diff --git a/src/gui/Popups/DeleteDevicesPopup.qml b/src/gui/Popups/DeleteDevicesPopup.qml index ae2422a6..1ddf4c13 100644 --- a/src/gui/Popups/DeleteDevicesPopup.qml +++ b/src/gui/Popups/DeleteDevicesPopup.qml @@ -3,6 +3,7 @@ import QtQuick 2.12 import "../Base" import "../Base/ButtonLayout" +import "../PythonBridge" PasswordPopup { id: popup @@ -12,13 +13,18 @@ PasswordPopup { property var deviceIds // array property var deletedCallback: null + property Future deleteFuture: null + function verifyPassword(pass, callback) { - py.callClientCoro( + deleteFuture = py.callClientCoro( userId, "delete_devices_with_password", [deviceIds, pass], - () => callback(true), + () => { + deleteFuture = null + callback(true) + }, (type, args) => { callback( type === "MatrixUnauthorized" ? @@ -36,5 +42,10 @@ PasswordPopup { validateButton.text: qsTr("Sign out") validateButton.icon.name: "sign-out" - onClosed: if (acceptedPassword && deletedCallback) deletedCallback() + onClosed: { + if (deleteFuture) deleteFuture.cancel() + + if (deleteFuture || acceptedPassword && deletedCallback) + deletedCallback() + } }