[utilities/krusader] app/Dialogs: PopularUrls: Fix an incoherence

Toni Asensi Esteve <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 0eaa6f80c735f6f1e01fb3ad3179b70e4253c7d1 by Toni Asensi Esteve.
Committed on 16/08/2026 at 22:14.
Pushed by asensi into branch 'master'.

PopularUrls: Fix an incoherence

There is a mismatch: in `PopularUrls::save()`, `toDisplayString()` is used:
    KConfigGroup svr(krConfig, "Private");
    [...]
    QStringList urlList;
    [...]
    urlList << p->url.toDisplayString();
    [...]
    svr.writeEntry("PopularUrls", urlList);
    [...]
and in `load()`, that text (in that "toDisplayString()" format) is used
in order to populate `ranks`:
    [...]
    QStringList urlList = svr.readEntry("PopularUrls", QStringList());
    [...]
    uit = urlList.begin()
    [...]
    ranks.insert(*uit, node);
however, in `PopularUrls::addUrl(const QUrl &url)`, the format that is used is the "url()" one:
    ranks.insert(tmpurl.url(), pnode);

This commit is aimed to ensure that the keys in `ranks` are always in "url()" format (regardless of whether the node is loaded from the configuration or added using `addUrl()`), avoiding possible errors.

Revision: https://invent.kde.org/utilities/krusader/-/merge_requests/193

M  +1    -1    app/Dialogs/popularurls.cpp

https://invent.kde.org/utilities/krusader/-/commit/0eaa6f80c735f6f1e01fb3ad3179b70e4253c7d1

diff --git a/app/Dialogs/popularurls.cpp b/app/Dialogs/popularurls.cpp
index 1940e2dd6..60e794456 100644
--- a/app/Dialogs/popularurls.cpp
+++ b/app/Dialogs/popularurls.cpp
@@ -99,7 +99,7 @@ void PopularUrls::load()
         node->url = QUrl(*uit);
         node->rank = *rit;
         appendNode(node);
-        ranks.insert(*uit, node);
+        ranks.insert(node->url.url(), node);
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.