Commit 0b7b5896 authored by Volker Krause's avatar Volker Krause

Add support for QNAM SSL error handling via KIO

parent d96029b5
......@@ -27,6 +27,7 @@
#include <KTcpSocket>
#include <KIO/SslUi>
#include <KIO/TransferJob>
#include <kio_version.h>
#include <QNetworkReply>
#include <QNetworkRequest>
......@@ -57,6 +58,17 @@ MainWindow::MainWindow(QWidget *parent)
for (const auto &error : errors) {
ui->resultView->appendPlainText(error.errorString());
}
#if KIO_VERSION_MINOR >= 62
if (ui->qnamWithKIOSslUi->isChecked()) {
KSslErrorUiData errorData(reply, errors);
if (KIO::SslUi::askIgnoreSslErrors(errorData)) {
reply->ignoreSslErrors();
}
}
#else
#warning "KIO too old for QNAM SSL error handling!"
#endif
});
connect(reply, &QNetworkReply::finished, this, [this, reply]() {
reply->deleteLater();
......
......@@ -6,22 +6,15 @@
<rect>
<x>0</x>
<y>0</y>
<width>546</width>
<height>300</height>
<width>583</width>
<height>434</height>
</rect>
</property>
<property name="windowTitle">
<string>HTTP(S) Demo</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="3">
<widget class="QPushButton" name="qsslButton">
<property name="text">
<string>QSslSocket</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="4">
<item row="5" column="0" colspan="4">
<widget class="QPlainTextEdit" name="resultView">
<property name="undoRedoEnabled">
<bool>true</bool>
......@@ -34,17 +27,45 @@
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QCheckBox" name="qsslWithKIOSslUi">
<item row="1" column="0">
<widget class="QPushButton" name="qnamButton">
<property name="text">
<string>QNAM</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="kioButton">
<property name="text">
<string>KIO</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="ktcpButton">
<property name="text">
<string>KTCPSocket</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="qsslButton">
<property name="text">
<string>QSslSocket</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QCheckBox" name="ktcpWithKIOSslUi">
<property name="text">
<string>Use KIO::SslUi</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="qnamButton">
<item row="2" column="2">
<widget class="QCheckBox" name="kctpUseSecureProtocols">
<property name="text">
<string>QNAM</string>
<string>Secure Protocols</string>
</property>
</widget>
</item>
......@@ -145,20 +166,6 @@
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="kioButton">
<property name="text">
<string>KIO</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="ktcpButton">
<property name="text">
<string>KTCPSocket</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QComboBox" name="qnamRedirectBox">
<item>
......@@ -178,13 +185,10 @@
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<item row="2" column="3">
<widget class="QCheckBox" name="qsslWithKIOSslUi">
<property name="text">
<string>Host:</string>
</property>
<property name="buddy">
<cstring>hostBox</cstring>
<string>Use KIO::SslUi</string>
</property>
</widget>
</item>
......@@ -195,17 +199,20 @@
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QCheckBox" name="kctpUseSecureProtocols">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Secure Protocols</string>
<string>Host:</string>
</property>
<property name="buddy">
<cstring>hostBox</cstring>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QCheckBox" name="ktcpWithKIOSslUi">
<item row="4" column="0">
<widget class="QCheckBox" name="qnamWithKIOSslUi">
<property name="text">
<string>Use KIU::SslUi</string>
<string>Use KIO::SslUi</string>
</property>
</widget>
</item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment