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
This commit is contained in:
Emmanuel Pescosta 2014-08-27 22:40:06 +02:00
parent 4290827540
commit dc378935d3

View 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();