]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinapplication.cpp
SVN_SILENT: Minor simplificiation of the code. No change of behavior has been done.
[dolphin.git] / src / dolphinapplication.cpp
index e0e1c594044e3055679a16aa27e5f369678b329e..c418f4540d086a4ae45536625c18301215bb0925 100644 (file)
@@ -69,30 +69,36 @@ void DolphinApplication::refreshMainWindows()
     }
 }
 
-
 int DolphinApplication::newInstance()
 {
-    int exitValue = KUniqueApplication::newInstance();
-
     KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
-    if (args->count() > 0) {
-        for (int i = 0; i < args->count(); ++i) {
-            openWindow(args->url(i));
+
+    QList<KUrl> urls;
+    const int argsCount = args->count();
+    for (int i = 0; i < argsCount; ++i) {
+        urls.append(args->url(i));
+    }
+
+    DolphinMainWindow* win = createMainWindow();
+    if (urls.count() > 0) {
+        if (args->isSet("select")) {
+            win->openFiles(urls);
+        } else {
+            win->openDirectories(urls);
         }
-    } else {
-        openWindow(KUrl());
     }
+    win->show();
 
     args->clear();
-
-    return exitValue;
+    return 0;
 }
 
-int DolphinApplication::openWindow(const KUrl& url)
+int DolphinApplication::openWindow(const QString& urlString)
 {
     DolphinMainWindow* win = createMainWindow();
-    if ((win->activeViewContainer() != 0) && url.isValid()) {
-        win->activeViewContainer()->setUrl(url);
+    const KUrl url(urlString);
+    if (!url.isEmpty()) {
+        win->openDirectories(QList<KUrl>() << url);
     }
     win->show();
     return win->getId();