}
}
+void AccountManager::wantsAccountSavedSlot(AccountPtr a)
+{
+ auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
+ settings->beginGroup(a->id());
+ save(a, *settings, true);
+ settings->endGroup();
+}
+
void AccountManager::save(const AccountPtr& acc, QSettings& settings, bool saveCredentials)
{
settings.setValue(QLatin1String(urlC), acc->_url.toString());
}
newAccount->_id = id;
+ QObject::connect(newAccount.data(), SIGNAL(wantsAccountSaved(AccountPtr)),
+ this, SLOT(wantsAccountSavedSlot(AccountPtr)));
+
AccountStatePtr newAccountState(new AccountState(newAccount));
_accounts << newAccountState;
emit accountAdded(newAccountState.data());
bool isAccountIdAvailable(const QString& id) const;
QString generateFreeAccountId() const;
+public slots:
+ void wantsAccountSavedSlot(AccountPtr a);
+
Q_SIGNALS:
void accountAdded(AccountState *account);
if (_sslErrorHandler->handleErrors(errors, reply->sslConfiguration(), &approvedCerts, sharedFromThis())) {
QSslSocket::addDefaultCaCertificates(approvedCerts);
addApprovedCerts(approvedCerts);
+ emit wantsAccountSaved(sharedFromThis());
// all ssl certs are known and accepted. We can ignore the problems right away.
// qDebug() << out << "Certs are known and trusted! This is not an actual error.";
/// Forwards from QNetworkAccessManager::proxyAuthenticationRequired().
void proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*);
+ // e.g. when the approved SSL certificates changed
+ void wantsAccountSaved(AccountPtr acc);
+
protected Q_SLOTS:
void slotHandleSslErrors(QNetworkReply*,QList<QSslError>);
void slotCredentialsFetched();