From 00d9cdd235f8be27780a742d84eb22ce2c89f759 Mon Sep 17 00:00:00 2001 From: "kali kaneko (leap communications)" Date: Tue, 1 Jun 2021 11:28:34 +0200 Subject: [refactor] move logic to js file --- gui/qml/logic.js | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'gui/qml/logic.js') diff --git a/gui/qml/logic.js b/gui/qml/logic.js index 4fdbb99..582b824 100644 --- a/gui/qml/logic.js +++ b/gui/qml/logic.js @@ -34,6 +34,35 @@ function toHuman(st) { case "failed": //: %1 -> application name return qsTr("%1 blocking internet").arg( - ctx.appName) // TODO failed is not handed yet + ctx.appName) // TODO failed is not handled yet } } + +// Helper to show notification messages +function showNotification(ctx, msg) { + console.log("Going to show notification message: ", msg) + if (supportsMessages) { + let appname = ctx ? ctx.appName : "VPN" + showMessage(appname, msg, null, 15000) + } else { + console.log("System doesn't support systray notifications") + } +} + +function shouldAllowEmptyPass(providers) { + let obj = JSON.parse(providers.getJson()) + let active = obj['default'] + let allProviders = obj['providers'] + for (var i = 0; i < allProviders.length; i++) { + if (allProviders[i]['name'] === active) { + return (allProviders[i]['authEmptyPass'] === 'true') + } + } + return false +} + +function debugInit() { + console.debug("Platform:", Qt.platform.os) + console.debug("DEBUG: Pre-seeded providers:") + console.debug(providers.getJson()) +} -- cgit v1.2.3