Commit 4fad6f24 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Make virtual more method

parent 7e7d2a17
......@@ -352,14 +352,7 @@ QStringList AbstractImportExportJob::restoreResourceFile(const QString &resource
KSharedConfig::Ptr resourceConfig = KSharedConfig::openConfig(copyToDirName + QLatin1Char('/') + resourceName);
ResourceConverterImpl converter;
QString newUrl;
if (overwriteResources) {
//TODO fix me too
newUrl = converter.resourcePath(resourceConfig);
} else {
newUrl = converter.adaptResourcePath(resourceConfig, storePath);
}
QString newUrl = adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
const QString dataFile = value.akonadiResources;
const KArchiveEntry *dataResouceEntry = mArchiveDirectory->entry(dataFile);
if (dataResouceEntry->isFile()) {
......
......@@ -114,6 +114,7 @@ protected:
void convertCollectionListStrToAkonadiId(const KSharedConfig::Ptr &config, const QString &groupName, const QString &key, bool addCollectionPrefix);
void convertRealPathToCollectionList(KConfigGroup &group, const QString &currentKey, bool addCollectionPrefix = true);
virtual Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) = 0;
virtual QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) = 0;
QHash<QString, Akonadi::Collection::Id> mHashConvertPathCollectionId;
QVector<ResourceFiles> mListResourceFile;
......
......@@ -88,3 +88,9 @@ void ExportAddressbookJobInterfaceImpl::backupAddressBookResourceFile(const QStr
{
backupResourceFile(agentIdentifier, defaultPath);
}
QString ExportAddressbookJobInterfaceImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
{
ResourceConverterImpl converter;
return converter.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
}
......@@ -39,6 +39,7 @@ protected:
Q_REQUIRED_RESULT QVector<Utils::AkonadiInstanceInfo> listOfResource() override;
Q_REQUIRED_RESULT QString resourcePath(const QString &agentIdentifier, const QString &defaultPath) const override;
void backupAddressBookResourceFile(const QString &agentIdentifier, const QString &defaultPath) override;
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
};
#endif // EXPORTADDRESSBOOKINTERFACEIMPL_H
......@@ -64,3 +64,9 @@ QString ImportAddressbookJobInterfaceImpl::adaptResourcePath(const KSharedConfig
ResourceConverterImpl converter;
return converter.adaptResourcePath(resourceConfig, storedData);
}
QString ImportAddressbookJobInterfaceImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
{
ResourceConverterImpl converter;
return converter.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
}
......@@ -37,6 +37,7 @@ protected:
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;
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;
};
#endif // IMPORTADDRESSBOOKJOBINTERFACEIMPL_H
......@@ -53,6 +53,12 @@ Akonadi::Collection::Id ExportAkregatorJobInterface::convertFolderPathToCollecti
return -1;
}
QString ExportAkregatorJobInterface::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
{
//Unused
return {};
}
void ExportAkregatorJobInterface::slotCheckBackupConfig()
{
increaseProgressDialog();
......
......@@ -34,6 +34,7 @@ public:
void start() override;
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;
private:
void slotCheckBackupConfig();
void slotCheckBackupData();
......
......@@ -54,6 +54,12 @@ Akonadi::Collection::Id ImportAkregatorJobInterface::convertFolderPathToCollecti
return -1;
}
QString ImportAkregatorJobInterface::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
{
//Unused
return {};
}
void ImportAkregatorJobInterface::slotNextStep()
{
++mIndex;
......
......@@ -35,6 +35,7 @@ public:
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;
private:
void slotNextStep() override;
......
......@@ -76,3 +76,9 @@ void ExportAlarmJobInterfaceImpl::backupAlarmResourceFile(const QString &agentId
{
backupResourceFile(agentIdentifier, defaultPath);
}
QString ExportAlarmJobInterfaceImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
{
ResourceConverterImpl converter;
return converter.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
}
......@@ -38,6 +38,7 @@ protected:
Q_REQUIRED_RESULT QVector<Utils::AkonadiInstanceInfo> listOfResource() override;
Q_REQUIRED_RESULT QString resourcePath(const QString &identifier) const override;
void backupAlarmResourceFile(const QString &agentIdentifier, const QString &defaultPath) override;
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
};
#endif // EXPORTALARMJOBINTERFACEIMPL_H
......@@ -61,6 +61,12 @@ QString ImportAlarmJobInterfaceImpl::createResource(const QString &resources, co
return mCreateResource->createResource(resources, name, settings, synchronizeTree);
}
QString ImportAlarmJobInterfaceImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
{
ResourceConverterImpl converter;
return converter.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
}
void ImportAlarmJobInterfaceImpl::synchronizeResource(const QStringList &lst)
{
startSynchronizeResources(lst);
......
......@@ -36,6 +36,7 @@ protected:
Q_REQUIRED_RESULT QString adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData) 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;
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
};
#endif // IMPORTALARMJOBINTERFACEIMPL_H
......@@ -72,6 +72,13 @@ void ExportAddressbookJobInterfaceTestImpl::convertCollectionListToRealPath(KCon
resourceConverter.convertCollectionListToRealPath(group, currentKey);
}
QString ExportAddressbookJobInterfaceTestImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
}
QString ExportAddressbookJobInterfaceTestImpl::resourcePath(const QString &agentIdentifier, const QString &defaultPath) const
{
ResourceConverterTest converter;
......@@ -148,3 +155,5 @@ void ExportAddressbookJobInterfaceTest::exportAddressBookConfigAndResource()
file->start();
delete exportNote;
}
......@@ -39,6 +39,7 @@ protected:
Q_REQUIRED_RESULT QVector<Utils::AkonadiInstanceInfo> listOfResource() override;
Q_REQUIRED_RESULT QString resourcePath(const QString &agentIdentifier, const QString &defaultPath = QString()) const override;
void backupAddressBookResourceFile(const QString &agentIdentifier, const QString &defaultPath) override;
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
};
class ExportAddressbookJobInterfaceTest : public QObject
......
......@@ -39,7 +39,7 @@ ImportAddressbookJobInterfaceTestImpl::~ImportAddressbookJobInterfaceTestImpl()
Akonadi::Collection::Id ImportAddressbookJobInterfaceTestImpl::convertFolderPathToCollectionId(const QString &path)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR));
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.convertFolderPathToCollectionId(path);
}
......@@ -59,10 +59,17 @@ void ImportAddressbookJobInterfaceTestImpl::synchronizeResource(const QStringLis
QString ImportAddressbookJobInterfaceTestImpl::adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR));
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.adaptResourcePath(resourceConfig, storedData);
}
QString ImportAddressbookJobInterfaceTestImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
}
ImportAddressbookJobInterfaceTest::ImportAddressbookJobInterfaceTest(QObject *parent)
: QObject(parent)
{
......
......@@ -37,6 +37,7 @@ protected:
Q_REQUIRED_RESULT QString createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree) override;
void synchronizeResource(const QStringList &lst) 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;
};
class ImportAddressbookJobInterfaceTest : public QObject
......
......@@ -37,6 +37,11 @@ ExportAkregatorJobInterfaceTestImpl::~ExportAkregatorJobInterfaceTestImpl()
{
}
QString ExportAkregatorJobInterfaceTestImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
{
return {};
}
ExportAkregatorJobInterfaceTest::ExportAkregatorJobInterfaceTest(QObject *parent)
: QObject(parent)
{
......
......@@ -30,6 +30,8 @@ class ExportAkregatorJobInterfaceTestImpl : public ExportAkregatorJobInterface
public:
explicit ExportAkregatorJobInterfaceTestImpl(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep);
~ExportAkregatorJobInterfaceTestImpl();
protected:
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
};
class ExportAkregatorJobInterfaceTest : public QObject
......
......@@ -36,9 +36,12 @@ ImportAkregatorJobInterfaceTestImpl::~ImportAkregatorJobInterfaceTestImpl()
Akonadi::Collection::Id ImportAkregatorJobInterfaceTestImpl::convertFolderPathToCollectionId(const QString &path)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR));
return resourceConverterTest.convertFolderPathToCollectionId(path);
return -1;
}
QString ImportAkregatorJobInterfaceTestImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
{
return {};
}
ImportAkregatorJobInterfaceTest::ImportAkregatorJobInterfaceTest(QObject *parent)
......
......@@ -33,6 +33,7 @@ public:
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;
};
class ImportAkregatorJobInterfaceTest : public QObject
......
......@@ -78,6 +78,13 @@ void ExportAlarmJobInterfaceTestImpl::backupAlarmResourceFile(const QString &age
job->start();
}
QString ExportAlarmJobInterfaceTestImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
}
ExportAlarmJobInterfaceTest::ExportAlarmJobInterfaceTest(QObject *parent)
: QObject(parent)
{
......
......@@ -37,6 +37,7 @@ protected:
Q_REQUIRED_RESULT QVector<Utils::AkonadiInstanceInfo> listOfResource() override;
Q_REQUIRED_RESULT QString resourcePath(const QString &identifier) const override;
void backupAlarmResourceFile(const QString &agentIdentifier, const QString &defaultPath) override;
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
};
class ExportAlarmJobInterfaceTest : public QObject
......
......@@ -39,7 +39,7 @@ ImportAlarmJobInterfaceTestImpl::~ImportAlarmJobInterfaceTestImpl()
Akonadi::Collection::Id ImportAlarmJobInterfaceTestImpl::convertFolderPathToCollectionId(const QString &path)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR));
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.convertFolderPathToCollectionId(path);
}
......@@ -59,10 +59,17 @@ void ImportAlarmJobInterfaceTestImpl::synchronizeResource(const QStringList &lst
QString ImportAlarmJobInterfaceTestImpl::adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR));
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.adaptResourcePath(resourceConfig, storedData);
}
QString ImportAlarmJobInterfaceTestImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
}
ImportAlarmJobInterfaceTest::ImportAlarmJobInterfaceTest(QObject *parent)
: QObject(parent)
{
......
......@@ -37,6 +37,7 @@ protected:
Q_REQUIRED_RESULT QString createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree) override;
void synchronizeResource(const QStringList &lst) 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;
};
class ImportAlarmJobInterfaceTest : public QObject
......
......@@ -91,6 +91,13 @@ void ExportCalendarsJobInterfaceTestImpl::backupCalendarResourceFile(const QStri
job->start();
}
QString ExportCalendarsJobInterfaceTestImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
}
ExportCalendarsJobInterfaceTest::ExportCalendarsJobInterfaceTest(QObject *parent)
: QObject(parent)
{
......
......@@ -39,6 +39,7 @@ protected:
Q_REQUIRED_RESULT QVector<Utils::AkonadiInstanceInfo> listOfResource() override;
Q_REQUIRED_RESULT QString resourcePath(const QString &identifier) const override;
void backupCalendarResourceFile(const QString &agentIdentifier, const QString &defaultPath) override;
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
};
class ExportCalendarsJobInterfaceTest : public QObject
......
......@@ -39,7 +39,7 @@ ImportCalendarJobInterfaceTestImpl::~ImportCalendarJobInterfaceTestImpl()
Akonadi::Collection::Id ImportCalendarJobInterfaceTestImpl::convertFolderPathToCollectionId(const QString &path)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR));
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.convertFolderPathToCollectionId(path);
}
......@@ -59,10 +59,17 @@ void ImportCalendarJobInterfaceTestImpl::synchronizeResource(const QStringList &
QString ImportCalendarJobInterfaceTestImpl::adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR));
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.adaptResourcePath(resourceConfig, storedData);
}
QString ImportCalendarJobInterfaceTestImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
}
ImportCalendarJobInterfaceTest::ImportCalendarJobInterfaceTest(QObject *parent)
: QObject(parent)
{
......
......@@ -37,6 +37,7 @@ protected:
Q_REQUIRED_RESULT QString createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree) override;
void synchronizeResource(const QStringList &lst) 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;
};
class ImportCalendarJobInterfaceTest : public QObject
......
......@@ -61,7 +61,7 @@ void ExportMailJobInterfaceTestImpl::convertCollectionIdsToRealPath(KConfigGroup
Akonadi::Collection::Id ExportMailJobInterfaceTestImpl::convertFolderPathToCollectionId(const QString &path)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR));
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.convertFolderPathToCollectionId(path);
}
......@@ -119,6 +119,13 @@ void ExportMailJobInterfaceTestImpl::backupMailResourceFile(const QString &agent
job->start();
}
QString ExportMailJobInterfaceTestImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
}
ExportMailJobInterfaceTest::ExportMailJobInterfaceTest(QObject *parent)
: QObject(parent)
{
......
......@@ -48,6 +48,7 @@ protected:
Q_REQUIRED_RESULT QString storeResources(KZip *archive, const QString &identifier, const QString &path) override;
Q_REQUIRED_RESULT QString resourcePath(const QString &identifier) const override;
void backupMailResourceFile(const QString &agentIdentifier, const QString &defaultPath) override;
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
};
class ExportMailJobInterfaceTest : public QObject
......
......@@ -39,7 +39,7 @@ ImportMailJobInterfaceTestImpl::~ImportMailJobInterfaceTestImpl()
Akonadi::Collection::Id ImportMailJobInterfaceTestImpl::convertFolderPathToCollectionId(const QString &path)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR));
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.convertFolderPathToCollectionId(path);
}
......@@ -69,10 +69,17 @@ void ImportMailJobInterfaceTestImpl::importFilters(const QVector<MailCommon::Mai
QString ImportMailJobInterfaceTestImpl::adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR));
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.adaptResourcePath(resourceConfig, storedData);
}
QString ImportMailJobInterfaceTestImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
}
ImportMailJobInterfaceTest::ImportMailJobInterfaceTest(QObject *parent)
: QObject(parent)
{
......
......@@ -41,6 +41,7 @@ protected:
void importFilters(const QVector<MailCommon::MailFilter *> &filters) 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;
};
class ImportMailJobInterfaceTest : public QObject
......
......@@ -73,6 +73,13 @@ QString ExportNotesJobInterfaceTestImpl::resourcePath(const QString &identifier)
return url;
}
QString ExportNotesJobInterfaceTestImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
}
ExportNotesJobInterfaceTest::ExportNotesJobInterfaceTest(QObject *parent)
: QObject(parent)
{
......
......@@ -38,6 +38,7 @@ protected:
void exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier) override;
Q_REQUIRED_RESULT QVector<Utils::AkonadiInstanceInfo> listOfResource() override;
Q_REQUIRED_RESULT QString resourcePath(const QString &identifier) const override;
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
};
class ExportNotesJobInterfaceTest : public QObject
......
......@@ -40,7 +40,7 @@ ImportNotesJobInterfaceTestImpl::~ImportNotesJobInterfaceTestImpl()
Akonadi::Collection::Id ImportNotesJobInterfaceTestImpl::convertFolderPathToCollectionId(const QString &path)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR));
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.convertFolderPathToCollectionId(path);
}
......@@ -61,10 +61,17 @@ void ImportNotesJobInterfaceTestImpl::synchronizeResource(const QStringList &lst
QString ImportNotesJobInterfaceTestImpl::adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR));
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.adaptResourcePath(resourceConfig, storedData);
}
QString ImportNotesJobInterfaceTestImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
{
ResourceConverterTest resourceConverterTest;
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
}
ImportNotesJobInterfaceTest::ImportNotesJobInterfaceTest(QObject *parent)
: QObject(parent)
{
......
......@@ -37,6 +37,7 @@ protected:
Q_REQUIRED_RESULT QString createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree) override;
void synchronizeResource(const QStringList &lst) 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;
};
class ImportNotesJobInterfaceTest : public QObject
......
......@@ -72,3 +72,14 @@ QString ResourceConverterTest::installDefaultDirectory()
{
return QDir::tempPath();
}
QString ResourceConverterTest::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
{
QString newUrl;
if (overwriteResources) {
newUrl = resourcePath(resourceConfig);
} else {
newUrl = adaptResourcePath(resourceConfig, storePath);
}
return newUrl;
}
......@@ -36,6 +36,7 @@ public:
void setTestPath(const QString &testPath);
Q_REQUIRED_RESULT QString installDefaultDirectory() override;
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
private:
Q_REQUIRED_RESULT QString prefixStr() const;
QString mTestPath;
......
......@@ -91,3 +91,9 @@ void ExportCalendarJobInterfaceImpl::backupCalendarResourceFile(const QString &a
{
backupResourceFile(agentIdentifier, defaultPath);
}
QString ExportCalendarJobInterfaceImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
{
ResourceConverterImpl converter;
return converter.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
}