mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Notify when new lock files are found in folderwatcher
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
f5d15d8a82
commit
859bf07873
@ -197,6 +197,7 @@ void FolderWatcher::changeDetected(const QStringList &paths)
|
||||
QSet<QString> changedPaths;
|
||||
QSet<QString> unlockedFiles;
|
||||
QSet<QString> lockedFiles;
|
||||
QSet<QString> lockFiles;
|
||||
|
||||
for (const auto &path : paths) {
|
||||
if (!_testNotificationPath.isEmpty()
|
||||
@ -207,14 +208,11 @@ void FolderWatcher::changeDetected(const QStringList &paths)
|
||||
const auto lockFileNamePattern = filePathLockFilePatternMatch(path);
|
||||
const auto checkResult = checkIfFileIsLockOrUnlock(path,lockFileNamePattern);
|
||||
if (_shouldWatchForFileUnlocking) {
|
||||
const auto lockFileNamePattern = filePathLockFilePatternMatch(path);
|
||||
const auto unlockedFilePath = checkIfFileIsLockOrUnlock(path, lockFileNamePattern);
|
||||
|
||||
if (checkResult.type == FileLockingInfo::Type::Unlocked && !checkResult.path.isEmpty()) {
|
||||
unlockedFiles.insert(checkResult.path);
|
||||
} else if (!lockFileNamePattern.isEmpty()) {
|
||||
lockFiles.insert(path);
|
||||
}
|
||||
|
||||
qCDebug(lcFolderWatcher) << "Unlocked files:" << unlockedFiles.values();
|
||||
}
|
||||
|
||||
if (checkResult.type == FileLockingInfo::Type::Locked && !checkResult.path.isEmpty()) {
|
||||
@ -231,6 +229,9 @@ void FolderWatcher::changeDetected(const QStringList &paths)
|
||||
changedPaths.insert(path);
|
||||
}
|
||||
|
||||
qCDebug(lcFolderWatcher) << "Unlocked files:" << unlockedFiles.values();
|
||||
qCDebug(lcFolderWatcher) << "Lock files:" << lockFiles;
|
||||
|
||||
if (!unlockedFiles.isEmpty()) {
|
||||
emit filesLockReleased(unlockedFiles);
|
||||
}
|
||||
@ -239,6 +240,10 @@ void FolderWatcher::changeDetected(const QStringList &paths)
|
||||
emit filesLockImposed(lockedFiles);
|
||||
}
|
||||
|
||||
if (!lockFiles.isEmpty()) {
|
||||
emit lockFilesFound(lockFiles);
|
||||
}
|
||||
|
||||
if (changedPaths.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -102,6 +102,8 @@ signals:
|
||||
*/
|
||||
void filesLockImposed(const QSet<QString> &files);
|
||||
|
||||
void lockFilesFound(const QSet<QString> &files);
|
||||
|
||||
/**
|
||||
* Emitted if some notifications were lost.
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user