From: arnav dhamija Date: Mon, 26 Sep 2016 16:55:42 +0000 (+0530) Subject: Added the GUI button for quick stashing X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/2704b3693f86b31ac033597c63898c3aef16edf7 Added the GUI button for quick stashing --- 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 @@ + @@ -97,6 +98,7 @@ +