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

Add canStart method

parent 533bd55c
......@@ -20,6 +20,7 @@
#include "backupresourcefilejob.h"
#include "resourceconverterimpl.h"
#include "storeresourcejob.h"
#include "pimdataexportcore_debug.h"
#include <KLocalizedString>
......@@ -38,10 +39,16 @@ backupResourceFileJob::~backupResourceFileJob()
void backupResourceFileJob::start()
{
if (!canStart()) {
qCWarning(PIMDATAEXPORTERCORE_LOG) << "Impossible to start backupResourceFileJob";
deleteLater();
return;
}
const QString archivePath = mDefaultPath + mIdentifier + QLatin1Char('/');
ResourceConverterImpl converter;
QString url = converter.resourcePath(mIdentifier);
const QString url = converter.resourcePath(mIdentifier);
if (!url.isEmpty()) {
QFileInfo fi(url);
QString filename = fi.fileName();
......@@ -63,6 +70,11 @@ void backupResourceFileJob::start()
deleteLater();
}
bool backupResourceFileJob::canStart() const
{
return mZip && !mDefaultPath.isEmpty() && !mIdentifier.isEmpty();
}
QString backupResourceFileJob::identifier() const
{
return mIdentifier;
......
......@@ -33,6 +33,8 @@ public:
void start();
Q_REQUIRED_RESULT bool canStart() const;
Q_REQUIRED_RESULT QString identifier() const;
void setIdentifier(const QString &identifier);
......
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