File 0001-Fix-native-QFileDialog-initial-selection-for-remote-.patch of Package libqt5-qtbase.16540

From 56dd51935266090acc272feeec4fa58e435d1baa Mon Sep 17 00:00:00 2001
From: Alex Richardson <arichardson.kde@gmail.com>
Date: Tue, 17 Jan 2017 22:31:04 +0000
Subject: [PATCH] Fix native QFileDialog initial selection for remote URLs

When using QFileDialog::getOpenFileUrl() with dir set to e.g.
"sftp://foo/bar.cpp" we call q->selectDirectoryUrl("sftp://foo")
followed by q->selectFile("bar.cpp").
Inside  QFileDialog::selectFile() we unconditionally convert "bar.cpp"
to an absolute URL and then call d->selectFile_sys("$CWD/bar.cpp")
This then calls platform integration that detects that an absolute URL
is being passed to selectFile() and therefore overrides the initial
directory.

Initially reported as https://bugs.kde.org/show_bug.cgi?id=374913

This is a regression that appeared some time between Qt 5.7.0 and 5.7.1.
I have not had time to bisect this but the only commit that may have
change behavior in that time range appears to be
007f92c6eef6191c48da0c44916591d48813ae62.

Change-Id: I6968abe9ed5c5b9de067c453a7e9d2c5cdb3a190
Reviewed-by: Christoph Resch
Reviewed-by: David Faure <david.faure@kdab.com>
---
 src/widgets/dialogs/qfiledialog.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 8d37969be4..cb2c534b24 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -2830,7 +2830,10 @@ void QFileDialogPrivate::init(const QUrl &directory, const QString &nameFilter,
     if (!nameFilter.isEmpty())
         q->setNameFilter(nameFilter);
     q->setDirectoryUrl(workingDirectory(directory));
-    q->selectFile(initialSelection(directory));
+    if (directory.isLocalFile())
+        q->selectFile(initialSelection(directory));
+    else
+        q->selectUrl(directory);
 
 #ifndef QT_NO_SETTINGS
     // Try to restore from the FileDialog settings group; if it fails, fall back
-- 
2.20.1
openSUSE Build Service is sponsored by