diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp index c123adf7c..bd4f37b62 100644 --- a/src/libsync/owncloudpropagator.cpp +++ b/src/libsync/owncloudpropagator.cpp @@ -664,9 +664,8 @@ void CleanupPollsJob::start() auto info = _pollInfos.first(); _pollInfos.pop_front(); - SyncFileItemPtr item(new SyncFileItem); - item->_file = info._file; - item->_modtime = info._modtime; + SyncFileItemPtr item(new SyncFileItem( + _journal->getFileRecord(info._file).toSyncFileItem())); PollJob *job = new PollJob(_account, info._url, item, _journal, _localPath, this); connect(job, SIGNAL(finishedSignal()), SLOT(slotPollFinished())); job->start(); diff --git a/src/libsync/syncjournalfilerecord.cpp b/src/libsync/syncjournalfilerecord.cpp index 4fff0a785..07d5f7ce5 100644 --- a/src/libsync/syncjournalfilerecord.cpp +++ b/src/libsync/syncjournalfilerecord.cpp @@ -85,6 +85,24 @@ SyncJournalFileRecord::SyncJournalFileRecord(const SyncFileItem &item, const QSt } +SyncFileItem SyncJournalFileRecord::toSyncFileItem() +{ + SyncFileItem item; + item._file = _path; + item._inode = _inode; + item._modtime = Utility::qDateTimeToTime_t(_modtime); + item._type = static_cast(_type); + item._etag = _etag; + item._fileId = _fileId; + item._size = _fileSize; + item._remotePerm = _remotePerm; + // item has no _mode + item._serverHasIgnoredFiles = _serverHasIgnoredFiles; + item._transmissionChecksum = _transmissionChecksum; + item._transmissionChecksumType = _transmissionChecksumType; + return item; +} + static time_t getMinBlacklistTime() { return qMax(qgetenv("OWNCLOUD_BLACKLIST_TIME_MIN").toInt(), diff --git a/src/libsync/syncjournalfilerecord.h b/src/libsync/syncjournalfilerecord.h index 4165cafbc..d8282ecc1 100644 --- a/src/libsync/syncjournalfilerecord.h +++ b/src/libsync/syncjournalfilerecord.h @@ -31,8 +31,17 @@ class OWNCLOUDSYNC_EXPORT SyncJournalFileRecord { public: SyncJournalFileRecord(); + + /// Creates a record from an existing item while updating the inode SyncJournalFileRecord(const SyncFileItem&, const QString &localFileName); + /** Creates a basic SyncFileItem from the record + * + * This is intended in particular for read-update-write cycles that need + * to go through a a SyncFileItem, like PollJob. + */ + SyncFileItem toSyncFileItem(); + bool isValid() { return !_path.isEmpty(); }