┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/search/searchcriterionselector.h
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2009-10-23 21:06:33 +0000
committerPeter Penz <[email protected]>2009-10-23 21:06:33 +0000
commitefecb5021cc7855caa05117ebbe74608f5c863f2 (patch)
tree517df3bc5d22130997a5669a4c50c92a3ddb2865 /src/search/searchcriterionselector.h
parent66995e1a8f0b8a4001c1d4500f807277d685ab7f (diff)
Imported Adam Kidders search configuration widgets from playground/base/nepomuk/search_widgets_test. I adjusted some names of classes and members and also changed some parts of the implementation, but conceptually the concept is 1:1 like provided by Adam in playground.
Currently the UI works quite well, but the creating of the query string has not been integrated yet. svn path=/trunk/KDE/kdebase/apps/; revision=1039572
Diffstat (limited to 'src/search/searchcriterionselector.h')
-rw-r--r--src/search/searchcriterionselector.h95
1 files changed, 95 insertions, 0 deletions
diff --git a/src/search/searchcriterionselector.h b/src/search/searchcriterionselector.h
new file mode 100644
index 000000000..3720b53fb
--- /dev/null
+++ b/src/search/searchcriterionselector.h
@@ -0,0 +1,95 @@
+/***************************************************************************
+ * Copyright (C) 2009 by Adam Kidder <[email protected]> *
+ * Copyright (C) 2009 by Peter Penz <[email protected]> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef SEARCHCRITERIONSELECTOR_H
+#define SEARCHCRITERIONSELECTOR_H
+
+#include <QList>
+#include <QString>
+#include <QWidget>
+
+#include <search/searchcriteriondescription.h>
+
+class SearchCriterionValue;
+class QComboBox;
+class QHBoxLayout;
+class QPushButton;
+class ValueWidget;
+
+/**
+ * @brief Allows the user to select a search criterion.
+ * The widget represents one row of the DolphinSearchOptionsConfigurator.
+ * Example: [File Size] [greater than] [10] [Byte]
+ *
+ * @see DolphinSearchOptionsConfigurator.
+ */
+class SearchCriterionSelector : public QWidget
+{
+ Q_OBJECT
+
+public:
+ SearchCriterionSelector(QWidget* parent = 0);
+ virtual ~SearchCriterionSelector();
+
+signals:
+ /**
+ * Is emitted if the criterion selector should be removed
+ * because the user clicked the "Remove" button.
+ */
+ void removeCriterion();
+
+ /**
+ * Is emitted if the user changed the search criterion.
+ * \p queryString represents a Nepomuk conform query string.
+ */
+ void criterionChanged(const QString& queryString);
+
+private slots:
+ void slotDescriptionChanged(int index);
+
+ /**
+ * Updates the query string and emits the signal criterionChanged().
+ */
+ void updateQuery();
+
+private:
+ /**
+ * Creates all available search criterion descriptions m_descriptions
+ * and adds them into the combobox m_descriptionsBox.
+ */
+ void createDescriptions();
+
+ /**
+ * Returns the currently selected searc criterion description. If nothing
+ * is selected, 0 is returned.
+ */
+ const SearchCriterionDescription* description() const;
+
+private:
+ QHBoxLayout* m_layout;
+ QComboBox* m_descriptionsBox; // has items like "File Size", "Date Modified", ...
+ QComboBox* m_comparatorBox; // has items like "greater than", "less than", ...
+ SearchCriterionValue* m_valueWidget; // contains the value of a file size or a date
+ QPushButton* m_removeButton; // requests a removing of the search criterion instance
+
+ QList<SearchCriterionDescription> m_descriptions;
+};
+
+#endif // SEARCHCRITERIONSELECTOR_H