X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fidentityeditwidget.cpp;h=25d5abc8e0f5d34f524b943190412ef65536be98;hp=27e0609dc49c9811a5164d7622377823f1c52596;hb=7e867cbefbf6c3a9efa3ef66303b9ec10216b247;hpb=c4f9c122f56d2c58296c6a8663f79d605b033ae2 diff --git a/src/qtui/settingspages/identityeditwidget.cpp b/src/qtui/settingspages/identityeditwidget.cpp index 27e0609d..25d5abc8 100644 --- a/src/qtui/settingspages/identityeditwidget.cpp +++ b/src/qtui/settingspages/identityeditwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 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 * @@ -25,6 +25,7 @@ #include #include #include +#include #include "client.h" #include "iconloader.h" @@ -299,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 { @@ -340,6 +341,7 @@ QSslKey IdentityEditWidget::keyByFilename(const QString &filename) goto returnKey; } } + QMessageBox::information(this, tr("Failed to read key"), tr("Failed to read the key file. It is either incompatible or invalid. Note that the key file must not have a passphrase.")); returnKey: return key; } @@ -391,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; @@ -400,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());