- // Add input from search filter
- const QString text = m_searchInput->text();
- if (!text.isEmpty()) {
- if (m_fileNameButton->isChecked()) {
- QString regex = QRegExp::escape(text);
- regex.replace("\\*", QLatin1String(".*"));
- regex.replace("\\?", QLatin1String("."));
- regex.replace("\\", "\\\\");
- andTerm.addSubTerm(Nepomuk::Query::ComparisonTerm(
- Nepomuk::Vocabulary::NFO::fileName(),
- Nepomuk::Query::LiteralTerm(regex),
- Nepomuk::Query::ComparisonTerm::Regexp));
- } else {
- const Nepomuk::Query::Query customQuery = Nepomuk::Query::QueryParser::parseQuery(text, Nepomuk::Query::QueryParser::DetectFilenamePattern);
- if (customQuery.isValid()) {
- andTerm.addSubTerm(customQuery.term());
- }
- }
+ // Block all signals to avoid unnecessary "searchRequest" signals
+ // while we adjust the search text and the facet widget.
+ blockSignals(true);
+
+ const QVariantMap customOptions = query.customOptions();
+ if (customOptions.contains("includeFolder")) {
+ setSearchPath(customOptions.value("includeFolder").toString());
+ } else {
+ setSearchPath(QDir::homePath());