From 92368c1e4df9ea09e50c6480c2f72b78416e3244 Mon Sep 17 00:00:00 2001 From: Angelo Oliveira Jr Date: Sat, 16 Feb 2019 16:08:12 +0100 Subject: 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 --- src/dolphintabpage.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src/dolphintabpage.cpp') 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(); -- cgit v1.3