Changeset View
Changeset View
Standalone View
Standalone View
agents/sendlateragent/sendlateragent.cpp
Show All 36 Lines | |||||
37 | #include <AttributeFactory> | 37 | #include <AttributeFactory> | ||
38 | #include <CollectionFetchScope> | 38 | #include <CollectionFetchScope> | ||
39 | #include <KMime/Message> | 39 | #include <KMime/Message> | ||
40 | 40 | | |||
41 | #include <KWindowSystem> | 41 | #include <KWindowSystem> | ||
42 | #include <Kdelibs4ConfigMigrator> | 42 | #include <Kdelibs4ConfigMigrator> | ||
43 | 43 | | |||
44 | #include <QPointer> | 44 | #include <QPointer> | ||
45 | #include <sendlaterinfo.h> | ||||
45 | 46 | | |||
46 | //#define DEBUG_SENDLATERAGENT 1 | 47 | //#define DEBUG_SENDLATERAGENT 1 | ||
47 | 48 | | |||
48 | SendLaterAgent::SendLaterAgent(const QString &id) | 49 | SendLaterAgent::SendLaterAgent(const QString &id) | ||
49 | : Akonadi::AgentBase(id) | 50 | : Akonadi::AgentBase(id) | ||
50 | , mAgentInitialized(false) | 51 | , mAgentInitialized(false) | ||
51 | { | 52 | { | ||
52 | Kdelibs4ConfigMigrator migrate(QStringLiteral("sendlateragent")); | 53 | Kdelibs4ConfigMigrator migrate(QStringLiteral("sendlateragent")); | ||
▲ Show 20 Lines • Show All 104 Lines • ▼ Show 20 Line(s) | |||||
157 | 158 | | |||
158 | void SendLaterAgent::removeItem(qint64 item) | 159 | void SendLaterAgent::removeItem(qint64 item) | ||
159 | { | 160 | { | ||
160 | if (mManager->itemRemoved(item)) { | 161 | if (mManager->itemRemoved(item)) { | ||
161 | reload(); | 162 | reload(); | ||
162 | } | 163 | } | ||
163 | } | 164 | } | ||
164 | 165 | | |||
166 | void SendLaterAgent::addItem(qint64 timestamp, bool recurrence, int recurrenceValue, int recurrenceUnit, | ||||
167 | Akonadi::Item::Id id, const QString &subject, const QString &to) | ||||
168 | { | ||||
169 | auto info = new MessageComposer::SendLaterInfo; | ||||
170 | info->setDateTime(QDateTime::fromSecsSinceEpoch(timestamp)); | ||||
171 | info->setRecurrence(recurrence); | ||||
172 | info->setRecurrenceEachValue(recurrenceValue); | ||||
173 | info->setRecurrenceUnit(static_cast<MessageComposer::SendLaterInfo::RecurrenceUnit>(recurrenceUnit)); | ||||
174 | info->setItemId(id); | ||||
175 | info->setSubject(subject); | ||||
176 | info->setTo(to); | ||||
177 | | ||||
178 | SendLaterUtil::writeSendLaterInfo(SendLaterUtil::defaultConfig(), info); | ||||
179 | reload(); | ||||
180 | } | ||||
181 | | ||||
165 | void SendLaterAgent::slotSendNow(Akonadi::Item::Id id) | 182 | void SendLaterAgent::slotSendNow(Akonadi::Item::Id id) | ||
166 | { | 183 | { | ||
167 | mManager->sendNow(id); | 184 | mManager->sendNow(id); | ||
168 | } | 185 | } | ||
169 | 186 | | |||
170 | void SendLaterAgent::itemsRemoved(const Akonadi::Item::List &items) | 187 | void SendLaterAgent::itemsRemoved(const Akonadi::Item::List &items) | ||
171 | { | 188 | { | ||
172 | bool needToReload = false; | 189 | bool needToReload = false; | ||
Show All 24 Lines |