uisupport: Provide helpers for dealing with widget changes
[quassel.git] / src / qtui / sslinfodlg.cpp
index 6fbf110..7db4c3e 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2015 by the Quassel Project                        *
+ *   Copyright (C) 2005-2018 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -43,7 +43,7 @@ SslInfoDlg::SslInfoDlg(const QSslSocket *socket, QWidget *parent)
     ui.encryption->setText(cipher.name());
     ui.protocol->setText(cipher.protocolString());
 
-    connect(ui.certificateChain, SIGNAL(currentIndexChanged(int)), SLOT(setCurrentCert(int)));
+    connect(ui.certificateChain, selectOverload<int>(&QComboBox::currentIndexChanged), this, &SslInfoDlg::setCurrentCert);
     foreach(const QSslCertificate &cert, socket->peerCertificateChain()) {
         ui.certificateChain->addItem(subjectInfo(cert, QSslCertificate::CommonName));
     }
@@ -80,25 +80,18 @@ void SslInfoDlg::setCurrentCert(int index)
     ui.validity->setText(tr("%1 to %2").arg(cert.effectiveDate().date().toString(Qt::ISODate), cert.expiryDate().date().toString(Qt::ISODate)));
     ui.md5Digest->setText(prettyDigest(cert.digest(QCryptographicHash::Md5)));
     ui.sha1Digest->setText(prettyDigest(cert.digest(QCryptographicHash::Sha1)));
+    ui.sha256Digest->setText(prettyDigest(cert.digest(QCryptographicHash::Sha256)));
 }
 
 // in Qt5, subjectInfo returns a QStringList(); turn this into a comma-separated string instead
 QString SslInfoDlg::subjectInfo(const QSslCertificate &cert, QSslCertificate::SubjectInfo subjectInfo) const
 {
-#if QT_VERSION < 0x050000
-    return cert.subjectInfo(subjectInfo);
-#else
     return cert.subjectInfo(subjectInfo).join(", ");
-#endif
 }
 
 
 // same here
 QString SslInfoDlg::issuerInfo(const QSslCertificate &cert, QSslCertificate::SubjectInfo subjectInfo) const
 {
-#if QT_VERSION < 0x050000
-    return cert.issuerInfo(subjectInfo);
-#else
     return cert.issuerInfo(subjectInfo).join(", ");
-#endif
 }