summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Larrosa <larrosa@kde.org>2016-09-28 14:57:04 (GMT)
committerAntonio Larrosa <larrosa@kde.org>2016-09-28 15:05:20 (GMT)
commit3d0531c0f253e469126b463f0dfb374a19dee641 (patch)
treefcf028c9b79f66ba870d51158dd33aa1fdf56d45
parent5a280dd2f44dc3d5693a59390df309658dc12da7 (diff)
Fix handling of multiple arguments in command line
Summary: When running gwenview with multiple local images as arguments in the command line, the constructed urls used to create the links in the temporary directory were wrong. This commit fixes the urls so they can point to local files. Also, if some file was specified multiple times in the command line, the user was presented with a KIO rename dialog, which is quite strange since the user was just opening some images, so this commit also removed duplicated arguments. Reviewers: apol Reviewed By: apol Subscribers: apol Differential Revision: https://phabricator.kde.org/D2880
-rw-r--r--app/main.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/app/main.cpp b/app/main.cpp
index a28ca82..503ea95 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -59,24 +59,17 @@ public:
mMultipleUrlsDir.reset(new QTemporaryDir);
mUrl = QUrl::fromLocalFile(mMultipleUrlsDir->path());
QList<QUrl> list;
- foreach(const QString & url, args) {
- list << QUrl::fromUserInput(url);
+ QStringList tmpArgs = args;
+ tmpArgs.removeDuplicates();
+ foreach(const QString & url, tmpArgs) {
+ list << QUrl::fromUserInput(url, QDir::currentPath(), QUrl::AssumeLocalFile);
}
KIO::CopyJob* job = KIO::link(list, mUrl);
job->exec();
} else {
QString tmpArg = args.first();
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
- mUrl = QUrl::fromUserInput(tmpArg, QDir::currentPath());
-#else
- QUrl tmpUrl = QUrl(tmpArg);
- if (tmpUrl.scheme().isEmpty() && !tmpArg.startsWith(QLatin1Char('/'))) {
- mUrl = QUrl::fromLocalFile(tmpArg);
- } else {
- mUrl = QUrl::fromUserInput(tmpArg);
- }
-#endif
+ mUrl = QUrl::fromUserInput(tmpArg, QDir::currentPath(), QUrl::AssumeLocalFile);
}
if (mUrl.isValid() && (fullscreen || slideshow)) {