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
......
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