kioslaves

webdavhandler.cpp

Go to the documentation of this file.
00001 /*
00002     This file is part of kdepim.
00003 
00004     Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #include <config.h>
00022 
00023 #include "webdavhandler.h"
00024 
00025 #include <limits.h>
00026 
00027 #include <libkdepim/kpimprefs.h>
00028 
00029 #include <kdebug.h>
00030 #include <kconfig.h>
00031 
00032 #include <qfile.h>
00033 
00034 
00035 WebdavHandler::WebdavHandler()
00036 {
00037 }
00038 
00039 
00040 QDomElement WebdavHandler::addElement( QDomDocument &doc, QDomNode &node,
00041                                        const QString &tag )
00042 {
00043   QDomElement el = doc.createElement( tag );
00044   node.appendChild( el );
00045   return el;
00046 }
00047 
00048 QDomElement WebdavHandler::addDavElement( QDomDocument &doc, QDomNode &node,
00049                                           const QString &tag )
00050 {
00051   QDomElement el = doc.createElementNS( "DAV", tag );
00052   node.appendChild( el );
00053   return el;
00054 }
00055 
00056 QDomElement WebdavHandler::addSloxElement( QDomDocument &doc, QDomNode &node,
00057                                            const QString &tag,
00058                                            const QString &text )
00059 {
00060   QDomElement el = doc.createElementNS( "SLOX", tag );
00061   if ( !text.isEmpty() ) {
00062     QDomText textnode = doc.createTextNode( text );
00063     el.appendChild( textnode );
00064   }
00065   node.appendChild( el );
00066   return el;
00067 }
00068 
00069 QDomDocument WebdavHandler::createAllPropsRequest()
00070 {
00071   QDomDocument doc;
00072 
00073   QDomElement root = WebdavHandler::addDavElement(  doc, doc, "propfind" );
00074   QDomElement prop = WebdavHandler::addDavElement(  doc, root, "prop" );
00075   WebdavHandler::addDavElement(  doc, prop, "getcontentlength");
00076   WebdavHandler::addDavElement(  doc, prop, "getlastmodified" );
00077   WebdavHandler::addDavElement(  doc, prop, "displayname" );
00078   WebdavHandler::addDavElement(  doc, prop, "resourcetype" );
00079   prop.appendChild( doc.createElementNS( "http://apache.org/dav/props/", "executable" ) );
00080   return doc;
00081 }