]> cloud.milkyroute.net Git - dolphin.git/commitdiff
filenamesearch:/ define a title for the query
authorMéven Car <meven29@gmail.com>
Sun, 3 May 2020 10:45:54 +0000 (12:45 +0200)
committerMéven Car <meven29@gmail.com>
Sun, 3 May 2020 10:46:00 +0000 (12:46 +0200)
Summary: CCBUG: 420354

Reviewers: ngraham, elvisangelaccio, #dolphin, #frameworks, iasensio

Reviewed By: elvisangelaccio, #dolphin, iasensio

Subscribers: iasensio, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D29198

src/search/dolphinsearchbox.cpp
src/search/dolphinsearchbox.h

index 52a495270615bebe6aa39f6079a289badcd8e3cd..cdc0718dfb321391ef25c9e8bd7e8412282dc8cf 100644 (file)
@@ -136,6 +136,7 @@ QUrl DolphinSearchBox::urlForSearching() const
         }
 
         query.addQueryItem(QStringLiteral("url"), searchPath().url());
+        query.addQueryItem(QStringLiteral("title"), queryTitle(m_searchInput->text()));
 
         url.setQuery(query);
     }
@@ -472,6 +473,12 @@ void DolphinSearchBox::init()
     connect(m_startSearchTimer, &QTimer::timeout, this, &DolphinSearchBox::emitSearchRequest);
 }
 
+QString DolphinSearchBox::queryTitle(const QString& text) const
+{
+    return i18nc("@title UDS_DISPLAY_NAME for a KIO directory listing. %1 is the query the user entered.",
+                             "Query Results from '%1'", text);
+}
+
 QUrl DolphinSearchBox::balooUrlForSearching() const
 {
 #ifdef HAVE_BALOO
@@ -494,8 +501,7 @@ QUrl DolphinSearchBox::balooUrlForSearching() const
 
     query.setSearchString(queryStrings.join(QLatin1Char(' ')));
 
-    return query.toSearchUrl(i18nc("@title UDS_DISPLAY_NAME for a KIO directory listing. %1 is the query the user entered.",
-                                   "Query Results from '%1'", text));
+    return query.toSearchUrl(queryTitle(text));
 #else
     return QUrl();
 #endif
index 2bf3ce4b18c0c700a7295b617e9694a394bea1c9..4afd752bc15b00680ffb65981a826eaabed3a61c 100644 (file)
@@ -161,6 +161,8 @@ private:
     bool isIndexingEnabled() const;
 
 private:
+    QString queryTitle(const QString& text) const;
+
     bool m_startedSearching;
     bool m_active;