parent
f527a837db
commit
ee8a00ea50
7 changed files with 278 additions and 35 deletions
@ -0,0 +1,70 @@ |
||||
/* ============================================================
|
||||
* QupZilla - WebKit based browser |
||||
* Copyright (C) 2013 David Rosca <nowrep@gmail.com> |
||||
* |
||||
* This program is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, either version 3 of the License, or |
||||
* (at your option) any later version. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* ============================================================ */ |
||||
#include "sslerrordialog.h" |
||||
#include "ui_sslerrordialog.h" |
||||
#include "iconprovider.h" |
||||
|
||||
#include <QPushButton> |
||||
|
||||
SslErrorDialog::SslErrorDialog(QWidget* parent) |
||||
: QDialog(parent) |
||||
, ui(new Ui::SslErrorDialog) |
||||
, m_result(No) |
||||
{ |
||||
ui->setupUi(this); |
||||
ui->icon->setPixmap(qIconProvider->standardIcon(QStyle::SP_MessageBoxCritical).pixmap(52)); |
||||
ui->buttonBox->addButton(tr("Only for this session"), QDialogButtonBox::ApplyRole); |
||||
ui->buttonBox->button(QDialogButtonBox::No)->setFocus(); |
||||
|
||||
connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*))); |
||||
} |
||||
|
||||
SslErrorDialog::~SslErrorDialog() |
||||
{ |
||||
delete ui; |
||||
} |
||||
|
||||
void SslErrorDialog::setText(const QString &text) |
||||
{ |
||||
ui->text->setText(text); |
||||
} |
||||
|
||||
SslErrorDialog::Result SslErrorDialog::result() |
||||
{ |
||||
return m_result; |
||||
} |
||||
|
||||
void SslErrorDialog::buttonClicked(QAbstractButton* button) |
||||
{ |
||||
switch (ui->buttonBox->buttonRole(button)) { |
||||
case QDialogButtonBox::YesRole: |
||||
m_result = Yes; |
||||
accept(); |
||||
break; |
||||
|
||||
case QDialogButtonBox::ApplyRole: |
||||
m_result = OnlyForThisSession; |
||||
accept(); |
||||
break; |
||||
|
||||
default: |
||||
m_result = No; |
||||
reject(); |
||||
break; |
||||
} |
||||
} |
||||
@ -0,0 +1,54 @@ |
||||
/* ============================================================
|
||||
* QupZilla - WebKit based browser |
||||
* Copyright (C) 2013 David Rosca <nowrep@gmail.com> |
||||
* |
||||
* This program is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, either version 3 of the License, or |
||||
* (at your option) any later version. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* ============================================================ */ |
||||
#ifndef SSLERRORDIALOG_H |
||||
#define SSLERRORDIALOG_H |
||||
|
||||
#include <QDialog> |
||||
|
||||
namespace Ui |
||||
{ |
||||
class SslErrorDialog; |
||||
} |
||||
|
||||
class QAbstractButton; |
||||
|
||||
#include "qz_namespace.h" |
||||
|
||||
class QT_QUPZILLA_EXPORT SslErrorDialog : public QDialog |
||||
{ |
||||
Q_OBJECT |
||||
|
||||
public: |
||||
enum Result { Yes, No, OnlyForThisSession }; |
||||
|
||||
explicit SslErrorDialog(QWidget* parent = 0); |
||||
~SslErrorDialog(); |
||||
|
||||
void setText(const QString &text); |
||||
Result result(); |
||||
|
||||
private slots: |
||||
void buttonClicked(QAbstractButton* button); |
||||
|
||||
private: |
||||
Ui::SslErrorDialog* ui; |
||||
|
||||
Result m_result; |
||||
}; |
||||
|
||||
#endif // SSLERRORDIALOG_H
|
||||
@ -0,0 +1,87 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<ui version="4.0"> |
||||
<class>SslErrorDialog</class> |
||||
<widget class="QDialog" name="SslErrorDialog"> |
||||
<property name="geometry"> |
||||
<rect> |
||||
<x>0</x> |
||||
<y>0</y> |
||||
<width>511</width> |
||||
<height>72</height> |
||||
</rect> |
||||
</property> |
||||
<property name="windowTitle"> |
||||
<string>SSL Certificate Error!</string> |
||||
</property> |
||||
<layout class="QGridLayout" name="gridLayout"> |
||||
<item row="0" column="0"> |
||||
<widget class="QLabel" name="icon"> |
||||
<property name="alignment"> |
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="0" column="1"> |
||||
<widget class="QLabel" name="text"> |
||||
<property name="sizePolicy"> |
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> |
||||
<horstretch>0</horstretch> |
||||
<verstretch>0</verstretch> |
||||
</sizepolicy> |
||||
</property> |
||||
<property name="alignment"> |
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="1" column="0" colspan="2"> |
||||
<layout class="QHBoxLayout" name="horizontalLayout_2"> |
||||
<item> |
||||
<spacer name="horizontalSpacer_3"> |
||||
<property name="orientation"> |
||||
<enum>Qt::Horizontal</enum> |
||||
</property> |
||||
<property name="sizeHint" stdset="0"> |
||||
<size> |
||||
<width>40</width> |
||||
<height>20</height> |
||||
</size> |
||||
</property> |
||||
</spacer> |
||||
</item> |
||||
<item> |
||||
<widget class="QDialogButtonBox" name="buttonBox"> |
||||
<property name="sizePolicy"> |
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> |
||||
<horstretch>0</horstretch> |
||||
<verstretch>0</verstretch> |
||||
</sizepolicy> |
||||
</property> |
||||
<property name="orientation"> |
||||
<enum>Qt::Horizontal</enum> |
||||
</property> |
||||
<property name="standardButtons"> |
||||
<set>QDialogButtonBox::No|QDialogButtonBox::Yes</set> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<spacer name="horizontalSpacer_4"> |
||||
<property name="orientation"> |
||||
<enum>Qt::Horizontal</enum> |
||||
</property> |
||||
<property name="sizeHint" stdset="0"> |
||||
<size> |
||||
<width>40</width> |
||||
<height>20</height> |
||||
</size> |
||||
</property> |
||||
</spacer> |
||||
</item> |
||||
</layout> |
||||
</item> |
||||
</layout> |
||||
</widget> |
||||
<resources/> |
||||
<connections/> |
||||
</ui> |
||||
Loading…
Reference in new issue