Warning, file /pim/pim-data-exporter/core/notes/exportnotesjobinterfaceimpl.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002    SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "exportnotesjobinterfaceimpl.h"
0008 #include "exportresourcearchivejob.h"
0009 #include "resourceconverterimpl.h"
0010 
0011 #include <KConfigGroup>
0012 #include <KZip>
0013 #include <MailCommon/MailUtil>
0014 
0015 #include <QStandardPaths>
0016 
0017 ExportNotesJobInterfaceImpl::ExportNotesJobInterfaceImpl(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep)
0018     : ExportNotesJobInterface(parent, typeSelected, archiveStorage, numberOfStep)
0019 {
0020 }
0021 
0022 ExportNotesJobInterfaceImpl::~ExportNotesJobInterfaceImpl() = default;
0023 
0024 QList<Utils::AkonadiInstanceInfo> ExportNotesJobInterfaceImpl::listOfResource()
0025 {
0026     return Utils::listOfResource();
0027 }
0028 
0029 void ExportNotesJobInterfaceImpl::convertCollectionIdsToRealPath(KConfigGroup &selectFolderNoteGroup, const QString &selectFolderNoteGroupStr)
0030 {
0031     ResourceConverterImpl resourceImpl;
0032     resourceImpl.convertCollectionIdsToRealPath(selectFolderNoteGroup, selectFolderNoteGroupStr);
0033 }
0034 
0035 Akonadi::Collection::Id ExportNotesJobInterfaceImpl::convertFolderPathToCollectionId(const QString &path)
0036 {
0037     ResourceConverterImpl converter;
0038     return converter.convertFolderPathToCollectionId(path);
0039 }
0040 
0041 void ExportNotesJobInterfaceImpl::exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier)
0042 {
0043     auto resourceJob = new ExportResourceArchiveJob(this);
0044     resourceJob->setArchivePath(archivePath);
0045     resourceJob->setUrl(url);
0046     resourceJob->setIdentifier(identifier);
0047     resourceJob->setArchive(archive());
0048     resourceJob->setArchiveName(Utils::resourceNoteArchiveName());
0049     connect(resourceJob, &ExportResourceArchiveJob::error, this, &ExportNotesJobInterfaceImpl::emitError);
0050     connect(resourceJob, &ExportResourceArchiveJob::info, this, &ExportNotesJobInterfaceImpl::emitInfo);
0051     connect(resourceJob, &ExportResourceArchiveJob::terminated, this, &ExportNotesJobInterfaceImpl::slotNoteJobTerminated);
0052     resourceJob->start();
0053 }
0054 
0055 QString ExportNotesJobInterfaceImpl::resourcePath(const QString &identifier) const
0056 {
0057     ResourceConverterImpl converter;
0058     const QString url = converter.resourcePath(identifier);
0059     return url;
0060 }
0061 
0062 QString ExportNotesJobInterfaceImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath)
0063 {
0064     ResourceConverterImpl converter;
0065     return converter.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
0066 }
0067 
0068 QString
0069 ExportNotesJobInterfaceImpl::createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree)
0070 {
0071     Q_UNUSED(resources);
0072     Q_UNUSED(name);
0073     Q_UNUSED(settings);
0074     Q_UNUSED(synchronizeTree);
0075     Q_UNREACHABLE();
0076     return {};
0077 }
0078 
0079 #include "moc_exportnotesjobinterfaceimpl.cpp"