Commit 3d0531c0 authored by Antonio Larrosa Jimenez's avatar Antonio Larrosa Jimenez
Browse files

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
parent 5a280dd2
......@@ -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)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment