diff --git a/src/account.cpp b/src/account.cpp index 4c30853c0841d982de0ca3867e677c323f740d41..7e40e9c1a0b23024780cd1ccf6e1f9760b9b986a 100644 --- a/src/account.cpp +++ b/src/account.cpp @@ -1054,25 +1054,46 @@ void Account::setTlsPassword(const QString& detail) d_ptr->setAccountProperty(DRing::Account::ConfProperties::TLS::PASSWORD, detail); } +///Set the certificate authority list file +void Account::setTlsCaListCertificate(const QString& path) +{ + Certificate* cert = CertificateModel::instance()->getCertificate(path); + setTlsCaListCertificate(cert); +} + +///Set the certificate +void Account::setTlsCertificate(const QString& path) +{ + Certificate* cert = CertificateModel::instance()->getCertificate(path); + setTlsCertificate(cert); +} + +///Set the private key +void Account::setTlsPrivateKeyCertificate(const QString& path) +{ + Certificate* cert = CertificateModel::instance()->getCertificate(path); + setTlsPrivateKeyCertificate(cert); +} + ///Set the certificate authority list file void Account::setTlsCaListCertificate(Certificate* cert) { - d_ptr->m_pCaCert = cert; //FIXME memory leak - d_ptr->setAccountProperty(DRing::Account::ConfProperties::TLS::CA_LIST_FILE, cert?cert->path().toLocalFile():QString()); + d_ptr->m_pCaCert = cert; + d_ptr->setAccountProperty(DRing::Account::ConfProperties::TLS::CA_LIST_FILE, cert?cert->path().path():QString()); } ///Set the certificate void Account::setTlsCertificate(Certificate* cert) { - d_ptr->m_pTlsCert = cert; //FIXME memory leak - d_ptr->setAccountProperty(DRing::Account::ConfProperties::TLS::CERTIFICATE_FILE, cert?cert->path().toLocalFile():QString()); + d_ptr->m_pTlsCert = cert; + d_ptr->setAccountProperty(DRing::Account::ConfProperties::TLS::CERTIFICATE_FILE, cert?cert->path().path():QString()); } ///Set the private key void Account::setTlsPrivateKeyCertificate(Certificate* cert) { - d_ptr->m_pPrivateKey = cert; //FIXME memory leak - d_ptr->setAccountProperty(DRing::Account::ConfProperties::TLS::PRIVATE_KEY_FILE, cert?cert->path().toLocalFile():QString()); + d_ptr->m_pPrivateKey = cert; + d_ptr->setAccountProperty(DRing::Account::ConfProperties::TLS::PRIVATE_KEY_FILE, cert?cert->path().path():QString()); } ///Set the TLS server diff --git a/src/account.h b/src/account.h index 4ea0b84242cc779389bd61d3543ad4a5c1e65cb6..998a968739488d2c06c638287178da0ca63c0b6c 100644 --- a/src/account.h +++ b/src/account.h @@ -91,9 +91,9 @@ class LIB_EXPORT Account : public QObject { Q_PROPERTY(QString mailbox READ mailbox WRITE setMailbox ) Q_PROPERTY(QString proxy READ proxy WRITE setProxy ) Q_PROPERTY(QString tlsPassword READ tlsPassword WRITE setTlsPassword ) -// Q_PROPERTY(QString tlsCaListFile READ tlsCaListFile WRITE setTlsCaListFile ) -// Q_PROPERTY(QString tlsCertificateFile READ tlsCertificateFile WRITE setTlsCertificateFile ) -// Q_PROPERTY(QString tlsPrivateKeyFile READ tlsPrivateKeyFile WRITE setTlsPrivateKeyFile ) + Q_PROPERTY(Certificate* tlsCaListCertificate READ tlsCaListCertificate WRITE setTlsCaListCertificate ) + Q_PROPERTY(Certificate* tlsCertificate READ tlsCertificate WRITE setTlsCertificate ) + Q_PROPERTY(Certificate* tlsPrivateKeyCertificate READ tlsPrivateKeyCertificate WRITE setTlsPrivateKeyCertificate ) Q_PROPERTY(QString tlsServerName READ tlsServerName WRITE setTlsServerName ) Q_PROPERTY(QString sipStunServer READ sipStunServer WRITE setSipStunServer ) Q_PROPERTY(QString publishedAddress READ publishedAddress WRITE setPublishedAddress ) @@ -332,6 +332,9 @@ class LIB_EXPORT Account : public QObject { void setTlsCaListCertificate (Certificate* cert ); void setTlsCertificate (Certificate* cert ); void setTlsPrivateKeyCertificate (Certificate* cert ); + void setTlsCaListCertificate (const QString& detail ); + void setTlsCertificate (const QString& detail ); + void setTlsPrivateKeyCertificate (const QString& detail ); void setTlsServerName (const QString& detail ); void setSipStunServer (const QString& detail ); void setPublishedAddress (const QString& detail ); diff --git a/src/accountstatusmodel.cpp b/src/accountstatusmodel.cpp index db91f0c4feae9218b13d8976d7f9a18f5b8e8e16..be13ab4b35aebb9ce91d952cad128835e8f9d04b 100644 --- a/src/accountstatusmodel.cpp +++ b/src/accountstatusmodel.cpp @@ -430,7 +430,7 @@ void AccountStatusModel::addSipRegistrationEvent(const QString& fallbackMessage, void AccountStatusModel::addTransportEvent(const QString& fallbackMessage, int errorCode) { - if (!d_ptr->m_lRows.size() || errorCode != d_ptr->m_pAccount->lastTransportErrorCode()) { + if ((!d_ptr->m_lRows.size()) || errorCode != d_ptr->m_pAccount->lastTransportErrorCode()) { beginInsertRows(QModelIndex(), d_ptr->m_lRows.size(), d_ptr->m_lRows.size()); d_ptr->m_lRows << new AccountStatusRow(fallbackMessage, errorCode, Type::TRANSPORT); endInsertRows();