summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2020-06-16 21:28:48 +0200
committerkali kaneko (leap communications) <kali@leap.se>2020-06-26 12:12:41 +0200
commitc17b5f6f7b6b28c890764688ff5e966ecebece63 (patch)
tree4c9931b10e7cddd9050f76aff95205dbf04d6d26 /gui
parenta18e61aa1be37aa568552c69fbd743d25498b9bb (diff)
[feat] re-implement donation reminders
first pass on giving functionality to the donation reminder
Diffstat (limited to 'gui')
-rw-r--r--gui/backend.go11
-rw-r--r--gui/handlers.cpp16
-rw-r--r--gui/handlers.h4
-rw-r--r--gui/qml/DonateDialog.qml5
-rw-r--r--gui/qml/main.qml7
5 files changed, 32 insertions, 11 deletions
diff --git a/gui/backend.go b/gui/backend.go
index 9c65025..ab96edb 100644
--- a/gui/backend.go
+++ b/gui/backend.go
@@ -31,9 +31,14 @@ func Quit() {
}
-//export ToggleDonate
-func ToggleDonate() {
- backend.ToggleDonate()
+//export DonateAccepted
+func DonateAccepted() {
+ backend.DonateAccepted()
+}
+
+//export DonateRejected
+func DonateRejected() {
+ backend.DonateRejected()
}
//export SubscribeToEvent
diff --git a/gui/handlers.cpp b/gui/handlers.cpp
index e37de2d..39a5746 100644
--- a/gui/handlers.cpp
+++ b/gui/handlers.cpp
@@ -1,5 +1,7 @@
#include <QTimer>
#include <QDebug>
+#include <QDesktopServices>
+#include <QUrl>
#include "handlers.h"
#include "lib/libgoshim.h"
@@ -23,9 +25,19 @@ void Backend::unblock()
Unblock();
}
-void Backend::toggleDonate()
+void Backend::donateAccepted()
{
- ToggleDonate();
+ DonateAccepted();
+}
+
+void Backend::donateRejected()
+{
+ DonateRejected();
+}
+
+void Backend::openURL(QString link)
+{
+ QDesktopServices::openUrl(QUrl(link));
}
void Backend::quit()
diff --git a/gui/handlers.h b/gui/handlers.h
index 3fe9eed..e65fd5e 100644
--- a/gui/handlers.h
+++ b/gui/handlers.h
@@ -33,7 +33,9 @@ public slots:
void switchOn();
void switchOff();
void unblock();
- void toggleDonate();
+ void donateAccepted();
+ void donateRejected();
+ void openURL(QString link);
void quit();
};
diff --git a/gui/qml/DonateDialog.qml b/gui/qml/DonateDialog.qml
index b7431ab..eb761a4 100644
--- a/gui/qml/DonateDialog.qml
+++ b/gui/qml/DonateDialog.qml
@@ -16,12 +16,13 @@ MessageDialog {
onAccepted: {
if (backend) {
- backend.donateAccepted(true)
+ backend.openURL(ctx.donateURL)
+ backend.donateAccepted()
}
}
onRejected: {
if (backend) {
- backend.donateAccepted(false)
+ backend.donateRejected()
}
}
}
diff --git a/gui/qml/main.qml b/gui/qml/main.qml
index 98eac80..65c09cb 100644
--- a/gui/qml/main.qml
+++ b/gui/qml/main.qml
@@ -16,10 +16,9 @@ ApplicationWindow {
target: jsonModel
onDataChanged: {
ctx = JSON.parse(jsonModel.getJson());
- if (ctx.donate == 'true') {
+ if (ctx.donateDialog == 'true') {
console.debug(jsonModel.getJson())
donate.visible = true
- backend.toggleDonate()
}
}
}
@@ -171,7 +170,9 @@ ApplicationWindow {
MenuItem {
text: qsTr("Donate...")
visible: true
- //onTriggered: donate.open()
+ onTriggered: {
+ donate.visible = true
+ }
}
MenuItem {