2020-06-30 00:30:44 +10:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
|
|
|
import QtQuick 2.12
|
|
|
|
import "../Base"
|
|
|
|
import "../Base/ButtonLayout"
|
2020-06-30 00:46:37 +10:00
|
|
|
import "../PythonBridge"
|
2020-06-30 00:30:44 +10:00
|
|
|
|
|
|
|
PasswordPopup {
|
|
|
|
id: popup
|
|
|
|
|
|
|
|
|
|
|
|
property string userId
|
|
|
|
property var deviceIds // array
|
|
|
|
property var deletedCallback: null
|
|
|
|
|
2020-06-30 00:46:37 +10:00
|
|
|
property Future deleteFuture: null
|
|
|
|
|
2020-06-30 00:30:44 +10:00
|
|
|
|
|
|
|
function verifyPassword(pass, callback) {
|
2020-06-30 00:46:37 +10:00
|
|
|
deleteFuture = py.callClientCoro(
|
2020-06-30 00:30:44 +10:00
|
|
|
userId,
|
|
|
|
"delete_devices_with_password",
|
|
|
|
[deviceIds, pass],
|
2020-06-30 00:46:37 +10:00
|
|
|
() => {
|
|
|
|
deleteFuture = null
|
|
|
|
callback(true)
|
|
|
|
},
|
2020-06-30 00:30:44 +10:00
|
|
|
(type, args) => {
|
|
|
|
callback(
|
|
|
|
type === "MatrixUnauthorized" ?
|
|
|
|
false :
|
|
|
|
qsTr("Unknown error: %1 - %2").arg(type).arg(args)
|
|
|
|
)
|
|
|
|
},
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
summary.text:
|
|
|
|
qsTr("Enter your account's password to continue:")
|
|
|
|
|
|
|
|
|
2020-07-10 17:16:20 +10:00
|
|
|
validateButton.text:
|
|
|
|
deviceIds.length > 1 ?
|
|
|
|
qsTr("Sign out %1 devices").arg(deviceIds.length) :
|
|
|
|
qsTr("Sign out %1 device").arg(deviceIds.length)
|
|
|
|
|
2020-06-30 00:30:44 +10:00
|
|
|
validateButton.icon.name: "sign-out"
|
|
|
|
|
2020-06-30 00:46:37 +10:00
|
|
|
onClosed: {
|
|
|
|
if (deleteFuture) deleteFuture.cancel()
|
|
|
|
|
|
|
|
if (deleteFuture || acceptedPassword && deletedCallback)
|
|
|
|
deletedCallback()
|
|
|
|
}
|
2020-06-30 00:30:44 +10:00
|
|
|
}
|