[Patch] Webdav properties in UDSAtoms

Best, Jan-Pascal van j.p.vanbest at tbm.tudelft.nl
Thu May 30 10:34:15 BST 2002


1234567890 1234567890 1234567890 1234567890 1234567890 1234567890
1234567890 1234567890 
> I'm afraid that the proper way would be to attach the propstats to the
UDS 
> entries. From the UDSAtomTypes it seems to me (but correct me if I'm
wrong)
> that there are really only two types (UDS_STRING and UDS_LONG) that
can be
> interpreted in a number of way. I'd like to pass the propstat as a  
> QDomNodeList or a number of QDomElements, but I think the UDSAtom
class is 
> too rigid to allow that. We could subclass it, of course, and use a
new 
> UDSAtomType 32768 to indicate UDS_DAV_RESPONSE?

Responding to myself again: Subclassing is no use, because UDSAtoms are
sometimes
streamed to and from QDataStreams. We have have modify the
operator>>(QDataStream, UDSAtom) anyway.

My first idea was to add a "QDomElement m_xml" member field to UDSAtom,
but I feel 
that might give too great a performance hit on all other systems and
applications using
UDSAtoms. 

My current implementation uses just another UDSAtomType,
  UDS_WEBDAV_PROPERTIES = 32768 | UDS_STRING
and then in http.c:HTTPProtocol:davParseProperties checks whether 
the metadata "davRequestResponse" is set to "true". In that case,
it adds an UDSAtom to the current UDSEntry, of type 
UDS_WEBDAV_PROPERTIES, containing the <prop/> XML element string.

>From the application side, this means that you set the
"davRequestResponse"
metadata before a STAT, LIST or SEARCH. When examining the results, the
webdav properties can be found in one of the UDSAtoms connected to the
UDSEntry. 

The main argument against this method is that we now first parse the
servers response, then encode the properties as an XML string in the
UDSAtom, and then (in the application side) parse the same data again!

Your comments?

Patch (2 files patched: kdelibs/kio/kio/global.h and
kdelibs/kioslave/http/http.cc) follows.

Cheers

Jan-Pascal

Index: global.h
===================================================================
RCS file: /home/kde/kdelibs/kio/kio/global.h,v
retrieving revision 1.49
diff -u -3 -p -r1.49 global.h
--- global.h    5 Apr 2002 22:18:47 -0000       1.49
+++ global.h    30 May 2002 09:10:00 -0000
@@ -238,7 +238,9 @@ namespace KIO
     UDS_MIME_TYPE = 16384 | UDS_STRING,
     // A mime type to be used for displaying only.
     // But when 'running' the file, the mimetype is re-determined
-    UDS_GUESSED_MIME_TYPE = 16392 | UDS_STRING
+    UDS_GUESSED_MIME_TYPE = 16392 | UDS_STRING,
+    // WebDAV properties
+    UDS_WEBDAV_PROPERTIES = 32768 | UDS_STRING
   };

   enum CacheControl


Index: http.cc
===================================================================
RCS file: /home/kde/kdelibs/kioslave/http/http.cc,v
retrieving revision 1.503
diff -u -3 -p -r1.503 http.cc
--- http.cc     23 May 2002 23:37:33 -0000      1.503
+++ http.cc     30 May 2002 09:17:35 -0000
@@ -595,6 +595,15 @@ void HTTPProtocol::davParsePropstats( co
       return;
     }

+    if ( metaData( "davRequestResponse" ) == "true" )
+    {
+      atom.m_uds = KIO::UDS_WEBDAV_PROPERTIES;
+      QDomDocument doc;
+      doc.appendChild(prop);
+      atom.m_str = doc.toString();
+      entry.append( atom );
+    }
+
     for ( QDomElement property = prop.firstChild().toElement();
           !property.isNull();
           property = property.nextSibling().toElement() )





More information about the kfm-devel mailing list