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

Skip to content
Snippets Groups Projects
Commit e28c0d0b authored by hypercubus's avatar hypercubus Committed by zzz
Browse files

* removed systray support for KDE as it remains buggy; win32 is the only...

* removed systray support for KDE as it remains buggy; win32 is the only supported systray platform for now
* added an 'Open router console' option to the systray menu, for people who can't bring themselves to double-click the icon
parent 918df735
No related branches found
No related tags found
No related merge requests found
......@@ -27,10 +27,11 @@ public class SysTray implements SysTrayMenuListener {
private String _browserString;
private ConfigFile _configFile = new ConfigFile();
private Frame _frame;
private SysTrayMenuItem _itemOpenConsole = new SysTrayMenuItem("Open router console", "openconsole");
private SysTrayMenuItem _itemSelectBrowser = new SysTrayMenuItem("Select browser...", "selectbrowser");
private SysTrayMenuItem _itemShutdown = new SysTrayMenuItem("Shut down I2P router", "shutdown");
private SysTrayMenuIcon _sysTrayMenuIcon = new SysTrayMenuIcon("icons/iggy");
private SysTrayMenu _sysTrayMenu = new SysTrayMenu(_sysTrayMenuIcon, "I2P Router Console");
private SysTrayMenu _sysTrayMenu = new SysTrayMenu(_sysTrayMenuIcon, "I2P Control");
private UrlLauncher _urlLauncher = new UrlLauncher();
public SysTray() {
......@@ -45,37 +46,15 @@ public class SysTray implements SysTrayMenuListener {
}
public static void main(String[] args) {
new SysTray();
if (System.getProperty("os.name").startsWith("Windows"))
new SysTray();
}
public void iconLeftClicked(SysTrayMenuEvent e) {}
public void iconLeftDoubleClicked(SysTrayMenuEvent e) {
String browser = null;
if (_browserString == null || _browserString.equals("default")) {
try {
if (_urlLauncher.openUrl("http://localhost:7657/"))
return;
} catch (Exception ex) {
// Fall through.
}
} else {
try {
if (_urlLauncher.openUrl("http://localhost:7657/", _browserString))
return;
} catch (Exception ex) {
// Fall through.
}
}
if (!(browser = promptForBrowser("Please select another browser")).equals("nullnull"))
setBrowser(browser);
openRouterConsole();
}
public void menuItemSelected(SysTrayMenuEvent e) {
......@@ -96,6 +75,9 @@ public class SysTray implements SysTrayMenuListener {
if (!(browser = promptForBrowser("Select browser")).equals("nullnull"))
setBrowser(browser);
} else if (e.getActionCommand().equals("openconsole")) {
openRouterConsole();
}
}
......@@ -105,6 +87,35 @@ public class SysTray implements SysTrayMenuListener {
_sysTrayMenu.addItem(_itemShutdown);
_sysTrayMenu.addSeparator();
_sysTrayMenu.addItem(_itemSelectBrowser);
_sysTrayMenu.addItem(_itemOpenConsole);
}
private void openRouterConsole() {
String browser = null;
if (_browserString == null || _browserString.equals("default")) {
try {
if (_urlLauncher.openUrl("http://localhost:7657/"))
return;
} catch (Exception ex) {
// Fall through.
}
} else {
try {
if (_urlLauncher.openUrl("http://localhost:7657/", _browserString))
return;
} catch (Exception ex) {
// Fall through.
}
}
if (!(browser = promptForBrowser("Please select another browser")).equals("nullnull"))
setBrowser(browser);
}
private String promptForBrowser(String windowTitle) {
......
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