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

Continue to implement interface

parent 848dceb3
......@@ -30,6 +30,12 @@ public:
: QObject(parent)
{}
virtual void writeNextArchiveResource() = 0;
Q_SIGNALS:
void info(const QString &);
void error(const QString &);
void title(const QString &);
void jobFinished();
};
#endif // EXPORTNOTESJOBINTERFACE_H
......@@ -24,11 +24,13 @@
#include <AkonadiCore/AgentManager>
#include <QDir>
#include <QTimer>
#include <abstractimportexportjob.h>
#include <exportresourcearchivejob.h>
ExportNotesJobInterfaceImpl::ExportNotesJobInterfaceImpl(QObject *parent)
ExportNotesJobInterfaceImpl::ExportNotesJobInterfaceImpl(AbstractImportExportJob *importExportJob, QObject *parent)
: ExportNotesJobInterface(parent)
, mImportExportJob(importExportJob)
{
}
......@@ -61,8 +63,8 @@ void ExportNotesJobInterfaceImpl::slotWriteNextArchiveResource()
resourceJob->setIdentifier(identifier);
resourceJob->setArchive(archive());
resourceJob->setArchiveName(QStringLiteral("notes.zip"));
connect(resourceJob, &ExportResourceArchiveJob::error, this, &ExportNotesJob::error);
connect(resourceJob, &ExportResourceArchiveJob::info, this, &ExportNotesJob::info);
connect(resourceJob, &ExportResourceArchiveJob::error, this, &ExportNotesJobInterfaceImpl::error);
connect(resourceJob, &ExportResourceArchiveJob::info, this, &ExportNotesJobInterfaceImpl::info);
connect(resourceJob, &ExportResourceArchiveJob::terminated, this, &ExportNotesJobInterfaceImpl::slotNoteJobTerminated);
resourceJob->start();
} else {
......@@ -83,7 +85,7 @@ void ExportNotesJobInterfaceImpl::slotWriteNextArchiveResource()
void ExportNotesJobInterfaceImpl::slotNoteJobTerminated()
{
if (wasCanceled()) {
if (mImportExportJob->wasCanceled()) {
Q_EMIT jobFinished();
return;
}
......
......@@ -21,12 +21,12 @@
#define EXPORTNOTESJOBINTERFACEIMPL_H
#include "exportnotesjobinterface.h"
class AbstractImportExportJob;
class ExportNotesJobInterfaceImpl : public ExportNotesJobInterface
{
Q_OBJECT
public:
explicit ExportNotesJobInterfaceImpl(QObject *parent = nullptr);
explicit ExportNotesJobInterfaceImpl(AbstractImportExportJob *importExportJob, QObject *parent = nullptr);
~ExportNotesJobInterfaceImpl();
void writeNextArchiveResource() override;
......@@ -35,6 +35,7 @@ private:
void slotWriteNextArchiveResource();
void slotNoteJobTerminated();
int mIndexIdentifier = 0;
AbstractImportExportJob *mImportExportJob = nullptr;
};
#endif // EXPORTNOTESJOBINTERFACEIMPL_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