From 6ba8052a1efb02c03b8cc31f35be8f0d5846cf42 Mon Sep 17 00:00:00 2001 From: Xavier Michelon Date: Wed, 10 May 2023 14:40:41 +0200 Subject: [PATCH] feat(GODT-2621): display pop up warning when IMAP login fails because user is locked (connecting). --- internal/frontend/bridge-gui/bridge-gui/QMLBackend.cpp | 10 ++++++++++ .../frontend/bridge-gui/bridgepp/bridgepp/User/User.h | 1 + 2 files changed, 11 insertions(+) diff --git a/internal/frontend/bridge-gui/bridge-gui/QMLBackend.cpp b/internal/frontend/bridge-gui/bridge-gui/QMLBackend.cpp index 47e8e2db..b10002a4 100644 --- a/internal/frontend/bridge-gui/bridge-gui/QMLBackend.cpp +++ b/internal/frontend/bridge-gui/bridge-gui/QMLBackend.cpp @@ -1019,6 +1019,16 @@ void QMLBackend::onIMAPLoginFailed(QString const &username) { tr("Your email client can't connect to Proton Bridge. Make sure you are using the local Bridge password shown in Bridge.")); break; + case UserState::Locked: + if (user->isNotificationInCooldown(User::ENotification::IMAPLoginWhileLocked)) { + return; + } + user->startNotificationCooldownPeriod(User::ENotification::IMAPLoginWhileLocked, cooldownDurationMs); + emit selectUser(user->id(), false); + trayIcon_->showErrorPopupNotification(tr("Connection in progress"), + tr("Your Proton account in Bridge is being connected. Please wait or restart Bridge.")); + break; + default: break; } diff --git a/internal/frontend/bridge-gui/bridgepp/bridgepp/User/User.h b/internal/frontend/bridge-gui/bridgepp/bridgepp/User/User.h index d30c6b00..b63e51d6 100644 --- a/internal/frontend/bridge-gui/bridgepp/bridgepp/User/User.h +++ b/internal/frontend/bridge-gui/bridgepp/bridgepp/User/User.h @@ -66,6 +66,7 @@ public: // data types enum class ENotification { IMAPLoginWhileSignedOut, ///< An IMAP client tried to login while the user is signed out. IMAPPasswordFailure, ///< An IMAP client provided an invalid password for the user. + IMAPLoginWhileLocked, ///< An IMAP client tried to connect while the user is locked. }; public: // static member function