]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix updating of new item menu when changing tabs
authorMartin T. H. Sandsmark <martin.sandsmark@kde.org>
Sat, 17 Dec 2016 13:23:20 +0000 (14:23 +0100)
committerMartin T. H. Sandsmark <martin.sandsmark@kde.org>
Wed, 28 Dec 2016 12:49:37 +0000 (13:49 +0100)
Correctly set the active status of views when changing tabs.

Before: Right click in home folder, see create new enabled, open tab, go
to /usr, right click and see it is disabled, switch back to first tab
and right click, and it is still disabled.

After: It is enabled and disabled as appropriate when switching tab.

REVIEW: 129664

src/dolphintabwidget.cpp
src/dolphintabwidget.h

index 22674d1bd042bfc1280963f5be70289f111a917f..bcd4a49fdfea89df84cedf27131b875d54f5291b 100644 (file)
@@ -32,7 +32,8 @@
 
 DolphinTabWidget::DolphinTabWidget(QWidget* parent) :
     QTabWidget(parent),
-    m_placesSelectorVisible(true)
+    m_placesSelectorVisible(true),
+    m_previousTab(-1)
 {
     connect(this, &DolphinTabWidget::tabCloseRequested,
             this, static_cast<void (DolphinTabWidget::*)(int)>(&DolphinTabWidget::closeTab));
@@ -304,9 +305,15 @@ void DolphinTabWidget::tabUrlChanged(const QUrl& url)
 void DolphinTabWidget::currentTabChanged(int index)
 {
     DolphinViewContainer* viewContainer = tabPageAt(index)->activeViewContainer();
+    viewContainer->setActive(true);
     emit activeViewChanged(viewContainer);
     emit currentUrlChanged(viewContainer->url());
     viewContainer->view()->setFocus();
+
+    if (tabPageAt(m_previousTab)) {
+        tabPageAt(m_previousTab)->activeViewContainer()->setActive(false);
+    }
+    m_previousTab = index;
 }
 
 void DolphinTabWidget::tabInserted(int index)
index 7b3a18814c59ad8adad380d069ea9595884225c8..50ebd602ab85342d405cf8540b0dbd0d701a6e9b 100644 (file)
@@ -186,6 +186,8 @@ private:
 private:
     /** Caches the (negated) places panel visibility */
     bool m_placesSelectorVisible;
+
+    int m_previousTab;
 };
 
 #endif