2019-09-10 04:42:58 +10:00
|
|
|
import QtQuick 2.12
|
|
|
|
import Qt.labs.platform 1.1
|
|
|
|
import "../Popups"
|
|
|
|
|
|
|
|
HFileDialogOpener {
|
|
|
|
fill: false
|
|
|
|
dialog.title: qsTr("Save decryption keys file as...")
|
|
|
|
dialog.fileMode: FileDialog.SaveFile
|
|
|
|
onFileChanged: {
|
|
|
|
exportPasswordPopup.file = file
|
|
|
|
exportPasswordPopup.open()
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
let path = file.toString().replace(/^file:\/\//, "")
|
|
|
|
|
|
|
|
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
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PasswordPopup {
|
|
|
|
id: exportPasswordPopup
|
|
|
|
details.text: qsTr("Please enter a passphrase to protect this file:")
|
|
|
|
okText: qsTr("Export")
|
|
|
|
|
|
|
|
onAcceptedPasswordChanged: exportKeys(file, acceptedPassword)
|
|
|
|
|
|
|
|
property url file: ""
|
|
|
|
}
|
|
|
|
}
|