From dc378935d3f92c45a48349d08f96cac63411fd50 Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Wed, 27 Aug 2014 22:40:06 +0200 Subject: [PATCH] Only keep the active view container connected with the main window, all inactive 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 | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index db4ad07657..a4e43a9832 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -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();