summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2020-08-06 13:01:22 +0200
committerkali kaneko (leap communications) <kali@leap.se>2020-08-20 20:27:44 +0200
commit60a35bdde41e8648594dc6a501a11000081ff878 (patch)
tree20336cb66893e265c9125f66dc3e942ff8e1c467 /gui
parent249a8844b1aaf2cd2bf6fddc8da10a4defb656d2 (diff)
[pkg] add float-deployed demo libpvn for tests
Diffstat (limited to 'gui')
-rw-r--r--gui/backend.go5
-rw-r--r--gui/handlers.cpp12
-rw-r--r--gui/handlers.h1
-rw-r--r--gui/qml/LoginDialog.qml5
-rw-r--r--gui/qml/main.qml4
5 files changed, 24 insertions, 3 deletions
diff --git a/gui/backend.go b/gui/backend.go
index 536ade3..a5cb3ab 100644
--- a/gui/backend.go
+++ b/gui/backend.go
@@ -22,6 +22,11 @@ func GetAppName() *C.char {
return (*C.char)(backend.GetAppName())
}
+//export Login
+func Login(username, password *C.char) {
+ backend.Login(C.GoString(username), C.GoString(password))
+}
+
//export SwitchOn
func SwitchOn() {
backend.SwitchOn()
diff --git a/gui/handlers.cpp b/gui/handlers.cpp
index ab64afb..3959964 100644
--- a/gui/handlers.cpp
+++ b/gui/handlers.cpp
@@ -35,6 +35,18 @@ void Backend::donateAccepted()
DonateAccepted();
}
+void Backend::login(QString username, QString password)
+{
+ // TODO: there has to be a cleaner way to do the conversion
+ char * u = new char [username.length()+1];
+ char * p = new char [password.length()+1];
+ strcpy(u, username.toStdString().c_str());
+ strcpy(p, password.toStdString().c_str());
+ Login(u, p);
+ delete [] u;
+ delete [] p;
+}
+
void Backend::quit()
{
Quit();
diff --git a/gui/handlers.h b/gui/handlers.h
index 62a733d..656a451 100644
--- a/gui/handlers.h
+++ b/gui/handlers.h
@@ -35,6 +35,7 @@ public slots:
void switchOn();
void switchOff();
void donateAccepted();
+ void login(QString username, QString password);
void quit();
};
diff --git a/gui/qml/LoginDialog.qml b/gui/qml/LoginDialog.qml
index 0c0f18e..1724769 100644
--- a/gui/qml/LoginDialog.qml
+++ b/gui/qml/LoginDialog.qml
@@ -22,7 +22,6 @@ Dialog {
}
visible: false
- //visible: ctx.showLogin == true
- //onAccepted: backend.login(username.text, password.text)
- onRejected: backend.quit() // TODO: it doesn't close
+ onAccepted: backend.login(username.text, password.text)
+ onRejected: backend.quit()
}
diff --git a/gui/qml/main.qml b/gui/qml/main.qml
index 09bbab5..0242493 100644
--- a/gui/qml/main.qml
+++ b/gui/qml/main.qml
@@ -19,6 +19,10 @@ ApplicationWindow {
console.debug(jsonModel.getJson())
donate.visible = true
}
+ if (ctx.loginDialog == 'true') {
+ console.debug(jsonModel.getJson())
+ login.visible = true
+ }
if (ctx.errors ) {
if ( ctx.errors == "nohelpers" ) {
showInitFailure(qsTr("Could not find helpers. Check your installation"))