1 /***************************************************************************
2 * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
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. *
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. *
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 ***************************************************************************/
20 #ifndef DOLPHINSEARCHOPTIONSCONFIGURATOR_H
21 #define DOLPHINSEARCHOPTIONSCONFIGURATOR_H
24 #define DISABLE_NEPOMUK_LEGACY
25 #include <nepomuk/query.h>
31 class SearchCriterionSelector
;
36 * @brief Allows the user to configure a search query for Nepomuk.
38 class DolphinSearchOptionsConfigurator
: public QWidget
43 DolphinSearchOptionsConfigurator(QWidget
* parent
= 0);
44 virtual ~DolphinSearchOptionsConfigurator();
46 QString
customSearchQuery() const;
47 KUrl
directory() const;
50 * Returns the sum of the configured options and the
51 * custom search query as Nepomuk conform search URL. If the
52 * query is invalid, an empty URL is returned.
53 * @see DolphinSearchOptionsConfigurator::setCustomSearchQuery()
55 KUrl
nepomukSearchUrl() const;
59 * Sets a custom search query that is added to the
60 * search query defined by the search options configurator.
61 * This is useful if a custom search user interface is
62 * offered outside the search options configurator.
64 void setCustomSearchQuery(const QString
& searchQuery
);
67 * Sets the directory that is used when the
68 * "From Here"-location-filter is used. URLs that represent
69 * already a Nepomuk search URL will be ignored.
71 void setDirectory(const KUrl
& dir
);
74 void searchOptionsChanged();
77 virtual void showEvent(QShowEvent
* event
);
80 void slotAddSelectorButtonClicked();
81 void removeCriterion();
84 * Saves the current query by adding it as Places entry.
89 * Enables the enabled property of the search-, save-button and the
90 * add-selector button.
96 * Adds the new search description selector to the bottom
99 void addCriterion(SearchCriterionSelector
* selector
);
102 * Returns the sum of the configured options and the
103 * custom search query as Nepomuk confrom query.
104 * @see DolphinSearchOptionsConfigurator::setCustomSearchQuery()
106 Nepomuk::Query::Query
nepomukQuery() const;
111 KComboBox
* m_locationBox
;
112 KComboBox
* m_whatBox
;
113 QPushButton
* m_addSelectorButton
;
114 QPushButton
* m_searchButton
;
115 QPushButton
* m_saveButton
;
116 QVBoxLayout
* m_vBoxLayout
;
117 QList
<SearchCriterionSelector
*> m_criteria
;
118 QString m_customSearchQuery
;