Further cleanups that were possible by new change notification.

This commit is contained in:
Klaas Freitag 2012-12-06 18:35:02 +01:00
parent f296fad4bb
commit fbae2d7330

View file

@ -53,24 +53,6 @@ void csyncLogCatcher(CSYNC *ctx,
Logger::instance()->csyncLog( QString::fromUtf8(function) + QLatin1String("> ") + QString::fromUtf8(buffer) ); Logger::instance()->csyncLog( QString::fromUtf8(function) + QLatin1String("> ") + QString::fromUtf8(buffer) );
} }
walkStats_s::walkStats_s() {
errorType = 0;
eval = 0;
removed = 0;
renamed = 0;
newFiles = 0;
conflicts = 0;
ignores = 0;
sync = 0;
error = 0;
dirPermErrors = 0;
seenFiles = 0;
}
CSyncThread::CSyncThread(const QString &source, const QString &target) CSyncThread::CSyncThread(const QString &source, const QString &target)
: _source(source) : _source(source)
, _target(target) , _target(target)
@ -167,7 +149,6 @@ void CSyncThread::startSync()
case CSYNC_ERR_ACCESS_FAILED: case CSYNC_ERR_ACCESS_FAILED:
errStr = tr("<p>The target directory %1 does not exist.</p><p>Please check the sync setup.</p>").arg(_target); errStr = tr("<p>The target directory %1 does not exist.</p><p>Please check the sync setup.</p>").arg(_target);
// this is critical. The database has to be removed. // this is critical. The database has to be removed.
emitStateDb(csync); // to make the name of the csync db known.
emit wipeDb(); emit wipeDb();
break; break;
case CSYNC_ERR_MODULE: case CSYNC_ERR_MODULE:
@ -197,8 +178,6 @@ void CSyncThread::startSync()
csync_set_module_property(csync, "proxy_user", _proxy.user().toAscii().data() ); csync_set_module_property(csync, "proxy_user", _proxy.user().toAscii().data() );
csync_set_module_property(csync, "proxy_pwd" , _proxy.password().toAscii().data() ); csync_set_module_property(csync, "proxy_pwd" , _proxy.password().toAscii().data() );
emitStateDb(csync);
qDebug() << "#### Update start #################################################### >>"; qDebug() << "#### Update start #################################################### >>";
if( csync_update(csync) < 0 ) { if( csync_update(csync) < 0 ) {
CSYNC_ERROR_CODE err = csync_get_error( csync ); CSYNC_ERROR_CODE err = csync_get_error( csync );
@ -248,20 +227,6 @@ cleanup:
emit(finished()); emit(finished());
} }
void CSyncThread::emitStateDb( CSYNC *csync )
{
// After csync_init the statedb file name can be emitted
const char *statedb = csync_get_statedb_file( csync );
if( statedb ) {
QString stateDbFile = QString::fromUtf8(statedb);
free((void*)statedb);
emit csyncStateDbFile( stateDbFile );
} else {
qDebug() << "WRN: Unable to get csync statedb file name";
}
}
void CSyncThread::setConnectionDetails( const QString &user, const QString &passwd, const QNetworkProxy &proxy ) void CSyncThread::setConnectionDetails( const QString &user, const QString &passwd, const QNetworkProxy &proxy )
{ {
_mutex.lock(); _mutex.lock();