Really cancel key import when clicking "Cancel"
This commit is contained in:
parent
cb020ad479
commit
6662628b4e
|
@ -3,6 +3,7 @@
|
|||
import QtQuick 2.12
|
||||
import Qt.labs.platform 1.1
|
||||
import "../Popups"
|
||||
import "../PythonBridge"
|
||||
|
||||
HFileDialogOpener {
|
||||
fill: false
|
||||
|
@ -15,27 +16,37 @@ HFileDialogOpener {
|
|||
|
||||
property string userId: ""
|
||||
property bool importing: false
|
||||
property Future importFuture: null
|
||||
|
||||
|
||||
PasswordPopup {
|
||||
id: importPasswordPopup
|
||||
details.text: qsTr("Passphrase used to protect this file:")
|
||||
details.text:
|
||||
importing ?
|
||||
qsTr("This might take a while...") :
|
||||
qsTr("Passphrase used to protect this file:")
|
||||
okText: qsTr("Import")
|
||||
|
||||
onCancelled: if (importFuture) importFuture.cancel()
|
||||
|
||||
|
||||
property url file: ""
|
||||
|
||||
|
||||
function verifyPassword(pass, callback) {
|
||||
importing = true
|
||||
|
||||
const call = py.callClientCoro
|
||||
const path = file.toString().replace(/^file:\/\//, "")
|
||||
|
||||
py.callClientCoro(userId, "import_keys", [path, pass], () => {
|
||||
importing = false
|
||||
importFuture = call(userId, "import_keys", [path, pass], () => {
|
||||
importing = false
|
||||
importFuture = null
|
||||
callback(true)
|
||||
|
||||
}, (type, args, error, traceback, uuid) => {
|
||||
let unknown = false
|
||||
let unknown = false
|
||||
importFuture = null
|
||||
|
||||
callback(
|
||||
type === "EncryptionError" ?
|
||||
|
|
|
@ -17,6 +17,9 @@ BoxPopup {
|
|||
onOpened: passwordField.forceActiveFocus()
|
||||
|
||||
|
||||
signal cancelled()
|
||||
|
||||
|
||||
property bool validateWhileTyping: false
|
||||
|
||||
property string acceptedPassword: ""
|
||||
|
@ -54,7 +57,10 @@ BoxPopup {
|
|||
button.loading = false
|
||||
})
|
||||
},
|
||||
cancel: button => { popup.close() },
|
||||
cancel: button => {
|
||||
popup.close()
|
||||
cancelled()
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user