7#include "collectionfetchjob.h" 
    8#include "invalidatecachejob_p.h" 
    9#include "itemfetchjob.h" 
   10#include "itemmodifyjob.h" 
   13#include <KLocalizedString> 
   19class InvalidateCacheJobPrivate : JobPrivate
 
   22    explicit InvalidateCacheJobPrivate(InvalidateCacheJob *qq)
 
   26    Collection collection;
 
   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)
 
   36QString InvalidateCacheJobPrivate::jobDebuggingString()
 const 
   38    return QStringLiteral(
"Invalidate Cache from collection id: %1").arg(collection.id());
 
   43void 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."));
 
   63    auto itemFetch = 
new ItemFetchJob(collection, q);
 
   69void InvalidateCacheJobPrivate::itemFetchResult(KJob *job)
 
   71    Q_Q(InvalidateCacheJob);
 
   75    auto fetchJob = qobject_cast<ItemFetchJob *>(job);
 
   77    if (fetchJob->items().isEmpty()) {
 
   82    ItemModifyJob *modJob = 
nullptr;
 
   84    for (Item item : itemsLst) {
 
   86        modJob = 
new ItemModifyJob(item, q);
 
   93void InvalidateCacheJobPrivate::itemStoreResult(KJob *job)
 
   95    Q_Q(InvalidateCacheJob);
 
  102InvalidateCacheJob::InvalidateCacheJob(
const Collection &collection, QObject *parent)
 
  103    : 
Job(new InvalidateCacheJobPrivate(this), parent)
 
  105    Q_D(InvalidateCacheJob);
 
  106    d->collection = collection;
 
  109void InvalidateCacheJob::doStart()
 
  111    Q_D(InvalidateCacheJob);
 
  115        d->collectionFetchResult(job);
 
  119#include "moc_invalidatecachejob_p.cpp" 
Job that fetches collections from the Akonadi storage.
 
@ Base
Only fetch the base collection.
 
Represents a collection of PIM items.
 
QList< Item > List
Describes a list of items.
 
Base class for all actions in the Akonadi storage.
 
QString i18n(const char *text, const TYPE &arg...)
 
Helper integration between Akonadi and Qt.
 
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)