+void DolphinSearchBox::fromBalooSearchUrl(const QUrl& url)
+{
+#ifdef HAVE_BALOO
+ const Baloo::Query query = Baloo::Query::fromSearchUrl(url);
+
+ // Block all signals to avoid unnecessary "searchRequest" signals
+ // while we adjust the search text and the facet widget.
+ blockSignals(true);
+
+ const QString customDir = query.includeFolder();
+ if (!customDir.isEmpty()) {
+ setSearchPath(QUrl::fromLocalFile(customDir));
+ } else {
+ setSearchPath(QUrl::fromLocalFile(QDir::homePath()));
+ }
+
+ setText(query.searchString());
+
+ QStringList types = query.types();
+ if (!types.isEmpty()) {
+ m_facetsWidget->setFacetType(types.first());
+ }
+
+ const QStringList subTerms = query.searchString().split(' ', QString::SkipEmptyParts);
+ foreach (const QString& subTerm, subTerms) {
+ if (subTerm.startsWith(QLatin1String("filename:"))) {
+ const QString value = subTerm.mid(9);
+ setText(value);
+ } else if (m_facetsWidget->isRatingTerm(subTerm)) {
+ m_facetsWidget->setRatingTerm(subTerm);
+ }
+ }
+
+ m_startSearchTimer->stop();
+ blockSignals(false);
+#else
+ Q_UNUSED(url);
+#endif
+}
+
+void DolphinSearchBox::updateFacetsToggleButton()
+{
+ 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"));
+}
+