Commit efc498d0 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Improve api

parent dd50f45b
Pipeline #21411 passed with stage
in 11 minutes and 40 seconds
...@@ -129,9 +129,8 @@ void ImportMailJobInterfaceTestImpl::importCustomMailTransport(const QString &id ...@@ -129,9 +129,8 @@ void ImportMailJobInterfaceTestImpl::importCustomMailTransport(const QString &id
qDebug() << "importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId) not implemented yet"; qDebug() << "importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId) not implemented yet";
} }
void ImportMailJobInterfaceTestImpl::importSmtpMailTransport(const KConfigGroup &group, int defaultTransport, int transportId) void ImportMailJobInterfaceTestImpl::importSmtpMailTransport(const SmtpMailTransport &smtpMailTransport, int defaultTransport, int transportId)
{ {
SmtpMailTransport smtpMailTransport(group);
qDebug() << "ImportMailJobInterfaceTestImpl::importSmtpMailTransport(const KConfigGroup &group, int defaultTransport, int transportId) not implement yet"; qDebug() << "ImportMailJobInterfaceTestImpl::importSmtpMailTransport(const KConfigGroup &group, int defaultTransport, int transportId) not implement yet";
qDebug() << " defaultTransport " << defaultTransport << " transportId " << transportId; qDebug() << " defaultTransport " << defaultTransport << " transportId " << transportId;
} }
...@@ -44,7 +44,7 @@ protected: ...@@ -44,7 +44,7 @@ protected:
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override; Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
void addNewIdentity(const QString &name, KConfigGroup &group, int defaultIdentities, int oldUid) override; void addNewIdentity(const QString &name, KConfigGroup &group, int defaultIdentities, int oldUid) override;
void importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId) override; void importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId) override;
void importSmtpMailTransport(const KConfigGroup &group, int defaultTransport, int transportId) override; void importSmtpMailTransport(const SmtpMailTransport &smtpMailTransport, int defaultTransport, int transportId) override;
private: private:
Q_REQUIRED_RESULT QString uniqueIdentityName(const QString &name); Q_REQUIRED_RESULT QString uniqueIdentityName(const QString &name);
uint mIdentityUoid = 1; uint mIdentityUoid = 1;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "importexportmailutil.h" #include "importexportmailutil.h"
#include "resourceconverterimpl.h" #include "resourceconverterimpl.h"
#include "pimdataexportcore_debug.h" #include "pimdataexportcore_debug.h"
#include "smtpmailtransport.h"
#include <MailCommon/FilterImporterExporter> #include <MailCommon/FilterImporterExporter>
#include <MailCommon/MailUtil> #include <MailCommon/MailUtil>
...@@ -166,7 +167,8 @@ void ImportMailJobInterface::importMailTransport(const QString &tempDirName) ...@@ -166,7 +167,8 @@ void ImportMailJobInterface::importMailTransport(const QString &tempDirName)
const QString identifierValue = group.readEntry(identifierStr); const QString identifierValue = group.readEntry(identifierStr);
importCustomMailTransport(identifierValue, group, defaultTransport, transportId); importCustomMailTransport(identifierValue, group, defaultTransport, transportId);
} else { } else {
importSmtpMailTransport(group, defaultTransport, transportId); SmtpMailTransport smtpMailTransport(group);
importSmtpMailTransport(smtpMailTransport, defaultTransport, transportId);
} }
} }
} }
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
class KArchiveDirectory; class KArchiveDirectory;
class KArchiveFile; class KArchiveFile;
class ArchiveStorage; class ArchiveStorage;
class SmtpMailTransport;
namespace MailTransport { namespace MailTransport {
class Transport; class Transport;
} }
...@@ -61,7 +62,7 @@ protected: ...@@ -61,7 +62,7 @@ protected:
virtual Q_REQUIRED_RESULT QString adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData) = 0; virtual Q_REQUIRED_RESULT QString adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData) = 0;
virtual void addNewIdentity(const QString &name, KConfigGroup &group, int defaultIdentities, int oldUid) = 0; virtual void addNewIdentity(const QString &name, KConfigGroup &group, int defaultIdentities, int oldUid) = 0;
virtual void importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId) = 0; virtual void importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId) = 0;
virtual void importSmtpMailTransport(const KConfigGroup &group, int defaultTransport, int transportId) = 0; virtual void importSmtpMailTransport(const SmtpMailTransport &smtpMailTransport, int defaultTransport, int transportId) = 0;
QHash<int, uint> mHashIdentity; QHash<int, uint> mHashIdentity;
QHash<int, int> mHashTransport; QHash<int, int> mHashTransport;
......
...@@ -134,9 +134,8 @@ void ImportMailJobInterfaceImpl::importCustomMailTransport(const QString &identi ...@@ -134,9 +134,8 @@ void ImportMailJobInterfaceImpl::importCustomMailTransport(const QString &identi
} }
} }
void ImportMailJobInterfaceImpl::importSmtpMailTransport(const KConfigGroup &group, int defaultTransport, int transportId) void ImportMailJobInterfaceImpl::importSmtpMailTransport(const SmtpMailTransport &smtpMailTransport, int defaultTransport, int transportId)
{ {
SmtpMailTransport smtpMailTransport(group);
MailTransport::Transport *mt = MailTransport::TransportManager::self()->createTransport(); MailTransport::Transport *mt = MailTransport::TransportManager::self()->createTransport();
mt->setName(smtpMailTransport.name()); mt->setName(smtpMailTransport.name());
mt->setHost(smtpMailTransport.host()); mt->setHost(smtpMailTransport.host());
......
...@@ -51,7 +51,7 @@ protected: ...@@ -51,7 +51,7 @@ protected:
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override; Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
void addNewIdentity(const QString &name, KConfigGroup &group, int defaultIdentities, int oldUid) override; void addNewIdentity(const QString &name, KConfigGroup &group, int defaultIdentities, int oldUid) override;
void importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId) override; void importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId) override;
void importSmtpMailTransport(const KConfigGroup &group, int defaultTransport, int transportId) override; void importSmtpMailTransport(const SmtpMailTransport &smtpMailTransport, int defaultTransport, int transportId) override;
void addMailTransport(MailTransport::Transport *mt, int defaultTransport, int transportId); void addMailTransport(MailTransport::Transport *mt, int defaultTransport, int transportId);
private: private:
Q_REQUIRED_RESULT QString uniqueIdentityName(const QString &name); Q_REQUIRED_RESULT QString uniqueIdentityName(const QString &name);
......
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