X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/c331d7068574dd468101ed8ade3ce51a2a8560c0..df85f24ecbf3dfb6431f357929328daaf7a59cfb:/src/search/dolphinfacetswidget.cpp diff --git a/src/search/dolphinfacetswidget.cpp b/src/search/dolphinfacetswidget.cpp index 34719730b..8bae83887 100644 --- a/src/search/dolphinfacetswidget.cpp +++ b/src/search/dolphinfacetswidget.cpp @@ -131,7 +131,11 @@ QStringList DolphinFacetsWidget::searchTerms() const if (!m_searchTags.isEmpty()) { for (auto const &tag : m_searchTags) { - terms << QStringLiteral("tag:%1").arg(tag); + if (tag.contains(QLatin1Char(' '))) { + terms << QStringLiteral("tag:\"%1\"").arg(tag); + } else { + terms << QStringLiteral("tag:%1").arg(tag); + } } } @@ -268,18 +272,24 @@ void DolphinFacetsWidget::updateTagsMenuItems(const QUrl&, const KFileItemList& allTags.sort(Qt::CaseInsensitive); allTags.removeDuplicates(); + const bool onlyOneTag = allTags.count() == 1; + for (const QString& tagName : qAsConst(allTags)) { QAction* action = m_tagsSelector->menu()->addAction(QIcon::fromTheme(QStringLiteral("tag")), tagName); action->setCheckable(true); action->setChecked(m_searchTags.contains(tagName)); - connect(action, &QAction::triggered, this, [this, tagName](bool isChecked) { + connect(action, &QAction::triggered, this, [this, tagName, onlyOneTag](bool isChecked) { if (isChecked) { addSearchTag(tagName); } else { removeSearchTag(tagName); } emit facetChanged(); + + if (!onlyOneTag) { + m_tagsSelector->menu()->show(); + } }); }