]> cloud.milkyroute.net Git - dolphin.git/blob - src/search/searchcriteriondescription.h
Fix visual artefacts for tooltips, if compositing has been disabled. Thanks to Maciej...
[dolphin.git] / src / search / searchcriteriondescription.h
1 /***************************************************************************
2 * Copyright (C) 2009 by Adam Kidder <thekidder@gmail.com> *
3 * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
4 * *
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. *
9 * *
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. *
14 * *
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 ***************************************************************************/
20
21 #ifndef SEARCHCRITERIONDESCRIPTION_H
22 #define SEARCHCRITERIONDESCRIPTION_H
23
24 #define DISABLE_NEPOMUK_LEGACY
25 #include <nepomuk/comparisonterm.h>
26
27 #include <QList>
28 #include <QString>
29 #include <QUrl>
30
31 class SearchCriterionValue;
32
33 /**
34 * @brief Helper class for SearchCriterionSelector.
35 *
36 * Describes a search criterion including the used
37 * widget for editing.
38 */
39 class SearchCriterionDescription
40 {
41 public:
42 struct Comparator
43 {
44 Comparator(const QString& n) :
45 name(n),
46 isActive(false),
47 value(Nepomuk::Query::ComparisonTerm::Smaller),
48 autoValueType()
49 {
50 }
51
52 Comparator(const QString& n, Nepomuk::Query::ComparisonTerm::Comparator c,
53 const QString& a = QString()) :
54 name(n),
55 isActive(true),
56 value(c),
57 autoValueType(a)
58 {
59 }
60
61 QString name; // user visible and translated name
62 bool isActive;
63 Nepomuk::Query::ComparisonTerm::Comparator value;
64 QString autoValueType; // type for an automatically calculated value of the value widget
65 };
66
67 SearchCriterionDescription(const QString& name,
68 const QUrl& identifier,
69 const QList<Comparator>& comparators,
70 SearchCriterionValue* valueWidget);
71
72 virtual ~SearchCriterionDescription();
73
74 QString name() const;
75 QUrl identifier() const;
76 const QList<Comparator>& comparators() const;
77 SearchCriterionValue* valueWidget() const;
78
79 private:
80 QString m_name; // user visible name that gets translated
81 QUrl m_identifier; // internal Nepomuk identifier URL
82 QList<Comparator> m_comparators;
83 SearchCriterionValue* m_valueWidget;
84 };
85
86 #endif // SEARCHCRITERIONDESCRIPTION_H