File indexing completed on 2024-12-22 04:56:55

0001 /*
0002     SPDX-FileCopyrightText: 2010 Grégory Oestreicher <greg@kamago.net>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <KDAV/EtagCache>
0010 
0011 namespace Akonadi
0012 {
0013 class Collection;
0014 }
0015 
0016 class KJob;
0017 
0018 /**
0019  * @short A helper class to cache etags.
0020  *
0021  * The KDAV::EtagCache caches the remote ids and etags of all items
0022  * in a given collection. This cache is needed to find
0023  * out which items have been changed in the backend and have to
0024  * be refetched on the next call of ResourceBase::retrieveItems()
0025  */
0026 class AkonadiEtagCache : public KDAV::EtagCache
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031     /**
0032      * Creates a new etag cache and populates it with the ETags
0033      * of items found in @p collection.
0034      */
0035     explicit AkonadiEtagCache(const Akonadi::Collection &collection, QObject *parent = nullptr);
0036 
0037 private:
0038     void onItemFetchJobFinished(KJob *job);
0039 };