Akonadi::CollectionStatistics Class
class Akonadi::CollectionStatisticsProvides statistics information of a Collection. More...
| Header: | #include <Akonadi/CollectionStatistics> |
| CMake: | find_package(KPim6 REQUIRED COMPONENTS AkonadiCore)target_link_libraries(mytarget PRIVATE KPim6::AkonadiCore) |
Public Functions
| CollectionStatistics() | |
| CollectionStatistics(const Akonadi::CollectionStatistics &other) | |
| ~CollectionStatistics() | |
| qint64 | count() const |
| void | setCount(qint64 count) |
| void | setSize(qint64 size) |
| void | setUnreadCount(qint64 count) |
| qint64 | size() const |
| qint64 | unreadCount() const |
| Akonadi::CollectionStatistics & | operator=(const Akonadi::CollectionStatistics &other) |
Detailed Description
This class contains information such as total number of items, number of new and unread items, etc.
This information might be expensive to obtain and is thus not included when fetching collections with a CollectionFetchJob. It can be retrieved separately using CollectionStatisticsJob.
Example:
Akonadi::Collection collection = ... Akonadi::CollectionStatisticsJob *job = new Akonadi::CollectionStatisticsJob( collection ); connect(job, &KJob::result, this, &MyClass::jobFinished); ... MyClass::jobFinished( KJob *job ) { if ( job->error() ) { qDebug() << "Error occurred"; return; } CollectionStatisticsJob *statisticsJob = qobject_cast<CollectionStatisticsJob*>( job ); const Akonadi::CollectionStatistics statistics = statisticsJob->statistics(); qDebug() << "Unread items:" << statistics.unreadCount(); }
This class is implicitly shared.
Author: Volker Krause <vkrause@kde.org>
Member Function Documentation
CollectionStatistics::CollectionStatistics()
Creates a new collection statistics object.
CollectionStatistics::CollectionStatistics(const Akonadi::CollectionStatistics &other)
Creates a collection statistics object from an other one.
[noexcept] CollectionStatistics::~CollectionStatistics()
Destroys the collection statistics object.
qint64 CollectionStatistics::count() const
Returns the number of items in this collection or \ -1 if this information is not available.
Note: Getter function for property count.
See also setCount() and unreadCount().
void CollectionStatistics::setCount(qint64 count)
Sets the number of items in this collection.
count The number of items.
See also count().
void CollectionStatistics::setSize(qint64 size)
Sets the total size of the items in this collection.
size The total size of the items
See also size().
void CollectionStatistics::setUnreadCount(qint64 count)
Sets the number of unread items in this collection.
count The number of unread messages.
See also unreadCount().
qint64 CollectionStatistics::size() const
Returns the total size of the items in this collection or \ -1 if this information is not available.
Note: Getter function for property size.
See also setSize().
qint64 CollectionStatistics::unreadCount() const
Returns the number of unread items in this collection or \ -1 if this information is not available.
See also setUnreadCount() and count().
Akonadi::CollectionStatistics &CollectionStatistics::operator=(const Akonadi::CollectionStatistics &other)
Assigns other to this statistics object and returns a reference to this one.