┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/search/selectors/dateselector.cpp
diff options
context:
space:
mode:
authorFelix Ernst <[email protected]>2026-04-27 22:25:02 +0200
committerFelix Ernst <[email protected]>2026-04-29 01:51:03 +0200
commit4a6d048a77d0954c350df5ce9b3657fc69c9ada4 (patch)
tree4c5fddcba01eb06134e3346501e8d9092bed6aee /src/search/selectors/dateselector.cpp
parentaf12f10b7d0fdbc5b737abb226f27077e6f952a7 (diff)
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.
Diffstat (limited to 'src/search/selectors/dateselector.cpp')
-rw-r--r--src/search/selectors/dateselector.cpp7
1 files changed, 6 insertions, 1 deletions
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 <KDatePicker>
@@ -19,7 +20,11 @@ Search::DateSelector::DateSelector(std::shared_ptr<const DolphinQuery> 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<ChipBase *>(parent) ? KDatePickerPopup::DatePicker | KDatePickerPopup::Words
+ : KDatePickerPopup::NoDate | KDatePickerPopup::DatePicker | KDatePickerPopup::Words,
+ dolphinQuery->modifiedSinceDate(),
+ this}}
{
setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
setPopupMode(QToolButton::InstantPopup);