Improve ImportKeys popup closing/cancelling

- Once the importing process starts, only allow the popup to be closed
  by pressing pressing esc or clicking the Cancel button, to prevent
  accidental clicks

- When closing the popup without clicking the Cancel button, cancel the
  import process
This commit is contained in:
miruka 2020-05-28 14:06:29 -04:00
parent ee58b0cee4
commit 0f6f3bce98

View File

@ -1,6 +1,7 @@
// SPDX-License-Identifier: LGPL-3.0-or-later // SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Controls 2.12
import Qt.labs.platform 1.1 import Qt.labs.platform 1.1
import "../Popups" import "../Popups"
import "../PythonBridge" import "../PythonBridge"
@ -27,7 +28,7 @@ HFileDialogOpener {
qsTr("Passphrase used to protect this file:") qsTr("Passphrase used to protect this file:")
okText: qsTr("Import") okText: qsTr("Import")
onCancelled: if (importFuture) importFuture.cancel() onClosed: if (importFuture) importFuture.cancel()
property url file: "" property url file: ""
@ -73,5 +74,11 @@ HFileDialogOpener {
if (unknown) utils.showError(type, traceback, uuid) if (unknown) utils.showError(type, traceback, uuid)
}) })
} }
Binding on closePolicy {
value: Popup.CloseOnEscape
when: importing
}
} }
} }