• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Nepomuk-Core

  • sources
  • kde-4.12
  • kdelibs
  • nepomuk-core
  • services
  • storage
  • query
folder.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2008-2010 Sebastian Trueg <trueg@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 
19 #ifndef _NEPOMUK_VIRTUAL_FOLDER_H_
20 #define _NEPOMUK_VIRTUAL_FOLDER_H_
21 
22 #include <QtCore/QObject>
23 
24 #include "query/result.h"
25 #include "query/query.h"
26 
27 #include <QtCore/QSet>
28 #include <QtCore/QTimer>
29 #include <QtCore/QPointer>
30 #include <QtCore/QMutex>
31 #include <Soprano/Model>
32 
33 #include <KUrl>
34 
35 namespace Nepomuk2 {
36  namespace Query {
37 
38  uint qHash( const Result& );
39 
40  class SearchRunnable;
41  class CountQueryRunnable;
42  class FolderConnection;
43 
49  class Folder : public QObject
50  {
51  Q_OBJECT
52 
53  public:
54  Folder( Soprano::Model* model, const Query& query, QObject* parent = 0 );
55  Folder( Soprano::Model* model, const QString& sparqlQuery,
56  const RequestPropertyMap& requestProps, QObject* parent = 0 );
57  ~Folder();
58 
59  bool isSparqlQueryFolder() const { return m_isSparqlQueryFolder; }
60 
66  QList<Result> entries() const;
67 
72  bool initialListingDone() const;
73 
74  QList<FolderConnection*> openConnections() const;
75 
76  Query query() const { return m_query; }
77 
78  QString sparqlQuery() const;
79 
80  RequestPropertyMap requestPropertyMap() const;
81 
90  int getResultCount() const { return m_resultCount; }
91 
92  private Q_SLOTS:
93  void addResult( const Nepomuk2::Query::Result& result );
94  void listingFinished();
95 
96  void update();
97 
99  void countQueryFinished( int count );
100 
101  Q_SIGNALS:
102  void newEntries( const QList<Nepomuk2::Query::Result>& entries );
103  void entriesRemoved( const QList<QUrl>& entries );
104  void entriesRemoved( const QList<Nepomuk2::Query::Result>& entries );
105 
111  void resultCount( int count );
112 
113  void finishedListing();
114  void aboutToBeDeleted( Nepomuk2::Query::Folder* );
115 
116  private Q_SLOTS:
117  void slotStorageChanged();
118  void slotUpdateTimeout();
119 
120  private:
121  void init();
122 
126  void addConnection( FolderConnection* );
127 
131  void removeConnection( FolderConnection* );
132 
134  const bool m_isSparqlQueryFolder;
135 
137  Query m_query;
138 
140  QString m_sparqlQuery;
141 
143  RequestPropertyMap m_requestProperties;
144 
146  Soprano::Model* m_model;
147 
149  QList<FolderConnection*> m_connections;
150 
152  int m_resultCount;
153 
155  bool m_initialListingDone;
156 
158  QHash<QUrl, Result> m_results;
159 
161  QHash<QUrl, Result> m_newResults;
162 
164  SearchRunnable* m_currentSearchRunnable;
165  CountQueryRunnable* m_currentCountQueryRunnable;
166 
168  bool m_storageChanged;
169 
171  QTimer m_updateTimer;
172 
173  // for addConnection and removeConnection
174  friend class FolderConnection;
175  };
176  }
177 }
178 
179 #endif
Nepomuk2::Query::Folder::entriesRemoved
void entriesRemoved(const QList< QUrl > &entries)
Nepomuk2::Query::Folder::aboutToBeDeleted
void aboutToBeDeleted(Nepomuk2::Query::Folder *)
Nepomuk2::Query::SearchRunnable
Definition: searchrunnable.h:40
QHash
Nepomuk2::Query::Folder::sparqlQuery
QString sparqlQuery() const
Definition: folder.cpp:203
QObject
Nepomuk2::Query::Folder::entries
QList< Result > entries() const
Definition: folder.cpp:191
Nepomuk2::Query::qHash
uint qHash(const Nepomuk2::Query::Query &)
Definition: query.cpp:738
Nepomuk2::Query::Folder::query
Query query() const
Definition: folder.h:76
Nepomuk2::Query::Folder::openConnections
QList< FolderConnection * > openConnections() const
Definition: folder.cpp:320
query.h
result.h
Nepomuk2::Query::Folder::Folder
Folder(Soprano::Model *model, const Query &query, QObject *parent=0)
Definition: folder.cpp:45
Nepomuk2::Query::RequestPropertyMap
QHash< QString, Nepomuk2::Types::Property > RequestPropertyMap
Convinience definition for request property mappings as used in QueryServiceClient::sparqlQuery() and...
Definition: query.h:41
Nepomuk2::Query::Folder::initialListingDone
bool initialListingDone() const
Definition: folder.cpp:197
Nepomuk2::Query::Folder::getResultCount
int getResultCount() const
Get the result count.
Definition: folder.h:90
Nepomuk2::Query::Query
A Nepomuk desktop query.
Definition: query.h:76
Nepomuk2::Query::Folder::finishedListing
void finishedListing()
Nepomuk2::Query::CountQueryRunnable
Definition: countqueryrunnable.h:34
Nepomuk2::Query::FolderConnection
Definition: folderconnection.h:35
Nepomuk2::Query::Folder::isSparqlQueryFolder
bool isSparqlQueryFolder() const
Definition: folder.h:59
Nepomuk2::Query::Result
A single search result.
Definition: result.h:57
Nepomuk2::Query::Folder::~Folder
~Folder()
Definition: folder.cpp:146
Nepomuk2::Query::Folder
One search folder which automatically updates itself.
Definition: folder.h:49
Nepomuk2::Query::Folder::resultCount
void resultCount(int count)
Emitted once the result count is available.
Nepomuk2::Query::Folder::requestPropertyMap
RequestPropertyMap requestPropertyMap() const
Definition: folder.cpp:212
Nepomuk2::Query::Folder::newEntries
void newEntries(const QList< Nepomuk2::Query::Result > &entries)
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Nepomuk-Core

Skip menu "Nepomuk-Core"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal