mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-22 01:40:02 +00:00
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
This commit is contained in:
parent
037a394ec7
commit
92368c1e4d
|
@ -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")));
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ private:
|
|||
|
||||
QCheckBox* m_renameInline;
|
||||
QCheckBox* m_useTabForSplitViewSwitch;
|
||||
QCheckBox* m_closeActiveSplitView;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue