Commit 719097cb authored by Laurent Montel's avatar Laurent Montel
Browse files

Remove unused code

parent 62bf4243
Pipeline #213897 passed with stage
in 5 minutes and 34 seconds
# SPDX-License-Identifier: CC0-1.0
# SPDX-FileCopyrightText: none
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
set(PIM_VERSION "5.21.41")
set(PIM_VERSION "5.21.42")
project(mailcommon VERSION ${PIM_VERSION})
......
......@@ -179,7 +179,6 @@ target_sources(KF5MailCommon PRIVATE
widgets/redirectdialog.cpp
widgets/redirectwidget.cpp
widgets/favoritecollectionwidget.cpp
mdn/sendmdnhandler.cpp
mdn/mdnwarningjob.h
mdn/mdnwarningjob.cpp
util/cryptoutils.cpp
......@@ -328,7 +327,6 @@ target_sources(KF5MailCommon PRIVATE
util/mailutil.h
util/cryptoutils.h
util/resourcereadconfigfile.h
mdn/sendmdnhandler.h
)
......@@ -489,7 +487,6 @@ ecm_generate_headers(MailCommon_Camelcasefilteraction_HEADERS
ecm_generate_headers(MailCommon_Camelcasemdn_HEADERS
HEADER_NAMES
SendMdnHandler
MDNWarningJob
REQUIRED_HEADERS MailCommon_mdn_HEADERS
PREFIX MailCommon
......
/*
SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
SPDX-FileContributor: Tobias Koenig <tokoe@kdab.com>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "sendmdnhandler.h"
#include "kernel/mailkernel.h"
#include "mailcommon_debug.h"
#include "util/mailutil.h"
#include <MessageComposer/MDNAdviceHelper>
#include <MessageComposer/MessageFactoryNG>
#include <MessageComposer/MessageSender>
#include <MessageComposer/Util>
#include <MessageViewer/MessageViewerSettings>
#include <Akonadi/Collection>
#include <Akonadi/Item>
#include <Akonadi/MessageFlags>
#include <QQueue>
#include <QTimer>
using namespace MailCommon;
class Q_DECL_HIDDEN SendMdnHandler::SendMdnHandlerPrivate
{
public:
SendMdnHandlerPrivate(SendMdnHandler *qq, IKernel *kernel)
: q(qq)
, mKernel(kernel)
{
}
void handleMessages();
SendMdnHandler *const q;
IKernel *const mKernel;
QQueue<Akonadi::Item> mItemQueue;
QTimer mTimer;
};
void SendMdnHandler::SendMdnHandlerPrivate::handleMessages()
{
while (!mItemQueue.isEmpty()) {
Akonadi::Item item = mItemQueue.dequeue();
#if 0
// should we send an MDN?
if (MessageViewer::MessageViewerSettings::notSendWhenEncrypted()
&& message()->encryptionState() != KMMsgNotEncrypted
&& message()->encryptionState() != KMMsgEncryptionStateUnknown) {
return;
}
#else
qCDebug(MAILCOMMON_LOG) << "AKONADI PORT: Disabled code in " << Q_FUNC_INFO;
#endif
const Akonadi::Collection collection = item.parentCollection();
if (collection.isValid()
&& (CommonKernel->folderIsSentMailFolder(collection) || CommonKernel->folderIsTrash(collection) || CommonKernel->folderIsDraftOrOutbox(collection)
|| CommonKernel->folderIsTemplates(collection))) {
continue;
}
const KMime::Message::Ptr message = MessageComposer::Util::message(item);
if (!message) {
continue;
}
const QPair<bool, KMime::MDN::SendingMode> mdnSend = MessageComposer::MDNAdviceHelper::instance()->checkAndSetMDNInfo(item, KMime::MDN::Displayed);
if (mdnSend.first) {
const int quote = MessageViewer::MessageViewerSettings::self()->quoteMessage();
MessageComposer::MessageFactoryNG factory(message, Akonadi::Item().id());
factory.setIdentityManager(mKernel->identityManager());
factory.setFolderIdentity(MailCommon::Util::folderIdentity(item));
const KMime::Message::Ptr mdn = factory.createMDN(KMime::MDN::ManualAction, KMime::MDN::Displayed, mdnSend.second, quote);
if (mdn) {
if (!mKernel->msgSender()->send(mdn)) {
qCDebug(MAILCOMMON_LOG) << "Sending failed.";
}
}
}
}
}
SendMdnHandler::SendMdnHandler(IKernel *kernel, QObject *parent)
: QObject(parent)
, d(new SendMdnHandlerPrivate(this, kernel))
{
d->mTimer.setSingleShot(true);
connect(&d->mTimer, &QTimer::timeout, this, [this]() {
d->handleMessages();
});
}
SendMdnHandler::~SendMdnHandler() = default;
void SendMdnHandler::setItem(const Akonadi::Item &item)
{
if (item.hasFlag(Akonadi::MessageFlags::Seen)) {
return;
}
d->mTimer.stop();
d->mItemQueue.enqueue(item);
if (MessageViewer::MessageViewerSettings::self()->delayedMarkAsRead() && MessageViewer::MessageViewerSettings::self()->delayedMarkTime() != 0) {
d->mTimer.start(MessageViewer::MessageViewerSettings::self()->delayedMarkTime() * 1000);
return;
}
d->handleMessages();
}
#include "moc_sendmdnhandler.cpp"
/*
SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
SPDX-FileContributor: Tobias Koenig <tokoe@kdab.com>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#pragma once
#include "mailcommon_export.h"
#include <MessageViewer/Viewer>
#include <QObject>
namespace MailCommon
{
class IKernel;
/**
* @short A viewer handler to send MDN for viewed messages.
*/
class MAILCOMMON_EXPORT SendMdnHandler : public QObject, public MessageViewer::AbstractMessageLoadedHandler
{
Q_OBJECT
public:
/**
* Creates a new send mnd handler.
*
* @param kernel The mail kernel object that will be used.
* @param parent The parent object.
*/
explicit SendMdnHandler(IKernel *kernel, QObject *parent = nullptr);
/**
* Destroys the send mdn handler.
*/
~SendMdnHandler() override;
/**
* @copydoc AbstractMessageLoadedHandler::setItem()
*/
void setItem(const Akonadi::Item &item) override;
private:
//@cond PRIVATE
class SendMdnHandlerPrivate;
std::unique_ptr<SendMdnHandlerPrivate> const d;
//@endcond
};
}
Supports Markdown
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