diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index ba24802cf2..0c228ca807 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -1832,12 +1832,14 @@ bool ProcessDirectoryJob::checkPermissions(const OCC::SyncFileItemPtr &item) #if !defined(Q_OS_MACOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_15 qCWarning(lcDisco) << "unexpected new folder in a read-only folder will be made read-write" << localPath; FileSystem::setFolderPermissions(localPath, FileSystem::FolderPermissions::ReadWrite); + emit _discoveryData->remnantReadOnlyFolderDiscovered(item); #endif return false; } else if (!item->isDirectory() && !perms.hasPermission(RemotePermissions::CanAddFile)) { qCWarning(lcDisco) << "checkForPermission: ERROR" << item->_file; item->_instruction = CSYNC_INSTRUCTION_ERROR; item->_errorString = tr("Not allowed because you don't have permission to add files in that folder"); + emit _discoveryData->remnantReadOnlyFolderDiscovered(item); return false; } break; @@ -2038,6 +2040,7 @@ int ProcessDirectoryJob::processSubJobs(int nbJobs) #if !defined(Q_OS_MACOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_15 qCWarning(lcDisco) << "unexpected new folder in a read-only folder will be made read-write" << localPath; FileSystem::setFolderPermissions(localPath, FileSystem::FolderPermissions::ReadWrite); + emit _discoveryData->remnantReadOnlyFolderDiscovered(_dirItem); #endif } diff --git a/src/libsync/discoveryphase.h b/src/libsync/discoveryphase.h index 89012df25f..7d53f1336d 100644 --- a/src/libsync/discoveryphase.h +++ b/src/libsync/discoveryphase.h @@ -357,6 +357,7 @@ signals: void addErrorToGui(const SyncFileItem::Status status, const QString &errorMessage, const QString &subject, const OCC::ErrorCategory category); + void remnantReadOnlyFolderDiscovered(const OCC::SyncFileItemPtr &item); private slots: void slotItemDiscovered(const OCC::SyncFileItemPtr &item); }; diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index 3f0cd9b3cd..21d6b0c8b6 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -630,6 +630,8 @@ void SyncEngine::startSync() _progressInfo->_status = ProgressInfo::Discovery; emit transmissionProgress(*_progressInfo); + _remnantReadOnlyFolders.clear(); + _discoveryPhase.reset(new DiscoveryPhase); _discoveryPhase->_leadingAndTrailingSpacesFilesAllowed = _leadingAndTrailingSpacesFilesAllowed; _discoveryPhase->_account = _account; @@ -683,6 +685,7 @@ void SyncEngine::startSync() connect(_discoveryPhase.data(), &DiscoveryPhase::finished, this, &SyncEngine::slotDiscoveryFinished); connect(_discoveryPhase.data(), &DiscoveryPhase::silentlyExcluded, _syncFileStatusTracker.data(), &SyncFileStatusTracker::slotAddSilentlyExcluded); + connect(_discoveryPhase.data(), &DiscoveryPhase::remnantReadOnlyFolderDiscovered, this, &SyncEngine::remnantReadOnlyFolderDiscovered); ProcessDirectoryJob *discoveryJob = nullptr; @@ -1486,6 +1489,11 @@ void SyncEngine::slotCleanupScheduledSyncTimers() } } +void SyncEngine::remnantReadOnlyFolderDiscovered(const SyncFileItemPtr &item) +{ + _remnantReadOnlyFolders.push_back(item); +} + void SyncEngine::slotUnscheduleFilesDelayedSync() { if (!_discoveryPhase || _discoveryPhase->_filesUnscheduleSync.empty()) { diff --git a/src/libsync/syncengine.h b/src/libsync/syncengine.h index ea9b3c21ad..2887c4bc1f 100644 --- a/src/libsync/syncengine.h +++ b/src/libsync/syncengine.h @@ -240,6 +240,8 @@ private slots: void slotUnscheduleFilesDelayedSync(); void slotCleanupScheduledSyncTimers(); + void remnantReadOnlyFolderDiscovered(const OCC::SyncFileItemPtr &item); + private: // Some files need a sync run to be executed at a specified time after // their status is scheduled to change (e.g. lock status will expire in @@ -404,6 +406,8 @@ private: QVector> _scheduledSyncTimers; SingleItemDiscoveryOptions _singleItemDiscoveryOptions; + + QList _remnantReadOnlyFolders; }; }