return _journal.wipeErrorBlacklist();
}
-void Folder::slotWatchedPathChanged(const QString &path)
+void Folder::slotWatchedPathChanged(const QString &path, ChangeReason reason)
{
if (!path.startsWith(this->path())) {
qCDebug(lcFolder) << "Changed path is not contained in folder, ignoring:" << path;
}
#endif
- // 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;
+ _journal.getFileRecord(relativePathBytes, &record);
+ if (reason != ChangeReason::UnLock) {
+ // Check that the mtime/size actually changed or there was
+ // an attribute change (pin state) that caused the notification
+ bool spurious = false;
+ if (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
}
}
- if (spurious) {
- qCInfo(lcFolder) << "Ignoring spurious notification for file" << relativePath;
- return; // probably a spurious notification
- }
-
warnOnNewExcludedItem(record, relativePath);
emit watchedFileChangedExternally(path);
_folderWatcher.reset(new FolderWatcher(this));
connect(_folderWatcher.data(), &FolderWatcher::pathChanged,
- this, &Folder::slotWatchedPathChanged);
+ this, [this](const QString &path) { slotWatchedPathChanged(path, Folder::ChangeReason::Other); });
connect(_folderWatcher.data(), &FolderWatcher::lostChanges,
this, &Folder::slotNextSyncFullLocalDiscovery);
connect(_folderWatcher.data(), &FolderWatcher::becameUnreliable,
Q_OBJECT
public:
+ enum class ChangeReason {
+ Other,
+ UnLock
+ };
+ Q_ENUM(ChangeReason)
+
/** Create a new Folder
*/
Folder(const FolderDefinition &definition, AccountState *accountState, std::unique_ptr<Vfs> vfs, QObject *parent = nullptr);
* changes. Needs to check whether this change should trigger a new
* sync run to be scheduled.
*/
- void slotWatchedPathChanged(const QString &path);
+ void slotWatchedPathChanged(const QString &path, ChangeReason reason);
/**
* Mark a virtual file as being requested for download, and start a sync.