diff --git a/src/search/dolphinfacetswidget.h b/src/search/dolphinfacetswidget.h --- a/src/search/dolphinfacetswidget.h +++ b/src/search/dolphinfacetswidget.h @@ -24,6 +24,7 @@ class QButtonGroup; class QDate; +class QEvent; class QRadioButton; /** @@ -50,6 +51,8 @@ explicit DolphinFacetsWidget(QWidget* parent = nullptr); ~DolphinFacetsWidget() override; + void resetOptions(); + QString ratingTerm() const; QString facetType() const; @@ -61,6 +64,9 @@ signals: void facetChanged(); +protected: + void changeEvent(QEvent* event) override; + private: void setRating(const int stars); void setTimespan(const QDate& date); diff --git a/src/search/dolphinfacetswidget.cpp b/src/search/dolphinfacetswidget.cpp --- a/src/search/dolphinfacetswidget.cpp +++ b/src/search/dolphinfacetswidget.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -106,15 +107,27 @@ topLayout->addLayout(ratingLayout); topLayout->addStretch(); - m_anyType->setChecked(true); - m_anytime->setChecked(true); - m_anyRating->setChecked(true); + resetOptions(); } DolphinFacetsWidget::~DolphinFacetsWidget() { } +void DolphinFacetsWidget::changeEvent(QEvent *event) +{ + if (event->type() == QEvent::EnabledChange && !isEnabled()) { + resetOptions(); + } +} + +void DolphinFacetsWidget::resetOptions() +{ + m_anyType->setChecked(true); + m_anytime->setChecked(true); + m_anyRating->setChecked(true); +} + QString DolphinFacetsWidget::ratingTerm() const { QStringList terms; diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp --- a/src/search/dolphinsearchbox.cpp +++ b/src/search/dolphinsearchbox.cpp @@ -524,6 +524,8 @@ setSearchPath(QUrl::fromLocalFile(QDir::homePath())); } + m_facetsWidget->resetOptions(); + setText(query.searchString()); QStringList types = query.types();