X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fclientidentity.cpp;h=6e63ac4d510afd6fe42f240d082548c4d346452a;hb=6c561d2b7b1bb303cfcd8a013179b1838d315910;hp=08a24b7f922e827866e124251d40823b9028d804;hpb=ab7ef4d24f62b5848b628482b7762ebfc0b53e1a;p=quassel.git diff --git a/src/client/clientidentity.cpp b/src/client/clientidentity.cpp index 08a24b7f..6e63ac4d 100644 --- a/src/client/clientidentity.cpp +++ b/src/client/clientidentity.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2018 by the Quassel Project * + * Copyright (C) 2005-2020 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -23,55 +23,35 @@ #include "client.h" #include "signalproxy.h" -INIT_SYNCABLE_OBJECT(CertIdentity) -CertIdentity::CertIdentity(IdentityId id, QObject *parent) +CertIdentity::CertIdentity(IdentityId id, QObject* parent) : Identity(id, parent) -#ifdef HAVE_SSL - , _certManager(0), - _isDirty(false) -#endif -{ -} +{} - -CertIdentity::CertIdentity(const Identity &other, QObject *parent) +CertIdentity::CertIdentity(const Identity& other, QObject* parent) : Identity(other, parent) -#ifdef HAVE_SSL - , _certManager(0), - _isDirty(false) -#endif -{ -} - +{} -CertIdentity::CertIdentity(const CertIdentity &other, QObject *parent) +CertIdentity::CertIdentity(const CertIdentity& other, QObject* parent) : Identity(other, parent) -#ifdef HAVE_SSL - , _certManager(0), - _isDirty(other._isDirty), - _sslKey(other._sslKey), - _sslCert(other._sslCert) -#endif -{ -} + , _isDirty(other._isDirty) + , _sslKey(other._sslKey) + , _sslCert(other._sslCert) +{} - -#ifdef HAVE_SSL void CertIdentity::enableEditSsl(bool enable) { if (!enable || _certManager) return; _certManager = new ClientCertManager(id(), this); - if (isValid()) { // this means we are not a newly created Identity but have a proper Id + if (isValid()) { // this means we are not a newly created Identity but have a proper Id Client::signalProxy()->synchronize(_certManager); - connect(_certManager, SIGNAL(updated()), this, SLOT(markClean())); - connect(_certManager, SIGNAL(initDone()), this, SLOT(markClean())); + connect(_certManager, &SyncableObject::updated, this, &CertIdentity::markClean); + connect(_certManager, &SyncableObject::initDone, this, &CertIdentity::markClean); } } - -void CertIdentity::setSslKey(const QSslKey &key) +void CertIdentity::setSslKey(const QSslKey& key) { if (key.toPem() == _sslKey.toPem()) return; @@ -79,8 +59,7 @@ void CertIdentity::setSslKey(const QSslKey &key) _isDirty = true; } - -void CertIdentity::setSslCert(const QSslCertificate &cert) +void CertIdentity::setSslCert(const QSslCertificate& cert) { if (cert.toPem() == _sslCert.toPem()) return; @@ -88,7 +67,6 @@ void CertIdentity::setSslCert(const QSslCertificate &cert) _isDirty = true; } - void CertIdentity::requestUpdateSslSettings() { if (!_certManager) @@ -97,18 +75,16 @@ void CertIdentity::requestUpdateSslSettings() _certManager->requestUpdate(_certManager->toVariantMap()); } - void CertIdentity::markClean() { _isDirty = false; emit sslSettingsUpdated(); } - // ======================================== // ClientCertManager // ======================================== -void ClientCertManager::setSslKey(const QByteArray &encoded) +void ClientCertManager::setSslKey(const QByteArray& encoded) { QSslKey key(encoded, QSsl::Rsa); if (key.isNull() && Client::isCoreFeatureEnabled(Quassel::Feature::EcdsaCertfpKeys)) @@ -118,10 +94,7 @@ void ClientCertManager::setSslKey(const QByteArray &encoded) _certIdentity->setSslKey(key); } - -void ClientCertManager::setSslCert(const QByteArray &encoded) +void ClientCertManager::setSslCert(const QByteArray& encoded) { _certIdentity->setSslCert(QSslCertificate(encoded)); } - -#endif // HAVE_SSL