Fix closing a secondary viewContainer on startup settings change

Apply split view settings only when changing the corresponding option.

BUG: 426221
FIXED-IN: 21.08.2
This commit is contained in:
Eugene Popov 2021-09-28 19:39:52 +00:00 committed by Nate Graham
parent 8bf64cf8b1
commit fa8d9de4d8
3 changed files with 14 additions and 5 deletions

View file

@ -216,6 +216,9 @@ DolphinMainWindow::DolphinMainWindow() :
showErrorMessage(errorMessage);
});
#endif
connect(GeneralSettings::self(), &GeneralSettings::splitViewChanged,
this, &DolphinMainWindow::slotSplitViewChanged);
}
DolphinMainWindow::~DolphinMainWindow()
@ -439,6 +442,12 @@ void DolphinMainWindow::openNewTab(const QUrl& url)
m_tabWidget->openNewTab(url, QUrl());
}
void DolphinMainWindow::slotSplitViewChanged()
{
m_tabWidget->currentTabPage()->setSplitViewEnabled(GeneralSettings::splitView(), WithAnimation);
updateSplitAction();
}
void DolphinMainWindow::openInNewTab()
{
const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
@ -2096,11 +2105,6 @@ void DolphinMainWindow::refreshViews()
m_tabWidget->refreshViews();
if (GeneralSettings::modifiedStartupSettings()) {
// The startup settings have been changed by the user (see bug #254947).
// Synchronize the split-view setting with the active view:
const bool splitView = GeneralSettings::splitView();
m_tabWidget->currentTabPage()->setSplitViewEnabled(splitView, WithAnimation);
updateSplitAction();
updateWindowTitle();
}

View file

@ -171,6 +171,9 @@ public Q_SLOTS:
*/
void openNewTab(const QUrl& url);
/** @see GeneralSettings::splitViewChanged() */
void slotSplitViewChanged();
Q_SIGNALS:
/**
* Is sent if the selection of the currently active view has

View file

@ -9,6 +9,7 @@
<include>KCompletion</include>
<kcfgfile name="dolphinrc"/>
<signal name="sortingChoiceChanged" />
<signal name="splitViewChanged" />
<group name="General">
<entry name="EditableUrl" type="Bool">
<label>Should the URL be editable for the user</label>
@ -49,6 +50,7 @@
<entry name="SplitView" type="Bool">
<label>Split the view into two panes</label>
<default>false</default>
<emit signal="splitViewChanged" />
</entry>
<entry name="FilterBar" type="Bool">
<label>Should the filter bar be shown</label>