2020-09-24 09:57:54 +10:00
|
|
|
// Copyright Mirage authors & contributors <https://github.com/mirukana/mirage>
|
2019-12-19 22:46:16 +11:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2019-09-10 02:57:40 +10:00
|
|
|
import QtQuick 2.12
|
2019-12-03 07:29:29 +11:00
|
|
|
import ".."
|
2020-07-12 12:52:14 +10:00
|
|
|
import "../Base"
|
|
|
|
import "../Base/Buttons"
|
2019-09-10 02:57:40 +10:00
|
|
|
|
2020-06-25 22:32:08 +10:00
|
|
|
HFlickableColumnPopup {
|
2019-09-10 02:57:40 +10:00
|
|
|
id: popup
|
2020-06-25 22:32:08 +10:00
|
|
|
|
|
|
|
property string userId: ""
|
|
|
|
|
2020-07-12 12:52:14 +10:00
|
|
|
page.footer: AutoDirectionLayout {
|
|
|
|
PositiveButton {
|
2020-06-25 22:32:08 +10:00
|
|
|
id: exportButton
|
|
|
|
text: qsTr("Export keys")
|
|
|
|
icon.name: "export-keys"
|
|
|
|
|
|
|
|
onClicked: utils.makeObject(
|
2019-09-10 04:49:54 +10:00
|
|
|
"Dialogs/ExportKeys.qml",
|
2019-12-03 07:29:29 +11:00
|
|
|
window.mainUI,
|
2019-09-10 04:49:54 +10:00
|
|
|
{ userId },
|
|
|
|
obj => {
|
2020-06-25 22:32:08 +10:00
|
|
|
loading = Qt.binding(() => obj.exporting)
|
|
|
|
obj.done.connect(signOutButton.clicked)
|
2019-09-10 04:49:54 +10:00
|
|
|
obj.dialog.open()
|
|
|
|
}
|
|
|
|
)
|
2020-06-25 22:32:08 +10:00
|
|
|
}
|
2019-09-10 02:57:40 +10:00
|
|
|
|
2020-07-12 12:52:14 +10:00
|
|
|
MiddleButton {
|
2020-06-25 22:32:08 +10:00
|
|
|
id: signOutButton
|
|
|
|
text: qsTr("Sign out now")
|
|
|
|
icon.name: "sign-out"
|
2019-09-10 02:57:40 +10:00
|
|
|
|
2020-06-25 22:32:08 +10:00
|
|
|
onClicked: {
|
2020-09-14 02:47:25 +10:00
|
|
|
const showAdd =
|
|
|
|
ModelStore.get("accounts").count < 2 ||
|
|
|
|
window.uiState.pageProperties.userId === userId ||
|
|
|
|
(window.uiState.pageProperties.userRoomId || [])[0] ===
|
|
|
|
userId
|
|
|
|
|
|
|
|
if (showAdd) {
|
2020-09-03 05:07:10 +10:00
|
|
|
const page = "Pages/AddAccount/AddAccount.qml"
|
2020-09-04 07:33:19 +10:00
|
|
|
window.mainUI.pageLoader.show(page)
|
2020-06-25 22:32:08 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
py.callCoro("logout_client", [userId])
|
|
|
|
popup.close()
|
2019-09-10 02:57:40 +10:00
|
|
|
}
|
2020-06-25 22:32:08 +10:00
|
|
|
}
|
2019-09-10 02:57:40 +10:00
|
|
|
|
2020-06-25 22:32:08 +10:00
|
|
|
CancelButton {
|
|
|
|
onClicked: popup.close()
|
|
|
|
}
|
|
|
|
}
|
2019-09-10 02:57:40 +10:00
|
|
|
|
2020-06-25 22:32:08 +10:00
|
|
|
onOpened: exportButton.forceActiveFocus()
|
2019-09-10 02:57:40 +10:00
|
|
|
|
2020-06-25 22:32:08 +10:00
|
|
|
SummaryLabel {
|
|
|
|
text: qsTr("Backup your decryption keys before signing out?")
|
|
|
|
}
|
|
|
|
|
|
|
|
DetailsLabel {
|
|
|
|
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."
|
|
|
|
)
|
|
|
|
}
|
2019-09-10 02:57:40 +10:00
|
|
|
}
|