Nepomuk
dynamicresourcefacet.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_DYNAMIC_RESOURCE_FACET_H_ 00023 #define _NEPOMUK_QUERY_DYNAMIC_RESOURCE_FACET_H_ 00024 00025 #include "facet.h" 00026 #include "nepomukutils_export.h" 00027 00028 #include <QtCore/QList> 00029 00030 namespace Nepomuk { 00031 class Resource; 00032 namespace Types { 00033 class Property; 00034 class Class; 00035 } 00036 namespace Query { 00037 class Result; 00038 } 00039 00040 namespace Utils { 00070 class NEPOMUKUTILS_EXPORT DynamicResourceFacet : public Facet 00071 { 00072 Q_OBJECT 00073 00074 public: 00078 DynamicResourceFacet( QObject* parent = 0 ); 00079 00083 virtual ~DynamicResourceFacet(); 00084 00090 Query::Term queryTerm() const; 00091 00095 void setSelectionMode( SelectionMode mode ); 00096 00100 SelectionMode selectionMode() const; 00101 00105 int count() const; 00106 00110 KGuiItem guiItem( int index ) const; 00111 00115 bool isSelected( int index ) const; 00116 00120 void setRelation( const Types::Property& prop ); 00121 00126 void setResourceType( const Types::Class& type ); 00127 00133 void setMaxRows( int max ); 00134 00138 Types::Property relation() const; 00139 00144 Types::Class resourceType() const; 00145 00149 int maxRows() const; 00150 00156 Nepomuk::Resource resourceAt( int i ) const; 00157 00161 QList<Resource> selectedResources() const; 00162 00163 public Q_SLOTS: 00168 void clearSelection(); 00169 00173 void setSelected( int index, bool selected = true ); 00174 00179 void setSelected( const Nepomuk::Resource& res, bool selected = true ); 00180 00186 bool selectFromTerm( const Nepomuk::Query::Term& queryTerm ); 00187 00188 protected: 00211 virtual Query::Query resourceQuery( const Query::Query& clientQuery ) const; 00212 00221 virtual Nepomuk::Query::Term termForResource( const Resource& res ) const; 00222 00233 virtual Nepomuk::Resource resourceForTerm( const Nepomuk::Query::Term& queryTerm ) const; 00234 00250 virtual QList<Resource> getMoreResources() const; 00251 00255 void handleClientQueryChange(); 00256 00257 #ifdef BUILDING_NEPOMUK_TESTS 00258 protected: 00259 #else 00260 private: 00261 #endif 00262 class Private; 00263 Private* d; 00264 00265 Q_PRIVATE_SLOT( d, void _k_newEntries( const QList<Nepomuk::Query::Result>& ) ) 00266 Q_PRIVATE_SLOT( d, void _k_populateFinished() ) 00267 }; 00268 } 00269 } 00270 00271 #endif
KDE 4.6 API Reference