Esempio n. 1
0
void SaveDraftJob::start()
{
    Akonadi::Item item;
    item.setPayload(mMsg);
    item.setMimeType(KMime::Message::mimeType());
    item.setFlag(Akonadi::MessageFlags::Seen);
    Akonadi::MessageFlags::copyMessageFlags(*mMsg, item);

    Akonadi::ItemCreateJob *createJob = new Akonadi::ItemCreateJob(item, mCollection);
    connect(createJob, &Akonadi::ItemCreateJob::result, this, &SaveDraftJob::slotStoreDone);
}
Esempio n. 2
0
void SentActionHandler::itemFetchResult(KJob *job)
{
    if (job->error()) {
        qCWarning(MAILDISPATCHER_LOG) << job->errorText();
        return;
    }

    Akonadi::ItemFetchJob *fetchJob = qobject_cast<Akonadi::ItemFetchJob *>(job);
    if (fetchJob->items().isEmpty()) {
        return;
    }

    Akonadi::Item item = fetchJob->items().at(0);

    const SentActionAttribute::Action::Type type = static_cast<SentActionAttribute::Action::Type>(job->property("type").toInt());
    if (type == SentActionAttribute::Action::MarkAsReplied) {
        item.setFlag(Akonadi::MessageFlags::Replied);
    } else if (type == SentActionAttribute::Action::MarkAsForwarded) {
        item.setFlag(Akonadi::MessageFlags::Forwarded);
    }

    Akonadi::ItemModifyJob *modifyJob = new Akonadi::ItemModifyJob(item);
    modifyJob->setIgnorePayload(true);
}