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 {
|
|
|
|
fill: false
|
|
|
|
dialog.title: qsTr("Save decryption keys file as...")
|
|
|
|
dialog.fileMode: FileDialog.SaveFile
|
2019-11-06 23:55:47 +11:00
|
|
|
onFilePicked: {
|
2019-09-10 04:42:58 +10:00
|
|
|
exportPasswordPopup.file = file
|
|
|
|
exportPasswordPopup.open()
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PasswordPopup {
|
|
|
|
id: exportPasswordPopup
|
2020-03-18 04:40:58 +11:00
|
|
|
details.text: qsTr("Passphrase to protect this file:")
|
2019-09-10 04:42:58 +10:00
|
|
|
okText: qsTr("Export")
|
|
|
|
|
|
|
|
onAcceptedPasswordChanged: exportKeys(file, acceptedPassword)
|
|
|
|
|
|
|
|
property url file: ""
|
|
|
|
}
|
|
|
|
}
|