1 /***************************************************************************
2 * Copyright (C) 2009 by Adam Kidder <thekidder@gmail.com> *
3 * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
21 #ifndef SEARCHCRITERIONSELECTOR_H
22 #define SEARCHCRITERIONSELECTOR_H
28 #define DISABLE_NEPOMUK_LEGACY
29 #include <nepomuk/term.h>
30 #include <search/searchcriteriondescription.h>
32 class SearchCriterionValue
;
39 * @brief Allows the user to select a search criterion.
40 * The widget represents one row of the DolphinSearchOptionsConfigurator.
41 * Example: [File Size] [greater than] [10] [Byte]
43 * @see DolphinSearchOptionsConfigurator.
45 class SearchCriterionSelector
: public QWidget
50 enum Type
{ Date
, Size
, Tag
, Rating
};
52 SearchCriterionSelector(Type type
, QWidget
* parent
= 0);
53 virtual ~SearchCriterionSelector();
55 /** Returns the query-term for the criterion. */
56 Nepomuk::Query::Term
queryTerm() const;
62 * Is emitted if the criterion selector should be removed
63 * because the user clicked the "Remove" button.
65 void removeCriterion();
67 /** Is emitted if the user has changed the search criterion. */
68 void criterionChanged();
71 void slotDescriptionChanged(int index
);
72 void slotComparatorChanged(int index
);
76 * Creates all available search criterion descriptions m_descriptions
77 * and adds them into the combobox m_descriptionsBox.
79 void createDescriptions();
82 QHBoxLayout
* m_layout
;
83 QComboBox
* m_descriptionsBox
; // has items like "File Size", "Date Modified", ...
84 QComboBox
* m_comparatorBox
; // has items like "greater than", "less than", ...
85 SearchCriterionValue
* m_valueWidget
; // contains the value of a file size or a date
86 QPushButton
* m_removeButton
; // requests a removing of the search criterion instance
88 QList
<SearchCriterionDescription
> m_descriptions
;
91 #endif // SEARCHCRITERIONSELECTOR_H