From 1f77e1c810ad8b47cb40cb59e52b01fe534652b7 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 6 Nov 2022 01:06:01 +0100 Subject: [PATCH] Prompt before deleting the database --- src/Cache.cpp | 3 ++- src/ChatPage.cpp | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Cache.cpp b/src/Cache.cpp index b577f201..09e3fe5c 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -361,7 +361,8 @@ fatalSecretError() "have multiple reasons. Check if your D-Bus service is running and you have configured a " "service like KWallet, Gnome Keyring, KeePassXC or the equivalent for your platform. If " "you are having trouble, feel free to open an issue here: " - "https://github.com/Nheko-Reborn/nheko/issues")); + "https://github.com/Nheko-Reborn/nheko/issues"), + QMessageBox::StandardButton::Close); QCoreApplication::exit(1); exit(1); diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp index f87c2738..8edaa1cf 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp @@ -378,6 +378,20 @@ ChatPage::dropToLoginPage(const QString &msg) http::client()->shutdown(); connectivityTimer_.stop(); + auto btn = QMessageBox::warning( + nullptr, + tr("Confirm logout"), + tr("Because of the following reason Nheko wants to drop you to the login page:\n%1\nIf you " + "think this is a mistake, you can close Nheko instead to possibly recover your encrpytion " + "keys. After you have been dropped to the login page, you can sign in again using your " + "usual methods."), + QMessageBox::StandardButton::Close | QMessageBox::StandardButton::Ok, + QMessageBox::StandardButton::Ok); + if (btn == QMessageBox::StandardButton::Close) { + QCoreApplication::exit(1); + exit(1); + } + resetUI(); deleteConfigs();