]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Open new instance of Dolphin if no URLs are given
authorAlexander Saoutkin <a.saoutkin@gmail.com>
Sat, 22 Jun 2019 13:44:11 +0000 (15:44 +0200)
committerNate Graham <nate@kde.org>
Sat, 22 Jun 2019 13:47:00 +0000 (15:47 +0200)
Summary:
BUG: 408387
BUG: 408244
FIXED-IN: 19.08.0

Currently Dolphin only opens a new instance of itself in the following two scenarios:
1. No other Dolphin instances ( D21666 deals with not matching daemonized instances) are currently running.
2. A new instance is explicitly asked for via:  `dolphin --new-window`

A third scenario is needed to fix this bug:
3. If no URLs are passed in as arguments then open a new instance.

This patch adds this third scenario.

Test Plan:
STEPS TO REPRODUCE
1. Open Dolphin
2. Right-click on Dolphin's Task Manager Entry and click "Start New Instance"
3. A new instance is created.

As my system stuff is not built on master I am unable to replicate the bug (and can't confirm whether this fixes it), hence I'll rely on @ngraham to confirm whether this patch fixes the issue.

Reviewers: ngraham, elvisangelaccio

Reviewed By: ngraham, elvisangelaccio

Subscribers: elvisangelaccio, ngraham, kfm-devel

Tags: #dolphin

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

src/global.cpp
src/main.cpp

index 73e154b3a035985203a05cc0fdd969b2b0b9c314..42044c97dc6b4aab31467ecc1e42e40f01e28eea 100644 (file)
@@ -72,8 +72,8 @@ 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)
 {
-    if (KWindowSystem::isPlatformWayland()) {
-        // TODO: once Wayland clients can raise or activate themselves remove this conditional
+    // TODO: once Wayland clients can raise or activate themselves remove check from conditional
+    if (KWindowSystem::isPlatformWayland() || inputUrls.isEmpty()) {
         return false;
     }
 
index 639dc32efa6694a8fdf00142935552200c0512e5..10adfc638b05cd4d91ba1816d587bbccb0c4108f 100644 (file)
@@ -142,11 +142,6 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
         return app.exec();
     }
 
-    if (urls.isEmpty()) {
-        // We need at least one URL to open Dolphin
-        urls.append(Dolphin::homeUrl());
-    }
-
     if (splitView && urls.size() < 2) {
         // Split view does only make sense if we have at least 2 URLs
         urls.append(urls.last());
@@ -159,6 +154,11 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
         }
     }
 
+    if (urls.isEmpty()) {
+        // We need at least one URL to open Dolphin
+        urls.append(Dolphin::homeUrl());
+    }
+    
     DolphinMainWindow* mainWindow = new DolphinMainWindow();
 
     if (openFiles) {