#include <QSslKey>
#include <QSslCertificate>
-class CoreCertManager;
-class CoreSession;
+class CoreIdentity;
class SignalProxy;
+// ========================================
+// CoreCertManager
+// ========================================
+class CoreCertManager : public CertManager {
+ Q_OBJECT
+
+public:
+ CoreCertManager(CoreIdentity &identity);
+
+ virtual const QSslKey &sslKey() const;
+ virtual const QSslCertificate &sslCert() const;
+
+public slots:
+ virtual void setSslKey(const QByteArray &encoded);
+ virtual void setSslCert(const QByteArray &encoded);
+
+ void setId(IdentityId id);
+
+private:
+ CoreIdentity &identity;
+};
+
+// =========================================
+// CoreIdentity
+// =========================================
class CoreIdentity : public Identity {
Q_OBJECT
public:
- CoreIdentity(IdentityId id, SignalProxy *proxy, CoreSession *parent);
- CoreIdentity(const Identity &other, SignalProxy *proxy, CoreSession *parent);
+ CoreIdentity(IdentityId id, QObject *parent = 0);
+ CoreIdentity(const Identity &other, QObject *parent = 0);
+ CoreIdentity(const CoreIdentity &other, QObject *parent = 0);
+
+ void synchronize(SignalProxy *proxy);
inline const QSslKey &sslKey() const { return _sslKey; }
inline void setSslKey(const QSslKey &key) { _sslKey = key; }
inline void setSslCert(const QSslCertificate &cert) { _sslCert = cert; }
void setSslCert(const QByteArray &encoded);
-public slots:
- virtual void update(const QVariantMap &properties);
- void save();
+ CoreIdentity& CoreIdentity::operator=(const CoreIdentity &identity);
private:
QSslKey _sslKey;
QSslCertificate _sslCert;
- CoreCertManager *_certManager;
- CoreSession *_coreSession;
+ CoreCertManager _certManager;
};
+inline const QSslKey &CoreCertManager::sslKey() const {
+ return identity.sslKey();
+}
+inline const QSslCertificate &CoreCertManager::sslCert() const {
+ return identity.sslCert();
+}
-// ========================================
-// CoreCertManager
-// ========================================
-class CoreCertManager : public CertManager {
- Q_OBJECT
-
-public:
- CoreCertManager(CoreIdentity *identity);
-
- inline CoreIdentity *identity() const { return _identity; }
- virtual inline const QSslKey &sslKey() const { return identity()->sslKey(); }
- virtual inline const QSslCertificate &sslCert() const { return identity()->sslCert(); }
-
-public slots:
- virtual void setSslKey(const QByteArray &encoded);
- virtual void setSslCert(const QByteArray &encoded);
- void setId(IdentityId id);
-
-private:
- CoreIdentity *_identity;
-};
#endif //COREIDENTITY_H