X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/5dd5eaf08da4b7d11e53c90096c2ea0e6a19e840..0dd0b65bf02f52da0d2e9d270160e69b81a357ca:/src/global.cpp diff --git a/src/global.cpp b/src/global.cpp index d87a29c7a..20dee00fa 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -17,6 +17,11 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include +#include + +#include + #include "global.h" #include "dolphindebug.h" @@ -24,9 +29,10 @@ QList Dolphin::validateUris(const QStringList& uriList) { + const QString currentDir = QDir::currentPath(); QList 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 { @@ -40,3 +46,18 @@ QUrl Dolphin::homeUrl() { return QUrl::fromUserInput(GeneralSettings::homeUrl(), QString(), QUrl::AssumeLocalFile); } + +void Dolphin::openNewWindow(const QList &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()); +}