Make sync journal name generating a method of SyncJournal.
Before it was in Folder, however, the command line client does not have the Folder class. To not duplicate code, the function to generate the sync journal name went to SyncEngine class.
Esse commit está contido em:
@@ -92,7 +92,8 @@ SyncEngine::SyncEngine(AccountPtr account, const QString& localPath,
|
||||
|
||||
csync_create(&_csync_ctx, localPath.toUtf8().data(), url_string.toUtf8().data());
|
||||
|
||||
const QString dbFile = _journal->databaseFilePath();
|
||||
const QString dbFile = this->journalDbFilePath();
|
||||
_journal->setDatabaseFilePath( dbFile );
|
||||
Q_ASSERT(!dbFile.isEmpty());
|
||||
csync_init(_csync_ctx, dbFile.toUtf8().data());
|
||||
|
||||
@@ -115,6 +116,23 @@ SyncEngine::~SyncEngine()
|
||||
csync_destroy(_csync_ctx);
|
||||
}
|
||||
|
||||
QString SyncEngine::journalDbFilePath() const
|
||||
{
|
||||
// localPath always has a trailing slash
|
||||
QString dbFile(_localPath);
|
||||
dbFile.append( QLatin1String(".sync_"));
|
||||
// FIXME: Maybe it is better to only allow different hosts, without path component.
|
||||
QString remoteUrlPath = _remoteUrl.toString();
|
||||
if( _remotePath != QLatin1String("/") ) {
|
||||
remoteUrlPath.append(_remotePath);
|
||||
}
|
||||
QByteArray ba = QCryptographicHash::hash( remoteUrlPath.toUtf8(), QCryptographicHash::Md5);
|
||||
dbFile.append( ba.left(6).toHex() );
|
||||
dbFile.append(".db");
|
||||
|
||||
return dbFile;
|
||||
}
|
||||
|
||||
//Convert an error code from csync to a user readable string.
|
||||
// Keep that function thread safe as it can be called from the sync thread or the main thread
|
||||
QString SyncEngine::csyncErrorToString(CSYNC_STATUS err)
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário