diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2011-07-11 10:06:41 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2011-07-18 11:37:08 +0200 |
commit | c36f3b1351088b86845dd8981a7a9b13b971606e (patch) | |
tree | a039935a831f91fccf6e56ffb6e98e08bf27a513 /src/sslinfodialog.cpp | |
parent | WARNING: HISTORY_VERSION upgrade!! (diff) | |
download | rekonq-c36f3b1351088b86845dd8981a7a9b13b971606e.tar.xz |
SSL rewamp, one step to finish!
These are last changes to clean up and improve SSL rekonq
communications.
It is yet missing a proper SSL errors API integration. You just need
to wait for the next commit...
Diffstat (limited to 'src/sslinfodialog.cpp')
-rw-r--r-- | src/sslinfodialog.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/sslinfodialog.cpp b/src/sslinfodialog.cpp index cb60cef8..376480af 100644 --- a/src/sslinfodialog.cpp +++ b/src/sslinfodialog.cpp @@ -37,6 +37,7 @@ #include <QtGui/QLayout> #include <QtCore/Q_PID> #include <QtNetwork/QSslCertificate> +#include <QtNetwork/QSslError> #include <QFormLayout> @@ -72,12 +73,30 @@ SslInfoDialog::SslInfoDialog(const QString &host, const WebSslInfo &info, QWidge QSslCertificate subjectCert = caList.first(); - showCertificateInfo(subjectCert); + if (subjectCert.isValid()) + showCertificateInfo(subjectCert, i18n("The Certificate is Valid!") ); + else + { + QString errors; + QStringList sl = info.certificateErrors().split("\t", QString::SkipEmptyParts); + Q_FOREACH(const QString &s, sl) + { + bool didConvert; + QSslError::SslError error = static_cast<QSslError::SslError>(s.trimmed().toInt(&didConvert)); + if (didConvert) + { + errors += QSslError(error).errorString() + QL1S("\n"); + } + } + showCertificateInfo(subjectCert, i18n("The certificate for this site is NOT valid for the following reasons:\n%1", errors) ); + } } -void SslInfoDialog::showCertificateInfo(QSslCertificate subjectCert) +void SslInfoDialog::showCertificateInfo(QSslCertificate subjectCert, const QString &certErrors) { + ui.certInfoLabel->setText(certErrors); + ui.subjectCN->setText( subjectCert.subjectInfo(QSslCertificate::CommonName) ); ui.subjectO->setText( subjectCert.subjectInfo(QSslCertificate::Organization) ); ui.subjectOU->setText( subjectCert.subjectInfo(QSslCertificate::OrganizationalUnitName) ); @@ -99,7 +118,7 @@ void SslInfoDialog::displayFromChain(int i) { QList<QSslCertificate> caList = m_info.certificateChain(); QSslCertificate cert = caList.at(i); - showCertificateInfo(cert); + showCertificateInfo(cert, QString()); } |