From 48344390525ea25ffb1cdf363eb596e2ac6c795e Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 29 Jan 2015 13:27:04 +0100 Subject: [PATCH] QFileDialog: don't clear directory url upon show If the app sets a directory url that is not a local file, the url would be cleared just before showing the dialog. The reason is that we try to convert the url to a local file when preparing helper options, but fail. Trying to convert the url in the first place is wrong, since the app should be able to point the file dialog to any url, not just local directories. Since QFileDialogPrivate::init() calls QFileDialog::setDirectoryUrl(), and setDirectoryUrl() calls options->setInitialDirectory(), there should be no reason to set initialDirectory once more in QFileDialogPrivate::helperPrepareShow(). The easiest fix is therefore to remove the code in initHelper() that modifies the initial url. Change-Id: Ia6c2113e867b1156cf9d59d347116f7df8c06d93 Reviewed-by: Shawn Rutledge --- src/widgets/dialogs/qfiledialog.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 4616933bcf..0f368f4910 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -586,10 +586,6 @@ void QFileDialogPrivate::helperPrepareShow(QPlatformDialogHelper *) options->setHistory(q->history()); if (usingWidgets()) options->setSidebarUrls(qFileDialogUi->sidebar->urls()); - const QDir directory = q->directory(); - options->setInitialDirectory(directory.exists() ? - QUrl::fromLocalFile(directory.absolutePath()) : - QUrl()); if (options->initiallySelectedNameFilter().isEmpty()) options->setInitiallySelectedNameFilter(q->selectedNameFilter()); if (options->initiallySelectedFiles().isEmpty())