[PATCH] Add WebDav REPORT query to KIO

View: New views
1 Messages — Rating Filter:   Alert me  

[PATCH] Add WebDav REPORT query to KIO

by Grégory Oestreicher :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Here is a patch against the SVN trunk that adds the WebDav REPORT query (RFC
3253). It's mostly a copy-and-paste of other methods and it works OK for me
against the CalDav implementations I could test.

This is required for Akonadi CalDav support, which should be released soon.

Cheers,
Grégory

[kdelibs_add_dav_report.diff]

Index: interfaces/kio/http.h
===================================================================
--- interfaces/kio/http.h (révision 1041941)
+++ interfaces/kio/http.h (copie de travail)
@@ -28,6 +28,7 @@ namespace KIO {
                     HTTP_OPTIONS, DAV_PROPFIND, DAV_PROPPATCH, DAV_MKCOL,
                     DAV_COPY, DAV_MOVE, DAV_LOCK, DAV_UNLOCK, DAV_SEARCH,
                     DAV_SUBSCRIBE, DAV_UNSUBSCRIBE, DAV_POLL, DAV_NOTIFY,
+                    DAV_REPORT,
                     HTTP_UNKNOWN = -1};
 
 }
Index: kioslave/http/http.cpp
===================================================================
--- kioslave/http/http.cpp (révision 1041941)
+++ kioslave/http/http.cpp (copie de travail)
@@ -269,6 +269,8 @@ static QString methodString(HTTP_METHOD
         return "UNSUBSCRIBE ";
     case DAV_POLL:
         return "POLL ";
+    case DAV_REPORT:
+        return "REPORT ";
     default:
         Q_ASSERT(false);
         return QString();
@@ -1540,6 +1542,9 @@ QString HTTPProtocol::davError( int code
     case HTTP_GET:
       action = i18nc( "request type", "retrieve the contents of the specified file or folder" );
       break;
+    case DAV_REPORT:
+      action = i18nc( "request type", "run a report in the specified folder" );
+      break;
     case HTTP_PUT:
     case HTTP_POST:
     case HTTP_HEAD:
@@ -2231,6 +2236,7 @@ bool HTTPProtocol::sendQuery()
         davHeader = "Lock-token: " + metaData("davLockToken") + "\r\n";
         break;
     case DAV_SEARCH:
+    case DAV_REPORT:
         hasDavData = true;
         /* fall through */
     case DAV_SUBSCRIBE:
Index: kio/kio/davjob.cpp
===================================================================
--- kio/kio/davjob.cpp (révision 1041941)
+++ kio/kio/davjob.cpp (copie de travail)
@@ -162,4 +162,11 @@ DavJob* KIO::davSearch( const KUrl& url,
   return DavJobPrivate::newJob(url, KIO::DAV_SEARCH, doc.toString(), flags);
 }
 
+DavJob* KIO::davReport( const KUrl& url, const QDomDocument& report, const QString &depth, JobFlags flags )
+{
+    DavJob *job = DavJobPrivate::newJob(url, (int) KIO::DAV_REPORT, report.toString(), flags);
+    job->addMetaData( "davDepth", depth );
+    return job;
+}
+
 #include "davjob.moc"
Index: kio/kio/davjob.h
===================================================================
--- kio/kio/davjob.h (révision 1041941)
+++ kio/kio/davjob.h (copie de travail)
@@ -107,6 +107,17 @@ namespace KIO {
     */
    KIO_EXPORT DavJob* davSearch( const KUrl &url, const QString& nsURI, const QString& qName, const QString& query, JobFlags flags = DefaultFlags );
 
+   /**
+    * Creates a new DavJob that issues a REPORT command.
+    *
+    * @param url the URL of the resource
+    * @param report a REPORT document that describes the request to make
+    * @param depth the depth of the request. Can be "0", "1" or "infinity"
+    * @param flags: We support HideProgressInfo here
+    * @return the new DavJob
+    */
+   KIO_EXPORT DavJob* davReport( const KUrl& url, const QDomDocument& report, const QString &depth, JobFlags flags = DefaultFlags );
+
 }
 
 #endif


 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<