]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Adding option to open externally called folder in a new tab
authorAlexander Saoutkin <a.saoutkin@gmail.com>
Sun, 23 Jun 2019 11:22:41 +0000 (13:22 +0200)
committerNate Graham <nate@kde.org>
Sun, 23 Jun 2019 11:27:25 +0000 (13:27 +0200)
Summary:
Adds an option to open externally called folder in a new tab.

By default this option is enabled

Test Plan:
If option selected:
1. All valid arguments passed to Dolphin should be opened in tabs of an instance(s) (if it exists). Duplicate tabs just change activation to current tab.

If option not selected:
1. All calls to Dolphin result in a new instance being opened

This option does not require Dolphin to be restarted to take effect.

Reviewers: #dolphin, elvisangelaccio, ngraham

Reviewed By: #dolphin, ngraham

Subscribers: broulik, ngraham, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D21736

src/dbusinterface.cpp
src/global.cpp
src/settings/dolphin_generalsettings.kcfg
src/settings/startup/startupsettingspage.cpp
src/settings/startup/startupsettingspage.h

index 4e24354abefe5578c05ac501bea288417000df1f..15016d2e08a978d85d3e814612f9f169627b95f7 100644 (file)
@@ -59,7 +59,7 @@ void DBusInterface::ShowItems(const QStringList& uriList, const QString& startUp
     }
     const auto serviceName = QStringLiteral("org.kde.dolphin-%1").arg(QCoreApplication::applicationPid());
     if(!Dolphin::attachToExistingInstance(urls, true, GeneralSettings::splitView(), serviceName)) {
-        Dolphin::openNewWindow(urls);
+        Dolphin::openNewWindow(urls, nullptr, Dolphin::OpenNewWindowFlag::Select);
     };
 }
 
index 42044c97dc6b4aab31467ecc1e42e40f01e28eea..4547faced407a9244eeb84e47bc47f07e6d79c70 100644 (file)
@@ -73,7 +73,7 @@ void Dolphin::openNewWindow(const QList<QUrl> &urls, QWidget *window, const Open
 bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFiles, bool splitView, const QString& preferredService)
 {
     // TODO: once Wayland clients can raise or activate themselves remove check from conditional
-    if (KWindowSystem::isPlatformWayland() || inputUrls.isEmpty()) {
+    if (KWindowSystem::isPlatformWayland() || inputUrls.isEmpty() || !GeneralSettings::openExternallyCalledFolderInNewTab()) {
         return false;
     }
 
index 5a6bba06b6b20e9618afe3cad128132e4f8be5a2..5a7bb1a01d582b0ca5952085131fcc3073dae308 100644 (file)
             <label>Should the full path be shown in the title bar</label>
             <default>false</default>
         </entry>
+        <entry name="OpenExternallyCalledFolderInNewTab" type="Bool">
+            <label>Should an externally called folder open in a new tab in an existing Dolphin instance</label>
+            <default>true</default>
+        </entry>
         <entry name="Version" type="Int">
             <label>Internal version of Dolphin, containing 3 digits for major, minor, bugfix</label>
             <default>0</default>
index 23d8731d4726e4c4e191768759445f689e8955d2..d7d5fba4cc1e954e925a4e6f7a9004439f56102d 100644 (file)
@@ -43,7 +43,8 @@ StartupSettingsPage::StartupSettingsPage(const QUrl& url, QWidget* parent) :
     m_editableUrl(nullptr),
     m_showFullPath(nullptr),
     m_filterBar(nullptr),
-    m_showFullPathInTitlebar(nullptr)
+    m_showFullPathInTitlebar(nullptr),
+    m_openExternallyCalledFolderInNewTab(nullptr)
 {
     QFormLayout* topLayout = new QFormLayout(this);
 
@@ -100,6 +101,8 @@ StartupSettingsPage::StartupSettingsPage(const QUrl& url, QWidget* parent) :
     topLayout->addRow(QString(), m_filterBar);
     m_showFullPathInTitlebar = new QCheckBox(i18nc("@option:check Startup Settings", "Show full path in title bar"));
     topLayout->addRow(QString(), m_showFullPathInTitlebar);
+    m_openExternallyCalledFolderInNewTab = new QCheckBox(i18nc("@option:check Startup Settings", "Open new folders in tabs"));
+    topLayout->addRow(QString(), m_openExternallyCalledFolderInNewTab);
 
 
     loadSettings();
@@ -110,6 +113,7 @@ StartupSettingsPage::StartupSettingsPage(const QUrl& url, QWidget* parent) :
     connect(m_showFullPath, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged);
     connect(m_filterBar,    &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged);
     connect(m_showFullPathInTitlebar, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged);
+    connect(m_openExternallyCalledFolderInNewTab, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged);
 }
 
 StartupSettingsPage::~StartupSettingsPage()
@@ -133,7 +137,7 @@ void StartupSettingsPage::applySettings()
     settings->setShowFullPath(m_showFullPath->isChecked());
     settings->setFilterBar(m_filterBar->isChecked());
     settings->setShowFullPathInTitlebar(m_showFullPathInTitlebar->isChecked());
-
+    settings->setOpenExternallyCalledFolderInNewTab(m_openExternallyCalledFolderInNewTab->isChecked());
     settings->save();
 }
 
@@ -183,4 +187,5 @@ void StartupSettingsPage::loadSettings()
     m_showFullPath->setChecked(GeneralSettings::showFullPath());
     m_filterBar->setChecked(GeneralSettings::filterBar());
     m_showFullPathInTitlebar->setChecked(GeneralSettings::showFullPathInTitlebar());
+    m_openExternallyCalledFolderInNewTab->setChecked(GeneralSettings::openExternallyCalledFolderInNewTab());
 }
index e06b65697fafa43fd4dc5f5900bddd3a08f48f89..a5e0b236f415f7551da914074e80511188bfdd66 100644 (file)
@@ -64,6 +64,7 @@ private:
     QCheckBox* m_showFullPath;
     QCheckBox* m_filterBar;
     QCheckBox* m_showFullPathInTitlebar;
+    QCheckBox* m_openExternallyCalledFolderInNewTab;
 };
 
 #endif