File indexing completed on 2024-12-22 05:05:23
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 "importalarmjobinterfacetestimpl.h" 0008 #include "archivestorage.h" 0009 #include "resourceconvertertest.h" 0010 0011 #include <QDir> 0012 #include <QTest> 0013 0014 ImportAlarmJobInterfaceTestImpl::ImportAlarmJobInterfaceTestImpl(QObject *parent, 0015 Utils::StoredTypes typeSelected, 0016 ArchiveStorage *archiveStorage, 0017 int numberOfStep) 0018 : ImportAlarmJobInterface(parent, typeSelected, archiveStorage, numberOfStep) 0019 { 0020 } 0021 0022 ImportAlarmJobInterfaceTestImpl::~ImportAlarmJobInterfaceTestImpl() 0023 { 0024 // Clean up temp repo 0025 QVERIFY(QDir(extractPath()).removeRecursively()); 0026 QVERIFY(QDir(QDir::tempPath() + QLatin1Char('/') + Utils::storeAlarm()).removeRecursively()); 0027 } 0028 0029 Akonadi::Collection::Id ImportAlarmJobInterfaceTestImpl::convertFolderPathToCollectionId(const QString &path) 0030 { 0031 ResourceConverterTest resourceConverterTest; 0032 resourceConverterTest.setTestPath(mPathConfig); 0033 return resourceConverterTest.convertFolderPathToCollectionId(path); 0034 } 0035 0036 QString 0037 ImportAlarmJobInterfaceTestImpl::createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree) 0038 { 0039 return mLogCreateResource->logCreateResource(resources, name, settings, synchronizeTree); 0040 } 0041 0042 void ImportAlarmJobInterfaceTestImpl::synchronizeResource(const QStringList &lst) 0043 { 0044 mLogCreateResource->logSynchronizeResource(lst); 0045 slotNextStep(); 0046 } 0047 0048 QString ImportAlarmJobInterfaceTestImpl::adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData) 0049 { 0050 ResourceConverterTest resourceConverterTest; 0051 resourceConverterTest.setTestPath(mPathConfig); 0052 return resourceConverterTest.adaptResourcePath(resourceConfig, storedData); 0053 } 0054 0055 QString ImportAlarmJobInterfaceTestImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) 0056 { 0057 ResourceConverterTest resourceConverterTest; 0058 resourceConverterTest.setTestPath(mPathConfig); 0059 return resourceConverterTest.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath); 0060 } 0061 0062 void ImportAlarmJobInterfaceTestImpl::setExistingPathConfig(const QString &path) 0063 { 0064 mExistingPathConfig = path; 0065 } 0066 0067 QString ImportAlarmJobInterfaceTestImpl::configLocation() const 0068 { 0069 return mExistingPathConfig; 0070 } 0071 0072 #include "moc_importalarmjobinterfacetestimpl.cpp"