diff options
Diffstat (limited to 'tderesources/groupdav')
-rw-r--r-- | tderesources/groupdav/CMakeLists.txt | 77 | ||||
-rw-r--r-- | tderesources/groupdav/Makefile.am | 52 | ||||
-rw-r--r-- | tderesources/groupdav/groupdavaddressbookadaptor.cpp | 54 | ||||
-rw-r--r-- | tderesources/groupdav/groupdavaddressbookadaptor.h | 79 | ||||
-rw-r--r-- | tderesources/groupdav/groupdavcalendaradaptor.cpp | 46 | ||||
-rw-r--r-- | tderesources/groupdav/groupdavcalendaradaptor.h | 84 | ||||
-rw-r--r-- | tderesources/groupdav/groupdavglobals.cpp | 287 | ||||
-rw-r--r-- | tderesources/groupdav/groupdavglobals.h | 73 | ||||
-rw-r--r-- | tderesources/groupdav/kabc_groupdav.desktop | 52 | ||||
-rw-r--r-- | tderesources/groupdav/kabc_resourcegroupdav.cpp | 47 | ||||
-rw-r--r-- | tderesources/groupdav/kabc_resourcegroupdav.h | 45 | ||||
-rw-r--r-- | tderesources/groupdav/kabc_resourcegroupdav_plugin.cpp | 42 | ||||
-rw-r--r-- | tderesources/groupdav/kcal_groupdav.desktop | 52 | ||||
-rw-r--r-- | tderesources/groupdav/kcal_resourcegroupdav.cpp | 52 | ||||
-rw-r--r-- | tderesources/groupdav/kcal_resourcegroupdav.h | 48 | ||||
-rw-r--r-- | tderesources/groupdav/kcal_resourcegroupdav_plugin.cpp | 43 | ||||
-rw-r--r-- | tderesources/groupdav/uninstall.desktop | 2 |
17 files changed, 1135 insertions, 0 deletions
diff --git a/tderesources/groupdav/CMakeLists.txt b/tderesources/groupdav/CMakeLists.txt new file mode 100644 index 000000000..bc903d00b --- /dev/null +++ b/tderesources/groupdav/CMakeLists.txt @@ -0,0 +1,77 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/../lib + ${CMAKE_CURRENT_SOURCE_DIR}/../lib + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/libtdepim + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES kcal_groupdav.desktop DESTINATION ${SERVICES_INSTALL_DIR}/tderesources/kcal ) +install( FILES uninstall.desktop DESTINATION ${SERVICES_INSTALL_DIR}/tderesources/kcal RENAME kcal_opengroupware.desktop ) +install( FILES kabc_groupdav.desktop DESTINATION ${SERVICES_INSTALL_DIR}/tderesources/kabc ) +install( FILES uninstall.desktop DESTINATION ${SERVICES_INSTALL_DIR}/tderesources/kabc RENAME kabc_opengroupware.desktop) + + +##### kcal_groupdav (module) #################### + +tde_add_kpart( kcal_groupdav AUTOMOC + SOURCES kcal_resourcegroupdav_plugin.cpp + LINK kcal_groupdav-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) + + +##### kabc_groupdav (module) #################### + +tde_add_kpart( kabc_groupdav AUTOMOC + SOURCES kabc_resourcegroupdav_plugin.cpp + LINK kabc_groupdav-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) + + +##### kgroupdav (static) ######################## + +tde_add_library( kgroupdav STATIC_PIC + SOURCES groupdavglobals.cpp +) + + +##### kcal_groupdav (shared) #################### + +tde_add_library( kcal_groupdav SHARED AUTOMOC + SOURCES groupdavcalendaradaptor.cpp kcal_resourcegroupdav.cpp + VERSION 1.0.0 + LINK kgroupdav-static kgroupwaredav-shared + DESTINATION ${LIB_INSTALL_DIR} +) + + +##### kabc_groupdav (shared) #################### + +tde_add_library( kabc_groupdav SHARED AUTOMOC + SOURCES kabc_resourcegroupdav.cpp groupdavaddressbookadaptor.cpp + VERSION 1.0.0 + LINK kgroupdav-static kgroupwaredav-shared + DESTINATION ${LIB_INSTALL_DIR} +) diff --git a/tderesources/groupdav/Makefile.am b/tderesources/groupdav/Makefile.am new file mode 100644 index 000000000..1e20f2912 --- /dev/null +++ b/tderesources/groupdav/Makefile.am @@ -0,0 +1,52 @@ +INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tderesources/lib \ + -I../lib $(all_includes) + +lib_LTLIBRARIES = libkcal_groupdav.la libkabc_groupdav.la +noinst_LTLIBRARIES = libkgroupdav.la + +libkgroupdav_la_SOURCES = groupdavglobals.cpp + +libkcal_groupdav_la_SOURCES = groupdavcalendaradaptor.cpp kcal_resourcegroupdav.cpp +libkcal_groupdav_la_LDFLAGS = $(KDE_RPATH) $(all_libraries) \ + -version-info 1:0:0 -no-undefined +libkcal_groupdav_la_LIBADD = \ + libkgroupdav.la ../lib/libkgroupwaredav.la \ + $(top_builddir)/libkcal/libkcal.la $(top_builddir)/libtdepim/libtdepim.la + +libkabc_groupdav_la_SOURCES = kabc_resourcegroupdav.cpp groupdavaddressbookadaptor.cpp +libkabc_groupdav_la_LDFLAGS = $(KDE_RPATH) $(all_libraries) \ + -version-info 1:0:0 -no-undefined +libkabc_groupdav_la_LIBADD = \ + libkgroupdav.la ../lib/libkgroupwaredav.la \ + $(top_builddir)/libkcal/libkcal.la $(top_builddir)/libtdepim/libtdepim.la \ + -lkabc + +kde_module_LTLIBRARIES = kcal_groupdav.la kabc_groupdav.la + +kcal_groupdav_la_SOURCES = kcal_resourcegroupdav_plugin.cpp +kcal_groupdav_la_LDFLAGS = $(all_libraries) -module -no-undefined $(KDE_PLUGIN) +kcal_groupdav_la_LIBADD = libkcal_groupdav.la + +kabc_groupdav_la_SOURCES = kabc_resourcegroupdav_plugin.cpp +kabc_groupdav_la_LDFLAGS = $(all_libraries) -module -no-undefined $(KDE_PLUGIN) +kabc_groupdav_la_LIBADD = libkabc_groupdav.la + +kcal_servicedir = $(kde_servicesdir)/tderesources/kcal +kcal_service_DATA = kcal_groupdav.desktop + +kabc_servicedir = $(kde_servicesdir)/tderesources/kabc +kabc_service_DATA = kabc_groupdav.desktop + +METASOURCES = AUTO + +install-data-local: uninstall.desktop + $(mkinstalldirs) $(DESTDIR)$(kde_servicesdir)/tderesources/kabc + $(mkinstalldirs) $(DESTDIR)$(kde_servicesdir)/tderesources/kcal + $(INSTALL_DATA) $(srcdir)/uninstall.desktop $(DESTDIR)$(kde_servicesdir)/tderesources/kabc/kabc_opengroupware.desktop + $(INSTALL_DATA) $(srcdir)/uninstall.desktop $(DESTDIR)$(kde_servicesdir)/tderesources/kcal/kcal_opengroupware.desktop + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kres_groupdav.pot + +kabc_resourcegroupdav.lo: ../lib/tderesources_groupwareprefs.h + diff --git a/tderesources/groupdav/groupdavaddressbookadaptor.cpp b/tderesources/groupdav/groupdavaddressbookadaptor.cpp new file mode 100644 index 000000000..f8f30f659 --- /dev/null +++ b/tderesources/groupdav/groupdavaddressbookadaptor.cpp @@ -0,0 +1,54 @@ +/* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> + Copyright (c) 2004 Till Adam <adam@kde.org> + Copyright (c) 2005 Reinhold Kainhofer <reinhold@kainhofer.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "groupdavaddressbookadaptor.h" +#include "groupdavglobals.h" +#include "davgroupwareglobals.h" +#include "webdavhandler.h" + +#include <kabc/addressee.h> +#include <kabc/vcardconverter.h> +#include <kabcresourcecached.h> + +#include <kio/job.h> +#include <kdebug.h> + +using namespace KABC; + +GroupDavAddressBookAdaptor::GroupDavAddressBookAdaptor() : DavAddressBookAdaptor() +{ +} + +void GroupDavAddressBookAdaptor::customAdaptDownloadUrl( KURL &url ) +{ + url = WebdavHandler::toDAV( url ); +} + +void GroupDavAddressBookAdaptor::customAdaptUploadUrl( KURL &url ) +{ +kdDebug()<<"GroupDavAddressBookAdaptor::adaptUploadUrl( "<<url.url()<<")"<<endl; + url = WebdavHandler::toDAV( url ); +// url.setPath( url.path() + "/new.vcf" ); +// url.addPath( "new.vcf" ); +kdDebug()<<"after GroupDavAddressBookAdaptor::adaptUploadUrl( "<<url.url()<<")"<<endl; +} diff --git a/tderesources/groupdav/groupdavaddressbookadaptor.h b/tderesources/groupdav/groupdavaddressbookadaptor.h new file mode 100644 index 000000000..425c63712 --- /dev/null +++ b/tderesources/groupdav/groupdavaddressbookadaptor.h @@ -0,0 +1,79 @@ + /* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> + Copyright (c) 2004 Till Adam <adam@kde.org> + Copyright (c) 2005 Reinhold Kainhofer <reinhold@kainhofer.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KABC_GROUPDAVADDRESSBOOKADAPTOR_H +#define KABC_GROUPDAVADDRESSBOOKADAPTOR_H + +#include "davaddressbookadaptor.h" +#include "groupdavglobals.h" +#include <davgroupwareglobals.h> +#include <kabc/addressee.h> +#include <kurl.h> + +#include <tqdom.h> + +namespace KABC { + +class GroupDavAddressBookAdaptor : public DavAddressBookAdaptor +{ + public: + GroupDavAddressBookAdaptor(); + + void customAdaptDownloadUrl( KURL &url ); + void customAdaptUploadUrl( KURL &url ); + TQString mimeType() const { return "text/x-vcard"; } + TQCString identifier() const { return "KABCResourceGroupDAV"; } + TQString defaultNewItemName( KPIM::GroupwareUploadItem */*item*/ ) { return "new.vcf"; } + long flags() const { return 0; } + + + // Creating Jobs + TDEIO::Job *createListFoldersJob( const KURL &url ) + { return GroupDavGlobals::createListFoldersJob( url ); } + TDEIO::TransferJob *createListItemsJob( const KURL &url ) + { return GroupDavGlobals::createListItemsJob( url ); } + TDEIO::TransferJob *createDownloadJob( const KURL &url, KPIM::FolderLister::ContentType ctype ) + { return GroupDavGlobals::createDownloadJob( this, url, ctype ); } + TDEIO::Job *createRemoveJob( const KURL &uploadurl, KPIM::GroupwareUploadItem *deletedItem ) + { return GroupDavGlobals::createRemoveJob( this, uploadurl, deletedItem ); } + + + // Interpreting Jobs + bool interpretListItemsJob( TDEIO::Job *job, const TQString &/*jobData*/ ) + { return GroupDavGlobals::interpretListItemsJob( this, job ); } + bool interpretDownloadItemsJob( TDEIO::Job *job, const TQString &jobData ) + { return GroupDavGlobals::interpretAddressBookDownloadItemsJob( + this, job, jobData ); } + + + bool getFolderHasSubs( const TQDomNode &folderNode ) + { return GroupDavGlobals::getFolderHasSubs( folderNode ); } + KPIM::FolderLister::ContentType getContentType( const TQDomNode &folderNode ) + { return GroupDavGlobals::getContentType( folderNode ); } +}; + +} + + + + +#endif diff --git a/tderesources/groupdav/groupdavcalendaradaptor.cpp b/tderesources/groupdav/groupdavcalendaradaptor.cpp new file mode 100644 index 000000000..2556e3d02 --- /dev/null +++ b/tderesources/groupdav/groupdavcalendaradaptor.cpp @@ -0,0 +1,46 @@ +/* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> + Copyright (c) 2004 Till Adam <adam@kde.org> + Copyright (c) 2005 Reinhold Kainhofer <reinhold@kainhofer.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "groupdavcalendaradaptor.h" +#include "webdavhandler.h" + +#include <kdebug.h> + +using namespace KCal; + +GroupDavCalendarAdaptor::GroupDavCalendarAdaptor() : DavCalendarAdaptor() +{ +} + +void GroupDavCalendarAdaptor::customAdaptDownloadUrl( KURL &url ) +{ + url = WebdavHandler::toDAV( url ); +} + +void GroupDavCalendarAdaptor::customAdaptUploadUrl( KURL &url ) +{ + url = WebdavHandler::toDAV( url ); + // FIXME: Find a good place where we can obtain the path for a new item +// url.setPath( url.path() + "/new.ics" ); +} + diff --git a/tderesources/groupdav/groupdavcalendaradaptor.h b/tderesources/groupdav/groupdavcalendaradaptor.h new file mode 100644 index 000000000..b1a0bd366 --- /dev/null +++ b/tderesources/groupdav/groupdavcalendaradaptor.h @@ -0,0 +1,84 @@ + /* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> + Copyright (c) 2004 Till Adam <adam@kde.org> + Copyright (c) 2005 Reinhold Kainhofer <reinhold@kainhofer.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KCAL_GROUPDAVCALENDARADAPTOR_H +#define KCAL_GROUPDAVCALENDARADAPTOR_H + +#include "davcalendaradaptor.h" +#include "groupwareuploadjob.h" +#include "groupdavglobals.h" +#include <davgroupwareglobals.h> + +#include <kurl.h> + +namespace TDEIO { +class Job; +} + +namespace KCal { + +class GroupDavCalendarAdaptor : public DavCalendarAdaptor +{ + public: + GroupDavCalendarAdaptor(); + + TQValueList<KPIM::FolderLister::ContentType> supportedTypes() + { + TQValueList<KPIM::FolderLister::ContentType> types; + types << KPIM::FolderLister::Event; + types << KPIM::FolderLister::Todo; + return types; + } + void customAdaptDownloadUrl( KURL &url ); + void customAdaptUploadUrl( KURL &url ); + TQCString identifier() const { return "KCalResourceGroupDAV"; } + TQString defaultNewItemName( KPIM::GroupwareUploadItem */*item*/ ) { return "new.ics"; } + long flags() const { return 0; } + + + // Creating Jobs + TDEIO::Job *createListFoldersJob( const KURL &url ) + { return GroupDavGlobals::createListFoldersJob( url ); } + TDEIO::TransferJob *createListItemsJob( const KURL &url ) + { return GroupDavGlobals::createListItemsJob( url ); } + TDEIO::TransferJob *createDownloadJob( const KURL &url, KPIM::FolderLister::ContentType ctype ) + { return GroupDavGlobals::createDownloadJob( this, url, ctype ); } + TDEIO::Job *createRemoveJob( const KURL &uploadurl, KPIM::GroupwareUploadItem *deletedItem ) + { return GroupDavGlobals::createRemoveJob( this, uploadurl, deletedItem ); } + + + // Interpreting Jobs + bool interpretListItemsJob( TDEIO::Job *job, const TQString &/*jobData*/ ) + { return GroupDavGlobals::interpretListItemsJob( this, job ); } + bool interpretDownloadItemsJob( TDEIO::Job *job, const TQString &jobData ) + { return GroupDavGlobals::interpretCalendarDownloadItemsJob( this, job, jobData ); } + + + bool getFolderHasSubs( const TQDomNode &folderNode ) + { return GroupDavGlobals::getFolderHasSubs( folderNode ); } + KPIM::FolderLister::ContentType getContentType( const TQDomNode &folderNode ) + { return GroupDavGlobals::getContentType( folderNode ); } +}; +} + + +#endif diff --git a/tderesources/groupdav/groupdavglobals.cpp b/tderesources/groupdav/groupdavglobals.cpp new file mode 100644 index 000000000..5088bca96 --- /dev/null +++ b/tderesources/groupdav/groupdavglobals.cpp @@ -0,0 +1,287 @@ +/* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> + Copyright (c) 2004 Till Adam <adam@kde.org> + Copyright (c) 2005 Reinhold Kainhofer <reinhold@kainhofer.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "groupdavglobals.h" +#include "groupwaredataadaptor.h" +#include <webdavhandler.h> +#include <libemailfunctions/idmapper.h> +#include <calendaradaptor.h> +#include <addressbookadaptor.h> + +#include <libkcal/calendarlocal.h> +#include <libkcal/icalformat.h> +#include <libkcal/resourcecached.h> +#include <kabc/vcardconverter.h> + +#include <kdebug.h> +#include <kio/davjob.h> +#include <kio/job.h> + +TQString GroupDavGlobals::extractFingerprint( TDEIO::Job *job, const TQString &/*jobData*/ ) +{ + const TQString& headers = job->queryMetaData( "HTTP-Headers" ); + return WebdavHandler::getEtagFromHeaders( headers ); +} + + +KPIM::FolderLister::ContentType GroupDavGlobals::getContentType( const TQDomElement &prop ) +{ + TQDomElement ctype = prop.namedItem("getcontenttype").toElement(); + if ( ctype.isNull() ) return KPIM::FolderLister::Unknown; + const TQString &type = ctype.text(); +kdDebug()<<"Found content type: "<<type<<endl; + /// TODO: Not yet implemented in GroupDav! + return KPIM::FolderLister::Unknown; +} + + +KPIM::FolderLister::ContentType GroupDavGlobals::getContentType( const TQDomNode &folderNode ) +{ + TQDomNode n4; +kdDebug()<<"GroupDavGlobals::getContentType(...)"<<endl; + int type = KPIM::FolderLister::Unknown; + for( n4 = folderNode.firstChild(); !n4.isNull(); n4 = n4.nextSibling() ) { + TQDomElement e = n4.toElement(); + + if ( e.tagName() == "resourcetype" ) { + if ( !e.namedItem( "vevent-collection" ).isNull() ) + type |= KPIM::FolderLister::Event; + if ( !e.namedItem( "vtodo-collection" ).isNull() ) + type |= KPIM::FolderLister::Todo; + if ( !e.namedItem( "vjournal-collection" ).isNull() ) + type |= KPIM::FolderLister::Journal; + if ( !e.namedItem( "vcard-collection" ).isNull() ) + type |= KPIM::FolderLister::Contact; + if ( (type == KPIM::FolderLister::Unknown) && + !( e.namedItem( "collection" ).isNull() ) ) + type |= KPIM::FolderLister::Folder; + } + } + return (KPIM::FolderLister::ContentType)type; +} + +bool GroupDavGlobals::getFolderHasSubs( const TQDomNode &folderNode ) +{ + // a folder is identified by the collection item in the resourcetype: + // <a:resourcetype xmlns:a="DAV:"><a:collection xmlns:a="DAV:"/>...</a:resourcetype> + TQDomElement e = folderNode.namedItem("resourcetype").toElement(); + if ( !e.namedItem( "collection" ).isNull() ) + return true; + else return false; +} + + + + +TDEIO::Job *GroupDavGlobals::createListFoldersJob( const KURL &url ) +{ + TQDomDocument doc; + TQDomElement root = WebdavHandler::addDavElement( doc, doc, "d:propfind" ); + TQDomElement prop = WebdavHandler::addElement( doc, root, "d:prop" ); + WebdavHandler::addElement( doc, prop, "d:displayname" ); + WebdavHandler::addElement( doc, prop, "d:resourcetype" ); +// WebdavHandler::addElement( doc, prop, "d:hassubs" ); + + kdDebug(7000) << "props: " << doc.toString() << endl; + return TDEIO::davPropFind( url, doc, "1", false ); +} + + +TDEIO::TransferJob *GroupDavGlobals::createListItemsJob( const KURL &url ) +{ + TQDomDocument doc; + TQDomElement root = WebdavHandler::addDavElement( doc, doc, "propfind" ); + TQDomElement prop = WebdavHandler::addDavElement( doc, root, "prop" ); + WebdavHandler::addDavElement( doc, prop, "getetag" ); +// WebdavHandler::addDavElement( doc, prop, "getcontenttype" ); + kdDebug(5800) << "props = "<< doc.toString() << endl; + TDEIO::TransferJob *job = TDEIO::davPropFind( url, doc, "1", false ); + if ( job ) { + job->addMetaData( "accept", "text/xml" ); + job->addMetaData( "customHTTPHeader", "accept-encoding: " ); + } + return job; +} + + +TDEIO::TransferJob *GroupDavGlobals::createDownloadJob( KPIM::GroupwareDataAdaptor *adaptor, + const KURL &url, KPIM::FolderLister::ContentType /*ctype*/ ) +{ +kdDebug()<<"GroupDavGlobals::createDownloadJob, url="<<url.url()<<endl; + TDEIO::TransferJob *job = TDEIO::get( url, false, false ); + if ( adaptor ) { + TQString mt = adaptor->mimeType(); + job->addMetaData( "accept", mt ); + } + job->addMetaData( "PropagateHttpHeader", "true" ); + return job; +} + + +TDEIO::Job *GroupDavGlobals::createRemoveJob( KPIM::GroupwareDataAdaptor *adaptor, const KURL &/*uploadurl*/, + KPIM::GroupwareUploadItem *deletedItem ) +{ + if ( !deletedItem ) return 0; + //kdDebug(7000) << "Delete: " << endl << format.toICalString(*it) << endl; + KURL url( deletedItem->url() ); + if ( adaptor ) { + adaptor->adaptUploadUrl( url ); + } + TDEIO::Job *delJob = 0; + if ( !url.isEmpty() ) { + kdDebug(5700) << "Delete: " << url.url() << endl; + delJob = TDEIO::file_delete( url, false ); + } + if ( delJob && adaptor && adaptor->idMapper() ) { + kdDebug(5800 ) << "Adding If-Match metadata: " << adaptor->idMapper()->fingerprint( deletedItem->uid() ) << endl; + delJob->addMetaData( "customHTTPHeader", "If-Match: " + adaptor->idMapper()->fingerprint( deletedItem->uid() ) ); + } + return delJob; + +/* TQStringList urls; + KPIM::GroupwareUploadItem::List::const_iterator it; + kdDebug(5800) << " GroupDavGlobals::createRemoveJob, BaseURL="<<uploadurl.url()<<endl; + for ( it = deletedItems.constBegin(); it != deletedItems.constEnd(); ++it ) { + //kdDebug(7000) << "Delete: " << endl << format.toICalString(*it) << endl; + KURL url( (*it)->url() ); + if ( adaptor ) { + adaptor->adaptUploadUrl( url ); + }*/ +/* KURL url( uploadurl ); + url.setPath( (*it)->url().path() ); + if ( !(*it)->url().isEmpty() )*/ +/* if ( !url.isEmpty() ) { +kdDebug() << "Deleting item at "<< url.url() << endl; + urls << url.url(); + } + kdDebug(5700) << "Delete (Mod) : " << url.url() << endl; + } + return TDEIO::file_del( urls, false, false );*/ +} + + + + +bool GroupDavGlobals::interpretListItemsJob( KPIM::GroupwareDataAdaptor *adaptor, + TDEIO::Job *job ) +{ + TDEIO::DavJob *davjob = dynamic_cast<TDEIO::DavJob *>(job); + + if ( !davjob ) { + return false; + } + TQDomDocument doc = davjob->response(); + + kdDebug(7000) << " Doc: " << doc.toString() << endl; + kdDebug(7000) << " IdMapper: " << adaptor->idMapper()->asString() << endl; + + TQDomElement docElem = doc.documentElement(); + TQDomNode n = docElem.firstChild(); + while( !n.isNull() ) { + TQDomElement e = n.toElement(); // try to convert the node to an element. + n = n.nextSibling(); + if ( e.isNull() ) + continue; + + const KURL &entry( e.namedItem("href").toElement().text() ); + TQDomElement propstat = e.namedItem("propstat").toElement(); + if ( propstat.isNull() ) + continue; + TQDomElement prop = propstat.namedItem( "prop" ).toElement(); + if ( prop.isNull() ) + continue; + TQDomElement elem = prop.namedItem("getetag").toElement(); + const TQString &newFingerprint = elem.text(); + if ( elem.isNull() || newFingerprint.isEmpty() ) + continue; + + KPIM::FolderLister::ContentType type = getContentType( prop ); + + adaptor->processDownloadListItem( entry, newFingerprint, type ); + } + + return true; +} + + +bool GroupDavGlobals::interpretCalendarDownloadItemsJob( KCal::CalendarAdaptor *adaptor, + TDEIO::Job *job, const TQString &jobData ) +{ +kdDebug(5800) << "GroupDavGlobals::interpretCalendarDownloadItemsJob, iCalendar=" << endl; +kdDebug(5800) << jobData << endl; + if ( !adaptor || !job ) return false; + KCal::CalendarLocal calendar( TQString::fromLatin1("UTC") ); + KCal::ICalFormat ical; + calendar.setTimeZoneId( adaptor->resource()->timeZoneId() ); + KCal::Incidence::List incidences; + if ( ical.fromString( &calendar, jobData ) ) { + KCal::Incidence::List raw = calendar.rawIncidences(); + KCal::Incidence::List::Iterator it = raw.begin(); + if ( raw.count() != 1 ) { + kdError() << "Parsed iCalendar does not contain exactly one event." << endl; + return false; + } + + KCal::Incidence *inc = (raw.front())->clone(); + if ( !inc ) return false; + TDEIO::SimpleJob *sjob = dynamic_cast<TDEIO::SimpleJob *>(job); + KURL remoteId; + if ( sjob ) remoteId = sjob->url(); + TQString fingerprint = extractFingerprint( job, jobData ); + adaptor->calendarItemDownloaded( inc, inc->uid(), remoteId, fingerprint, + remoteId.prettyURL() ); + return true; + } else { + kdError() << "Unable to parse iCalendar" << endl; + } + return false; +} + + +bool GroupDavGlobals::interpretAddressBookDownloadItemsJob( + KABC::AddressBookAdaptor *adaptor, TDEIO::Job *job, const TQString &jobData ) +{ +kdDebug(5800) << "GroupDavGlobals::interpretAddressBookDownloadItemsJob, vCard=" << endl; +kdDebug(5800) << jobData << endl; + if ( !adaptor || !job ) return false; + + KABC::VCardConverter conv; + KABC::Addressee::List addrs( conv.parseVCards( jobData ) ); + + if ( addrs.count() != 1 ) { + kdError() << "Parsed vCard does not contain exactly one addressee." << endl; + return false; + } + + KABC::Addressee a = addrs.first(); + + TDEIO::SimpleJob *sjob = dynamic_cast<TDEIO::SimpleJob*>(job); + KURL remoteId; + if ( sjob ) remoteId = sjob->url(); + TQString fingerprint = extractFingerprint( job, jobData ); + adaptor->addressbookItemDownloaded( a, a.uid(), remoteId, fingerprint, + remoteId.prettyURL() ); + return true; +} + + diff --git a/tderesources/groupdav/groupdavglobals.h b/tderesources/groupdav/groupdavglobals.h new file mode 100644 index 000000000..e7f2b06e7 --- /dev/null +++ b/tderesources/groupdav/groupdavglobals.h @@ -0,0 +1,73 @@ + /* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> + Copyright (c) 2004 Till Adam <adam@kde.org> + Copyright (C) 2004-2005 Reinhold Kainhofer <reinhold@kainhofer.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef GROUPDAVGLOBALS_H +#define GROUPDAVGLOBALS_H + +#include <groupwareuploadjob.h> +#include <folderlister.h> +#include <kurl.h> +#include <tqdom.h> + +namespace KPIM { +class GroupwareDataAdaptor; +class GroupwareUploadItem; +} +namespace TDEIO { +class TransferJob; +class Job; +} +namespace KABC { +class AddressBookAdaptor; +} +namespace KCal { +class CalendarAdaptor; +} + +class GroupDavGlobals +{ + public: + GroupDavGlobals() {} + static TQString extractFingerprint( TDEIO::Job *job, const TQString &/*jobData*/ ); + static KPIM::FolderLister::ContentType getContentType( const TQDomElement &prop ); + static KPIM::FolderLister::ContentType getContentType( const TQDomNode &folderNode ); + static bool getFolderHasSubs( const TQDomNode &folderNode ); + + + static TDEIO::Job *createListFoldersJob( const KURL &url ); + static TDEIO::TransferJob *createListItemsJob( const KURL &url ); + static TDEIO::TransferJob *createDownloadJob( KPIM::GroupwareDataAdaptor *adaptor, + const KURL &url, KPIM::FolderLister::ContentType ctype ); + static TDEIO::Job *createRemoveJob( KPIM::GroupwareDataAdaptor *adaptor, const KURL &uploadurl, + KPIM::GroupwareUploadItem *deletedItems ); + + + static bool interpretListItemsJob( KPIM::GroupwareDataAdaptor *adaptor, + TDEIO::Job *job ); + static bool interpretCalendarDownloadItemsJob( KCal::CalendarAdaptor *adaptor, + TDEIO::Job *job, const TQString &jobData ); + static bool interpretAddressBookDownloadItemsJob( KABC::AddressBookAdaptor *adaptor, + TDEIO::Job *job, const TQString &jobData ); + +}; + +#endif diff --git a/tderesources/groupdav/kabc_groupdav.desktop b/tderesources/groupdav/kabc_groupdav.desktop new file mode 100644 index 000000000..c10ea97c2 --- /dev/null +++ b/tderesources/groupdav/kabc_groupdav.desktop @@ -0,0 +1,52 @@ +[Desktop Entry] +Name=GroupDAV Server (e.g. OpenGroupware) +Name[af]=GroupDAV bediener (bv. OpenGroupware) +Name[bg]=Сървър GroupDAV (e.g. OpenGroupware) +Name[br]=Servijer GroupDAV (e.g. OpenGroupware) +Name[ca]=Servidor GroupDAV (p.ex. OpenGroupware) +Name[cs]=GroupDAV server (např. OpenGroupware) +Name[da]=GroupDAV-server (f.eks. OpenGroupware) +Name[de]=GroupDAV-Server (z. B. OpenGroupware) +Name[el]=Εξυπηρετητής GroupDAV (π.χ. OpenGroupware) +Name[es]=Servidor GroupDAV (por ejemplo, OpenGroupware) +Name[et]=GroupDAV server (nt. OpenGroupware) +Name[eu]=GroupDAV zerbitzaria (adib. OpenGroupware) +Name[fa]=کارساز GroupDAV (مثلاً OpenGroupware) +Name[fi]=GroupDAV-palvelin (esim. OpenGroupware) +Name[fr]=GroupDAV Serveur (ex. OpenGroupware) +Name[fy]=GroupDAV-tsjinner (OpenGroupware) +Name[ga]=Freastalaí GroupDAV (m.sh. OpenGroupware) +Name[gl]=Servidor GroupDAV (e.g. OpenGroupware) +Name[hu]=GroupDAV-kiszolgáló (pl. OpenGroupware) +Name[is]=GroupDAV þjónn (t.d. OpenGroupware) +Name[it]=Server GroupDAV (per es. OpenGroupware) +Name[ja]=GroupDAV サーバ (例 OpenGroupware) +Name[ka]=სერვერი GroupDAV (მაგ., OpenGroupware) +Name[kk]=GroupDAV сервері (мысалы OpenGroupware) +Name[km]=ម៉ាស៊ីនបម្រើ GroupDAV (ឧ. OpenGroupware) +Name[lt]=GroupDAV serveris (pvz.: OpenGroupware) +Name[ms]=Pelayan GroupDAV (misalnya OpenGroupware) +Name[nb]=GroupDAV-tjener (f.eks. OpenGroupware) +Name[nds]=GroupDAV-Server (t.B. OpenGroupware) +Name[ne]=समूह DAV सर्भर (जस्तै: खुला ग्रुपवेयर) +Name[nl]=GroupDAV-server (OpenGroupware) +Name[nn]=GroupDAV-tenar (t.d. OpenGroupware) +Name[pl]=Serwer GroupDAV (np. OpenGroupware) +Name[pt]=Servidor GroupDAV (por exemplo OpenGroupware) +Name[pt_BR]=Servidor GroupDav (p. ex. OpenGroupware) +Name[ru]=Сервер GroupDAV (например, OpenGroupware) +Name[sk]=GroupDAV Server (napr. OpenGroupware) +Name[sl]=Strežnik GroupDAV (npr. OpenGroupware) +Name[sr]=GroupDAV сервер (нпр. OpenGroupware) +Name[sr@Latn]=GroupDAV server (npr. OpenGroupware) +Name[sv]=GroupDAV-server (t.ex. OpenGroupware) +Name[ta]=GroupDAV சேவகன் (e.g. OpenGroupware) +Name[tr]=GroupDAV Sunucusu (ör. OpenGroupware) +Name[uk]=Сервер GroupDAV (напр., OpenGroupware) +Name[zh_CN]=GroupDAV 服务器(如 OpenGroupware) +Name[zh_TW]=GroupDAV 伺服器 (如: OpenGroupware) +X-TDE-Library=kabc_groupdav +Type=Service +ServiceTypes=KResources/Plugin +X-TDE-ResourceFamily=contact +X-TDE-ResourceType=groupdav diff --git a/tderesources/groupdav/kabc_resourcegroupdav.cpp b/tderesources/groupdav/kabc_resourcegroupdav.cpp new file mode 100644 index 000000000..1f50e04bb --- /dev/null +++ b/tderesources/groupdav/kabc_resourcegroupdav.cpp @@ -0,0 +1,47 @@ +/* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> + Copyright (c) 2004 Till Adam <adam@kde.org> + Copyright (c) 2005 Reinhold Kainhofer <reinhold@kainhofer.com> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include "groupdavaddressbookadaptor.h" +#include "tderesources_groupwareprefs.h" + +#include "kabc_resourcegroupdav.h" + +using namespace KABC; + +ResourceGroupDav::ResourceGroupDav( const TDEConfig *config ) + : ResourceGroupwareBase( config ) +{ + init(); + if ( config ) readConfig( config ); +} + +void ResourceGroupDav::init() +{ + setType( "ResourceGroupDav" ); + setPrefs( createPrefs() ); + setFolderLister( new KPIM::FolderLister( KPIM::FolderLister::AddressBook ) ); + setAdaptor( new GroupDavAddressBookAdaptor() ); + + ResourceGroupwareBase::init(); +} + +#include "kabc_resourcegroupdav.moc" diff --git a/tderesources/groupdav/kabc_resourcegroupdav.h b/tderesources/groupdav/kabc_resourcegroupdav.h new file mode 100644 index 000000000..ca7ed96d3 --- /dev/null +++ b/tderesources/groupdav/kabc_resourcegroupdav.h @@ -0,0 +1,45 @@ +/* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> + Copyright (c) 2004 Till Adam <adam@kde.org> + Copyright (c) 2005 Reinhold Kainhofer <reinhold@kainhofer.com> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ +#ifndef KABC_RESOURCEGROUPDAV_H +#define KABC_RESOURCEGROUPDAV_H + +#include "kabc_resourcegroupwarebase.h" +#include <tdepimmacros.h> + +namespace KABC { + +class KDE_EXPORT ResourceGroupDav : public ResourceGroupwareBase +{ + Q_OBJECT + + + public: + ResourceGroupDav( const TDEConfig * ); +// ResourceGroupDav( const KURL &url, +// const TQString &user, const TQString &password ); + protected: + void init(); +}; + +} + +#endif diff --git a/tderesources/groupdav/kabc_resourcegroupdav_plugin.cpp b/tderesources/groupdav/kabc_resourcegroupdav_plugin.cpp new file mode 100644 index 000000000..d487889fc --- /dev/null +++ b/tderesources/groupdav/kabc_resourcegroupdav_plugin.cpp @@ -0,0 +1,42 @@ +/* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> + Copyright (c) 2004 Till Adam <adam@kde.org> + Copyright (c) 2005 Reinhold Kainhofer <reinhold@kainhofer.com> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include "kabc_resourcegroupdav.h" +#include "kabc_resourcegroupwarebaseconfig.h" + +#include <kglobal.h> +#include <klocale.h> + +using namespace KABC; + +typedef KRES::PluginFactory< ResourceGroupDav, ResourceGroupwareBaseConfig > GroupDavFactory; +// FIXME: Use K_EXPORT_COMPONENT_FACTORY( kabc_groupdav, GroupDavFactory ); here +// Problem: How do I insert the catalogue??? +extern "C" +{ + void *init_kabc_groupdav() + { + TDEGlobal::locale()->insertCatalogue( "tdepimresources" ); + TDEGlobal::locale()->insertCatalogue( "kres_groupdav" ); + return new GroupDavFactory; + } +} diff --git a/tderesources/groupdav/kcal_groupdav.desktop b/tderesources/groupdav/kcal_groupdav.desktop new file mode 100644 index 000000000..288659d6c --- /dev/null +++ b/tderesources/groupdav/kcal_groupdav.desktop @@ -0,0 +1,52 @@ +[Desktop Entry] +Name=GroupDAV Server (e.g. OpenGroupware) +Name[af]=GroupDAV bediener (bv. OpenGroupware) +Name[bg]=Сървър GroupDAV (e.g. OpenGroupware) +Name[br]=Servijer GroupDAV (e.g. OpenGroupware) +Name[ca]=Servidor GroupDAV (p.ex. OpenGroupware) +Name[cs]=GroupDAV server (např. OpenGroupware) +Name[da]=GroupDAV-server (f.eks. OpenGroupware) +Name[de]=GroupDAV-Server (z. B. OpenGroupware) +Name[el]=Εξυπηρετητής GroupDAV (π.χ. OpenGroupware) +Name[es]=Servidor GroupDAV (por ejemplo, OpenGroupware) +Name[et]=GroupDAV server (nt. OpenGroupware) +Name[eu]=GroupDAV zerbitzaria (adib. OpenGroupware) +Name[fa]=کارساز GroupDAV (مثلاً OpenGroupware) +Name[fi]=GroupDAV-palvelin (esim. OpenGroupware) +Name[fr]=GroupDAV Serveur (ex. OpenGroupware) +Name[fy]=GroupDAV-tsjinner (OpenGroupware) +Name[ga]=Freastalaí GroupDAV (m.sh. OpenGroupware) +Name[gl]=Servidor GroupDAV (e.g. OpenGroupware) +Name[hu]=GroupDAV-kiszolgáló (pl. OpenGroupware) +Name[is]=GroupDAV þjónn (t.d. OpenGroupware) +Name[it]=Server GroupDAV (per es. OpenGroupware) +Name[ja]=GroupDAV サーバ (例 OpenGroupware) +Name[ka]=სერვერი GroupDAV (მაგ., OpenGroupware) +Name[kk]=GroupDAV сервері (мысалы OpenGroupware) +Name[km]=ម៉ាស៊ីនបម្រើ GroupDAV (ឧ. OpenGroupware) +Name[lt]=GroupDAV serveris (pvz.: OpenGroupware) +Name[ms]=Pelayan GroupDAV (misalnya OpenGroupware) +Name[nb]=GroupDAV-tjener (f.eks. OpenGroupware) +Name[nds]=GroupDAV-Server (t.B. OpenGroupware) +Name[ne]=समूह DAV सर्भर (जस्तै: खुला ग्रुपवेयर) +Name[nl]=GroupDAV-server (OpenGroupware) +Name[nn]=GroupDAV-tenar (t.d. OpenGroupware) +Name[pl]=Serwer GroupDAV (np. OpenGroupware) +Name[pt]=Servidor GroupDAV (por exemplo OpenGroupware) +Name[pt_BR]=Servidor GroupDav (p. ex. OpenGroupware) +Name[ru]=Сервер GroupDAV (например, OpenGroupware) +Name[sk]=GroupDAV Server (napr. OpenGroupware) +Name[sl]=Strežnik GroupDAV (npr. OpenGroupware) +Name[sr]=GroupDAV сервер (нпр. OpenGroupware) +Name[sr@Latn]=GroupDAV server (npr. OpenGroupware) +Name[sv]=GroupDAV-server (t.ex. OpenGroupware) +Name[ta]=GroupDAV சேவகன் (e.g. OpenGroupware) +Name[tr]=GroupDAV Sunucusu (ör. OpenGroupware) +Name[uk]=Сервер GroupDAV (напр., OpenGroupware) +Name[zh_CN]=GroupDAV 服务器(如 OpenGroupware) +Name[zh_TW]=GroupDAV 伺服器 (如: OpenGroupware) +X-TDE-Library=kcal_groupdav +Type=Service +ServiceTypes=KResources/Plugin +X-TDE-ResourceFamily=calendar +X-TDE-ResourceType=groupdav diff --git a/tderesources/groupdav/kcal_resourcegroupdav.cpp b/tderesources/groupdav/kcal_resourcegroupdav.cpp new file mode 100644 index 000000000..b93ba7693 --- /dev/null +++ b/tderesources/groupdav/kcal_resourcegroupdav.cpp @@ -0,0 +1,52 @@ +/* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> + Copyright (c) 2004 Till Adam <adam@kde.org> + Copyright (c) 2005 Reinhold Kainhofer <reinhold@kainhofer.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include "groupdavcalendaradaptor.h" + +#include "kcal_resourcegroupdav.h" + +using namespace KCal; + +ResourceGroupDav::ResourceGroupDav() + : ResourceGroupwareBase() +{ + init(); +} + +ResourceGroupDav::ResourceGroupDav( const TDEConfig *config ) + : ResourceGroupwareBase( config ) +{ + init(); + if ( config ) readConfig( config ); +} + +void ResourceGroupDav::init() +{ + setType( "ResourceGroupDav" ); + setPrefs( createPrefs() ); + setFolderLister( new KPIM::FolderLister( KPIM::FolderLister::Calendar ) ); + setAdaptor( new GroupDavCalendarAdaptor() ); + + ResourceGroupwareBase::init(); +} + +#include "kcal_resourcegroupdav.moc" diff --git a/tderesources/groupdav/kcal_resourcegroupdav.h b/tderesources/groupdav/kcal_resourcegroupdav.h new file mode 100644 index 000000000..dba9bd274 --- /dev/null +++ b/tderesources/groupdav/kcal_resourcegroupdav.h @@ -0,0 +1,48 @@ + /* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> + Copyright (c) 2004 Till Adam <adam@kde.org> + Copyright (c) 2005 Reinhold Kainhofer <reinhold@kainhofer.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KCAL_RESOURCEGROUPDAV_H +#define KCAL_RESOURCEGROUPDAV_H + +#include "kcal_resourcegroupwarebase.h" + +namespace KCal { + + +/** + This class provides a resource for accessing an GroupDav.org server +*/ +class KDE_EXPORT ResourceGroupDav : public ResourceGroupwareBase +{ + Q_OBJECT + + public: + ResourceGroupDav(); + ResourceGroupDav( const TDEConfig * ); + + protected: + void init(); +}; + +} + +#endif diff --git a/tderesources/groupdav/kcal_resourcegroupdav_plugin.cpp b/tderesources/groupdav/kcal_resourcegroupdav_plugin.cpp new file mode 100644 index 000000000..f06e5d248 --- /dev/null +++ b/tderesources/groupdav/kcal_resourcegroupdav_plugin.cpp @@ -0,0 +1,43 @@ +/* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> + Copyright (c) 2004 Till Adam <adam@kde.org> + Copyright (c) 2005 Reinhold Kainhofer <reinhold@kainhofer.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "kcal_resourcegroupdav.h" +#include "kcal_resourcegroupwarebaseconfig.h" + +#include <kglobal.h> +#include <klocale.h> + +using namespace KCal; + +typedef KRES::PluginFactory< ResourceGroupDav, ResourceGroupwareBaseConfig > GroupDavFactory; +// FIXME: Use K_EXPORT_COMPONENT_FACTORY( kcal_groupdav, GroupDavFactory ); here +// Problem: How do I insert the catalogue??? +extern "C" +{ + void *init_kcal_groupdav() + { + TDEGlobal::locale()->insertCatalogue( "tdepimresources" ); + TDEGlobal::locale()->insertCatalogue( "kres_groupdav" ); + return new GroupDavFactory; + } +} diff --git a/tderesources/groupdav/uninstall.desktop b/tderesources/groupdav/uninstall.desktop new file mode 100644 index 000000000..e1e3e1732 --- /dev/null +++ b/tderesources/groupdav/uninstall.desktop @@ -0,0 +1,2 @@ +[Desktop Entry] +Hidden=true |