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() { function getCursorPos() {
return BridgePreview.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() { function quit() {
if (bridge !== undefined && bridge !== null) { if (bridge !== undefined && bridge !== null) {
bridge.destroy() bridge.destroy()
@ -367,18 +387,7 @@ Window {
text: "Open Bridge" text: "Open Bridge"
enabled: bridge === undefined || bridge === null enabled: bridge === undefined || bridge === null
onClicked: { onClicked: root.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 } )
}
}
} }
Button { Button {
@ -589,7 +598,7 @@ Window {
text: "No keychain" text: "No keychain"
colorScheme: root.colorScheme colorScheme: root.colorScheme
onClicked: { onClicked: {
root.hasNoKeychain() root.notifyHasNoKeychain()
} }
} }
} }
@ -815,7 +824,7 @@ Window {
root.changeKeychainFinished() root.changeKeychainFinished()
} }
signal changeKeychainFinished() signal changeKeychainFinished()
signal hasNoKeychain() signal notifyHasNoKeychain()
signal noActiveKeyForRecipient(string email) signal noActiveKeyForRecipient(string email)
signal showMainWindow() signal showMainWindow()

View File

@ -870,7 +870,7 @@ QtObject {
property Notification noKeychain: Notification { property Notification noKeychain: Notification {
title: qsTr("No keychain available") 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 brief: title
icon: "./icons/ic-exclamation-circle-filled.svg" icon: "./icons/ic-exclamation-circle-filled.svg"
type: Notification.NotificationType.Danger type: Notification.NotificationType.Danger
@ -879,7 +879,7 @@ QtObject {
Connections { Connections {
target: root.backend target: root.backend
onHasNoKeychain: { onNotifyHasNoKeychain: {
root.noKeychain.active = true root.noKeychain.active = true
} }
} }
@ -891,6 +891,13 @@ QtObject {
onTriggered: { onTriggered: {
root.backend.quit() root.backend.quit()
} }
},
Action {
text: qsTr("Restart Bridge")
onTriggered: {
root.backend.restart()
}
} }
] ]
} }

View File

@ -35,17 +35,19 @@ const (
func init() { // nolint[noinit] func init() { // nolint[noinit]
Helpers = make(map[string]helperConstructor) Helpers = make(map[string]helperConstructor)
if isUsable(newSecretServiceHelper("")) {
Helpers[SecretService] = newSecretServiceHelper Helpers[SecretService] = newSecretServiceHelper
}
if _, err := exec.LookPath("pass"); err == nil { if _, err := exec.LookPath("pass"); err == nil && isUsable(newPassHelper("")) {
Helpers[Pass] = newPassHelper Helpers[Pass] = newPassHelper
} }
// If Pass is available, use it by default. // If Pass is available, use it by default.
// Otherwise, if SecretService 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 defaultHelper = Pass
} else if isUsable(newSecretServiceHelper("")) { } else if _, ok := Helpers[SecretService]; ok {
defaultHelper = SecretService defaultHelper = SecretService
} }
} }