diff --git a/runners/recentdocuments/recentdocuments.cpp b/runners/recentdocuments/recentdocuments.cpp --- a/runners/recentdocuments/recentdocuments.cpp +++ b/runners/recentdocuments/recentdocuments.cpp @@ -75,21 +75,32 @@ const QString homePath = QDir::homePath(); + // avoid duplicates + QSet knownUrls; + foreach (const QString &document, m_recentdocuments) { if (!context.isValid()) { return; } if (document.contains(term, Qt::CaseInsensitive)) { KDesktopFile config(document); + + const QUrl url = QUrl(config.readUrl()); + if (knownUrls.contains(url)) { + continue; + } + + knownUrls.insert(url); + Plasma::QueryMatch match(this); match.setType(Plasma::QueryMatch::PossibleMatch); match.setRelevance(1.0); match.setIconName(config.readIcon()); - match.setData(config.readUrl()); + match.setData(url); match.setText(config.readName()); - QUrl folderUrl = QUrl(config.readUrl()).adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash); + QUrl folderUrl = url.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash); if (folderUrl.isLocalFile()) { QString folderPath = folderUrl.toLocalFile(); if (folderPath.startsWith(homePath)) {