[frameworks/kdav] src/common: Add some debug to DavPrincipalSearchJob

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

Add some debug to DavPrincipalSearchJob

M  +11   -0    src/common/davprincipalsearchjob.cpp

https://invent.kde.org/frameworks/kdav/-/commit/632f95445e267df61812b6caf91f8cda2e834b69

diff --git a/src/common/davprincipalsearchjob.cpp b/src/common/davprincipalsearchjob.cpp
index 7ce08ee..64a17f2 100644
--- a/src/common/davprincipalsearchjob.cpp
+++ b/src/common/davprincipalsearchjob.cpp
@@ -9,6 +9,7 @@
 
 #include "daverror.h"
 #include "davmanager_p.h"
+#include "libkdav_debug.h"
 #include "utils_p.h"
 
 #include <QNetworkReply>
@@ -86,6 +87,7 @@ void DavPrincipalSearchJob::start()
     QDomElement principalCollectionSet = query.createElementNS(QStringLiteral("DAV:"), QStringLiteral("principal-collection-set"));
     prop.appendChild(principalCollectionSet);
 
+    qCDebug(KDAV_LOG) << "PROPFIND:" << d->mUrl.url().toDisplayString() << "query: " << query.toString();
     QNetworkReply *reply = DavManager::self()->createPropFindJob(d->mUrl.url(), query.toString());
     connect(reply, &QNetworkReply::finished, this, [d, reply]() {
         d->principalCollectionSetSearchFinished(reply);
@@ -104,6 +106,7 @@ void DavPrincipalSearchJobPrivate::principalCollectionSetSearchFinished(QNetwork
         setJobError(reply->error());
         setErrorTextFromDavError();
 
+        qCWarning(KDAV_LOG) << "Error during principal search:" << responseCode << reply->error() << reply->errorString();
         emitResult();
         return;
     }
@@ -134,6 +137,7 @@ void DavPrincipalSearchJobPrivate::principalCollectionSetSearchFinished(QNetwork
 
     QDomElement responseElement = Utils::firstChildElementNS(documentElement, QStringLiteral("DAV:"), QStringLiteral("response"));
     if (responseElement.isNull()) {
+        qCDebug(KDAV_LOG) << "Got a null response";
         emitResult();
         return;
     }
@@ -152,18 +156,21 @@ void DavPrincipalSearchJobPrivate::principalCollectionSetSearchFinished(QNetwork
     }
 
     if (propstatElement.isNull()) {
+        qCDebug(KDAV_LOG) << "Got no propstat in the response";
         emitResult();
         return;
     }
 
     QDomElement propElement = Utils::firstChildElementNS(propstatElement, QStringLiteral("DAV:"), QStringLiteral("prop"));
     if (propElement.isNull()) {
+        qCDebug(KDAV_LOG) << "Got no prop in the response";
         emitResult();
         return;
     }
 
     QDomElement principalCollectionSetElement = Utils::firstChildElementNS(propElement, QStringLiteral("DAV:"), QStringLiteral("principal-collection-set"));
     if (principalCollectionSetElement.isNull()) {
+        qCDebug(KDAV_LOG) << "Got no principal-collection-set in the response";
         emitResult();
         return;
     }
@@ -187,6 +194,7 @@ void DavPrincipalSearchJobPrivate::principalCollectionSetSearchFinished(QNetwork
 
         QDomDocument principalPropertySearchQuery;
         buildReportQuery(principalPropertySearchQuery);
+        qCDebug(KDAV_LOG) << "REPORT:" << url.toDisplayString() << "query:" << principalPropertySearchQuery.toString();
         QNetworkReply *reportReply = DavManager::self()->createReportJob(url, principalPropertySearchQuery.toString());
         QObject::connect(reportReply, &QNetworkReply::finished, q_ptr, [this, reportReply]() {
             principalPropertySearchFinished(reportReply);
@@ -214,6 +222,9 @@ void DavPrincipalSearchJobPrivate::principalPropertySearchFinished(QNetworkReply
             setJobError(reply->error());
             setErrorTextFromDavError();
         }
+
+        qCWarning(KDAV_LOG) << "Error during principal property search:" << responseCode << reply->error() << reply->errorString();
+
         if (mPrincipalPropertySearchSubJobCount == 0) {
             emitResult();
         }
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.