From 2704b3693f86b31ac033597c63898c3aef16edf7 Mon Sep 17 00:00:00 2001 From: arnav dhamija Date: Mon, 26 Sep 2016 22:25:42 +0530 Subject: Added the GUI button for quick stashing --- src/dolphinmainwindow.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/dolphinmainwindow.cpp') 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); } } - -- cgit v1.3 From 45d90a61f8ceb36d302c90ad8d02d3ded964c92d Mon Sep 17 00:00:00 2001 From: arnav dhamija Date: Tue, 27 Sep 2016 10:11:44 +0530 Subject: Found an icon for the button --- src/dolphinmainwindow.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/dolphinmainwindow.cpp') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index db9c34c6a..30498952c 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1050,6 +1050,7 @@ void DolphinMainWindow::setupActions() 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->setIcon(QIcon::fromTheme(QStringLiteral("folder-visiting"))); stashSplit->setCheckable(true); connect(stashSplit, &QAction::triggered, this, &DolphinMainWindow::toggleSplitStash); -- cgit v1.3 From a097a1277a02a5dd0f6d687e8bc2c3a7ec399efd Mon Sep 17 00:00:00 2001 From: arnav dhamija Date: Tue, 27 Sep 2016 10:37:08 +0530 Subject: Changed shortcut, but need to fix async conditions --- src/dolphinmainwindow.cpp | 2 +- src/dolphintabpage.cpp | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'src/dolphinmainwindow.cpp') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 30498952c..ea4ff0525 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1047,7 +1047,7 @@ void DolphinMainWindow::setupActions() connect(split, &QAction::triggered, this, &DolphinMainWindow::toggleSplitView); QAction* stashSplit = actionCollection()->addAction(QStringLiteral("split_stash")); - actionCollection()->setDefaultShortcut(stashSplit, Qt::Key_F2); + 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"))); diff --git a/src/dolphintabpage.cpp b/src/dolphintabpage.cpp index e6440af5e..3491dbad8 100644 --- a/src/dolphintabpage.cpp +++ b/src/dolphintabpage.cpp @@ -75,13 +75,9 @@ void DolphinTabPage::setSplitViewEnabled(bool enabled, bool stash /*= false*/) { if (m_splitViewEnabled != enabled) { m_splitViewEnabled = enabled; - QUrl url; + if (enabled) { - if (stash) { - url = QUrl("stash:/"); - } else { - url = m_primaryViewContainer->url(); - } + const QUrl& url = (stash) ? QUrl("stash:/") : m_primaryViewContainer->url(); m_secondaryViewContainer = createViewContainer(url); const bool placesSelectorVisible = m_primaryViewContainer->urlNavigator()->isPlacesSelectorVisible(); -- cgit v1.3 From 3e32ee5e8cfd4fd6ffc5b3a9cd14f5ab967eb8c6 Mon Sep 17 00:00:00 2001 From: arnav dhamija Date: Tue, 27 Sep 2016 10:55:35 +0530 Subject: need to fix async conditions --- src/dolphinmainwindow.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/dolphinmainwindow.cpp') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index ea4ff0525..cb230454d 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1469,6 +1469,7 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container) void DolphinMainWindow::updateSplitAction() { QAction* splitAction = actionCollection()->action(QStringLiteral("split_view")); + QAction* stashSplit = actionCollection()->action(QStringLiteral("stash_split")); const DolphinTabPage* tabPage = m_tabWidget->currentTabPage(); if (tabPage->splitViewEnabled()) { if (tabPage->primaryViewActive()) { -- cgit v1.3 From ee1231541a306bb5874426fe2db5451539983132 Mon Sep 17 00:00:00 2001 From: arnav dhamija Date: Tue, 27 Sep 2016 13:53:53 +0530 Subject: Fixed async conditions --- src/dolphinmainwindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/dolphinmainwindow.cpp') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index cb230454d..687b30698 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1469,7 +1469,7 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container) void DolphinMainWindow::updateSplitAction() { QAction* splitAction = actionCollection()->action(QStringLiteral("split_view")); - QAction* stashSplit = actionCollection()->action(QStringLiteral("stash_split")); + QAction* stashSplit = actionCollection()->action(QStringLiteral("split_stash")); const DolphinTabPage* tabPage = m_tabWidget->currentTabPage(); if (tabPage->splitViewEnabled()) { if (tabPage->primaryViewActive()) { @@ -1485,6 +1485,7 @@ void DolphinMainWindow::updateSplitAction() splitAction->setText(i18nc("@action:intoolbar Split view", "Split")); splitAction->setToolTip(i18nc("@info", "Split view")); splitAction->setIcon(QIcon::fromTheme(QStringLiteral("view-right-new"))); + stashSplit->setChecked(false); } } -- cgit v1.3 From e7f6a1010ac07dfddaaa75a372dbeaa6d0352731 Mon Sep 17 00:00:00 2001 From: arnav dhamija Date: Wed, 2 Nov 2016 21:49:11 +0530 Subject: Changed default arg for the setSplitViewEnabled --- src/dolphinmainwindow.cpp | 2 +- src/dolphintabpage.cpp | 4 ++-- src/dolphintabpage.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/dolphinmainwindow.cpp') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 687b30698..9817bf08a 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -527,7 +527,7 @@ void DolphinMainWindow::toggleSplitView() void DolphinMainWindow::toggleSplitStash() { DolphinTabPage* tabPage = m_tabWidget->currentTabPage(); - tabPage->setSplitViewEnabled(!tabPage->splitViewEnabled(), true); + tabPage->setSplitViewEnabled(!tabPage->splitViewEnabled(), QUrl("stash:/")); } void DolphinMainWindow::reloadView() diff --git a/src/dolphintabpage.cpp b/src/dolphintabpage.cpp index 3491dbad8..9d239fdfc 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, bool stash /*= false*/) +void DolphinTabPage::setSplitViewEnabled(bool enabled, QUrl secondaryUrl /*= QUrl()*/) { if (m_splitViewEnabled != enabled) { m_splitViewEnabled = enabled; if (enabled) { - const QUrl& url = (stash) ? QUrl("stash:/") : 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 d14574561..023f216fc 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, bool stash = false); + void setSplitViewEnabled(bool enabled, QUrl secondaryUrl = QUrl()); /** * @return The primary view containter. -- cgit v1.3 From fa9cc1333aa1bbb1ad5195069e8ddf477746552c Mon Sep 17 00:00:00 2001 From: arnav dhamija Date: Thu, 3 Nov 2016 09:35:15 +0530 Subject: This seems to work. Though it could be better --- src/dolphinmainwindow.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/dolphinmainwindow.cpp') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 9817bf08a..55577e27b 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -527,7 +527,16 @@ void DolphinMainWindow::toggleSplitView() void DolphinMainWindow::toggleSplitStash() { DolphinTabPage* tabPage = m_tabWidget->currentTabPage(); - tabPage->setSplitViewEnabled(!tabPage->splitViewEnabled(), QUrl("stash:/")); + QAction* stashSplit = actionCollection()->action(QStringLiteral("split_stash")); + qDebug() << "StashSplitstate" << stashSplit->isChecked(); + //stashSplit->setEnabled(false); + if (stashSplit->isChecked()) { + tabPage->setSplitViewEnabled(false); + tabPage->setSplitViewEnabled(true, QUrl("stash:/")); + stashSplit->setChecked(true); + } else { + tabPage->setSplitViewEnabled(false); + } } void DolphinMainWindow::reloadView() -- cgit v1.3 From 68cda76aa8f552246db136fa61303f9678cea7e7 Mon Sep 17 00:00:00 2001 From: arnav dhamija Date: Sun, 29 Jan 2017 22:00:08 +0530 Subject: Time to get back to business --- src/dolphinmainwindow.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/dolphinmainwindow.cpp') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 55577e27b..412d4fb2e 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -528,7 +528,6 @@ void DolphinMainWindow::toggleSplitStash() { DolphinTabPage* tabPage = m_tabWidget->currentTabPage(); QAction* stashSplit = actionCollection()->action(QStringLiteral("split_stash")); - qDebug() << "StashSplitstate" << stashSplit->isChecked(); //stashSplit->setEnabled(false); if (stashSplit->isChecked()) { tabPage->setSplitViewEnabled(false); -- cgit v1.3 From e8a48689431e0fc7b9ae0ed3fd0113227d4b99cb Mon Sep 17 00:00:00 2001 From: arnav dhamija Date: Sun, 29 Jan 2017 23:31:43 +0530 Subject: Made more changes --- src/dolphinmainwindow.cpp | 2 -- src/dolphintabpage.cpp | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'src/dolphinmainwindow.cpp') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 412d4fb2e..09fc7732b 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -528,11 +528,9 @@ void DolphinMainWindow::toggleSplitStash() { DolphinTabPage* tabPage = m_tabWidget->currentTabPage(); QAction* stashSplit = actionCollection()->action(QStringLiteral("split_stash")); - //stashSplit->setEnabled(false); if (stashSplit->isChecked()) { tabPage->setSplitViewEnabled(false); tabPage->setSplitViewEnabled(true, QUrl("stash:/")); - stashSplit->setChecked(true); } else { tabPage->setSplitViewEnabled(false); } diff --git a/src/dolphintabpage.cpp b/src/dolphintabpage.cpp index 9d239fdfc..0ed5fd2f2 100644 --- a/src/dolphintabpage.cpp +++ b/src/dolphintabpage.cpp @@ -71,7 +71,7 @@ bool DolphinTabPage::splitViewEnabled() const return m_splitViewEnabled; } -void DolphinTabPage::setSplitViewEnabled(bool enabled, QUrl secondaryUrl /*= QUrl()*/) +void DolphinTabPage::setSplitViewEnabled(bool enabled, QUrl secondaryUrl) { if (m_splitViewEnabled != enabled) { m_splitViewEnabled = enabled; -- cgit v1.3 From 8f28ceaad109d9366049b0a7381685e975519c77 Mon Sep 17 00:00:00 2001 From: arnav dhamija Date: Thu, 2 Feb 2017 21:46:54 +0530 Subject: More happy with this patch --- src/dolphinmainwindow.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/dolphinmainwindow.cpp') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 09fc7732b..f9d44c92d 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -528,12 +528,8 @@ void DolphinMainWindow::toggleSplitStash() { DolphinTabPage* tabPage = m_tabWidget->currentTabPage(); QAction* stashSplit = actionCollection()->action(QStringLiteral("split_stash")); - if (stashSplit->isChecked()) { - tabPage->setSplitViewEnabled(false); - tabPage->setSplitViewEnabled(true, QUrl("stash:/")); - } else { - tabPage->setSplitViewEnabled(false); - } + tabPage->setSplitViewEnabled(false); + tabPage->setSplitViewEnabled(true, QUrl("stash:/")); } void DolphinMainWindow::reloadView() @@ -1057,7 +1053,7 @@ void DolphinMainWindow::setupActions() 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(true); + stashSplit->setCheckable(false); connect(stashSplit, &QAction::triggered, this, &DolphinMainWindow::toggleSplitStash); QAction* reload = actionCollection()->addAction(QStringLiteral("reload")); @@ -1491,7 +1487,6 @@ void DolphinMainWindow::updateSplitAction() splitAction->setText(i18nc("@action:intoolbar Split view", "Split")); splitAction->setToolTip(i18nc("@info", "Split view")); splitAction->setIcon(QIcon::fromTheme(QStringLiteral("view-right-new"))); - stashSplit->setChecked(false); } } -- cgit v1.3 From b92ccf2ff5f3395e2e1d1cce71a9a2c32ab093a7 Mon Sep 17 00:00:00 2001 From: arnav dhamija Date: Mon, 13 Feb 2017 15:39:01 +0530 Subject: Improved the patch --- src/dolphinmainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/dolphinmainwindow.cpp') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index f9d44c92d..afc9d0420 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -58,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -527,7 +528,6 @@ void DolphinMainWindow::toggleSplitView() void DolphinMainWindow::toggleSplitStash() { DolphinTabPage* tabPage = m_tabWidget->currentTabPage(); - QAction* stashSplit = actionCollection()->action(QStringLiteral("split_stash")); tabPage->setSplitViewEnabled(false); tabPage->setSplitViewEnabled(true, QUrl("stash:/")); } @@ -1054,6 +1054,7 @@ void DolphinMainWindow::setupActions() 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")); @@ -1471,7 +1472,6 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container) void DolphinMainWindow::updateSplitAction() { QAction* splitAction = actionCollection()->action(QStringLiteral("split_view")); - QAction* stashSplit = actionCollection()->action(QStringLiteral("split_stash")); const DolphinTabPage* tabPage = m_tabWidget->currentTabPage(); if (tabPage->splitViewEnabled()) { if (tabPage->primaryViewActive()) { -- cgit v1.3 From d92d752828654faa3817039111c430310fdb0e9e Mon Sep 17 00:00:00 2001 From: arnav dhamija Date: Mon, 13 Feb 2017 22:16:56 +0530 Subject: Whitespace? --- src/dolphinmainwindow.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/dolphinmainwindow.cpp') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index afc9d0420..8d80d6b9a 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -528,6 +528,7 @@ void DolphinMainWindow::toggleSplitView() void DolphinMainWindow::toggleSplitStash() { DolphinTabPage* tabPage = m_tabWidget->currentTabPage(); + tabPage->setSplitViewEnabled(false); tabPage->setSplitViewEnabled(true, QUrl("stash:/")); } -- cgit v1.3 From f52f9331d07c69ac102e7085477e762abc03e661 Mon Sep 17 00:00:00 2001 From: arnav dhamija Date: Mon, 13 Feb 2017 22:17:00 +0530 Subject: Whitespace? --- src/dolphinmainwindow.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/dolphinmainwindow.cpp') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 8d80d6b9a..afc9d0420 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -528,7 +528,6 @@ void DolphinMainWindow::toggleSplitView() void DolphinMainWindow::toggleSplitStash() { DolphinTabPage* tabPage = m_tabWidget->currentTabPage(); - tabPage->setSplitViewEnabled(false); tabPage->setSplitViewEnabled(true, QUrl("stash:/")); } -- cgit v1.3 From 0d4924d8bbab256b13ae13040201bea7ea04ab2f Mon Sep 17 00:00:00 2001 From: arnav dhamija Date: Mon, 13 Feb 2017 22:20:59 +0530 Subject: Whitespace? --- src/dolphinmainwindow.cpp | 1 + src/dolphinmainwindow.h | 1 + 2 files changed, 2 insertions(+) (limited to 'src/dolphinmainwindow.cpp') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index afc9d0420..31b4cfed7 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1538,3 +1538,4 @@ void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job* job) KIO::FileUndoManager::UiInterface::jobError(job); } } + diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index 5aefa3714..d741eb21e 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -517,3 +517,4 @@ inline int DolphinMainWindow::getId() const } #endif // DOLPHIN_MAINWINDOW_H + -- cgit v1.3