Summary:
This Diff make configurable which view will close when toggling off
the split view mode, if it's the active one or the inactive one.
A new checkbox was added to the Dolphin configuration window,
and defaults to the original behavior.
FEATURE: 312834
FIXED-IN: 19.03.80
Test Plan: {
F6535432}
Reviewers: ngraham, #dolphin, elvisangelaccio
Reviewed By: ngraham, #dolphin
Subscribers: elvisangelaccio, cfeck, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D18040
QAction* splitAction = actionCollection()->action(QStringLiteral("split_view"));
const DolphinTabPage* tabPage = m_tabWidget->currentTabPage();
if (tabPage->splitViewEnabled()) {
- if (tabPage->primaryViewActive()) {
+ if (GeneralSettings::closeActiveSplitView() ? tabPage->primaryViewActive() : !tabPage->primaryViewActive()) {
splitAction->setText(i18nc("@action:intoolbar Close left view", "Close"));
splitAction->setToolTip(i18nc("@info", "Close left view"));
splitAction->setIcon(QIcon::fromTheme(QStringLiteral("view-left-close")));
m_secondaryViewContainer->show();
m_secondaryViewContainer->setActive(true);
} else {
- // Close the view which is active.
- DolphinViewContainer* view = activeViewContainer();
- if (m_primaryViewActive) {
- // If the primary view is active, we have to swap the pointers
- // because the secondary view will be the new primary view.
- qSwap(m_primaryViewContainer, m_secondaryViewContainer);
- m_primaryViewActive = false;
+ DolphinViewContainer* view;
+ if (GeneralSettings::closeActiveSplitView()) {
+ view = activeViewContainer();
+ if (m_primaryViewActive) {
+ // If the primary view is active, we have to swap the pointers
+ // because the secondary view will be the new primary view.
+ qSwap(m_primaryViewContainer, m_secondaryViewContainer);
+ m_primaryViewActive = false;
+ }
+ } else {
+ view = m_primaryViewActive ? m_secondaryViewContainer : m_primaryViewContainer;
+ if (!m_primaryViewActive) {
+ // If the secondary view is active, we have to swap the pointers
+ // because the secondary view will be the new primary view.
+ qSwap(m_primaryViewContainer, m_secondaryViewContainer);
+ m_primaryViewActive = true;
+ }
}
m_primaryViewContainer->setActive(true);
view->close();
<label>Use tab for switching between right and left split</label>
<default>false</default>
</entry>
+ <entry name="CloseActiveSplitView" type="Bool">
+ <label>Close active view when toggling off</label>
+ <default>true</default>
+ </entry>
<entry name="ShowToolTips" type="Bool">
<label>Show tooltips</label>
<default>false</default>
m_useTabForSplitViewSwitch = new QCheckBox(i18nc("option:check", "Switch between split views with tab key"));
topLayout->addRow(QString(), m_useTabForSplitViewSwitch);
+ // 'Close active view when turning off split view'
+ m_closeActiveSplitView = new QCheckBox(i18nc("option:check", "Turning off split view closes active pane"));
+ topLayout->addRow(QString(), m_closeActiveSplitView);
+ m_closeActiveSplitView->setToolTip(i18n("When deactivated, turning off split view will close the inactive pane"));
+
loadSettings();
connect(m_localViewProps, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
connect(m_caseSensitiveSorting, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
connect(m_renameInline, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed);
connect(m_useTabForSplitViewSwitch, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed);
+ connect(m_closeActiveSplitView, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed);
}
BehaviorSettingsPage::~BehaviorSettingsPage()
setSortingChoiceValue(settings);
settings->setRenameInline(m_renameInline->isChecked());
settings->setUseTabForSwitchingSplitView(m_useTabForSplitViewSwitch->isChecked());
+ settings->setCloseActiveSplitView(m_closeActiveSplitView->isChecked());
settings->save();
if (useGlobalViewProps) {
m_showSelectionToggle->setChecked(GeneralSettings::showSelectionToggle());
m_renameInline->setChecked(GeneralSettings::renameInline());
m_useTabForSplitViewSwitch->setChecked(GeneralSettings::useTabForSwitchingSplitView());
+ m_closeActiveSplitView->setChecked(GeneralSettings::closeActiveSplitView());
loadSortingChoiceSettings();
}
QCheckBox* m_renameInline;
QCheckBox* m_useTabForSplitViewSwitch;
+ QCheckBox* m_closeActiveSplitView;
};
#endif