QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
qgsauthsslimportdialog.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsauthsslimportdialog.h
3 ---------------------
4 begin : May 17, 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/****************************************************************************
18**
19** Portions of this code were derived from the following...
20**
21** qt-everywhere-opensource-src-4.8.6/examples/network/
22** securesocketclient/certificateinfo.h (and .cpp)
23**
24** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
25** Contact: http://www.qt-project.org/legal
26**
27** This file is part of the examples of the Qt Toolkit.
28**
29** $QT_BEGIN_LICENSE:BSD$
30** You may use this file under the terms of the BSD license as follows:
31**
32** "Redistribution and use in source and binary forms, with or without
33** modification, are permitted provided that the following conditions are
34** met:
35** * Redistributions of source code must retain the above copyright
36** notice, this list of conditions and the following disclaimer.
37** * Redistributions in binary form must reproduce the above copyright
38** notice, this list of conditions and the following disclaimer in
39** the documentation and/or other materials provided with the
40** distribution.
41** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
42** of its contributors may be used to endorse or promote products derived
43** from this software without specific prior written permission.
44**
45**
46** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
47** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
48** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
49** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
50** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
51** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
52** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
53** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
54** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
55** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
56** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
57**
58** $QT_END_LICENSE$
59**
60****************************************************************************/
61
62#ifndef QGSAUTHSSLIMPORTDIALOG_H
63#define QGSAUTHSSLIMPORTDIALOG_H
64
65#include "ui_qgsauthsslimportdialog.h"
66#include "qgis_sip.h"
67
68#include <QDialog>
69#include <QAbstractSocket>
70#include <QSslSocket>
71#include "qgis_gui.h"
72
73class QPushButton;
74class QSslSocket;
75class QTimer;
76
77
82class GUI_EXPORT QgsAuthSslImportDialog : public QDialog, private Ui::QgsAuthSslTestDialog
83{
84 Q_OBJECT
85 public:
90 QgsAuthSslImportDialog( QWidget *parent SIP_TRANSFERTHIS = nullptr );
91
92 public slots:
93 void accept() override;
94
95 private slots:
96 void updateEnabledState();
97 void secureConnect();
98 void socketStateChanged( QAbstractSocket::SocketState state );
99 void socketConnected();
100 void socketDisconnected();
101 void socketEncrypted();
102 void socketError( QAbstractSocket::SocketError err );
103 void socketReadyRead();
104 void destroySocket();
105 void sslErrors( const QList<QSslError> &errors );
106 void showCertificateInfo();
107
108 void widgetReadyToSaveChanged( bool cansave );
109 void checkCanSave();
110
111 void radioServerImportToggled( bool checked );
112 void radioFileImportToggled( bool checked );
113
114 void btnCertPath_clicked();
115 void clearCertificateConfig();
116 void clearStatusCertificateConfig();
117
118 private:
119 void loadCertFromFile();
120
121 void appendString( const QString &line );
122
123 QPushButton *saveButton();
124 QPushButton *closeButton();
125 QString getOpenFileName( const QString &title, const QString &extfilter );
126
127 QSslSocket *mSocket = nullptr;
128 bool mExecErrorsDialog = false;
129 QTimer *mTimer = nullptr;
130 QList<QSslError> mSslErrors;
131 QList<QSslCertificate> mTrustedCAs;
132
133 QVBoxLayout *mAuthNotifyLayout = nullptr;
134 QLabel *mAuthNotify = nullptr;
135};
136
137#endif // QGSAUTHSSLIMPORTDIALOG_H
Widget for importing an SSL server certificate exception into the authentication database.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53