From 4069acb058b982c97677bb50b5609a9902dd21d8 Mon Sep 17 00:00:00 2001 From: Laurent Montel Date: Thu, 24 Oct 2019 14:01:18 +0200 Subject: [PATCH] continue to implement undosave --- CMakeLists.txt | 2 +- src/editor/kmcomposerwin.cpp | 19 ++++++++++++++++++- src/editor/kmcomposerwin.h | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33beb5085..4e4372141 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,7 @@ find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED DBus Network Test Widget set(LIBGRAVATAR_VERSION_LIB "5.12.40") set(MAILCOMMON_LIB_VERSION_LIB "5.12.46") set(KDEPIM_APPS_LIB_VERSION_LIB "5.12.41") -set(MESSAGELIB_LIB_VERSION_LIB "5.12.63") +set(MESSAGELIB_LIB_VERSION_LIB "5.12.68") set(LIBKLEO_LIB_VERSION_LIB "5.12.40") set(PIMCOMMON_LIB_VERSION_LIB "5.12.41") set(LIBKDEPIM_LIB_VERSION_LIB "5.12.40") diff --git a/src/editor/kmcomposerwin.cpp b/src/editor/kmcomposerwin.cpp index 8077e7fa8..e99d7ad0a 100644 --- a/src/editor/kmcomposerwin.cpp +++ b/src/editor/kmcomposerwin.cpp @@ -1876,8 +1876,11 @@ void KMComposerWin::slotSendFailed(const QString &msg, MessageComposer::Composer } } -void KMComposerWin::slotSendSuccessful() +void KMComposerWin::slotSendSuccessful(Akonadi::Item::Id id) { + if (id != -1) { + //TODO send later info + } setModified(false); mComposerBase->cleanupAutoSave(); mFolder = Akonadi::Collection(); // see dtor @@ -2540,6 +2543,20 @@ void KMComposerWin::doSend(MessageComposer::MessageSender::SendMethod method, Me if (!MessageComposer::Util::sendMailDispatcherIsOnline()) { method = MessageComposer::MessageSender::SendLater; } + if (KMailSettings::self()->enabledUndoSend()) { + mComposerBase->setSendLaterInfo(nullptr); + const bool wasRegistered = sendLaterRegistered(); + if (wasRegistered) { + SendLater::SendLaterInfo *info = new SendLater::SendLaterInfo; + info->setRecurrence(false); + info->setSubject(subject()); + info->setDateTime(QDateTime::currentDateTime().addSecs(KMailSettings::self()->undoSendDelay())); + mComposerBase->setSendLaterInfo(info); + } + method = MessageComposer::MessageSender::SendLater; + willSendItWithoutReediting = true; + saveIn == MessageComposer::MessageSender::SaveInOutbox; + } } if (saveIn == MessageComposer::MessageSender::SaveInNone || willSendItWithoutReediting) { // don't save as draft or template, send immediately diff --git a/src/editor/kmcomposerwin.h b/src/editor/kmcomposerwin.h index 807e3f30f..236af0b86 100644 --- a/src/editor/kmcomposerwin.h +++ b/src/editor/kmcomposerwin.h @@ -358,7 +358,7 @@ private Q_SLOTS: void slotPrintComposeResult(KJob *job); void slotSendFailed(const QString &msg, MessageComposer::ComposerViewBase::FailedType type); - void slotSendSuccessful(); + void slotSendSuccessful(Akonadi::Item::Id id); /** * toggle automatic spellchecking