File indexing completed on 2024-09-22 04:47:56

0001 /*
0002     SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "mailtransport_export.h"
0010 #include <QList>
0011 #include <QObject>
0012 namespace MailTransport
0013 {
0014 class TransportJob;
0015 class Transport;
0016 /**
0017  * @brief The TransportAbstractPluginInfo struct
0018  * @author Laurent Montel <montel@kde.org>
0019  */
0020 struct MAILTRANSPORT_EXPORT TransportAbstractPluginInfo {
0021     QString name;
0022     QString identifier;
0023     QString description;
0024     bool isAkonadi = false;
0025 };
0026 
0027 /**
0028  * @brief The TransportAbstractPlugin class
0029  * @author Laurent Montel <montel@kde.org>
0030  */
0031 class MAILTRANSPORT_EXPORT TransportAbstractPlugin : public QObject
0032 {
0033     Q_OBJECT
0034 public:
0035     explicit TransportAbstractPlugin(QObject *parent = nullptr);
0036     ~TransportAbstractPlugin() override;
0037 
0038     [[nodiscard]] virtual TransportJob *createTransportJob(MailTransport::Transport *t, const QString &identifier) = 0;
0039     [[nodiscard]] virtual QList<TransportAbstractPluginInfo> names() const = 0;
0040     [[nodiscard]] virtual bool configureTransport(const QString &identifier, Transport *transport, QWidget *parent) = 0;
0041     virtual void cleanUp(MailTransport::Transport *t);
0042     virtual void initializeTransport(MailTransport::Transport *t, const QString &identifier);
0043 
0044 Q_SIGNALS:
0045     void updatePluginList();
0046 };
0047 }
0048 Q_DECLARE_TYPEINFO(MailTransport::TransportAbstractPluginInfo, Q_RELOCATABLE_TYPE);