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);
+ }
}
}
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();
+ }
});
}