SHA256
1
0
forked from pool/gwenview5
gwenview5/fix-multiple-arguments.diff

36 lines
1.5 KiB
Diff
Raw Normal View History

Index: gwenview-16.08.1/app/main.cpp
===================================================================
--- gwenview-16.08.1.orig/app/main.cpp
+++ gwenview-16.08.1/app/main.cpp
@@ -59,8 +59,19 @@ 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) {
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
+ list << QUrl::fromUserInput(url, QDir::currentPath(), QUrl::AssumeLocalFile);
+#else
+ QUrl tmpUrl = QUrl(url);
+ if (tmpUrl.scheme().isEmpty() && !url.startsWith(QLatin1Char('/'))) {
+ list << QUrl::fromLocalFile(url);
+ } else {
+ list << QUrl::fromUserInput(url);
+ }
+#endif
}
KIO::CopyJob* job = KIO::link(list, mUrl);
@@ -68,7 +79,7 @@ public:
} else {
QString tmpArg = args.first();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
- mUrl = QUrl::fromUserInput(tmpArg, QDir::currentPath());
+ mUrl = QUrl::fromUserInput(tmpArg, QDir::currentPath(), QUrl::AssumeLocalFile);
#else
QUrl tmpUrl = QUrl(tmpArg);
if (tmpUrl.scheme().isEmpty() && !tmpArg.startsWith(QLatin1Char('/'))) {