┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/search/dolphinsearchbox.cpp
diff options
context:
space:
mode:
authorIsmael Asensio <[email protected]>2019-10-08 21:42:11 +0200
committerElvis Angelaccio <[email protected]>2019-10-08 21:42:11 +0200
commitdf9ca5b0c2238a42cfd829ab9ad30d574e4ece29 (patch)
tree28c355150ebeacb3467a45d354b2f210274c947b /src/search/dolphinsearchbox.cpp
parente30357343bdadd6bf6bb94e5adf54d8b840ef1bd (diff)
[dolphin/search] Add method isIndexEnabled()
Summary: Extracts the logic for checking if the current path is indexed to its own method. Test Plan: No behavior changes Reviewers: elvisangelaccio, ngraham, meven Reviewed By: ngraham, meven Subscribers: meven, kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D24478
Diffstat (limited to 'src/search/dolphinsearchbox.cpp')
-rw-r--r--src/search/dolphinsearchbox.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp
index 6a87edc9e..1c1accd26 100644
--- a/src/search/dolphinsearchbox.cpp
+++ b/src/search/dolphinsearchbox.cpp
@@ -107,12 +107,7 @@ void DolphinSearchBox::setSearchPath(const QUrl& url)
m_fromHereButton->setText(i18nc("action:button", "From Here (%1)", elidedLocation));
m_fromHereButton->setToolTip(i18nc("action:button", "Limit search to '%1' and its subfolders", cleanedUrl.toString(QUrl::PreferLocalFile)));
- bool hasFacetsSupport = false;
-#ifdef HAVE_BALOO
- const Baloo::IndexerConfig searchInfo;
- hasFacetsSupport = searchInfo.fileIndexingEnabled() && searchInfo.shouldBeIndexed(m_searchPath.toLocalFile());
-#endif
- m_facetsWidget->setEnabled(hasFacetsSupport);
+ m_facetsWidget->setEnabled(isIndexingEnabled());
}
QUrl DolphinSearchBox::searchPath() const
@@ -123,12 +118,8 @@ QUrl DolphinSearchBox::searchPath() const
QUrl DolphinSearchBox::urlForSearching() const
{
QUrl url;
- bool useBalooSearch = false;
-#ifdef HAVE_BALOO
- const Baloo::IndexerConfig searchInfo;
- useBalooSearch = searchInfo.fileIndexingEnabled() && searchInfo.shouldBeIndexed(m_searchPath.toLocalFile());
-#endif
- if (useBalooSearch) {
+
+ if (isIndexingEnabled()) {
url = balooUrlForSearching();
} else {
url.setScheme(QStringLiteral("filenamesearch"));
@@ -566,3 +557,12 @@ void DolphinSearchBox::updateFacetsToggleButton()
m_facetsToggleButton->setText(facetsIsVisible ? i18nc("action:button", "Fewer Options") : i18nc("action:button", "More Options"));
}
+bool DolphinSearchBox::isIndexingEnabled() const
+{
+#ifdef HAVE_BALOO
+ const Baloo::IndexerConfig searchInfo;
+ return searchInfo.fileIndexingEnabled() && searchInfo.shouldBeIndexed(m_searchPath.toLocalFile());
+#else
+ return false;
+#endif
+}