|
@@ -23,6 +23,7 @@
|
23
|
23
|
package com.dmdirc.addons.ui_swing.components;
|
24
|
24
|
|
25
|
25
|
import com.dmdirc.addons.ui_swing.dialogs.url.URLSubsitutionsPanel;
|
|
26
|
+import com.dmdirc.interfaces.config.AggregateConfigProvider;
|
26
|
27
|
import com.dmdirc.interfaces.config.ConfigProvider;
|
27
|
28
|
import com.dmdirc.ui.core.util.URLHandler;
|
28
|
29
|
|
|
@@ -53,8 +54,10 @@ public class URLProtocolPanel extends JPanel implements ActionListener,
|
53
|
54
|
|
54
|
55
|
/** Serial version UID. */
|
55
|
56
|
private static final long serialVersionUID = 1;
|
56
|
|
- /** Config. */
|
57
|
|
- private final ConfigProvider config;
|
|
57
|
+ /** Global config. */
|
|
58
|
+ private final AggregateConfigProvider globalConfig;
|
|
59
|
+ /** User settings. */
|
|
60
|
+ private final ConfigProvider userSettings;
|
58
|
61
|
/** URL. */
|
59
|
62
|
private final URI uri;
|
60
|
63
|
/** Show insets? */
|
|
@@ -83,15 +86,19 @@ public class URLProtocolPanel extends JPanel implements ActionListener,
|
83
|
86
|
/**
|
84
|
87
|
* Instantiates the URLDialog.
|
85
|
88
|
*
|
86
|
|
- * @param config Configuration
|
87
|
|
- * @param url URL to open once added
|
88
|
|
- * @param useInsets Show insets?
|
|
89
|
+ * @param globalConfig Global configuration
|
|
90
|
+ * @param userSettings User settings
|
|
91
|
+ * @param url URL to open once added
|
|
92
|
+ * @param useInsets Show insets?
|
89
|
93
|
*/
|
90
|
|
- public URLProtocolPanel(final ConfigProvider config, final URI url,
|
|
94
|
+ public URLProtocolPanel(final AggregateConfigProvider globalConfig,
|
|
95
|
+ final ConfigProvider userSettings,
|
|
96
|
+ final URI url,
|
91
|
97
|
final boolean useInsets) {
|
92
|
98
|
super();
|
93
|
99
|
|
94
|
|
- this.config = config;
|
|
100
|
+ this.globalConfig = globalConfig;
|
|
101
|
+ this.userSettings = userSettings;
|
95
|
102
|
uri = url;
|
96
|
103
|
this.useInsets = useInsets;
|
97
|
104
|
|
|
@@ -165,7 +172,7 @@ public class URLProtocolPanel extends JPanel implements ActionListener,
|
165
|
172
|
|
166
|
173
|
/** Saves the settings. */
|
167
|
174
|
public void save() {
|
168
|
|
- config.setOption("protocol", uri.getScheme().toLowerCase(), getSelection());
|
|
175
|
+ userSettings.setOption("protocol", uri.getScheme().toLowerCase(), getSelection());
|
169
|
176
|
}
|
170
|
177
|
|
171
|
178
|
/**
|
|
@@ -204,8 +211,8 @@ public class URLProtocolPanel extends JPanel implements ActionListener,
|
204
|
211
|
* Updates the selection.
|
205
|
212
|
*/
|
206
|
213
|
public void updateSelection() {
|
207
|
|
- if (uri != null && config.hasOptionString("protocol", uri.getScheme())) {
|
208
|
|
- final String option = config.getOption("protocol", uri.getScheme());
|
|
214
|
+ if (uri != null && globalConfig.hasOptionString("protocol", uri.getScheme())) {
|
|
215
|
+ final String option = globalConfig.getOption("protocol", uri.getScheme());
|
209
|
216
|
switch (option) {
|
210
|
217
|
case "DMDIRC":
|
211
|
218
|
optionType.setSelected(dmdirc.getModel(), true);
|