From 4a6d048a77d0954c350df5ce9b3657fc69c9ada4 Mon Sep 17 00:00:00 2001 From: Felix Ernst Date: Mon, 27 Apr 2026 22:25:02 +0200 Subject: Search/Selectors: Prevent unexpectedly removing a chip One can close a chip by pressing the "X" close button on it. Prior to this commit, one could also close a chip somewhat unexpectedly by choosing an option from the Chip's dropdown. This commit removes any "empty" options from the Chips which would lead to the Chip disappearing. Example: Choosing "Any Rating" would remove the rating chip because it would no longer act as a restriction on what the search should find. Now the "Any Rating" option is not added to the Chip in the first place. --- src/search/selectors/dateselector.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/search/selectors/dateselector.cpp') diff --git a/src/search/selectors/dateselector.cpp b/src/search/selectors/dateselector.cpp index 70e563614..a7f4463e5 100644 --- a/src/search/selectors/dateselector.cpp +++ b/src/search/selectors/dateselector.cpp @@ -6,6 +6,7 @@ #include "dateselector.h" +#include "../chip.h" #include "../dolphinquery.h" #include @@ -19,7 +20,11 @@ Search::DateSelector::DateSelector(std::shared_ptr dolphinQu : QToolButton{parent} , UpdatableStateInterface{dolphinQuery} , m_datePickerPopup{ - new KDatePickerPopup{KDatePickerPopup::NoDate | KDatePickerPopup::DatePicker | KDatePickerPopup::Words, dolphinQuery->modifiedSinceDate(), this}} + new KDatePickerPopup{/* When in a Chip, we don't add the KDatePickerPopup::NoDate option because it would allow removing the Chip unexpectedly. */ + qobject_cast(parent) ? KDatePickerPopup::DatePicker | KDatePickerPopup::Words + : KDatePickerPopup::NoDate | KDatePickerPopup::DatePicker | KDatePickerPopup::Words, + dolphinQuery->modifiedSinceDate(), + this}} { setToolButtonStyle(Qt::ToolButtonTextBesideIcon); setPopupMode(QToolButton::InstantPopup); -- cgit v1.3