From: Markus Goetz Date: Mon, 22 Feb 2016 14:44:50 +0000 (+0100) Subject: Merge pull request #4389 from Bottswana/deleteprompt X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~1354 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a76ba06817289bebb0033bd0fddb533b6ac20640;p=nextcloud-desktop.git Merge pull request #4389 from Bottswana/deleteprompt Add option to disable the delete all files prompt --- a76ba06817289bebb0033bd0fddb533b6ac20640 diff --cc src/libsync/syncengine.cpp index ac3b3ea08,4a7c73805..8f4f2c03c --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@@ -828,20 -813,21 +829,22 @@@ void SyncEngine::slotDiscoveryJobFinish (*it)->_file = adjustRenamedPath((*it)->_file); } - // Sort items per destination - std::sort(_syncedItems.begin(), _syncedItems.end()); - - // make sure everything is allowed - checkForPermission(); - - // To announce the beginning of the sync - emit aboutToPropagate(_syncedItems); - // it's important to do this before ProgressInfo::start(), to announce start of new sync - emit transmissionProgress(*_progressInfo); - _progressInfo->start(); + // Check for invalid character in old server version + if (_account->serverVersionInt() < 0x080100) { + // Server version older than 8.1 don't support these character in filename. + static const QRegExp invalidCharRx("[\\\\:?*\"<>|]"); + for (auto it = _syncedItems.begin(); it != _syncedItems.end(); ++it) { + if ((*it)->_direction == SyncFileItem::Up && + (*it)->destination().contains(invalidCharRx)) { + (*it)->_errorString = tr("File name contains at least one invalid character"); + (*it)->_instruction = CSYNC_INSTRUCTION_IGNORE; + } + } + } - if (!_hasNoneFiles && _hasRemoveFile) { + // Check the config file before displaying prompt in case it is disabled. + ConfigFile cfgFile; + if (!_hasNoneFiles && _hasRemoveFile && cfgFile.promptDeleteFiles()) { qDebug() << Q_FUNC_INFO << "All the files are going to be changed, asking the user"; bool cancel = false; emit aboutToRemoveAllFiles(_syncedItems.first()->_direction, &cancel);