Commit 21d82630 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Allow to define config path

parent 53421f5f
......@@ -52,10 +52,15 @@ void ExportAlarmJobInterfaceTestImpl::setListOfResource(const QVector<Utils::Ako
mListAkonadiInstanceInfo = instanceInfoList;
}
void ExportAlarmJobInterfaceTestImpl::setPathConfig(const QString &pathConfig)
{
mPathConfig = pathConfig;
}
Akonadi::Collection::Id ExportAlarmJobInterfaceTestImpl::convertFolderPathToCollectionId(const QString &path)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR));
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.convertFolderPathToCollectionId(path);
}
......@@ -68,7 +73,7 @@ void ExportAlarmJobInterfaceTestImpl::exportResourceToArchive(const QString &arc
QString ExportAlarmJobInterfaceTestImpl::resourcePath(const QString &identifier) const
{
ResourceConverterTest converter;
converter.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR));
converter.setTestPath(mPathConfig);
const QString url = converter.resourcePath(identifier);
return url;
}
......@@ -90,8 +95,9 @@ void ExportAlarmJobInterfaceTest::exportAlarmConfig()
QFETCH(QByteArray, configpath);
TestExportFile *file = new TestExportFile(this);
file->setPathConfig(configpath);
ExportAlarmJobInterfaceTestImpl *exportNote = new ExportAlarmJobInterfaceTestImpl(this, {Utils::StoredType::Config}, file->archiveStorage(), 1);
file->setAbstractImportExportJob(exportNote);
ExportAlarmJobInterfaceTestImpl *impl = new ExportAlarmJobInterfaceTestImpl(this, {Utils::StoredType::Config}, file->archiveStorage(), 1);
file->setAbstractImportExportJob(impl);
impl->setPathConfig(QLatin1String(configpath));
file->start();
delete exportNote;
delete impl;
}
......@@ -31,6 +31,7 @@ public:
explicit ExportAlarmJobInterfaceTestImpl(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep);
~ExportAlarmJobInterfaceTestImpl();
void setListOfResource(const QVector<Utils::AkonadiInstanceInfo> &instanceInfoList);
void setPathConfig(const QString &pathConfig);
protected:
void exportArchiveResource() override;
Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override;
......@@ -39,6 +40,7 @@ protected:
Q_REQUIRED_RESULT QString resourcePath(const QString &identifier) const override;
private:
QVector<Utils::AkonadiInstanceInfo> mListAkonadiInstanceInfo;
QString mPathConfig;
};
class ExportAlarmJobInterfaceTest : public QObject
......
......@@ -43,14 +43,14 @@ void ExportCalendarsJobInterfaceTestImpl::exportArchiveResource()
Akonadi::Collection::Id ExportCalendarsJobInterfaceTestImpl::convertFolderPathToCollectionId(const QString &path)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR));
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.convertFolderPathToCollectionId(path);
}
QString ExportCalendarsJobInterfaceTestImpl::convertToFullCollectionPath(const qlonglong collectionValue)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR));
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.convertToFullCollectionPath(collectionValue);
}
......@@ -71,13 +71,27 @@ void ExportCalendarsJobInterfaceTestImpl::setListOfResource(const QVector<Utils:
mListAkonadiInstanceInfo = instanceInfoList;
}
void ExportCalendarsJobInterfaceTestImpl::setPathConfig(const QString &pathConfig)
{
mPathConfig = pathConfig;
}
void ExportCalendarsJobInterfaceTestImpl::convertCollectionListToRealPath(KConfigGroup &group, const QString &currentKey)
{
ResourceConverterTest converter;
converter.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR));
converter.setTestPath(mPathConfig);
converter.convertCollectionListToRealPath(group, currentKey);
}
QString ExportCalendarsJobInterfaceTestImpl::resourcePath(const QString &identifier) const
{
ResourceConverterTest converter;
converter.setTestPath(mPathConfig);
const QString url = converter.resourcePath(identifier);
return url;
}
ExportCalendarsJobInterfaceTest::ExportCalendarsJobInterfaceTest(QObject *parent)
: QObject(parent)
{
......@@ -95,16 +109,10 @@ void ExportCalendarsJobInterfaceTest::exportCalendarConfig()
QFETCH(QByteArray, configpath);
TestExportFile *file = new TestExportFile(this);
file->setPathConfig(configpath);
ExportCalendarsJobInterfaceTestImpl *exportNote = new ExportCalendarsJobInterfaceTestImpl(this, {Utils::StoredType::Config}, file->archiveStorage(), 1);
file->setAbstractImportExportJob(exportNote);
ExportCalendarsJobInterfaceTestImpl *impl = new ExportCalendarsJobInterfaceTestImpl(this, {Utils::StoredType::Config}, file->archiveStorage(), 1);
impl->setPathConfig(QLatin1String(configpath));
file->setAbstractImportExportJob(impl);
file->start();
delete exportNote;
delete impl;
}
QString ExportCalendarsJobInterfaceTestImpl::resourcePath(const QString &identifier) const
{
ResourceConverterTest converter;
converter.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR));
const QString url = converter.resourcePath(identifier);
return url;
}
......@@ -32,6 +32,7 @@ public:
~ExportCalendarsJobInterfaceTestImpl();
void setListOfResource(const QVector<Utils::AkonadiInstanceInfo> &instanceInfoList);
void setPathConfig(const QString &pathConfig);
protected:
void exportArchiveResource() override;
Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override;
......@@ -42,6 +43,7 @@ protected:
Q_REQUIRED_RESULT QString resourcePath(const QString &identifier) const override;
private:
QVector<Utils::AkonadiInstanceInfo> mListAkonadiInstanceInfo;
QString mPathConfig;
};
class ExportCalendarsJobInterfaceTest : public QObject
......
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