- const bool facetsIsVisible = SearchSettings::showFacetsWidget();
- m_facetsToggleButton->setChecked(facetsIsVisible ? true : false);
- m_facetsToggleButton->setIcon(QIcon::fromTheme(facetsIsVisible ? QStringLiteral("arrow-up-double") : QStringLiteral("arrow-down-double")));
- m_facetsToggleButton->setText(facetsIsVisible ? i18nc("action:button", "Fewer Options") : i18nc("action:button", "More Options"));
+ const bool facetsEnabled = m_facetsWidget->isEnabled();
+ const bool facetsVisible = m_facetsWidget->isVisible();
+
+ m_facetsToggleButton->setEnabled(facetsEnabled);
+ m_facetsToggleButton->setChecked(facetsVisible);
+
+ m_facetsToggleButton->setIcon(QIcon::fromTheme(
+ facetsVisible ? QStringLiteral("arrow-up-double") :
+ QStringLiteral("arrow-down-double")));
+
+ m_facetsToggleButton->setText(
+ facetsVisible ? i18nc("@action:button", "Fewer Options") :
+ i18nc("@action:button", "More Options"));
+
+ if (facetsEnabled) {
+ m_facetsToggleButton->setToolTip(QString());
+ } else {
+#ifdef HAVE_BALOO
+ const Baloo::IndexerConfig searchInfo;
+ if (!searchInfo.fileIndexingEnabled()) {
+ m_facetsToggleButton->setToolTip(i18nc("@info:tooltip", "Advanced search options are not available because the file indexing service is disabled."));
+ } else {
+ m_facetsToggleButton->setToolTip(i18nc("@info:tooltip", "Advanced search options are not available because this location is not indexed."));
+ }
+#else
+ m_facetsToggleButton->setToolTip(i18nc("@info:tooltip", "Advanced search options are not available because this version of Dolphin does not support the Baloo file indexer."));
+#endif
+ }