KIO
ksslcertificatebox.cpp
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 * 00003 * Copyright (C) 2007 Andreas Hartmetz <ahartmetz@gmail.com> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #include "ksslcertificatebox.h" 00022 00023 #include "ui_certificateparty.h" 00024 00025 #include <QtNetwork/QSslCertificate> 00026 00027 class KSslCertificateBoxPrivate 00028 { 00029 public: 00030 Ui::CertificateParty ui; 00031 }; 00032 00033 00034 KSslCertificateBox::KSslCertificateBox(QWidget *parent) 00035 : QWidget(parent), 00036 d(new KSslCertificateBoxPrivate()) 00037 { 00038 d->ui.setupUi(this); 00039 } 00040 00041 00042 KSslCertificateBox::~KSslCertificateBox() 00043 { 00044 delete d; 00045 } 00046 00047 00048 void KSslCertificateBox::setCertificate(const QSslCertificate &cert, CertificateParty party) 00049 { 00050 if (party == Subject) { 00051 d->ui.commonName->setText(cert.subjectInfo(QSslCertificate::CommonName)); 00052 d->ui.organization->setText(cert.subjectInfo(QSslCertificate::Organization)); 00053 d->ui.organizationalUnit 00054 ->setText(cert.subjectInfo(QSslCertificate::OrganizationalUnitName)); 00055 d->ui.country->setText(cert.subjectInfo(QSslCertificate::CountryName)); 00056 d->ui.state->setText(cert.subjectInfo(QSslCertificate::StateOrProvinceName)); 00057 d->ui.city->setText(cert.subjectInfo(QSslCertificate::LocalityName)); 00058 } else if (party == Issuer) { 00059 d->ui.commonName->setText(cert.issuerInfo(QSslCertificate::CommonName)); 00060 d->ui.organization->setText(cert.issuerInfo(QSslCertificate::Organization)); 00061 d->ui.organizationalUnit 00062 ->setText(cert.issuerInfo(QSslCertificate::OrganizationalUnitName)); 00063 d->ui.country->setText(cert.issuerInfo(QSslCertificate::CountryName)); 00064 d->ui.state->setText(cert.issuerInfo(QSslCertificate::StateOrProvinceName)); 00065 d->ui.city->setText(cert.issuerInfo(QSslCertificate::LocalityName)); 00066 } 00067 } 00068 00069 00070 void KSslCertificateBox::clear() 00071 { 00072 d->ui.commonName->clear(); 00073 d->ui.organization->clear(); 00074 d->ui.organizationalUnit->clear(); 00075 d->ui.country->clear(); 00076 d->ui.state->clear(); 00077 d->ui.city->clear(); 00078 } 00079 00080 00081 #include "ksslcertificatebox.moc"
KDE 4.6 API Reference