本文整理汇总了C++中akonadi::Collection::setCachePolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ Collection::setCachePolicy方法的具体用法?C++ Collection::setCachePolicy怎么用?C++ Collection::setCachePolicy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类akonadi::Collection
的用法示例。
在下文中一共展示了Collection::setCachePolicy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doStart
void RetrieveCollectionsTask::doStart(KIMAP::Session *session)
{
Akonadi::Collection root;
root.setName(resourceName());
root.setRemoteId(rootRemoteId());
root.setContentMimeTypes(QStringList(Akonadi::Collection::mimeType()));
root.setParentCollection(Akonadi::Collection::root());
root.addAttribute(new NoSelectAttribute(true));
Akonadi::CachePolicy policy;
policy.setInheritFromParent(false);
policy.setSyncOnDemand(true);
QStringList localParts;
localParts << QLatin1String(Akonadi::MessagePart::Envelope)
<< QLatin1String(Akonadi::MessagePart::Header);
int cacheTimeout = 60;
if (isDisconnectedModeEnabled()) {
// For disconnected mode we also cache the body
// and we keep all data indifinitely
localParts << QLatin1String(Akonadi::MessagePart::Body);
cacheTimeout = -1;
}
policy.setLocalParts(localParts);
policy.setCacheTimeout(cacheTimeout);
policy.setIntervalCheckTime(intervalCheckTime());
root.setCachePolicy(policy);
m_reportedCollections.insert(QString(), root);
// this is ugly, but the result of LSUB is unfortunately not a sub-set of LIST
// it also contains subscribed but currently not available (eg. deleted) mailboxes
// so we need to use both and exclude mailboxes in LSUB but not in LIST
if (isSubscriptionEnabled()) {
KIMAP::ListJob *fullListJob = new KIMAP::ListJob(session);
fullListJob->setIncludeUnsubscribed(true);
fullListJob->setQueriedNamespaces(serverNamespaces());
connect(fullListJob, &KIMAP::ListJob::mailBoxesReceived,
this, &RetrieveCollectionsTask::onFullMailBoxesReceived);
connect(fullListJob, &KIMAP::ListJob::result, this, &RetrieveCollectionsTask::onFullMailBoxesReceiveDone);
fullListJob->start();
}
KIMAP::ListJob *listJob = new KIMAP::ListJob(session);
listJob->setIncludeUnsubscribed(!isSubscriptionEnabled());
listJob->setQueriedNamespaces(serverNamespaces());
connect(listJob, &KIMAP::ListJob::mailBoxesReceived,
this, &RetrieveCollectionsTask::onMailBoxesReceived);
connect(listJob, &KIMAP::ListJob::result, this, &RetrieveCollectionsTask::onMailBoxesReceiveDone);
listJob->start();
}