Commit 2cff77ec authored by Laurent Montel's avatar Laurent Montel 😁

Create a mailtransportakonadi

parent 8530205c
cmake_minimum_required(VERSION 3.0)
set(PIM_VERSION "5.4.43")
set(PIM_VERSION "5.4.46")
project(MailTransport VERSION ${PIM_VERSION})
......
......@@ -12,7 +12,7 @@ macro(add_akonadi_isolated_test _source _path)
Qt5::Test
KF5::AkonadiCore
KF5::AkonadiMime
KF5::MailTransport
KF5::MailTransportAkonadi
KF5::Mime
KF5::I18n
KF5::ConfigGui
......
......@@ -23,11 +23,11 @@
#include <qtest_akonadi.h>
#include <addressattribute.h>
#include <akonadi/dispatchmodeattribute.h>
#include <akonadi/errorattribute.h>
#include <akonadi/sentactionattribute.h>
#include <akonadi/sentbehaviourattribute.h>
#include <akonadi/transportattribute.h>
#include <kmailtransportakonadi/dispatchmodeattribute.h>
#include <kmailtransportakonadi/errorattribute.h>
#include <kmailtransportakonadi/sentactionattribute.h>
#include <kmailtransportakonadi/sentbehaviourattribute.h>
#include <kmailtransportakonadi/transportattribute.h>
using namespace Akonadi;
using namespace MailTransport;
......
......@@ -38,12 +38,12 @@
#include <kmime/kmime_message.h>
#include <akonadi/dispatchmodeattribute.h>
#include <akonadi/errorattribute.h>
#include <akonadi/messagequeuejob.h>
#include <akonadi/sentbehaviourattribute.h>
#include <kmailtransportakonadi/dispatchmodeattribute.h>
#include <kmailtransportakonadi/errorattribute.h>
#include <kmailtransportakonadi/messagequeuejob.h>
#include <kmailtransportakonadi/sentbehaviourattribute.h>
#include <transport.h>
#include <akonadi/transportattribute.h>
#include <kmailtransportakonadi/transportattribute.h>
#include <transportmanager.h>
#include <qsignalspy.h>
......
add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
set(mailtransport_lib_srcs
transport.cpp
transportmanager.cpp
transporttype.cpp
filteractionjob.cpp
transportjob.cpp
smtpjob.cpp
precommandjob.cpp
socket.cpp
servertest.cpp
)
set(mailtransport_akonadi_srcs
akonadi/dispatcherinterface.cpp
akonadi/attributeregistrar.cpp
akonadi/dispatchmodeattribute.cpp
akonadi/errorattribute.cpp
akonadi/transportattribute.cpp
akonadi/sentactionattribute.cpp
akonadi/sentbehaviourattribute.cpp
akonadi/messagequeuejob.cpp
akonadi/outboxactions.cpp
)
set(mailtransport_widgets_srcs
widgets/transportconfigwidget.cpp
widgets/addtransportdialog.cpp
widgets/transportcombobox.cpp
widgets/transportlistview.cpp
widgets/transportmanagementwidget.cpp
widgets/transportconfigdialog.cpp
widgets/smtpconfigwidget.cpp
)
ecm_qt_declare_logging_category(mailtransport_lib_srcs HEADER mailtransport_debug.h IDENTIFIER MAILTRANSPORT_LOG CATEGORY_NAME org.kde.pim.mailtransport)
ki18n_wrap_ui(mailtransport_lib_srcs
ui/addtransportdialog.ui
ui/transportmanagementwidget.ui
ui/smtpsettings.ui
)
kconfig_add_kcfg_files(mailtransport_lib_srcs transportbase.kcfgc)
add_library(KF5MailTransport ${mailtransport_lib_srcs}
${mailtransport_widgets_srcs}
${mailtransport_akonadi_srcs}
)
generate_export_header(KF5MailTransport BASE_NAME mailtransport)
add_library(KF5::MailTransport ALIAS KF5MailTransport)
target_include_directories(KF5MailTransport INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/MailTransport;${KDE_INSTALL_INCLUDEDIR_KF5}/MailTransport/mailtransport>")
target_include_directories(KF5MailTransport PUBLIC "$<BUILD_INTERFACE:${MailTransport_SOURCE_DIR}/src;${MailTransport_BINARY_DIR}/src>")
target_link_libraries(KF5MailTransport
PUBLIC
KF5::Wallet
KF5::AkonadiCore
KF5::Mime
KF5::AkonadiMime
PRIVATE
KF5::I18n
KF5::KIOCore
KF5::ConfigGui
KF5::WidgetsAddons
KF5::CoreAddons
KF5::Wallet
KF5::ConfigWidgets
Qt5::DBus
Qt5::Network
KF5::Completion
)
set_target_properties(KF5MailTransport PROPERTIES
VERSION ${MAILTRANSPORT_VERSION_STRING}
SOVERSION ${MAILTRANSPORT_SOVERSION}
EXPORT_NAME MailTransport
)
install(TARGETS KF5MailTransport EXPORT KF5MailTransportTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES mailtransport.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
add_subdirectory(kmailtransport)
add_subdirectory(kmailtransportakonadi)
add_subdirectory(kcm)
ecm_generate_headers(MailTransport_CamelCase_HEADERS
HEADER_NAMES
PrecommandJob
ServerTest
SmtpJob
Transport
TransportJob
TransportManager
TransportType
PREFIX MailTransport
REQUIRED_HEADERS MailTransport_HEADERS
)
ecm_generate_headers(MailTransport_widgets_CamelCase_HEADERS
HEADER_NAMES
TransportComboBox
TransportManagementWidget
PREFIX MailTransport
REQUIRED_HEADERS MailTransport_widgets_HEADERS
RELATIVE widgets
)
ecm_generate_headers(MailTransport_akonadi_CamelCase_HEADERS
HEADER_NAMES
DispatcherInterface
MessageQueueJob
TransportAttribute
SentBehaviourAttribute
DispatchModeAttribute
ErrorAttribute
SentActionAttribute
PREFIX MailTransport
REQUIRED_HEADERS MailTransport_akonadi_HEADERS
RELATIVE akonadi
)
install(FILES
${MailTransport_CamelCase_HEADERS}
${MailTransport_widgets_CamelCase_HEADERS}
${MailTransport_akonadi_CamelCase_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/MailTransport/MailTransport/ COMPONENT Devel )
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/mailtransport_export.h
${MailTransport_HEADERS}
${MailTransport_widgets_HEADERS}
${MailTransport_akonadi_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/transportbase.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/MailTransport/mailtransport COMPONENT Devel
)
ecm_generate_pri_file(BASE_NAME KMailTransport LIB_NAME KF5MailTransport DEPS "Wallet AkonadiCore Mime AkonadiMime" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/MailTransport/)
install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
set(mailtransport_lib_srcs
transport.cpp
transportmanager.cpp
transporttype.cpp
transportjob.cpp
smtpjob.cpp
precommandjob.cpp
socket.cpp
servertest.cpp
)
set(mailtransport_widgets_srcs
widgets/transportconfigwidget.cpp
widgets/addtransportdialog.cpp
widgets/transportcombobox.cpp
widgets/transportlistview.cpp
widgets/transportmanagementwidget.cpp
widgets/transportconfigdialog.cpp
widgets/smtpconfigwidget.cpp
)
ecm_qt_declare_logging_category(mailtransport_lib_srcs HEADER mailtransport_debug.h IDENTIFIER MAILTRANSPORT_LOG CATEGORY_NAME org.kde.pim.mailtransport)
ki18n_wrap_ui(mailtransport_lib_srcs
ui/addtransportdialog.ui
ui/transportmanagementwidget.ui
ui/smtpsettings.ui
)
kconfig_add_kcfg_files(mailtransport_lib_srcs transportbase.kcfgc)
add_library(KF5MailTransport ${mailtransport_lib_srcs}
${mailtransport_widgets_srcs}
${mailtransport_kmailtransportakonadi_srcs}
)
generate_export_header(KF5MailTransport BASE_NAME mailtransport)
add_library(KF5::MailTransport ALIAS KF5MailTransport)
target_include_directories(KF5MailTransport INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/MailTransport;${KDE_INSTALL_INCLUDEDIR_KF5}/mailtransport>")
target_include_directories(KF5MailTransport PUBLIC "$<BUILD_INTERFACE:${MailTransport_SOURCE_DIR}/src;${MailTransport_BINARY_DIR}/src>")
target_link_libraries(KF5MailTransport
PUBLIC
KF5::Wallet
PRIVATE
KF5::I18n
KF5::KIOCore
KF5::ConfigGui
KF5::WidgetsAddons
KF5::CoreAddons
KF5::Wallet
KF5::ConfigWidgets
Qt5::DBus
Qt5::Network
KF5::Completion
)
set_target_properties(KF5MailTransport PROPERTIES
VERSION ${MAILTRANSPORT_VERSION_STRING}
SOVERSION ${MAILTRANSPORT_SOVERSION}
EXPORT_NAME MailTransport
)
install(TARGETS KF5MailTransport EXPORT KF5MailTransportTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES mailtransport.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
ecm_generate_headers(MailTransport_CamelCase_HEADERS
HEADER_NAMES
PrecommandJob
ServerTest
SmtpJob
Transport
TransportJob
TransportManager
TransportType
PREFIX MailTransport
REQUIRED_HEADERS MailTransport_HEADERS
)
ecm_generate_headers(MailTransport_widgets_CamelCase_HEADERS
HEADER_NAMES
TransportComboBox
TransportManagementWidget
PREFIX MailTransport
REQUIRED_HEADERS MailTransport_widgets_HEADERS
RELATIVE widgets
)
install(FILES
${MailTransport_CamelCase_HEADERS}
${MailTransport_widgets_CamelCase_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/MailTransport/ COMPONENT Devel )
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/mailtransport_export.h
${MailTransport_HEADERS}
${MailTransport_widgets_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/transportbase.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/mailtransport COMPONENT Devel
)
ecm_generate_pri_file(BASE_NAME KMailTransport LIB_NAME KF5MailTransport DEPS "Wallet" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/MailTransport/)
install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
......@@ -32,9 +32,6 @@
#include <KStringHandler>
#include <KWallet/KWallet>
#include <agentinstance.h>
#include <agentmanager.h>
using namespace MailTransport;
using namespace KWallet;
......@@ -161,7 +158,6 @@ void Transport::usrRead()
// Set TransportType.
{
using namespace Akonadi;
d->transportType = TransportType();
d->transportType.d->mType = type();
qCDebug(MAILTRANSPORT_LOG) << "type" << type();
......
......@@ -26,8 +26,6 @@
#include <QtCore/QList>
#include <QtCore/QObject>
#include <agenttype.h>
class KJob;
namespace KWallet
......
......@@ -25,7 +25,6 @@
#include <QtCore/QString>
#include <agenttype.h>
namespace MailTransport
{
......
add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
set(mailtransportakonadi_lib_srcs
dispatcherinterface.cpp
attributeregistrar.cpp
dispatchmodeattribute.cpp
errorattribute.cpp
transportattribute.cpp
sentactionattribute.cpp
sentbehaviourattribute.cpp
messagequeuejob.cpp
outboxactions.cpp
filteractionjob.cpp
)
ecm_qt_declare_logging_category(mailtransportakonadi_lib_srcs HEADER mailtransportakonadi_debug.h IDENTIFIER MAILTRANSPORTAKONADI_LOG CATEGORY_NAME org.kde.pim.mailtransportakonadi)
add_library(KF5MailTransportAkonadi ${mailtransportakonadi_lib_srcs}
)
generate_export_header(KF5MailTransportAkonadi BASE_NAME mailtransportakonadi)
add_library(KF5::MailTransportAkonadi ALIAS KF5MailTransportAkonadi)
target_include_directories(KF5MailTransportAkonadi INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/MailTransportAkonadi;${KDE_INSTALL_INCLUDEDIR_KF5}/mailtransportakonadi>")
target_include_directories(KF5MailTransportAkonadi PUBLIC "$<BUILD_INTERFACE:${MailTransport_SOURCE_DIR}/src;${MailTransport_BINARY_DIR}/src>")
target_link_libraries(KF5MailTransportAkonadi
PUBLIC
KF5::AkonadiCore
KF5::Mime
KF5::AkonadiMime
KF5::MailTransport
PRIVATE
KF5::I18n
KF5::KIOCore
KF5::WidgetsAddons
KF5::CoreAddons
KF5::Wallet
KF5::ConfigGui
)
set_target_properties(KF5MailTransportAkonadi PROPERTIES
VERSION ${MAILTRANSPORT_VERSION_STRING}
SOVERSION ${MAILTRANSPORT_SOVERSION}
EXPORT_NAME MailTransportAkonadi
)
install(TARGETS KF5MailTransportAkonadi EXPORT KF5MailTransportTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
ecm_generate_headers(MailTransport_kmailtransportakonadi_CamelCase_HEADERS
HEADER_NAMES
DispatcherInterface
MessageQueueJob
TransportAttribute
SentBehaviourAttribute
DispatchModeAttribute
ErrorAttribute
SentActionAttribute
PREFIX MailTransportAkonadi
REQUIRED_HEADERS MailTransport_kmailtransportakonadi_HEADERS
)
install(FILES
${MailTransport_kmailtransportakonadi_CamelCase_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/MailTransportAkonadi COMPONENT Devel )
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/mailtransportakonadi_export.h
${MailTransport_kmailtransportakonadi_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/mailtransportakonadi COMPONENT Devel
)
ecm_generate_pri_file(BASE_NAME KMailTransport LIB_NAME KF5MailTransportAkonadi DEPS "Wallet AkonadiCore Mime AkonadiMime" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/MailTransportAkonadi/)
install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
......@@ -20,14 +20,14 @@
#include "dispatcherinterface.h"
#include "dispatcherinterface_p.h"
#include "akonadi/outboxactions_p.h"
#include "kmailtransportakonadi/outboxactions_p.h"
#include "mailtransport_debug.h"
#include "mailtransportakonadi_debug.h"
#include <agentmanager.h>
#include <collection.h>
#include <specialmailcollections.h>
#include "akonadi/transportattribute.h"
#include "kmailtransportakonadi/transportattribute.h"
using namespace Akonadi;
using namespace MailTransport;
......@@ -38,9 +38,9 @@ void DispatcherInterfacePrivate::massModifyResult(KJob *job)
{
// Nothing to do here, really. If the job fails, the user can retry it.
if (job->error()) {
qCDebug(MAILTRANSPORT_LOG) << "failed" << job->errorString();
qCDebug(MAILTRANSPORTAKONADI_LOG) << "failed" << job->errorString();
} else {
qCDebug(MAILTRANSPORT_LOG) << "succeeded.";
qCDebug(MAILTRANSPORTAKONADI_LOG) << "succeeded.";
}
}
......@@ -53,7 +53,7 @@ AgentInstance DispatcherInterface::dispatcherInstance() const
AgentInstance a =
AgentManager::self()->instance(QStringLiteral("akonadi_maildispatcher_agent"));
if (!a.isValid()) {
qCWarning(MAILTRANSPORT_LOG) << "Could not get MDA instance.";
qCWarning(MAILTRANSPORTAKONADI_LOG) << "Could not get MDA instance.";
}
return a;
}
......
......@@ -20,7 +20,7 @@
#ifndef MAILTRANSPORT_DISPATCHERINTERFACE_H
#define MAILTRANSPORT_DISPATCHERINTERFACE_H
#include <mailtransport_export.h>
#include <mailtransportakonadi_export.h>
#include <agentinstance.h>
......@@ -41,7 +41,7 @@ namespace MailTransport
@author Constantin Berzan <exit3219@gmail.com>
@since 4.4
*/
class MAILTRANSPORT_EXPORT DispatcherInterface
class MAILTRANSPORTAKONADI_EXPORT DispatcherInterface
{
public:
......
......@@ -19,7 +19,7 @@
#include "dispatchmodeattribute.h"
#include "mailtransport_debug.h"
#include "mailtransportakonadi_debug.h"
#include <attributefactory.h>
......@@ -86,7 +86,7 @@ void DispatchModeAttribute::deserialize(const QByteArray &data)
d->mDueDate = QDateTime::fromString(QString::fromLatin1(data.mid(5)), Qt::ISODate);
// NOTE: 5 is the strlen of "after".
} else {
qCWarning(MAILTRANSPORT_LOG) << "Failed to deserialize data [" << data << "]";
qCWarning(MAILTRANSPORTAKONADI_LOG) << "Failed to deserialize data [" << data << "]";
}
}
......
......@@ -20,7 +20,7 @@
#ifndef MAILTRANSPORT_DISPATCHMODEATTRIBUTE_H
#define MAILTRANSPORT_DISPATCHMODEATTRIBUTE_H
#include <mailtransport_export.h>
#include <mailtransportakonadi_export.h>
#include <QtCore/QDateTime>
......@@ -37,7 +37,7 @@ namespace MailTransport
@author Constantin Berzan <exit3219@gmail.com>
@since 4.4
*/
class MAILTRANSPORT_EXPORT DispatchModeAttribute : public Akonadi::Attribute
class MAILTRANSPORTAKONADI_EXPORT DispatchModeAttribute : public Akonadi::Attribute
{
public:
/**
......
......@@ -20,7 +20,7 @@
#ifndef MAILTRANSPORT_ERRORATTRIBUTE_H
#define MAILTRANSPORT_ERRORATTRIBUTE_H
#include <mailtransport_export.h>
#include <mailtransportakonadi_export.h>
#include <QtCore/QString>
......@@ -37,7 +37,7 @@ namespace MailTransport
* @author Constantin Berzan <exit3219@gmail.com>
* @since 4.4
*/
class MAILTRANSPORT_EXPORT ErrorAttribute : public Akonadi::Attribute
class MAILTRANSPORTAKONADI_EXPORT ErrorAttribute : public Akonadi::Attribute
{
public:
/**
...