rrenkert@582: /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik rrenkert@582: * Software engineering by Intevation GmbH rrenkert@582: * rrenkert@582: * This file is Free Software under the GNU GPL (v>=2) rrenkert@582: * and comes with ABSOLUTELY NO WARRANTY! rrenkert@582: * See LICENSE.txt for details. rrenkert@582: */ rrenkert@582: #ifndef CERTIFICATELISTWIDGET_H rrenkert@582: #define CERTIFICATELISTWIDGET_H rrenkert@582: rrenkert@582: #include rrenkert@582: #include rrenkert@582: #include rrenkert@582: #include rrenkert@582: rrenkert@582: #include "certificate.h" rrenkert@582: /** rrenkert@582: * @file certificatelistwidget.h rrenkert@582: * @brief Displays a list of certificates and a details panel for a selected rrenkert@582: * certificate. rrenkert@582: */ rrenkert@582: rrenkert@582: Q_DECLARE_METATYPE(Certificate); rrenkert@582: class CertificateListWidget : public QWidget rrenkert@582: { rrenkert@582: Q_OBJECT rrenkert@582: public: rrenkert@582: CertificateListWidget(QWidget *parent, Qt::WindowFlags flags = 0); rrenkert@582: andre@687: void addCertificate(const Certificate &certificate, bool state, andre@687: bool editable = true, andre@687: const QString& installLabel = tr("install"), andre@687: const QString& removeLabel = tr("remove")); rrenkert@582: void addCertificates(const QList &list); rrenkert@639: void removeCertificate(const Certificate &cert); rrenkert@639: void setCertState(bool state, const Certificate &cert); rrenkert@627: void clear(); rrenkert@627: QStringList certificates(); rrenkert@639: QStringList selectedCertificates(); rrenkert@639: QStringList unselectedCertificates(); rrenkert@639: QList certificateList(); rrenkert@627: int selectedCertCount(); rrenkert@639: bool contains(const Certificate &cert); rrenkert@653: void setSelected(int index); andre@720: int selected() { return mCertificateList->currentRow(); } rrenkert@582: rrenkert@582: private: rrenkert@582: void setupGUI(); rrenkert@582: rrenkert@582: QListWidget *mCertificateList; rrenkert@582: QLabel *mSubjectCN; rrenkert@582: QLabel *mSubjectO; rrenkert@582: QLabel *mIssuerCN; rrenkert@582: QLabel *mIssuerO; rrenkert@582: QLabel *mValidFrom; rrenkert@582: QLabel *mValidTo; rrenkert@582: QLabel *mFingerprint; rrenkert@582: rrenkert@582: private slots: rrenkert@582: void updateDetails(QListWidgetItem *item); rrenkert@627: void certStateChanged(bool state, const Certificate &cert); rrenkert@627: rrenkert@627: signals: rrenkert@627: void certListChanged(int selected); rrenkert@639: void certChanged(bool state, const Certificate &cert); rrenkert@582: rrenkert@582: }; rrenkert@582: #endif // CERTIFICATELISTWIDGET_H