diff options
| author | Ismael Asensio <[email protected]> | 2020-07-31 23:59:21 +0200 |
|---|---|---|
| committer | Ismael Asensio <[email protected]> | 2020-08-04 22:34:05 +0200 |
| commit | f9fd0e7be301eb6fa5019b0abfdfbc7ed60e2325 (patch) | |
| tree | d3e02b0b9463e29e8ba2f4f9b4287c7fdbb340a6 /src | |
| parent | 48158d7079cd5f727eade27aa516d8f3133abca2 (diff) | |
[search] Close tags menu after click when there is only one tag
It stays open otherwise to allow checking/unchecking several tags at a time
BUG: 424873
FIXED-IN: 20.08
Diffstat (limited to 'src')
| -rw-r--r-- | src/search/dolphinfacetswidget.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/search/dolphinfacetswidget.cpp b/src/search/dolphinfacetswidget.cpp index d9943abcd..8bae83887 100644 --- a/src/search/dolphinfacetswidget.cpp +++ b/src/search/dolphinfacetswidget.cpp @@ -272,12 +272,14 @@ 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 { @@ -285,7 +287,9 @@ void DolphinFacetsWidget::updateTagsMenuItems(const QUrl&, const KFileItemList& } emit facetChanged(); - m_tagsSelector->menu()->show(); + if (!onlyOneTag) { + m_tagsSelector->menu()->show(); + } }); } |
