Nepomuk
facet.h
Go to the documentation of this file.
00001 /* 00002 This file is part of the Nepomuk KDE project. 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 _NEPOMUK_QUERY_FACET_H_ 00023 #define _NEPOMUK_QUERY_FACET_H_ 00024 00025 #include <QtCore/QObject> 00026 00027 #include "nepomukutils_export.h" 00028 00029 class KGuiItem; 00030 00031 namespace Nepomuk { 00032 namespace Query { 00033 class Term; 00034 class Query; 00035 } 00036 00037 namespace Utils { 00074 class NEPOMUKUTILS_EXPORT Facet : public QObject 00075 { 00076 Q_OBJECT 00077 00078 public: 00082 Facet( QObject* parent = 0 ); 00083 00087 virtual ~Facet(); 00088 00093 enum SelectionMode { 00099 MatchAll, 00100 00106 MatchAny, 00107 00113 MatchOne 00114 }; 00115 00122 virtual SelectionMode selectionMode() const = 0; 00123 00130 virtual Query::Term queryTerm() const = 0; 00131 00135 virtual int count() const = 0; 00136 00142 virtual QString text( int index ) const; 00143 00147 virtual KGuiItem guiItem( int index ) const; 00148 00152 virtual bool isSelected( int index ) const = 0; 00153 00158 Query::Query clientQuery() const; 00159 00165 static Facet* createFileTypeFacet( QObject* parent = 0 ); 00166 00172 static Facet* createTypeFacet( QObject* parent = 0 ); 00173 00179 static Facet* createDateFacet( QObject* parent = 0 ); 00180 00187 static Facet* createTagFacet( QObject* parent = 0 ); 00188 00196 static Facet* createPriorityFacet( QObject* parent = 0 ); 00197 00201 static Facet* createRatingFacet( QObject* parent = 0 ); 00202 00203 public Q_SLOTS: 00208 virtual void clearSelection() = 0; 00209 00218 virtual void setSelected( int index, bool selected = true ) = 0; 00219 00246 virtual bool selectFromTerm( const Nepomuk::Query::Term& queryTerm ) = 0; 00247 00255 void setClientQuery( const Nepomuk::Query::Query& query ); 00256 00257 Q_SIGNALS: 00267 void queryTermChanged( Nepomuk::Utils::Facet* facet, const Nepomuk::Query::Term& queryTerm ); 00268 00275 void layoutChanged( Nepomuk::Utils::Facet* facet ); 00276 00285 void selectionChanged( Nepomuk::Utils::Facet* facet ); 00286 00287 protected Q_SLOTS: 00291 void setQueryTermChanged(); 00292 00296 void setLayoutChanged(); 00297 00301 void setSelectionChanged(); 00302 00303 protected: 00309 virtual void handleClientQueryChange(); 00310 00311 private: 00312 class FacetPrivate; 00313 FacetPrivate* const d; 00314 }; 00315 } 00316 } 00317 00318 #endif
KDE 4.6 API Reference