/usr/include/akonadi/itemsearchjob.h is in kdepimlibs5-dev 4:4.8.5-0ubuntu0.3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | /*
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef AKONADI_ITEMSEARCHJOB_H
#define AKONADI_ITEMSEARCHJOB_H
#include <akonadi/item.h>
#include <akonadi/job.h>
#include <QtCore/QUrl>
namespace Akonadi {
class ItemFetchScope;
class ItemSearchJobPrivate;
/**
* @short Job that searches for items in the Akonadi storage.
*
* This job searches for items that match a given search query and returns
* the list of matching item.
*
* <b>Attention:</b> Since this is an ordinary SPARQL query, potentially the whole Nepomuk
* store is searched, which can be very slow. Therefore, you should create
* SPARQL queries that only search for items that Akonadi fed into Nepomuk.
* This can be done by limiting the results to statements that contain the
* predicate with the akonadiItemIdUri() URI. This limits the search result to
* to Nepomuk resources that were added by the Akonadi Nepomuk feeders.
*
* @code
*
* const QString query = "..."; // some sparql query
*
* Akonadi::ItemSearchJob *job = new Akonadi::ItemSearchJob( query );
* job->fetchScope().fetchFullPayload();
* connect( job, SIGNAL( result( KJob* ) ), this, SLOT( searchResult( KJob* ) ) );
*
* ...
*
* MyClass::searchResult( KJob *job )
* {
* Akonadi::ItemSearchJob *searchJob = qobject_cast<Akonadi::ItemSearchJob*>( job );
* const Akonadi::Item::List items = searchJob->items();
* foreach ( const Akonadi::Item &item, items ) {
* // extract the payload and do further stuff
* }
* }
*
* @endcode
*
* @author Tobias Koenig <tokoe@kde.org>
* @since 4.4
*/
class AKONADI_EXPORT ItemSearchJob : public Job
{
Q_OBJECT
public:
/**
* Creates an item search job.
*
* @param query The search query in SPARQL format.
* @param parent The parent object.
*/
explicit ItemSearchJob( const QString &query, QObject *parent = 0 );
/**
* Destroys the item search job.
*/
~ItemSearchJob();
/**
* Sets the search @p query in SPARQL format.
*/
void setQuery( const QString &query );
/**
* Sets the item fetch scope.
*
* The ItemFetchScope controls how much of an matching item's data is fetched
* from the server, e.g. whether to fetch the full item payload or
* only meta data.
*
* @param fetchScope The new scope for item fetch operations.
*
* @see fetchScope()
*/
void setFetchScope( const ItemFetchScope &fetchScope );
/**
* Returns the item fetch scope.
*
* Since this returns a reference it can be used to conveniently modify the
* current scope in-place, i.e. by calling a method on the returned reference
* without storing it in a local variable. See the ItemFetchScope documentation
* for an example.
*
* @return a reference to the current item fetch scope
*
* @see setFetchScope() for replacing the current item fetch scope
*/
ItemFetchScope &fetchScope();
/**
* Returns the items that matched the search query.
*/
Item::List items() const;
/**
* Returns an URI that represents a predicate that is always added to the Nepomuk resource
* by the Akonadi Nepomuk feeders.
*
* The statement containing this predicate has the Akonadi Item ID of the resource as string
* as the object, and the Nepomuk resource, e.g. a PersonContact, as the subject.
*
* Always limit your searches to statements that contain this URI as predicate.
*
* @since 4.4.3
*/
static QUrl akonadiItemIdUri();
Q_SIGNALS:
/**
* This signal is emitted whenever new matching items have been fetched completely.
*
* @note This is an optimization, instead of waiting for the end of the job
* and calling items(), you can connect to this signal and get the items
* incrementally.
*
* @param items The matching items.
*/
void itemsReceived( const Akonadi::Item::List &items );
protected:
void doStart();
virtual void doHandleResponse( const QByteArray &tag, const QByteArray &data );
private:
//@cond PRIVATE
Q_DECLARE_PRIVATE( ItemSearchJob )
Q_PRIVATE_SLOT( d_func(), void timeout() )
//@endcond
};
}
#endif
|