2019-09-10 02:57:40 +10:00
|
|
|
import QtQuick 2.12
|
|
|
|
|
|
|
|
BoxPopup {
|
|
|
|
id: popup
|
|
|
|
summary.text: qsTr("Backup your decryption keys before signing out?")
|
|
|
|
details.text: qsTr(
|
|
|
|
"Signing out will delete your device's information and the keys " +
|
|
|
|
"required to decrypt messages in encrypted rooms.\n\n" +
|
|
|
|
|
|
|
|
"You can export your keys to a passphrase-protected file " +
|
|
|
|
"before signing out.\n\n" +
|
|
|
|
|
|
|
|
"This will allow you to restore access to your messages when " +
|
|
|
|
"you sign in again, by importing this file in your account settings."
|
|
|
|
)
|
|
|
|
|
|
|
|
box.focusButton: "ok"
|
|
|
|
box.buttonModel: [
|
|
|
|
{ name: "ok", text: qsTr("Export keys"), iconName: "export-keys" },
|
2019-12-08 03:45:20 +11:00
|
|
|
{ name: "signout", text: qsTr("Sign out now"), iconName: "sign-out",
|
2019-09-10 02:57:40 +10:00
|
|
|
iconColor: theme.colors.middleBackground },
|
|
|
|
{ name: "cancel", text: qsTr("Cancel"), iconName: "cancel" },
|
|
|
|
]
|
2019-12-08 01:59:43 +11:00
|
|
|
|
2019-09-10 02:57:40 +10:00
|
|
|
box.buttonCallbacks: ({
|
|
|
|
ok: button => {
|
2019-12-18 08:59:53 +11:00
|
|
|
utils.makeObject(
|
2019-09-10 04:49:54 +10:00
|
|
|
"Dialogs/ExportKeys.qml",
|
|
|
|
mainUI,
|
|
|
|
{ userId },
|
|
|
|
obj => {
|
|
|
|
button.loading = Qt.binding(() => obj.exporting)
|
|
|
|
obj.done.connect(() => {
|
|
|
|
box.buttonCallbacks["signout"](button)
|
|
|
|
})
|
|
|
|
obj.dialog.open()
|
|
|
|
}
|
|
|
|
)
|
2019-09-10 02:57:40 +10:00
|
|
|
},
|
|
|
|
|
|
|
|
signout: button => {
|
|
|
|
okClicked = true
|
|
|
|
popup.ok()
|
|
|
|
|
|
|
|
if ((modelSources["Account"] || []).length < 2) {
|
2019-12-08 00:38:36 +11:00
|
|
|
pageLoader.showPage("AddAccount/AddAccount")
|
2019-12-10 02:35:50 +11:00
|
|
|
} else if (window.uiState.pageProperties.userId === userId) {
|
2019-09-10 02:57:40 +10:00
|
|
|
pageLoader.showPage("Default")
|
|
|
|
}
|
|
|
|
|
|
|
|
py.callCoro("logout_client", [userId])
|
|
|
|
popup.close()
|
|
|
|
},
|
|
|
|
|
|
|
|
cancel: button => { okClicked = false; popup.cancel(); popup.close() },
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
property string userId: ""
|
|
|
|
}
|