mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 09:30:13 +03:00
Propagator, remove the QNAM in the name as the alternative has been removed a long time ago
This commit is contained in:
parent
39e93768ea
commit
d2bde5489f
6 changed files with 36 additions and 36 deletions
|
@ -201,7 +201,7 @@ bool PropagateItemJob::checkForProblemsWithShared(int httpStatusCode, const QStr
|
||||||
downloadItem->_instruction = CSYNC_INSTRUCTION_SYNC;
|
downloadItem->_instruction = CSYNC_INSTRUCTION_SYNC;
|
||||||
}
|
}
|
||||||
downloadItem->_direction = SyncFileItem::Down;
|
downloadItem->_direction = SyncFileItem::Down;
|
||||||
newJob = new PropagateDownloadFileQNAM(_propagator, downloadItem);
|
newJob = new PropagateDownloadFile(_propagator, downloadItem);
|
||||||
} else {
|
} else {
|
||||||
// Directories are harder to recover.
|
// Directories are harder to recover.
|
||||||
// But just re-create the directory, next sync will be able to recover the files
|
// But just re-create the directory, next sync will be able to recover the files
|
||||||
|
@ -266,11 +266,11 @@ PropagateItemJob* OwncloudPropagator::createJob(const SyncFileItemPtr &item) {
|
||||||
case CSYNC_INSTRUCTION_SYNC:
|
case CSYNC_INSTRUCTION_SYNC:
|
||||||
case CSYNC_INSTRUCTION_CONFLICT:
|
case CSYNC_INSTRUCTION_CONFLICT:
|
||||||
if (item->_direction != SyncFileItem::Up) {
|
if (item->_direction != SyncFileItem::Up) {
|
||||||
auto job = new PropagateDownloadFileQNAM(this, item);
|
auto job = new PropagateDownloadFile(this, item);
|
||||||
job->setDeleteExistingFolder(deleteExisting);
|
job->setDeleteExistingFolder(deleteExisting);
|
||||||
return job;
|
return job;
|
||||||
} else {
|
} else {
|
||||||
auto job = new PropagateUploadFileQNAM(this, item);
|
auto job = new PropagateUploadFile(this, item);
|
||||||
job->setDeleteExisting(deleteExisting);
|
job->setDeleteExisting(deleteExisting);
|
||||||
return job;
|
return job;
|
||||||
}
|
}
|
||||||
|
|
|
@ -378,7 +378,7 @@ private:
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||||
// access to signals which are protected in Qt4
|
// access to signals which are protected in Qt4
|
||||||
friend class PropagateDownloadFileQNAM;
|
friend class PropagateDownloadFile;
|
||||||
friend class PropagateUploadFileQNAM;
|
friend class PropagateUploadFileQNAM;
|
||||||
friend class PropagateLocalMkdir;
|
friend class PropagateLocalMkdir;
|
||||||
friend class PropagateLocalRename;
|
friend class PropagateLocalRename;
|
||||||
|
|
|
@ -304,7 +304,7 @@ QString GETFileJob::errorString() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropagateDownloadFileQNAM::start()
|
void PropagateDownloadFile::start()
|
||||||
{
|
{
|
||||||
if (_propagator->_abortRequested.fetchAndAddRelaxed(0))
|
if (_propagator->_abortRequested.fetchAndAddRelaxed(0))
|
||||||
return;
|
return;
|
||||||
|
@ -418,7 +418,7 @@ void PropagateDownloadFileQNAM::start()
|
||||||
_job->start();
|
_job->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 PropagateDownloadFileQNAM::committedDiskSpace() const
|
qint64 PropagateDownloadFile::committedDiskSpace() const
|
||||||
{
|
{
|
||||||
if (_state == Running) {
|
if (_state == Running) {
|
||||||
return qBound(0ULL, _item->_size - _resumeStart - _downloadProgress, _item->_size);
|
return qBound(0ULL, _item->_size - _resumeStart - _downloadProgress, _item->_size);
|
||||||
|
@ -426,13 +426,13 @@ qint64 PropagateDownloadFileQNAM::committedDiskSpace() const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropagateDownloadFileQNAM::setDeleteExistingFolder(bool enabled)
|
void PropagateDownloadFile::setDeleteExistingFolder(bool enabled)
|
||||||
{
|
{
|
||||||
_deleteExisting = enabled;
|
_deleteExisting = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char owncloudCustomSoftErrorStringC[] = "owncloud-custom-soft-error-string";
|
const char owncloudCustomSoftErrorStringC[] = "owncloud-custom-soft-error-string";
|
||||||
void PropagateDownloadFileQNAM::slotGetFinished()
|
void PropagateDownloadFile::slotGetFinished()
|
||||||
{
|
{
|
||||||
_propagator->_activeJobList.removeOne(this);
|
_propagator->_activeJobList.removeOne(this);
|
||||||
|
|
||||||
|
@ -565,14 +565,14 @@ void PropagateDownloadFileQNAM::slotGetFinished()
|
||||||
validator->start(_tmpFile.fileName(), checksumHeader);
|
validator->start(_tmpFile.fileName(), checksumHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropagateDownloadFileQNAM::slotChecksumFail( const QString& errMsg )
|
void PropagateDownloadFile::slotChecksumFail( const QString& errMsg )
|
||||||
{
|
{
|
||||||
FileSystem::remove(_tmpFile.fileName());
|
FileSystem::remove(_tmpFile.fileName());
|
||||||
_propagator->_anotherSyncNeeded = true;
|
_propagator->_anotherSyncNeeded = true;
|
||||||
done(SyncFileItem::SoftError, errMsg ); // tr("The file downloaded with a broken checksum, will be redownloaded."));
|
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);
|
QString existingDir = _propagator->getFilePath(_item->_file);
|
||||||
if (!QFileInfo(existingDir).isDir()) {
|
if (!QFileInfo(existingDir).isDir()) {
|
||||||
|
@ -653,7 +653,7 @@ static void preserveGroupOwnership(const QString& fileName, const QFileInfo& fi)
|
||||||
}
|
}
|
||||||
} // end namespace
|
} // end namespace
|
||||||
|
|
||||||
void PropagateDownloadFileQNAM::transmissionChecksumValidated(const QByteArray &checksumType, const QByteArray &checksum)
|
void PropagateDownloadFile::transmissionChecksumValidated(const QByteArray &checksumType, const QByteArray &checksum)
|
||||||
{
|
{
|
||||||
const auto theContentChecksumType = contentChecksumType();
|
const auto theContentChecksumType = contentChecksumType();
|
||||||
|
|
||||||
|
@ -674,7 +674,7 @@ void PropagateDownloadFileQNAM::transmissionChecksumValidated(const QByteArray &
|
||||||
computeChecksum->start(_tmpFile.fileName());
|
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->_contentChecksum = checksum;
|
||||||
_item->_contentChecksumType = checksumType;
|
_item->_contentChecksumType = checksumType;
|
||||||
|
@ -682,7 +682,7 @@ void PropagateDownloadFileQNAM::contentChecksumComputed(const QByteArray &checks
|
||||||
downloadFinished();
|
downloadFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropagateDownloadFileQNAM::downloadFinished()
|
void PropagateDownloadFile::downloadFinished()
|
||||||
{
|
{
|
||||||
QString fn = _propagator->getFilePath(_item->_file);
|
QString fn = _propagator->getFilePath(_item->_file);
|
||||||
|
|
||||||
|
@ -805,7 +805,7 @@ void PropagateDownloadFileQNAM::downloadFinished()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropagateDownloadFileQNAM::slotDownloadProgress(qint64 received, qint64)
|
void PropagateDownloadFile::slotDownloadProgress(qint64 received, qint64)
|
||||||
{
|
{
|
||||||
if (!_job) return;
|
if (!_job) return;
|
||||||
_downloadProgress = received;
|
_downloadProgress = received;
|
||||||
|
@ -813,7 +813,7 @@ void PropagateDownloadFileQNAM::slotDownloadProgress(qint64 received, qint64)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PropagateDownloadFileQNAM::abort()
|
void PropagateDownloadFile::abort()
|
||||||
{
|
{
|
||||||
if (_job && _job->reply())
|
if (_job && _job->reply())
|
||||||
_job->reply()->abort();
|
_job->reply()->abort();
|
||||||
|
|
|
@ -103,13 +103,13 @@ private slots:
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The PropagateDownloadFileQNAM class
|
* @brief The PropagateDownloadFile class
|
||||||
* @ingroup libsync
|
* @ingroup libsync
|
||||||
*/
|
*/
|
||||||
class PropagateDownloadFileQNAM : public PropagateItemJob {
|
class PropagateDownloadFile : public PropagateItemJob {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PropagateDownloadFileQNAM(OwncloudPropagator* propagator,const SyncFileItemPtr& item)
|
PropagateDownloadFile(OwncloudPropagator* propagator,const SyncFileItemPtr& item)
|
||||||
: PropagateItemJob(propagator, item), _resumeStart(0), _downloadProgress(0), _deleteExisting(false) {}
|
: PropagateItemJob(propagator, item), _resumeStart(0), _downloadProgress(0), _deleteExisting(false) {}
|
||||||
void start() Q_DECL_OVERRIDE;
|
void start() Q_DECL_OVERRIDE;
|
||||||
qint64 committedDiskSpace() const Q_DECL_OVERRIDE;
|
qint64 committedDiskSpace() const Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -184,7 +184,7 @@ bool PollJob::finished()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropagateUploadFileQNAM::start()
|
void PropagateUploadFile::start()
|
||||||
{
|
{
|
||||||
if (_propagator->_abortRequested.fetchAndAddRelaxed(0)) {
|
if (_propagator->_abortRequested.fetchAndAddRelaxed(0)) {
|
||||||
return;
|
return;
|
||||||
|
@ -205,7 +205,7 @@ void PropagateUploadFileQNAM::start()
|
||||||
job->start();
|
job->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropagateUploadFileQNAM::slotComputeContentChecksum()
|
void PropagateUploadFile::slotComputeContentChecksum()
|
||||||
{
|
{
|
||||||
if (_propagator->_abortRequested.fetchAndAddRelaxed(0)) {
|
if (_propagator->_abortRequested.fetchAndAddRelaxed(0)) {
|
||||||
return;
|
return;
|
||||||
|
@ -239,12 +239,12 @@ void PropagateUploadFileQNAM::slotComputeContentChecksum()
|
||||||
computeChecksum->start(filePath);
|
computeChecksum->start(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropagateUploadFileQNAM::setDeleteExisting(bool enabled)
|
void PropagateUploadFile::setDeleteExisting(bool enabled)
|
||||||
{
|
{
|
||||||
_deleteExisting = 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->_contentChecksum = contentChecksum;
|
||||||
_item->_contentChecksumType = contentChecksumType;
|
_item->_contentChecksumType = contentChecksumType;
|
||||||
|
@ -276,7 +276,7 @@ void PropagateUploadFileQNAM::slotComputeTransmissionChecksum(const QByteArray&
|
||||||
computeChecksum->start(filePath);
|
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()
|
// 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.
|
// When we start chunks, we will add it again, once for every chunks.
|
||||||
|
@ -299,7 +299,7 @@ void PropagateUploadFileQNAM::slotStartUpload(const QByteArray& transmissionChec
|
||||||
}
|
}
|
||||||
_stopWatch.addLapTime(QLatin1String("TransmissionChecksum"));
|
_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
|
// but a potential checksum calculation could have taken some time during which the file could
|
||||||
// have been changed again, so better check again here.
|
// have been changed again, so better check again here.
|
||||||
|
|
||||||
|
@ -476,7 +476,7 @@ void UploadDevice::setChoked(bool b) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropagateUploadFileQNAM::startNextChunk()
|
void PropagateUploadFile::startNextChunk()
|
||||||
{
|
{
|
||||||
if (_propagator->_abortRequested.fetchAndAddRelaxed(0))
|
if (_propagator->_abortRequested.fetchAndAddRelaxed(0))
|
||||||
return;
|
return;
|
||||||
|
@ -607,7 +607,7 @@ void PropagateUploadFileQNAM::startNextChunk()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropagateUploadFileQNAM::slotPutFinished()
|
void PropagateUploadFile::slotPutFinished()
|
||||||
{
|
{
|
||||||
PUTFileJob *job = qobject_cast<PUTFileJob *>(sender());
|
PUTFileJob *job = qobject_cast<PUTFileJob *>(sender());
|
||||||
Q_ASSERT(job);
|
Q_ASSERT(job);
|
||||||
|
@ -785,7 +785,7 @@ void PropagateUploadFileQNAM::slotPutFinished()
|
||||||
finalize(*_item);
|
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
|
// Normally, copy == _item, but when it comes from the UpdateMTimeAndETagJob, we need to do
|
||||||
// some updates
|
// some updates
|
||||||
|
@ -807,7 +807,7 @@ void PropagateUploadFileQNAM::finalize(const SyncFileItem ©)
|
||||||
done(SyncFileItem::Success);
|
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
|
// Completion is signaled with sent=0, total=0; avoid accidentally
|
||||||
// resetting progress due to the sent being zero by ignoring it.
|
// resetting progress due to the sent being zero by ignoring it.
|
||||||
|
@ -840,7 +840,7 @@ void PropagateUploadFileQNAM::slotUploadProgress(qint64 sent, qint64 total)
|
||||||
emit progress(*_item, amount);
|
emit progress(*_item, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropagateUploadFileQNAM::startPollJob(const QString& path)
|
void PropagateUploadFile::startPollJob(const QString& path)
|
||||||
{
|
{
|
||||||
PollJob* job = new PollJob(_propagator->account(), path, _item,
|
PollJob* job = new PollJob(_propagator->account(), path, _item,
|
||||||
_propagator->_journal, _propagator->_localDir, this);
|
_propagator->_journal, _propagator->_localDir, this);
|
||||||
|
@ -855,7 +855,7 @@ void PropagateUploadFileQNAM::startPollJob(const QString& path)
|
||||||
job->start();
|
job->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropagateUploadFileQNAM::slotPollFinished()
|
void PropagateUploadFile::slotPollFinished()
|
||||||
{
|
{
|
||||||
PollJob *job = qobject_cast<PollJob *>(sender());
|
PollJob *job = qobject_cast<PollJob *>(sender());
|
||||||
Q_ASSERT(job);
|
Q_ASSERT(job);
|
||||||
|
@ -871,12 +871,12 @@ void PropagateUploadFileQNAM::slotPollFinished()
|
||||||
finalize(*job->_item);
|
finalize(*job->_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropagateUploadFileQNAM::slotJobDestroyed(QObject* job)
|
void PropagateUploadFile::slotJobDestroyed(QObject* job)
|
||||||
{
|
{
|
||||||
_jobs.erase(std::remove(_jobs.begin(), _jobs.end(), job) , _jobs.end());
|
_jobs.erase(std::remove(_jobs.begin(), _jobs.end(), job) , _jobs.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropagateUploadFileQNAM::abort()
|
void PropagateUploadFile::abort()
|
||||||
{
|
{
|
||||||
foreach(auto *job, _jobs) {
|
foreach(auto *job, _jobs) {
|
||||||
if (job->reply()) {
|
if (job->reply()) {
|
||||||
|
@ -887,7 +887,7 @@ void PropagateUploadFileQNAM::abort()
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function is used whenever there is an error occuring and jobs might be in progress
|
// 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;
|
_finished = true;
|
||||||
abort();
|
abort();
|
||||||
|
|
|
@ -155,10 +155,10 @@ signals:
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The PropagateUploadFileQNAM class
|
* @brief The PropagateUploadFile class
|
||||||
* @ingroup libsync
|
* @ingroup libsync
|
||||||
*/
|
*/
|
||||||
class PropagateUploadFileQNAM : public PropagateItemJob {
|
class PropagateUploadFile : public PropagateItemJob {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -191,7 +191,7 @@ private:
|
||||||
quint64 chunkSize() const { return _propagator->chunkSize(); }
|
quint64 chunkSize() const { return _propagator->chunkSize(); }
|
||||||
|
|
||||||
public:
|
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) {}
|
: PropagateItemJob(propagator, item), _startChunk(0), _currentChunk(0), _chunkCount(0), _transferId(0), _finished(false), _deleteExisting(false) {}
|
||||||
void start() Q_DECL_OVERRIDE;
|
void start() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue