┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelo Oliveira Jr <[email protected]>2019-02-16 16:08:12 +0100
committerElvis Angelaccio <[email protected]>2019-02-16 16:09:27 +0100
commit92368c1e4df9ea09e50c6480c2f72b78416e3244 (patch)
treebceba14535090e8a234340a6234e4523c6451e7b
parent037a394ec786d98c358a8c745c68de44efc17f85 (diff)
Add option to choose which view to close
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
-rw-r--r--src/dolphinmainwindow.cpp2
-rw-r--r--src/dolphintabpage.cpp24
-rw-r--r--src/settings/dolphin_generalsettings.kcfg4
-rw-r--r--src/settings/general/behaviorsettingspage.cpp8
-rw-r--r--src/settings/general/behaviorsettingspage.h1
5 files changed, 31 insertions, 8 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 076869c1a..8be788eae 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -1606,7 +1606,7 @@ void DolphinMainWindow::updateSplitAction()
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")));
diff --git a/src/dolphintabpage.cpp b/src/dolphintabpage.cpp
index 0193aaad0..e0e9bf4bd 100644
--- a/src/dolphintabpage.cpp
+++ b/src/dolphintabpage.cpp
@@ -88,13 +88,23 @@ void DolphinTabPage::setSplitViewEnabled(bool enabled, const QUrl &secondaryUrl)
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();
diff --git a/src/settings/dolphin_generalsettings.kcfg b/src/settings/dolphin_generalsettings.kcfg
index b06b3a1f3..e76103c5e 100644
--- a/src/settings/dolphin_generalsettings.kcfg
+++ b/src/settings/dolphin_generalsettings.kcfg
@@ -74,6 +74,10 @@
<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>
diff --git a/src/settings/general/behaviorsettingspage.cpp b/src/settings/general/behaviorsettingspage.cpp
index add9acad5..0b5cee7aa 100644
--- a/src/settings/general/behaviorsettingspage.cpp
+++ b/src/settings/general/behaviorsettingspage.cpp
@@ -100,6 +100,11 @@ BehaviorSettingsPage::BehaviorSettingsPage(const QUrl& url, QWidget* parent) :
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);
@@ -113,6 +118,7 @@ BehaviorSettingsPage::BehaviorSettingsPage(const QUrl& url, QWidget* parent) :
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()
@@ -133,6 +139,7 @@ void BehaviorSettingsPage::applySettings()
setSortingChoiceValue(settings);
settings->setRenameInline(m_renameInline->isChecked());
settings->setUseTabForSwitchingSplitView(m_useTabForSplitViewSwitch->isChecked());
+ settings->setCloseActiveSplitView(m_closeActiveSplitView->isChecked());
settings->save();
if (useGlobalViewProps) {
@@ -165,6 +172,7 @@ void BehaviorSettingsPage::loadSettings()
m_showSelectionToggle->setChecked(GeneralSettings::showSelectionToggle());
m_renameInline->setChecked(GeneralSettings::renameInline());
m_useTabForSplitViewSwitch->setChecked(GeneralSettings::useTabForSwitchingSplitView());
+ m_closeActiveSplitView->setChecked(GeneralSettings::closeActiveSplitView());
loadSortingChoiceSettings();
}
diff --git a/src/settings/general/behaviorsettingspage.h b/src/settings/general/behaviorsettingspage.h
index 779fae377..d26a709d3 100644
--- a/src/settings/general/behaviorsettingspage.h
+++ b/src/settings/general/behaviorsettingspage.h
@@ -67,6 +67,7 @@ private:
QCheckBox* m_renameInline;
QCheckBox* m_useTabForSplitViewSwitch;
+ QCheckBox* m_closeActiveSplitView;
};
#endif