Changeset View
Changeset View
Standalone View
Standalone View
src/search/dolphinfacetswidget.cpp
Show All 23 Lines | |||||
24 | #include <QCheckBox> | 24 | #include <QCheckBox> | ||
25 | #include <QDate> | 25 | #include <QDate> | ||
26 | #include <QRadioButton> | 26 | #include <QRadioButton> | ||
27 | #include <QHBoxLayout> | 27 | #include <QHBoxLayout> | ||
28 | #include <QVBoxLayout> | 28 | #include <QVBoxLayout> | ||
29 | 29 | | |||
30 | DolphinFacetsWidget::DolphinFacetsWidget(QWidget* parent) : | 30 | DolphinFacetsWidget::DolphinFacetsWidget(QWidget* parent) : | ||
31 | QWidget(parent), | 31 | QWidget(parent), | ||
32 | m_folders(0), | ||||
32 | m_documents(0), | 33 | m_documents(0), | ||
33 | m_images(0), | 34 | m_images(0), | ||
34 | m_audio(0), | 35 | m_audio(0), | ||
35 | m_videos(0), | 36 | m_videos(0), | ||
36 | m_folders(0), | | |||
37 | m_anytime(0), | 37 | m_anytime(0), | ||
38 | m_today(0), | 38 | m_today(0), | ||
39 | m_yesterday(0), | 39 | m_yesterday(0), | ||
40 | m_thisWeek(0), | 40 | m_thisWeek(0), | ||
41 | m_thisMonth(0), | 41 | m_thisMonth(0), | ||
42 | m_thisYear(0), | 42 | m_thisYear(0), | ||
43 | m_anyRating(0), | 43 | m_anyRating(0), | ||
44 | m_oneOrMore(0), | 44 | m_oneOrMore(0), | ||
45 | m_twoOrMore(0), | 45 | m_twoOrMore(0), | ||
46 | m_threeOrMore(0), | 46 | m_threeOrMore(0), | ||
47 | m_fourOrMore(0), | 47 | m_fourOrMore(0), | ||
48 | m_maxRating(0) | 48 | m_maxRating(0) | ||
49 | { | 49 | { | ||
50 | QButtonGroup* filetypeGroup = new QButtonGroup(this); | 50 | QButtonGroup* filetypeGroup = new QButtonGroup(this); | ||
51 | m_anyType = createRadioButton(i18nc("@option:check", "Any"), filetypeGroup); | 51 | m_anyType = createRadioButton(i18nc("@option:check", "Any"), filetypeGroup); | ||
52 | m_folders = createRadioButton(i18nc("@option:check", "Folders"), filetypeGroup); | ||||
52 | m_documents = createRadioButton(i18nc("@option:check", "Documents"), filetypeGroup); | 53 | m_documents = createRadioButton(i18nc("@option:check", "Documents"), filetypeGroup); | ||
53 | m_images = createRadioButton(i18nc("@option:check", "Images"), filetypeGroup); | 54 | m_images = createRadioButton(i18nc("@option:check", "Images"), filetypeGroup); | ||
54 | m_audio = createRadioButton(i18nc("@option:check", "Audio Files"), filetypeGroup); | 55 | m_audio = createRadioButton(i18nc("@option:check", "Audio Files"), filetypeGroup); | ||
55 | m_videos = createRadioButton(i18nc("@option:check", "Videos"), filetypeGroup); | 56 | m_videos = createRadioButton(i18nc("@option:check", "Videos"), filetypeGroup); | ||
56 | m_folders = createRadioButton(i18nc("@option:check", "Folders"), filetypeGroup); | | |||
57 | 57 | | |||
58 | QVBoxLayout* typeLayout = new QVBoxLayout(); | 58 | QVBoxLayout* typeLayout = new QVBoxLayout(); | ||
59 | typeLayout->setSpacing(0); | 59 | typeLayout->setSpacing(0); | ||
60 | typeLayout->addWidget(m_anyType); | 60 | typeLayout->addWidget(m_anyType); | ||
61 | typeLayout->addWidget(m_folders); | ||||
61 | typeLayout->addWidget(m_documents); | 62 | typeLayout->addWidget(m_documents); | ||
62 | typeLayout->addWidget(m_images); | 63 | typeLayout->addWidget(m_images); | ||
63 | typeLayout->addWidget(m_audio); | 64 | typeLayout->addWidget(m_audio); | ||
64 | typeLayout->addWidget(m_videos); | 65 | typeLayout->addWidget(m_videos); | ||
65 | typeLayout->addWidget(m_folders); | | |||
66 | typeLayout->addStretch(); | 66 | typeLayout->addStretch(); | ||
67 | 67 | | |||
68 | QButtonGroup* timespanGroup = new QButtonGroup(this); | 68 | QButtonGroup* timespanGroup = new QButtonGroup(this); | ||
69 | m_anytime = createRadioButton(i18nc("@option:option", "Anytime"), timespanGroup); | 69 | m_anytime = createRadioButton(i18nc("@option:option", "Anytime"), timespanGroup); | ||
70 | m_today = createRadioButton(i18nc("@option:option", "Today"), timespanGroup); | 70 | m_today = createRadioButton(i18nc("@option:option", "Today"), timespanGroup); | ||
71 | m_yesterday = createRadioButton(i18nc("@option:option", "Yesterday"), timespanGroup); | 71 | m_yesterday = createRadioButton(i18nc("@option:option", "Yesterday"), timespanGroup); | ||
72 | m_thisWeek = createRadioButton(i18nc("@option:option", "This Week"), timespanGroup); | 72 | m_thisWeek = createRadioButton(i18nc("@option:option", "This Week"), timespanGroup); | ||
73 | m_thisMonth = createRadioButton(i18nc("@option:option", "This Month"), timespanGroup); | 73 | m_thisMonth = createRadioButton(i18nc("@option:option", "This Month"), timespanGroup); | ||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Line(s) | 138 | if (!m_anytime->isChecked()) { | |||
150 | terms << QStringLiteral("modified>=%1").arg(date.toString(Qt::ISODate)); | 150 | terms << QStringLiteral("modified>=%1").arg(date.toString(Qt::ISODate)); | ||
151 | } | 151 | } | ||
152 | 152 | | |||
153 | return terms.join(QStringLiteral(" AND ")); | 153 | return terms.join(QStringLiteral(" AND ")); | ||
154 | } | 154 | } | ||
155 | 155 | | |||
156 | QString DolphinFacetsWidget::facetType() const | 156 | QString DolphinFacetsWidget::facetType() const | ||
157 | { | 157 | { | ||
158 | if (m_documents->isChecked()) { | 158 | if (m_folders->isChecked()) { | ||
159 | return QStringLiteral("Folder"); | ||||
160 | } else if (m_documents->isChecked()) { | ||||
159 | return QStringLiteral("Document"); | 161 | return QStringLiteral("Document"); | ||
160 | } else if (m_images->isChecked()) { | 162 | } else if (m_images->isChecked()) { | ||
161 | return QStringLiteral("Image"); | 163 | return QStringLiteral("Image"); | ||
162 | } else if (m_audio->isChecked()) { | 164 | } else if (m_audio->isChecked()) { | ||
163 | return QStringLiteral("Audio"); | 165 | return QStringLiteral("Audio"); | ||
164 | } else if (m_videos->isChecked()) { | 166 | } else if (m_videos->isChecked()) { | ||
165 | return QStringLiteral("Video"); | 167 | return QStringLiteral("Video"); | ||
166 | } else if (m_folders->isChecked()) { | | |||
167 | return QStringLiteral("Folder"); | | |||
168 | } | 168 | } | ||
169 | 169 | | |||
170 | return QString(); | 170 | return QString(); | ||
171 | } | 171 | } | ||
172 | 172 | | |||
173 | bool DolphinFacetsWidget::isRatingTerm(const QString& term) const | 173 | bool DolphinFacetsWidget::isRatingTerm(const QString& term) const | ||
174 | { | 174 | { | ||
175 | const QStringList subTerms = term.split(' ', QString::SkipEmptyParts); | 175 | const QStringList subTerms = term.split(' ', QString::SkipEmptyParts); | ||
▲ Show 20 Lines • Show All 108 Lines • Show Last 20 Lines |