[kde-doc-english] [trojita] src/Gui: GUI: Do not spam with "Mailbox openened" status updates

Jan Kundrát jkt at kde.org
Thu Aug 13 17:33:51 UTC 2015


Git commit ba9b9a3b313a836d19b2b9fa5f778fbcfe3e8bde by Jan Kundrát.
Committed on 29/07/2015 at 11:03.
Pushed by gerrit into branch 'master'.

GUI: Do not spam with "Mailbox openened" status updates

It's a good thing that the code underneath emits these signals (it's for
tracking the state, anyway). However, there's little point in updating
the user each and every time an action *finishes*.

Change-Id: Ie5f908fbd8b7ceefc60dac4e362d43674e580b50

M  +9    -1    src/Gui/Window.cpp

http://commits.kde.org/trojita/ba9b9a3b313a836d19b2b9fa5f778fbcfe3e8bde

diff --git a/src/Gui/Window.cpp b/src/Gui/Window.cpp
index 8792355..e52a757 100644
--- a/src/Gui/Window.cpp
+++ b/src/Gui/Window.cpp
@@ -1666,8 +1666,16 @@ void MainWindow::slotMailboxChanged(const QModelIndex &mailbox)
 void MainWindow::showConnectionStatus(uint parserId, Imap::ConnectionState state)
 {
     Q_UNUSED(parserId);
+    static Imap::ConnectionState previousState = Imap::ConnectionState::CONN_STATE_NONE;
     QString message = connectionStateToString(state);
-    showStatusMessage(message);
+
+    if (state == Imap::ConnectionState::CONN_STATE_SELECTED && previousState >= Imap::ConnectionState::CONN_STATE_SELECTED) {
+        // prevent excessive popups when we "reset the state" to something which is shown quite often
+        showStatusMessage(QString());
+    } else {
+        showStatusMessage(message);
+    }
+    previousState = state;
 }
 
 void MainWindow::slotShowLinkTarget(const QString &link)



More information about the kde-doc-english mailing list