diff --git a/internal/frontend/qml/Bridge_test.qml b/internal/frontend/qml/Bridge_test.qml index bab4b7b5..728c1545 100644 --- a/internal/frontend/qml/Bridge_test.qml +++ b/internal/frontend/qml/Bridge_test.qml @@ -55,6 +55,26 @@ Window { function getCursorPos() { return BridgePreview.getCursorPos() } + + function restart() { + root.quit() + console.log("Restarting....") + root.openBridge() + } + + function openBridge() { + bridge = bridgeComponent.createObject() + var showSetupGuide = false + if (showSetupGuide) { + var newUserObject = root.userComponent.createObject(root) + newUserObject.username = "LerooooyJenkins@protonmail.com" + newUserObject.loggedIn = true + newUserObject.setupGuideSeen = false + root.users.append( { object: newUserObject } ) + } + } + + function quit() { if (bridge !== undefined && bridge !== null) { bridge.destroy() @@ -367,18 +387,7 @@ Window { text: "Open Bridge" enabled: bridge === undefined || bridge === null - onClicked: { - bridge = bridgeComponent.createObject() - var showSetupGuide = false - if (showSetupGuide) { - var newUserObject = root.userComponent.createObject(root) - newUserObject.username = "LerooooyJenkins@protonmail.com" - newUserObject.loggedIn = true - newUserObject.setupGuideSeen = false - root.users.append( { object: newUserObject } ) - } - - } + onClicked: root.openBridge() } Button { @@ -589,7 +598,7 @@ Window { text: "No keychain" colorScheme: root.colorScheme onClicked: { - root.hasNoKeychain() + root.notifyHasNoKeychain() } } } @@ -815,7 +824,7 @@ Window { root.changeKeychainFinished() } signal changeKeychainFinished() - signal hasNoKeychain() + signal notifyHasNoKeychain() signal noActiveKeyForRecipient(string email) signal showMainWindow() diff --git a/internal/frontend/qml/Notifications/Notifications.qml b/internal/frontend/qml/Notifications/Notifications.qml index 8a5bc5be..c4fc32ea 100644 --- a/internal/frontend/qml/Notifications/Notifications.qml +++ b/internal/frontend/qml/Notifications/Notifications.qml @@ -870,7 +870,7 @@ QtObject { property Notification noKeychain: Notification { title: qsTr("No keychain available") - description: qsTr("Bridge is not able to detected a supported password manager (pass or secret-service). Please install and setup supported password manager and restart the application.") + description: qsTr("Bridge is not able to detect a supported password manager (pass or secret-service). Please install and setup supported password manager and restart the application.") brief: title icon: "./icons/ic-exclamation-circle-filled.svg" type: Notification.NotificationType.Danger @@ -879,7 +879,7 @@ QtObject { Connections { target: root.backend - onHasNoKeychain: { + onNotifyHasNoKeychain: { root.noKeychain.active = true } } @@ -891,6 +891,13 @@ QtObject { onTriggered: { root.backend.quit() } + }, + Action { + text: qsTr("Restart Bridge") + + onTriggered: { + root.backend.restart() + } } ] } diff --git a/pkg/keychain/helper_linux.go b/pkg/keychain/helper_linux.go index 0dcb7f86..2f48f76c 100644 --- a/pkg/keychain/helper_linux.go +++ b/pkg/keychain/helper_linux.go @@ -35,17 +35,19 @@ const ( func init() { // nolint[noinit] Helpers = make(map[string]helperConstructor) - Helpers[SecretService] = newSecretServiceHelper + if isUsable(newSecretServiceHelper("")) { + Helpers[SecretService] = newSecretServiceHelper + } - if _, err := exec.LookPath("pass"); err == nil { + if _, err := exec.LookPath("pass"); err == nil && isUsable(newPassHelper("")) { Helpers[Pass] = newPassHelper } // If Pass is available, use it by default. // Otherwise, if SecretService is available, use it by default. - if _, ok := Helpers[Pass]; ok && isUsable(newPassHelper("")) { + if _, ok := Helpers[Pass]; ok { defaultHelper = Pass - } else if isUsable(newSecretServiceHelper("")) { + } else if _, ok := Helpers[SecretService]; ok { defaultHelper = SecretService } }