Commit 3754de2f authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add more virtual method

parent 83fb0a01
Pipeline #20828 passed with stage
in 12 minutes and 19 seconds
......@@ -78,6 +78,17 @@ QString ImportMailJobInterfaceTestImpl::adaptNewResourceUrl(bool overwriteResour
return resourceConverterTest.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
}
void ImportMailJobInterfaceTestImpl::addNewIdentity(const QString &name, KConfigGroup &group, int defaultIdentities, int oldUid)
{
qDebug() << " void ImportMailJobInterfaceTestImpl::addNewIdentity(const QString &name, KConfigGroup &group, int defaultIdentities, int oldUid) not implemented yet";
}
void ImportMailJobInterfaceTestImpl::importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId)
{
qDebug() << "importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId) not implemented yet";
}
ImportMailJobInterfaceTest::ImportMailJobInterfaceTest(QObject *parent)
: QObject(parent)
{
......@@ -119,7 +130,3 @@ void ImportMailJobInterfaceTest::importMail()
}
void ImportMailJobInterfaceTestImpl::addNewIdentity(const QString &name, KConfigGroup &group, int defaultIdentities, int oldUid)
{
qDebug() << " void ImportMailJobInterfaceTestImpl::addNewIdentity(const QString &name, KConfigGroup &group, int defaultIdentities, int oldUid) not implemented yet";
}
......@@ -43,6 +43,7 @@ protected:
Q_REQUIRED_RESULT QString adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData) 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 importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId) override;
};
class ImportMailJobInterfaceTest : public QObject
......
......@@ -167,22 +167,7 @@ void ImportMailJobInterface::importMailTransport(const QString &tempDirName)
const QString identifierStr(QStringLiteral("identifier"));
if (group.hasKey(identifierStr)) {
const QString identifierValue = group.readEntry(identifierStr);
if (!identifierValue.isEmpty()) {
if (identifierValue == QLatin1String("sendmail") || identifierValue == QLatin1String("akonadi_ewsmta_resource")) {
MailTransport::Transport *mt = MailTransport::TransportManager::self()->createTransport();
mt->setName(group.readEntry(QStringLiteral("name")));
const QString hostStr(QStringLiteral("host"));
if (group.hasKey(hostStr)) {
mt->setHost(group.readEntry(hostStr));
}
mt->setIdentifier(identifierValue);
addMailTransport(mt, defaultTransport, transportId);
} else {
qCWarning(PIMDATAEXPORTERCORE_LOG) << "Unknown identifier type " << identifierValue;
}
} else {
qCWarning(PIMDATAEXPORTERCORE_LOG) << "identifier value is empty";
}
importCustomMailTransport(identifierValue, group, defaultTransport, transportId);
} else {
MailTransport::Transport *mt = MailTransport::TransportManager::self()->createTransport();
mt->setName(group.readEntry(QStringLiteral("name")));
......
......@@ -59,6 +59,8 @@ protected:
virtual void importFilters(const QVector<MailCommon::MailFilter *> &filters) = 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 importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId) = 0;
void addMailTransport(MailTransport::Transport *mt, int defaultTransport, int transportId);
QHash<int, uint> mHashIdentity;
......@@ -84,7 +86,6 @@ private:
void mergeMailArchiveConfig(const KArchiveFile *archivefile, const QString &filename, const QString &prefix);
void mergeSieveTemplate(const KArchiveFile *archivefile, const QString &filename, const QString &prefix);
void importSimpleFilesInDirectory(const QString &relativePath);
void addMailTransport(MailTransport::Transport *mt, int defaultTransport, int transportId);
QHash<int, int> mHashTransport;
QHash<QString, QString> mHashResources;
......
......@@ -25,6 +25,7 @@
#include <MailCommon/FilterManager>
#include <KIdentityManagement/Identity>
#include <KIdentityManagement/IdentityManager>
#include <MailTransport/TransportManager>
using namespace Akonadi;
ImportMailJobInterfaceImpl::ImportMailJobInterfaceImpl(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep)
......@@ -110,3 +111,23 @@ QString ImportMailJobInterfaceImpl::uniqueIdentityName(const QString &name)
return newName;
}
void ImportMailJobInterfaceImpl::importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId)
{
if (!identifierValue.isEmpty()) {
if (identifierValue == QLatin1String("sendmail") || identifierValue == QLatin1String("akonadi_ewsmta_resource")) {
MailTransport::Transport *mt = MailTransport::TransportManager::self()->createTransport();
mt->setName(group.readEntry(QStringLiteral("name")));
const QString hostStr(QStringLiteral("host"));
if (group.hasKey(hostStr)) {
mt->setHost(group.readEntry(hostStr));
}
mt->setIdentifier(identifierValue);
addMailTransport(mt, defaultTransport, transportId);
} else {
qCWarning(PIMDATAEXPORTERCORE_LOG) << "Unknown identifier type " << identifierValue;
}
} else {
qCWarning(PIMDATAEXPORTERCORE_LOG) << "identifier value is empty";
}
}
......@@ -48,6 +48,7 @@ protected:
Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) 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 importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId) override;
private:
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