Commit 58c741e8 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Export filters

parent 7b840f6e
......@@ -5,7 +5,7 @@ set( exportmailjobinterfacetest_SRCS exportmailjobinterfacetest.cpp exportmailjo
add_executable( exportmailjobinterfacetest ${exportmailjobinterfacetest_SRCS})
add_test(NAME exportmailjobinterfacetest COMMAND exportmailjobinterfacetest)
ecm_mark_as_test(exportmailjobinterfacetest)
target_link_libraries(exportmailjobinterfacetest Qt5::Test pimdataexporterprivate KF5::ConfigCore test_resourceconverter KF5::MailCommon)
target_link_libraries(exportmailjobinterfacetest Qt5::Test pimdataexporterprivate KF5::ConfigCore test_resourceconverter)
#####
......
......@@ -22,7 +22,6 @@
#include "resourceconvertertest.h"
#include "saveresourceconfigtest.h"
#include "testbackupresourcefilejob.h"
#include <MailCommon/FilterImporterExporter>
#include <QDebug>
ExportMailJobInterfaceTestImpl::ExportMailJobInterfaceTestImpl(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep)
......@@ -64,13 +63,7 @@ Akonadi::Collection::Id ExportMailJobInterfaceTestImpl::convertFolderPathToColle
QVector<MailCommon::MailFilter *> ExportMailJobInterfaceTestImpl::filters()
{
MailCommon::FilterImporterExporter exportFilters;
const QString filename = mPathConfig + QLatin1String("filters");
KSharedConfig::Ptr config = KSharedConfig::openConfig(filename);
qDebug() << " filename " << filename;
QStringList lst;
const QVector<MailCommon::MailFilter *> filters = exportFilters.readFiltersFromConfig(config, lst);
return filters;
return {};
}
void ExportMailJobInterfaceTestImpl::exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier)
......@@ -137,3 +130,14 @@ QVector<uint> ExportMailJobInterfaceTestImpl::listIdentityUoid() const
{
return {10, 11, 12, 13, 14};
}
void ExportMailJobInterfaceTestImpl::exportFilters()
{
const QString filename = mPathConfig + QLatin1String("filters");
const bool fileAdded = archive()->addLocalFile(filename, Utils::configsPath() + QStringLiteral("filters"));
if (fileAdded) {
Q_EMIT info(QStringLiteral("Filters backup done."));
} else {
Q_EMIT error(QStringLiteral("Filters cannot be exported."));
}
}
......@@ -50,6 +50,8 @@ protected:
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
Q_REQUIRED_RESULT QString createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree) override;
Q_REQUIRED_RESULT QVector<uint> listIdentityUoid() const override;
void exportFilters() override;
};
#endif // EXPORTMAILJOBINTERFACETESTIMPL_H
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