Changeset View
Changeset View
Standalone View
Standalone View
src/search/dolphinsearchbox.cpp
Show First 20 Lines • Show All 101 Lines • ▼ Show 20 Line(s) | 101 | } else { | |||
---|---|---|---|---|---|
102 | m_fromHereButton->setChecked(true); | 102 | m_fromHereButton->setChecked(true); | ||
103 | m_everywhereButton->setChecked(false); | 103 | m_everywhereButton->setChecked(false); | ||
104 | } | 104 | } | ||
105 | 105 | | |||
106 | const QString elidedLocation = metrics.elidedText(location, Qt::ElideMiddle, maxWidth); | 106 | const QString elidedLocation = metrics.elidedText(location, Qt::ElideMiddle, maxWidth); | ||
107 | m_fromHereButton->setText(i18nc("action:button", "From Here (%1)", elidedLocation)); | 107 | m_fromHereButton->setText(i18nc("action:button", "From Here (%1)", elidedLocation)); | ||
108 | m_fromHereButton->setToolTip(i18nc("action:button", "Limit search to '%1' and its subfolders", cleanedUrl.toString(QUrl::PreferLocalFile))); | 108 | m_fromHereButton->setToolTip(i18nc("action:button", "Limit search to '%1' and its subfolders", cleanedUrl.toString(QUrl::PreferLocalFile))); | ||
109 | 109 | | |||
110 | bool hasFacetsSupport = false; | 110 | m_facetsWidget->setEnabled(isIndexingEnabled()); | ||
111 | #ifdef HAVE_BALOO | | |||
112 | const Baloo::IndexerConfig searchInfo; | | |||
113 | hasFacetsSupport = searchInfo.fileIndexingEnabled() && searchInfo.shouldBeIndexed(m_searchPath.toLocalFile()); | | |||
114 | #endif | | |||
115 | m_facetsWidget->setEnabled(hasFacetsSupport); | | |||
116 | } | 111 | } | ||
117 | 112 | | |||
118 | QUrl DolphinSearchBox::searchPath() const | 113 | QUrl DolphinSearchBox::searchPath() const | ||
119 | { | 114 | { | ||
120 | return m_searchPath; | 115 | return m_searchPath; | ||
121 | } | 116 | } | ||
122 | 117 | | |||
123 | QUrl DolphinSearchBox::urlForSearching() const | 118 | QUrl DolphinSearchBox::urlForSearching() const | ||
124 | { | 119 | { | ||
125 | QUrl url; | 120 | QUrl url; | ||
126 | bool useBalooSearch = false; | 121 | | ||
127 | #ifdef HAVE_BALOO | 122 | if (isIndexingEnabled()) { | ||
128 | const Baloo::IndexerConfig searchInfo; | | |||
129 | useBalooSearch = searchInfo.fileIndexingEnabled() && searchInfo.shouldBeIndexed(m_searchPath.toLocalFile()); | | |||
130 | #endif | | |||
131 | if (useBalooSearch) { | | |||
132 | url = balooUrlForSearching(); | 123 | url = balooUrlForSearching(); | ||
133 | } else { | 124 | } else { | ||
134 | url.setScheme(QStringLiteral("filenamesearch")); | 125 | url.setScheme(QStringLiteral("filenamesearch")); | ||
135 | 126 | | |||
136 | QUrlQuery query; | 127 | QUrlQuery query; | ||
137 | query.addQueryItem(QStringLiteral("search"), m_searchInput->text()); | 128 | query.addQueryItem(QStringLiteral("search"), m_searchInput->text()); | ||
138 | if (m_contentButton->isChecked()) { | 129 | if (m_contentButton->isChecked()) { | ||
139 | query.addQueryItem(QStringLiteral("checkContent"), QStringLiteral("yes")); | 130 | query.addQueryItem(QStringLiteral("checkContent"), QStringLiteral("yes")); | ||
▲ Show 20 Lines • Show All 421 Lines • ▼ Show 20 Line(s) | |||||
561 | void DolphinSearchBox::updateFacetsToggleButton() | 552 | void DolphinSearchBox::updateFacetsToggleButton() | ||
562 | { | 553 | { | ||
563 | const bool facetsIsVisible = SearchSettings::showFacetsWidget(); | 554 | const bool facetsIsVisible = SearchSettings::showFacetsWidget(); | ||
564 | m_facetsToggleButton->setChecked(facetsIsVisible ? true : false); | 555 | m_facetsToggleButton->setChecked(facetsIsVisible ? true : false); | ||
565 | m_facetsToggleButton->setIcon(QIcon::fromTheme(facetsIsVisible ? QStringLiteral("arrow-up-double") : QStringLiteral("arrow-down-double"))); | 556 | m_facetsToggleButton->setIcon(QIcon::fromTheme(facetsIsVisible ? QStringLiteral("arrow-up-double") : QStringLiteral("arrow-down-double"))); | ||
566 | m_facetsToggleButton->setText(facetsIsVisible ? i18nc("action:button", "Fewer Options") : i18nc("action:button", "More Options")); | 557 | m_facetsToggleButton->setText(facetsIsVisible ? i18nc("action:button", "Fewer Options") : i18nc("action:button", "More Options")); | ||
567 | } | 558 | } | ||
568 | 559 | | |||
560 | bool DolphinSearchBox::isIndexingEnabled() const | ||||
561 | { | ||||
562 | #ifdef HAVE_BALOO | ||||
563 | const Baloo::IndexerConfig searchInfo; | ||||
564 | return searchInfo.fileIndexingEnabled() && searchInfo.shouldBeIndexed(m_searchPath.toLocalFile()); | ||||
565 | #else | ||||
566 | return false; | ||||
567 | #endif | ||||
568 | } |