diff options
| author | arnav dhamija <[email protected]> | 2017-02-13 22:24:01 +0530 |
|---|---|---|
| committer | arnav dhamija <[email protected]> | 2017-02-13 22:24:01 +0530 |
| commit | ccb3658b3aa7f5b0f0b71cb6e91808bdfe58af64 (patch) | |
| tree | cf6b1cd277d7a410278802aa600be0c65af6bd64 /src | |
| parent | 41253c0c81bafb54a0b6c82e5282e3add85e8a50 (diff) | |
| parent | 0d4924d8bbab256b13ae13040201bea7ea04ab2f (diff) | |
Merge branch 'stashAction'
This adds the support for the Stash action which will be helpful for the upcoming stash:/ ioslave
Diffstat (limited to 'src')
| -rw-r--r-- | src/dolphinmainwindow.cpp | 17 | ||||
| -rw-r--r-- | src/dolphinmainwindow.h | 3 | ||||
| -rw-r--r-- | src/dolphintabpage.cpp | 4 | ||||
| -rw-r--r-- | src/dolphintabpage.h | 2 | ||||
| -rw-r--r-- | src/dolphinui.rc | 2 |
5 files changed, 25 insertions, 3 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 5bca8d06f..a2e9c0dd8 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -57,6 +57,7 @@ #include <KIO/JobUiDelegate> #include <KLocalizedString> #include <KProtocolManager> +#include <KProtocolInfo> #include <QMenu> #include <KMessageBox> #include <KFileItemListProperties> @@ -523,6 +524,13 @@ void DolphinMainWindow::toggleSplitView() updateViewActions(); } +void DolphinMainWindow::toggleSplitStash() +{ + DolphinTabPage* tabPage = m_tabWidget->currentTabPage(); + tabPage->setSplitViewEnabled(false); + tabPage->setSplitViewEnabled(true, QUrl("stash:/")); +} + void DolphinMainWindow::reloadView() { clearStatusBar(); @@ -1041,6 +1049,15 @@ void DolphinMainWindow::setupActions() actionCollection()->setDefaultShortcut(split, Qt::Key_F3); connect(split, &QAction::triggered, this, &DolphinMainWindow::toggleSplitView); + QAction* stashSplit = actionCollection()->addAction(QStringLiteral("split_stash")); + actionCollection()->setDefaultShortcut(stashSplit, Qt::CTRL | Qt::Key_S); + stashSplit->setText(i18nc("@action:intoolbar Stash", "Stash")); + stashSplit->setToolTip(i18nc("@info", "Opens the stash virtual directory in a split window")); + stashSplit->setIcon(QIcon::fromTheme(QStringLiteral("folder-visiting"))); + stashSplit->setCheckable(false); + stashSplit->setVisible(KProtocolInfo::isKnownProtocol("stash")); + connect(stashSplit, &QAction::triggered, this, &DolphinMainWindow::toggleSplitStash); + QAction* reload = actionCollection()->addAction(QStringLiteral("reload")); reload->setText(i18nc("@action:inmenu View", "Reload")); actionCollection()->setDefaultShortcut(reload, Qt::Key_F5); diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index 7003e9474..d741eb21e 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -224,6 +224,9 @@ private slots: */ void toggleSplitView(); + /** Dedicated action to open the stash:/ ioslave in split view. */ + void toggleSplitStash(); + /** Reloads the currently active view. */ void reloadView(); diff --git a/src/dolphintabpage.cpp b/src/dolphintabpage.cpp index c674e1eb0..5c42d41ec 100644 --- a/src/dolphintabpage.cpp +++ b/src/dolphintabpage.cpp @@ -71,13 +71,13 @@ bool DolphinTabPage::splitViewEnabled() const return m_splitViewEnabled; } -void DolphinTabPage::setSplitViewEnabled(bool enabled) +void DolphinTabPage::setSplitViewEnabled(bool enabled, const QUrl &secondaryUrl) { if (m_splitViewEnabled != enabled) { m_splitViewEnabled = enabled; if (enabled) { - const QUrl& url = m_primaryViewContainer->url(); + const QUrl& url = (secondaryUrl.isEmpty()) ? m_primaryViewContainer->url() : secondaryUrl; m_secondaryViewContainer = createViewContainer(url); const bool placesSelectorVisible = m_primaryViewContainer->urlNavigator()->isPlacesSelectorVisible(); diff --git a/src/dolphintabpage.h b/src/dolphintabpage.h index 9d180883a..1a97ea457 100644 --- a/src/dolphintabpage.h +++ b/src/dolphintabpage.h @@ -50,7 +50,7 @@ public: * * If \a enabled is true, it creates a secondary view with the url of the primary view. */ - void setSplitViewEnabled(bool enabled); + void setSplitViewEnabled(bool enabled, const QUrl &secondaryUrl = QUrl()); /** * @return The primary view containter. diff --git a/src/dolphinui.rc b/src/dolphinui.rc index f197af402..c44665656 100644 --- a/src/dolphinui.rc +++ b/src/dolphinui.rc @@ -27,6 +27,7 @@ <Action name="show_hidden_files" /> <Separator/> <Action name="split_view" /> + <Action name="split_stash" /> <Action name="reload" /> <Action name="stop" /> <Separator/> @@ -97,6 +98,7 @@ <Action name="edit_find"/> <Action name="show_preview" /> <Action name="split_view" /> + <Action name="split_stash" /> </ToolBar> <ActionProperties scheme="Default"> <Action priority="0" name="go_back"/> |
