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

Prepare to autotest merge config

parent 04e1ca6a
Pipeline #25441 passed with stage
in 18 minutes and 11 seconds
...@@ -96,7 +96,7 @@ void ImportAddressbookJobInterface::restoreConfig() ...@@ -96,7 +96,7 @@ void ImportAddressbookJobInterface::restoreConfig()
const KArchiveEntry *kaddressbookrcentry = mArchiveDirectory->entry(Utils::configsPath() + kaddressbookStr); const KArchiveEntry *kaddressbookrcentry = mArchiveDirectory->entry(Utils::configsPath() + kaddressbookStr);
if (kaddressbookrcentry && kaddressbookrcentry->isFile()) { if (kaddressbookrcentry && kaddressbookrcentry->isFile()) {
const KArchiveFile *kaddressbookrcFile = static_cast<const KArchiveFile *>(kaddressbookrcentry); const KArchiveFile *kaddressbookrcFile = static_cast<const KArchiveFile *>(kaddressbookrcentry);
const QString kaddressbookrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + kaddressbookStr; const QString kaddressbookrc = configLocation() + kaddressbookStr;
if (QFileInfo::exists(kaddressbookrc)) { if (QFileInfo::exists(kaddressbookrc)) {
if (overwriteConfigMessageBox(kaddressbookStr)) { if (overwriteConfigMessageBox(kaddressbookStr)) {
importkaddressBookConfig(kaddressbookrcFile, kaddressbookrc, kaddressbookStr, Utils::configsPath()); importkaddressBookConfig(kaddressbookrcFile, kaddressbookrc, kaddressbookStr, Utils::configsPath());
......
...@@ -38,7 +38,7 @@ protected: ...@@ -38,7 +38,7 @@ protected:
void slotNextStep() override; void slotNextStep() override;
virtual void synchronizeResource(const QStringList &lst) = 0; virtual void synchronizeResource(const QStringList &lst) = 0;
virtual Q_REQUIRED_RESULT QString adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData) = 0; virtual Q_REQUIRED_RESULT QString adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData) = 0;
virtual Q_REQUIRED_RESULT QString configLocation() const = 0;
void restoreResources(); void restoreResources();
private: private:
Q_REQUIRED_RESULT bool isAConfigFile(const QString &name) const override; Q_REQUIRED_RESULT bool isAConfigFile(const QString &name) const override;
......
...@@ -37,6 +37,11 @@ ImportAddressbookJobInterfaceImpl::~ImportAddressbookJobInterfaceImpl() ...@@ -37,6 +37,11 @@ ImportAddressbookJobInterfaceImpl::~ImportAddressbookJobInterfaceImpl()
{ {
} }
QString ImportAddressbookJobInterfaceImpl::configLocation() const
{
return QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/');
}
Akonadi::Collection::Id ImportAddressbookJobInterfaceImpl::convertFolderPathToCollectionId(const QString &path) Akonadi::Collection::Id ImportAddressbookJobInterfaceImpl::convertFolderPathToCollectionId(const QString &path)
{ {
ResourceConverterImpl converter; ResourceConverterImpl converter;
......
...@@ -37,6 +37,7 @@ protected: ...@@ -37,6 +37,7 @@ protected:
Q_REQUIRED_RESULT QString createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree = false) override; Q_REQUIRED_RESULT QString createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree = false) override;
Q_REQUIRED_RESULT QString adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData) 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; Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
Q_REQUIRED_RESULT QString configLocation() const override;
}; };
#endif // IMPORTADDRESSBOOKJOBINTERFACEIMPL_H #endif // IMPORTADDRESSBOOKJOBINTERFACEIMPL_H
...@@ -67,3 +67,9 @@ QString ImportAddressbookJobInterfaceTestImpl::adaptNewResourceUrl(bool overwrit ...@@ -67,3 +67,9 @@ QString ImportAddressbookJobInterfaceTestImpl::adaptNewResourceUrl(bool overwrit
resourceConverterTest.setTestPath(mPathConfig); resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath); return resourceConverterTest.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
} }
QString ImportAddressbookJobInterfaceTestImpl::configLocation() const
{
//TODO
return {};
}
...@@ -38,6 +38,7 @@ protected: ...@@ -38,6 +38,7 @@ protected:
void synchronizeResource(const QStringList &lst) override; void synchronizeResource(const QStringList &lst) override;
Q_REQUIRED_RESULT QString adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData) 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; Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
Q_REQUIRED_RESULT QString configLocation() const override;
}; };
#endif // IMPORTADDRESSBOOKJOBINTERFACETESTIMPL_H #endif // IMPORTADDRESSBOOKJOBINTERFACETESTIMPL_H
...@@ -88,7 +88,7 @@ void ImportNotesJobInterface::restoreConfig() ...@@ -88,7 +88,7 @@ void ImportNotesJobInterface::restoreConfig()
const KArchiveEntry *globalNotecentry = mArchiveDirectory->entry(Utils::configsPath() + globalNoteStr); const KArchiveEntry *globalNotecentry = mArchiveDirectory->entry(Utils::configsPath() + globalNoteStr);
if (globalNotecentry && globalNotecentry->isFile()) { if (globalNotecentry && globalNotecentry->isFile()) {
const KArchiveFile *globalNotecentryrc = static_cast<const KArchiveFile *>(globalNotecentry); const KArchiveFile *globalNotecentryrc = static_cast<const KArchiveFile *>(globalNotecentry);
const QString globalNoterc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + globalNoteStr; const QString globalNoterc = configLocation() + globalNoteStr;
if (QFileInfo::exists(globalNoterc)) { if (QFileInfo::exists(globalNoterc)) {
if (overwriteConfigMessageBox(globalNoteStr)) { if (overwriteConfigMessageBox(globalNoteStr)) {
importKNoteGlobalSettings(globalNotecentryrc, globalNoterc, globalNoteStr, Utils::configsPath()); importKNoteGlobalSettings(globalNotecentryrc, globalNoterc, globalNoteStr, Utils::configsPath());
......
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