comparison ui/certificatelistwidget.h @ 743:a467204a35f5

Rework User Interface. Certificate lists are now plain lists of widgets and no longer a ListWidget. Details are no longer shown extra but included in the list. List entries are somewhat larger accordingly.
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 04 Jul 2014 16:15:59 +0200
parents 3d669400104a
children 9c4543128666
comparison
equal deleted inserted replaced
742:627e8d678b6d 743:a467204a35f5
10 10
11 #include <QWidget> 11 #include <QWidget>
12 #include <QMainWindow> 12 #include <QMainWindow>
13 #include <QLabel> 13 #include <QLabel>
14 #include <QListWidget> 14 #include <QListWidget>
15 #include <QVBoxLayout>
15 16
16 #include "certificate.h" 17 #include "certificate.h"
17 /** 18 /**
18 * @file certificatelistwidget.h 19 * @file certificatelistwidget.h
19 * @brief Displays a list of certificates and a details panel for a selected 20 * @brief Displays a list of certificates and a details panel for a selected
20 * certificate. 21 * certificate.
21 */ 22 */
23
24 class CertificateItemWidget;
22 25
23 Q_DECLARE_METATYPE(Certificate); 26 Q_DECLARE_METATYPE(Certificate);
24 class CertificateListWidget : public QWidget 27 class CertificateListWidget : public QWidget
25 { 28 {
26 Q_OBJECT 29 Q_OBJECT
29 32
30 void addCertificate(const Certificate &certificate, bool state, 33 void addCertificate(const Certificate &certificate, bool state,
31 bool editable = true, 34 bool editable = true,
32 const QString& installLabel = tr("install"), 35 const QString& installLabel = tr("install"),
33 const QString& removeLabel = tr("remove")); 36 const QString& removeLabel = tr("remove"));
34 void addCertificates(const QList<Certificate> &list);
35 void removeCertificate(const Certificate &cert); 37 void removeCertificate(const Certificate &cert);
36 void setCertState(bool state, const Certificate &cert); 38 void setCertState(bool state, const Certificate &cert);
37 void clear(); 39 void clear();
38 QStringList certificates(); 40 QStringList certificates();
39 QStringList selectedCertificates(); 41 QStringList selectedCertificates();
40 QStringList unselectedCertificates(); 42 QStringList unselectedCertificates();
41 QList<Certificate> certificateList(); 43 QList<Certificate> certificateList();
42 int selectedCertCount(); 44 int selectedCertCount();
43 bool contains(const Certificate &cert); 45 bool contains(const Certificate &cert);
44 void setSelected(int index);
45 int selected() { return mCertificateList->currentRow(); }
46 46
47 private: 47 private:
48 void setupGUI();
49 48
50 QListWidget *mCertificateList; 49 QList <CertificateItemWidget*> mCertificateWidgets;
51 QLabel *mSubjectCN; 50 QVBoxLayout mLayout;
52 QLabel *mSubjectO;
53 QLabel *mIssuerCN;
54 QLabel *mIssuerO;
55 QLabel *mValidFrom;
56 QLabel *mValidTo;
57 QLabel *mFingerprint;
58 51
59 private slots: 52 private slots:
60 void updateDetails(QListWidgetItem *item);
61 void certStateChanged(bool state, const Certificate &cert); 53 void certStateChanged(bool state, const Certificate &cert);
62 54
63 signals: 55 signals:
64 void certListChanged(int selected); 56 void certListChanged(int selected);
65 void certChanged(bool state, const Certificate &cert); 57 void certChanged(bool state, const Certificate &cert);

http://wald.intevation.org/projects/trustbridge/