[trojita] src/Gui: GUI: Next/Previous mail actions should work from all contexts
Jan Kundrát
jkt at kde.org
Mon Oct 3 18:49:10 UTC 2016
Git commit 8eba6b67637b2121228a4d5dfbc5b8284f8b3b58 by Jan Kundrát.
Committed on 01/10/2016 at 00:14.
Pushed by gerrit into branch 'master'.
GUI: Next/Previous mail actions should work from all contexts
v2: The QAction binding was correct, the bug was in our logic. When no
items were selected, the move would default to a no-op.
We are not going to the very first item in a mailbox because doing that
might be a bit counter-intuitive on huge mailboxes. This patch will
resume the navigation at the top of the current view, depending on where
the user scrolled the viewport. Chances are that this is going to be
near the desired position.
Thanks to Sérgio Martins for reporting this.
Change-Id: I89fde26bbd5ff4ae445410eff0d22f39ca996ee1
M +6 -0 src/Gui/Window.cpp
http://commits.kde.org/trojita/8eba6b67637b2121228a4d5dfbc5b8284f8b3b58
diff --git a/src/Gui/Window.cpp b/src/Gui/Window.cpp
index 24715f5..90e46c9 100644
--- a/src/Gui/Window.cpp
+++ b/src/Gui/Window.cpp
@@ -1433,6 +1433,9 @@ void MainWindow::handleMarkAsRead(bool value)
void MainWindow::slotNextUnread()
{
QModelIndex current = msgListWidget->tree->currentIndex();
+ if (!current.isValid()) {
+ current = msgListWidget->tree->indexAt(QPoint(0, 0));
+ }
bool wrapped = false;
while (current.isValid()) {
@@ -1469,6 +1472,9 @@ void MainWindow::slotNextUnread()
void MainWindow::slotPreviousUnread()
{
QModelIndex current = msgListWidget->tree->currentIndex();
+ if (!current.isValid()) {
+ current = msgListWidget->tree->indexAt(QPoint(0, 0));
+ }
bool wrapped = false;
while (current.isValid()) {
More information about the kde-doc-english
mailing list