QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 <QSslCertificate>
22 
23 #include "ui_qgsauthauthoritieseditor.h"
24 #include "qgsauthmanager.h"
25 
26 class QgsMessageBar;
27 class QMenu;
28 class QAction;
29 
33 class GUI_EXPORT QgsAuthAuthoritiesEditor : public QWidget, private Ui::QgsAuthAuthoritiesEditor
34 {
35  Q_OBJECT
36 
37  public:
42  explicit QgsAuthAuthoritiesEditor( QWidget *parent = nullptr );
44 
45  private slots:
46  void populateCaCertsView();
47 
48  void refreshCaCertsView();
49 
50  void showCertInfo( QTreeWidgetItem *item );
51 
53  void selectionChanged( const QItemSelection& selected, const QItemSelection& deselected );
54 
56  void checkSelection();
57 
58  void handleDoubleClick( QTreeWidgetItem* item, int col );
59 
60  void on_btnAddCa_clicked();
61 
62  void on_btnRemoveCa_clicked();
63 
64  void on_btnInfoCa_clicked();
65 
66  void on_btnGroupByOrg_toggled( bool checked );
67 
68  void editDefaultTrustPolicy();
69 
70  void defaultTrustPolicyChanged( QgsAuthCertUtils::CertTrustPolicy trustpolicy );
71 
72  void on_btnCaFile_clicked();
73 
74  void on_btnCaFileClear_clicked();
75 
76  void showTrustedCertificateAuthorities();
77 
79  void authMessageOut( const QString& message, const QString& authtag, QgsAuthManager::MessageLevel level );
80 
81  protected:
83  void showEvent( QShowEvent *e ) override;
84 
85  private:
86  enum CaType
87  {
88  Section = 1000,
89  OrgName = 1001,
90  RootCaCert = 1002,
91  FileCaCert = 1003,
92  DbCaCert = 1004,
93  };
94 
95  void setupCaCertsTree();
96 
97  void populateDatabaseCaCerts();
98 
99  void populateFileCaCerts();
100 
101  void populateRootCaCerts();
102 
103  void populateCaCertsSection( QTreeWidgetItem *item, const QList<QSslCertificate>& certs,
104  QgsAuthAuthoritiesEditor::CaType catype );
105 
106  void appendCertsToGroup( const QList<QSslCertificate>& certs,
107  QgsAuthAuthoritiesEditor::CaType catype,
108  QTreeWidgetItem *parent = nullptr );
109 
110  void appendCertsToItem( const QList<QSslCertificate>& certs,
111  QgsAuthAuthoritiesEditor::CaType catype,
112  QTreeWidgetItem *parent = nullptr );
113 
114  void updateCertTrustPolicyCache();
115 
116  void populateUtilitiesMenu();
117 
118  QgsMessageBar * messageBar();
119  int messageTimeout();
120 
121  QVBoxLayout *mAuthNotifyLayout;
122  QLabel *mAuthNotify;
123 
124  QTreeWidgetItem * mRootCaSecItem;
125  QTreeWidgetItem * mFileCaSecItem;
126  QTreeWidgetItem * mDbCaSecItem;
127 
128  QgsAuthCertUtils::CertTrustPolicy mDefaultTrustPolicy;
130 
131  QMenu * mUtilitiesMenu;
132  bool mDisabled;
133  QAction * mActionDefaultTrustPolicy;
134  QAction * mActionShowTrustedCAs;
135 };
136 
137 #endif // QGSAUTHAUTHORITIESEDITOR_H
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:42
MessageLevel
Message log level (mirrors that of QgsMessageLog, so it can also output there)
virtual void showEvent(QShowEvent *event)
Widget for viewing and editing authentication identities database.
CertTrustPolicy
Type of certificate trust policy.