Nepomuk
searchwidget.h
Go to the documentation of this file.
00001 /* 00002 Copyright (c) 2010 Oszkar Ambrus <aoszkar@gmail.com> 00003 Copyright (C) 2010 Sebastian Trueg <trueg@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) version 3, or any 00009 later version accepted by the membership of KDE e.V. (or its 00010 successor approved by the membership of KDE e.V.), which shall 00011 act as a proxy defined in Section 6 of version 3 of the license. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Lesser General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public 00019 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00020 */ 00021 00022 #ifndef RESOURCESEARCHWIDGET_H 00023 #define RESOURCESEARCHWIDGET_H 00024 00025 #include <QWidget> 00026 #include <QAbstractItemView> 00027 00028 #include "query.h" 00029 #include "nepomukutils_export.h" 00030 00031 namespace Nepomuk { 00032 class Resource; 00033 00034 namespace Utils { 00035 class FacetWidget; 00036 00054 class NEPOMUKUTILS_EXPORT SearchWidget : public QWidget 00055 { 00056 Q_OBJECT 00057 00058 public: 00062 SearchWidget(QWidget *parent = 0); 00063 00067 ~SearchWidget(); 00068 00073 enum ConfigFlag { 00075 NoConfigFlags = 0x0, 00076 00078 ShowFacets = 0x1, 00079 00081 SearchWhileYouType = 0x2, 00082 00084 DefaultConfigFlags = ShowFacets 00085 }; 00086 Q_DECLARE_FLAGS( ConfigFlags, ConfigFlag ) 00087 00088 00093 void setConfigFlags( ConfigFlags flags ); 00094 00098 ConfigFlags configFlags() const; 00099 00103 void setSelectionMode(QAbstractItemView::SelectionMode mode); 00104 00108 QAbstractItemView::SelectionMode selectionMode () const; 00109 00113 Query::Query baseQuery() const; 00114 00119 Query::Query query() const; 00120 00124 Resource currentResource() const; 00125 00129 QList<Resource> selectedResources() const; 00130 00136 FacetWidget* facetWidget() const; 00137 00145 static Nepomuk::Resource searchResource( QWidget* parent = 0, 00146 const Nepomuk::Query::Query& baseQuery = Nepomuk::Query::Query(), 00147 SearchWidget::ConfigFlags flags = SearchWidget::DefaultConfigFlags ); 00148 00156 static QList<Nepomuk::Resource> searchResources( QWidget* parent = 0, 00157 const Nepomuk::Query::Query& baseQuery = Nepomuk::Query::Query(), 00158 SearchWidget::ConfigFlags flags = SearchWidget::DefaultConfigFlags ); 00159 00160 public Q_SLOTS: 00169 Nepomuk::Query::Query setQuery( const Nepomuk::Query::Query& query ); 00170 00182 void setBaseQuery( const Nepomuk::Query::Query& query ); 00183 00184 Q_SIGNALS: 00189 void selectionChanged(); 00190 00191 private: 00192 class SearchWidgetPrivate; 00193 SearchWidgetPrivate * const d_ptr; 00194 00195 Q_DECLARE_PRIVATE(SearchWidget) 00196 00197 Q_PRIVATE_SLOT( d_ptr, void _k_queryComponentChanged() ) 00198 Q_PRIVATE_SLOT( d_ptr, void _k_listingFinished() ) 00199 }; 00200 } 00201 } 00202 00203 Q_DECLARE_OPERATORS_FOR_FLAGS( Nepomuk::Utils::SearchWidget::ConfigFlags ) 00204 00205 #endif // RESOURCESEARCHWIDGET_H
KDE 4.6 API Reference