[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdepim-runtime] resources/dav/common: Limit DAV Depth for homesets
From:       Gregory Oestreicher <greg () kamago ! net>
Date:       2011-07-31 19:59:20
Message-ID: 20110731195920.17184A60A6 () git ! kde ! org
[Download RAW message or body]

Git commit febdb632a39784c7a171c6ad1f6ef6bf291f4c73 by Gregory Oestreicher.
Committed on 31/07/2011 at 21:58.
Pushed by goestreicher into branch 'master'.

Limit DAV Depth for homesets query

M  +8    -10   resources/dav/common/davmanager.cpp
M  +4    -2    resources/dav/common/davmanager.h
M  +1    -1    resources/dav/common/davprincipalhomesetsfetchjob.cpp

http://commits.kde.org/kdepim-runtime/febdb632a39784c7a171c6ad1f6ef6bf291f4c73

diff --git a/resources/dav/common/davmanager.cpp \
b/resources/dav/common/davmanager.cpp index c1885b1..6d12e0c 100644
--- a/resources/dav/common/davmanager.cpp
+++ b/resources/dav/common/davmanager.cpp
@@ -50,32 +50,30 @@ DavManager* DavManager::self()
   return mSelf;
 }
 
-KIO::DavJob* DavManager::createPropFindJob( const KUrl &url, const QDomDocument \
&document ) const +KIO::DavJob* DavManager::createPropFindJob( const KUrl &url, const \
QDomDocument &document, const QString &depth ) const  {
-  const QString davDepth( '1' );
-  KIO::DavJob *job = KIO::davPropFind( url, document, davDepth, \
KIO::HideProgressInfo | KIO::DefaultFlags ); +  KIO::DavJob *job = KIO::davPropFind( \
url, document, depth, KIO::HideProgressInfo | KIO::DefaultFlags );  
   // workaround needed, Depth: header doesn't seem to be correctly added
-  const QString header = "Content-Type: text/xml\r\nDepth: " + davDepth;
+  const QString header = "Content-Type: text/xml\r\nDepth: " + depth;
   job->addMetaData( "customHTTPHeader", header );
   job->addMetaData( "cookies", "none" );
   job->addMetaData( "no-auth-prompt", "true" );
-  job->setProperty( "extraDavDepth", QVariant::fromValue( davDepth ) );
+  job->setProperty( "extraDavDepth", QVariant::fromValue( depth ) );
 
   return job;
 }
 
-KIO::DavJob* DavManager::createReportJob( const KUrl &url, const QDomDocument \
&document ) const +KIO::DavJob* DavManager::createReportJob( const KUrl &url, const \
QDomDocument &document, const QString &depth ) const  {
-  const QString davDepth( '1' );
-  KIO::DavJob *job = KIO::davReport( url, document.toString(), davDepth, \
KIO::HideProgressInfo | KIO::DefaultFlags ); +  KIO::DavJob *job = KIO::davReport( \
url, document.toString(), depth, KIO::HideProgressInfo | KIO::DefaultFlags );  
   // workaround needed, Depth: header doesn't seem to be correctly added
-  const QString header = "Content-Type: text/xml\r\nDepth: " + davDepth;
+  const QString header = "Content-Type: text/xml\r\nDepth: " + depth;
   job->addMetaData( "customHTTPHeader", header );
   job->addMetaData( "cookies", "none" );
   job->addMetaData( "no-auth-prompt", "true" );
-  job->setProperty( "extraDavDepth", QVariant::fromValue( davDepth ) );
+  job->setProperty( "extraDavDepth", QVariant::fromValue( depth ) );
 
   return job;
 }
diff --git a/resources/dav/common/davmanager.h b/resources/dav/common/davmanager.h
index 6cd7cb4..b9b5bd9 100644
--- a/resources/dav/common/davmanager.h
+++ b/resources/dav/common/davmanager.h
@@ -59,16 +59,18 @@ class DavManager
      *
      * @param url The target url of the job.
      * @param document The query XML document.
+     * @param depth The Depth: value to send in the HTTP request
      */
-    KIO::DavJob* createPropFindJob( const KUrl &url, const QDomDocument &document ) \
const; +    KIO::DavJob* createPropFindJob( const KUrl &url, const QDomDocument \
&document, const QString &depth = QString( "1" ) ) const;  
     /**
      * Returns a preconfigured DAV REPORT job.
      *
      * @param url The target url of the job.
      * @param document The query XML document.
+     * @param depth The Depth: value to send in the HTTP request
      */
-    KIO::DavJob* createReportJob( const KUrl &url, const QDomDocument &document ) \
const; +    KIO::DavJob* createReportJob( const KUrl &url, const QDomDocument \
&document, const QString &depth = QString( "1" ) ) const;  
     /**
      * Returns a preconfigured DAV PROPPATCH job.
diff --git a/resources/dav/common/davprincipalhomesetsfetchjob.cpp \
b/resources/dav/common/davprincipalhomesetsfetchjob.cpp index 90047d3..04d1ef6 100644
--- a/resources/dav/common/davprincipalhomesetsfetchjob.cpp
+++ b/resources/dav/common/davprincipalhomesetsfetchjob.cpp
@@ -53,7 +53,7 @@ void DavPrincipalHomeSetsFetchJob::fetchHomeSets( bool homeSetsOnly \
                )
     propElement.appendChild( document.createElementNS( "DAV:", "principal-URL" ) );
   }
 
-  KIO::DavJob *job = DavManager::self()->createPropFindJob( mUrl.url(), document );
+  KIO::DavJob *job = DavManager::self()->createPropFindJob( mUrl.url(), document, \
"0" );  job->addMetaData( "PropagateHttpHeader", "true" );
   connect( job, SIGNAL(result(KJob*)), SLOT(davJobFinished(KJob*)) );
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic