|
|
@@ -286,60 +286,6 @@ void PropagateItemJob::done(SyncFileItem::Status statusArg, const QString &error
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * For delete or remove, check that we are not removing from a shared directory.
|
|
|
- * If we are, try to restore the file
|
|
|
- *
|
|
|
- * Return true if the problem is handled.
|
|
|
- */
|
|
|
-bool PropagateItemJob::checkForProblemsWithShared(int httpStatusCode, const QString &msg)
|
|
|
-{
|
|
|
- PropagateItemJob *newJob = NULL;
|
|
|
-
|
|
|
- if (httpStatusCode == 403 && propagator()->isInSharedDirectory(_item->_file)) {
|
|
|
- if (!_item->isDirectory()) {
|
|
|
- SyncFileItemPtr downloadItem(new SyncFileItem(*_item));
|
|
|
- if (downloadItem->_instruction == CSYNC_INSTRUCTION_NEW
|
|
|
- || downloadItem->_instruction == CSYNC_INSTRUCTION_TYPE_CHANGE) {
|
|
|
- // don't try to recover pushing new files
|
|
|
- return false;
|
|
|
- } else if (downloadItem->_instruction == CSYNC_INSTRUCTION_SYNC) {
|
|
|
- // we modified the file locally, just create a conflict then
|
|
|
- downloadItem->_instruction = CSYNC_INSTRUCTION_CONFLICT;
|
|
|
-
|
|
|
- // HACK to avoid continuation: See task #1448: We do not know the _modtime from the
|
|
|
- // server, at this point, so just set the current one. (rather than the one locally)
|
|
|
- downloadItem->_modtime = Utility::qDateTimeToTime_t(QDateTime::currentDateTimeUtc());
|
|
|
- } else {
|
|
|
- // the file was removed or renamed, just recover the old one
|
|
|
- downloadItem->_instruction = CSYNC_INSTRUCTION_SYNC;
|
|
|
- }
|
|
|
- downloadItem->_direction = SyncFileItem::Down;
|
|
|
- newJob = new PropagateDownloadFile(propagator(), downloadItem);
|
|
|
- } else {
|
|
|
- // Directories are harder to recover.
|
|
|
- // But just re-create the directory, next sync will be able to recover the files
|
|
|
- SyncFileItemPtr mkdirItem(new SyncFileItem(*_item));
|
|
|
- mkdirItem->_instruction = CSYNC_INSTRUCTION_NEW;
|
|
|
- mkdirItem->_direction = SyncFileItem::Down;
|
|
|
- newJob = new PropagateLocalMkdir(propagator(), mkdirItem);
|
|
|
- // Also remove the inodes and fileid from the db so no further renames are tried for
|
|
|
- // this item.
|
|
|
- propagator()->_journal->avoidRenamesOnNextSync(_item->_file);
|
|
|
- propagator()->_anotherSyncNeeded = true;
|
|
|
- }
|
|
|
- if (newJob) {
|
|
|
- newJob->setRestoreJobMsg(msg);
|
|
|
- _restoreJob.reset(newJob);
|
|
|
- connect(_restoreJob.data(), &PropagatorJob::finished,
|
|
|
- this, &PropagateItemJob::slotRestoreJobFinished);
|
|
|
- QMetaObject::invokeMethod(newJob, "start");
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
-}
|
|
|
-
|
|
|
void PropagateItemJob::slotRestoreJobFinished(SyncFileItem::Status status)
|
|
|
{
|
|
|
QString msg;
|
|
|
@@ -559,23 +505,6 @@ void OwncloudPropagator::setSyncOptions(const SyncOptions &syncOptions)
|
|
|
_chunkSize = syncOptions._initialChunkSize;
|
|
|
}
|
|
|
|
|
|
-// ownCloud server < 7.0 did not had permissions so we need some other euristics
|
|
|
-// to detect wrong doing in a Shared directory
|
|
|
-bool OwncloudPropagator::isInSharedDirectory(const QString &file)
|
|
|
-{
|
|
|
- bool re = false;
|
|
|
- if (_remoteFolder.startsWith(QLatin1String("Shared"))) {
|
|
|
- // The Shared directory is synced as its own sync connection
|
|
|
- re = true;
|
|
|
- } else {
|
|
|
- if (file.startsWith("Shared/") || file == "Shared") {
|
|
|
- // The whole ownCloud is synced and Shared is always a top dir
|
|
|
- re = true;
|
|
|
- }
|
|
|
- }
|
|
|
- return re;
|
|
|
-}
|
|
|
-
|
|
|
bool OwncloudPropagator::localFileNameClash(const QString &relFile)
|
|
|
{
|
|
|
bool re = false;
|