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

improve import filter

parent d7476e50
Pipeline #22273 canceled with stage
......@@ -7,3 +7,4 @@ configs/kabldaprc
configs/kmail2rc
configs/templatesconfigurationrc
transports/mailtransports
configs/filters
......@@ -66,7 +66,7 @@ void ImportMailJobInterfaceTestImpl::registerSpecialCollection(Akonadi::SpecialM
mLogCreateResource->logRegisterSpecialCollection(type, colId);
}
void ImportMailJobInterfaceTestImpl::importFilters(const QVector<MailCommon::MailFilter *> &filters)
void ImportMailJobInterfaceTestImpl::importFilters(const QString &filename)
{
qDebug() << " void ImportMailJobInterfaceTestImpl::importFilters(const QVector<MailCommon::MailFilter *> &filters)";
}
......
......@@ -38,7 +38,7 @@ protected:
Q_REQUIRED_RESULT QString createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree = false) override;
void registerSpecialCollection(Akonadi::SpecialMailCollections::Type type, qint64 colId) override;
void importFilters(const QVector<MailCommon::MailFilter *> &filters) override;
void importFilters(const QString &filename) override;
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;
......
......@@ -24,7 +24,6 @@
#include "pimdataexportcore_debug.h"
#include "smtpmailtransport.h"
#include <MailCommon/FilterImporterExporter>
#include <MailCommon/MailUtil>
#include <MailTransport/TransportManager>
......@@ -606,13 +605,7 @@ void ImportMailJobInterface::restoreConfig()
}
}
filtersConfig->sync();
bool canceled = false;
MailCommon::FilterImporterExporter exportFilters;
QVector<MailCommon::MailFilter *> lstFilter = exportFilters.importFilters(canceled, MailCommon::FilterImporterExporter::KMailFilter, filterFileName);
if (canceled) {
importFilters(lstFilter);
}
importFilters(filterFileName);
}
}
const QString kmailsnippetrcStr(QStringLiteral("kmailsnippetrc"));
......
......@@ -58,7 +58,7 @@ protected:
virtual Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) = 0;
virtual void registerSpecialCollection(Akonadi::SpecialMailCollections::Type type, qint64 colId) = 0;
virtual void synchronizeResource(const QStringList &lst) = 0;
virtual void importFilters(const QVector<MailCommon::MailFilter *> &filters) = 0;
virtual void importFilters(const QString &filename) = 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;
......
......@@ -26,6 +26,7 @@
#include <KIdentityManagement/Identity>
#include <KIdentityManagement/IdentityManager>
#include <MailTransport/TransportManager>
#include <MailCommon/FilterImporterExporter>
#include "smtpmailtransport.h"
using namespace Akonadi;
......@@ -68,9 +69,14 @@ void ImportMailJobInterfaceImpl::synchronizeResource(const QStringList &lst)
startSynchronizeResources(lst);
}
void ImportMailJobInterfaceImpl::importFilters(const QVector<MailCommon::MailFilter *> &filters)
void ImportMailJobInterfaceImpl::importFilters(const QString &filename)
{
MailCommon::FilterManager::instance()->appendFilters(filters);
bool canceled = false;
MailCommon::FilterImporterExporter exportFilters;
QVector<MailCommon::MailFilter *> lstFilter = exportFilters.importFilters(canceled, MailCommon::FilterImporterExporter::KMailFilter, filename);
if (canceled) {
MailCommon::FilterManager::instance()->appendFilters(lstFilter);
}
}
Collection::Id ImportMailJobInterfaceImpl::convertFolderPathToCollectionId(const QString &path)
......
......@@ -46,7 +46,7 @@ protected:
Q_REQUIRED_RESULT QString createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree = false) override;
Q_REQUIRED_RESULT QString adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData) override;
void synchronizeResource(const QStringList &lst) override;
void importFilters(const QVector<MailCommon::MailFilter *> &filters) override;
void importFilters(const QString &filename) override;
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;
......
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