Commit aca4ab7c authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add more virtual method

parent bc1563da
......@@ -38,6 +38,7 @@ protected:
virtual void convertCollectionToRealPath(KConfigGroup &group, const QString &currentKey) = 0;
virtual void convertCollectionListToRealPath(KConfigGroup &group, const QString &currentKey) = 0;
void slotCheckBackupConfig();
virtual void exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier) = 0;
private:
void slotCheckBackupResource();
......
......@@ -71,16 +71,7 @@ void ExportAddressbookJobInterfaceImpl::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("addressbook.zip"));
connect(resourceJob, &ExportResourceArchiveJob::error, this, &ExportAddressbookJobInterfaceImpl::error);
connect(resourceJob, &ExportResourceArchiveJob::info, this, &ExportAddressbookJobInterfaceImpl::info);
connect(resourceJob, &ExportResourceArchiveJob::terminated, this, &ExportAddressbookJobInterfaceImpl::slotAddressbookJobTerminated);
resourceJob->start();
exportResourceToArchive(archivePath, url, identifier);
} else {
qCDebug(PIMDATAEXPORTERCORE_LOG) << "Url is empty for " << identifier;
QTimer::singleShot(0, this, &ExportAddressbookJobInterfaceImpl::slotAddressbookJobTerminated);
......@@ -117,3 +108,17 @@ Akonadi::Collection::Id ExportAddressbookJobInterfaceImpl::convertFolderPathToCo
ResourceConverterImpl converter;
return converter.convertFolderPathToCollectionId(path);
}
void ExportAddressbookJobInterfaceImpl::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(QStringLiteral("addressbook.zip"));
connect(resourceJob, &ExportResourceArchiveJob::error, this, &ExportAddressbookJobInterfaceImpl::error);
connect(resourceJob, &ExportResourceArchiveJob::info, this, &ExportAddressbookJobInterfaceImpl::info);
connect(resourceJob, &ExportResourceArchiveJob::terminated, this, &ExportAddressbookJobInterfaceImpl::slotAddressbookJobTerminated);
resourceJob->start();
}
......@@ -36,6 +36,7 @@ protected:
void convertCollectionToRealPath(KConfigGroup &group, const QString &currentKey) override;
void convertCollectionListToRealPath(KConfigGroup &group, const QString &currentKey) override;
Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override;
void exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier) override;
private:
void slotWriteNextArchiveResource();
void slotAddressbookJobTerminated();
......
......@@ -35,6 +35,7 @@ public:
protected:
virtual void exportArchiveResource() = 0;
void slotCheckBackupConfig();
virtual void exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier) = 0;
private:
void slotCheckBackupResource();
......
......@@ -107,3 +107,17 @@ Akonadi::Collection::Id ExportAlarmJobInterfaceImpl::convertFolderPathToCollecti
ResourceConverterImpl converter;
return converter.convertFolderPathToCollectionId(path);
}
void ExportAlarmJobInterfaceImpl::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(QStringLiteral("alarm.zip"));
connect(resourceJob, &ExportResourceArchiveJob::error, this, &ExportAlarmJobInterfaceImpl::error);
connect(resourceJob, &ExportResourceArchiveJob::info, this, &ExportAlarmJobInterfaceImpl::info);
connect(resourceJob, &ExportResourceArchiveJob::terminated, this, &ExportAlarmJobInterfaceImpl::slotAlarmJobTerminated);
resourceJob->start();
}
......@@ -35,6 +35,7 @@ protected:
void exportArchiveResource() override;
Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override;
void exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier) override;
private:
void slotAlarmJobTerminated();
void slotWriteNextArchiveResource();
......
......@@ -46,6 +46,11 @@ Akonadi::Collection::Id ExportAddressbookJobInterfaceTestImpl::convertFolderPath
return resourceConverterTest.convertFolderPathToCollectionId(path);
}
void ExportAddressbookJobInterfaceTestImpl::exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier)
{
//TODO implement it
}
void ExportAddressbookJobInterfaceTestImpl::convertCollectionToRealPath(KConfigGroup &group, const QString &currentKey)
{
ResourceConverterTest resourceConverter;
......
......@@ -38,6 +38,7 @@ protected:
void convertCollectionToRealPath(KConfigGroup &group, const QString &currentKey) override;
void convertCollectionListToRealPath(KConfigGroup &group, const QString &currentKey) override;
Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override;
void exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier) override;
};
class ExportAddressbookJobInterfaceTest : public QObject
......
......@@ -47,6 +47,11 @@ Akonadi::Collection::Id ExportAlarmJobInterfaceTestImpl::convertFolderPathToColl
return resourceConverterTest.convertFolderPathToCollectionId(path);
}
void ExportAlarmJobInterfaceTestImpl::exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier)
{
//TODO implement me
}
ExportAlarmJobInterfaceTest::ExportAlarmJobInterfaceTest(QObject *parent)
: QObject(parent)
{
......
......@@ -34,6 +34,7 @@ public:
protected:
void exportArchiveResource() override;
Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override;
void exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier) override;
};
class ExportAlarmJobInterfaceTest : public QObject
......
......@@ -52,6 +52,11 @@ QString ExportCalendarsJobInterfaceTestImpl::convertToFullCollectionPath(const q
return resourceConverterTest.convertToFullCollectionPath(collectionValue);
}
void ExportCalendarsJobInterfaceTestImpl::exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier)
{
//TODO implement it
}
void ExportCalendarsJobInterfaceTestImpl::convertCollectionListToRealPath(KConfigGroup &group, const QString &currentKey)
{
ResourceConverterTest converter;
......@@ -80,3 +85,4 @@ void ExportCalendarsJobInterfaceTest::exportCalendarConfig()
file->start();
delete exportNote;
}
......@@ -36,6 +36,7 @@ protected:
Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override;
Q_REQUIRED_RESULT QString convertToFullCollectionPath(const qlonglong collectionValue) override;
void convertCollectionListToRealPath(KConfigGroup &group, const QString &currentKey) override;
void exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier) override;
};
class ExportCalendarsJobInterfaceTest : public QObject
......
......@@ -76,6 +76,12 @@ void ExportMailJobInterfaceTestImpl::backupResources()
qDebug() << " not implement yet";
}
void ExportMailJobInterfaceTestImpl::exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier)
{
qDebug() << " not implement yet";
}
ExportMailJobInterfaceTest::ExportMailJobInterfaceTest(QObject *parent)
: QObject(parent)
{
......@@ -106,3 +112,4 @@ QString ExportMailJobInterfaceTestImpl::convertToFullCollectionPath(const qlongl
ResourceConverterTest converter;
return converter.convertToFullCollectionPath(collectionValue);
}
......@@ -46,6 +46,7 @@ protected:
Q_REQUIRED_RESULT QVector<MailCommon::MailFilter *> filters() override;
Q_REQUIRED_RESULT QString convertToFullCollectionPath(const qlonglong collectionValue) override;
void exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier) override;
};
class ExportMailJobInterfaceTest : public QObject
......
......@@ -46,6 +46,12 @@ void ExportNotesJobInterfaceTestImpl::exportArchiveResource()
qDebug() << " not implement yet";
}
void ExportNotesJobInterfaceTestImpl::exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier)
{
//TODO implement it
}
Akonadi::Collection::Id ExportNotesJobInterfaceTestImpl::convertFolderPathToCollectionId(const QString &path)
{
ResourceConverterTest resourceConverterTest;
......@@ -75,3 +81,4 @@ void ExportNotesJobInterfaceTest::exportNoteConfig()
file->start();
delete exportNote;
}
......@@ -35,6 +35,7 @@ protected:
void exportArchiveResource() override;
void convertCollectionIdsToRealPath(KConfigGroup &selectFolderNoteGroup, const QString &selectFolderNoteGroupStr) override;
Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override;
void exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier) override;
};
class ExportNotesJobInterfaceTest : public QObject
......
......@@ -38,6 +38,7 @@ protected:
void slotCheckBackupConfig();
virtual Q_REQUIRED_RESULT QString convertToFullCollectionPath(const qlonglong collectionValue) = 0;
virtual void convertCollectionListToRealPath(KConfigGroup &group, const QString &currentKey) = 0;
virtual void exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier) = 0;
private:
void slotCheckBackupResource();
......
......@@ -86,16 +86,7 @@ void ExportCalendarJobInterfaceImpl::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("calendar.zip"));
connect(resourceJob, &ExportResourceArchiveJob::error, this, &ExportCalendarJobInterfaceImpl::error);
connect(resourceJob, &ExportResourceArchiveJob::info, this, &ExportCalendarJobInterfaceImpl::info);
connect(resourceJob, &ExportResourceArchiveJob::terminated, this, &ExportCalendarJobInterfaceImpl::slotCalendarJobTerminated);
resourceJob->start();
exportResourceToArchive(archivePath, url, identifier);
} else {
qCDebug(PIMDATAEXPORTERCORE_LOG) << "Url is empty for " << identifier;
QTimer::singleShot(0, this, &ExportCalendarJobInterfaceImpl::slotCalendarJobTerminated);
......@@ -120,3 +111,17 @@ QString ExportCalendarJobInterfaceImpl::convertToFullCollectionPath(const qlongl
ResourceConverterImpl converter;
return converter.convertToFullCollectionPath(collectionValue);
}
void ExportCalendarJobInterfaceImpl::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(QStringLiteral("calendar.zip"));
connect(resourceJob, &ExportResourceArchiveJob::error, this, &ExportCalendarJobInterfaceImpl::error);
connect(resourceJob, &ExportResourceArchiveJob::info, this, &ExportCalendarJobInterfaceImpl::info);
connect(resourceJob, &ExportResourceArchiveJob::terminated, this, &ExportCalendarJobInterfaceImpl::slotCalendarJobTerminated);
resourceJob->start();
}
......@@ -36,7 +36,7 @@ protected:
Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override;
Q_REQUIRED_RESULT QString convertToFullCollectionPath(const qlonglong collectionValue) override;
void convertCollectionListToRealPath(KConfigGroup &group, const QString &currentKey) override;
void exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier) override;
private:
void slotCalendarJobTerminated();
void slotWriteNextArchiveResource();
......
......@@ -51,6 +51,7 @@ protected:
virtual QVector<MailCommon::MailFilter *> 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;
private:
void slotCheckBackupIdentity();
void slotCheckBackupMailTransport();
......
......@@ -91,17 +91,7 @@ void ExportMailJobInterfaceImpl::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("mail.zip"));
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();
exportResourceToArchive(archivePath, url, identifier);
} else {
qCDebug(PIMDATAEXPORTERCORE_LOG) << "Url is empty for " << identifier;
QTimer::singleShot(0, this, &ExportMailJobInterfaceImpl::slotMailsJobTerminated);
......@@ -126,6 +116,21 @@ void ExportMailJobInterfaceImpl::slotWriteNextArchiveResource()
}
}
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(QStringLiteral("mail.zip"));
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();
}
void ExportMailJobInterfaceImpl::backupResources()
{
setProgressDialogLabel(i18n("Backing up resources..."));
......
......@@ -43,6 +43,7 @@ protected:
Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override;
Q_REQUIRED_RESULT QVector<MailCommon::MailFilter *> filters() override;
Q_REQUIRED_RESULT QString convertToFullCollectionPath(const qlonglong collectionValue) override;
void exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier) override;
private:
void slotCheckBackupMails();
void slotWriteNextArchiveResource();
......
......@@ -38,6 +38,7 @@ public:
protected:
virtual void exportArchiveResource() = 0;
virtual void convertCollectionIdsToRealPath(KConfigGroup &selectFolderNoteGroup, const QString &selectFolderNoteGroupStr) = 0;
virtual void exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier) = 0;
private:
void slotCheckBackupResource();
......
......@@ -66,16 +66,7 @@ void ExportNotesJobInterfaceImpl::slotWriteNextArchiveResource()
if (!mAgentPaths.contains(url) && QDir(url).exists()) {
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("notes.zip"));
connect(resourceJob, &ExportResourceArchiveJob::error, this, &ExportNotesJobInterfaceImpl::error);
connect(resourceJob, &ExportResourceArchiveJob::info, this, &ExportNotesJobInterfaceImpl::info);
connect(resourceJob, &ExportResourceArchiveJob::terminated, this, &ExportNotesJobInterfaceImpl::slotNoteJobTerminated);
resourceJob->start();
exportResourceToArchive(archivePath, url, identifier);
} else {
qCDebug(PIMDATAEXPORTERCORE_LOG) << "Url is empty for " << identifier;
QTimer::singleShot(0, this, &ExportNotesJobInterfaceImpl::slotNoteJobTerminated);
......@@ -108,3 +99,18 @@ Akonadi::Collection::Id ExportNotesJobInterfaceImpl::convertFolderPathToCollecti
ResourceConverterImpl converter;
return converter.convertFolderPathToCollectionId(path);
}
void ExportNotesJobInterfaceImpl::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(QStringLiteral("notes.zip"));
connect(resourceJob, &ExportResourceArchiveJob::error, this, &ExportNotesJobInterfaceImpl::error);
connect(resourceJob, &ExportResourceArchiveJob::info, this, &ExportNotesJobInterfaceImpl::info);
connect(resourceJob, &ExportResourceArchiveJob::terminated, this, &ExportNotesJobInterfaceImpl::slotNoteJobTerminated);
resourceJob->start();
}
......@@ -35,6 +35,7 @@ protected:
void exportArchiveResource() override;
void convertCollectionIdsToRealPath(KConfigGroup &selectFolderNoteGroup, const QString &selectFolderNoteGroupStr) override;
Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override;
void exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier) override;
private:
void slotNoteJobTerminated();
void slotWriteNextArchiveResource();
......
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