2019-12-19 22:46:16 +11:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2019-09-10 04:42:58 +10:00
|
|
|
import QtQuick 2.12
|
|
|
|
import Qt.labs.platform 1.1
|
|
|
|
import "../Popups"
|
|
|
|
|
|
|
|
HFileDialogOpener {
|
2019-12-08 03:45:20 +11:00
|
|
|
// This is used for the SignOutPopup to know when the export is done
|
2019-11-30 20:50:56 +11:00
|
|
|
// so it can close
|
2019-09-10 04:49:54 +10:00
|
|
|
signal done()
|
|
|
|
|
2019-09-10 04:42:58 +10:00
|
|
|
property string userId: ""
|
|
|
|
property bool exporting: false
|
|
|
|
|
|
|
|
function exportKeys(file, passphrase) {
|
|
|
|
exporting = true
|
|
|
|
|
2020-03-08 19:46:20 +11:00
|
|
|
const path = file.toString().replace(/^file:\/\//, "")
|
2019-09-10 04:42:58 +10:00
|
|
|
|
|
|
|
py.callClientCoro(userId, "export_keys", [path, passphrase], () => {
|
|
|
|
exporting = false
|
2019-09-10 04:49:54 +10:00
|
|
|
done()
|
2019-09-10 04:42:58 +10:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-12 14:25:57 +10:00
|
|
|
fill: false
|
|
|
|
dialog.title: qsTr("Save decryption keys file as...")
|
|
|
|
dialog.fileMode: FileDialog.SaveFile
|
|
|
|
onFilePicked: {
|
|
|
|
exportPasswordPopup.file = file
|
|
|
|
exportPasswordPopup.open()
|
|
|
|
}
|
|
|
|
|
2019-09-10 04:42:58 +10:00
|
|
|
PasswordPopup {
|
|
|
|
id: exportPasswordPopup
|
2020-07-12 14:25:57 +10:00
|
|
|
|
|
|
|
property url file: ""
|
|
|
|
|
2020-06-25 22:32:08 +10:00
|
|
|
summary.text: qsTr("Passphrase to protect this file:")
|
|
|
|
validateButton.text: qsTr("Export")
|
2020-06-26 18:06:01 +10:00
|
|
|
validateButton.icon.name: "export-keys"
|
2019-09-10 04:42:58 +10:00
|
|
|
|
|
|
|
onAcceptedPasswordChanged: exportKeys(file, acceptedPassword)
|
|
|
|
}
|
|
|
|
}
|