Falkon Develop
Cross-platform Qt-based web browser
sslerrordialog.cpp
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2013-2014 David Rosca <nowrep@gmail.com>
4*
5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation, either version 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
18#include "sslerrordialog.h"
19#include "ui_sslerrordialog.h"
20#include "iconprovider.h"
21
22#include <QPushButton>
23
25 : QDialog(parent)
26 , ui(new Ui::SslErrorDialog)
27 , m_result(No)
28{
29 ui->setupUi(this);
30 ui->icon->setPixmap(IconProvider::standardIcon(QStyle::SP_MessageBoxCritical).pixmap(52));
31 ui->buttonBox->addButton(tr("Only for this session"), QDialogButtonBox::ApplyRole);
32 ui->buttonBox->button(QDialogButtonBox::No)->setFocus();
33
34 connect(ui->buttonBox, &QDialogButtonBox::clicked, this, &SslErrorDialog::buttonClicked);
35}
36
38{
39 delete ui;
40}
41
42void SslErrorDialog::setText(const QString &text)
43{
44 ui->text->setText(text);
45}
46
48{
49 return m_result;
50}
51
52void SslErrorDialog::buttonClicked(QAbstractButton* button)
53{
54 switch (ui->buttonBox->buttonRole(button)) {
55 case QDialogButtonBox::YesRole:
56 m_result = Yes;
57 accept();
58 break;
59
60 case QDialogButtonBox::ApplyRole:
61 m_result = OnlyForThisSession;
62 accept();
63 break;
64
65 case QDialogButtonBox::NoRole:
66 m_result = NoForThisSession;
67 reject();
68 break;
69
70 default:
71 m_result = No;
72 reject();
73 break;
74 }
75}
static QIcon standardIcon(QStyle::StandardPixmap icon)
SslErrorDialog(QWidget *parent=nullptr)
void setText(const QString &text)