]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Added the GUI button for quick stashing
authorarnav dhamija <arnav.dhamija@gmail.com>
Mon, 26 Sep 2016 16:55:42 +0000 (22:25 +0530)
committerarnav dhamija <arnav.dhamija@gmail.com>
Mon, 26 Sep 2016 16:55:42 +0000 (22:25 +0530)
src/dolphinmainwindow.cpp
src/dolphinmainwindow.h
src/dolphintabpage.cpp
src/dolphintabpage.h
src/dolphinui.rc

index 4d97fc1b13e550f638e8766832f6d779476a8d40..db9c34c6ac5f21ccc01761c1b6955e909672eedf 100644 (file)
@@ -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);
     }
 }
-
index 7003e94744769450656d3bf3ab84152178059074..b44f5afb9d830b67f71871cc9f993bf580a847de 100644 (file)
@@ -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
-
index c674e1eb018d192ac48901edb53d062d18b2a24f..e6440af5e22b0249f1ff61cdebcc40bcb826238c 100644 (file)
@@ -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();
index 9d180883ab06b1bc59f35f8f0d35672f69c416ab..d145745614d7acad000d54d6be736f43ea6084e0 100644 (file)
@@ -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.
index f197af402e1ece48e68378e14ce654ca8e81cfa0..c446656561d8b03e88dc7a862b3685ba095218c5 100644 (file)
@@ -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"/>