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.
This commit is contained in:
Christian Kamm 2019-01-22 11:29:03 +01:00 committed by Kevin Ottens
parent e2eea24a03
commit af1666788e
No known key found for this signature in database
GPG key ID: 074BBBCB8DECC9E2
5 changed files with 20 additions and 0 deletions

View file

@ -194,6 +194,7 @@ bool ProcessDirectoryJob::handleExcluded(const QString &path, const QString &loc
if (excluded == CSYNC_NOT_EXCLUDED && !isSymlink) { if (excluded == CSYNC_NOT_EXCLUDED && !isSymlink) {
return false; return false;
} else if (excluded == CSYNC_FILE_SILENTLY_EXCLUDED || excluded == CSYNC_FILE_EXCLUDE_AND_REMOVE) { } else if (excluded == CSYNC_FILE_SILENTLY_EXCLUDED || excluded == CSYNC_FILE_EXCLUDE_AND_REMOVE) {
emit _discoveryData->silentlyExcluded(path);
return true; return true;
} }

View file

@ -98,6 +98,7 @@ signals:
void firstDirectoryPermissions(RemotePermissions); void firstDirectoryPermissions(RemotePermissions);
void etag(const QString &); void etag(const QString &);
void finished(const HttpResult<QVector<RemoteInfo>> &result); void finished(const HttpResult<QVector<RemoteInfo>> &result);
private slots: private slots:
void directoryListingIteratedSlot(QString, const QMap<QString, QString> &); void directoryListingIteratedSlot(QString, const QMap<QString, QString> &);
void lsJobFinishedWithoutErrorSlot(); void lsJobFinishedWithoutErrorSlot();
@ -194,6 +195,12 @@ signals:
// A new folder was discovered and was not synced because of the confirmation feature // A new folder was discovered and was not synced because of the confirmation feature
void newBigFolder(const QString &folder, bool isExternal); 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 /// Implementation of DiscoveryPhase::adjustRenamedPath

View file

@ -634,6 +634,8 @@ void SyncEngine::slotStartDiscovery()
finalize(false); finalize(false);
}); });
connect(_discoveryPhase.data(), &DiscoveryPhase::finished, this, &SyncEngine::slotDiscoveryFinished); 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, auto discoveryJob = new ProcessDirectoryJob(SyncFileItemPtr(), ProcessDirectoryJob::NormalQuery, ProcessDirectoryJob::NormalQuery,
_discoveryPhase.data(), _discoveryPhase.data()); _discoveryPhase.data(), _discoveryPhase.data());

View file

@ -137,6 +137,8 @@ SyncFileStatus SyncFileStatusTracker::fileStatus(const QString &relativePath)
// update the exclude list at runtime and doing it statically here removes // update the exclude list at runtime and doing it statically here removes
// our ability to notify changes through the fileStatusChanged signal, // our ability to notify changes through the fileStatusChanged signal,
// it's an acceptable compromize to treat all exclude types the same. // 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, if (_syncEngine->excludedFiles().isExcluded(_syncEngine->localPath() + relativePath,
_syncEngine->localPath(), _syncEngine->localPath(),
_syncEngine->ignoreHiddenFiles())) { _syncEngine->ignoreHiddenFiles())) {
@ -167,6 +169,12 @@ void SyncFileStatusTracker::slotPathTouched(const QString &fileName)
emit fileStatusChanged(fileName, SyncFileStatus::StatusSync); 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) void SyncFileStatusTracker::incSyncCountAndEmitStatusChanged(const QString &relativePath, SharedFlag sharedFlag)
{ {
// Will return 0 (and increase to 1) if the path wasn't in the map yet // Will return 0 (and increase to 1) if the path wasn't in the map yet

View file

@ -40,6 +40,8 @@ public:
public slots: public slots:
void slotPathTouched(const QString &fileName); void slotPathTouched(const QString &fileName);
// path relative to folder
void slotAddSilentlyExcluded(const QString &folderPath);
signals: signals:
void fileStatusChanged(const QString &systemFileName, SyncFileStatus fileStatus); void fileStatusChanged(const QString &systemFileName, SyncFileStatus fileStatus);