From: Loren Burkholder Date: Fri, 7 Apr 2023 00:05:48 +0000 (-0400) Subject: Allow popping out a split view X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/f7e2c51198f00ff0f8e807590ed004c4fc65b6f0?ds=inline Allow popping out a split view If you have a split view open, you can now pop the active half out into a new window by clicking the "Pop out" button in the toolbar or by activating "View > Pop out". BUG: 270604 --- diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index d73cc4866..308cd166f 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -469,7 +469,7 @@ void DolphinMainWindow::openNewWindow(const QUrl &url) void DolphinMainWindow::slotSplitViewChanged() { m_tabWidget->currentTabPage()->setSplitViewEnabled(GeneralSettings::splitView(), WithAnimation); - updateSplitAction(); + updateSplitActions(); } void DolphinMainWindow::openInNewTab() @@ -984,6 +984,15 @@ void DolphinMainWindow::toggleSplitView() updateViewActions(); } +void DolphinMainWindow::popoutSplitView() +{ + DolphinTabPage *tabPage = m_tabWidget->currentTabPage(); + if (!tabPage->splitViewEnabled()) + return; + openNewWindow(tabPage->activeViewContainer()->url()); + tabPage->setSplitViewEnabled(false, WithAnimation); +} + void DolphinMainWindow::toggleSplitStash() { DolphinTabPage *tabPage = m_tabWidget->currentTabPage(); @@ -1829,6 +1838,14 @@ void DolphinMainWindow::setupActions() actionCollection()->setDefaultShortcut(split, Qt::Key_F3); connect(split, &QAction::triggered, this, &DolphinMainWindow::toggleSplitView); + QAction *popoutSplit = actionCollection()->addAction(QStringLiteral("popout_split_view")); + popoutSplit->setWhatsThis(xi18nc("@info:whatsthis", + "If the folder view has been split, this will pop the active folder " + "view out into a new window.")); + popoutSplit->setIcon(QIcon::fromTheme(QStringLiteral("window-new"))); + actionCollection()->setDefaultShortcut(popoutSplit, Qt::SHIFT | Qt::Key_F3); + connect(popoutSplit, &QAction::triggered, this, &DolphinMainWindow::popoutSplitView); + QAction *stashSplit = actionCollection()->addAction(QStringLiteral("split_stash")); actionCollection()->setDefaultShortcut(stashSplit, Qt::CTRL | Qt::Key_S); stashSplit->setText(i18nc("@action:intoolbar Stash", "Stash")); @@ -2417,7 +2434,7 @@ void DolphinMainWindow::updateViewActions() QAction *toggleFilterBarAction = actionCollection()->action(QStringLiteral("toggle_filter")); toggleFilterBarAction->setChecked(m_activeViewContainer->isFilterBarVisible()); - updateSplitAction(); + updateSplitActions(); } void DolphinMainWindow::updateGoActions() @@ -2446,7 +2463,7 @@ void DolphinMainWindow::refreshViews() updateWindowTitle(); } - updateSplitAction(); + updateSplitActions(); Q_EMIT settingsChanged(); } @@ -2505,24 +2522,31 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer *container) connect(navigator, &KUrlNavigator::newWindowRequested, this, &DolphinMainWindow::openNewWindow); } -void DolphinMainWindow::updateSplitAction() +void DolphinMainWindow::updateSplitActions() { QAction *splitAction = actionCollection()->action(QStringLiteral("split_view")); + QAction *popoutSplitAction = actionCollection()->action(QStringLiteral("popout_split_view")); const DolphinTabPage *tabPage = m_tabWidget->currentTabPage(); if (tabPage->splitViewEnabled()) { 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"))); + popoutSplitAction->setText(i18nc("@action:intoolbar Pop out left view", "Pop out")); + popoutSplitAction->setToolTip(i18nc("@info", "Pop out left view")); } else { splitAction->setText(i18nc("@action:intoolbar Close right view", "Close")); splitAction->setToolTip(i18nc("@info", "Close right view")); splitAction->setIcon(QIcon::fromTheme(QStringLiteral("view-right-close"))); + popoutSplitAction->setText(i18nc("@action:intoolbar Pop out right view", "Pop out")); + popoutSplitAction->setToolTip(i18nc("@info", "Pop out right view")); } + popoutSplitAction->setVisible(true); } else { splitAction->setText(i18nc("@action:intoolbar Split view", "Split")); splitAction->setToolTip(i18nc("@info", "Split view")); splitAction->setIcon(QIcon::fromTheme(QStringLiteral("view-right-new"))); + popoutSplitAction->setVisible(false); } } diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index bff0ef4de..844360aaa 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -343,6 +343,13 @@ private Q_SLOTS: */ void toggleSplitView(); + /** + * Pops out a split view. + * The active view will be popped out, unless the view is not split, + * in which case nothing will happen. + */ + void popoutSplitView(); + /** Dedicated action to open the stash:/ ioslave in split view. */ void toggleSplitStash(); @@ -662,7 +669,7 @@ private: * otherwise the text is set to "Join". The icon * is updated to match with the text and the currently active view. */ - void updateSplitAction(); + void updateSplitActions(); /** * Sets the window sides the toolbar may be moved to based on toolbar contents. diff --git a/src/dolphinui.rc b/src/dolphinui.rc index 0eca6b8fe..7d35ed303 100644 --- a/src/dolphinui.rc +++ b/src/dolphinui.rc @@ -50,6 +50,7 @@ + @@ -111,6 +112,7 @@ +