downloadItem->_instruction = CSYNC_INSTRUCTION_SYNC;
}
downloadItem->_direction = SyncFileItem::Down;
- newJob = new PropagateDownloadFileQNAM(_propagator, downloadItem);
+ newJob = new PropagateDownloadFile(_propagator, downloadItem);
} else {
// Directories are harder to recover.
// But just re-create the directory, next sync will be able to recover the files
case CSYNC_INSTRUCTION_SYNC:
case CSYNC_INSTRUCTION_CONFLICT:
if (item->_direction != SyncFileItem::Up) {
- auto job = new PropagateDownloadFileQNAM(this, item);
+ auto job = new PropagateDownloadFile(this, item);
job->setDeleteExistingFolder(deleteExisting);
return job;
} else {
- auto job = new PropagateUploadFileQNAM(this, item);
+ auto job = new PropagateUploadFile(this, item);
job->setDeleteExisting(deleteExisting);
return job;
}
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
// access to signals which are protected in Qt4
- friend class PropagateDownloadFileQNAM;
+ friend class PropagateDownloadFile;
friend class PropagateUploadFileQNAM;
friend class PropagateLocalMkdir;
friend class PropagateLocalRename;
}
}
-void PropagateDownloadFileQNAM::start()
+void PropagateDownloadFile::start()
{
if (_propagator->_abortRequested.fetchAndAddRelaxed(0))
return;
_job->start();
}
-qint64 PropagateDownloadFileQNAM::committedDiskSpace() const
+qint64 PropagateDownloadFile::committedDiskSpace() const
{
if (_state == Running) {
return qBound(0ULL, _item->_size - _resumeStart - _downloadProgress, _item->_size);
return 0;
}
-void PropagateDownloadFileQNAM::setDeleteExistingFolder(bool enabled)
+void PropagateDownloadFile::setDeleteExistingFolder(bool enabled)
{
_deleteExisting = enabled;
}
const char owncloudCustomSoftErrorStringC[] = "owncloud-custom-soft-error-string";
-void PropagateDownloadFileQNAM::slotGetFinished()
+void PropagateDownloadFile::slotGetFinished()
{
_propagator->_activeJobList.removeOne(this);
validator->start(_tmpFile.fileName(), checksumHeader);
}
-void PropagateDownloadFileQNAM::slotChecksumFail( const QString& errMsg )
+void PropagateDownloadFile::slotChecksumFail( const QString& errMsg )
{
FileSystem::remove(_tmpFile.fileName());
_propagator->_anotherSyncNeeded = true;
done(SyncFileItem::SoftError, errMsg ); // tr("The file downloaded with a broken checksum, will be redownloaded."));
}
-void PropagateDownloadFileQNAM::deleteExistingFolder()
+void PropagateDownloadFile::deleteExistingFolder()
{
QString existingDir = _propagator->getFilePath(_item->_file);
if (!QFileInfo(existingDir).isDir()) {
}
} // end namespace
-void PropagateDownloadFileQNAM::transmissionChecksumValidated(const QByteArray &checksumType, const QByteArray &checksum)
+void PropagateDownloadFile::transmissionChecksumValidated(const QByteArray &checksumType, const QByteArray &checksum)
{
const auto theContentChecksumType = contentChecksumType();
computeChecksum->start(_tmpFile.fileName());
}
-void PropagateDownloadFileQNAM::contentChecksumComputed(const QByteArray &checksumType, const QByteArray &checksum)
+void PropagateDownloadFile::contentChecksumComputed(const QByteArray &checksumType, const QByteArray &checksum)
{
_item->_contentChecksum = checksum;
_item->_contentChecksumType = checksumType;
downloadFinished();
}
-void PropagateDownloadFileQNAM::downloadFinished()
+void PropagateDownloadFile::downloadFinished()
{
QString fn = _propagator->getFilePath(_item->_file);
}
}
-void PropagateDownloadFileQNAM::slotDownloadProgress(qint64 received, qint64)
+void PropagateDownloadFile::slotDownloadProgress(qint64 received, qint64)
{
if (!_job) return;
_downloadProgress = received;
}
-void PropagateDownloadFileQNAM::abort()
+void PropagateDownloadFile::abort()
{
if (_job && _job->reply())
_job->reply()->abort();
};
/**
- * @brief The PropagateDownloadFileQNAM class
+ * @brief The PropagateDownloadFile class
* @ingroup libsync
*/
-class PropagateDownloadFileQNAM : public PropagateItemJob {
+class PropagateDownloadFile : public PropagateItemJob {
Q_OBJECT
public:
- PropagateDownloadFileQNAM(OwncloudPropagator* propagator,const SyncFileItemPtr& item)
+ PropagateDownloadFile(OwncloudPropagator* propagator,const SyncFileItemPtr& item)
: PropagateItemJob(propagator, item), _resumeStart(0), _downloadProgress(0), _deleteExisting(false) {}
void start() Q_DECL_OVERRIDE;
qint64 committedDiskSpace() const Q_DECL_OVERRIDE;
return true;
}
-void PropagateUploadFileQNAM::start()
+void PropagateUploadFile::start()
{
if (_propagator->_abortRequested.fetchAndAddRelaxed(0)) {
return;
job->start();
}
-void PropagateUploadFileQNAM::slotComputeContentChecksum()
+void PropagateUploadFile::slotComputeContentChecksum()
{
if (_propagator->_abortRequested.fetchAndAddRelaxed(0)) {
return;
computeChecksum->start(filePath);
}
-void PropagateUploadFileQNAM::setDeleteExisting(bool enabled)
+void PropagateUploadFile::setDeleteExisting(bool enabled)
{
_deleteExisting = enabled;
}
-void PropagateUploadFileQNAM::slotComputeTransmissionChecksum(const QByteArray& contentChecksumType, const QByteArray& contentChecksum)
+void PropagateUploadFile::slotComputeTransmissionChecksum(const QByteArray& contentChecksumType, const QByteArray& contentChecksum)
{
_item->_contentChecksum = contentChecksum;
_item->_contentChecksumType = contentChecksumType;
computeChecksum->start(filePath);
}
-void PropagateUploadFileQNAM::slotStartUpload(const QByteArray& transmissionChecksumType, const QByteArray& transmissionChecksum)
+void PropagateUploadFile::slotStartUpload(const QByteArray& transmissionChecksumType, const QByteArray& transmissionChecksum)
{
// Remove ourselfs from the list of active job, before any posible call to done()
// When we start chunks, we will add it again, once for every chunks.
}
_stopWatch.addLapTime(QLatin1String("TransmissionChecksum"));
- time_t prevModtime = _item->_modtime; // the _item value was set in PropagateUploadFileQNAM::start()
+ time_t prevModtime = _item->_modtime; // the _item value was set in PropagateUploadFile::start()
// but a potential checksum calculation could have taken some time during which the file could
// have been changed again, so better check again here.
}
}
-void PropagateUploadFileQNAM::startNextChunk()
+void PropagateUploadFile::startNextChunk()
{
if (_propagator->_abortRequested.fetchAndAddRelaxed(0))
return;
}
}
-void PropagateUploadFileQNAM::slotPutFinished()
+void PropagateUploadFile::slotPutFinished()
{
PUTFileJob *job = qobject_cast<PUTFileJob *>(sender());
Q_ASSERT(job);
finalize(*_item);
}
-void PropagateUploadFileQNAM::finalize(const SyncFileItem ©)
+void PropagateUploadFile::finalize(const SyncFileItem ©)
{
// Normally, copy == _item, but when it comes from the UpdateMTimeAndETagJob, we need to do
// some updates
done(SyncFileItem::Success);
}
-void PropagateUploadFileQNAM::slotUploadProgress(qint64 sent, qint64 total)
+void PropagateUploadFile::slotUploadProgress(qint64 sent, qint64 total)
{
// Completion is signaled with sent=0, total=0; avoid accidentally
// resetting progress due to the sent being zero by ignoring it.
emit progress(*_item, amount);
}
-void PropagateUploadFileQNAM::startPollJob(const QString& path)
+void PropagateUploadFile::startPollJob(const QString& path)
{
PollJob* job = new PollJob(_propagator->account(), path, _item,
_propagator->_journal, _propagator->_localDir, this);
job->start();
}
-void PropagateUploadFileQNAM::slotPollFinished()
+void PropagateUploadFile::slotPollFinished()
{
PollJob *job = qobject_cast<PollJob *>(sender());
Q_ASSERT(job);
finalize(*job->_item);
}
-void PropagateUploadFileQNAM::slotJobDestroyed(QObject* job)
+void PropagateUploadFile::slotJobDestroyed(QObject* job)
{
_jobs.erase(std::remove(_jobs.begin(), _jobs.end(), job) , _jobs.end());
}
-void PropagateUploadFileQNAM::abort()
+void PropagateUploadFile::abort()
{
foreach(auto *job, _jobs) {
if (job->reply()) {
}
// This function is used whenever there is an error occuring and jobs might be in progress
-void PropagateUploadFileQNAM::abortWithError(SyncFileItem::Status status, const QString &error)
+void PropagateUploadFile::abortWithError(SyncFileItem::Status status, const QString &error)
{
_finished = true;
abort();
};
/**
- * @brief The PropagateUploadFileQNAM class
+ * @brief The PropagateUploadFile class
* @ingroup libsync
*/
-class PropagateUploadFileQNAM : public PropagateItemJob {
+class PropagateUploadFile : public PropagateItemJob {
Q_OBJECT
private:
quint64 chunkSize() const { return _propagator->chunkSize(); }
public:
- PropagateUploadFileQNAM(OwncloudPropagator* propagator,const SyncFileItemPtr& item)
+ PropagateUploadFile(OwncloudPropagator* propagator,const SyncFileItemPtr& item)
: PropagateItemJob(propagator, item), _startChunk(0), _currentChunk(0), _chunkCount(0), _transferId(0), _finished(false), _deleteExisting(false) {}
void start() Q_DECL_OVERRIDE;