TDE personal information management applications
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.5KB

  1. /*
  2. This file is part of kdepim.
  3. Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  15. */
  16. #include <config.h>
  17. #include "webdavhandler.h"
  18. #include <limits.h>
  19. #include <libtdepim/kpimprefs.h>
  20. #include <kdebug.h>
  21. #include <kconfig.h>
  22. #include <tqfile.h>
  23. WebdavHandler::WebdavHandler()
  24. {
  25. }
  26. TQDomElement WebdavHandler::addElement( TQDomDocument &doc, TQDomNode &node,
  27. const TQString &tag )
  28. {
  29. TQDomElement el = doc.createElement( tag );
  30. node.appendChild( el );
  31. return el;
  32. }
  33. TQDomElement WebdavHandler::addDavElement( TQDomDocument &doc, TQDomNode &node,
  34. const TQString &tag )
  35. {
  36. TQDomElement el = doc.createElementNS( "DAV", tag );
  37. node.appendChild( el );
  38. return el;
  39. }
  40. TQDomElement WebdavHandler::addSloxElement( TQDomDocument &doc, TQDomNode &node,
  41. const TQString &tag,
  42. const TQString &text )
  43. {
  44. TQDomElement el = doc.createElementNS( "SLOX", tag );
  45. if ( !text.isEmpty() ) {
  46. TQDomText textnode = doc.createTextNode( text );
  47. el.appendChild( textnode );
  48. }
  49. node.appendChild( el );
  50. return el;
  51. }
  52. TQDomDocument WebdavHandler::createAllPropsRequest()
  53. {
  54. TQDomDocument doc;
  55. TQDomElement root = WebdavHandler::addDavElement( doc, doc, "propfind" );
  56. TQDomElement prop = WebdavHandler::addDavElement( doc, root, "prop" );
  57. WebdavHandler::addDavElement( doc, prop, "getcontentlength");
  58. WebdavHandler::addDavElement( doc, prop, "getlastmodified" );
  59. WebdavHandler::addDavElement( doc, prop, "displayname" );
  60. WebdavHandler::addDavElement( doc, prop, "resourcetype" );
  61. prop.appendChild( doc.createElementNS( "http://apache.org/dav/props/", "executable" ) );
  62. return doc;
  63. }