summaryrefslogtreecommitdiff
path: root/gui/qml
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2020-06-12 12:40:59 +0200
committerkali kaneko (leap communications) <kali@leap.se>2020-06-12 20:03:02 +0200
commit971c28f6563de35b1d66401d6919f86787af0611 (patch)
tree81ded50db137663acf6837e05e6df74507d346da /gui/qml
parent57b7f111c27f57085a2c64c37c5c5a94ee1d0f02 (diff)
[feat] working donate dialog
Signed-off-by: kali kaneko (leap communications) <kali@leap.se>
Diffstat (limited to 'gui/qml')
-rw-r--r--gui/qml/DonateDialog.qml27
-rw-r--r--gui/qml/main.qml23
2 files changed, 42 insertions, 8 deletions
diff --git a/gui/qml/DonateDialog.qml b/gui/qml/DonateDialog.qml
new file mode 100644
index 0000000..b7431ab
--- /dev/null
+++ b/gui/qml/DonateDialog.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+import QtQuick.Dialogs 1.2
+
+MessageDialog {
+ standardButtons: StandardButton.No | StandardButton.Yes
+ title: "Donate"
+ icon: StandardIcon.Warning
+ text: getText()
+
+ function getText() {
+ var _name = ctx ? ctx.appName : "vpn"
+ var donateTxt = qsTr(
+ "The %1 service is expensive to run. Because we don't want to store personal information about you, there are no accounts or billing for this service. But if you want the service to continue, donate at least $5 each month.\n\nDo you want to donate now?").arg(_name)
+ return donateTxt
+ }
+
+ onAccepted: {
+ if (backend) {
+ backend.donateAccepted(true)
+ }
+ }
+ onRejected: {
+ if (backend) {
+ backend.donateAccepted(false)
+ }
+ }
+}
diff --git a/gui/qml/main.qml b/gui/qml/main.qml
index 80e5e62..98eac80 100644
--- a/gui/qml/main.qml
+++ b/gui/qml/main.qml
@@ -11,10 +11,16 @@ ApplicationWindow {
property var ctx
+
Connections {
target: jsonModel
onDataChanged: {
ctx = JSON.parse(jsonModel.getJson());
+ if (ctx.donate == 'true') {
+ console.debug(jsonModel.getJson())
+ donate.visible = true
+ backend.toggleDonate()
+ }
}
}
@@ -92,6 +98,7 @@ ApplicationWindow {
StateGroup {
id: vpn
state: ctx ? ctx.status : ""
+
states: [
State { name: "initializing" },
State {
@@ -106,7 +113,7 @@ ApplicationWindow {
},
State {
name: "starting"
- PropertyChanges { target: systray; tooltip: toHuman("connecting"); icon.source: icons["wait"] }
+ PropertyChanges { target: systray; tooltip: toHuman("connecting"); icon.source: icons["wait"] }
PropertyChanges { target: statusItem; text: toHuman("connecting") }
},
State {
@@ -181,13 +188,17 @@ ApplicationWindow {
}
}
+ DonateDialog {
+ visible: false
+ id: donate
+ }
+}
+
+
/*
LoginDialog {
id: login
}
- DonateDialog {
- id: donate
- }
MessageDialog {
id: about
buttons: MessageDialog.Ok
@@ -223,7 +234,3 @@ ApplicationWindow {
visible: ctxSystray.errorInitMsg != ""
}
*/
-
-
-
-}