From 5eaa87755469a024b0fa58013fe02a7e705ff0af Mon Sep 17 00:00:00 2001 From: miruka Date: Thu, 5 Sep 2019 17:51:38 -0400 Subject: [PATCH] Avoid import harmless error messages at the end --- TODO.md | 1 + src/qml/Pages/EditAccount/Encryption.qml | 39 +++++++++++++----------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/TODO.md b/TODO.md index 45b00721..341f267f 100644 --- a/TODO.md +++ b/TODO.md @@ -32,6 +32,7 @@ - Change typing bar background - Show error if uploading avatar fails or file is corrupted - Way to open context menus without a right mouse button + - Room header descriptions: styled text - Single message context menu - Copy text diff --git a/src/qml/Pages/EditAccount/Encryption.qml b/src/qml/Pages/EditAccount/Encryption.qml index 385fb974..573e3309 100644 --- a/src/qml/Pages/EditAccount/Encryption.qml +++ b/src/qml/Pages/EditAccount/Encryption.qml @@ -2,24 +2,6 @@ import QtQuick 2.12 import "../../Base" HLoader { - property bool importing: false - - - function importKeys(file, passphrase, button=null) { - if (button) button.loading = true - importing = true - - let path = file.toString().replace(/^file:\/\//, "") - - py.callClientCoro( - editAccount.userId, "import_keys", [path, passphrase], () => { - importing = false - if (button) button.loading = false - } - ) - } - - id: encryptionUI source: accountInfo.import_error[0] ? "ImportError.qml" : @@ -28,6 +10,27 @@ HLoader { onSourceChanged: animation.running = true + + property bool importing: false + + + function importKeys(file, passphrase, button=null) { + if (button) button.loading = true + encryptionUI.importing = true + + let path = file.toString().replace(/^file:\/\//, "") + + py.callClientCoro( + editAccount.userId, "import_keys", [path, passphrase], () => { + if (encryptionUI !== null) { // null: user is on another page + encryptionUI.importing = false + if (button) button.loading = false + } + } + ) + } + + SequentialAnimation { id: animation HNumberAnimation {