[kde-doc-english] [trojita] src/Gui: GUI: Do not toggle the message read/unread on key up/down

Jan Kundrát jkt at flaska.net
Wed Nov 6 10:13:50 UTC 2013


Git commit f8e478b0c2e799971f6464289739b6d2c7c7a8aa by Jan Kundrát.
Committed on 04/11/2013 at 20:26.
Pushed by jkt into branch 'master'.

GUI: Do not toggle the message read/unread on key up/down

If the current column corresponds to the "seen indicator", key up/down would
preserve that column which would cause an unexpected result. This special
behavior shall work only as a result of an explicit mouse click.

REVIEW: 113667

M  +8    -3    src/Gui/MsgListView.cpp

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

diff --git a/src/Gui/MsgListView.cpp b/src/Gui/MsgListView.cpp
index 074e311..049084d 100644
--- a/src/Gui/MsgListView.cpp
+++ b/src/Gui/MsgListView.cpp
@@ -60,7 +60,7 @@ MsgListView::MsgListView(QWidget *parent): QTreeView(parent), m_autoActivateAfte
 
     m_naviActivationTimer = new QTimer(this);
     m_naviActivationTimer->setSingleShot(true);
-    connect (m_naviActivationTimer, SIGNAL(timeout()), SLOT(slotCurrentActivated()));
+    connect(m_naviActivationTimer, SIGNAL(timeout()), SLOT(slotCurrentActivated()));
 }
 
 // left might collapse a thread, question is whether ending there (on closing the thread) should be
@@ -93,8 +93,13 @@ void MsgListView::keyReleaseEvent(QKeyEvent *ke)
 
 void MsgListView::slotCurrentActivated()
 {
-    if (currentIndex().isValid() && m_autoActivateAfterKeyNavigation)
-        emit activated(currentIndex());
+    if (currentIndex().isValid() && m_autoActivateAfterKeyNavigation) {
+        // The "current index" is the one with that funny dot which only triggers the read/unread status toggle.
+        // If we don't do anything, subsequent pressing of key_up or key_down will move the cursor up/down one row
+        // while preserving the column which will lead to toggling the read/unread state of *that* message.
+        // That's unexpected; the key shall just move the cursor and change the current message.
+        emit activated(currentIndex().sibling(currentIndex().row(), Imap::Mailbox::MsgListModel::SUBJECT));
+    }
 }
 
 int MsgListView::sizeHintForColumn(int column) const



More information about the kde-doc-english mailing list