┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/search
diff options
context:
space:
mode:
authorLukáš Tinkl <[email protected]>2014-10-21 21:18:43 +0200
committerLukáš Tinkl <[email protected]>2014-10-21 21:19:14 +0200
commit1b4572dac9fb529d31b786f93e4f02c6f8aeeb21 (patch)
treecf88750183dbc93db5357be4a359c421c29d049c /src/search
parent3653c8ad6bfb21a4b098f4e89d5ff34ed6df2901 (diff)
port Dolphin from KUrl to QUrl
REVIEW: 120688
Diffstat (limited to 'src/search')
-rw-r--r--src/search/dolphinsearchbox.cpp31
-rw-r--r--src/search/dolphinsearchbox.h16
2 files changed, 23 insertions, 24 deletions
diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp
index 050ae394d..65d35539c 100644
--- a/src/search/dolphinsearchbox.cpp
+++ b/src/search/dolphinsearchbox.cpp
@@ -82,7 +82,7 @@ QString DolphinSearchBox::text() const
return m_searchInput->text();
}
-void DolphinSearchBox::setSearchPath(const KUrl& url)
+void DolphinSearchBox::setSearchPath(const QUrl& url)
{
m_searchPath = url;
@@ -94,7 +94,7 @@ void DolphinSearchBox::setSearchPath(const KUrl& url)
if (url.isLocalFile()) {
location = QLatin1String("/");
} else {
- location = url.protocol() + QLatin1String(" - ") + url.host();
+ location = url.scheme() + QLatin1String(" - ") + url.host();
}
}
@@ -114,14 +114,14 @@ void DolphinSearchBox::setSearchPath(const KUrl& url)
m_facetsWidget->setEnabled(hasFacetsSupport);
}
-KUrl DolphinSearchBox::searchPath() const
+QUrl DolphinSearchBox::searchPath() const
{
return m_searchPath;
}
-KUrl DolphinSearchBox::urlForSearching() const
+QUrl DolphinSearchBox::urlForSearching() const
{
- KUrl url;
+ QUrl url;
bool useBalooSearch = false;
#ifdef HAVE_BALOO
const Baloo::IndexerConfig searchInfo;
@@ -130,7 +130,7 @@ KUrl DolphinSearchBox::urlForSearching() const
if (useBalooSearch) {
url = balooUrlForSearching();
} else {
- url.setProtocol("filenamesearch");
+ url.setScheme("filenamesearch");
url.addQueryItem("search", m_searchInput->text());
if (m_contentButton->isChecked()) {
url.addQueryItem("checkContent", "yes");
@@ -151,15 +151,14 @@ KUrl DolphinSearchBox::urlForSearching() const
return url;
}
-void DolphinSearchBox::fromSearchUrl(const KUrl& url)
+void DolphinSearchBox::fromSearchUrl(const QUrl& url)
{
- if (url.protocol() == "baloosearch") {
+ if (url.scheme() == "baloosearch") {
fromBalooSearchUrl(url);
- } else if (url.protocol() == "filenamesearch") {
- const QMap<QString, QString>& queryItems = url.queryItems();
- setText(queryItems.value("search"));
- setSearchPath(queryItems.value("url"));
- m_contentButton->setChecked(queryItems.value("checkContent") == "yes");
+ } else if (url.scheme() == "filenamesearch") {
+ setText(url.queryItemValue("search"));
+ setSearchPath(url.queryItemValue("url"));
+ m_contentButton->setChecked(url.queryItemValue("checkContent") == "yes");
} else {
setText(QString());
setSearchPath(url);
@@ -449,7 +448,7 @@ void DolphinSearchBox::init()
updateFacetsToggleButton();
}
-KUrl DolphinSearchBox::balooUrlForSearching() const
+QUrl DolphinSearchBox::balooUrlForSearching() const
{
#ifdef HAVE_BALOO
const QString text = m_searchInput->text();
@@ -483,11 +482,11 @@ KUrl DolphinSearchBox::balooUrlForSearching() const
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));
#else
- return KUrl();
+ return QUrl();
#endif
}
-void DolphinSearchBox::fromBalooSearchUrl(const KUrl& url)
+void DolphinSearchBox::fromBalooSearchUrl(const QUrl& url)
{
#ifdef HAVE_BALOO
const Baloo::Query query = Baloo::Query::fromSearchUrl(url);
diff --git a/src/search/dolphinsearchbox.h b/src/search/dolphinsearchbox.h
index 16a6ec0c1..2de4c457c 100644
--- a/src/search/dolphinsearchbox.h
+++ b/src/search/dolphinsearchbox.h
@@ -20,7 +20,7 @@
#ifndef DOLPHINSEARCHBOX_H
#define DOLPHINSEARCHBOX_H
-#include <KUrl>
+#include <QUrl>
#include <QWidget>
#include <config-baloo.h>
@@ -71,17 +71,17 @@ public:
* Sets the current path that is used as root for
* searching files, if "From Here" has been selected.
*/
- void setSearchPath(const KUrl& url);
- KUrl searchPath() const;
+ void setSearchPath(const QUrl& url);
+ QUrl searchPath() const;
/** @return URL that will start the searching of files. */
- KUrl urlForSearching() const;
+ QUrl urlForSearching() const;
/**
* Extracts information from the given search \a url to
* initialize the search box properly.
*/
- void fromSearchUrl(const KUrl& url);
+ void fromSearchUrl(const QUrl& url);
/**
* Selects the whole text of the search box.
@@ -155,13 +155,13 @@ private:
/**
* @return URL that represents the Baloo query for starting the search.
*/
- KUrl balooUrlForSearching() const;
+ QUrl balooUrlForSearching() const;
/**
* Extracts information from the given Baloo search \a url to
* initialize the search box properly.
*/
- void fromBalooSearchUrl(const KUrl& url);
+ void fromBalooSearchUrl(const QUrl& url);
void updateFacetsToggleButton();
private:
@@ -186,7 +186,7 @@ private:
QToolButton* m_facetsToggleButton;
DolphinFacetsWidget* m_facetsWidget;
- KUrl m_searchPath;
+ QUrl m_searchPath;
QTimer* m_startSearchTimer;
};