]> cloud.milkyroute.net Git - dolphin.git/blob - src/search/searchcriteriondescription.h
I'm very sorry for breaking the build: I forgot to add the new files :-(
[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 #include <QList>
25 #include <QString>
26
27 class SearchCriterionValue;
28 class QWidget;
29
30 /**
31 * @brief Helper class for SearchCriterionSelector.
32 *
33 * Describes a search criterion including the used
34 * widget for editing.
35 */
36 class SearchCriterionDescription
37 {
38 public:
39 struct Comparator
40 {
41 Comparator(const QString& n, const QString& o = QString(),
42 const QString& p = QString(), const QString& a = QString()) :
43 name(n), operation(o), prefix(p), autoValueType(a) {}
44 QString name; // user visible and translated name
45 QString operation; // Nepomuk operation that represents the comparator
46 QString prefix; // prefix like "+" or "-" that is part of the Nepomuk query
47 QString autoValueType; // type for an automatically calculated value of the value widget
48 };
49
50 SearchCriterionDescription(const QString& name,
51 const QString& identifier,
52 const QList<Comparator>& comparators,
53 SearchCriterionValue* valueWidget);
54
55 virtual ~SearchCriterionDescription();
56
57 QString name() const;
58 QString identifier() const;
59 const QList<Comparator>& comparators() const;
60 SearchCriterionValue* valueWidget() const;
61
62 private:
63 QString m_name; // user visible name that gets translated
64 QString m_identifier; // internal Nepomuk identifier
65 QList<Comparator> m_comparators;
66 SearchCriterionValue* m_valueWidget;
67 };
68
69 #endif // SEARCHCRITERIONDESCRIPTION_H