void SiteCopyFolder::pushToOC() { QMutexLocker locker( &_syncMutex ); qDebug() << "starting to sync to ownCloud"; setSyncEnabled( true ); startSiteCopy( "--update", Sync ); }
void SiteCopyFolder::fetchFromOC() { QMutexLocker locker( &_syncMutex ); qDebug() << "starting to sync from ownCloud"; setSyncEnabled( true ); startSiteCopy( "--fetch", Sync ); }
void Folder::slotTerminateSync() { qDebug() << "folder " << alias() << " Terminating!"; if( _engine ) { _engine->abort(); // Do not display an error message, user knows his own actions. // _errors.append( tr("The CSync thread terminated.") ); // _csyncError = true; setSyncEnabled(false); setSyncState(SyncResult::SyncAbortRequested); return; } }
void Folder::slotTerminateSync(bool block) { qDebug() << "folder " << alias() << " Terminating!"; if( _thread && _csync ) { _csync->abort(); // Do not display an error message, user knows his own actions. // _errors.append( tr("The CSync thread terminated.") ); // _csyncError = true; if (!block) { setSyncState(SyncResult::SyncAbortRequested); return; } _thread->wait(); _csync->deleteLater(); delete _thread; _thread = 0; slotCSyncFinished(); } setSyncEnabled(false); }
void SiteCopyFolder::slotFinished(int exitCode, QProcess::ExitStatus exitStatus) { qDebug() << " * SiteCopy process finished with status" << exitCode; if( exitCode == -1 ) { qDebug() << "Configuration Error, stop processing."; SyncResult res( SyncResult::Error ); res.setErrorString( tr("Sitecopy configuration problem, check $HOME/.sitecopyrc")); incrementErrorCount(); emit( syncFinished( res )); } if( exitCode > 1 ) { // error has happened. QString out( _lastOutput ); SyncResult res( SyncResult::Error ); res.setErrorString( out ); qDebug() << "An error happened: " << out; incrementErrorCount(); emit syncFinished( res ); return; } if( _NextStep == Sync ) { startSiteCopy( "--sync", Finish ); // sync local with cloud data. } else if( _NextStep == Update ) { startSiteCopy( "--update", Finish ); // update from owncloud } else if( _NextStep == Finish ) { qDebug() << "Finished!"; emit syncFinished( SyncResult(SyncResult::Success) ); // mLocalChangesSeen = false; } else if( _NextStep == Status ) { startSiteCopy( "--fetch", FlatList ); } else if( _NextStep == FlatList ) { startSiteCopy( "--flatlist", ExecuteStatus ); } else if( _NextStep == ExecuteStatus ) { if( exitCode == 1 ) { qDebug() << "Exit-Code: Sync Needed!"; analyzeStatus(); if( _ChangesHash.contains("deleted") && _pathListEmpty ) { // problem: Files were added on the cloud. If we say update, // the new files are going to be deleted. Lets warn the user. qDebug() << "!!!! Better not call update, changes happened on the cloud!"; SyncResult res( SyncResult::Disabled ); res.setErrorString( tr("The ownCloud changed. Disabling syncing for security reasons.")); res.setSyncChanges( _ChangesHash ); setSyncEnabled( false ); emit syncFinished( res ); } else { startSiteCopy( "--update", Status ); } } else if( exitCode == 0 ) { qDebug() << "No update needed, remote is in sync."; SyncResult res( SyncResult::Success ); // store the analyze results into the sync result data structure. res.setSyncChanges( _ChangesHash ); // No update needed emit syncFinished( res ); } else { qDebug() << "Got an unknown exit code " << exitCode; emit syncFinished( SyncResult( SyncResult::Error ) ); } } _lastOutput.clear(); }