Commit 70f391f7 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

return resource zip name

parent e54b5806
......@@ -109,6 +109,10 @@ protected:
void storeDirectory(const QString &subDirectory);
void importDataSubdirectory(const QString &subdirectoryRelativePath);
void convertCollectionListStrToAkonadiId(const KSharedConfig::Ptr &config, const QString &groupName, const QString &key, bool addCollectionPrefix);
void convertRealPathToCollectionList(KConfigGroup &group, const QString &currentKey, bool addCollectionPrefix = true);
virtual Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) = 0;
QHash<QString, Akonadi::Collection::Id> mHashConvertPathCollectionId;
QVector<ResourceFiles> mListResourceFile;
......@@ -126,9 +130,6 @@ protected:
int mIndex = -1;
static int sArchiveVersion;
void convertCollectionListStrToAkonadiId(const KSharedConfig::Ptr &config, const QString &groupName, const QString &key, bool addCollectionPrefix);
void convertRealPathToCollectionList(KConfigGroup &group, const QString &currentKey, bool addCollectionPrefix = true);
virtual Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) = 0;
private:
void slotAllResourceSynchronized();
void slotSynchronizeInstanceDone(const QString &, const QString &identifier);
......
......@@ -75,7 +75,7 @@ void ExportAddressbookJobInterfaceImpl::exportResourceToArchive(const QString &a
resourceJob->setUrl(url);
resourceJob->setIdentifier(identifier);
resourceJob->setArchive(archive());
resourceJob->setArchiveName(QStringLiteral("addressbook.zip"));
resourceJob->setArchiveName(Utils::resourceAddressbookArchiveName());
connect(resourceJob, &ExportResourceArchiveJob::error, this, &ExportAddressbookJobInterfaceImpl::error);
connect(resourceJob, &ExportResourceArchiveJob::info, this, &ExportAddressbookJobInterfaceImpl::info);
connect(resourceJob, &ExportResourceArchiveJob::terminated, this, &ExportAddressbookJobInterfaceImpl::slotAddressbookJobTerminated);
......
......@@ -75,16 +75,7 @@ void ExportAlarmJobInterface::slotWriteNextArchiveResource()
if (!mAgentPaths.contains(url)) {
if (!url.isEmpty()) {
mAgentPaths << url;
ExportResourceArchiveJob *resourceJob = new ExportResourceArchiveJob(this);
resourceJob->setArchivePath(archivePath);
resourceJob->setUrl(url);
resourceJob->setIdentifier(identifier);
resourceJob->setArchive(archive());
resourceJob->setArchiveName(QStringLiteral("alarm.zip"));
connect(resourceJob, &ExportResourceArchiveJob::error, this, &ExportAlarmJobInterface::error);
connect(resourceJob, &ExportResourceArchiveJob::info, this, &ExportAlarmJobInterface::info);
connect(resourceJob, &ExportResourceArchiveJob::terminated, this, &ExportAlarmJobInterface::slotAlarmJobTerminated);
resourceJob->start();
exportResourceToArchive(archivePath, url, identifier);
} else {
qCDebug(PIMDATAEXPORTERCORE_LOG) << "Url is empty for " << identifier;
QTimer::singleShot(0, this, &ExportAlarmJobInterface::slotAlarmJobTerminated);
......
......@@ -63,7 +63,7 @@ void ExportAlarmJobInterfaceImpl::exportResourceToArchive(const QString &archive
resourceJob->setUrl(url);
resourceJob->setIdentifier(identifier);
resourceJob->setArchive(archive());
resourceJob->setArchiveName(QStringLiteral("alarm.zip"));
resourceJob->setArchiveName(Utils::resourceAlarmArchiveName());
connect(resourceJob, &ExportResourceArchiveJob::error, this, &ExportAlarmJobInterfaceImpl::error);
connect(resourceJob, &ExportResourceArchiveJob::info, this, &ExportAlarmJobInterfaceImpl::info);
connect(resourceJob, &ExportResourceArchiveJob::terminated, this, &ExportAlarmJobInterfaceImpl::slotAlarmJobTerminated);
......
......@@ -62,7 +62,7 @@ void ExportNotesJobInterfaceTestImpl::exportResourceToArchive(const QString &arc
QVERIFY(identifier.startsWith(QLatin1String("akonadi_akonotes_resource_")));
qDebug() << "11 " << url + identifier + QLatin1String(".zip");
qDebug() << "22 " << archivePath + identifier + QLatin1String(".zip");
QVERIFY(mArchiveStorage->archive()->addLocalFile(url + identifier + QLatin1String(".zip"), archivePath + identifier + QLatin1String(".zip")));
QVERIFY(mArchiveStorage->archive()->addLocalFile(url + identifier + QLatin1String(".zip"), archivePath + Utils::resourceNoteArchiveName()));
slotNoteJobTerminated();
}
......
......@@ -78,7 +78,7 @@ void ExportCalendarJobInterfaceImpl::exportResourceToArchive(const QString &arch
resourceJob->setUrl(url);
resourceJob->setIdentifier(identifier);
resourceJob->setArchive(archive());
resourceJob->setArchiveName(QStringLiteral("calendar.zip"));
resourceJob->setArchiveName(Utils::resourceCalendarArchiveName());
connect(resourceJob, &ExportResourceArchiveJob::error, this, &ExportCalendarJobInterfaceImpl::error);
connect(resourceJob, &ExportResourceArchiveJob::info, this, &ExportCalendarJobInterfaceImpl::info);
connect(resourceJob, &ExportResourceArchiveJob::terminated, this, &ExportCalendarJobInterfaceImpl::slotCalendarJobTerminated);
......
......@@ -106,7 +106,7 @@ void ExportMailJobInterfaceImpl::exportResourceToArchive(const QString &archiveP
resourceJob->setUrl(url);
resourceJob->setIdentifier(identifier);
resourceJob->setArchive(archive());
resourceJob->setArchiveName(QStringLiteral("mail.zip"));
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);
......
......@@ -43,6 +43,7 @@ protected:
virtual Q_REQUIRED_RESULT QVector<Utils::AkonadiInstanceInfo> listOfResource() = 0;
void slotNoteJobTerminated();
virtual Q_REQUIRED_RESULT QString resourcePath(const QString &identifier) const = 0;
Q_REQUIRED_RESULT QString resourceArchiveName() const;
private:
void slotCheckBackupResource();
......
......@@ -68,7 +68,7 @@ void ExportNotesJobInterfaceImpl::exportResourceToArchive(const QString &archive
resourceJob->setUrl(url);
resourceJob->setIdentifier(identifier);
resourceJob->setArchive(archive());
resourceJob->setArchiveName(QStringLiteral("notes.zip"));
resourceJob->setArchiveName(Utils::resourceNoteArchiveName());
connect(resourceJob, &ExportResourceArchiveJob::error, this, &ExportNotesJobInterfaceImpl::error);
connect(resourceJob, &ExportResourceArchiveJob::info, this, &ExportNotesJobInterfaceImpl::info);
connect(resourceJob, &ExportResourceArchiveJob::terminated, this, &ExportNotesJobInterfaceImpl::slotNoteJobTerminated);
......
......@@ -266,3 +266,29 @@ QVector<Utils::AkonadiInstanceInfo> Utils::listOfResource()
}
return instanceInfoList;
}
QString Utils::resourceNoteArchiveName()
{
return QStringLiteral("notes.zip");
}
QString Utils::resourceAddressbookArchiveName()
{
return QStringLiteral("addressbook.zip");
}
QString Utils::resourceAlarmArchiveName()
{
return QStringLiteral("alarm.zip");
}
QString Utils::resourceCalendarArchiveName()
{
return QStringLiteral("calendar.zip");
}
QString Utils::resourceMailArchiveName()
{
return QStringLiteral("mail.zip");
}
......@@ -91,6 +91,14 @@ PIMDATAEXPORTER_EXPORT Q_REQUIRED_RESULT QString addressbookPath();
PIMDATAEXPORTER_EXPORT Q_REQUIRED_RESULT QString alarmPath();
PIMDATAEXPORTER_EXPORT Q_REQUIRED_RESULT QString infoPath();
PIMDATAEXPORTER_EXPORT Q_REQUIRED_RESULT QString notePath();
PIMDATAEXPORTER_EXPORT Q_REQUIRED_RESULT QString resourceNoteArchiveName();
PIMDATAEXPORTER_EXPORT Q_REQUIRED_RESULT QString resourceAddressbookArchiveName();
PIMDATAEXPORTER_EXPORT Q_REQUIRED_RESULT QString resourceAlarmArchiveName();
PIMDATAEXPORTER_EXPORT Q_REQUIRED_RESULT QString resourceCalendarArchiveName();
PIMDATAEXPORTER_EXPORT Q_REQUIRED_RESULT QString resourceMailArchiveName();
PIMDATAEXPORTER_EXPORT Q_REQUIRED_RESULT QString prefixAkonadiConfigFile();
PIMDATAEXPORTER_EXPORT Q_REQUIRED_RESULT QString exportDataTypeFileName();
Q_REQUIRED_RESULT QString akonadiAgentName(const QString &configPath);
......
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