I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 8e6bade4 authored by str4d's avatar str4d
Browse files

Added checkbox to console to set theme universally across all apps

parent 3c4f1b78
No related branches found
No related tags found
No related merge requests found
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();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment