Commit 3225df54 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

continue to implement autotesting

parent d4837b27
......@@ -29,7 +29,13 @@
#include <QFile>
#include <QDir>
#include <QStandardPaths>
#include <resourceconverterimpl.h>
namespace {
inline const QString storeAddressbook()
{
return QStringLiteral("backupaddressbook/");
}
}
ImportAddressbookJobInterface::ImportAddressbookJobInterface(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep)
: AbstractImportExportJob(parent, archiveStorage, typeSelected, numberOfStep)
{
......@@ -156,3 +162,79 @@ void ImportAddressbookJobInterface::importkaddressBookConfig(const KArchiveFile
importDataSubdirectory(QStringLiteral("/kaddressbook/printing/"));
kaddressBookConfig->sync();
}
void ImportAddressbookJobInterface::restoreResources()
{
Q_EMIT info(i18n("Restore resources..."));
setProgressDialogLabel(i18n("Restore resources..."));
increaseProgressDialog();
QStringList listResource;
listResource
<< restoreResourceFile(QStringLiteral("akonadi_vcard_resource"), Utils::addressbookPath(), QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral(
"/share/kaddressbook/"));
if (!mListResourceFile.isEmpty()) {
QDir dir(mTempDirName);
dir.mkdir(Utils::addressbookPath());
const QString copyToDirName(mTempDirName + QLatin1Char('/') + Utils::addressbookPath());
const int numberOfResourceFile = mListResourceFile.size();
for (int i = 0; i < numberOfResourceFile; ++i) {
ResourceFiles value = mListResourceFile.at(i);
QMap<QString, QVariant> settings;
if (value.akonadiConfigFile.contains(QLatin1String("akonadi_vcarddir_resource_"))
|| value.akonadiConfigFile.contains(QLatin1String("akonadi_contacts_resource_"))) {
const KArchiveEntry *fileResouceEntry = mArchiveDirectory->entry(value.akonadiConfigFile);
if (fileResouceEntry && fileResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(fileResouceEntry);
copyArchiveFileTo(file, copyToDirName);
QString resourceName(file->name());
QString filename(resourceName);
KSharedConfig::Ptr resourceConfig = KSharedConfig::openConfig(copyToDirName + QLatin1Char('/') + resourceName);
//TODO fix default path
ResourceConverterImpl converter;
const QString newUrl = converter.adaptResourcePath(resourceConfig, QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/contacts"));
QFileInfo newUrlInfo(newUrl);
const QString dataFile = value.akonadiResources;
const KArchiveEntry *dataResouceEntry = mArchiveDirectory->entry(dataFile);
if (dataResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(dataResouceEntry);
//TODO adapt directory name too
extractZipFile(file, copyToDirName, newUrlInfo.path(), value.akonadiConfigFile.contains(QLatin1String("akonadi_contacts_resource_")));
}
settings.insert(QStringLiteral("Path"), newUrl);
const QString agentConfigFile = value.akonadiAgentConfigFile;
if (!agentConfigFile.isEmpty()) {
const KArchiveEntry *akonadiAgentConfigEntry = mArchiveDirectory->entry(agentConfigFile);
if (akonadiAgentConfigEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(akonadiAgentConfigEntry);
copyArchiveFileTo(file, copyToDirName);
resourceName = file->name();
filename = Utils::akonadiAgentName(copyToDirName + QLatin1Char('/') + resourceName);
}
}
QString instanceType;
if (value.akonadiConfigFile.contains(QLatin1String("akonadi_vcarddir_resource_"))) {
instanceType = QStringLiteral("akonadi_vcarddir_resource");
} else if (value.akonadiConfigFile.contains(QLatin1String("akonadi_contacts_resource_"))) {
instanceType = QStringLiteral("akonadi_contacts_resource");
} else {
qCWarning(PIMDATAEXPORTERCORE_LOG) << " not supported" << value.akonadiConfigFile;
}
const QString newResource = createResource(instanceType, filename, settings, true);
infoAboutNewResource(newResource);
qCDebug(PIMDATAEXPORTERCORE_LOG) << " newResource" << newResource;
listResource << newResource;
}
}
}
}
Q_EMIT info(i18n("Resources restored."));
//It's maildir support. Need to add support
synchronizeResource(listResource);
}
......@@ -36,8 +36,10 @@ public:
protected:
void slotNextStep() override;
virtual void restoreResources() = 0;
virtual void synchronizeResource(const QStringList &lst) = 0;
virtual Q_REQUIRED_RESULT QString createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree) = 0;
void restoreResources();
private:
Q_REQUIRED_RESULT bool isAConfigFile(const QString &name) const override;
void importkaddressBookConfig(const KArchiveFile *file, const QString &config, const QString &filename, const QString &prefix);
......
......@@ -33,12 +33,7 @@
#include <QStandardPaths>
#include "resourceconverterimpl.h"
namespace {
inline const QString storeAddressbook()
{
return QStringLiteral("backupaddressbook/");
}
}
ImportAddressbookJobInterfaceImpl::ImportAddressbookJobInterfaceImpl(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep)
: ImportAddressbookJobInterface(parent, typeSelected, archiveStorage, numberOfStep)
......@@ -49,84 +44,19 @@ ImportAddressbookJobInterfaceImpl::~ImportAddressbookJobInterfaceImpl()
{
}
void ImportAddressbookJobInterfaceImpl::restoreResources()
Akonadi::Collection::Id ImportAddressbookJobInterfaceImpl::convertFolderPathToCollectionId(const QString &path)
{
Q_EMIT info(i18n("Restore resources..."));
setProgressDialogLabel(i18n("Restore resources..."));
increaseProgressDialog();
QStringList listResource;
listResource
<< restoreResourceFile(QStringLiteral("akonadi_vcard_resource"), Utils::addressbookPath(), QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral(
"/share/kaddressbook/"));
if (!mListResourceFile.isEmpty()) {
QDir dir(mTempDirName);
dir.mkdir(Utils::addressbookPath());
const QString copyToDirName(mTempDirName + QLatin1Char('/') + Utils::addressbookPath());
const int numberOfResourceFile = mListResourceFile.size();
for (int i = 0; i < numberOfResourceFile; ++i) {
ResourceFiles value = mListResourceFile.at(i);
QMap<QString, QVariant> settings;
if (value.akonadiConfigFile.contains(QLatin1String("akonadi_vcarddir_resource_"))
|| value.akonadiConfigFile.contains(QLatin1String("akonadi_contacts_resource_"))) {
const KArchiveEntry *fileResouceEntry = mArchiveDirectory->entry(value.akonadiConfigFile);
if (fileResouceEntry && fileResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(fileResouceEntry);
copyArchiveFileTo(file, copyToDirName);
QString resourceName(file->name());
QString filename(resourceName);
KSharedConfig::Ptr resourceConfig = KSharedConfig::openConfig(copyToDirName + QLatin1Char('/') + resourceName);
//TODO fix default path
ResourceConverterImpl converter;
const QString newUrl = converter.adaptResourcePath(resourceConfig, QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/contacts"));
QFileInfo newUrlInfo(newUrl);
const QString dataFile = value.akonadiResources;
const KArchiveEntry *dataResouceEntry = mArchiveDirectory->entry(dataFile);
if (dataResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(dataResouceEntry);
//TODO adapt directory name too
extractZipFile(file, copyToDirName, newUrlInfo.path(), value.akonadiConfigFile.contains(QLatin1String("akonadi_contacts_resource_")));
}
settings.insert(QStringLiteral("Path"), newUrl);
const QString agentConfigFile = value.akonadiAgentConfigFile;
if (!agentConfigFile.isEmpty()) {
const KArchiveEntry *akonadiAgentConfigEntry = mArchiveDirectory->entry(agentConfigFile);
if (akonadiAgentConfigEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(akonadiAgentConfigEntry);
copyArchiveFileTo(file, copyToDirName);
resourceName = file->name();
filename = Utils::akonadiAgentName(copyToDirName + QLatin1Char('/') + resourceName);
}
}
QString instanceType;
if (value.akonadiConfigFile.contains(QLatin1String("akonadi_vcarddir_resource_"))) {
instanceType = QStringLiteral("akonadi_vcarddir_resource");
} else if (value.akonadiConfigFile.contains(QLatin1String("akonadi_contacts_resource_"))) {
instanceType = QStringLiteral("akonadi_contacts_resource");
} else {
qCWarning(PIMDATAEXPORTERCORE_LOG) << " not supported" << value.akonadiConfigFile;
}
const QString newResource = mCreateResource->createResource(instanceType, filename, settings, true);
infoAboutNewResource(newResource);
qCDebug(PIMDATAEXPORTERCORE_LOG) << " newResource" << newResource;
listResource << newResource;
}
}
}
}
ResourceConverterImpl converter;
return converter.convertFolderPathToCollectionId(path);
}
Q_EMIT info(i18n("Resources restored."));
void ImportAddressbookJobInterfaceImpl::synchronizeResource(const QStringList &lst)
{
//It's maildir support. Need to add support
startSynchronizeResources(listResource);
startSynchronizeResources(lst);
}
Akonadi::Collection::Id ImportAddressbookJobInterfaceImpl::convertFolderPathToCollectionId(const QString &path)
QString ImportAddressbookJobInterfaceImpl::createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree)
{
ResourceConverterImpl converter;
return converter.convertFolderPathToCollectionId(path);
return mCreateResource->createResource(resources, name, settings, synchronizeTree);
}
......@@ -33,8 +33,9 @@ public:
~ImportAddressbookJobInterfaceImpl() override;
protected:
void restoreResources() override;
Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override;
void synchronizeResource(const QStringList &lst) override;
Q_REQUIRED_RESULT QString createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree) override;
};
#endif // IMPORTADDRESSBOOKJOBINTERFACEIMPL_H
......@@ -32,6 +32,14 @@
#include <QFile>
#include <QStandardPaths>
#include <QTimer>
#include <resourceconverterimpl.h>
namespace {
inline const QString storeAlarm()
{
return QStringLiteral("backupalarm/");
}
}
ImportAlarmJobInterface::ImportAlarmJobInterface(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep)
: AbstractImportExportJob(parent, archiveStorage, typeSelected, numberOfStep)
......@@ -108,3 +116,69 @@ void ImportAlarmJobInterface::importkalarmConfig(const KArchiveFile *kalarmFile,
kalarmConfig->sync();
}
void ImportAlarmJobInterface::restoreResources()
{
Q_EMIT info(i18n("Restore resources..."));
setProgressDialogLabel(i18n("Restore resources..."));
increaseProgressDialog();
QStringList listResource;
listResource << restoreResourceFile(QStringLiteral("akonadi_kalarm_resource"), Utils::alarmPath(), storeAlarm(), false);
if (!mListResourceFile.isEmpty()) {
QDir dir(mTempDirName);
dir.mkdir(Utils::alarmPath());
const QString copyToDirName(mTempDirName + QLatin1Char('/') + Utils::alarmPath());
const int numberOfResourceFile = mListResourceFile.size();
for (int i = 0; i < numberOfResourceFile; ++i) {
ResourceFiles value = mListResourceFile.at(i);
QMap<QString, QVariant> settings;
if (value.akonadiConfigFile.contains(QLatin1String("akonadi_kalarm_dir_resource_"))
|| value.akonadiConfigFile.contains(QLatin1String("akonadi_kalarm_resource_"))) {
const KArchiveEntry *fileResouceEntry = mArchiveDirectory->entry(value.akonadiConfigFile);
if (fileResouceEntry && fileResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(fileResouceEntry);
copyArchiveFileTo(file, copyToDirName);
QString resourceName(file->name());
QString filename(resourceName);
//TODO adapt filename otherwise it will use all the time the same filename.
qCDebug(PIMDATAEXPORTERCORE_LOG) << " filename :" << filename;
KSharedConfig::Ptr resourceConfig = KSharedConfig::openConfig(copyToDirName + QLatin1Char('/') + resourceName);
ResourceConverterImpl converter;
const QString newUrl = converter.adaptResourcePath(resourceConfig, storeAlarm());
QFileInfo newUrlInfo(newUrl);
const QString dataFile = value.akonadiResources;
const KArchiveEntry *dataResouceEntry = mArchiveDirectory->entry(dataFile);
bool isDirResource = value.akonadiConfigFile.contains(QLatin1String("akonadi_kalarm_dir_resource_"));
if (dataResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(dataResouceEntry);
//TODO adapt directory name too
extractZipFile(file, copyToDirName, newUrlInfo.path(), isDirResource);
}
settings.insert(QStringLiteral("Path"), newUrl);
const QString agentConfigFile = value.akonadiAgentConfigFile;
if (!agentConfigFile.isEmpty()) {
const KArchiveEntry *akonadiAgentConfigEntry = mArchiveDirectory->entry(agentConfigFile);
if (akonadiAgentConfigEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(akonadiAgentConfigEntry);
copyArchiveFileTo(file, copyToDirName);
resourceName = file->name();
filename = Utils::akonadiAgentName(copyToDirName + QLatin1Char('/') + resourceName);
}
}
const QString archiveNameType = isDirResource ? QStringLiteral("akonadi_kalarm_dir_resource") : QStringLiteral("akonadi_kalarm_resource");
const QString newResource = createResource(archiveNameType, filename, settings, true);
infoAboutNewResource(newResource);
listResource << newResource;
qCDebug(PIMDATAEXPORTERCORE_LOG) << " newResource" << newResource;
}
}
}
}
//It's maildir support. Need to add support
synchronizeResource(listResource);
}
......@@ -35,8 +35,11 @@ public:
protected:
void slotNextStep() override;
virtual void restoreResources() = 0;
virtual void synchronizeResource(const QStringList &lst) = 0;
virtual Q_REQUIRED_RESULT QString createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree) = 0;
void restoreResources();
private:
Q_REQUIRED_RESULT bool isAConfigFile(const QString &name) const override;
void importkalarmConfig(const KArchiveFile *kalarmFile, const QString &kalarmrc, const QString &filename, const QString &prefix);
......
......@@ -35,12 +35,7 @@
#include <QTimer>
#include "resourceconverterimpl.h"
namespace {
inline const QString storeAlarm()
{
return QStringLiteral("backupalarm/");
}
}
ImportAlarmJobInterfaceImpl::ImportAlarmJobInterfaceImpl(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep)
: ImportAlarmJobInterface(parent, typeSelected, archiveStorage, numberOfStep)
......@@ -51,74 +46,20 @@ ImportAlarmJobInterfaceImpl::~ImportAlarmJobInterfaceImpl()
{
}
void ImportAlarmJobInterfaceImpl::restoreResources()
{
Q_EMIT info(i18n("Restore resources..."));
setProgressDialogLabel(i18n("Restore resources..."));
increaseProgressDialog();
QStringList listResource;
listResource << restoreResourceFile(QStringLiteral("akonadi_kalarm_resource"), Utils::alarmPath(), storeAlarm(), false);
if (!mListResourceFile.isEmpty()) {
QDir dir(mTempDirName);
dir.mkdir(Utils::alarmPath());
const QString copyToDirName(mTempDirName + QLatin1Char('/') + Utils::alarmPath());
const int numberOfResourceFile = mListResourceFile.size();
for (int i = 0; i < numberOfResourceFile; ++i) {
ResourceFiles value = mListResourceFile.at(i);
QMap<QString, QVariant> settings;
if (value.akonadiConfigFile.contains(QLatin1String("akonadi_kalarm_dir_resource_"))
|| value.akonadiConfigFile.contains(QLatin1String("akonadi_kalarm_resource_"))) {
const KArchiveEntry *fileResouceEntry = mArchiveDirectory->entry(value.akonadiConfigFile);
if (fileResouceEntry && fileResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(fileResouceEntry);
copyArchiveFileTo(file, copyToDirName);
QString resourceName(file->name());
QString filename(resourceName);
//TODO adapt filename otherwise it will use all the time the same filename.
qCDebug(PIMDATAEXPORTERCORE_LOG) << " filename :" << filename;
KSharedConfig::Ptr resourceConfig = KSharedConfig::openConfig(copyToDirName + QLatin1Char('/') + resourceName);
ResourceConverterImpl converter;
const QString newUrl = converter.adaptResourcePath(resourceConfig, storeAlarm());
QFileInfo newUrlInfo(newUrl);
const QString dataFile = value.akonadiResources;
const KArchiveEntry *dataResouceEntry = mArchiveDirectory->entry(dataFile);
bool isDirResource = value.akonadiConfigFile.contains(QLatin1String("akonadi_kalarm_dir_resource_"));
if (dataResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(dataResouceEntry);
//TODO adapt directory name too
extractZipFile(file, copyToDirName, newUrlInfo.path(), isDirResource);
}
settings.insert(QStringLiteral("Path"), newUrl);
const QString agentConfigFile = value.akonadiAgentConfigFile;
if (!agentConfigFile.isEmpty()) {
const KArchiveEntry *akonadiAgentConfigEntry = mArchiveDirectory->entry(agentConfigFile);
if (akonadiAgentConfigEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(akonadiAgentConfigEntry);
copyArchiveFileTo(file, copyToDirName);
resourceName = file->name();
filename = Utils::akonadiAgentName(copyToDirName + QLatin1Char('/') + resourceName);
}
}
const QString archiveNameType = isDirResource ? QStringLiteral("akonadi_kalarm_dir_resource") : QStringLiteral("akonadi_kalarm_resource");
const QString newResource = mCreateResource->createResource(archiveNameType, filename, settings, true);
infoAboutNewResource(newResource);
listResource << newResource;
qCDebug(PIMDATAEXPORTERCORE_LOG) << " newResource" << newResource;
}
}
}
}
//It's maildir support. Need to add support
startSynchronizeResources(listResource);
}
Akonadi::Collection::Id ImportAlarmJobInterfaceImpl::convertFolderPathToCollectionId(const QString &path)
{
ResourceConverterImpl converter;
return converter.convertFolderPathToCollectionId(path);
}
QString ImportAlarmJobInterfaceImpl::createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree)
{
return mCreateResource->createResource(resources, name, settings, synchronizeTree);
}
void ImportAlarmJobInterfaceImpl::synchronizeResource(const QStringList &lst)
{
startSynchronizeResources(lst);
}
......@@ -31,8 +31,10 @@ public:
explicit ImportAlarmJobInterfaceImpl(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep);
~ImportAlarmJobInterfaceImpl() override;
protected:
void restoreResources() override;
void restoreResources();
Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override;
void synchronizeResource(const QStringList &lst) override;
Q_REQUIRED_RESULT QString createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree) override;
};
#endif // IMPORTALARMJOBINTERFACEIMPL_H
......@@ -36,6 +36,13 @@
#include <QTimer>
#include <QColor>
namespace {
inline const QString storeCalendar()
{
return QStringLiteral("backupcalendar/");
}
}
ImportCalendarJobInterface::ImportCalendarJobInterface(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep)
: AbstractImportExportJob(parent, archiveStorage, typeSelected, numberOfStep)
{
......@@ -245,3 +252,71 @@ void ImportCalendarJobInterface::importeventViewConfig(const KArchiveFile *file,
eventviewConfig->sync();
}
void ImportCalendarJobInterface::restoreResources()
{
Q_EMIT info(i18n("Restore resources..."));
setProgressDialogLabel(i18n("Restore resources..."));
increaseProgressDialog();
QStringList listResource;
listResource << restoreResourceFile(QStringLiteral("akonadi_ical_resource"), Utils::calendarPath(), storeCalendar());
if (!mListResourceFile.isEmpty()) {
QDir dir(mTempDirName);
dir.mkdir(Utils::addressbookPath());
const QString copyToDirName(mTempDirName + QLatin1Char('/') + Utils::calendarPath());
const int numberOfResourceFile = mListResourceFile.size();
for (int i = 0; i < numberOfResourceFile; ++i) {
ResourceFiles value = mListResourceFile.at(i);
QMap<QString, QVariant> settings;
if (value.akonadiConfigFile.contains(QLatin1String("akonadi_icaldir_resource_"))
|| value.akonadiConfigFile.contains(QLatin1String("akonadi_ical_resource_"))) {
const KArchiveEntry *fileResouceEntry = mArchiveDirectory->entry(value.akonadiConfigFile);
if (fileResouceEntry && fileResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(fileResouceEntry);
copyArchiveFileTo(file, copyToDirName);
QString resourceName(file->name());
QString filename(resourceName);
//TODO adapt filename otherwise it will use all the time the same filename.
qCDebug(PIMDATAEXPORTERCORE_LOG) << " filename :" << filename;
KSharedConfig::Ptr resourceConfig = KSharedConfig::openConfig(copyToDirName + QLatin1Char('/') + resourceName);
ResourceConverterImpl converter;
const QString newUrl = converter.adaptResourcePath(resourceConfig, storeCalendar());
QFileInfo newUrlInfo(newUrl);
const QString dataFile = value.akonadiResources;
const KArchiveEntry *dataResouceEntry = mArchiveDirectory->entry(dataFile);
bool isDirResource = value.akonadiConfigFile.contains(QLatin1String("akonadi_icaldir_resource_"));
if (dataResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(dataResouceEntry);
//TODO adapt directory name too
extractZipFile(file, copyToDirName, newUrlInfo.path(), value.akonadiConfigFile.contains(QLatin1String("akonadi_icaldir_resource_")));
}
settings.insert(QStringLiteral("Path"), newUrl);
const QString agentConfigFile = value.akonadiAgentConfigFile;
if (!agentConfigFile.isEmpty()) {
const KArchiveEntry *akonadiAgentConfigEntry = mArchiveDirectory->entry(agentConfigFile);
if (akonadiAgentConfigEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(akonadiAgentConfigEntry);
copyArchiveFileTo(file, copyToDirName);
resourceName = file->name();
filename = Utils::akonadiAgentName(copyToDirName + QLatin1Char('/') + resourceName);
}
}
const QString resourceTypeName = isDirResource ? QStringLiteral("akonadi_icaldir_resource") : QStringLiteral("akonadi_ical_resource");
const QString newResource = createResource(resourceTypeName, filename, settings, true);
infoAboutNewResource(newResource);
listResource << newResource;
qCDebug(PIMDATAEXPORTERCORE_LOG) << " newResource" << newResource;
}
}
}
}
//It's maildir support. Need to add support
synchronizeResource(listResource);
}
......@@ -36,14 +36,17 @@ public:
protected:
void slotNextStep() override;
virtual Q_REQUIRED_RESULT QString createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree) = 0;
virtual void synchronizeResource(const QStringList &lst) = 0;
private:
Q_REQUIRED_RESULT bool isAConfigFile(const QString &name) const override;
void importkorganizerConfig(const KArchiveFile *file, const QString &config, const QString &filename, const QString &prefix);
void importeventViewConfig(const KArchiveFile *file, const QString &config, const QString &filename, const QString &prefix);
virtual void restoreResources() = 0;
void restoreResources();
void restoreConfig();
void addSpecificResourceSettings(const KSharedConfig::Ptr &resourceConfig, const QString &resourceName, QMap<QString, QVariant> &settings) override;
};
#endif // IMPORTCALENDARJOBINTERFACE_H
......@@ -39,12 +39,6 @@
#include <QColor>
#include "resourceconverterimpl.h"
namespace {
inline const QString storeCalendar()
{
return QStringLiteral("backupcalendar/");
}
}
ImportCalendarJobInterfaceImpl::ImportCalendarJobInterfaceImpl(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep)
: ImportCalendarJobInterface(parent, typeSelected, archiveStorage, numberOfStep)
......@@ -61,70 +55,13 @@ Akonadi::Collection::Id ImportCalendarJobInterfaceImpl::convertFolderPathToColle
return converter.convertFolderPathToCollectionId(path);
}
void ImportCalendarJobInterfaceImpl::restoreResources()
{
Q_EMIT info(i18n("Restore resources..."));