Commit ab8a336c authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix test import

parent 4a0752a0
Pipeline #25740 passed with stage
in 10 minutes and 54 seconds
......@@ -58,14 +58,16 @@ void ImportMailJobInterfaceTest::importMail()
QFETCH(QString, zipFilePath);
QFETCH(QString, testPath);
QFETCH(Utils::StoredTypes, options);
TestImportFile *file = new TestImportFile(zipFilePath + testPath, this);
file->setPathConfig(zipFilePath + testPath);
const QString fullTestPath = zipFilePath + testPath;
TestImportFile *file = new TestImportFile(fullTestPath, this);
file->setPathConfig(fullTestPath);
file->setExtractPath(QDir::tempPath() + QLatin1Char('/') + testPath);
file->setExcludePath(Utils::mailsPath()); // ???
ImportMailJobInterfaceTestImpl *impl = new ImportMailJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
impl->setPathConfig(file->pathConfig());
impl->setExtractPath(file->extractPath());
impl->setTempDirName(file->extractPath());
impl->setExistingPathConfig(fullTestPath + QStringLiteral("/existingconfig"));
file->setAbstractImportExportJob(impl);
file->setLoggingFilePath(impl->loggingFilePath());
file->start();
......
......@@ -48,6 +48,11 @@ void ImportMailJobInterfaceTestImpl::start()
ImportMailJobInterface::start();
}
void ImportMailJobInterfaceTestImpl::setExistingPathConfig(const QString &path)
{
mExistingPathConfig = path;
}
Akonadi::Collection::Id ImportMailJobInterfaceTestImpl::convertFolderPathToCollectionId(const QString &path)
{
ResourceConverterTest resourceConverterTest;
......@@ -183,6 +188,6 @@ void ImportMailJobInterfaceTestImpl::importSmtpMailTransport(const SmtpMailTrans
QString ImportMailJobInterfaceTestImpl::configLocation() const
{
//TODO implement
return {};
qDebug() << " QString ImportMailJobInterfaceTestImpl::configLocation() const "<< mExistingPathConfig;
return mExistingPathConfig;
}
......@@ -31,6 +31,7 @@ public:
explicit ImportMailJobInterfaceTestImpl(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep);
~ImportMailJobInterfaceTestImpl();
void start() override;
void setExistingPathConfig(const QString &path);
protected:
Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override;
......@@ -50,6 +51,7 @@ private:
Q_REQUIRED_RESULT QString uniqueIdentityName(const QString &name);
uint mIdentityUoid = 1;
uint mMailTransportId = 1;
QString mExistingPathConfig;
};
......
......@@ -74,6 +74,11 @@ bool ImportNotesJobInterface::isAConfigFile(const QString &name) const
return name.endsWith(QLatin1String("rc")) && (name.contains(QLatin1String("akonadi_akonotes_resource_")));
}
QString ImportNotesJobInterface::installConfigLocation() const
{
return QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/');
}
void ImportNotesJobInterface::restoreConfig()
{
increaseProgressDialog();
......@@ -88,13 +93,15 @@ void ImportNotesJobInterface::restoreConfig()
const KArchiveEntry *globalNotecentry = mArchiveDirectory->entry(Utils::configsPath() + globalNoteStr);
if (globalNotecentry && globalNotecentry->isFile()) {
const KArchiveFile *globalNotecentryrc = static_cast<const KArchiveFile *>(globalNotecentry);
const QString globalNoterc = configLocation() + globalNoteStr;
if (QFileInfo::exists(globalNoterc)) {
const QString searchExistingGlobalNoterc = configLocation() + globalNoteStr;
const QString installPathGlobalNoterc = installConfigLocation() + globalNoteStr;
if (QFileInfo::exists(searchExistingGlobalNoterc)) {
if (overwriteConfigMessageBox(globalNoteStr)) {
importKNoteGlobalSettings(globalNotecentryrc, globalNoterc, globalNoteStr, Utils::configsPath());
}
importKNoteGlobalSettings(globalNotecentryrc, installPathGlobalNoterc, globalNoteStr, Utils::configsPath());
} //Else merge!
} else {
importKNoteGlobalSettings(globalNotecentryrc, globalNoterc, globalNoteStr, Utils::configsPath());
importKNoteGlobalSettings(globalNotecentryrc, installPathGlobalNoterc, globalNoteStr, Utils::configsPath());
}
}
}
......
......@@ -37,6 +37,7 @@ protected:
virtual void synchronizeResource(const QStringList &lst) = 0;
virtual Q_REQUIRED_RESULT QString adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData) = 0;
void slotNextStep() override;
Q_REQUIRED_RESULT QString installConfigLocation() const;
private:
Q_REQUIRED_RESULT bool isAConfigFile(const QString &name) const override;
void importKNoteGlobalSettings(const KArchiveFile *kmailsnippet, const QString &configrc, const QString &filename, const QString &prefix);
......
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