summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2021-06-22 17:10:26 +0200
committerkali kaneko (leap communications) <kali@leap.se>2021-06-22 18:04:46 +0200
commit45c13d49936009f095629ef6f6d82aae768b20f3 (patch)
tree98e15d3cc4f318053874381e7826b8e6500ad212 /gui
parent326dc2449a69c9ea97cb5c2936807e9045dc1aa7 (diff)
[feat] only show donate dialog after first connect when due
- Cloases: #470
Diffstat (limited to 'gui')
-rw-r--r--gui/qml/VpnState.qml6
-rw-r--r--gui/qml/logic.js20
-rw-r--r--gui/qml/main.qml8
3 files changed, 22 insertions, 12 deletions
diff --git a/gui/qml/VpnState.qml b/gui/qml/VpnState.qml
index b18d6b5..86239e4 100644
--- a/gui/qml/VpnState.qml
+++ b/gui/qml/VpnState.qml
@@ -48,6 +48,12 @@ StateGroup {
script: {
Logic.setNeedsReconnect(false);
brReconnect = false;
+
+ if (needsDonate && !shownDonate) {
+ donate.visible = true;
+ shownDonate = true;
+ backend.donateSeen();
+ }
}
}
diff --git a/gui/qml/logic.js b/gui/qml/logic.js
index 582b824..10ebfcd 100644
--- a/gui/qml/logic.js
+++ b/gui/qml/logic.js
@@ -1,5 +1,13 @@
-let status = 'off';
-let needsReconnect = false;
+var status = 'off';
+var needsReconnect = false;
+
+function setNeedsReconnect(val) {
+ needsReconnect = val;
+}
+
+function getNeedsReconnect() {
+ return needsReconnect;
+}
function setStatus(st) {
status = st;
@@ -9,12 +17,8 @@ function getStatus() {
return status;
}
-function setNeedsReconnect(val) {
- needsReconnect = val;
-}
-
-function getNeedsReconnect() {
- return needsReconnect;
+function setNeedsDonate(val) {
+ needsDonate = val;
}
function toHuman(st) {
diff --git a/gui/qml/main.qml b/gui/qml/main.qml
index e0a9a81..e12c61d 100644
--- a/gui/qml/main.qml
+++ b/gui/qml/main.qml
@@ -21,7 +21,8 @@ ApplicationWindow {
property var loginDone
property var allowEmptyPass
property var needsRestart
-
+ property var needsDonate
+ property var shownDonate
onSceneGraphError: function(error, msg) {
console.debug("ERROR while initializing scene")
@@ -189,9 +190,7 @@ ApplicationWindow {
gwSelector.model = Object.keys(ctx.locations)
if (ctx.donateDialog == 'true') {
- console.debug(jsonModel.getJson())
- donate.visible = true
- backend.donateSeen()
+ Logic.setNeedsDonate(true);
}
if (ctx.loginDialog == 'true') {
console.debug(jsonModel.getJson())
@@ -276,6 +275,7 @@ ApplicationWindow {
loginDone = false
allowEmptyPass = Logic.shouldAllowEmptyPass(providers)
needsRestart = false;
+ shownDonate = false;
if (!systrayAvailable) {
app.visible = true
app.raise()