summaryrefslogtreecommitdiff
path: root/gui/qml/main.qml
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2020-09-08 16:51:32 +0200
committerkali kaneko (leap communications) <kali@leap.se>2020-09-08 20:10:17 +0200
commite217f990bcdc687b8c0cdf8f84929aaf5aa8f935 (patch)
treea71583b024a9a0cc5115d472206973cbea555bd1 /gui/qml/main.qml
parenta40434d402ceb9cfacff59aeeab12a3d6b13a0ed (diff)
[feat] improve phrasing for login dialog, split into its own file
Diffstat (limited to 'gui/qml/main.qml')
-rw-r--r--gui/qml/main.qml39
1 files changed, 20 insertions, 19 deletions
diff --git a/gui/qml/main.qml b/gui/qml/main.qml
index f030345..4d0e648 100644
--- a/gui/qml/main.qml
+++ b/gui/qml/main.qml
@@ -37,16 +37,30 @@ ApplicationWindow {
} else if ( ctx.errors == "nopolkit" ) {
showInitFailure(qsTr("Could not find polkit agent."))
} else {
- //: %1 -> application name
- //: %2 -> error string
- showInitFailure(qsTr("Got an error starting %1: %2").arg(ctx.appName).arg(ctx.errors))
- console.debug(ctx.errors)
+ showInitFailure()
}
}
}
}
function showInitFailure(msg) {
+ console.debug("ERRORS:", ctx.errors)
+ if (msg == undefined) {
+ if (ctx.errors == 'bad_auth') {
+ if (allowEmptyPass) {
+ // For now, this is a libraryVPN, so we can be explicit about what credentials are here.
+ // Another option to consider is to customize the error strings while vendoring.
+ msg = qsTr("Please check your Patron ID")
+ } else {
+ msg = qsTr("Could not log in with those credentials, please retry")
+ }
+ initFailure.title = qsTr("Login Error")
+ } else {
+ //: %1 -> application name
+ //: %2 -> error string
+ msg = qsTr("Got an error starting %1: %2").arg(ctx.appName).arg(ctx.errors)
+ }
+ }
initFailure.text = msg
initFailure.visible = true
}
@@ -249,6 +263,7 @@ ApplicationWindow {
id: about
visible: false
}
+
LoginDialog {
id: login
@@ -279,22 +294,8 @@ ApplicationWindow {
visible: false
}
- MessageDialog {
+ FailDialog {
id: initFailure
- buttons: MessageDialog.Ok
- modality: Qt.NonModal
- title: qsTr("Initialization Error")
- text: ""
visible: false
- onAccepted: retryOrQuit()
- onRejected: retryOrQuit()
-
- function retryOrQuit() {
- if (ctx.loginDialog == 'true') {
- login.visible = true
- } else {
- backend.quit()
- }
- }
}
}