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
;
38 * @brief Allows the user to select a search criterion.
39 * The widget represents one row of the DolphinSearchOptionsConfigurator.
40 * Example: [File Size] [greater than] [10] [Byte]
42 * @see DolphinSearchOptionsConfigurator.
44 class SearchCriterionSelector
: public QWidget
49 enum Type
{ Date
, Size
, Tag
, Rating
};
51 SearchCriterionSelector(Type type
, QWidget
* parent
= 0);
52 virtual ~SearchCriterionSelector();
54 /** Returns the query-term for the criterion. */
55 Nepomuk::Query::Term
queryTerm() const;
61 * Is emitted if the criterion selector should be removed
62 * because the user clicked the "Remove" button.
64 void removeCriterion();
66 /** Is emitted if the user has changed the search criterion. */
67 void criterionChanged();
70 void slotDescriptionChanged(int index
);
71 void slotComparatorChanged(int index
);
75 * Creates all available search criterion descriptions m_descriptions
76 * and adds them into the combobox m_descriptionsBox.
78 void createDescriptions();
81 QHBoxLayout
* m_layout
;
82 QComboBox
* m_descriptionsBox
; // has items like "File Size", "Date Modified", ...
83 QComboBox
* m_comparatorBox
; // has items like "greater than", "less than", ...
84 SearchCriterionValue
* m_valueWidget
; // contains the value of a file size or a date
85 QPushButton
* m_removeButton
; // requests a removing of the search criterion instance
87 QList
<SearchCriterionDescription
> m_descriptions
;
90 #endif // SEARCHCRITERIONSELECTOR_H