From 20266b063c1be8818d4582bff7b59486551ee447 Mon Sep 17 00:00:00 2001 From: "kali kaneko (leap communications)" Date: Wed, 17 Jun 2020 21:14:35 +0200 Subject: [feat] pass initialization errors to gui --- gui/qml/main.qml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'gui/qml/main.qml') diff --git a/gui/qml/main.qml b/gui/qml/main.qml index 8d756c6..efcfef2 100644 --- a/gui/qml/main.qml +++ b/gui/qml/main.qml @@ -11,7 +11,6 @@ ApplicationWindow { property var ctx - Connections { target: jsonModel onDataChanged: { @@ -20,9 +19,24 @@ ApplicationWindow { console.debug(jsonModel.getJson()) donate.visible = true } + if (ctx.errors ) { + // TODO consider disabling on/off buttons, or quit after closing the dialog + if ( ctx.errors == "nohelpers" ) { + showInitFailure(qsTr("Could not find helpers. Check your installation")) + } else if ( ctx.errors == "nopolkit" ) { + showInitFailure(qsTr("Could not find polkit agent.")) + } else { + console.debug(ctx.errors) + } + } } } + function showInitFailure(msg) { + initFailure.text = msg + initFailure.visible = true + } + Component.onCompleted: { /* stupid as it sounds, windows doesn't like to have the systray icon not being attached to an actual application window. @@ -210,9 +224,6 @@ ApplicationWindow { text: "" detailedText: "" visible: false - //text: ctx ? qsTr("Can't connect to %1").arg(ctx.appName) : "" - //detailedText: ctx ? ctx.errorStartingMsg : "" - //visible: ctx.errorStartingMsg != "" } MessageDialog { @@ -222,7 +233,6 @@ ApplicationWindow { title: qsTr("Missing authentication agent") text: qsTr("Could not find a polkit authentication agent. Please run one and try again.") visible: false - //visible: ctx.missingAuthAgent == "true" } MessageDialog { @@ -232,7 +242,5 @@ ApplicationWindow { title: qsTr("Initialization Error") text: "" visible: false - //text: ctx ? ctx.errorInitMsg : "" - //visible: ctx.errorInitMsg != "" } } -- cgit v1.2.3