QGIS API Documentation  3.8.0-Zanzibar (11aff65)
qgsauthauthoritieseditor.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsauthauthoritieseditor.h
3  ---------------------
4  begin : April 26, 2015
5  copyright : (C) 2015 by Boundless Spatial, Inc. USA
6  author : Larry Shaffer
7  email : lshaffer at boundlessgeo dot com
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #ifndef QGSAUTHAUTHORITIESEDITOR_H
18 #define QGSAUTHAUTHORITIESEDITOR_H
19 
20 #include <QWidget>
21 #include "qgis_sip.h"
22 #include <QSslCertificate>
23 
24 #include "ui_qgsauthauthoritieseditor.h"
25 #include "qgsauthcertutils.h"
26 #include "qgsauthmanager.h"
27 #include "qgis_gui.h"
28 
29 class QgsMessageBar;
30 class QMenu;
31 class QAction;
32 
37 class GUI_EXPORT QgsAuthAuthoritiesEditor : public QWidget, private Ui::QgsAuthAuthoritiesEditor
38 {
39  Q_OBJECT
40 
41  public:
42 
47  explicit QgsAuthAuthoritiesEditor( QWidget *parent SIP_TRANSFERTHIS = nullptr );
48 
49  private slots:
50  void populateCaCertsView();
51 
52  void refreshCaCertsView();
53 
54  void showCertInfo( QTreeWidgetItem *item );
55 
57  void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
58 
60  void checkSelection();
61 
62  void handleDoubleClick( QTreeWidgetItem *item, int col );
63 
64  void btnAddCa_clicked();
65 
66  void btnRemoveCa_clicked();
67 
68  void btnInfoCa_clicked();
69 
70  void btnGroupByOrg_toggled( bool checked );
71 
72  void editDefaultTrustPolicy();
73 
74  void defaultTrustPolicyChanged( QgsAuthCertUtils::CertTrustPolicy trustpolicy );
75 
76  void btnCaFile_clicked();
77 
78  void btnCaFileClear_clicked();
79 
80  void showTrustedCertificateAuthorities();
81 
83  void authMessageOut( const QString &message, const QString &authtag, QgsAuthManager::MessageLevel level );
84 
85  protected:
87  void showEvent( QShowEvent *e ) override;
88 
89  private:
90  enum CaType
91  {
92  Section = 1000,
93  OrgName = 1001,
94  RootCaCert = 1002,
95  FileCaCert = 1003,
96  DbCaCert = 1004,
97  };
98 
99  void setupCaCertsTree();
100 
101  void populateDatabaseCaCerts();
102 
103  void populateFileCaCerts();
104 
105  void populateRootCaCerts();
106 
107  void populateCaCertsSection( QTreeWidgetItem *item, const QList<QSslCertificate> &certs,
108  QgsAuthAuthoritiesEditor::CaType catype );
109 
110  void appendCertsToGroup( const QList<QSslCertificate> &certs,
111  QgsAuthAuthoritiesEditor::CaType catype,
112  QTreeWidgetItem *parent = nullptr );
113 
114  void appendCertsToItem( const QList<QSslCertificate> &certs,
115  QgsAuthAuthoritiesEditor::CaType catype,
116  QTreeWidgetItem *parent = nullptr );
117 
118  void updateCertTrustPolicyCache();
119 
120  void populateUtilitiesMenu();
121 
122  QgsMessageBar *messageBar();
123  int messageTimeout();
124 
125  QVBoxLayout *mAuthNotifyLayout = nullptr;
126  QLabel *mAuthNotify = nullptr;
127 
128  QTreeWidgetItem *mRootCaSecItem = nullptr;
129  QTreeWidgetItem *mFileCaSecItem = nullptr;
130  QTreeWidgetItem *mDbCaSecItem = nullptr;
131 
133  QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList > mCertTrustCache;
134 
135  QMenu *mUtilitiesMenu = nullptr;
136  bool mDisabled = false;
137  QAction *mActionDefaultTrustPolicy = nullptr;
138  QAction *mActionShowTrustedCAs = nullptr;
139 };
140 
141 #endif // QGSAUTHAUTHORITIESEDITOR_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:45
MessageLevel
Message log level (mirrors that of QgsMessageLog, so it can also output there)
Widget for viewing and editing authentication identities database.
CertTrustPolicy
Type of certificate trust policy.