Changeset View
Changeset View
Standalone View
Standalone View
ui/certificateviewer.h
- This file was added.
1 | /*************************************************************************** | ||||
---|---|---|---|---|---|
2 | * Copyright (C) 2018 by Chinmoy Ranjan Pradhan <chinmoyrp65@gmail.com> * | ||||
3 | * * | ||||
4 | * This program is free software; you can redistribute it and/or modify * | ||||
5 | * it under the terms of the GNU General Public License as published by * | ||||
6 | * the Free Software Foundation; either version 2 of the License, or * | ||||
7 | * (at your option) any later version. * | ||||
8 | ***************************************************************************/ | ||||
9 | | ||||
10 | #ifndef OKULAR_CERTIFICATEVIEWER_H | ||||
11 | #define OKULAR_CERTIFICATEVIEWER_H | ||||
12 | | ||||
13 | #include <QVector> | ||||
14 | #include <QAbstractTableModel> | ||||
15 | #include <KPageDialog> | ||||
16 | | ||||
17 | #include "core/signatureutils.h" | ||||
18 | | ||||
19 | class QTextEdit; | ||||
20 | | ||||
21 | namespace Okular { | ||||
22 | class CertificateInfo; | ||||
23 | } | ||||
24 | | ||||
25 | class CertificateModel : public QAbstractTableModel | ||||
26 | { | ||||
27 | Q_OBJECT | ||||
28 | | ||||
29 | public: | ||||
30 | explicit CertificateModel( Okular::CertificateInfo *certInfo, QObject * parent = nullptr ); | ||||
31 | | ||||
32 | enum { | ||||
33 | PropertyKeyRole = Qt::UserRole, | ||||
34 | PropertyValueRole, | ||||
35 | PublicKeyRole | ||||
36 | }; | ||||
37 | | ||||
38 | int columnCount( const QModelIndex &parent = QModelIndex() ) const override; | ||||
39 | int rowCount( const QModelIndex &parent = QModelIndex() ) const override; | ||||
40 | QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override; | ||||
41 | QVariant headerData( int section, Qt::Orientation orientation, int role ) const override; | ||||
42 | | ||||
43 | private: | ||||
44 | QVector< QPair<QString, QString> > m_certificateProperties; | ||||
45 | Okular::CertificateInfo *m_certificateInfo; | ||||
46 | }; | ||||
47 | | ||||
48 | class CertificateViewer : public KPageDialog | ||||
49 | { | ||||
50 | Q_OBJECT | ||||
51 | | ||||
52 | public: | ||||
53 | CertificateViewer( Okular::CertificateInfo *certInfo, QWidget *parent ); | ||||
54 | | ||||
55 | private Q_SLOTS: | ||||
56 | void updateText( const QModelIndex &index ); | ||||
57 | void exportCertificate(); | ||||
58 | | ||||
59 | private: | ||||
60 | QTextEdit *m_propertyText; | ||||
61 | CertificateModel *m_certificateModel; | ||||
62 | Okular::CertificateInfo *m_certificateInfo; | ||||
63 | }; | ||||
64 | | ||||
65 | #endif |