summaryrefslogtreecommitdiff
path: root/src/websslinfo.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-04-30 11:23:37 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-04-30 11:23:37 +0200
commitc896cc340d7e6e0878b3249c5792e6d88a12cf42 (patch)
treefd0a7a61ff1d07f301f2188de5cb6fa473134897 /src/websslinfo.cpp
parentA tiny improvement in the error page, showing a fat icon.. :) (diff)
downloadrekonq-c896cc340d7e6e0878b3249c5792e6d88a12cf42.tar.xz
A coding style round
Diffstat (limited to 'src/websslinfo.cpp')
-rw-r--r--src/websslinfo.cpp161
1 files changed, 82 insertions, 79 deletions
diff --git a/src/websslinfo.cpp b/src/websslinfo.cpp
index ffc4918f..35112504 100644
--- a/src/websslinfo.cpp
+++ b/src/websslinfo.cpp
@@ -28,184 +28,187 @@
class WebSslInfo::WebSslInfoPrivate
{
public:
- WebSslInfoPrivate()
- : usedCipherBits(0), supportedCipherBits(0) {}
-
- QUrl url;
- QString ciphers;
- QString protocol;
- QString certErrors;
- QHostAddress peerAddress;
- QHostAddress parentAddress;
- QList<QSslCertificate> certificateChain;
-
- int usedCipherBits;
- int supportedCipherBits;
+ WebSslInfoPrivate()
+ : usedCipherBits(0), supportedCipherBits(0) {}
+
+ QUrl url;
+ QString ciphers;
+ QString protocol;
+ QString certErrors;
+ QHostAddress peerAddress;
+ QHostAddress parentAddress;
+ QList<QSslCertificate> certificateChain;
+
+ int usedCipherBits;
+ int supportedCipherBits;
};
WebSslInfo::WebSslInfo()
- :d(new WebSslInfo::WebSslInfoPrivate)
+ : d(new WebSslInfo::WebSslInfoPrivate)
{
}
WebSslInfo::WebSslInfo(const WebSslInfo& other)
- :d(new WebSslInfo::WebSslInfoPrivate)
+ : d(new WebSslInfo::WebSslInfoPrivate)
{
- *this = other;
+ *this = other;
}
WebSslInfo::~WebSslInfo()
{
- delete d;
- d = 0;
+ delete d;
+ d = 0;
}
bool WebSslInfo::isValid() const
{
- return !d->peerAddress.isNull();
+ return !d->peerAddress.isNull();
}
QUrl WebSslInfo::url() const
{
- return d->url;
+ return d->url;
}
QHostAddress WebSslInfo::parentAddress() const
{
- return d->parentAddress;
+ return d->parentAddress;
}
QHostAddress WebSslInfo::peerAddress() const
{
- return d->peerAddress;
+ return d->peerAddress;
}
QString WebSslInfo::protocol() const
{
- return d->protocol;
+ return d->protocol;
}
QString WebSslInfo::ciphers() const
{
- return d->ciphers;
+ return d->ciphers;
}
QString WebSslInfo::certificateErrors() const
{
- return d->certErrors;
+ return d->certErrors;
}
-int WebSslInfo::supportedChiperBits () const
+int WebSslInfo::supportedChiperBits() const
{
- return d->supportedCipherBits;
+ return d->supportedCipherBits;
}
-int WebSslInfo::usedChiperBits () const
+int WebSslInfo::usedChiperBits() const
{
- return d->usedCipherBits;
+ return d->usedCipherBits;
}
QList<QSslCertificate> WebSslInfo::certificateChain() const
{
- return d->certificateChain;
+ return d->certificateChain;
}
-WebSslInfo& WebSslInfo::operator=(const WebSslInfo& other)
+WebSslInfo& WebSslInfo::operator=(const WebSslInfo & other)
{
- d->ciphers = other.d->ciphers;
- d->protocol = other.d->protocol;
- d->certErrors = other.d->certErrors;
- d->peerAddress = other.d->peerAddress;
- d->parentAddress = other.d->parentAddress;
- d->certificateChain = other.d->certificateChain;
+ d->ciphers = other.d->ciphers;
+ d->protocol = other.d->protocol;
+ d->certErrors = other.d->certErrors;
+ d->peerAddress = other.d->peerAddress;
+ d->parentAddress = other.d->parentAddress;
+ d->certificateChain = other.d->certificateChain;
- d->usedCipherBits = other.d->usedCipherBits;
- d->supportedCipherBits = other.d->supportedCipherBits;
- d->url = other.d->url;
+ d->usedCipherBits = other.d->usedCipherBits;
+ d->supportedCipherBits = other.d->supportedCipherBits;
+ d->url = other.d->url;
- return *this;
+ return *this;
}
QVariant WebSslInfo::toMetaData() const
{
- if (isValid()) {
- QMap<QString, QVariant> data;
- data.insert("ssl_in_use", true);
- data.insert("ssl_peer_ip", d->peerAddress.toString());
- data.insert("ssl_parent_ip", d->parentAddress.toString());
- data.insert("ssl_protocol_version", d->protocol);
- data.insert("ssl_cipher", d->ciphers);
- data.insert("ssl_cert_errors", d->certErrors);
- data.insert("ssl_cipher_used_bits", d->usedCipherBits);
- data.insert("ssl_cipher_bits", d->supportedCipherBits);
- QByteArray certChain;
- Q_FOREACH(const QSslCertificate& cert, d->certificateChain)
+ if (isValid())
+ {
+ QMap<QString, QVariant> data;
+ data.insert("ssl_in_use", true);
+ data.insert("ssl_peer_ip", d->peerAddress.toString());
+ data.insert("ssl_parent_ip", d->parentAddress.toString());
+ data.insert("ssl_protocol_version", d->protocol);
+ data.insert("ssl_cipher", d->ciphers);
+ data.insert("ssl_cert_errors", d->certErrors);
+ data.insert("ssl_cipher_used_bits", d->usedCipherBits);
+ data.insert("ssl_cipher_bits", d->supportedCipherBits);
+ QByteArray certChain;
+ Q_FOREACH(const QSslCertificate& cert, d->certificateChain)
certChain += cert.toPem();
- data.insert("ssl_peer_chain", certChain);
- return data;
- }
+ data.insert("ssl_peer_chain", certChain);
+ return data;
+ }
- return QVariant();
+ return QVariant();
}
void WebSslInfo::fromMetaData(const QVariant& value)
{
- if (value.isValid() && value.type() == QVariant::Map) {
- QMap<QString,QVariant> metaData = value.toMap();
- if (metaData.value("ssl_in_use", false).toBool()) {
- setCertificateChain(metaData.value("ssl_peer_chain").toByteArray());
- setPeerAddress(metaData.value("ssl_peer_ip").toString());
- setParentAddress(metaData.value("ssl_parent_ip").toString());
- setProtocol(metaData.value("ssl_protocol_version").toString());
- setCiphers(metaData.value("ssl_cipher").toString());
- setCertificateErrors(metaData.value("ssl_cert_errors").toString());
- setUsedCipherBits(metaData.value("ssl_cipher_used_bits").toString());
- setSupportedCipherBits(metaData.value("ssl_cipher_bits").toString());
+ if (value.isValid() && value.type() == QVariant::Map)
+ {
+ QMap<QString, QVariant> metaData = value.toMap();
+ if (metaData.value("ssl_in_use", false).toBool())
+ {
+ setCertificateChain(metaData.value("ssl_peer_chain").toByteArray());
+ setPeerAddress(metaData.value("ssl_peer_ip").toString());
+ setParentAddress(metaData.value("ssl_parent_ip").toString());
+ setProtocol(metaData.value("ssl_protocol_version").toString());
+ setCiphers(metaData.value("ssl_cipher").toString());
+ setCertificateErrors(metaData.value("ssl_cert_errors").toString());
+ setUsedCipherBits(metaData.value("ssl_cipher_used_bits").toString());
+ setSupportedCipherBits(metaData.value("ssl_cipher_bits").toString());
+ }
}
- }
}
-void WebSslInfo::setUrl (const QUrl &url)
+void WebSslInfo::setUrl(const QUrl &url)
{
- d->url = url;
+ d->url = url;
}
void WebSslInfo::setPeerAddress(const QString& address)
{
- d->peerAddress = address;
+ d->peerAddress = address;
}
void WebSslInfo::setParentAddress(const QString& address)
{
- d->parentAddress = address;
+ d->parentAddress = address;
}
void WebSslInfo::setProtocol(const QString& protocol)
{
- d->protocol = protocol;
+ d->protocol = protocol;
}
void WebSslInfo::setCertificateChain(const QByteArray& chain)
{
- d->certificateChain = QSslCertificate::fromData(chain);
+ d->certificateChain = QSslCertificate::fromData(chain);
}
void WebSslInfo::setCiphers(const QString& ciphers)
{
- d->ciphers = ciphers;
+ d->ciphers = ciphers;
}
void WebSslInfo::setUsedCipherBits(const QString& bits)
{
- d->usedCipherBits = bits.toInt();
+ d->usedCipherBits = bits.toInt();
}
void WebSslInfo::setSupportedCipherBits(const QString& bits)
{
- d->supportedCipherBits = bits.toInt();
+ d->supportedCipherBits = bits.toInt();
}
void WebSslInfo::setCertificateErrors(const QString& certErrors)
{
- d->certErrors = certErrors;
+ d->certErrors = certErrors;
}