diff options
author | David Faure <david.faure@kdab.com> | 2014-07-09 15:03:35 +0200 |
---|---|---|
committer | David Faure <david.faure@kdab.com> | 2014-07-26 09:49:33 +0200 |
commit | fd331a5b3a122393cd697a8b856dd52cfd31d698 (patch) | |
tree | 8743ce9b26863cbd5091624e8168257e1d7f6f01 /src/widgets/dialogs/qsidebar.cpp | |
parent | 63efdf9851915ce3b81bffe089fcd1995d6750f8 (diff) |
QUrl: fromLocalFile(QString()) should lead to an empty URL.
This is much more useful than the URL "file:", it allows to use
"empty path" and "empty URL" for the same meaning (e.g. not set).
QFileDialog actually uses "file:" though, as the URL for the
"My Computer" item in the sidebar. This patch preserves that.
[ChangeLog][QtCore][QUrl] QUrl::fromLocalFile now returns an empty URL
if the input string is empty.
Change-Id: Ib5ce1a3cdf5f229368e5bcd83c62c1d1ac9f8a17
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/widgets/dialogs/qsidebar.cpp')
-rw-r--r-- | src/widgets/dialogs/qsidebar.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/widgets/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp index 3d22992e3a..7b691dc609 100644 --- a/src/widgets/dialogs/qsidebar.cpp +++ b/src/widgets/dialogs/qsidebar.cpp @@ -249,7 +249,8 @@ void QUrlModel::addUrls(const QList<QUrl> &list, int row, bool move) continue; //this makes sure the url is clean const QString cleanUrl = QDir::cleanPath(url.toLocalFile()); - url = QUrl::fromLocalFile(cleanUrl); + if (!cleanUrl.isEmpty()) + url = QUrl::fromLocalFile(cleanUrl); for (int j = 0; move && j < rowCount(); ++j) { QString local = index(j, 0).data(UrlRole).toUrl().toLocalFile(); |