1 | /* |
2 | * Copyright (C) by Klaas Freitag <freitag@kde.org> |
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 | * This program is distributed in the hope that it will be useful, but |
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
12 | * for more details. |
13 | */ |
14 | #ifndef SSLERRORDIALOG_H |
15 | #define SSLERRORDIALOG_H |
16 | |
17 | #include <QtCore> |
18 | #include <QDialog> |
19 | #include <QSslCertificate> |
20 | #include <QList> |
21 | |
22 | #include "account.h" |
23 | |
24 | class QSslError; |
25 | class QSslCertificate; |
26 | |
27 | namespace OCC { |
28 | |
29 | namespace Ui { |
30 | class SslErrorDialog; |
31 | } |
32 | |
33 | /** |
34 | * @brief The SslDialogErrorHandler class |
35 | * @ingroup gui |
36 | */ |
37 | class SslDialogErrorHandler : public AbstractSslErrorHandler |
38 | { |
39 | public: |
40 | bool handleErrors(QList<QSslError> errors, const QSslConfiguration &conf, QList<QSslCertificate> *certs, AccountPtr) Q_DECL_OVERRIDE; |
41 | }; |
42 | |
43 | /** |
44 | * @brief The SslErrorDialog class |
45 | * @ingroup gui |
46 | */ |
47 | class SslErrorDialog : public QDialog |
48 | { |
49 | Q_OBJECT |
50 | public: |
51 | explicit SslErrorDialog(AccountPtr account, QWidget *parent = 0); |
52 | ~SslErrorDialog(); |
53 | bool checkFailingCertsKnown(const QList<QSslError> &errors); |
54 | bool trustConnection(); |
55 | QList<QSslCertificate> unknownCerts() const { return _unknownCerts; } |
56 | |
57 | private: |
58 | QString styleSheet() const; |
59 | bool _allTrusted; |
60 | |
61 | QString certDiv(QSslCertificate) const; |
62 | |
63 | QList<QSslCertificate> _unknownCerts; |
64 | QString _customConfigHandle; |
65 | Ui::SslErrorDialog *_ui; |
66 | AccountPtr _account; |
67 | }; |
68 | } // end namespace |
69 | |
70 | #endif // SSLERRORDIALOG_H |
71 | |