+
+ QFontMetrics metrics(m_fromHereButton->font());
+ const int maxWidth = metrics.height() * 8;
+
+ QString location = url.fileName();
+ if (location.isEmpty()) {
+ if (url.isLocalFile()) {
+ location = QStringLiteral("/");
+ } else {
+ location = url.scheme() + QLatin1String(" - ") + url.host();
+ }
+ }
+
+ const QString elidedLocation = metrics.elidedText(location, Qt::ElideMiddle, maxWidth);
+ m_fromHereButton->setText(i18nc("action:button", "From Here (%1)", elidedLocation));
+
+ const bool showSearchFromButtons = url.isLocalFile();
+ m_separator->setVisible(showSearchFromButtons);
+ m_fromHereButton->setVisible(showSearchFromButtons);
+ m_everywhereButton->setVisible(showSearchFromButtons);
+
+ bool hasFacetsSupport = false;
+#ifdef HAVE_BALOO
+ const Baloo::IndexerConfig searchInfo;
+ hasFacetsSupport = searchInfo.fileIndexingEnabled() && searchInfo.shouldBeIndexed(m_searchPath.toLocalFile());
+#endif
+ m_facetsWidget->setEnabled(hasFacetsSupport);