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