From: Christian Kamm Date: Tue, 29 Jan 2019 10:41:03 +0000 (+0100) Subject: File watcher: Pin state attribute changes are valid notifications X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~21^2~468^2~302 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d8873c18a113c0604755b0aeac106f8d0ac77abe;p=nextcloud-desktop.git File watcher: Pin state attribute changes are valid notifications Previously they would be discarded since the file's mtime or size hadn't changed. --- diff --git a/src/common/syncjournalfilerecord.h b/src/common/syncjournalfilerecord.h index 064334928..3a8643fe8 100644 --- a/src/common/syncjournalfilerecord.h +++ b/src/common/syncjournalfilerecord.h @@ -53,6 +53,7 @@ public: QDateTime modDateTime() const { return Utility::qDateTimeFromTime_t(_modtime); } bool isDirectory() const { return _type == ItemTypeDirectory; } + bool isFile() const { return _type == ItemTypeFile || _type == ItemTypeVirtualFileDehydration; } bool isVirtualFile() const { return _type == ItemTypeVirtualFile || _type == ItemTypeVirtualFileDownload; } QByteArray _path; diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index 916241778..c5bcbcd16 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -560,11 +560,23 @@ void Folder::slotWatchedPathChanged(const QString &path) } #endif - // Check that the mtime actually changed. + // Check that the mtime/size actually changed or there was + // an attribute change (pin state) that caused the notification + bool spurious = false; SyncJournalFileRecord record; if (_journal.getFileRecord(relativePathBytes, &record) && record.isValid() && !FileSystem::fileChanged(path, record._fileSize, record._modtime)) { + spurious = true; + + if (auto pinState = _vfs->pinState(relativePath.toString())) { + if (*pinState == PinState::AlwaysLocal && record.isVirtualFile()) + spurious = false; + if (*pinState == PinState::OnlineOnly && record.isFile()) + spurious = false; + } + } + if (spurious) { qCInfo(lcFolder) << "Ignoring spurious notification for file" << relativePath; return; // probably a spurious notification }