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

Fix handling of multiple arguments in command line

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:
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;
foreach(const QString & url, tmpArgs) {
list << QUrl::fromUserInput(url, QDir::currentPath(), QUrl::AssumeLocalFile);
KIO::CopyJob* job = KIO::link(list, mUrl);
} else {
QString tmpArg = args.first();
mUrl = QUrl::fromUserInput(tmpArg, QDir::currentPath());
QUrl tmpUrl = QUrl(tmpArg);
if (tmpUrl.scheme().isEmpty() && !tmpArg.startsWith(QLatin1Char('/'))) {
mUrl = QUrl::fromLocalFile(tmpArg);
} else {
mUrl = QUrl::fromUserInput(tmpArg);
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