Commit 46a8c287 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[KDEPlatformFileDialog] Don't do stat if baseUrl didn't change

Qt might call `setDirectory` twice on dialog initialization, the second
one coming from `restoreFromSettings`.
This would needlessly trigger another `StatJob` if the URL didn't change.


(cherry picked from commit fffe10df)
parent 9d009462
Pipeline #141756 passed with stage
in 2 minutes and 13 seconds
...@@ -204,6 +204,11 @@ void KDEPlatformFileDialog::selectNameFilter(const QString &filter) ...@@ -204,6 +204,11 @@ void KDEPlatformFileDialog::selectNameFilter(const QString &filter)
void KDEPlatformFileDialog::setDirectory(const QUrl &directory) void KDEPlatformFileDialog::setDirectory(const QUrl &directory)
{ {
if (!directory.isLocalFile()) { if (!directory.isLocalFile()) {
// Short-circuit: Avoid stat if the effective URL hasn't changed
if (directory == m_fileWidget->baseUrl()) {
return;
}
// Qt can not determine if the remote URL points to a file or a // Qt can not determine if the remote URL points to a file or a
// directory, that is why options()->initialDirectory() always returns // directory, that is why options()->initialDirectory() always returns
// the full URL. // the full URL.
......
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