]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/global.cpp
Remove unused #include
[dolphin.git] / src / global.cpp
index 2f23ae4d4c36cee336bc8cf6d4e193fd3a086d5f..aaeb5812060e18d7f2a38d494d9afa3afc4eedcd 100644 (file)
  */
 
 #include "global.h"
+
+#include "dolphin_generalsettings.h"
 #include "dolphindebug.h"
 
+#include <KRun>
+
+#include <QApplication>
+#include <QIcon>
+
 QList<QUrl> Dolphin::validateUris(const QStringList& uriList)
 {
+    const QString currentDir = QDir::currentPath();
     QList<QUrl> urls;
     foreach (const QString& str, uriList) {
-        const QUrl url = QUrl::fromUserInput(str, QString(), QUrl::AssumeLocalFile);
+        const QUrl url = QUrl::fromUserInput(str, currentDir, QUrl::AssumeLocalFile);
         if (url.isValid()) {
             urls.append(url);
         } else {
@@ -33,3 +41,23 @@ QList<QUrl> Dolphin::validateUris(const QStringList& uriList)
     }
     return urls;
 }
+
+QUrl Dolphin::homeUrl()
+{
+    return QUrl::fromUserInput(GeneralSettings::homeUrl(), QString(), QUrl::AssumeLocalFile);
+}
+
+void Dolphin::openNewWindow(const QList<QUrl> &urls, QWidget *window, const OpenNewWindowFlags &flags)
+{
+    QString command = QStringLiteral("dolphin");
+
+    if (flags.testFlag(OpenNewWindowFlag::Select)) {
+        command.append(QLatin1String(" --select"));
+    }
+
+    if (!urls.isEmpty()) {
+        command.append(QLatin1String(" %U"));
+    }
+
+    KRun::run(command, urls, window, qApp->applicationDisplayName(), qApp->windowIcon().name());
+}