QSslCertificate::subjectInfo() returns a QStringList in Qt5
[quassel.git] / src / qtui / settingspages / identityeditwidget.cpp
index b5a3dfa..25d5abc 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2013 by the Quassel Project                        *
+ *   Copyright (C) 2005-2014 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -300,7 +300,7 @@ void IdentityEditWidget::sslDropEvent(QDropEvent *event, bool isCert)
 
     if (isCert) {
         QSslCertificate cert = certByFilename(filename);
-        if (cert.isValid())
+        if (!cert.isNull())
             showCertState(cert);
     }
     else {
@@ -393,7 +393,7 @@ QSslCertificate IdentityEditWidget::certByFilename(const QString &filename)
 
     for (int i = 0; i < 2; i++) {
         cert = QSslCertificate(certRaw, (QSsl::EncodingFormat)i);
-        if (cert.isValid())
+        if (!cert.isNull())
             break;
     }
     return cert;
@@ -402,14 +402,19 @@ QSslCertificate IdentityEditWidget::certByFilename(const QString &filename)
 
 void IdentityEditWidget::showCertState(const QSslCertificate &cert)
 {
-    if (!cert.isValid()) {
+    if (cert.isNull()) {
         ui.certOrgLabel->setText(tr("No Certificate loaded"));
         ui.certCNameLabel->setText(tr("No Certificate loaded"));
         ui.clearOrLoadCertButton->setText(tr("Load"));
     }
     else {
+#if QT_VERSION < 0x050000
         ui.certOrgLabel->setText(cert.subjectInfo(QSslCertificate::Organization));
         ui.certCNameLabel->setText(cert.subjectInfo(QSslCertificate::CommonName));
+#else
+        ui.certOrgLabel->setText(cert.subjectInfo(QSslCertificate::Organization).join(", "));
+        ui.certCNameLabel->setText(cert.subjectInfo(QSslCertificate::CommonName).join(", "));
+#endif
         ui.clearOrLoadCertButton->setText(tr("Clear"));
     }
     ui.certOrgLabel->setProperty("sslCert", cert.toPem());