Commit da178cb9 authored by Volker Krause's avatar Volker Krause
Browse files

Remove MailTransport dependency from MailTransportAkonadi

This removes two things:
- The transport() helper method in TransportAttribute. This is only used
in the mail dispatcher agent and easy to replace.
- The transport validity check when queuing an email. This check is
repeated by the dispatcher agent at the time of sending again anyway
(and that's the more relevant time, as transport configuration can change
meanwhile).

As a result both libraries are now independent of each other. This might
seem a bit weird, but to me this shows that what is in MailTransportAkonadi
probably rather belongs into AkonadiMime instead. That's for a subsequent
change though.
parent 01f20f5c
Pipeline #143815 passed with stage
in 1 minute and 8 seconds
......@@ -55,11 +55,9 @@ target_link_libraries(KF5MailTransportAkonadi
KF5::AkonadiCore
KF5::Mime
KF5::AkonadiMime
KF5::MailTransport
PRIVATE
KF5::I18n
KF5::CoreAddons
KF5::ConfigGui
)
set_target_properties(KF5MailTransportAkonadi PROPERTIES
......
......@@ -7,7 +7,7 @@ add_akonadi_isolated_test(
)
add_akonadi_isolated_test(
SOURCE messagequeuejobtest.cpp
LINK_LIBRARIES KF5::MailTransportAkonadi KF5::I18n KF5::ConfigGui
LINK_LIBRARIES KF5::MailTransportAkonadi KF5::MailTransport KF5::I18n KF5::ConfigGui
)
# TODO: port & re-enable
#add_akonadi_isolated_test(
......
......@@ -7,8 +7,6 @@
#include "messagequeuejob.h"
#include "kmailtransportakonadi/transportattribute.h"
#include "transport.h"
#include "transportmanager.h"
#include "mailtransportakonadi_debug.h"
#include <KLocalizedString>
......@@ -71,14 +69,6 @@ bool MessageQueueJobPrivate::validate()
return false;
}
const int transport = transportAttribute.transportId();
if (TransportManager::self()->transportById(transport, false) == nullptr) {
q->setError(KJob::UserDefinedError);
q->setErrorText(i18n("Message has invalid transport."));
q->emitResult();
return false;
}
if (sentBehaviourAttribute.sentBehaviour() == SentBehaviourAttribute::MoveToCollection && !(sentBehaviourAttribute.moveToCollection().isValid())) {
q->setError(KJob::UserDefinedError);
q->setErrorText(i18n("Message has invalid sent-mail folder."));
......
......@@ -17,6 +17,7 @@ ecm_qt_declare_logging_category(mailtransport_akonadiplugin HEADER mailtransport
target_link_libraries(mailtransport_akonadiplugin
KF5::MailTransportAkonadi
KF5::MailTransport
KF5::CoreAddons
KF5::AkonadiCore
KF5::AkonadiWidgets
......
......@@ -6,7 +6,7 @@ find_package(KF5TextWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED)
set(queuer_srcs queuer.cpp)
add_executable(queuer ${queuer_srcs})
ecm_mark_as_test(queuer)
target_link_libraries(queuer KF5MailTransportAkonadi Qt${QT_MAJOR_VERSION}::Widgets KF5::I18n KF5::ConfigGui KF5::TextWidgets)
target_link_libraries(queuer KF5MailTransportAkonadi KF5MailTransport Qt${QT_MAJOR_VERSION}::Widgets KF5::I18n KF5::ConfigGui KF5::TextWidgets)
set( sendqueued_srcs sendqueued.cpp )
add_executable( sendqueued ${sendqueued_srcs} )
......
......@@ -6,8 +6,6 @@
#include "transportattribute.h"
#include "transportmanager.h"
using namespace Akonadi;
using namespace MailTransport;
......@@ -51,11 +49,6 @@ int TransportAttribute::transportId() const
return d->mId;
}
Transport *TransportAttribute::transport() const
{
return TransportManager::self()->transportById(d->mId, false);
}
void TransportAttribute::setTransportId(int id)
{
d->mId = id;
......
......@@ -14,7 +14,6 @@
namespace MailTransport
{
class Transport;
class TransportAttributePrivate;
/**
......@@ -51,12 +50,6 @@ public:
*/
Q_REQUIRED_RESULT int transportId() const;
/**
Returns the transport object corresponding to the transport id contained
in this attribute.
@see Transport.
*/
Transport *transport() const;
/**
Sets the transport id to use for sending this message.
*/
......
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