mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-17 15:31:20 +00:00
Use the path instead of the display string in PlacesItemModel::closestItem,
fixes the determination of the closest item for me.
This commit is contained in:
parent
c9641c96f9
commit
c07a97c4be
|
@ -214,8 +214,12 @@ int PlacesItemModel::closestItem(const QUrl& url) const
|
||||||
|
|
||||||
for (int i = 0; i < count(); ++i) {
|
for (int i = 0; i < count(); ++i) {
|
||||||
const QUrl itemUrl = placesItem(i)->url();
|
const QUrl itemUrl = placesItem(i)->url();
|
||||||
if (itemUrl.isParentOf(url)) {
|
if (url == itemUrl) {
|
||||||
const int length = itemUrl.toDisplayString().length();
|
// 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) {
|
if (length > maxLength) {
|
||||||
foundIndex = i;
|
foundIndex = i;
|
||||||
maxLength = length;
|
maxLength = length;
|
||||||
|
|
Loading…
Reference in a new issue