]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Only keep the active view container connected with the main window, all inactive
authorEmmanuel Pescosta <emmanuelpescosta099@gmail.com>
Wed, 27 Aug 2014 20:40:06 +0000 (22:40 +0200)
committerEmmanuel Pescosta <emmanuelpescosta099@gmail.com>
Sun, 31 Aug 2014 15:00:10 +0000 (17:00 +0200)
view containers are disconnected. Changing the connections is done whenever the
active view has been changed, so we can always guarantee that the active view is
connected.

The problem with restoring saved sessions is, that we create a new view container
in DolphinTabPage::restoreState() when split view was used in the previous session,
but this view container isn't connected to the main window slots because
DolphinMainWindow::connectViewSignals() is not called for this container. This leads
to these strange problems: no context menu, ...

BUG: 338549
REVIEW: 119961
FIXED-IN: 4.14.1

src/dolphinmainwindow.cpp

index db4ad07657bc6db5de4aeadd16c887587e0cac0a..a4e43a98321fa30e1d1e650e65825292f7a322a2 100644 (file)
@@ -409,14 +409,6 @@ void DolphinMainWindow::openNewTab(const KUrl& primaryUrl, const KUrl& secondary
     const bool placesSelectorVisible = !placesDock || !placesDock->isVisible();
     tabPage->setPlacesSelectorVisible(placesSelectorVisible);
 
-    DolphinViewContainer* primaryContainer = tabPage->primaryViewContainer();
-    connectViewSignals(primaryContainer);
-
-    if (tabPage->splitViewEnabled()) {
-        DolphinViewContainer* secondaryContainer = tabPage->secondaryViewContainer();
-        connectViewSignals(secondaryContainer);
-    }
-
     tabPage->hide();
 
     m_tabBar->addTab(KIcon(KMimeType::iconNameForUrl(primaryUrl)),
@@ -701,10 +693,6 @@ void DolphinMainWindow::toggleSplitView()
     DolphinTabPage* tabPage = m_viewTab.at(m_tabIndex);
     tabPage->setSplitViewEnabled(!tabPage->splitViewEnabled());
 
-    if (tabPage->splitViewEnabled()) {
-        connectViewSignals(tabPage->secondaryViewContainer());
-    }
-
     updateViewActions();
 }
 
@@ -1260,7 +1248,17 @@ void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer* viewContain
         return;
     }
 
+    if (m_activeViewContainer) {
+        // Disconnect all signals between the old view container (container,
+        // view and url navigator) and main window.
+        m_activeViewContainer->disconnect(this);
+        m_activeViewContainer->view()->disconnect(this);
+        m_activeViewContainer->urlNavigator()->disconnect(this);
+    }
+
     m_activeViewContainer = viewContainer;
+    connectViewSignals(viewContainer);
+
     m_actionHandler->setCurrentView(viewContainer->view());
 
     updateHistory();