]> cloud.milkyroute.net Git - dolphin.git/blob - src/search/dolphinsearchoptionsconfigurator.h
initial code to provide a Nepomuk query string out of the search criterions
[dolphin.git] / src / search / dolphinsearchoptionsconfigurator.h
1 /***************************************************************************
2 * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
19
20 #ifndef DOLPHINSEARCHOPTIONSCONFIGURATOR_H
21 #define DOLPHINSEARCHOPTIONSCONFIGURATOR_H
22
23 #include <QList>
24 #include <QWidget>
25
26 class KComboBox;
27 class SearchCriterionSelector;
28 class QPushButton;
29 class QVBoxLayout;
30
31 /**
32 * @brief Allows the user to configure a search query for Nepomuk.
33 */
34 class DolphinSearchOptionsConfigurator : public QWidget
35 {
36 Q_OBJECT
37
38 public:
39 DolphinSearchOptionsConfigurator(QWidget* parent = 0);
40 virtual ~DolphinSearchOptionsConfigurator();
41
42 signals:
43 void searchOptionsChanged(const QString& options);
44
45 protected:
46 virtual void showEvent(QShowEvent* event);
47
48 private slots:
49 void slotAddSelectorButtonClicked();
50
51 void slotCriterionChanged();
52
53 void removeCriterion();
54
55 /**
56 * Updates the 'enabled' property of the selector button
57 * dependent from the number of existing selectors.
58 */
59 void updateSelectorButton();
60
61 /**
62 * Saves the current query by adding it as Places entry.
63 */
64 void saveQuery();
65
66 private:
67 /**
68 * Adds the new search description selector to the bottom
69 * of the layout.
70 */
71 void addCriterion(SearchCriterionSelector* selector);
72
73 private:
74 bool m_initialized;
75 KComboBox* m_searchFromBox;
76 KComboBox* m_searchWhatBox;
77 QPushButton* m_addSelectorButton;
78 QVBoxLayout* m_vBoxLayout;
79 QList<SearchCriterionSelector*> m_criterions;
80 };
81
82 #endif