summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authort h <t@h>2020-11-17 02:54:06 +0000
committerkali kaneko (leap communications) <kali@leap.se>2020-11-23 20:05:17 +0100
commit34553ffec72c769b400ba7047964f5953cac331a (patch)
treeae1ed2fc5ed296c8ec01df88b6f557c90dee9b0c
parente35caad676b34cfae336e60846c539ecba0a7dc7 (diff)
[feat] windows: pop-up on left click and notification on app start
- Related: #367, #370
-rw-r--r--gui/qml/main.qml59
1 files changed, 37 insertions, 22 deletions
diff --git a/gui/qml/main.qml b/gui/qml/main.qml
index e6c1964..028b373 100644
--- a/gui/qml/main.qml
+++ b/gui/qml/main.qml
@@ -93,26 +93,26 @@ ApplicationWindow {
console.debug(providers.getJson());
allowEmptyPass = shouldAllowEmptyPass();
- /* TODO get appVisible flag from backend */
+ /* TODO get appVisible flag from backend */
app.visible = false;
}
function toHuman(st) {
switch(st) {
case "off":
- //: %1 -> application name
+ //: %1 -> application name
return qsTr("%1 off").arg(ctx.appName);
case "on":
- //: %1 -> application name
+ //: %1 -> application name
return qsTr("%1 on").arg(ctx.appName);
case "connecting":
- //: %1 -> application name
+ //: %1 -> application name
return qsTr("Connecting to %1").arg(ctx.appName);
case "stopping":
- //: %1 -> application name
+ //: %1 -> application name
return qsTr("Stopping %1").arg(ctx.appName);
case "failed":
- //: %1 -> application name
+ //: %1 -> application name
return qsTr("%1 blocking internet").arg(ctx.appName); // TODO failed is not handed yet
}
}
@@ -135,25 +135,29 @@ ApplicationWindow {
// produce a segfault when trying to call menu.open()
// left and right click seem to be working fine, so let's ignore this for now.
switch (reason) {
- case SystemTrayIcon.Unknown:
- console.debug("reason: unknown")
- menu.open()
- break
- case SystemTrayIcon.Context:
- console.debug("activated: context")
- if (Qt.platform.os !== "linux") {
- menu.open()
- }
+ case SystemTrayIcon.Unknown:
+ console.debug("reason: unknown")
+ menu.open()
break
- case SystemTrayIcon.DoubleClick:
- console.debug("activated: double click")
- if (Qt.platform.os !== "linux") {
- menu.open()
- }
+ case SystemTrayIcon.Context:
+ console.debug("activated: context")
+ if (Qt.platform.os !== "linux") {
+ menu.open()
+ }
+ break
+ case SystemTrayIcon.DoubleClick:
+ console.debug("activated: double click")
+ if (Qt.platform.os !== "linux") {
+ menu.open()
+ }
break
- case SystemTrayIcon.Trigger:
+ case SystemTrayIcon.Trigger:
+ console.debug("activated: left click")
+ if (Qt.platform.os !== "linux") {
+ menu.open()
+ }
break
- case SystemTrayIcon.MiddleClick:
+ case SystemTrayIcon.MiddleClick:
break
}
}
@@ -165,6 +169,17 @@ ApplicationWindow {
hide();
if (systrayVisible) {
show();
+ showNotification("Is up and running. Please use system tray icon to control it.");
+ }
+ }
+
+ // Helper to show notification messages
+ function showNotification(msg) {
+ console.log("Going to show notification message: ", msg);
+ if (supportsMessages) {
+ showMessage("Riseup VPN", msg, null, 15000);
+ } else {
+ console.log("System doesn't support systray notifications");
}
}