Use QSslCertificate::isNull() instead of isValid() in IdentityEditWidget
[quassel.git] / src / qtui / settingspages / identityeditwidget.cpp
index f670753..6585891 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  *
@@ -25,6 +25,7 @@
 #include <QDropEvent>
 #include <QFileDialog>
 #include <QUrl>
+#include <QMessageBox>
 
 #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,7 +402,7 @@ 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"));