diff --git a/core/autotests/mail/exportmailjobinterfacetest.cpp b/core/autotests/mail/exportmailjobinterfacetest.cpp index 5fcfa8e..ad505ea 100644 --- a/core/autotests/mail/exportmailjobinterfacetest.cpp +++ b/core/autotests/mail/exportmailjobinterfacetest.cpp @@ -1,185 +1,193 @@ /* Copyright (C) 2020 Laurent Montel This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "exportmailjobinterfacetest.h" #include "archivestorage.h" #include "resourceconvertertest.h" #include "testexportfile.h" #include #include #include #include QTEST_MAIN(ExportMailJobInterfaceTest) ExportMailJobInterfaceTestImpl::ExportMailJobInterfaceTestImpl(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep) : ExportMailJobInterface(parent, typeSelected, archiveStorage, numberOfStep) { } ExportMailJobInterfaceTestImpl::~ExportMailJobInterfaceTestImpl() { } void ExportMailJobInterfaceTestImpl::convertCollectionToRealPath(KConfigGroup &group, const QString ¤tKey) { ResourceConverterTest resourceConverter; resourceConverter.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR)); resourceConverter.convertCollectionToRealPath(group, currentKey); } void ExportMailJobInterfaceTestImpl::convertCollectionListToRealPath(KConfigGroup &group, const QString ¤tKey) { ResourceConverterTest resourceConverter; resourceConverter.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR)); resourceConverter.convertCollectionListToRealPath(group, currentKey); } void ExportMailJobInterfaceTestImpl::convertCollectionIdsToRealPath(KConfigGroup &group, const QString ¤tKey, const QString &prefixCollection) { ResourceConverterTest resourceConverter; resourceConverter.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR)); resourceConverter.convertCollectionIdsToRealPath(group, currentKey, prefixCollection); } Akonadi::Collection::Id ExportMailJobInterfaceTestImpl::convertFolderPathToCollectionId(const QString &path) { ResourceConverterTest resourceConverterTest; resourceConverterTest.setTestPath(mPathConfig); return resourceConverterTest.convertFolderPathToCollectionId(path); } QVector ExportMailJobInterfaceTestImpl::filters() { qDebug() << " not implement yet ExportMailJobInterfaceTestImpl::filters()"; //TODO implement it return {}; } void ExportMailJobInterfaceTestImpl::exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier) { SaveResoureConfigTest saveResourceConfig; saveResourceConfig.setArchive(mArchiveStorage->archive()); saveResourceConfig.exportResourceToArchive(archivePath, url, identifier, Utils::resourceMailArchiveName(), { QLatin1String("akonadi_maildir_resource_"), QLatin1String("akonadi_mixedmaildir_resource_")}); slotMailsJobTerminated(); } QVector ExportMailJobInterfaceTestImpl::listOfResource() { return mListAkonadiInstanceInfo; } QString ExportMailJobInterfaceTestImpl::storeResources(KZip *archive, const QString &identifier, const QString &path) { ResourceConverterTest converter; return converter.storeResources(archive, identifier, path); } QString ExportMailJobInterfaceTestImpl::convertToFullCollectionPath(const qlonglong collectionValue) { ResourceConverterTest converter; converter.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR)); return converter.convertToFullCollectionPath(collectionValue); } QString ExportMailJobInterfaceTestImpl::resourcePath(const QString &identifier) const { ResourceConverterTest converter; converter.setTestPath(QLatin1String(PIMDATAEXPORTER_DIR)); const QString url = converter.resourcePath(identifier); return url; } void ExportMailJobInterfaceTestImpl::exportFilters() { qDebug() << " void ExportMailJobInterfaceTestImpl::exportFilters() not implemented yet"; } void ExportMailJobInterfaceTestImpl::backupMailResourceFile(const QString &agentIdentifier, const QString &defaultPath) { TestBackupResourceFileJob *job = new TestBackupResourceFileJob(this); job->setDefaultPath(defaultPath); job->setIdentifier(agentIdentifier); job->setTestPath(mPathConfig); job->setZip(archive()); connect(job, &TestBackupResourceFileJob::error, this, &ExportMailJobInterfaceTestImpl::error); connect(job, &TestBackupResourceFileJob::info, this, &ExportMailJobInterfaceTestImpl::info); job->start(); } QString ExportMailJobInterfaceTestImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) { ResourceConverterTest resourceConverterTest; resourceConverterTest.setTestPath(mPathConfig); return resourceConverterTest.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath); } QString ExportMailJobInterfaceTestImpl::createResource(const QString &resources, const QString &name, const QMap &settings, bool synchronizeTree) { Q_UNREACHABLE(); return {}; } +QVector ExportMailJobInterfaceTestImpl::listIdentityUoid() const +{ + //TODO + return {}; +} + ExportMailJobInterfaceTest::ExportMailJobInterfaceTest(QObject *parent) : QObject(parent) { } void ExportMailJobInterfaceTest::exportMail_data() { QTest::addColumn("configpath"); QTest::addColumn("options"); const QByteArray pathConfig(QByteArray(PIMDATAEXPORTER_DIR) + "/export/"); Utils::StoredTypes options = {Utils::StoredType::Config}; QTest::newRow("mailonlyconfig") << pathConfig + QByteArray("mailonlyconfig/") << options; options = {Utils::StoredType::Config|Utils::StoredType::Resources}; QTest::newRow("mailconfigandresource") << pathConfig + QByteArray("mailconfigandresource/") << options; options = {Utils::StoredType::MailTransport}; QTest::newRow("mailtransport") << pathConfig + QByteArray("mailtransport/") << options; options = {Utils::StoredType::Identity}; QTest::newRow("identities") << pathConfig + QByteArray("identities/") << options; } void ExportMailJobInterfaceTest::exportMail() { QFETCH(QByteArray, configpath); QFETCH(Utils::StoredTypes, options); TestExportFile *file = new TestExportFile(this); file->setPathConfig(configpath); QVector lstInfo; Utils::AkonadiInstanceInfo info; info.identifier = QLatin1String("akonadi_mbox_resource_1"); lstInfo << info; info.identifier = QLatin1String("akonadi_maildir_resource_1"); lstInfo << info; info.identifier = QLatin1String("akonadi_mixedmaildir_resource_1"); lstInfo << info; //Add extra resource. info.identifier = QStringLiteral("akonadi_kolab_resource_2"); lstInfo << info; ExportMailJobInterfaceTestImpl *exportNote = new ExportMailJobInterfaceTestImpl(this, options, file->archiveStorage(), 1); exportNote->setListOfResource(lstInfo); exportNote->setPathConfig(QLatin1String(configpath)); file->setAbstractImportExportJob(exportNote); file->start(); delete exportNote; } + + diff --git a/core/autotests/mail/exportmailjobinterfacetest.h b/core/autotests/mail/exportmailjobinterfacetest.h index 0bcdc27..90a863c 100644 --- a/core/autotests/mail/exportmailjobinterfacetest.h +++ b/core/autotests/mail/exportmailjobinterfacetest.h @@ -1,68 +1,69 @@ /* Copyright (C) 2020 Laurent Montel This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef EXPORTMAILJOBINTERFACETEST_H #define EXPORTMAILJOBINTERFACETEST_H #include #include "exportimportutil.h" #include "mail/exportmailjobinterface.h" class ExportMailJobInterfaceTestImpl : public ExportMailJobInterface, public ExportImportUtil { Q_OBJECT public: explicit ExportMailJobInterfaceTestImpl(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep); ~ExportMailJobInterfaceTestImpl(); protected: void convertCollectionToRealPath(KConfigGroup &group, const QString ¤tKey) override; void convertCollectionListToRealPath(KConfigGroup &group, const QString ¤tKey) override; void convertCollectionIdsToRealPath(KConfigGroup &group, const QString ¤tKey, const QString &prefixCollection) override; Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override; Q_REQUIRED_RESULT QVector filters() override; Q_REQUIRED_RESULT QString convertToFullCollectionPath(const qlonglong collectionValue) override; void exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier) override; Q_REQUIRED_RESULT QVector listOfResource() override; Q_REQUIRED_RESULT QString storeResources(KZip *archive, const QString &identifier, const QString &path) override; Q_REQUIRED_RESULT QString resourcePath(const QString &identifier) const override; void backupMailResourceFile(const QString &agentIdentifier, const QString &defaultPath) override; Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override; Q_REQUIRED_RESULT QString createResource(const QString &resources, const QString &name, const QMap &settings, bool synchronizeTree) override; + Q_REQUIRED_RESULT QVector listIdentityUoid() const override; void exportFilters() override; }; class ExportMailJobInterfaceTest : public QObject { Q_OBJECT public: explicit ExportMailJobInterfaceTest(QObject *parent = nullptr); ~ExportMailJobInterfaceTest() = default; private Q_SLOTS: void exportMail(); void exportMail_data(); }; #endif // EXPORTMAILJOBINTERFACETEST_H diff --git a/core/mail/exportmailjobinterface.cpp b/core/mail/exportmailjobinterface.cpp index 3197323..7b8b5ef 100644 --- a/core/mail/exportmailjobinterface.cpp +++ b/core/mail/exportmailjobinterface.cpp @@ -1,648 +1,647 @@ /* Copyright (C) 2012-2020 Laurent Montel This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "exportmailjobinterface.h" #include "importexportmailutil.h" #include #include "importexportprogressindicatorbase.h" #include #include #include #include #include "pimdataexportcore_debug.h" #include #include #include #include #include #include #include #include #include ExportMailJobInterface::ExportMailJobInterface(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep) : AbstractImportExportJob(parent, archiveStorage, typeSelected, numberOfStep) { } ExportMailJobInterface::~ExportMailJobInterface() { } bool ExportMailJobInterface::checkBackupType(Utils::StoredType type) const { return mTypeSelected & type; } void ExportMailJobInterface::start() { Q_EMIT title(i18n("Start export KMail settings...")); createProgressDialog(i18n("Export KMail settings")); if (checkBackupType(Utils::Identity)) { QTimer::singleShot(0, this, &ExportMailJobInterface::slotCheckBackupIdentity); } else if (checkBackupType(Utils::MailTransport)) { QTimer::singleShot(0, this, &ExportMailJobInterface::slotCheckBackupMailTransport); } else if (checkBackupType(Utils::Config)) { QTimer::singleShot(0, this, &ExportMailJobInterface::slotCheckBackupConfig); } else if (checkBackupType(Utils::Mails)) { QTimer::singleShot(0, this, &ExportMailJobInterface::slotCheckBackupMails); } else if (checkBackupType(Utils::Resources)) { QTimer::singleShot(0, this, &ExportMailJobInterface::slotCheckBackupResources); } else { Q_EMIT jobFinished(); } } void ExportMailJobInterface::slotCheckBackupIdentity() { if (checkBackupType(Utils::Identity)) { backupIdentity(); increaseProgressDialog(); if (wasCanceled()) { Q_EMIT jobFinished(); return; } } QTimer::singleShot(0, this, &ExportMailJobInterface::slotCheckBackupMailTransport); } void ExportMailJobInterface::slotCheckBackupMailTransport() { if (checkBackupType(Utils::MailTransport)) { backupTransports(); increaseProgressDialog(); if (wasCanceled()) { Q_EMIT jobFinished(); return; } } QTimer::singleShot(0, this, &ExportMailJobInterface::slotCheckBackupConfig); } void ExportMailJobInterface::slotCheckBackupConfig() { if (checkBackupType(Utils::Config)) { backupConfig(); increaseProgressDialog(); if (wasCanceled()) { Q_EMIT jobFinished(); return; } } QTimer::singleShot(0, this, &ExportMailJobInterface::slotCheckBackupMails); } void ExportMailJobInterface::slotCheckBackupMails() { mAkonadiInstanceInfo = listOfResource(); if (checkBackupType(Utils::Mails)) { increaseProgressDialog(); setProgressDialogLabel(i18n("Backing up Mails...")); QTimer::singleShot(0, this, &ExportMailJobInterface::slotWriteNextArchiveResource); return; } QTimer::singleShot(0, this, &ExportMailJobInterface::slotCheckBackupResources); } void ExportMailJobInterface::backupTransports() { setProgressDialogLabel(i18n("Backing up transports...")); const QString mailtransportsStr(QStringLiteral("mailtransports")); const QString maitransportsrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + mailtransportsStr; if (!QFileInfo::exists(maitransportsrc)) { Q_EMIT info(i18n("Transports backup done.")); } else { KSharedConfigPtr mailtransportsConfig = KSharedConfig::openConfig(mailtransportsStr); QTemporaryFile tmp; tmp.open(); KConfig *config = mailtransportsConfig->copyTo(tmp.fileName()); config->sync(); const bool fileAdded = archive()->addLocalFile(tmp.fileName(), Utils::transportsPath() + QStringLiteral("mailtransports")); delete config; if (fileAdded) { Q_EMIT info(i18n("Transports backup done.")); } else { Q_EMIT error(i18n("Transport file cannot be added to backup file.")); } } } void ExportMailJobInterface::slotCheckBackupResources() { if (checkBackupType(Utils::Resources)) { backupResources(); increaseProgressDialog(); if (wasCanceled()) { Q_EMIT jobFinished(); return; } } Q_EMIT jobFinished(); } void ExportMailJobInterface::backupConfig() { setProgressDialogLabel(i18n("Backing up config...")); exportFilters(); backupUiRcFile(QStringLiteral("sieveeditorui.rc"), QStringLiteral("sieveeditor")); backupUiRcFile(QStringLiteral("kmreadermainwin.rc"), QStringLiteral("kmail2")); backupUiRcFile(QStringLiteral("kmcomposerui.rc"), QStringLiteral("kmail2")); backupUiRcFile(QStringLiteral("kmmainwin.rc"), QStringLiteral("kmail2")); backupUiRcFile(QStringLiteral("kmail_part.rc"), QStringLiteral("kmail2")); backupUiRcFile(QStringLiteral("kontactsummary_part.rc"), QStringLiteral("kontactsummary")); backupUiRcFile(QStringLiteral("kontactui.rc"), QStringLiteral("kontact")); backupUiRcFile(QStringLiteral("kleopatra.rc"), QStringLiteral("kleopatra")); backupUiRcFile(QStringLiteral("headerthemeeditorui.rc"), QStringLiteral("headerthemeeditor")); backupUiRcFile(QStringLiteral("contactthemeeditorui.rc"), QStringLiteral("contactthemeeditor")); backupUiRcFile(QStringLiteral("contactprintthemeeditorui.rc"), QStringLiteral("contactprintthemeeditor")); backupUiRcFile(QStringLiteral("kwatchgnupgui.rc"), QStringLiteral("kwatchgnupg")); backupUiRcFile(QStringLiteral("akonadiconsoleui.rc"), QStringLiteral("akonadiconsole")); backupConfigFile(QStringLiteral("kabldaprc")); backupConfigFile(QStringLiteral("kmailsnippetrc")); backupConfigFile(QStringLiteral("sievetemplaterc")); backupConfigFile(QStringLiteral("customtemplatesrc")); backupConfigFile(QStringLiteral("kontactrc")); backupConfigFile(QStringLiteral("kontact_summaryrc")); backupConfigFile(QStringLiteral("storageservicerc")); backupConfigFile(QStringLiteral("kpimbalooblacklist")); backupConfigFile(QStringLiteral("kleopatrarc")); backupConfigFile(QStringLiteral("sieveeditorrc")); backupConfigFile(QStringLiteral("kwatchgnupgrc")); backupConfigFile(QStringLiteral("pimpluginsrc")); backupConfigFile(QStringLiteral("texttospeechrc")); backupConfigFile(QStringLiteral("kleopatracertificateselectiondialogrc")); backupConfigFile(QStringLiteral("dkimsettingsrc")); //Notify file config backupConfigFile(QStringLiteral("akonadi_mailfilter_agent.notifyrc")); backupConfigFile(QStringLiteral("akonadi_sendlater_agent.notifyrc")); backupConfigFile(QStringLiteral("akonadi_archivemail_agent.notifyrc")); backupConfigFile(QStringLiteral("kmail2.notifyrc")); backupConfigFile(QStringLiteral("akonadi_newmailnotifier_agent.notifyrc")); backupConfigFile(QStringLiteral("akonadi_maildispatcher_agent.notifyrc")); backupConfigFile(QStringLiteral("akonadi_followupreminder_agent.notifyrc")); backupConfigFile(QStringLiteral("messagevieweradblockrc")); backupConfigFile(QStringLiteral("messageviewer.notifyrc")); const QString folderMailArchiveStr(QStringLiteral("foldermailarchiverc")); const QString folderMailArchiverc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + folderMailArchiveStr; if (QFileInfo::exists(folderMailArchiverc)) { KSharedConfigPtr archivemailrc = KSharedConfig::openConfig(folderMailArchiveStr); QTemporaryFile tmp; tmp.open(); KConfig *archiveConfig = archivemailrc->copyTo(tmp.fileName()); const QStringList archiveList = archiveConfig->groupList().filter(QRegularExpression(QStringLiteral("FolderArchiveAccount"))); for (const QString &str : archiveList) { KConfigGroup oldGroup = archiveConfig->group(str); const qint64 id = oldGroup.readEntry("topLevelCollectionId", -1); if (id != -1) { const QString realPath = convertToFullCollectionPath(id); if (!realPath.isEmpty()) { oldGroup.writeEntry(QStringLiteral("topLevelCollectionId"), realPath); } } } archiveConfig->sync(); backupFile(tmp.fileName(), Utils::configsPath(), folderMailArchiveStr); delete archiveConfig; } const QString archiveMailAgentConfigurationStr(QStringLiteral("akonadi_archivemail_agentrc")); const QString archiveMailAgentconfigurationrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + archiveMailAgentConfigurationStr; if (QFileInfo::exists(archiveMailAgentconfigurationrc)) { KSharedConfigPtr archivemailrc = KSharedConfig::openConfig(archiveMailAgentConfigurationStr); QTemporaryFile tmp; tmp.open(); KConfig *archiveConfig = archivemailrc->copyTo(tmp.fileName()); const QStringList archiveList = archiveConfig->groupList().filter(QRegularExpression(QStringLiteral("ArchiveMailCollection \\d+"))); const QString archiveGroupPattern = QStringLiteral("ArchiveMailCollection "); for (const QString &str : archiveList) { bool found = false; const int collectionId = str.rightRef(str.length() - archiveGroupPattern.length()).toInt(&found); if (found) { KConfigGroup oldGroup = archiveConfig->group(str); const QString realPath = convertToFullCollectionPath(collectionId); if (!realPath.isEmpty()) { const QString collectionPath(archiveGroupPattern + realPath); KConfigGroup newGroup(archiveConfig, collectionPath); oldGroup.copyTo(&newGroup); newGroup.writeEntry(QStringLiteral("saveCollectionId"), collectionPath); } oldGroup.deleteGroup(); } } archiveConfig->sync(); backupFile(tmp.fileName(), Utils::configsPath(), archiveMailAgentConfigurationStr); delete archiveConfig; } const QString templatesconfigurationrcStr(QStringLiteral("templatesconfigurationrc")); const QString templatesconfigurationrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + templatesconfigurationrcStr; if (QFileInfo::exists(templatesconfigurationrc)) { KSharedConfigPtr templaterc = KSharedConfig::openConfig(templatesconfigurationrcStr); QTemporaryFile tmp; tmp.open(); KConfig *templateConfig = templaterc->copyTo(tmp.fileName()); const QString templateGroupPattern = QStringLiteral("Templates #"); const QStringList templateList = templateConfig->groupList().filter(QRegularExpression(QStringLiteral("Templates #\\d+"))); for (const QString &str : templateList) { bool found = false; const int collectionId = str.rightRef(str.length() - templateGroupPattern.length()).toInt(&found); if (found) { KConfigGroup oldGroup = templateConfig->group(str); const QString realPath = convertToFullCollectionPath(collectionId); if (!realPath.isEmpty()) { KConfigGroup newGroup(templateConfig, templateGroupPattern + realPath); oldGroup.copyTo(&newGroup); } oldGroup.deleteGroup(); } } templateConfig->sync(); backupFile(tmp.fileName(), Utils::configsPath(), templatesconfigurationrcStr); delete templateConfig; } storeDirectory(QStringLiteral("/messageviewerplugins/")); storeDirectory(QStringLiteral("/messageviewer/themes/")); const QDir gravatarDirectory(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/gravatar/")); if (gravatarDirectory.exists()) { const QFileInfoList listFileInfo = gravatarDirectory.entryInfoList(QStringList() << QStringLiteral("*.png"), QDir::Files); const int listSize(listFileInfo.size()); for (int i = 0; i < listSize; ++i) { backupFile(listFileInfo.at(i).absoluteFilePath(), Utils::dataPath() + QStringLiteral("gravatar/"), listFileInfo.at(i).fileName()); } } const QDir autocorrectDirectory(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/autocorrect/")); if (autocorrectDirectory.exists()) { const QFileInfoList listFileInfo = autocorrectDirectory.entryInfoList(QStringList() << QStringLiteral("*.xml"), QDir::Files); const int listSize(listFileInfo.size()); for (int i = 0; i < listSize; ++i) { backupFile(listFileInfo.at(i).absoluteFilePath(), Utils::dataPath() + QStringLiteral("autocorrect/"), listFileInfo.at(i).fileName()); } } const QString adblockFilePath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/kmail2/adblockrules_local"); if (QFileInfo::exists(adblockFilePath)) { backupFile(adblockFilePath, Utils::dataPath() + QStringLiteral("kmail2/"), QStringLiteral("adblockrules_local")); } const QString kmailStr(QStringLiteral("kmail2rc")); const QString kmail2rc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + kmailStr; if (QFileInfo::exists(kmail2rc)) { KSharedConfigPtr kmailrc = KSharedConfig::openConfig(kmail2rc); QTemporaryFile tmp; tmp.open(); KConfig *kmailConfig = kmailrc->copyTo(tmp.fileName()); const QString folderGroupPattern = QStringLiteral("Folder-"); const QStringList folderList = kmailConfig->groupList().filter(QRegularExpression(QStringLiteral("Folder-\\d+"))); for (const QString &str : folderList) { bool found = false; const int collectionId = str.rightRef(str.length() - folderGroupPattern.length()).toInt(&found); if (found) { KConfigGroup oldGroup = kmailConfig->group(str); ImportExportMailUtil::cleanupFolderSettings(oldGroup); const QString realPath = convertToFullCollectionPath(collectionId); if (!realPath.isEmpty()) { KConfigGroup newGroup(kmailConfig, folderGroupPattern + realPath); oldGroup.copyTo(&newGroup); } oldGroup.deleteGroup(); } } const QString composerStr(QStringLiteral("Composer")); if (kmailConfig->hasGroup(composerStr)) { KConfigGroup composerGroup = kmailConfig->group(composerStr); const QString previousStr(QStringLiteral("previous-fcc")); if (composerGroup.hasKey(previousStr)) { const int collectionId = composerGroup.readEntry(previousStr, -1); if (collectionId != -1) { const QString realPath = convertToFullCollectionPath(collectionId); composerGroup.writeEntry(previousStr, realPath); } } } const QString generalStr(QStringLiteral("General")); if (kmailConfig->hasGroup(generalStr)) { KConfigGroup generalGroup = kmailConfig->group(generalStr); const QString startupFolderStr(QStringLiteral("startupFolder")); if (generalGroup.hasKey(startupFolderStr)) { const int collectionId = generalGroup.readEntry(startupFolderStr, -1); if (collectionId != -1) { const QString realPath = convertToFullCollectionPath(collectionId); generalGroup.writeEntry(startupFolderStr, realPath); } } } const QString storageModelSelectedMessageStr(QStringLiteral("MessageListView::StorageModelSelectedMessages")); if (kmailConfig->hasGroup(storageModelSelectedMessageStr)) { KConfigGroup storageGroup = kmailConfig->group(storageModelSelectedMessageStr); const QString storageModelSelectedPattern(QStringLiteral("MessageUniqueIdForStorageModel")); const QStringList storageList = storageGroup.keyList().filter(QRegularExpression(QStringLiteral("MessageUniqueIdForStorageModel\\d+"))); for (const QString &str : storageList) { bool found = false; const int collectionId = str.rightRef(str.length() - storageModelSelectedPattern.length()).toInt(&found); const QString oldValue = storageGroup.readEntry(str); if (found) { const QString realPath = convertToFullCollectionPath(collectionId); if (!realPath.isEmpty()) { storageGroup.writeEntry(QStringLiteral("%1%2").arg(storageModelSelectedPattern, realPath), oldValue); storageGroup.deleteEntry(str); } else { storageGroup.deleteEntry(str); } } } } const QString collectionFolderViewStr(QStringLiteral("CollectionFolderView")); if (kmailConfig->hasGroup(collectionFolderViewStr)) { KConfigGroup favoriteGroup = kmailConfig->group(collectionFolderViewStr); const QString currentKey(QStringLiteral("Current")); convertCollectionToRealPath(favoriteGroup, currentKey); const QString expensionKey(QStringLiteral("Expansion")); convertCollectionListToRealPath(favoriteGroup, expensionKey); } const QString favoriteCollectionStr(QStringLiteral("FavoriteCollections")); if (kmailConfig->hasGroup(favoriteCollectionStr)) { KConfigGroup favoriteGroup = kmailConfig->group(favoriteCollectionStr); const QString favoriteCollectionIdsStr(QStringLiteral("FavoriteCollectionIds")); convertCollectionIdsToRealPath(favoriteGroup, favoriteCollectionIdsStr); } const QString favoriteCollectionOrderStr(QStringLiteral("FavoriteCollectionsOrder")); if (kmailConfig->hasGroup(favoriteCollectionOrderStr)) { KConfigGroup favoriteGroup = kmailConfig->group(favoriteCollectionOrderStr); //For favorite id for root collection == 0 and we store only folder => c const QString favoriteCollectionIdsStr(QStringLiteral("0")); const QString prefixCollection(QStringLiteral("c")); convertCollectionIdsToRealPath(favoriteGroup, favoriteCollectionIdsStr, prefixCollection); } //Event collection const QString eventCollectionStr(QStringLiteral("Event")); if (kmailConfig->hasGroup(eventCollectionStr)) { KConfigGroup eventGroup = kmailConfig->group(eventCollectionStr); const QString eventLastEventSelectedFolder(QStringLiteral("LastEventSelectedFolder")); convertCollectionIdsToRealPath(eventGroup, eventLastEventSelectedFolder); } //Todo collection const QString todoCollectionStr(QStringLiteral("Todo")); if (kmailConfig->hasGroup(todoCollectionStr)) { KConfigGroup todoGroup = kmailConfig->group(todoCollectionStr); const QString todoLastEventSelectedFolder(QStringLiteral("LastSelectedFolder")); convertCollectionIdsToRealPath(todoGroup, todoLastEventSelectedFolder); } //FolderSelectionDialog collection const QString folderSelectionCollectionStr(QStringLiteral("FolderSelectionDialog")); if (kmailConfig->hasGroup(folderSelectionCollectionStr)) { KConfigGroup folderSelectionGroup = kmailConfig->group(folderSelectionCollectionStr); const QString folderSelectionSelectedFolder(QStringLiteral("LastSelectedFolder")); convertCollectionIdsToRealPath(folderSelectionGroup, folderSelectionSelectedFolder); } //Note collection const QString noteCollectionStr(QStringLiteral("Note")); if (kmailConfig->hasGroup(noteCollectionStr)) { KConfigGroup noteGroup = kmailConfig->group(noteCollectionStr); const QString noteLastEventSelectedFolder(QStringLiteral("LastNoteSelectedFolder")); convertCollectionIdsToRealPath(noteGroup, noteLastEventSelectedFolder); } //Convert MessageListTab collection id const QString messageListPaneStr(QStringLiteral("MessageListPane")); if (kmailConfig->hasGroup(messageListPaneStr)) { KConfigGroup messageListPaneGroup = kmailConfig->group(messageListPaneStr); const int numberOfTab = messageListPaneGroup.readEntry(QStringLiteral("tabNumber"), 0); for (int i = 0; i < numberOfTab; ++i) { KConfigGroup messageListPaneTabGroup = kmailConfig->group(QStringLiteral("MessageListTab%1").arg(i)); const QString messageListPaneTabFolderStr(QStringLiteral("collectionId")); convertCollectionIdsToRealPath(messageListPaneTabGroup, messageListPaneTabFolderStr); } } //Automatic Add Contacts - KIdentityManagement::IdentityManager::ConstIterator end = mIdentityManager->end(); - for (KIdentityManagement::IdentityManager::ConstIterator it = mIdentityManager->begin(); it != end; ++it) { - const uint identity = (*it).uoid(); + const QVector listIdentities = listIdentityUoid(); + for (uint identity : listIdentities) { const QString groupId = QStringLiteral("Automatic Add Contacts %1").arg(identity); if (kmailConfig->hasGroup(groupId)) { KConfigGroup identityGroup = kmailConfig->group(groupId); const QString automaticAddContactStr(QStringLiteral("Collection")); convertCollectionIdsToRealPath(identityGroup, automaticAddContactStr); } } //TODO add confirm address too //Clean up kmail2rc const QString tipOfDaysStr(QStringLiteral("TipOfDay")); if (kmailConfig->hasGroup(tipOfDaysStr)) { kmailConfig->deleteGroup(tipOfDaysStr); } const QString startupStr(QStringLiteral("Startup")); if (kmailConfig->hasGroup(startupStr)) { kmailConfig->deleteGroup(startupStr); } const QString search(QStringLiteral("Search")); if (kmailConfig->hasGroup(search)) { KConfigGroup searchGroup = kmailConfig->group(search); searchGroup.deleteGroup(); } kmailConfig->sync(); backupFile(tmp.fileName(), Utils::configsPath(), kmailStr); delete kmailConfig; } Q_EMIT info(i18n("Config backup done.")); } void ExportMailJobInterface::backupIdentity() { setProgressDialogLabel(i18n("Backing up identity...")); const QString emailidentitiesStr(QStringLiteral("emailidentities")); const QString emailidentitiesrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + emailidentitiesStr; if (QFileInfo::exists(emailidentitiesrc)) { KSharedConfigPtr identity = KSharedConfig::openConfig(emailidentitiesrc); QTemporaryFile tmp; tmp.open(); KConfig *identityConfig = identity->copyTo(tmp.fileName()); const QStringList accountList = identityConfig->groupList().filter(QRegularExpression(QStringLiteral("Identity #\\d+"))); for (const QString &account : accountList) { KConfigGroup group = identityConfig->group(account); const QString fcc = QStringLiteral("Fcc"); if (group.hasKey(fcc)) { const QString realPath = convertToFullCollectionPath(group.readEntry(fcc).toLongLong()); group.writeEntry(fcc, realPath); } const QString draft = QStringLiteral("Drafts"); if (group.hasKey(draft)) { const QString realPath = convertToFullCollectionPath(group.readEntry(draft).toLongLong()); group.writeEntry(draft, realPath); } const QString templates = QStringLiteral("Templates"); if (group.hasKey(templates)) { const QString realPath = convertToFullCollectionPath(group.readEntry(templates).toLongLong()); group.writeEntry(templates, realPath); } const QString vcard = QStringLiteral("VCardFile"); if (group.hasKey(vcard)) { const QString vcardFileName = group.readEntry(vcard); if (!vcardFileName.isEmpty()) { const int uoid = group.readEntry(QStringLiteral("uoid"), -1); QFile file(vcardFileName); if (file.exists()) { const bool fileAdded = archive()->addLocalFile(vcardFileName, Utils::identitiesPath() + QString::number(uoid) + QLatin1Char('/') + file.fileName()); if (!fileAdded) { Q_EMIT error(i18n("vCard file \"%1\" cannot be saved.", file.fileName())); } } else { group.deleteEntry(vcard); } } } } identityConfig->sync(); const bool fileAdded = archive()->addLocalFile(tmp.fileName(), Utils::identitiesPath() + QStringLiteral("emailidentities")); delete identityConfig; if (fileAdded) { Q_EMIT info(i18n("Identity backup done.")); } else { Q_EMIT error(i18n("Identity file cannot be added to backup file.")); } } } void ExportMailJobInterface::slotMailsJobTerminated() { if (wasCanceled()) { Q_EMIT jobFinished(); return; } mIndexIdentifier++; QTimer::singleShot(0, this, &ExportMailJobInterface::slotWriteNextArchiveResource); } void ExportMailJobInterface::slotWriteNextArchiveResource() { if (mIndexIdentifier < mAkonadiInstanceInfo.count()) { const Utils::AkonadiInstanceInfo agent = mAkonadiInstanceInfo.at(mIndexIdentifier); const QStringList capabilities(agent.capabilities); if (agent.mimeTypes.contains(KMime::Message::mimeType())) { if (capabilities.contains(QLatin1String("Resource")) && !capabilities.contains(QLatin1String("Virtual")) && !capabilities.contains(QLatin1String("MailTransport"))) { const QString identifier = agent.identifier; if (identifier.contains(QLatin1String("akonadi_maildir_resource_")) || identifier.contains(QLatin1String("akonadi_mixedmaildir_resource_"))) { const QString archivePath = Utils::mailsPath() + identifier + QLatin1Char('/'); const QString url = resourcePath(identifier); if (!mAgentPaths.contains(url)) { if (!url.isEmpty()) { mAgentPaths << url; exportResourceToArchive(archivePath, url, identifier); } else { qCDebug(PIMDATAEXPORTERCORE_LOG) << "Url is empty for " << identifier; QTimer::singleShot(0, this, &ExportMailJobInterface::slotMailsJobTerminated); } } else { QTimer::singleShot(0, this, &ExportMailJobInterface::slotMailsJobTerminated); } } else if (identifier.contains(QLatin1String("akonadi_mbox_resource_"))) { backupMailResourceFile(identifier, Utils::mailsPath()); //FIxME addressbookPath or MailPAth ??? QTimer::singleShot(0, this, &ExportMailJobInterface::slotMailsJobTerminated); } else { QTimer::singleShot(0, this, &ExportMailJobInterface::slotMailsJobTerminated); } } else { QTimer::singleShot(0, this, &ExportMailJobInterface::slotMailsJobTerminated); } } else { QTimer::singleShot(0, this, &ExportMailJobInterface::slotMailsJobTerminated); } } else { QTimer::singleShot(0, this, &ExportMailJobInterface::slotCheckBackupResources); } } void ExportMailJobInterface::backupResources() { setProgressDialogLabel(i18n("Backing up resources...")); for (const Utils::AkonadiInstanceInfo &agent : qAsConst(mAkonadiInstanceInfo)) { const QStringList capabilities(agent.capabilities); if (agent.mimeTypes.contains(KMime::Message::mimeType())) { if (capabilities.contains(QLatin1String("Resource")) && !capabilities.contains(QLatin1String("Virtual")) && !capabilities.contains(QLatin1String("MailTransport"))) { const QString identifier = agent.identifier; //Store just pop3/imap/kolab/gmail account. Store other config when we copy data. if (identifier.contains(QLatin1String("pop3")) || identifier.contains(QLatin1String("imap")) || identifier.contains(QLatin1String("_kolab_")) || identifier.contains(QLatin1String("_gmail_"))) { const QString errorStr = storeResources(archive(), identifier, Utils::resourcesPath()); if (!errorStr.isEmpty()) { Q_EMIT error(errorStr); } } else { qCDebug(PIMDATAEXPORTERCORE_LOG) << " resource \"" << identifier << "\" will not store"; } } } } Q_EMIT info(i18n("Resources backup done.")); } diff --git a/core/mail/exportmailjobinterface.h b/core/mail/exportmailjobinterface.h index 441e0c5..ebc03a8 100644 --- a/core/mail/exportmailjobinterface.h +++ b/core/mail/exportmailjobinterface.h @@ -1,76 +1,77 @@ /* Copyright (C) 2012-2020 Laurent Montel This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef ExportMailJobINTERFACE_H #define ExportMailJobINTERFACE_H #include "abstractimportexportjob.h" #include "pimdataexportercore_private_export.h" #include #include #include namespace MailCommon { class MailFilter; } class ArchiveStorage; class PIMDATAEXPORTER_TESTS_EXPORT ExportMailJobInterface : public AbstractImportExportJob { Q_OBJECT public: explicit ExportMailJobInterface(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep); ~ExportMailJobInterface() override; void start() override; void slotWriteNextArchiveResource(); void slotMailsJobTerminated(); Q_SIGNALS: void taskCanceled(); protected: virtual void convertCollectionIdsToRealPath(KConfigGroup &group, const QString ¤tKey, const QString &prefixCollection = QString()) = 0; virtual void convertCollectionToRealPath(KConfigGroup &group, const QString ¤tKey) = 0; virtual void convertCollectionListToRealPath(KConfigGroup &group, const QString ¤tKey) = 0; void backupResources(); virtual QVector filters() = 0; virtual Q_REQUIRED_RESULT QString convertToFullCollectionPath(const qlonglong collectionValue) = 0; void slotCheckBackupResources(); virtual void exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier) = 0; virtual Q_REQUIRED_RESULT QVector listOfResource() = 0; virtual Q_REQUIRED_RESULT QString storeResources(KZip *archive, const QString &identifier, const QString &path) = 0; virtual Q_REQUIRED_RESULT QString resourcePath(const QString &identifier) const = 0; virtual void backupMailResourceFile(const QString &agentIdentifier, const QString &defaultPath) = 0; virtual void exportFilters() = 0; + virtual Q_REQUIRED_RESULT QVector listIdentityUoid() const = 0; private: void slotCheckBackupIdentity(); void slotCheckBackupMailTransport(); void slotCheckBackupConfig(); void slotCheckBackupMails(); Q_REQUIRED_RESULT bool checkBackupType(Utils::StoredType type) const; void backupTransports(); void backupConfig(); void backupIdentity(); private: int mIndexIdentifier = 0; }; #endif // ExportMailJob_H diff --git a/core/mail/exportmailjobinterfaceimpl.cpp b/core/mail/exportmailjobinterfaceimpl.cpp index 57e6bf1..ee79c02 100644 --- a/core/mail/exportmailjobinterfaceimpl.cpp +++ b/core/mail/exportmailjobinterfaceimpl.cpp @@ -1,161 +1,172 @@ /* Copyright (C) 2020 Laurent Montel This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "exportmailjobinterfaceimpl.h" #include "importexportmailutil.h" #include #include #include #include #include "importexportprogressindicatorbase.h" #include #include #include #include #include #include "pimdataexportcore_debug.h" #include #include #include #include #include "exportresourcearchivejob.h" #include #include "resourceconverterimpl.h" #include #include ExportMailJobInterfaceImpl::ExportMailJobInterfaceImpl(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep) : ExportMailJobInterface(parent, typeSelected, archiveStorage, numberOfStep) { } ExportMailJobInterfaceImpl::~ExportMailJobInterfaceImpl() { } Akonadi::Collection::Id ExportMailJobInterfaceImpl::convertFolderPathToCollectionId(const QString &path) { ResourceConverterImpl converter; return converter.convertFolderPathToCollectionId(path); } void ExportMailJobInterfaceImpl::convertCollectionIdsToRealPath(KConfigGroup &group, const QString ¤tKey, const QString &prefixCollection) { ResourceConverterImpl converter; converter.convertCollectionIdsToRealPath(group, currentKey, prefixCollection); } void ExportMailJobInterfaceImpl::convertCollectionToRealPath(KConfigGroup &group, const QString ¤tKey) { ResourceConverterImpl converter; converter.convertCollectionToRealPath(group, currentKey); } void ExportMailJobInterfaceImpl::convertCollectionListToRealPath(KConfigGroup &group, const QString ¤tKey) { ResourceConverterImpl converter; converter.convertCollectionListToRealPath(group, currentKey); } QVector ExportMailJobInterfaceImpl::filters() { return MailCommon::FilterManager::instance()->filters(); } QString ExportMailJobInterfaceImpl::convertToFullCollectionPath(const qlonglong collectionValue) { ResourceConverterImpl converter; return converter.convertToFullCollectionPath(collectionValue); } QVector ExportMailJobInterfaceImpl::listOfResource() { return Utils::listOfResource(); } void ExportMailJobInterfaceImpl::exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier) { ExportResourceArchiveJob *resourceJob = new ExportResourceArchiveJob(this); resourceJob->setArchivePath(archivePath); resourceJob->setUrl(url); resourceJob->setIdentifier(identifier); resourceJob->setArchive(archive()); resourceJob->setArchiveName(Utils::resourceMailArchiveName()); connect(resourceJob, &ExportResourceArchiveJob::error, this, &ExportMailJobInterfaceImpl::error); connect(resourceJob, &ExportResourceArchiveJob::info, this, &ExportMailJobInterfaceImpl::info); connect(resourceJob, &ExportResourceArchiveJob::terminated, this, &ExportMailJobInterfaceImpl::slotMailsJobTerminated); connect(this, &ExportMailJobInterfaceImpl::taskCanceled, resourceJob, &ExportResourceArchiveJob::slotTaskCanceled); resourceJob->start(); } QString ExportMailJobInterfaceImpl::storeResources(KZip *archive, const QString &identifier, const QString &path) { ResourceConverterImpl converter; return converter.storeResources(archive, identifier, path); } QString ExportMailJobInterfaceImpl::resourcePath(const QString &identifier) const { ResourceConverterImpl converter; const QString url = converter.resourcePath(identifier); return url; } void ExportMailJobInterfaceImpl::backupMailResourceFile(const QString &agentIdentifier, const QString &defaultPath) { backupResourceFile(agentIdentifier, defaultPath); } QString ExportMailJobInterfaceImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) { ResourceConverterImpl converter; return converter.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath); } QString ExportMailJobInterfaceImpl::createResource(const QString &resources, const QString &name, const QMap &settings, bool synchronizeTree) { Q_UNREACHABLE(); return {}; } void ExportMailJobInterfaceImpl::exportFilters() { const QVector lstFilter = filters(); if (!lstFilter.isEmpty()) { QTemporaryFile tmp; tmp.open(); const QUrl url = QUrl::fromLocalFile(tmp.fileName()); MailCommon::FilterImporterExporter exportFilters; exportFilters.exportFilters(lstFilter, url, true); tmp.close(); const bool fileAdded = archive()->addLocalFile(tmp.fileName(), Utils::configsPath() + QStringLiteral("filters")); if (fileAdded) { Q_EMIT info(i18n("Filters backup done.")); } else { Q_EMIT error(i18n("Filters cannot be exported.")); } } } + +QVector ExportMailJobInterfaceImpl::listIdentityUoid() const +{ + QVector listUiod; + KIdentityManagement::IdentityManager::ConstIterator end = mIdentityManager->end(); + for (KIdentityManagement::IdentityManager::ConstIterator it = mIdentityManager->begin(); it != end; ++it) { + const uint identityUoid = (*it).uoid(); + listUiod << identityUoid; + } + return listUiod; +} diff --git a/core/mail/exportmailjobinterfaceimpl.h b/core/mail/exportmailjobinterfaceimpl.h index 9cbdd8d..937b65b 100644 --- a/core/mail/exportmailjobinterfaceimpl.h +++ b/core/mail/exportmailjobinterfaceimpl.h @@ -1,54 +1,55 @@ /* Copyright (C) 2020 Laurent Montel This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef EXPORTMAILJOBINTERFACEIMPL_H #define EXPORTMAILJOBINTERFACEIMPL_H #include "exportmailjobinterface.h" #include "pimdataexportercore_private_export.h" #include #include #include class ArchiveStorage; class PIMDATAEXPORTER_TESTS_EXPORT ExportMailJobInterfaceImpl : public ExportMailJobInterface { Q_OBJECT public: explicit ExportMailJobInterfaceImpl(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep); ~ExportMailJobInterfaceImpl() override; protected: void convertCollectionIdsToRealPath(KConfigGroup &group, const QString ¤tKey, const QString &prefixCollection = QString()) override; void convertCollectionToRealPath(KConfigGroup &group, const QString ¤tKey) override; void convertCollectionListToRealPath(KConfigGroup &group, const QString ¤tKey) override; Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override; Q_REQUIRED_RESULT QVector filters() override; Q_REQUIRED_RESULT QString convertToFullCollectionPath(const qlonglong collectionValue) override; void exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier) override; Q_REQUIRED_RESULT QVector listOfResource() override; Q_REQUIRED_RESULT QString storeResources(KZip *archive, const QString &identifier, const QString &path) override; Q_REQUIRED_RESULT QString resourcePath(const QString &identifier) const override; void backupMailResourceFile(const QString &agentIdentifier, const QString &defaultPath) override; Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override; Q_REQUIRED_RESULT QString createResource(const QString &resources, const QString &name, const QMap &settings, bool synchronizeTree) override; void exportFilters() override; + Q_REQUIRED_RESULT QVector listIdentityUoid() const override; }; #endif // ExportMailJob_H