fix: harden KF6 KIO build surface

This commit is contained in:
2026-05-07 07:52:47 +01:00
parent 2e2d36f18a
commit d8d498f831
9 changed files with 132 additions and 61 deletions
@@ -104,7 +104,7 @@ set_package_properties(KF6DocTools PROPERTIES DESCRIPTION "Provides tools to gen
)
set(REQUIRED_QT_VERSION 6.6.0)
find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Widgets Concurrent Xml)
find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Widgets Concurrent Xml Network)
# shall we use DBus?
# enabled per default on Linux & BSD systems
@@ -3,13 +3,9 @@ add_subdirectory(core)
# KIOCore-only executables
if (NOT KIOCORE_ONLY)
if (NOT ANDROID)
add_subdirectory(kioworkers)
add_subdirectory(schemehandlers)
endif()
if (HAVE_QTDBUS)
add_subdirectory(kiod)
add_subdirectory(kssld)
endif()
add_subdirectory(kioworker)
endif()
@@ -19,13 +15,9 @@ add_subdirectory(gui)
add_subdirectory(widgets)
if (HAVE_QTDBUS)
add_subdirectory(kpasswdserver)
add_subdirectory(kioexec)
endif()
if (NOT ANDROID)
add_subdirectory(filewidgets)
add_subdirectory(urifilters)
endif()
set(NON_KIOCORE_LINK_QCHS
@@ -78,6 +78,7 @@ target_sources(KF6KIOCore PRIVATE
batchrenamejob.cpp
worker.cpp
workerinterface.cpp
hostinfo.cpp
workerconfig.cpp
workerfactory.cpp
workerthread.cpp
@@ -89,6 +89,7 @@ target_link_libraries(KF6KIOGui
KF6::ConfigCore
KF6::Service
Qt6::Gui
Qt6::Network
PRIVATE
KF6::Solid
KF6::I18n
@@ -14,7 +14,7 @@
#include "standardthumbnailjob_p.h"
#include "statjob.h"
#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID) && !defined(Q_OS_HAIKU)
#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID) && !defined(Q_OS_HAIKU) && !defined(Q_OS_REDOX)
#define WITH_SHM 1
#else
#define WITH_SHM 0
@@ -35,8 +35,6 @@ target_sources(KF6KIOWidgets PRIVATE
kshellcompletion.cpp
kurlcompletion.cpp
renamedialog.cpp
ksslcertificatebox.cpp
ksslinfodialog.cpp
skipdialog.cpp
jobuidelegate.cpp
kdirlister.cpp
@@ -60,12 +58,10 @@ target_sources(KF6KIOWidgets PRIVATE
kpropertiesdialog.cpp
kpropertiesdialogplugin.cpp
kpropertiesdialogbuiltin_p.cpp
sslui.cpp
)
if (HAVE_QTDBUS)
target_sources(KF6KIOWidgets PRIVATE
kdynamicjobtracker.cpp
${kiowidgets_dbus_SRCS}
)
endif()
@@ -151,8 +147,6 @@ ecm_generate_headers(KIOWidgets_HEADERS
KBuildSycocaProgressDialog
KFile
KUrlRequester
KSslCertificateBox
KSslInfoDialog
KDirLister
KDirModel
KShellCompletion
@@ -25,7 +25,6 @@
#include <KMessageBox>
#include <KSharedConfig>
#include <clipboardupdater_p.h>
#include <ksslinfodialog.h>
#ifdef WITH_QTDBUS
#include <QDBusInterface>
@@ -16,7 +16,6 @@
#include <KLocalizedString>
#include <KMessageDialog>
#include <KSharedConfig>
#include <KSslInfoDialog>
#include <KStandardGuiItem>
#include <kio_widgets_debug.h>
@@ -507,51 +506,34 @@ void KIO::WidgetsAskUserActionHandler::askIgnoreSslErrors(const QVariantMap &ssl
void KIO::WidgetsAskUserActionHandler::showSslDetails(const QVariantMap &sslErrorData, QWidget *parentWidget)
{
const QStringList sslList = sslErrorData[QLatin1String("peerCertChain")].toStringList();
QString details = i18n("Detailed SSL certificate inspection is unavailable on Redox with the current QtNetwork SSL surface.");
const QString hostname = sslErrorData[QLatin1String("hostname")].toString();
const QString protocol = sslErrorData[QLatin1String("protocol")].toString();
const QString cipher = sslErrorData[QLatin1String("cipher")].toString();
const QString sslError = sslErrorData[QLatin1String("sslError")].toString();
QList<QSslCertificate> certChain;
bool decodedOk = true;
for (const QString &str : sslList) {
certChain.append(QSslCertificate(str.toUtf8()));
if (certChain.last().isNull()) {
decodedOk = false;
break;
}
if (!hostname.isEmpty()) {
details += QStringLiteral("\n\n") + i18n("Host: %1", hostname);
}
if (!protocol.isEmpty()) {
details += QStringLiteral("\n") + i18n("Protocol: %1", protocol);
}
if (!cipher.isEmpty()) {
details += QStringLiteral("\n") + i18n("Cipher: %1", cipher);
}
if (!sslError.isEmpty()) {
details += QStringLiteral("\n\n") + sslError;
}
QMetaObject::invokeMethod(qGuiApp, [=, this] {
if (decodedOk) { // Use KSslInfoDialog
KSslInfoDialog *ksslDlg = new KSslInfoDialog(parentWidget);
ksslDlg->setSslInfo(
certChain,
QString(),
sslErrorData[QLatin1String("hostname")].toString(),
sslErrorData[QLatin1String("protocol")].toString(),
sslErrorData[QLatin1String("cipher")].toString(),
sslErrorData[QLatin1String("usedBits")].toInt(),
sslErrorData[QLatin1String("bits")].toInt(),
KSslInfoDialog::certificateErrorsFromString(sslErrorData[QLatin1String("certificateErrors")].toStringList().join(QLatin1Char('\n'))));
// KSslInfoDialog deletes itself by setting Qt::WA_DeleteOnClose
QObject::connect(ksslDlg, &QDialog::finished, this, [this, sslErrorData, parentWidget]() {
// KSslInfoDialog only has one button, QDialogButtonBox::Close
askIgnoreSslErrors(sslErrorData, parentWidget);
});
ksslDlg->show();
return;
}
// Fallback to a generic message box
auto *dialog = new KMessageDialog(KMessageDialog::Information, i18n("The peer SSL certificate chain appears to be corrupt."), parentWidget);
auto *dialog = new KMessageDialog(KMessageDialog::Information, details, parentWidget);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setCaption(i18n("SSL"));
dialog->setButtons(KStandardGuiItem::ok());
QObject::connect(dialog, &QDialog::finished, this, [this](const int result) {
Q_EMIT askIgnoreSslErrorsResult(result == KMessageDialog::Ok ? 1 : 0);
QObject::connect(dialog, &QDialog::finished, this, [this, sslErrorData, parentWidget](const int) {
askIgnoreSslErrors(sslErrorData, parentWidget);
});
dialog->show();