- bool resetSplitSettings = false;
- if (parser.isSet("split") && !GeneralSettings::splitView()) {
- // Dolphin should be opened with a split view although this is not
- // set in the GeneralSettings. Temporary adjust the setting until
- // all passed URLs have been opened.
- GeneralSettings::setSplitView(true);
- resetSplitSettings = true;
-
- // We need 2 URLs to open Dolphin in split view mode
- if (urls.isEmpty()) { // No URL given - Open home URL in all two views
- urls.append(GeneralSettings::homeUrl());
- urls.append(GeneralSettings::homeUrl());
- } else if (urls.length() == 1) { // Only 1 URL given - Open given URL in all two views
- urls.append(urls.at(0));
+ if (!parser.isSet(QStringLiteral("new-window"))) {
+ if (Dolphin::attachToExistingInstance(urls, openFiles, splitView)) {
+ // Successfully attached to existing instance of Dolphin
+ return 0;