Akonadi
specialcollections.cpp
25SpecialCollectionsPrivate::SpecialCollectionsPrivate(KCoreConfigSkeleton *settings, SpecialCollections *qq)
38 QObject::connect(mMonitor, &Monitor::collectionRemoved, q, [this](const Akonadi::Collection &col) {
41 QObject::connect(mMonitor, &Monitor::collectionStatisticsChanged, q, [this](Akonadi::Collection::Id id, const Akonadi::CollectionStatistics &statistics) {
80 qCDebug(AKONADICORE_LOG) << "Collection" << collection.id() << "resource" << collection.resource();
103void SpecialCollectionsPrivate::collectionStatisticsChanged(Akonadi::Collection::Id collectionId, const Akonadi::CollectionStatistics &statistics)
107 auto fetchJob = new Akonadi::CollectionFetchJob(Collection(collectionId), Akonadi::CollectionFetchJob::Base);
119 qCWarning(AKONADICORE_LOG) << "Error fetching collection to get name from id for statistics updating in specialcollections!";
127 const auto statistics = fetchJob->property("statistics").value<Akonadi::CollectionStatistics>();
129 mFoldersForResource[collection.resource()][collection.name().toUtf8()].setStatistics(statistics);
178bool SpecialCollections::hasCollection(const QByteArray &type, const AgentInstance &instance) const
183Akonadi::Collection SpecialCollections::collection(const QByteArray &type, const AgentInstance &instance) const
188void SpecialCollections::setSpecialCollectionType(const QByteArray &type, const Akonadi::Collection &collection)
190 if (!collection.hasAttribute<SpecialCollectionAttribute>() || collection.attribute<SpecialCollectionAttribute>()->collectionType() != type) {
192 auto attribute = attributeCollection.attribute<SpecialCollectionAttribute>(Collection::AddIfMissing);
228bool SpecialCollections::registerCollection(const QByteArray &type, const Collection &collection)
Represents one agent instance and takes care of communication with it.
Definition akonadicontrol/agentinstance.h:35
QString identifier() const
Returns the unique identifier of the agent instance.
Job that fetches collections from the Akonadi storage.
Definition collectionfetchjob.h:39
Collection::List collections() const
Returns the list of fetched collection.
Definition collectionfetchjob.cpp:169
Job that modifies a collection in the Akonadi storage.
Definition collectionmodifyjob.h:62
Provides statistics information of a Collection.
Definition core/collectionstatistics.h:59
bool hasAttribute(const QByteArray &name) const
Returns true if the collection has an attribute of the given type name, false otherwise.
Definition collection.cpp:161
void removeAttribute(const QByteArray &name)
Removes and deletes the attribute of the given type name.
Definition collection.cpp:156
Attribute * attribute(const QByteArray &name)
Returns the attribute of the given type name if available, 0 otherwise.
Definition collection.cpp:176
void collectionRemoved(const Akonadi::Collection &collection)
This signal is emitted if a monitored collection has been removed from the Akonadi storage.
void collectionStatisticsChanged(Akonadi::Collection::Id id, const Akonadi::CollectionStatistics &statistics)
This signal is emitted if the statistics information of a monitored collection has changed.
An Attribute that stores the special collection type of a collection.
Definition specialcollectionattribute.h:29
void setCollectionType(const QByteArray &type)
Sets the special collections type of the collection.
Definition specialcollectionattribute.cpp:50
QByteArray collectionType() const
Returns the special collections type of the collection.
Definition specialcollectionattribute.cpp:55
static void setSpecialCollectionType(const QByteArray &type, const Akonadi::Collection &collection)
Sets the special collection attribute which marks collection as being a special collection of type ty...
Definition specialcollections.cpp:188
SpecialCollections(KCoreConfigSkeleton *config, QObject *parent=nullptr)
Creates a new special collections object.
Definition specialcollections.cpp:170
~SpecialCollections() override
Destroys the special collections object.
bool hasCollection(const QByteArray &type, const AgentInstance &instance) const
Returns whether the given agent instance has a special collection of the given type.
Definition specialcollections.cpp:178
bool hasDefaultCollection(const QByteArray &type) const
Returns whether the default resource has a special collection of the given type.
Definition specialcollections.cpp:256
Akonadi::Collection collection(const QByteArray &type, const AgentInstance &instance) const
Returns the special collection of the given type in the given agent instance, or an invalid collectio...
Definition specialcollections.cpp:183
static void unsetSpecialCollection(const Akonadi::Collection &collection)
unsets the special collection attribute which marks collection as being a special collection.
Definition specialcollections.cpp:198
bool unregisterCollection(const Collection &collection)
Unregisters the given collection as a special collection.
Definition specialcollections.cpp:207
bool registerCollection(const QByteArray &type, const Akonadi::Collection &collection)
Registers the given collection as a special collection with the given type.
Definition specialcollections.cpp:228
Akonadi::Collection defaultCollection(const QByteArray &type) const
Returns the special collection of given type in the default resource, or an invalid collection if suc...
Definition specialcollections.cpp:261
virtual QVariant property() const=0
int error() const
Helper integration between Akonadi and Qt.
QAction * statistics(const QObject *recvr, const char *slot, QObject *parent)
bool isEmpty() const const
bool remove(const Key &key)
const_reference at(qsizetype i) const const
bool empty() const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QVariant property(const char *name) const const
bool isEmpty() const const
QByteArray toUtf8() const const
QVariant fromValue(T &&value)
QString toString() const const
T value() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:49:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:49:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.