Commit 4e11ea93 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Export caldav resource

parent f5a53100
Pipeline #94746 passed with stage
in 11 minutes and 23 seconds
......@@ -21,6 +21,17 @@ BackupResourceFileJobBase::~BackupResourceFileJobBase()
{
}
void BackupResourceFileJobBase::storeResource(const QString &archivePath)
{
auto job = new StoreResourceJob(this);
connect(job, &StoreResourceJob::error, this, &BackupResourceFileJobBase::error);
connect(job, &StoreResourceJob::info, this, &BackupResourceFileJobBase::info);
job->setArchivePath(archivePath);
job->setZip(mZip);
job->setIdentifier(mIdentifier);
job->start();
}
void BackupResourceFileJobBase::start()
{
if (!canStart()) {
......@@ -40,22 +51,15 @@ void BackupResourceFileJobBase::start()
const QString filename = fi.fileName();
const bool fileAdded = mZip->addLocalFile(url, archivePath + filename);
if (fileAdded) {
storeResource(archivePath);
Q_EMIT info(i18n("\"%1\" was backed up.", filename));
auto job = new StoreResourceJob(this);
connect(job, &StoreResourceJob::error, this, &BackupResourceFileJobBase::error);
connect(job, &StoreResourceJob::info, this, &BackupResourceFileJobBase::info);
job->setArchivePath(archivePath);
job->setZip(mZip);
job->setIdentifier(mIdentifier);
job->start();
} else {
Q_EMIT error(i18n("\"%1\" file cannot be added to backup file.", filename));
}
}
} else {
qCWarning(PIMDATAEXPORTERCORE_LOG) << "resource not added : " << mIdentifier;
Q_EMIT error(i18n("\"%1\" resource not added.", mIdentifier));
storeResource(archivePath);
Q_EMIT info(i18n("\"%1\" was backed up.", mIdentifier));
}
deleteLater();
}
......
......@@ -36,6 +36,7 @@ Q_SIGNALS:
void info(const QString &);
private:
void storeResource(const QString &archivePath);
QString mDefaultPath;
QString mIdentifier;
KZip *mZip = nullptr;
......
Supports Markdown
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