diff --git a/applets/clipboard/contents/ui/TextItemDelegate.qml b/applets/clipboard/contents/ui/TextItemDelegate.qml
index d54c526eb..e2ffa66c3 100644
--- a/applets/clipboard/contents/ui/TextItemDelegate.qml
+++ b/applets/clipboard/contents/ui/TextItemDelegate.qml
@@ -30,7 +30,7 @@ PlasmaComponents.Label {
text: {
var highlightFontTag = "%1"
- var text = DisplayRole
+ var text = DisplayRole.slice(0, 100)
// first escape any HTML characters to prevent privacy issues
text = text.replace(/&/g, "&").replace(//g, ">")
diff --git a/runners/baloo/baloosearchrunner.cpp b/runners/baloo/baloosearchrunner.cpp
index a55912d6d..52411c9a6 100644
--- a/runners/baloo/baloosearchrunner.cpp
+++ b/runners/baloo/baloosearchrunner.cpp
@@ -116,21 +116,24 @@ RemoteMatches SearchRunner::Match(const QString& searchTerm)
void SearchRunner::performMatch()
{
+ // Filter out duplicates
+ QSet foundUrls;
+
RemoteMatches matches;
- matches << matchInternal(m_searchTerm, QStringLiteral("Audio"), i18n("Audio"));
- matches << matchInternal(m_searchTerm, QStringLiteral("Image"), i18n("Image"));
- matches << matchInternal(m_searchTerm, QStringLiteral("Document"), i18n("Document"));
- matches << matchInternal(m_searchTerm, QStringLiteral("Video"), i18n("Video"));
- matches << matchInternal(m_searchTerm, QStringLiteral("Folder"), i18n("Folder"));
- matches << matchInternal(m_searchTerm, QStringLiteral("Archive"), i18n("Archive"));
- matches << matchInternal(m_searchTerm, QStringLiteral("Spreadsheet"), i18n("Spreadsheet"));
- matches << matchInternal(m_searchTerm, QStringLiteral("Presentation"), i18n("Presentation"));
+ matches << matchInternal(m_searchTerm, QStringLiteral("Audio"), i18n("Audio"), foundUrls);
+ matches << matchInternal(m_searchTerm, QStringLiteral("Image"), i18n("Image"), foundUrls);
+ matches << matchInternal(m_searchTerm, QStringLiteral("Video"), i18n("Video"), foundUrls);
+ matches << matchInternal(m_searchTerm, QStringLiteral("Spreadsheet"), i18n("Spreadsheet"), foundUrls);
+ matches << matchInternal(m_searchTerm, QStringLiteral("Presentation"), i18n("Presentation"), foundUrls);
+ matches << matchInternal(m_searchTerm, QStringLiteral("Folder"), i18n("Folder"), foundUrls);
+ matches << matchInternal(m_searchTerm, QStringLiteral("Document"), i18n("Document"), foundUrls);
+ matches << matchInternal(m_searchTerm, QStringLiteral("Archive"), i18n("Archive"), foundUrls);
QDBusConnection::sessionBus().send(m_lastRequest.createReply(QVariant::fromValue(matches)));
m_lastRequest = QDBusMessage();
}
-RemoteMatches SearchRunner::matchInternal(const QString& searchTerm, const QString &type, const QString &category)
+RemoteMatches SearchRunner::matchInternal(const QString& searchTerm, const QString &type, const QString &category, QSet &foundUrls)
{
Baloo::Query query;
query.setSearchString(searchTerm);
@@ -154,6 +157,13 @@ RemoteMatches SearchRunner::matchInternal(const QString& searchTerm, const QStri
RemoteMatch match;
QString localUrl = it.filePath();
const QUrl url = QUrl::fromLocalFile(localUrl);
+
+ if (foundUrls.contains(url)) {
+ continue;
+ }
+
+ foundUrls.insert(url);
+
match.id = it.filePath();
match.text = url.fileName();
match.iconName = mimeDb.mimeTypeForFile(localUrl).iconName();
diff --git a/runners/baloo/baloosearchrunner.h b/runners/baloo/baloosearchrunner.h
index 53b99a0dd..9cb2f6e0f 100644
--- a/runners/baloo/baloosearchrunner.h
+++ b/runners/baloo/baloosearchrunner.h
@@ -46,7 +46,7 @@ public:
private:
void performMatch();
RemoteMatches matchInternal(const QString &searchTerm, const QString& type,
- const QString& category);
+ const QString& category, QSet &foundUrls);
QDBusMessage m_lastRequest;
QString m_searchTerm;