Akonadi
7 #include "collectionfetchjob.h"
8 #include "invalidatecachejob_p.h"
9 #include "itemfetchjob.h"
10 #include "itemmodifyjob.h"
13 #include <KLocalizedString>
19 class InvalidateCacheJobPrivate : JobPrivate
22 explicit InvalidateCacheJobPrivate(InvalidateCacheJob *qq)
28 QString jobDebuggingString()
const override;
29 void collectionFetchResult(
KJob *job);
30 void itemFetchResult(
KJob *job);
31 void itemStoreResult(
KJob *job);
33 Q_DECLARE_PUBLIC(InvalidateCacheJob)
36 QString InvalidateCacheJobPrivate::jobDebuggingString()
const
38 return QStringLiteral(
"Invalidate Cache from collection id: %1").
arg(collection.id());
43 void InvalidateCacheJobPrivate::collectionFetchResult(
KJob *job)
45 Q_Q(InvalidateCacheJob);
50 auto fetchJob = qobject_cast<CollectionFetchJob *>(job);
52 if (fetchJob->collections().size() == 1) {
53 collection = fetchJob->collections().at(0);
56 if (!collection.isValid()) {
58 q->setErrorText(
i18n(
"Invalid collection."));
69 void InvalidateCacheJobPrivate::itemFetchResult(
KJob *job)
71 Q_Q(InvalidateCacheJob);
75 auto fetchJob = qobject_cast<ItemFetchJob *>(job);
77 if (fetchJob->items().isEmpty()) {
84 for (
Item item : itemsLst) {
93 void InvalidateCacheJobPrivate::itemStoreResult(
KJob *job)
95 Q_Q(InvalidateCacheJob);
102 InvalidateCacheJob::InvalidateCacheJob(
const Collection &collection,
QObject *parent)
103 :
Job(new InvalidateCacheJobPrivate(this), parent)
105 Q_D(InvalidateCacheJob);
106 d->collection = collection;
109 void InvalidateCacheJob::doStart()
111 Q_D(InvalidateCacheJob);
115 d->collectionFetchResult(job);
119 #include "moc_invalidatecachejob_p.cpp"
Represents a collection of PIM items.
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Job that fetches collections from the Akonadi storage.
Job that modifies an existing item in the Akonadi storage.
QString i18n(const char *text, const TYPE &arg...)
@ Base
Only fetch the base collection.
Base class for all actions in the Akonadi storage.
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
Job that fetches items from the Akonadi storage.
Represents a PIM item stored in Akonadi storage.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Jun 27 2022 04:01:06 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.