#include "dolphinfacetswidget.h"
#include <KLocalizedString>
+
#include <QButtonGroup>
#include <QCheckBox>
#include <QDate>
-#include <QRadioButton>
+#include <QEvent>
#include <QHBoxLayout>
+#include <QRadioButton>
DolphinFacetsWidget::DolphinFacetsWidget(QWidget* parent) :
QWidget(parent),
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;
terms << QStringLiteral("modified>=%1").arg(date.toString(Qt::ISODate));
}
- return terms.join(QStringLiteral(" AND "));
+ return terms.join(QLatin1String(" AND "));
}
QString DolphinFacetsWidget::facetType() const
void DolphinFacetsWidget::setFacetType(const QString& type)
{
- if (type == QLatin1String("Document")) {
+ if (type == QLatin1String("Folder")) {
+ m_folders->setChecked(true);
+ } else if (type == QLatin1String("Document")) {
m_documents->setChecked(true);
} else if (type == QLatin1String("Image")) {
m_images->setChecked(true);