diff options
| author | Emmanuel Pescosta <[email protected]> | 2014-10-21 22:54:15 +0200 |
|---|---|---|
| committer | Emmanuel Pescosta <[email protected]> | 2014-10-21 22:54:15 +0200 |
| commit | c07a97c4be1b5118026ea95831fd1edf7fac34e9 (patch) | |
| tree | c27d1c1640a5d75c17bf22691e206197540f2f9f /src/panels | |
| parent | c9641c96f9cb4438dc16f26512a5138c6a12f5cb (diff) | |
Use the path instead of the display string in PlacesItemModel::closestItem,
fixes the determination of the closest item for me.
Diffstat (limited to 'src/panels')
| -rw-r--r-- | src/panels/places/placesitemmodel.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index e49a6a9da..8e6494919 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -214,8 +214,12 @@ int PlacesItemModel::closestItem(const QUrl& url) const for (int i = 0; i < count(); ++i) { const QUrl itemUrl = placesItem(i)->url(); - if (itemUrl.isParentOf(url)) { - const int length = itemUrl.toDisplayString().length(); + if (url == itemUrl) { + // We can't find a closer one, so stop here. + foundIndex = i; + break; + } else if (itemUrl.isParentOf(url)) { + const int length = itemUrl.path().length(); if (length > maxLength) { foundIndex = i; maxLength = length; |
