2019-07-25 16:43:52 +10:00
|
|
|
import QtQuick 2.12
|
|
|
|
import "../../Base"
|
|
|
|
|
2019-08-28 17:54:53 +10:00
|
|
|
HLoader {
|
2019-09-06 07:51:38 +10:00
|
|
|
id: encryptionUI
|
|
|
|
source:
|
|
|
|
accountInfo.import_error[0] ? "ImportError.qml" :
|
|
|
|
importing || accountInfo.total_keys_to_import ? "ImportingKeys.qml" :
|
|
|
|
"ImportExportKeys.qml"
|
|
|
|
|
|
|
|
onSourceChanged: animation.running = true
|
|
|
|
|
|
|
|
|
2019-08-29 01:42:52 +10:00
|
|
|
property bool importing: false
|
|
|
|
|
|
|
|
|
2019-09-08 09:17:32 +10:00
|
|
|
function exportKeys(file, passphrase, button=null) {
|
|
|
|
if (button) button.loading = true
|
|
|
|
|
|
|
|
let path = file.toString().replace(/^file:\/\//, "")
|
|
|
|
|
|
|
|
py.callClientCoro(
|
|
|
|
editAccount.userId, "export_keys", [path, passphrase], () => {
|
|
|
|
// null: user is on another page
|
|
|
|
if (encryptionUI !== null && button) button.loading = false
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2019-08-29 01:42:52 +10:00
|
|
|
function importKeys(file, passphrase, button=null) {
|
|
|
|
if (button) button.loading = true
|
2019-09-06 07:51:38 +10:00
|
|
|
encryptionUI.importing = true
|
2019-08-29 01:42:52 +10:00
|
|
|
|
|
|
|
let path = file.toString().replace(/^file:\/\//, "")
|
|
|
|
|
|
|
|
py.callClientCoro(
|
|
|
|
editAccount.userId, "import_keys", [path, passphrase], () => {
|
2019-09-08 09:17:32 +10:00
|
|
|
if (encryptionUI !== null) {
|
2019-09-06 07:51:38 +10:00
|
|
|
encryptionUI.importing = false
|
|
|
|
if (button) button.loading = false
|
|
|
|
}
|
2019-08-29 01:42:52 +10:00
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SequentialAnimation {
|
2019-08-28 17:54:53 +10:00
|
|
|
id: animation
|
2019-08-29 01:42:52 +10:00
|
|
|
HNumberAnimation {
|
|
|
|
target: encryptionUI; property: "scale"; to: 0;
|
|
|
|
}
|
|
|
|
HNumberAnimation {
|
|
|
|
target: encryptionUI; property: "scale"; to: 1; overshoot: 3;
|
|
|
|
}
|
2019-07-25 16:43:52 +10:00
|
|
|
}
|
|
|
|
}
|