[kde-doc-english] [trojita] src/Gui: GUI: make the history navigation within "one at time" layout a bit more robust

Jan Kundrát jkt at flaska.net
Fri May 31 12:35:07 UTC 2013


Git commit 64111dc9d5ec6562cf6123f20c545fd652b7d3e0 by Jan Kundrát.
Committed on 30/05/2013 at 23:42.
Pushed by jkt into branch 'master'.

GUI: make the history navigation within "one at time" layout a bit more robust

M  +8    -4    src/Gui/OnePanelAtTimeWidget.cpp

http://commits.kde.org/trojita/64111dc9d5ec6562cf6123f20c545fd652b7d3e0

diff --git a/src/Gui/OnePanelAtTimeWidget.cpp b/src/Gui/OnePanelAtTimeWidget.cpp
index b6c0ca7..0d145a5 100644
--- a/src/Gui/OnePanelAtTimeWidget.cpp
+++ b/src/Gui/OnePanelAtTimeWidget.cpp
@@ -84,11 +84,15 @@ void OnePanelAtTimeWidget::slotOneAtTimeGoBack()
 
 void OnePanelAtTimeWidget::slotOneAtTimeGoDeeper()
 {
+    QWidget *w = qobject_cast<QWidget*>(sender());
+    Q_ASSERT(w);
+
     // Careful here: some of the events are, unfortunately, emitted twice (one for clicked(), another time for activated())
-    if (sender() == m_msgListWidget->tree)
-        setCurrentIndex(indexOf(m_msgListWidget) + 1);
-    else if (sender() == m_mboxTree)
-        setCurrentIndex(indexOf(static_cast<QWidget*>(sender())) + 1);
+    if (!w->isVisible())
+        return;
+
+    if (currentIndex() < count() - 1)
+        setCurrentIndex(currentIndex() + 1);
 
     m_actionGoBack->setEnabled(currentIndex() > 0);
 }



More information about the kde-doc-english mailing list