diff options
| author | Vishesh Handa <[email protected]> | 2014-03-24 10:48:53 +0100 |
|---|---|---|
| committer | Vishesh Handa <[email protected]> | 2014-03-24 14:38:15 +0100 |
| commit | 76e5fd48349bb521e5403d694f1dc45f2d22d1ae (patch) | |
| tree | 26cb8385f157984e901487363aee5793d7b081cb /src/search/dolphinfacetswidget.cpp | |
| parent | 3e576a16597b154a137604efd16323e1a1338f60 (diff) | |
Dolphin Facet Widget: Convert type selection into radio buttons
They were previously checkboxes. Most files cannot have more than 1 type
considering that the exposed types were "Document", "Image", "Video" and
"Audio".
Also, it is not very simple in baloo to search through ORs for types.
Not through the exposed API anyway.
REVIEW: 117015
Diffstat (limited to 'src/search/dolphinfacetswidget.cpp')
| -rw-r--r-- | src/search/dolphinfacetswidget.cpp | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/src/search/dolphinfacetswidget.cpp b/src/search/dolphinfacetswidget.cpp index aec84d321..3824eb94c 100644 --- a/src/search/dolphinfacetswidget.cpp +++ b/src/search/dolphinfacetswidget.cpp @@ -46,13 +46,16 @@ DolphinFacetsWidget::DolphinFacetsWidget(QWidget* parent) : m_fourOrMore(0), m_maxRating(0) { - m_documents = createCheckBox(i18nc("@option:check", "Documents")); - m_images = createCheckBox(i18nc("@option:check", "Images")); - m_audio = createCheckBox(i18nc("@option:check", "Audio Files")); - m_videos = createCheckBox(i18nc("@option:check", "Videos")); + QButtonGroup* filetypeGroup = new QButtonGroup(this); + m_anyType = createRadioButton(i18nc("@option:check", "Any"), filetypeGroup); + m_documents = createRadioButton(i18nc("@option:check", "Documents"), filetypeGroup); + m_images = createRadioButton(i18nc("@option:check", "Images"), filetypeGroup); + m_audio = createRadioButton(i18nc("@option:check", "Audio Files"), filetypeGroup); + m_videos = createRadioButton(i18nc("@option:check", "Videos"), filetypeGroup); QVBoxLayout* typeLayout = new QVBoxLayout(); typeLayout->setSpacing(0); + typeLayout->addWidget(m_anyType); typeLayout->addWidget(m_documents); typeLayout->addWidget(m_images); typeLayout->addWidget(m_audio); @@ -160,38 +163,24 @@ Baloo::Term DolphinFacetsWidget::ratingTerm() const return Baloo::Term(); } -QStringList DolphinFacetsWidget::facetTypes() const +QString DolphinFacetsWidget::facetType() const { - QStringList types; if (m_documents->isChecked()) { - types << "Document"; + return QLatin1String("Document"); + } else if (m_images->isChecked()) { + return QLatin1String("Image"); + } else if (m_audio->isChecked()) { + return QLatin1String("Audio"); + } else if (m_videos->isChecked()) { + return QLatin1String("Video"); } - if (m_images->isChecked()) { - types << "Image"; - } - - if (m_audio->isChecked()) { - types << "Audio"; - } - - if (m_videos->isChecked()) { - types << "Video"; - } - - return types; + return QString(); } #endif -QCheckBox* DolphinFacetsWidget::createCheckBox(const QString& text) -{ - QCheckBox* checkBox = new QCheckBox(text); - connect(checkBox, SIGNAL(clicked()), this, SIGNAL(facetChanged())); - return checkBox; -} - QRadioButton* DolphinFacetsWidget::createRadioButton(const QString& text, QButtonGroup* group) { |
