From: Christian Kamm Date: Tue, 22 Jan 2019 10:29:03 +0000 (+0100) Subject: Discovery: Add signal for silentlyExcluded files X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~21^2~468^2~312 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=af1666788eac9fd1d29575b6d697d7b0210f6b64;p=nextcloud-desktop.git Discovery: Add signal for silentlyExcluded files This allows SyncFileStatusTracker to also know about these. After all its information is used to provide icons for them too. --- diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index 14d00bc5c..d4bf83249 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -194,6 +194,7 @@ bool ProcessDirectoryJob::handleExcluded(const QString &path, const QString &loc if (excluded == CSYNC_NOT_EXCLUDED && !isSymlink) { return false; } else if (excluded == CSYNC_FILE_SILENTLY_EXCLUDED || excluded == CSYNC_FILE_EXCLUDE_AND_REMOVE) { + emit _discoveryData->silentlyExcluded(path); return true; } diff --git a/src/libsync/discoveryphase.h b/src/libsync/discoveryphase.h index 35dedf7cf..32c9b1332 100644 --- a/src/libsync/discoveryphase.h +++ b/src/libsync/discoveryphase.h @@ -98,6 +98,7 @@ signals: void firstDirectoryPermissions(RemotePermissions); void etag(const QString &); void finished(const HttpResult> &result); + private slots: void directoryListingIteratedSlot(QString, const QMap &); void lsJobFinishedWithoutErrorSlot(); @@ -194,6 +195,12 @@ signals: // A new folder was discovered and was not synced because of the confirmation feature void newBigFolder(const QString &folder, bool isExternal); + + /** For excluded items that don't show up in itemDiscovered() + * + * The path is relative to the sync folder, similar to item->_file + */ + void silentlyExcluded(const QString &folderPath); }; /// Implementation of DiscoveryPhase::adjustRenamedPath diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index fc2c30ce3..29ddcf6fd 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -634,6 +634,8 @@ void SyncEngine::slotStartDiscovery() finalize(false); }); connect(_discoveryPhase.data(), &DiscoveryPhase::finished, this, &SyncEngine::slotDiscoveryFinished); + connect(_discoveryPhase.data(), &DiscoveryPhase::silentlyExcluded, + _syncFileStatusTracker.data(), &SyncFileStatusTracker::slotAddSilentlyExcluded); auto discoveryJob = new ProcessDirectoryJob(SyncFileItemPtr(), ProcessDirectoryJob::NormalQuery, ProcessDirectoryJob::NormalQuery, _discoveryPhase.data(), _discoveryPhase.data()); diff --git a/src/libsync/syncfilestatustracker.cpp b/src/libsync/syncfilestatustracker.cpp index 78ecba389..ed2e92fb0 100644 --- a/src/libsync/syncfilestatustracker.cpp +++ b/src/libsync/syncfilestatustracker.cpp @@ -137,6 +137,8 @@ SyncFileStatus SyncFileStatusTracker::fileStatus(const QString &relativePath) // update the exclude list at runtime and doing it statically here removes // our ability to notify changes through the fileStatusChanged signal, // it's an acceptable compromize to treat all exclude types the same. + // Update: This extra check shouldn't hurt even though silently excluded files + // are now available via slotAddSilentlyExcluded(). if (_syncEngine->excludedFiles().isExcluded(_syncEngine->localPath() + relativePath, _syncEngine->localPath(), _syncEngine->ignoreHiddenFiles())) { @@ -167,6 +169,12 @@ void SyncFileStatusTracker::slotPathTouched(const QString &fileName) emit fileStatusChanged(fileName, SyncFileStatus::StatusSync); } +void SyncFileStatusTracker::slotAddSilentlyExcluded(const QString &folderPath) +{ + _syncProblems[folderPath] = SyncFileStatus::StatusWarning; + emit fileStatusChanged(getSystemDestination(folderPath), resolveSyncAndErrorStatus(folderPath, NotShared)); +} + void SyncFileStatusTracker::incSyncCountAndEmitStatusChanged(const QString &relativePath, SharedFlag sharedFlag) { // Will return 0 (and increase to 1) if the path wasn't in the map yet diff --git a/src/libsync/syncfilestatustracker.h b/src/libsync/syncfilestatustracker.h index 362c4143c..bd5d73e04 100644 --- a/src/libsync/syncfilestatustracker.h +++ b/src/libsync/syncfilestatustracker.h @@ -40,6 +40,8 @@ public: public slots: void slotPathTouched(const QString &fileName); + // path relative to folder + void slotAddSilentlyExcluded(const QString &folderPath); signals: void fileStatusChanged(const QString &systemFileName, SyncFileStatus fileStatus);