GODT-1516: Return notification on missing keychain

This commit is contained in:
Jakub
2022-02-23 12:00:20 +01:00
committed by Jakub Cuth
parent c920c53243
commit cf75ea739f
3 changed files with 38 additions and 20 deletions

View File

@ -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()

View File

@ -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()
}
}
]
}

View File

@ -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
}
}