Merge pull request #3281 from owncloud/confirm

Confirm feature (sync engine part only)
Esse commit está contido em:
Olivier Goffart
2015-06-10 13:39:52 +02:00
16 arquivos alterados com 295 adições e 109 exclusões
+14 -8
Ver Arquivo
@@ -606,7 +606,8 @@ void SyncEngine::startSync()
// thereby speeding up the initial discovery significantly.
_csync_ctx->db_is_empty = (fileRecordCount == 0);
bool usingSelectiveSync = (!_selectiveSyncBlackList.isEmpty());
auto selectiveSyncBlackList = _journal->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList);
bool usingSelectiveSync = (!selectiveSyncBlackList.isEmpty());
qDebug() << (usingSelectiveSync ? "====Using Selective Sync" : "====NOT Using Selective Sync");
if (fileRecordCount >= 0 && fileRecordCount < 50 && !usingSelectiveSync) {
qDebug() << "===== Activating recursive PROPFIND (currently" << fileRecordCount << "file records)";
@@ -636,12 +637,19 @@ void SyncEngine::startSync()
DiscoveryJob *discoveryJob = new DiscoveryJob(_csync_ctx);
discoveryJob->_selectiveSyncBlackList = _selectiveSyncBlackList;
discoveryJob->_selectiveSyncBlackList = selectiveSyncBlackList;
discoveryJob->_selectiveSyncWhiteList =
_journal->getSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList);
discoveryJob->_newSharedFolderSizeLimit = _newSharedFolderSizeLimit;
discoveryJob->moveToThread(&_thread);
connect(discoveryJob, SIGNAL(finished(int)), this, SLOT(slotDiscoveryJobFinished(int)));
connect(discoveryJob, SIGNAL(folderDiscovered(bool,QString)),
this, SIGNAL(folderDiscovered(bool,QString)));
connect(discoveryJob, SIGNAL(newSharedFolder(QString)),
this, SIGNAL(newSharedFolder(QString)));
// This is used for the DiscoveryJob to be able to request the main thread/
// to read in directory contents.
qDebug() << Q_FUNC_INFO << _remotePath << _remoteUrl;
@@ -905,6 +913,9 @@ QString SyncEngine::adjustRenamedPath(const QString& original)
*/
void SyncEngine::checkForPermission()
{
auto selectiveSyncBlackList = _journal->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList);
std::sort(selectiveSyncBlackList.begin(), selectiveSyncBlackList.end());
for (SyncFileItemVector::iterator it = _syncedItems.begin(); it != _syncedItems.end(); ++it) {
if ((*it)->_direction != SyncFileItem::Up) {
// Currently we only check server-side permissions
@@ -913,7 +924,7 @@ void SyncEngine::checkForPermission()
// Do not propagate anything in the server if it is in the selective sync blacklist
const QString path = (*it)->destination() + QLatin1Char('/');
if (std::binary_search(_selectiveSyncBlackList.constBegin(), _selectiveSyncBlackList.constEnd(),
if (std::binary_search(selectiveSyncBlackList.constBegin(), selectiveSyncBlackList.constEnd(),
path)) {
(*it)->_instruction = CSYNC_INSTRUCTION_IGNORE;
(*it)->_status = SyncFileItem::FileIgnored;
@@ -1134,11 +1145,6 @@ QByteArray SyncEngine::getPermissions(const QString& file) const
return _remotePerms.value(file);
}
void SyncEngine::setSelectiveSyncBlackList(const QStringList& list)
{
_selectiveSyncBlackList = list;
}
bool SyncEngine::estimateState(QString fn, csync_ftw_type_e t, SyncFileStatus* s)
{
Q_UNUSED(t);