forked from I2P_Developers/i2p.i2p
Added checkbox to console to set theme universally across all apps
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Properties;
|
||||
|
||||
/** set the theme */
|
||||
public class ConfigUIHandler extends FormHandler {
|
||||
private boolean _shouldSave;
|
||||
private boolean _universalTheming;
|
||||
private String _config;
|
||||
|
||||
@Override
|
||||
@ -14,7 +16,9 @@ public class ConfigUIHandler extends FormHandler {
|
||||
}
|
||||
|
||||
public void setShouldsave(String moo) { _shouldSave = true; }
|
||||
|
||||
|
||||
public void setUniversalTheming(String baa) { _universalTheming = true; }
|
||||
|
||||
public void setTheme(String val) {
|
||||
_config = val;
|
||||
}
|
||||
@ -25,12 +29,18 @@ public class ConfigUIHandler extends FormHandler {
|
||||
return;
|
||||
Properties props = _context.readConfigFile(CSSHelper.THEME_CONFIG_FILE);
|
||||
String oldTheme = props.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME);
|
||||
boolean ok;
|
||||
if (_config.equals("default")) // obsolete
|
||||
props.put(CSSHelper.PROP_THEME_NAME, null);
|
||||
else
|
||||
props.put(CSSHelper.PROP_THEME_NAME, _config);
|
||||
ok = _context.writeConfigFile(CSSHelper.THEME_CONFIG_FILE, props);
|
||||
if (_universalTheming) {
|
||||
for (Iterator it = props.keySet().iterator(); it.hasNext();) {
|
||||
String key = (String) it.next();
|
||||
props.put(key, _config);
|
||||
}
|
||||
} else {
|
||||
if (_config.equals("default")) // obsolete
|
||||
props.put(CSSHelper.PROP_THEME_NAME, null);
|
||||
else
|
||||
props.put(CSSHelper.PROP_THEME_NAME, _config);
|
||||
}
|
||||
boolean ok = _context.writeConfigFile(CSSHelper.THEME_CONFIG_FILE, props);
|
||||
if (ok) {
|
||||
if (!oldTheme.equals(_config))
|
||||
addFormNotice(_("Theme change saved.") +
|
||||
|
@ -17,6 +17,9 @@ public class ConfigUIHelper extends HelperBase {
|
||||
buf.append("checked=\"checked\" ");
|
||||
buf.append("value=\"").append(theme).append("\">").append(_(theme)).append("<br>\n");
|
||||
}
|
||||
buf.append("<input type=\"checkbox\" name=\"universalTheming\" value=\"1\">")
|
||||
.append(_("Set theme universally across all apps"))
|
||||
.append("<br>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user