diff --git a/src/libsync/creds/credentialscommon.cpp b/src/libsync/creds/credentialscommon.cpp index feba82f90b..7ea5c1d777 100644 --- a/src/libsync/creds/credentialscommon.cpp +++ b/src/libsync/creds/credentialscommon.cpp @@ -25,6 +25,7 @@ #include "utility.h" #include "account.h" +#include "syncengine.h" namespace OCC { @@ -34,10 +35,11 @@ int handleNeonSSLProblems(const char* prompt, size_t /*len*/, int /*echo*/, int /*verify*/, - void* /*userdata*/) + void* userdata) { int re = 0; const QString qPrompt = QString::fromLatin1( prompt ).trimmed(); + SyncEngine* engine = reinterpret_cast(userdata); if( qPrompt.startsWith( QLatin1String("There are problems with the SSL certificate:"))) { // SSL is requested. If the program came here, the SSL check was done by Qt @@ -48,7 +50,7 @@ int handleNeonSSLProblems(const char* prompt, int pos = 0; // This is the set of certificates which QNAM accepted, so we should accept // them as well - QList certs = AccountManager::instance()->account()->sslConfiguration().peerCertificateChain(); + QList certs = engine->account()->sslConfiguration().peerCertificateChain(); while (!certOk && (pos = regexp.indexIn(qPrompt, 1+pos)) != -1) { QString neon_fingerprint = regexp.cap(1); diff --git a/src/libsync/creds/httpcredentials.cpp b/src/libsync/creds/httpcredentials.cpp index a5cf735177..1210b70933 100644 --- a/src/libsync/creds/httpcredentials.cpp +++ b/src/libsync/creds/httpcredentials.cpp @@ -29,6 +29,7 @@ #include "accessmanager.h" #include "utility.h" #include "theme.h" +#include "syncengine.h" #include "creds/credentialscommon.h" #include "creds/httpcredentials.h" @@ -47,8 +48,8 @@ int getauth(const char *prompt, int re = 0; // ### safe? Not really. If the wizard is run in the main thread, the caccount could change during the sync. - // Ideally, http_credentials could be use userdata, but userdata is the SyncEngine. - HttpCredentials* http_credentials = qobject_cast(AccountManager::instance()->account()->credentials()); + SyncEngine* engine = reinterpret_cast(userdata); + HttpCredentials* http_credentials = qobject_cast(engine->account()->credentials()); if (!http_credentials) { qDebug() << "Not a HTTP creds instance!"; diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index dd007c3a75..b442608b70 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -1149,6 +1149,11 @@ qint64 SyncEngine::timeSinceFileTouched(const QString& fn) const return -1; } +AccountPtr SyncEngine::account() const +{ + return _account; +} + void SyncEngine::abort() { csync_request_abort(_csync_ctx); diff --git a/src/libsync/syncengine.h b/src/libsync/syncengine.h index 1b99085cf7..e63a51f5d5 100644 --- a/src/libsync/syncengine.h +++ b/src/libsync/syncengine.h @@ -76,6 +76,8 @@ public: */ qint64 timeSinceFileTouched(const QString& fn) const; + AccountPtr account() const; + signals: void csyncError( const QString& ); void csyncUnavailable();