Verified Commit a866656c authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

Adapt KMail to MessageComposer SendLater API changes

Summary: All the SendLater classes have now moved into MessageComposer namespace.

Reviewers: mlaurent

Reviewed By: mlaurent

Subscribers: kde-doc-english, kde-pim

Tags: #kde_pim, #documentation

Differential Revision: https://phabricator.kde.org/D29723
parent 79813dea
......@@ -347,7 +347,6 @@ target_link_libraries(kmailprivate
KF5::Contacts
KF5::PimTextEdit
KF5::MessageViewer
KF5::SendLater
KF5::IconThemes
KF5::XmlGui
KF5::Completion
......
......@@ -147,9 +147,9 @@
#include <PimCommon/LineEditWithAutoCorrection>
#include <PimCommon/CustomToolsPluginManager>
#include <SendLater/SendLaterDialog>
#include <SendLater/SendLaterInfo>
#include <SendLater/SendLaterUtil>
#include <MessageComposer/SendLaterDialog>
#include <MessageComposer/SendLaterInfo>
#include <MessageComposer/SendLaterUtil>
#include <TemplateParser/TemplateParserJob>
#include <TemplateParser/TemplatesConfiguration>
......@@ -2643,7 +2643,7 @@ void KMComposerWin::doSend(MessageComposer::MessageSender::SendMethod method, Me
mComposerBase->setSendLaterInfo(nullptr);
const bool wasRegistered = sendLaterRegistered();
if (wasRegistered) {
SendLater::SendLaterInfo *info = new SendLater::SendLaterInfo;
auto info = new MessageComposer::SendLaterInfo;
info->setRecurrence(false);
info->setSubject(subject());
info->setDateTime(QDateTime::currentDateTime().addSecs(KMailSettings::self()->undoSendDelay()));
......@@ -2823,7 +2823,8 @@ void KMComposerWin::doDelayedSend(MessageComposer::MessageSender::SendMethod met
bool KMComposerWin::sendLaterRegistered() const
{
return SendLater::SendLaterUtil::sentLaterAgentWasRegistered() && SendLater::SendLaterUtil::sentLaterAgentEnabled();
return MessageComposer::SendLaterUtil::sentLaterAgentWasRegistered()
&& MessageComposer::SendLaterUtil::sentLaterAgentEnabled();
}
void KMComposerWin::slotSendLater()
......@@ -2838,23 +2839,23 @@ void KMComposerWin::slotSendLater()
if (mComposerBase->editor()->checkExternalEditorFinished()) {
const bool wasRegistered = sendLaterRegistered();
if (wasRegistered) {
SendLater::SendLaterInfo *info = nullptr;
QPointer<SendLater::SendLaterDialog> dlg = new SendLater::SendLaterDialog(info, this);
MessageComposer::SendLaterInfo *info = nullptr;
QPointer<MessageComposer::SendLaterDialog> dlg = new MessageComposer::SendLaterDialog(info, this);
if (dlg->exec()) {
info = dlg->info();
const SendLater::SendLaterDialog::SendLaterAction action = dlg->action();
const MessageComposer::SendLaterDialog::SendLaterAction action = dlg->action();
delete dlg;
switch (action) {
case SendLater::SendLaterDialog::Unknown:
case MessageComposer::SendLaterDialog::Unknown:
qCDebug(KMAIL_LOG) << "Sendlater action \"Unknown\": Need to fix it.";
break;
case SendLater::SendLaterDialog::Canceled:
case MessageComposer::SendLaterDialog::Canceled:
return;
break;
case SendLater::SendLaterDialog::PutInOutbox:
case MessageComposer::SendLaterDialog::PutInOutbox:
doSend(MessageComposer::MessageSender::SendLater);
break;
case SendLater::SendLaterDialog::SendDeliveryAtTime:
case MessageComposer::SendLaterDialog::SendDeliveryAtTime:
mComposerBase->setSendLaterInfo(info);
if (info->isRecurrence()) {
doSend(MessageComposer::MessageSender::SendLater, MessageComposer::MessageSender::SaveInTemplates, true);
......
......@@ -19,7 +19,9 @@
#include "undosendcreatejob.h"
#include "kmail_debug.h"
#include <SendLater/SendLaterUtil>
#include <MessageComposer/SendLaterRemoveJob>
#include <KNotification>
#include <KLocalizedString>
#include <QTimer>
......@@ -90,7 +92,8 @@ void UndoSendCreateJob::slotActivateNotificationAction(unsigned int index)
void UndoSendCreateJob::undoSendEmail()
{
mTimer->stop();
SendLater::SendLaterUtil::removeItem(mAkonadiIndex);
auto job = new MessageComposer::SendLaterRemoveJob(mAkonadiIndex, this);
job->start();
}
QString UndoSendCreateJob::subject() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment