File indexing completed on 2024-12-22 05:05:25

0001 /*
0002    SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "importnotesjobinterfacetestimpl.h"
0008 #include "resourceconvertertest.h"
0009 #include <QDir>
0010 #include <QTest>
0011 
0012 ImportNotesJobInterfaceTestImpl::ImportNotesJobInterfaceTestImpl(QObject *parent,
0013                                                                  Utils::StoredTypes typeSelected,
0014                                                                  ArchiveStorage *archiveStorage,
0015                                                                  int numberOfStep)
0016     : ImportNotesJobInterface(parent, typeSelected, archiveStorage, numberOfStep)
0017 {
0018 }
0019 
0020 ImportNotesJobInterfaceTestImpl::~ImportNotesJobInterfaceTestImpl()
0021 {
0022     // Clean up temp repo
0023     QVERIFY(QDir(QDir::tempPath() + QLatin1Char('/') + Utils::backupnote()).removeRecursively());
0024 }
0025 
0026 Akonadi::Collection::Id ImportNotesJobInterfaceTestImpl::convertFolderPathToCollectionId(const QString &path)
0027 {
0028     ResourceConverterTest resourceConverterTest;
0029     resourceConverterTest.setTestPath(mPathConfig);
0030     return resourceConverterTest.convertFolderPathToCollectionId(path);
0031 }
0032 
0033 QString
0034 ImportNotesJobInterfaceTestImpl::createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree)
0035 {
0036     return mLogCreateResource->logCreateResource(resources, name, settings, synchronizeTree);
0037 }
0038 
0039 void ImportNotesJobInterfaceTestImpl::synchronizeResource(const QStringList &lst)
0040 {
0041     mLogCreateResource->logSynchronizeResource(lst);
0042     slotNextStep();
0043 }
0044 
0045 QString ImportNotesJobInterfaceTestImpl::adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData)
0046 {
0047     ResourceConverterTest resourceConverterTest;
0048     resourceConverterTest.setTestPath(mPathConfig);
0049     return resourceConverterTest.adaptResourcePath(resourceConfig, storedData);
0050 }
0051 
0052 QString ImportNotesJobInterfaceTestImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
0053 {
0054     ResourceConverterTest resourceConverterTest;
0055     resourceConverterTest.setTestPath(mPathConfig);
0056     return resourceConverterTest.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
0057 }
0058 
0059 QString ImportNotesJobInterfaceTestImpl::configLocation() const
0060 {
0061     return mExistingPathConfig;
0062 }
0063 
0064 void ImportNotesJobInterfaceTestImpl::setExistingPathConfig(const QString &path)
0065 {
0066     mExistingPathConfig = path;
0067 }
0068 
0069 #include "moc_importnotesjobinterfacetestimpl.cpp"