[pim/kdepim-runtime] resources/dav/resource: Use the new DavSslUiProxy and KIO::SslUi to display SSL errors

Kevin Ottens <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit adb0aeb0d6e260fff9df09d790d466fed48b6a75 by Kevin Ottens, on behalf of Kevin Ottens.
Committed on 29/07/2026 at 06:10.
Pushed by ervin into branch 'master'.

Use the new DavSslUiProxy and KIO::SslUi to display SSL errors

M  +21   -0    resources/dav/resource/davgroupwareresource.cpp

https://invent.kde.org/pim/kdepim-runtime/-/commit/adb0aeb0d6e260fff9df09d790d466fed48b6a75

diff --git a/resources/dav/resource/davgroupwareresource.cpp b/resources/dav/resource/davgroupwareresource.cpp
index c395990ae..3c4e2c011 100644
--- a/resources/dav/resource/davgroupwareresource.cpp
+++ b/resources/dav/resource/davgroupwareresource.cpp
@@ -28,6 +28,7 @@
 #include <KDAV/DavItemsFetchJob>
 #include <KDAV/DavItemsListJob>
 #include <KDAV/DavPrincipalHomesetsFetchJob>
+#include <KDAV/DavSslUiProxy>
 #include <KDAV/ProtocolInfo>
 
 #include <KCalendarCore/FreeBusy>
@@ -56,6 +57,9 @@
 
 #include <KLocalizedString>
 
+#include <KIO/SslUi>
+#include <KSslErrorUiData>
+
 #include <QDBusMessage>
 #include <QDBusReply>
 
@@ -66,12 +70,29 @@ using IncidencePtr = QSharedPointer<KCalendarCore::Incidence>;
 
 using namespace Qt::Literals::StringLiterals;
 
+class SslUiProxy : public KDAV::DavSslUiProxy
+{
+public:
+    bool ignoreSslErrors(QNetworkReply *reply, const QList<QSslError> &sslErrors) override
+    {
+        KSslErrorUiData errorData(reply, sslErrors);
+        if (KIO::SslUi::askIgnoreSslErrors(errorData)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+};
+
 DavGroupwareResource::DavGroupwareResource(const QString &id)
     : ResourceWidgetBase(id)
     , FreeBusyProviderBase()
     , AccountBase(this)
     , mFreeBusyHandler(new DavFreeBusyHandler(settings(), this))
 {
+    auto proxy = std::make_unique<SslUiProxy>();
+    KDAV::DavSslUiProxy::setDefaultProxy(std::move(proxy));
+
     AttributeFactory::registerAttribute<DavProtocolAttribute>();
     AttributeFactory::registerAttribute<CTagAttribute>();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.