diff options
| author | arnav dhamija <[email protected]> | 2016-09-26 22:25:42 +0530 |
|---|---|---|
| committer | arnav dhamija <[email protected]> | 2016-09-26 22:25:42 +0530 |
| commit | 2704b3693f86b31ac033597c63898c3aef16edf7 (patch) | |
| tree | d075a94f1652a8793cafed821f1f42996ea5186c /src | |
| parent | 67099640b90588af1c72c340756253400da3e95b (diff) | |
Added the GUI button for quick stashing
Diffstat (limited to 'src')
| -rw-r--r-- | src/dolphinmainwindow.cpp | 14 | ||||
| -rw-r--r-- | src/dolphinmainwindow.h | 3 | ||||
| -rw-r--r-- | src/dolphintabpage.cpp | 10 | ||||
| -rw-r--r-- | src/dolphintabpage.h | 2 | ||||
| -rw-r--r-- | src/dolphinui.rc | 2 |
5 files changed, 25 insertions, 6 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 4d97fc1b1..db9c34c6a 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -524,6 +524,12 @@ void DolphinMainWindow::toggleSplitView() updateViewActions(); } +void DolphinMainWindow::toggleSplitStash() +{ + DolphinTabPage* tabPage = m_tabWidget->currentTabPage(); + tabPage->setSplitViewEnabled(!tabPage->splitViewEnabled(), true); +} + void DolphinMainWindow::reloadView() { clearStatusBar(); @@ -1040,6 +1046,13 @@ 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::Key_F2); + stashSplit->setText(i18nc("@action:intoolbar Stash", "Stash")); + stashSplit->setToolTip(i18nc("@info", "Opens the stash virtual directory in a split window")); + stashSplit->setCheckable(true); + 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); @@ -1521,4 +1534,3 @@ void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job* job) KIO::FileUndoManager::UiInterface::jobError(job); } } - diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index 7003e9474..b44f5afb9 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -224,6 +224,8 @@ private slots: */ void toggleSplitView(); + void toggleSplitStash(); + /** Reloads the currently active view. */ void reloadView(); @@ -514,4 +516,3 @@ inline int DolphinMainWindow::getId() const } #endif // DOLPHIN_MAINWINDOW_H - diff --git a/src/dolphintabpage.cpp b/src/dolphintabpage.cpp index c674e1eb0..e6440af5e 100644 --- a/src/dolphintabpage.cpp +++ b/src/dolphintabpage.cpp @@ -71,13 +71,17 @@ bool DolphinTabPage::splitViewEnabled() const return m_splitViewEnabled; } -void DolphinTabPage::setSplitViewEnabled(bool enabled) +void DolphinTabPage::setSplitViewEnabled(bool enabled, bool stash /*= false*/) { if (m_splitViewEnabled != enabled) { m_splitViewEnabled = enabled; - + QUrl url; if (enabled) { - const QUrl& url = m_primaryViewContainer->url(); + if (stash) { + url = QUrl("stash:/"); + } else { + url = m_primaryViewContainer->url(); + } m_secondaryViewContainer = createViewContainer(url); const bool placesSelectorVisible = m_primaryViewContainer->urlNavigator()->isPlacesSelectorVisible(); diff --git a/src/dolphintabpage.h b/src/dolphintabpage.h index 9d180883a..d14574561 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, bool stash = false); /** * @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"/> |
