Commit 09f877b0 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Move backupResources to interface

parent 1ad99634
......@@ -71,11 +71,6 @@ QVector<MailCommon::MailFilter *> ExportMailJobInterfaceTestImpl::filters()
return {};
}
void ExportMailJobInterfaceTestImpl::backupResources()
{
qDebug() << " not implement yet";
}
void ExportMailJobInterfaceTestImpl::exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier)
{
qDebug() << " not implement yet";
......
......@@ -39,7 +39,6 @@ protected:
void convertCollectionListToRealPath(KConfigGroup &group, const QString &currentKey) override;
void convertCollectionIdsToRealPath(KConfigGroup &group, const QString &currentKey, const QString &prefixCollection) override;
void backupResources() override;
Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override;
......
......@@ -636,3 +636,31 @@ void ExportMailJobInterface::slotWriteNextArchiveResource()
}
}
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 = Utils::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."));
}
......@@ -49,7 +49,7 @@ protected:
virtual void convertCollectionToRealPath(KConfigGroup &group, const QString &currentKey) = 0;
virtual void convertCollectionListToRealPath(KConfigGroup &group, const QString &currentKey) = 0;
virtual void exportArchiveResource() = 0;
virtual void backupResources() = 0;
void backupResources();
virtual QVector<MailCommon::MailFilter *> filters() = 0;
virtual Q_REQUIRED_RESULT QString convertToFullCollectionPath(const qlonglong collectionValue) = 0;
void slotCheckBackupResources();
......
......@@ -117,31 +117,3 @@ void ExportMailJobInterfaceImpl::exportResourceToArchive(const QString &archiveP
resourceJob->start();
}
void ExportMailJobInterfaceImpl::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 = Utils::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."));
}
......@@ -44,7 +44,6 @@ protected:
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<Utils::AkonadiInstanceInfo> listOfResource() override;
void backupResources() override;
};
#endif // ExportMailJob_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment