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