summaryrefslogtreecommitdiffstats
path: root/kresources/lib
diff options
context:
space:
mode:
Diffstat (limited to 'kresources/lib')
-rw-r--r--kresources/lib/CMakeLists.txt51
-rw-r--r--kresources/lib/Makefile.am35
-rw-r--r--kresources/lib/TODO45
-rw-r--r--kresources/lib/addressbookadaptor.cpp134
-rw-r--r--kresources/lib/addressbookadaptor.h92
-rw-r--r--kresources/lib/calendaradaptor.cpp150
-rw-r--r--kresources/lib/calendaradaptor.h110
-rw-r--r--kresources/lib/davaddressbookadaptor.cpp61
-rw-r--r--kresources/lib/davaddressbookadaptor.h52
-rw-r--r--kresources/lib/davcalendaradaptor.cpp56
-rw-r--r--kresources/lib/davcalendaradaptor.h52
-rw-r--r--kresources/lib/davgroupwareglobals.cpp22
-rw-r--r--kresources/lib/davgroupwareglobals.h30
-rw-r--r--kresources/lib/folderconfig.cpp173
-rw-r--r--kresources/lib/folderconfig.h66
-rw-r--r--kresources/lib/folderlister.cpp372
-rw-r--r--kresources/lib/folderlister.h151
-rw-r--r--kresources/lib/folderlistview.cpp296
-rw-r--r--kresources/lib/folderlistview.h130
-rw-r--r--kresources/lib/folderselectdialog.cpp88
-rw-r--r--kresources/lib/folderselectdialog.h59
-rw-r--r--kresources/lib/groupwaredataadaptor.cpp283
-rw-r--r--kresources/lib/groupwaredataadaptor.h364
-rw-r--r--kresources/lib/groupwaredownloadjob.cpp300
-rw-r--r--kresources/lib/groupwaredownloadjob.h95
-rw-r--r--kresources/lib/groupwareresourcejob.cpp59
-rw-r--r--kresources/lib/groupwareresourcejob.h69
-rw-r--r--kresources/lib/groupwareuploadjob.cpp485
-rw-r--r--kresources/lib/groupwareuploadjob.h131
-rw-r--r--kresources/lib/kabc_resourcegroupwarebase.cpp262
-rw-r--r--kresources/lib/kabc_resourcegroupwarebase.h99
-rw-r--r--kresources/lib/kabc_resourcegroupwarebaseconfig.cpp117
-rw-r--r--kresources/lib/kabc_resourcegroupwarebaseconfig.h65
-rw-r--r--kresources/lib/kcal_cachesettingsdlg.cpp89
-rw-r--r--kresources/lib/kcal_cachesettingsdlg.h60
-rw-r--r--kresources/lib/kcal_resourcegroupwarebase.cpp410
-rw-r--r--kresources/lib/kcal_resourcegroupwarebase.h119
-rw-r--r--kresources/lib/kcal_resourcegroupwarebaseconfig.cpp137
-rw-r--r--kresources/lib/kcal_resourcegroupwarebaseconfig.h74
-rw-r--r--kresources/lib/kresources_groupwareprefs.kcfg56
-rw-r--r--kresources/lib/kresources_groupwareprefs.kcfgc8
-rw-r--r--kresources/lib/webdavhandler.cpp194
-rw-r--r--kresources/lib/webdavhandler.h78
43 files changed, 0 insertions, 5779 deletions
diff --git a/kresources/lib/CMakeLists.txt b/kresources/lib/CMakeLists.txt
deleted file mode 100644
index a604c51b6..000000000
--- a/kresources/lib/CMakeLists.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-#################################################
-#
-# (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_SOURCE_DIR}
- ${CMAKE_SOURCE_DIR}
- ${CMAKE_SOURCE_DIR}/libtdepim
- ${TDE_INCLUDE_DIR}
- ${TQT_INCLUDE_DIRS}
-)
-
-link_directories(
- ${TQT_LIBRARY_DIRS}
-)
-
-
-##### kgroupwarebase (shared) ###################
-
-tde_add_library( kgroupwarebase SHARED AUTOMOC
- SOURCES
- folderlister.cpp folderconfig.cpp folderlistview.cpp folderselectdialog.cpp
- groupwaredataadaptor.cpp groupwaredownloadjob.cpp calendaradaptor.cpp
- addressbookadaptor.cpp groupwareresourcejob.cpp groupwareuploadjob.cpp
- kcal_resourcegroupwarebase.cpp kabc_resourcegroupwarebase.cpp
- kresources_groupwareprefs.kcfgc kcal_resourcegroupwarebaseconfig.cpp
- kabc_resourcegroupwarebaseconfig.cpp kcal_cachesettingsdlg.cpp
- VERSION 0.0.0
- LINK tdepim-shared
- DESTINATION ${LIB_INSTALL_DIR}
-)
-
-
-##### kgroupwaredav (shared) ####################
-
-tde_add_library( kgroupwaredav SHARED AUTOMOC
- SOURCES
- davcalendaradaptor.cpp davaddressbookadaptor.cpp webdavhandler.cpp
- davgroupwareglobals.cpp
- VERSION 0.0.0
- LINK kgroupwarebase-shared
- DESTINATION ${LIB_INSTALL_DIR}
-)
diff --git a/kresources/lib/Makefile.am b/kresources/lib/Makefile.am
deleted file mode 100644
index 37d08bedc..000000000
--- a/kresources/lib/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-INCLUDES = -I$(top_srcdir) $(all_includes)
-
-lib_LTLIBRARIES = libkgroupwarebase.la libkgroupwaredav.la
-
-libkgroupwarebase_la_SOURCES = folderlister.cpp folderconfig.cpp folderlistview.cpp folderselectdialog.cpp \
- groupwaredataadaptor.cpp groupwaredownloadjob.cpp \
- calendaradaptor.cpp addressbookadaptor.cpp groupwareresourcejob.cpp \
- groupwareuploadjob.cpp kcal_resourcegroupwarebase.cpp kabc_resourcegroupwarebase.cpp \
- kresources_groupwareprefs.kcfgc \
- kcal_resourcegroupwarebaseconfig.cpp kabc_resourcegroupwarebaseconfig.cpp \
- kcal_cachesettingsdlg.cpp
-libkgroupwarebase_la_LDFLAGS = $(all_libraries) -no-undefined
-libkgroupwarebase_la_LIBADD = $(top_builddir)/libkcal/libkcal.la \
- $(top_builddir)/libtdepim/libtdepim.la
-
-libkgroupwaredav_la_SOURCES = davcalendaradaptor.cpp davaddressbookadaptor.cpp webdavhandler.cpp \
- davgroupwareglobals.cpp
-libkgroupwaredav_la_LDFLAGS = $(all_libraries) -no-undefined
-libkgroupwaredav_la_LIBADD = $(top_builddir)/libkcal/libkcal.la \
- $(top_builddir)/libtdepim/libtdepim.la libkgroupwarebase.la
-
-METASOURCES = AUTO
-
-### We use three (or more) namespaces here in here - KPIM, KABC and KCal.
-### When using multiple "using namespace foo" declarations, namespaced
-### definitions cannot be resolved properly; we could use namespace foo { }
-### instead, but this breaks on TDEConfigXT generated code, which still uses
-### "using namespace" and can't be fixed due to our backwards-compatibility
-### requirements. This is only fatal when doing --enable-final, since only
-### then do all the namespaces get mixed together.
-KDE_OPTIONS = nofinal
-
-messages: rc.cpp
- $(XGETTEXT) *.cpp -o $(podir)/tdepimresources.pot
-
diff --git a/kresources/lib/TODO b/kresources/lib/TODO
deleted file mode 100644
index 1a1b4cdbf..000000000
--- a/kresources/lib/TODO
+++ /dev/null
@@ -1,45 +0,0 @@
-kresources/lib (general):
-===============
--) http result code handling (404, 200, etc.)
--) conflict resolution
--) Error handling in the folder lister (cannot connect to host, timeout, etc.)
--) turn the flat folder list into a folder tree
--) Restore folder subscriptions on folder list refresh
--) If the user cancels, we need to reset the mUploadJob variable to 0 in the
- abook resource.
--) if there's an item in the local cache that cannot be bound on the server and
- in the idMapper, mark it as added and try to upload it on save!
--) reload libkcal resources in korganizer when config changes
--) Use the username / password entered into the config dlg. For some reason
- each ioslave asks again with a password dialog...
--) If upload fails, mark the item as changed/added/deleted again
--) Don't ask immediately for uploading in korganizer, wait at least a
- QTimer::singleShot
--) Better progress bar messages
-
-
-kresources/newexchange:
-=======================
--) handling of errors returned in a valid dav response (Exchange)
--) recurrences on exchange
--) timezone for exchange
--) exdate on exchange
--) notifications from the server (old exchange resource has it!)
--) In Exchange abook: if an address is removed, store the empty string to the
- server to delete the data from the server
--) Journal upload not working
-
-
-kresources/groupdav:
-====================
--) recurrences on ogo
--) uploading abook entries don't work (server doesn't implement it yet)
--) Overview and Calendar have the same items -> downloaded every time (same
- uid, different href, only one of them can be in the local cache -> the other
- one is downloaded and replaces the current item, so on next folder sync the
- first item is downloaded again and replaces the other one...)
-
-
-kresources/blogging:
-====================
--) Upload of blog posts
diff --git a/kresources/lib/addressbookadaptor.cpp b/kresources/lib/addressbookadaptor.cpp
deleted file mode 100644
index 8cc28f67a..000000000
--- a/kresources/lib/addressbookadaptor.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- 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 "addressbookadaptor.h"
-
-#include <kabc/addressee.h>
-#include <kabc/vcardconverter.h>
-#include <libtdepim/kabcresourcecached.h>
-#include <kio/job.h>
-
-
-using namespace KABC;
-
-
-AddressBookUploadItem::AddressBookUploadItem(
- KPIM::GroupwareDataAdaptor *adaptor,
- KABC::Addressee addr,
- GroupwareUploadItem::UploadType type )
- : GroupwareUploadItem( type )
-{
- mItemType = KPIM::FolderLister::Contact;
- setUrl( addr.custom( adaptor->identifier(), "storagelocation" ) );
- setUid( addr.uid() );
- KABC::VCardConverter vcard;
-#if defined(KABC_VCARD_ENCODING_FIX)
- setData( vcard.createVCardRaw( addr ) );
-#else
- setData( vcard.createVCard( addr ) );
-#endif
-}
-
-
-
-AddressBookAdaptor::AddressBookAdaptor()
-{
-}
-
-TQString AddressBookAdaptor::mimeType() const
-{
- return "text/x-vcard";
-}
-
-bool AddressBookAdaptor::localItemExists( const TQString &localId )
-{
- KABC::Addressee a = mResource->findByUid( localId );
- return !a.isEmpty();
-}
-
-bool AddressBookAdaptor::localItemHasChanged( const TQString &localId )
-{
- KABC::Addressee::List addressees = mResource->deletedAddressees();
- KABC::Addressee::List::ConstIterator it;
- for( it = addressees.begin(); it != addressees.end(); ++it ) {
- if ( (*it).uid() == localId ) return true;
- }
-
- addressees = mResource->changedAddressees();
- for( it = addressees.begin(); it != addressees.end(); ++it ) {
- if ( (*it).uid() == localId ) return true;
- }
-
- return false;
-}
-
-
-void AddressBookAdaptor::deleteItem( const TQString &localId )
-{
- KABC::Addressee a = mResource->findByUid( localId );
- if ( !a.isEmpty() ) {
- mResource->removeAddressee( a );
- mResource->clearChange( a.uid() );
- }
-}
-
-void AddressBookAdaptor::addItem( KABC::Addressee addr )
-{
- if ( !addr.isEmpty() ) {
- addr.setResource( mResource );
- mResource->insertAddressee( addr );
- clearChange( addr.uid() );
- }
-}
-
-void AddressBookAdaptor::addressbookItemDownloaded( KABC::Addressee addr,
- const TQString &newLocalId, const KURL &remoteId, const TQString &fingerprint,
- const TQString &storagelocation )
-{
- // remove the currently existing item from the cache
- deleteItem( newLocalId );
- TQString localId = idMapper()->localId( remoteId.path() );
- if ( !localId.isEmpty() ) deleteItem( localId );
-
- // add the new item
- addr.insertCustom( identifier(), "storagelocation", storagelocation );
- if ( !localId.isEmpty() ) addr.setUid( localId );
- addItem( addr );
-
- // update the fingerprint and the ids in the idMapper
- idMapper()->removeRemoteId( localId );
- idMapper()->removeRemoteId( newLocalId );
- emit itemDownloaded( addr.uid(), remoteId, fingerprint );
-}
-
-
-void AddressBookAdaptor::clearChange( const TQString &uid )
-{
- mResource->clearChange( uid );
-}
-
-KPIM::GroupwareUploadItem *AddressBookAdaptor::newUploadItem(
- KABC::Addressee addr, KPIM::GroupwareUploadItem::UploadType type )
-{
- return new AddressBookUploadItem( this, addr, type );
-}
diff --git a/kresources/lib/addressbookadaptor.h b/kresources/lib/addressbookadaptor.h
deleted file mode 100644
index b029ff60d..000000000
--- a/kresources/lib/addressbookadaptor.h
+++ /dev/null
@@ -1,92 +0,0 @@
- /*
- 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_ADDRESSBOOKADAPTOR_H
-#define KABC_ADDRESSBOOKADAPTOR_H
-
-#include "groupwaredataadaptor.h"
-
-#include <kabc/addressee.h>
-#include <tdepimmacros.h>
-#include <kurl.h>
-
-namespace KABC {
-class ResourceCached;
-
-class AddressBookUploadItem : public KPIM::GroupwareUploadItem
-{
- public:
- AddressBookUploadItem( KPIM::GroupwareDataAdaptor *adaptor,
- KABC::Addressee addr, UploadType type );
- virtual ~AddressBookUploadItem() {}
- protected:
- AddressBookUploadItem( UploadType type )
- : KPIM::GroupwareUploadItem( type ) {}
-};
-
-class KDE_EXPORT AddressBookAdaptor : public KPIM::GroupwareDataAdaptor
-{
- public:
- AddressBookAdaptor();
-
- TQValueList<KPIM::FolderLister::ContentType> supportedTypes()
- {
- TQValueList<KPIM::FolderLister::ContentType> types;
- types << KPIM::FolderLister::Contact;
- return types;
- }
-
- /**
- Set resource.
- */
- void setResource( KABC::ResourceCached *v )
- {
- mResource = v;
- }
- /**
- Get resource. See setResource().
- */
- KABC::ResourceCached *resource() const
- {
- return mResource;
- }
-
- TQString mimeType() const;
- bool localItemExists( const TQString &localId );
- bool localItemHasChanged( const TQString &localId );
- void deleteItem( const TQString &localId );
- void addItem( KABC::Addressee addr );
- void clearChange( const TQString &uid );
-
- virtual KPIM::GroupwareUploadItem *newUploadItem( KABC::Addressee addr,
- KPIM::GroupwareUploadItem::UploadType type );
- virtual void addressbookItemDownloaded( KABC::Addressee addr,
- const TQString &newLocalId, const KURL &remoteId,
- const TQString &fingerprint, const TQString &storagelocation );
-
- private:
- KABC::ResourceCached *mResource;
-};
-
-}
-
-#endif
diff --git a/kresources/lib/calendaradaptor.cpp b/kresources/lib/calendaradaptor.cpp
deleted file mode 100644
index f2e255f0d..000000000
--- a/kresources/lib/calendaradaptor.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- 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 "calendaradaptor.h"
-
-#include <libkcal/incidence.h>
-#include <libkcal/calendar.h>
-#include <libkcal/resourcecached.h>
-#include <libkcal/icalformat.h>
-
-#include <kio/job.h>
-
-#include <kdebug.h>
-
-using namespace KCal;
-
-
-CalendarUploadItem::CalendarUploadItem( CalendarAdaptor *adaptor, KCal::Incidence *incidence, KPIM::GroupwareUploadItem::UploadType type )
- : GroupwareUploadItem( type )
-{
- if ( incidence && adaptor ) {
- if ( incidence->type() == "Event" ) mItemType = KPIM::FolderLister::Event;
- else if ( incidence->type() == "Todo" ) mItemType = KPIM::FolderLister::Todo;
- else if ( incidence->type() == "Journal" ) mItemType = KPIM::FolderLister::Journal;
-
- setUrl( incidence->customProperty( adaptor->identifier(), "storagelocation" ) );
- setUid( incidence->uid() );
-
- ICalFormat format;
- format.setTimeZone( adaptor->resource()->timeZoneId(), true );
- setData( format.toICalString( incidence ) );
- }
-}
-
-
-
-CalendarAdaptor::CalendarAdaptor()
-{
-}
-
-TQString CalendarAdaptor::mimeType() const
-{
- return "text/calendar";
-}
-
-bool CalendarAdaptor::localItemExists( const TQString &localId )
-{
- KCal::Incidence *i = mResource->incidence( localId );
- return i;
-}
-
-bool CalendarAdaptor::localItemHasChanged( const TQString &localId )
-{
- KCal::Incidence *i = mResource->incidence( localId );
- if ( !i ) return false;
-
- if ( !mResource->deletedIncidences().isEmpty() &&
- mResource->deletedIncidences().find( i )
- != mResource->deletedIncidences().end() )
- return true;
- if ( !mResource->changedIncidences().isEmpty() &&
- mResource->changedIncidences().find( i )
- != mResource->changedIncidences().end() )
- return true;
-
- return false;
-}
-
-void CalendarAdaptor::deleteItem( const TQString &localId )
-{
- mResource->disableChangeNotification();
- KCal::Incidence *i = mResource->incidence( localId );
- if ( i ) {
- mResource->deleteIncidence( i );
- mResource->clearChange( i );
- }
- mResource->enableChangeNotification();
-}
-
-void CalendarAdaptor::addItem( KCal::Incidence *i)
-{
- if ( i ) {
- mResource->disableChangeNotification();
- Incidence *existing = mResource->incidence( i->uid() );
- if ( existing ) {
- mResource->deleteIncidence( i );
- }
- mResource->addIncidence( i );
- mResource->clearChange( i );
- mResource->enableChangeNotification();
- }
-}
-
-
-void CalendarAdaptor::calendarItemDownloaded( KCal::Incidence *inc,
- const TQString &newLocalId, const KURL &remoteId, const TQString &fingerprint,
- const TQString &storagelocation )
-{
-kdDebug() << "CalendarAdaptor::calendarItemDownloaded, inc=" << inc->summary() << ", local=" << newLocalId << ", remote=" << remoteId.url() << ", fpr=" << fingerprint << ", storagelocation="<< storagelocation << endl;
- // remove the currently existing item from the cache
- deleteItem( newLocalId );
- TQString localId = idMapper()->localId( remoteId.path() );
- if ( !localId.isEmpty() ) deleteItem( localId );
-
- // add the new item
- inc->setCustomProperty( identifier(), "storagelocation", storagelocation );
- if ( !localId.isEmpty() ) inc->setUid( localId );
- addItem( inc );
-
- // update the fingerprint and the ids in the idMapper
- idMapper()->removeRemoteId( localId );
- idMapper()->removeRemoteId( newLocalId );
-
- emit itemDownloaded( inc->uid(), remoteId, fingerprint );
-}
-
-
-void CalendarAdaptor::clearChange( const TQString &uid )
-{
- KCal::Incidence *i = mResource->incidence( uid );
- mResource->clearChange( i );
-}
-
-KPIM::GroupwareUploadItem *CalendarAdaptor::newUploadItem( KCal::Incidence*it,
- KPIM::GroupwareUploadItem::UploadType type )
-{
- return new CalendarUploadItem( this, it, type );
-}
-
-#include "calendaradaptor.moc"
diff --git a/kresources/lib/calendaradaptor.h b/kresources/lib/calendaradaptor.h
deleted file mode 100644
index 354a2795e..000000000
--- a/kresources/lib/calendaradaptor.h
+++ /dev/null
@@ -1,110 +0,0 @@
- /*
- 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_CALENDARADAPTOR_H
-#define KCAL_CALENDARADAPTOR_H
-
-#include "groupwaredataadaptor.h"
-
-
-#include <libkcal/incidence.h>
-#include <tdepimmacros.h>
-#include <kurl.h>
-
-namespace KPIM {
-class GroupwareUploadItem;
-}
-
-namespace KCal {
-class ResourceCached;
-class CalendarAdaptor;
-
-class CalendarUploadItem : public KPIM::GroupwareUploadItem
-{
- public:
- CalendarUploadItem( CalendarAdaptor *adaptor, KCal::Incidence *incidence, UploadType type );
- virtual ~CalendarUploadItem() {}
-
- protected:
- CalendarUploadItem( UploadType type ) : KPIM::GroupwareUploadItem( type ) {}
-};
-
-
-class KDE_EXPORT CalendarAdaptor : public KPIM::GroupwareDataAdaptor
-{
- Q_OBJECT
-
- public:
- CalendarAdaptor();
-
- TQValueList<KPIM::FolderLister::ContentType> supportedTypes()
- {
- TQValueList<KPIM::FolderLister::ContentType> types;
- types << KPIM::FolderLister::Event;
- types << KPIM::FolderLister::Todo;
- types << KPIM::FolderLister::Journal;
- return types;
- }
-
- /**
- Set resource.
- */
- void setResource( KCal::ResourceCached *v )
- {
- mResource = v;
- }
- /**
- Get resource. See setResource().
- */
- KCal::ResourceCached *resource() const
- {
- return mResource;
- }
-
- virtual TQString mimeType() const;
- bool localItemExists( const TQString &localId );
- bool localItemHasChanged( const TQString &localId );
- void deleteItem( const TQString &localId );
- void clearChange( const TQString &uid );
-
- virtual KPIM::GroupwareUploadItem *newUploadItem( KCal::Incidence*it,
- KPIM::GroupwareUploadItem::UploadType type );
-
- public slots:
- /** newLocalId is the new id that was (randomly) assigned to the item */
- virtual void calendarItemDownloaded( KCal::Incidence *inc,
- const TQString &newLocalId, const KURL &remoteId,
- const TQString &fingerprint, const TQString &storagelocation );
-
- protected:
- void addItem( KCal::Incidence *i );
- private:
- KCal::ResourceCached *mResource;
-
- TQStringList mAddedItems;
- TQStringList mChangedItems;
- TQStringList mDeletedItems;
-};
-
-}
-
-#endif
diff --git a/kresources/lib/davaddressbookadaptor.cpp b/kresources/lib/davaddressbookadaptor.cpp
deleted file mode 100644
index 5b4a0a521..000000000
--- a/kresources/lib/davaddressbookadaptor.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- 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 "davaddressbookadaptor.h"
-// #include "ogoglobals.h"
-// #include "davgroupwareglobals.h"
-// #include "webdavhandler.h"
-
-// #include <kabc/addressee.h>
-// #include <kabc/vcardconverter.h>
-// #include <kabcresourcecached.h>
-
-#include <kio/davjob.h>
-// #include <kio/job.h>
-#include <kdebug.h>
-
-using namespace KABC;
-
-void DavAddressBookAdaptor::interpretListFoldersJob( TDEIO::Job *job, KPIM::FolderLister */*folderLister*/ )
-{
- TDEIO::DavJob *davjob = dynamic_cast<TDEIO::DavJob*>( job );
- Q_ASSERT( davjob );
- if ( !davjob ) return;
-
- TQDomDocument doc = davjob->response();
- kdDebug(7000) << " Doc: " << doc.toString() << endl;
-
- TQDomElement docElement = doc.documentElement();
- TQDomNode n;
- for( n = docElement.firstChild(); !n.isNull(); n = n.nextSibling() ) {
- TQDomNode n2 = n.namedItem( "propstat" );
- TQDomNode n3 = n2.namedItem( "prop" );
-
- KURL href( n.namedItem( "href" ).toElement().text() );
- TQString displayName = n3.namedItem( "displayname" ).toElement().text();
- KPIM::FolderLister::ContentType type = getContentType( n3 );
-
- emit folderInfoRetrieved( href, displayName, type );
- emit folderSubitemRetrieved( href, getFolderHasSubs( n3 ) );
- }
-}
diff --git a/kresources/lib/davaddressbookadaptor.h b/kresources/lib/davaddressbookadaptor.h
deleted file mode 100644
index f0f6f39d2..000000000
--- a/kresources/lib/davaddressbookadaptor.h
+++ /dev/null
@@ -1,52 +0,0 @@
- /*
- This file is part of tdepim.
-
- Copyright (C) 2004 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_DAVADDRESSBOOKADAPTOR_H
-#define KCAL_DAVADDRESSBOOKADAPTOR_H
-
-#include "addressbookadaptor.h"
-#include "folderlister.h"
-#include <tqdom.h>
-#include <tdepimmacros.h>
-
-namespace KABC {
-
-class KDE_EXPORT DavAddressBookAdaptor : public AddressBookAdaptor
-{
- public:
- DavAddressBookAdaptor() {}
-
- /** Interprets the results returned by the liste job (created by
- createListFoldersJob(url) ). Typically, this adds an Entry to the mFolders list if
- the job describes a folder of the appropriate type, by emitting
- folderInfoRetrieved( href, displayName, type ). If the folder has
- subfolders, just emit retrieveSubfolder( href ) for each of them. */
- virtual void interpretListFoldersJob( TDEIO::Job *job, KPIM::FolderLister *folderLister );
- /** Returns the type of folder retrieved in the dom node. Typically, you'll
- compare the DAV:resourcetype property with some values. */
- virtual KPIM::FolderLister::ContentType getContentType( const TQDomNode &folderNode ) = 0;
- /** Extract from the dav response whether the folder has subitems that need
- to be examined */
- virtual bool getFolderHasSubs( const TQDomNode &folderNode ) = 0;
-};
-
-}
-
-#endif
diff --git a/kresources/lib/davcalendaradaptor.cpp b/kresources/lib/davcalendaradaptor.cpp
deleted file mode 100644
index 5d6be2da6..000000000
--- a/kresources/lib/davcalendaradaptor.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- This file is part of tdepim.
-
- Copyright (c) 2004 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 "davcalendaradaptor.h"
-
-#include <kdebug.h>
-#include <kio/davjob.h>
-// #include <folderlister.h>
-
-// #include <tqdom.h>
-
-using namespace KCal;
-
-// TODO: This is exactly the same code as for the DavAddressBookAdaptor::interpretListFoldersJob!
-// But as this emits a signal, it needs to be located inside a TQObject
-void DavCalendarAdaptor::interpretListFoldersJob( TDEIO::Job *job, KPIM::FolderLister */*folderLister*/ )
-{
- TDEIO::DavJob *davjob = dynamic_cast<TDEIO::DavJob*>( job );
- Q_ASSERT( davjob );
- if ( !davjob ) return;
-
- TQDomDocument doc = davjob->response();
- kdDebug(7000) << " Doc: " << doc.toString() << endl;
-
- TQDomElement docElement = doc.documentElement();
- TQDomNode n;
- for( n = docElement.firstChild(); !n.isNull(); n = n.nextSibling() ) {
- TQDomNode n2 = n.namedItem( "propstat" );
- TQDomNode n3 = n2.namedItem( "prop" );
-
- KURL href( n.namedItem( "href" ).toElement().text() );
- TQString displayName = n3.namedItem( "displayname" ).toElement().text();
- KPIM::FolderLister::ContentType type = getContentType( n3 );
-
- emit folderInfoRetrieved( href, displayName, type );
- emit folderSubitemRetrieved( href, getFolderHasSubs( n3 ) );
- }
-}
diff --git a/kresources/lib/davcalendaradaptor.h b/kresources/lib/davcalendaradaptor.h
deleted file mode 100644
index 998a9cc7d..000000000
--- a/kresources/lib/davcalendaradaptor.h
+++ /dev/null
@@ -1,52 +0,0 @@
- /*
- This file is part of tdepim.
-
- Copyright (C) 2004 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_DAVCALENDARADAPTOR_H
-#define KCAL_DAVCALENDARADAPTOR_H
-
-#include "calendaradaptor.h"
-#include "folderlister.h"
-#include <tqdom.h>
-#include <tdepimmacros.h>
-
-namespace KCal {
-
-class KDE_EXPORT DavCalendarAdaptor : public CalendarAdaptor
-{
- public:
- DavCalendarAdaptor() {}
-
- /** Interprets the results returned by the liste job (created by
- createListFoldersJob(url) ). Typically, this adds an Entry to the mFolders list if
- the job describes a folder of the appropriate type, by emitting
- folderInfoRetrieved( href, displayName, type ). If the folder has
- subfolders, just emit retrieveSubfolder( href ) for each of them. */
- virtual void interpretListFoldersJob( TDEIO::Job *job, KPIM::FolderLister *folderLister );
- /** Returns the type of folder retrieved in the dom node. Typically, you'll
- compare the DAV:resourcetype property with some values. */
- virtual KPIM::FolderLister::ContentType getContentType( const TQDomNode &folderNode ) = 0;
- /** Extract from the dav response whether the folder has subitems that need
- to be examined */
- virtual bool getFolderHasSubs( const TQDomNode &folderNode ) = 0;
-};
-
-}
-
-#endif
diff --git a/kresources/lib/davgroupwareglobals.cpp b/kresources/lib/davgroupwareglobals.cpp
deleted file mode 100644
index 5d9a37206..000000000
--- a/kresources/lib/davgroupwareglobals.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- This file is part of tdepim.
-
- 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.
-*/
-
-#include "davgroupwareglobals.h"
diff --git a/kresources/lib/davgroupwareglobals.h b/kresources/lib/davgroupwareglobals.h
deleted file mode 100644
index 67eb22801..000000000
--- a/kresources/lib/davgroupwareglobals.h
+++ /dev/null
@@ -1,30 +0,0 @@
- /*
- This file is part of tdepim.
-
- 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 DAVGROUPWAREGLOBALS_H
-#define DAVGROUPWAREGLOBALS_H
-
-class DAVGroupwareGlobals
-{
- public:
- DAVGroupwareGlobals() {}
-};
-
-#endif
diff --git a/kresources/lib/folderconfig.cpp b/kresources/lib/folderconfig.cpp
deleted file mode 100644
index 20fa6fa1b..000000000
--- a/kresources/lib/folderconfig.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- This file is part of libkcal.
-
- 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 "folderconfig.h"
-
-#include "folderlister.h"
-#include "groupwaredataadaptor.h"
-#include "folderlistview.h"
-
-#include <klistview.h>
-#include <klocale.h>
-#include <kdebug.h>
-#include <kdialog.h>
-
-#include <tqlayout.h>
-#include <tqgroupbox.h>
-#include <tqpushbutton.h>
-#include <tqcombobox.h>
-#include <tqhbox.h>
-#include <tqlabel.h>
-
-using namespace KPIM;
-
-FolderConfig::FolderConfig( TQWidget *parent )
- : TQWidget( parent ), mFolderLister( 0 )
-{
- TQBoxLayout *topLayout = new TQVBoxLayout( this );
- topLayout->addSpacing( KDialog::spacingHint() );
-
- TQGroupBox *topBox = new TQGroupBox( 1, Qt::Horizontal, i18n("Folder Selection"),
- this );
- topLayout->addWidget( topBox );
-
- TQPushButton *button = new TQPushButton( i18n("Update Folder List"), topBox );
- connect( button, TQT_SIGNAL( clicked() ), TQT_SIGNAL( updateFoldersClicked() ) );
-
- mFolderList = new FolderListView( topBox );
-
-/* TQHBox *writeBox = new TQHBox( topBox );
-
- new TQLabel( i18n("Write to:"), writeBox );
-
- mWriteCombo = new TQComboBox( writeBox );*/
-}
-
-FolderConfig::~FolderConfig()
-{
-}
-
-void FolderConfig::setFolderLister( FolderLister *f )
-{
- mFolderLister = f;
-
- TQValueList<FolderListView::Property> types;
- TQValueList<FolderLister::ContentType> suptypes( mFolderLister->supportedTypes() );
- if ( suptypes.contains( FolderLister::Event ) ) types << FolderListView::Event;
- if ( suptypes.contains( FolderLister::Todo ) ) types << FolderListView::Todo;
- if ( suptypes.contains( FolderLister::Journal ) ) types << FolderListView::Journal;
- if ( suptypes.contains( FolderLister::Contact ) ) types << FolderListView::Contact;
- if ( suptypes.contains( FolderLister::All ) ) types << FolderListView::All;
- if ( suptypes.contains( FolderLister::Unknown ) ) types << FolderListView::Unknown;
-
- mFolderList->setEnabledTypes( types );
- connect( mFolderLister, TQT_SIGNAL( foldersRead() ), TQT_SLOT( updateFolderList() ) );
-}
-
-void FolderConfig::retrieveFolderList( const KURL &url )
-{
- kdDebug(7000) << "FolderConfig::retrieveFolderList()" << endl;
- if ( !mOldFolderListerURL.isEmpty() ) return;
-
- if ( mFolderLister->adaptor() ) {
- mOldFolderListerURL = mFolderLister->adaptor()->baseURL();
- mFolderLister->adaptor()->setBaseURL( url );
- }
- mFolderLister->retrieveFolders( url );
-}
-
-void FolderConfig::updateFolderList()
-{
- mFolderList->clear();
-
- TQStringList write;
-
- if ( !mOldFolderListerURL.isEmpty() && mFolderLister->adaptor() ) {
- mFolderLister->adaptor()->setBaseURL( mOldFolderListerURL );
- mOldFolderListerURL = KURL();
- }
-
- FolderLister::Entry::List folders = mFolderLister->folders();
- FolderLister::Entry::List::ConstIterator it;
- for( it = folders.begin(); it != folders.end(); ++it ) {
- FolderListItem *item = new FolderListItem( mFolderList, (*it) );
- if ( mFolderLister->writeDestinationId( FolderLister::Event ) == (*it).id ) {
- item->setDefault( FolderListView::Event );
- }
- if ( mFolderLister->writeDestinationId( FolderLister::Todo ) == (*it).id ) {
- item->setDefault( FolderListView::Todo );
- }
- if ( mFolderLister->writeDestinationId( FolderLister::Journal ) == (*it).id ) {
- item->setDefault( FolderListView::Journal );
- }
- if ( mFolderLister->writeDestinationId( FolderLister::Contact ) == (*it).id ) {
- item->setDefault( FolderListView::Contact );
- }
- if ( mFolderLister->writeDestinationId( FolderLister::All ) == (*it).id ) {
- item->setDefault( FolderListView::All );
- }
- if ( mFolderLister->writeDestinationId( FolderLister::Unknown ) == (*it).id ) {
- item->setDefault( FolderListView::Unknown );
- }
- }
-}
-
-void FolderConfig::saveSettings()
-{
- TQPtrList<TQListViewItem> lst;
-
- FolderLister::Entry::List folders;
-
- TQListViewItemIterator it( mFolderList );
- while ( it.current() ) {
- FolderListItem *item = dynamic_cast<FolderListItem *>( it.current() );
- if ( item ) {
- FolderLister::Entry folder = item->folder();
- folder.active = item->isOn();
- folders.append( folder );
- if ( item->isDefault( FolderListView::Event ) ) {
- mFolderLister->setWriteDestinationId( FolderLister::Event, folder.id );
- }
- if ( item->isDefault( FolderListView::Todo ) ) {
- mFolderLister->setWriteDestinationId( FolderLister::Todo, folder.id );
- }
- if ( item->isDefault( FolderListView::Journal ) ) {
- mFolderLister->setWriteDestinationId( FolderLister::Journal, folder.id );
- }
- if ( item->isDefault( FolderListView::Contact ) ) {
- mFolderLister->setWriteDestinationId( FolderLister::Contact, folder.id );
- }
- if ( item->isDefault( FolderListView::All ) ) {
- mFolderLister->setWriteDestinationId( FolderLister::All, folder.id );
- }
- if ( item->isDefault( FolderListView::Unknown ) ) {
- mFolderLister->setWriteDestinationId( FolderLister::Unknown, folder.id );
- }
- }
- ++it;
- }
-
- mFolderLister->setFolders( folders );
-}
-
-#include "folderconfig.moc"
diff --git a/kresources/lib/folderconfig.h b/kresources/lib/folderconfig.h
deleted file mode 100644
index 36a8d31a0..000000000
--- a/kresources/lib/folderconfig.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- This file is part of libkcal.
-
- 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 KPIM_FOLDERCONFIG_H
-#define KPIM_FOLDERCONFIG_H
-
-#include <kurl.h>
-#include <tdepimmacros.h>
-#include <tqwidget.h>
-
-// class KListView;
-class TQComboBox;
-class FolderListView;
-
-namespace KPIM {
-
-class FolderLister;
-
-class KDE_EXPORT FolderConfig : public TQWidget
-{
- Q_OBJECT
-
- public:
- FolderConfig( TQWidget *parent );
- ~FolderConfig();
-
- void setFolderLister( FolderLister * );
-
- void saveSettings();
-
- public slots:
- void updateFolderList();
- void retrieveFolderList( const KURL & );
-
- signals:
- void updateFoldersClicked();
-
- private:
- FolderListView *mFolderList;
-
- FolderLister *mFolderLister;
- KURL mOldFolderListerURL;
-};
-
-}
-
-#endif
diff --git a/kresources/lib/folderlister.cpp b/kresources/lib/folderlister.cpp
deleted file mode 100644
index eb91243b7..000000000
--- a/kresources/lib/folderlister.cpp
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- This file is part of libkcal.
-
- Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
- Copyright (c) 2004 Till Adam <adam@kde.org>
- Copyright (c) 2004 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 "folderlister.h"
-#include "groupwaredataadaptor.h"
-#include "kresources_groupwareprefs.h"
-
-#include <kio/job.h>
-
-#include <kdebug.h>
-#include <kconfig.h>
-#include <tqstringlist.h>
-
-using namespace KPIM;
-
-FolderLister::FolderLister( Type type )
- : mType( type ), mAdaptor( 0 )
-{
-}
-
-void FolderLister::setFolders( const FolderLister::Entry::List &folders )
-{
- mFolders = folders;
-}
-
-void FolderLister::setWriteDestinationId( KPIM::FolderLister::ContentType type, const TQString &id )
-{
- mWriteDestinationId[ type ] = id;
-}
-
-TQString FolderLister::writeDestinationId( KPIM::FolderLister::ContentType type ) const
-{
- if ( mWriteDestinationId.contains( type ) ) {
- return mWriteDestinationId[type];
- } else if ( mWriteDestinationId.contains( KPIM::FolderLister::All ) ) {
- return mWriteDestinationId[ KPIM::FolderLister::All ];
- } else if ( mWriteDestinationId.contains( KPIM::FolderLister::Unknown ) ) {
- return mWriteDestinationId[ KPIM::FolderLister::Unknown ];
- } else return TQString();
-}
-
-
-KURL::List FolderLister::activeFolderIds() const
-{
- KURL::List ids;
-
- FolderLister::Entry::List::ConstIterator it;
- for( it = mFolders.begin(); it != mFolders.end(); ++it ) {
- if ( (*it).active ) {
- ids.append( KURL((*it).id) );
- }
- }
-
- return ids;
-}
-
-bool FolderLister::isActive( const TQString &id ) const
-{
- FolderLister::Entry::List::ConstIterator it;
- for( it = mFolders.begin(); it != mFolders.end(); ++it ) {
- if ( (*it).id == id ) return (*it).active;
- }
- return false;
-}
-
-TQStringList FolderLister::contentTypeToStrings( ContentType type )
-{
-kdDebug() << "FolderLister::contentTypeToStrings( type=" << type << ")" << endl;
- TQStringList cont;
- if ( type == All ) {
- cont << "All";
- } else if ( type == Unknown ) {
- cont << "Unknown";
- } else {
- if ( type & Contact ) cont << "Contact";
- if ( type & Event ) cont << "Event";
- if ( type & Todo ) cont << "Todo";
- if ( type & Journal ) cont << "Journal";
- if ( type & Message ) cont << "Message";
- if ( type & Memo ) cont << "Memo";
- if ( type & Folder ) cont << "Folder";
- }
- return cont;
-}
-
-FolderLister::ContentType FolderLister::contentTypeFromString( const TQString &type )
-{
- if ( type == "All" ) return All;
- if ( type == "Contact" ) return Contact;
- if ( type == "Event" ) return Event;
- if ( type == "Todo" ) return Todo;
- if ( type == "Journal" ) return Journal;
- if ( type == "Message" ) return Message;
- if ( type == "Memo" ) return Memo;
- if ( type == "Folder" ) return Folder;
- return Unknown;
-}
-
-TQValueList<FolderLister::ContentType> FolderLister::supportedTypes()
-{
- if ( adaptor() ) {
- return adaptor()->supportedTypes();
- } else {
- return TQValueList<ContentType>();
- }
-}
-
-
-
-void FolderLister::readConfig( KPIM::GroupwarePrefsBase *newprefs )
-{
- kdDebug(7000) << "FolderLister::readConfig()" << endl;
- mFolders.clear();
-
- TQStringList active = newprefs->activeFolders();
- int nr = newprefs->folderNumber();
-
- for ( int i=0; i<nr; ++i ) {
- TQStringList l( newprefs->folder( i ) );
-// TQStringList l( cfgg.readListEntry( TQString("Folder%1").arg( i ) ) );
- Entry e;
- if ( l.count()>0 ) {
- e.id = l.first();
- l.pop_front();
- }
- if ( l.count()>1 ) {
- e.name = l.first();
- l.pop_front();
- }
- e.type = Unknown;
- for ( TQStringList::Iterator it = l.begin(); it != l.end(); ++it ) {
- e.type = (FolderLister::ContentType)( e.type | contentTypeFromString( *it ) );
- }
- if ( active.find( e.id ) != active.end() ) e.active = true;
- mFolders.append( e );
- }
-
- TQStringList destinations( newprefs->defaultDestinations() );
-
- #define readDestination(type) \
- if ( destinations.count()>0 ) { \
- mWriteDestinationId[ type ] = destinations.first(); \
- destinations.pop_front(); \
- }
- readDestination( FolderLister::Event );
- readDestination( FolderLister::Todo );
- readDestination( FolderLister::Journal );
- readDestination( FolderLister::Contact );
- readDestination( FolderLister::All );
- readDestination( FolderLister::Unknown );
- #undef readDestination
-}
-
-void FolderLister::writeConfig( GroupwarePrefsBase *newprefs )
-{
- TQStringList ids;
- TQStringList names;
- TQStringList active;
-
-// TDEConfigGroup cfgg( newprefs->config(), "Folders" );
- int nr = 0;
- Entry::List::ConstIterator it;
- for( it = mFolders.begin(); it != mFolders.end(); ++it ) {
- TQStringList lst;
- lst << (*it).id;
- lst << (*it).name;
- lst += contentTypeToStrings( (*it).type );
- newprefs->setFolder( nr, lst );
-// cfgg.writeEntry( TQString("Folder%1").arg( nr ), lst );
- if ( (*it).active ) active.append( (*it).id );
- nr++;
- }
- newprefs->setFolderNumber( nr );
-
- newprefs->setActiveFolders( active );
-
- TQStringList defaultFolders;
- #define writeDestination(type) \
- if ( mWriteDestinationId.contains( type ) ) \
- defaultFolders << mWriteDestinationId[type]; \
- else defaultFolders << TQString();
- writeDestination( KPIM::FolderLister::Event );
- writeDestination( KPIM::FolderLister::Todo );
- writeDestination( KPIM::FolderLister::Journal );
- writeDestination( KPIM::FolderLister::Contact );
- writeDestination( KPIM::FolderLister::All );
- writeDestination( KPIM::FolderLister::Unknown );
- #undef writeDestination
-
- newprefs->setDefaultDestinations( defaultFolders );
-}
-
-void FolderLister::setAdaptor( KPIM::GroupwareDataAdaptor *adaptor )
-{
- if ( mAdaptor ) {
- disconnect( mAdaptor, 0, this, 0 );
- }
- mAdaptor = adaptor;
- connect( mAdaptor, TQT_SIGNAL( folderInfoRetrieved( const KURL &,
- const TQString &, KPIM::FolderLister::ContentType ) ),
- this, TQT_SLOT( processFolderResult( const KURL &, const TQString &,
- KPIM::FolderLister::ContentType ) ) );
- connect( mAdaptor, TQT_SIGNAL( folderSubitemRetrieved( const KURL &, bool ) ),
- this, TQT_SLOT( folderSubitemRetrieved( const KURL &, bool ) ) );
-}
-
-void FolderLister::folderSubitemRetrieved( const KURL &url, bool isFolder )
-{
- if ( isFolder )
- doRetrieveFolder( url );
- else {
- KURL u( url ) ;
- u.setUser( TQString() );
- u.setPass( TQString() );
- mProcessedPathes.append( url.path(-1) );
- }
-}
-
-void FolderLister::retrieveFolders( const KURL &u )
-{
-kdDebug()<<"FolderLister::retrieveFolders( "<<u.url()<<" )"<<endl;
- mUrls.clear();
- mProcessedPathes.clear();
- bool firstRetrieve = mFolders.isEmpty();
- mFolders = defaultFolders();
- Entry::List::Iterator it = mFolders.begin();
-
- for ( ; it != mFolders.end(); ++it ) {
- if ( firstRetrieve ) {
- (*it).active = true;
- } else {
- (*it).active = isActive( (*it).id );
- }
- }
-
- doRetrieveFolder( u );
-}
-
-void FolderLister::doRetrieveFolder( const KURL &u )
-{
- kdDebug(7000) << "FolderLister::doRetrieveFolder: " << u.prettyURL() << endl;
-
- KURL url( u );
- if ( adaptor() ) adaptor()->adaptDownloadUrl( url );
- if ( mUrls.contains( url ) || mProcessedPathes.contains( url.path(-1) ) ) {
- kdDebug()<<"Item "<<u.path(-1)<<" is already being downloaded "<<endl;
- } else {
-
- TDEIO::Job *listjob = createListFoldersJob( url );
- if ( listjob ) {
- mUrls.append( url );
-
- kdDebug(7000) << "FolderLister::retrieveFolders: adjustedURL="
- << url.prettyURL() << endl;
- connect( listjob, TQT_SIGNAL( result( TDEIO::Job * ) ),
- TQT_SLOT( slotListJobResult( TDEIO::Job * ) ) );
- } else {
- // TODO: Indicate a problem to the user!
- kdWarning() << "Unable to create the folder list job for the url "
- << url.prettyURL() << endl;
- }
- }
- if ( mUrls.isEmpty() ) {
- kdDebug()<<"No more URLS to download, emitting foldersRead()"<<endl;
- emit foldersRead();
- }
-}
-
-FolderLister::Entry::List FolderLister::defaultFolders()
-{
- if ( adaptor() ) {
- return adaptor()->defaultFolders();
- } else {
- return Entry::List();
- }
-}
-
-void FolderLister::processFolderResult( const KURL &href,
- const TQString &displayName,
- ContentType type )
-{
-kdDebug() << "FolderLister::processFolderResult( href=" << href.url() << ", displayName=" << displayName << ", type=" << int(type) << endl;
- if ( ( mType == Calendar && ( type & ( Event | Todo |Journal) ) ) ||
- ( mType == AddressBook && (type & Contact ) ) ) {
-
- if ( !href.isEmpty() && !displayName.isEmpty() ) {
- Entry entry;
- entry.id = href.url();
- entry.name = displayName;
- entry.type = type;
- entry.active = isActive( entry.id );
-
- mFolders.append( entry );
- }
- kdDebug(7000) << "FOLDER: " << displayName << endl;
-kdDebug()<<"mFolders.size="<<mFolders.size()<<endl;
- } else {
-kdDebug() << "Folder "<< href << " is not of correct type ("<<type<<")"<<endl;
- }
-}
-
-void FolderLister::slotListJobResult( TDEIO::Job *job )
-{
- kdDebug(7000) << "OpenGroupware::slotListJobResult(): " << endl;
- kdDebug() << "URLS (" << mUrls.count() << "): " << mUrls.toStringList().join(" | ") << endl;
- kdDebug() << "Processed URLS (" << mProcessedPathes.count() << "): "
- << mProcessedPathes.join(" | ") << endl;
- TDEIO::SimpleJob *j = dynamic_cast<TDEIO::SimpleJob*>(job);
- if ( j ) {
- mUrls.remove( j->url() );
- mProcessedPathes.append( j->url().path(-1) );
- }
-
- if ( job->error() ) {
- kdError() << "Unable to retrieve folders." << endl;
- } else {
- interpretListFoldersJob( job );
- }
- kdDebug() << "After URLS (" << mUrls.count() << "): "
- << mUrls.toStringList().join(" | ") << endl;
- kdDebug() << "After Processed URLS (" << mProcessedPathes.count() << "): "
- << mProcessedPathes.join(" | ") << endl;
- if ( mUrls.isEmpty() ) {
- kdDebug()<<"No more URLS to download, emitting foldersRead()"<<endl;
- emit foldersRead();
- }
-}
-
-void FolderLister::interpretListFoldersJob( TDEIO::Job *job )
-{
- if ( adaptor() ) {
- adaptor()->interpretListFoldersJob( job, this );
- } else {
- // TODO: Error handling should show a message to the user!
- kdError() << "The FolderLister does not have a GroupwareDataAdaptor, so "
- "it cannot interpret the response!" << endl;
- }
-}
-
-TDEIO::Job *FolderLister::createListFoldersJob( const KURL &url )
-{
- if ( adaptor() ) {
- return adaptor()->createListFoldersJob( url );
- } else {
- // TODO: Error handling should show a message to the user!
- kdError() << "The FolderLister does not have a GroupwareDataAdaptor, so "
- "it cannot create the job for the folder list!" << endl;
- return 0;
- }
-}
-
-#include "folderlister.moc"
diff --git a/kresources/lib/folderlister.h b/kresources/lib/folderlister.h
deleted file mode 100644
index 8248ec22a..000000000
--- a/kresources/lib/folderlister.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- This file is part of libkcal.
-
- Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
- Copyright (c) 2004 Till Adam <adam@kde.org>
- Copyright (c) 2004 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 KPIM_FOLDERLISTER_H
-#define KPIM_FOLDERLISTER_H
-
-// #include "kresources_groupwareprefs.h"
-/*#include "groupwareresourcejob.h"*/
-#include <kurl.h>
-#include <tdepimmacros.h>
-
-#include <tqvaluelist.h>
-#include <tqstring.h>
-#include <tqstringlist.h>
-#include <tqobject.h>
-
-namespace TDEIO {
-class Job;
-}
-
-class TDEConfig;
-
-namespace KPIM {
-
-class GroupwareDataAdaptor;
-class GroupwarePrefsBase;
-
-
-class KDE_EXPORT FolderLister : public TQObject
-{
- Q_OBJECT
-
- public:
- enum Type { AddressBook, Calendar };
- enum ContentType {
- Contact=0x1, Event=0x2, Todo=0x4, Journal=0x8,
- Message=0x10, Memo=0x20, Folder=0x40,
- Incidences=Event|Todo|Journal, All=Contact|Incidences,
- Unknown=0x000
- };
-
- class Entry
- {
- public:
- Entry() : active( false ) {}
-
- typedef TQValueList<Entry> List;
-
- TQString id;
- TQString name;
- ContentType type;
- bool active;
- };
- static TQStringList contentTypeToStrings( ContentType );
- ContentType contentTypeFromString( const TQString &type );
-
- TQValueList<ContentType> supportedTypes();
-
- FolderLister( Type );
-
- /** Initialize the retrieval with given root URL */
- virtual void retrieveFolders( const KURL & );
-
- void setFolders( const Entry::List & );
- Entry::List folders() const { return mFolders; }
-
- void setAdaptor( KPIM::GroupwareDataAdaptor *adaptor );
- GroupwareDataAdaptor* adaptor() const { return mAdaptor; }
-
- KURL::List activeFolderIds() const;
- bool isActive( const TQString &id ) const;
-
- void setWriteDestinationId( KPIM::FolderLister::ContentType type, const TQString &dest );
- TQString writeDestinationId( KPIM::FolderLister::ContentType type ) const;
-
- void readConfig( KPIM::GroupwarePrefsBase *newprefs );
- void writeConfig( KPIM::GroupwarePrefsBase *newprefs );
-
-
- signals:
- void foldersRead();
-
- protected slots:
- void slotListJobResult( TDEIO::Job * );
- /** Adds the folder with the given url and display name to the folder
- * tree (if is has an appropriate type) */
- virtual void processFolderResult( const KURL &href,
- const TQString &displayName,
- KPIM::FolderLister::ContentType type );
- /** Retrieve information about the folder u. If it has sub-folders, it
- descends into the hierarchy */
- virtual void doRetrieveFolder( const KURL &u );
- /** A subitem was detected. If it's a folder, we need to descend, otherwise
- we just add the url to the list of processed URLs. */
- void folderSubitemRetrieved( const KURL &url, bool isFolder );
-
- protected:
- /** Creates the job to retrieve information about the folder at the given
- url. It's results will be interpreted by interpretFolderResult
- */
- virtual TDEIO::Job *createListFoldersJob( const KURL &url );
- /** Interprets the results returned by the liste job (created by
- * createJob(url) ). The default implementation calls
- * interpretFolderListJob of the GroupwareDataAdaptor. Typically,
- * this adds an Entry to the mFolders list if the job describes a
- * folder of the appropriate type, by calling processsFolderResult.
- * If the folder has subfolders, just call doRetrieveFolder(url)
- * recursively. */
- virtual void interpretListFoldersJob( TDEIO::Job *job );
- /** List of folders that will always be included (subfolders won't!).
- * Usually this is not needed as you should traverse the whole folder
- * tree starting from the user's root dir. */
- virtual Entry::List defaultFolders();
- /** Type of this folder lister (i.e. AddressBook or Calendar) */
- Type getType() const { return mType; }
-
-
- protected:
- Type mType;
- KURL::List mUrls;
- TQStringList mProcessedPathes;
- Entry::List mFolders;
- GroupwareDataAdaptor *mAdaptor;
- private:
- // TODO: We need multiple destinations for Events, Tasks and Journals
- TQMap<KPIM::FolderLister::ContentType, TQString> mWriteDestinationId;
- KURL mOldURL;
-};
-
-}
-
-#endif
diff --git a/kresources/lib/folderlistview.cpp b/kresources/lib/folderlistview.cpp
deleted file mode 100644
index b29e61c9d..000000000
--- a/kresources/lib/folderlistview.cpp
+++ /dev/null
@@ -1,296 +0,0 @@
-/* This file is part of the KDE libraries
-
- Copyright (C) 2005 Reinhold Kainhofer <reinhold@kainhofer.com>
-
- Taken in large parts from the kate highlighting list view kateschema.cpp:
- Copyright (C) 2001-2003 Christoph Cullmann <cullmann@kde.org>
- Copyright (C) 2002, 2003 Anders Lund <anders.lund@lund.tdcadsl.dk>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License version 2 as published by the Free Software Foundation.
-
- 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 "folderlistview.h"
-#include "folderlister.h"
-
-#include <klistview.h>
-#include <klocale.h>
-#include <kiconloader.h>
-#include <kpopupmenu.h>
-#include <kdebug.h>
-
-#include <tqlistview.h>
-#include <tqheader.h>
-#include <tqpainter.h>
-
-static const int BoxSize = 16;
-
-
-//BEGIN FolderListView
-FolderListView::FolderListView( TQWidget *parent, const TQValueList<Property> &types )
- : KListView( parent )
-{
- setEnabledTypes( types );
-
- connect( this, TQT_SIGNAL(mouseButtonPressed(int, TQListViewItem*, const TQPoint&, int)),
- this, TQT_SLOT(slotMousePressed(int, TQListViewItem*, const TQPoint&, int)) );
- connect( this, TQT_SIGNAL(spacePressed(TQListViewItem*)),
- this, TQT_SLOT(showPopupMenu(TQListViewItem*)) );
-}
-
-void FolderListView::setEnabledTypes( const TQValueList<Property> &types )
-{
-kdDebug() << "FolderListView::setEnabledTypes" << endl;
- for ( int i = 0; i< columns(); ++i ) removeColumn( i );
- mTypes = types;
- if ( !mTypes.contains( FolderName ) ) mTypes.prepend( FolderName );
- mColumnMap[FolderName] = addColumn( i18n("Folder") );
- mTypeMap[mColumnMap[FolderName]] = FolderName;
-
-
- if ( mTypes.contains( Event ) ) {
- mColumnMap[Event] = addColumn( i18n("Short column header meaning default for new events", "Events") );
- mTypeMap[mColumnMap[Event]] = Event;
- } else mColumnMap[Event] = -1;
-
- if ( mTypes.contains( Todo ) ) {
- mColumnMap[Todo] = addColumn( i18n("Short column header meaning default for new to-dos", "Todos") );
- mTypeMap[mColumnMap[Todo]] = Todo;
- } else mColumnMap[Todo] = -1;
-
- if ( mTypes.contains( Journal ) ) {
- mColumnMap[Journal] = addColumn( i18n("Short column header meaning default for new journals", "Journals") );
- mTypeMap[mColumnMap[Journal]] = Journal;
- } else mColumnMap[Journal] = -1;
-
- if ( mTypes.contains( Contact ) ) {
- mColumnMap[Contact] = addColumn( i18n("Short column header meaning default for new contacts", "Contacts") );
- mTypeMap[mColumnMap[Contact]] = Contact;
- } else mColumnMap[Contact] = -1;
-
- if ( mTypes.contains( All ) ) {
- mColumnMap[All] = addColumn( i18n("Short column header meaning default for all items", "All") );
- mTypeMap[mColumnMap[All]] = All;
- } else mColumnMap[All] = -1;
-
- if ( mTypes.contains( Unknown ) ) {
- mColumnMap[Unknown] = addColumn( i18n("Short column header meaning default for unknown new items", "Unknown") );
- mTypeMap[mColumnMap[Unknown]] = Unknown;
- } else mColumnMap[Unknown] = -1;
-}
-
-void FolderListView::showPopupMenu( FolderListItem *i, const TQPoint &globalPos )
-{
- if ( !i ) return;
- KPIM::FolderLister::Entry folder( i->folder() );
-
- KPopupMenu m( this );
- int id;
-
- m.insertTitle( folder.name, 9999 );
- id = m.insertItem( i18n("&Enabled"), this, TQT_SLOT(slotPopupHandler(int)), 0, FolderName );
- m.setItemChecked( id, i->isOn() );
- m.insertSeparator();
-
- if ( ( folder.type & KPIM::FolderLister::Event ) && (mTypes.contains( Event ) ) ) {
- id = m.insertItem( i18n("Default for New &Events"), this, TQT_SLOT(slotPopupHandler(int)), 0, Event );
- m.setItemChecked( id, i->isDefault( Event ) );
- }
- if ( ( folder.type & KPIM::FolderLister::Todo ) && (mTypes.contains( Todo ) ) ) {
- id = m.insertItem( i18n("Default for New &Todos"), this, TQT_SLOT(slotPopupHandler(int)), 0, Todo );
- m.setItemChecked( id, i->isDefault( Todo ) );
- }
- if ( ( folder.type & KPIM::FolderLister::Journal ) && (mTypes.contains( Journal ) ) ) {
- id = m.insertItem( i18n("Default for New &Journals"), this, TQT_SLOT(slotPopupHandler(int)), 0, Journal );
- m.setItemChecked( id, i->isDefault( Journal ) );
- }
- if ( ( folder.type & KPIM::FolderLister::Contact ) && (mTypes.contains( Contact ) ) ) {
- id = m.insertItem( i18n("Default for New &Contacts"), this, TQT_SLOT(slotPopupHandler(int)), 0, Contact );
- m.setItemChecked( id, i->isDefault( Contact ) );
- }
- if ( ( folder.type == KPIM::FolderLister::All ) && (mTypes.contains( All ) ) ) {
- id = m.insertItem( i18n("Default for All New &Items"), this, TQT_SLOT(slotPopupHandler(int)), 0, All );
- m.setItemChecked( id, i->isDefault( All ) );
- }
- if ( ( folder.type == KPIM::FolderLister::Unknown ) && (mTypes.contains( Unknown ) ) ) {
- id = m.insertItem( i18n("Default for &Unknown New Items"), this, TQT_SLOT(slotPopupHandler(int)), 0, Unknown );
- m.setItemChecked( id, i->isDefault( Unknown ) );
- }
-
- m.exec( globalPos );
-}
-
-void FolderListView::showPopupMenu( TQListViewItem *i )
-{
- if ( dynamic_cast<FolderListItem*>(i) )
- showPopupMenu( (FolderListItem*)i, viewport()->mapToGlobal(itemRect(i).topLeft()) );
-}
-
-void FolderListView::slotPopupHandler( int z )
-{
- ((FolderListItem*)currentItem())->changeProperty( (Property)z );
-}
-
-// Because TQListViewItem::activatePos() is going to become deprecated,
-// and also because this attempt offers more control, I connect mousePressed to this.
-void FolderListView::slotMousePressed(int btn, TQListViewItem* i, const TQPoint& pos, int c)
-{
- if ( dynamic_cast<FolderListItem*>(i) ) {
- if ( btn == Qt::RightButton ) {
- showPopupMenu( (FolderListItem*)i, /*mapToGlobal(*/pos/*)*/ );
- }
- else if ( btn == Qt::LeftButton && c > 0 ) {
- // map pos to item/column and call FolderListItem::activate(col, pos)
- ((FolderListItem*)i)->activate( c, viewport()->mapFromGlobal( pos ) - TQPoint( 0, itemRect(i).top() ) );
-// } else {
-// KListView::slotMousePressed( btn, i, pos, c );
- }
- }
-}
-
-//END
-
-//BEGIN FolderListItem
-
-void FolderListItem::activate( int column, const TQPoint &localPos )
-{
- if ( !mFolderListView ) return;
- TQListView *lv = listView();
- int x = 0;
- for( int c = 0; c < column-1; c++ )
- x += lv->columnWidth( c );
- int w;
- FolderListView::Property prop( mFolderListView->typeForColumn(column) );
- switch( prop ) {
- case FolderListView::Event:
- case FolderListView::Todo:
- case FolderListView::Journal:
- case FolderListView::Contact:
- case FolderListView::All:
- case FolderListView::Unknown:
- w = BoxSize;
- break;
- default:
- return;
- }
- if ( !TQRect( x, 0, w, BoxSize ).contains( localPos ) )
- changeProperty( prop );
-}
-
-void FolderListItem::changeProperty( FolderListView::Property p )
-{
-kdDebug() << "FolderListItem::changeProperty( " << p << ")" << endl;
- if ( p == FolderListView::FolderName ) {
-kdDebug() << "it's folderName" << endl;
- setOn( !isOn() );
- } else if ( typeSupported( p ) ) {
- TQListViewItemIterator it( listView() );
- while ( it.current() ) {
- FolderListItem *item = dynamic_cast<FolderListItem*>( it.current() );
- if ( item ) {
- item->setDefault( p, item==this );
- }
- ++it;
- }
- }
- listView()->triggerUpdate();
- ((FolderListView*)listView())->emitChanged();
-}
-
-
-bool FolderListItem::typeSupported( FolderListView::Property prop )
-{
- return ( (prop==FolderListView::Event) && (mFolder.type & KPIM::FolderLister::Event) ) ||
- ( (prop==FolderListView::Todo) && (mFolder.type & KPIM::FolderLister::Todo) ) ||
- ( (prop==FolderListView::Journal)&& (mFolder.type & KPIM::FolderLister::Journal) ) ||
- ( (prop==FolderListView::Contact)&& (mFolder.type & KPIM::FolderLister::Contact) ) ||
- ( (prop==FolderListView::All) && (mFolder.type == KPIM::FolderLister::All) ) ||
- ( (prop==FolderListView::Unknown)&& (mFolder.type == KPIM::FolderLister::Unknown) );
-}
-
-bool FolderListItem::isDefault( FolderListView::Property prop )
-{
- if ( !typeSupported( prop ) || prop<0 || prop>=FolderListView::PROP_MAX ) return false;
- else return mIsDefault[ prop ];
-}
-
-void FolderListItem::setDefault( FolderListView::Property prop, bool def )
-{
- if ( prop<0 || prop>=FolderListView::PROP_MAX ) return;
- else mIsDefault[ prop ] = def;
-
-}
-
-
-void FolderListItem::paintCell( TQPainter *p, const TQColorGroup &cg, int col, int width, int align )
-{
- if ( !p ) return;
-
- TQListView *lv = listView();
- Q_ASSERT( lv ); //###
- if ( !lv ) return;
-
- // use a private color group and set the text/highlighted text colors
-// TQColorGroup mcg = lv->viewport()->colorGroup();
- FolderListView::Property prop( mFolderListView->typeForColumn(col) );
-
- if ( prop == FolderListView::FolderName ) {
- // col 0 is drawn by the superclass method
- super::paintCell( p, cg, col, width, align );
- return;
- } else {
- p->fillRect( 0, 0, width, height(), TQBrush( cg.base() ) );
- }
-
- int marg = lv->itemMargin();
- TQColor c;
-
- switch ( prop )
- {
- case FolderListView::Event:
- case FolderListView::Todo:
- case FolderListView::Journal:
- case FolderListView::Contact:
- case FolderListView::All:
- case FolderListView::Unknown:
- {
- if ( !typeSupported( prop ) ) break;
-
- int x = 0;
- int y = (height() - BoxSize) / 2;
-
- if ( isEnabled() )
- p->setPen( TQPen( cg.text(), 1 ) );
- else
- p->setPen( TQPen( lv->palette().color( TQPalette::Disabled, TQColorGroup::Text ), 1 ) );
-
- p->drawEllipse( x+marg, y+2, BoxSize-4, BoxSize-4 );
-
- if ( isDefault( prop ) ) {
- if ( isEnabled() )
- p->setBrush( cg.text() );
- else
- p->setBrush( lv->palette().color( TQPalette::Disabled, TQColorGroup::Text ) );
- p->drawEllipse( x + marg + 3, y + 5, BoxSize-10, BoxSize-10 );
- }
- break;
- }
- default:
- break;
- }
-}
-//END
-
-#include "folderlistview.moc"
-// kate: space-indent on; indent-width 2; replace-tabs on;
diff --git a/kresources/lib/folderlistview.h b/kresources/lib/folderlistview.h
deleted file mode 100644
index 32f01199b..000000000
--- a/kresources/lib/folderlistview.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/* This file is part of the KDE libraries
-
- Copyright (C) 2005 Reinhold Kainhofer <reinhold@kainhofer.com>
-
- Taken in large parts from the kate highlighting list view kateschema.h:
- Copyright (C) 2001-2003 Christoph Cullmann <cullmann@kde.org>
- Copyright (C) 2002, 2003 Anders Lund <anders.lund@lund.tdcadsl.dk>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License version 2 as published by the Free Software Foundation.
-
- 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 FOLDERLISTVIEW_H
-#define FOLDERLISTVIEW_H
-
-#include <klistview.h>
-#include "folderlister.h"
-
-class FolderListItem;
-class FolderListCaption;
-
-
-/*
- TQListView that automatically adds columns for FolderListItems for selecting
- the default destination and a slot to edit the destinations using the keyboard.
-*/
-class FolderListView : public KListView
-{
- Q_OBJECT
-
-
- friend class FolderListItem;
-
- public:
- /* mainly for readability */
- enum Property { FolderName, Event, Todo, Journal, Contact, All, Unknown, PROP_MAX };
-
- FolderListView( TQWidget *parent, const TQValueList<Property> &types = TQValueList<Property>() );
- ~FolderListView() {};
-
- /* Display a popupmenu for item i at the specified global position, eventually with a title,
- promoting the context name of that item */
- void showPopupMenu( FolderListItem *i, const TQPoint &globalPos );
- void emitChanged() { emit changed(); };
- void setEnabledTypes( const TQValueList<Property> &types );
-
- int columnForType( Property prop ) const { if ( mColumnMap.contains(prop) ) return mColumnMap[prop]; else return -1;}
- Property typeForColumn( int col ) const { if ( mTypeMap.contains( col ) ) return mTypeMap[col]; else return Unknown; }
-
- private slots:
- /* Display a popupmenu for item i at item position */
- void showPopupMenu( TQListViewItem *i );
- /* call item to change a property, or display a menu */
- void slotMousePressed( int, TQListViewItem*, const TQPoint&, int );
- /* asks item to change the property in q */
- void slotPopupHandler( int z );
-
- signals:
- void changed();
- private:
- TQValueList<Property> mTypes;
- TQMap<Property,int> mColumnMap;
- TQMap<int,Property> mTypeMap;
-};
-
-/*
- TQListViewItem subclass to display/edit a folder on a groupware server.
- Selection of default destinations will be done via radio items.
-*/
-class FolderListItem : public TQCheckListItem
-{
- typedef TQCheckListItem super;
- public:
- FolderListItem( FolderListItem *parent, const KPIM::FolderLister::Entry &folder )
- : TQCheckListItem( parent, folder.name, TQCheckListItem::CheckBoxController ),
- mFolder( folder ), mFolderListView( parent?(parent->folderListView()):0 )
- {
- setOn( mFolder.active );
- }
- FolderListItem( FolderListView *listView, const KPIM::FolderLister::Entry &folder )
- : TQCheckListItem( listView, folder.name,
- TQCheckListItem::CheckBoxController ), mFolder( folder ), mFolderListView( listView )
- {
- setOn( mFolder.active );
- }
-
- KPIM::FolderLister::Entry folder() const
- {
- return mFolder;
- }
-
- /* reimp */
-// int width ( const TQFontMetrics & fm, const TQListView * lv, int c ) const;
-
- bool typeSupported( FolderListView::Property prop );
- bool isDefault( FolderListView::Property prop );
- void setDefault( FolderListView::Property prop, bool def = true );
-
- /* calls changeProperty() if it makes sense considering pos. */
- void activate( int column, const TQPoint &localPos );
- /* Sets this item as default for property p a */
- void changeProperty( FolderListView::Property p );
-
- FolderListView *folderListView() const { return mFolderListView; }
-
- protected:
- /* reimp */
- void paintCell(TQPainter *p, const TQColorGroup& cg, int col, int width, int align);
-
- private:
- KPIM::FolderLister::Entry mFolder;
- bool mIsDefault[FolderListView::PROP_MAX];
- FolderListView *mFolderListView;
-};
-
-
-#endif
-
-// kate: space-indent on; indent-width 2; replace-tabs on;
diff --git a/kresources/lib/folderselectdialog.cpp b/kresources/lib/folderselectdialog.cpp
deleted file mode 100644
index 9d0f48a5e..000000000
--- a/kresources/lib/folderselectdialog.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- This file is part of tdepim.
-
- Copyright (c) 2008 Kevin Ottens <ervin@kde.org>
-
- 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.
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the TQt library by Trolltech AS, Norway (or with modified versions
- of TQt that use the same license as TQt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- TQt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#include "folderselectdialog.h"
-
-#include <tqlayout.h>
-#include <tqlabel.h>
-
-using namespace KPIM;
-
-FolderSelectDialog::FolderSelectDialog( const TQString& caption, const TQString& label,
- const TQStringList& list )
- : KDialogBase(0, 0, true, caption, Ok|Cancel, Ok, true)
-{
- TQFrame* frame = makeMainWidget();
- TQVBoxLayout* layout = new TQVBoxLayout( frame, 0, spacingHint() );
-
- TQLabel* labelWidget = new TQLabel( label, frame );
- layout->addWidget( labelWidget );
-
- mListBox = new KListBox( frame );
- mListBox->insertStringList( list );
- mListBox->setSelected( 0, true );
- mListBox->ensureCurrentVisible();
- layout->addWidget( mListBox, 10 );
-
- connect( mListBox, TQT_SIGNAL( doubleClicked( TQListBoxItem * ) ),
- TQT_SLOT( slotOk() ) );
- connect( mListBox, TQT_SIGNAL( returnPressed( TQListBoxItem * ) ),
- TQT_SLOT( slotOk() ) );
-
- mListBox->setFocus();
-
- layout->addStretch();
-
- setMinimumWidth( 320 );
-}
-
-TQString FolderSelectDialog::getItem( const TQString &caption, const TQString &label,
- const TQStringList& list )
-{
- FolderSelectDialog dlg( caption, label, list );
-
- TQString result;
- if ( dlg.exec() == Accepted )
- result = dlg.mListBox->currentText();
-
- return result;
-}
-
-void FolderSelectDialog::closeEvent(TQCloseEvent *event)
-{
- event->ignore();
-}
-
-void FolderSelectDialog::reject()
-{
-}
-
diff --git a/kresources/lib/folderselectdialog.h b/kresources/lib/folderselectdialog.h
deleted file mode 100644
index e33ac80a4..000000000
--- a/kresources/lib/folderselectdialog.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- This file is part of tdepim.
-
- Copyright (c) 2008 Kevin Ottens <ervin@kde.org>
-
- 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.
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the TQt library by Trolltech AS, Norway (or with modified versions
- of TQt that use the same license as TQt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- TQt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef FOLDERSELECTDIALOG_H
-#define FOLDERSELECTDIALOG_H
-
-#include <kdialogbase.h>
-
-namespace KPIM {
-
-class FolderSelectDialog : public KDialogBase
-{
-private:
- FolderSelectDialog( const TQString& caption, const TQString& label,
- const TQStringList& list );
-
-public:
- static TQString getItem( const TQString& caption, const TQString& label,
- const TQStringList& list );
-
-protected:
- virtual void closeEvent(TQCloseEvent *event);
- void reject();
-private:
- KListBox* mListBox;
-};
-
-}
-
-#endif // FOLDERSELECTDIALOG_H
diff --git a/kresources/lib/groupwaredataadaptor.cpp b/kresources/lib/groupwaredataadaptor.cpp
deleted file mode 100644
index 85dacdaa8..000000000
--- a/kresources/lib/groupwaredataadaptor.cpp
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- 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 "groupwaredataadaptor.h"
-#include <kdebug.h>
-#include <kio/job.h>
-#include <libemailfunctions/idmapper.h>
-
-using namespace KPIM;
-
-GroupwareUploadItem::GroupwareUploadItem( UploadType type ) : mItemType( KPIM::FolderLister::Unknown ), mType( type )
-{
-}
-
-KURL GroupwareUploadItem::adaptNewItemUrl( GroupwareDataAdaptor *adaptor,
- const KURL &baseurl )
-{
-kdDebug()<<"GroupwareUploadItem::adaptNewItemUrl, baseurl=" << baseurl.url() << endl;
- if ( adaptor ) {
- TQString path( adaptor->defaultNewItemName( this ) );
-kdDebug() << "path=" << path << endl;
- KURL u( baseurl );
- if ( path.isEmpty() ) return u;
- else {
- u.addPath( path );
-kdDebug() << "Final Path for new item: " << u.url() << endl;
- return u;
- }
- } else return baseurl;
-}
-
-TDEIO::TransferJob *GroupwareUploadItem::createRawUploadJob(
- GroupwareDataAdaptor *adaptor, const KURL &/*baseurl*/ )
-{
- Q_ASSERT( adaptor );
- if ( !adaptor ) return 0;
- const TQString dta = data();
- //kdDebug(7000) << "Uploading: " << data << endl;
- KURL upUrl( url() );
- if ( adaptor )
- adaptor->adaptUploadUrl( upUrl );
- kdDebug(7000) << "Uploading to: " << upUrl.prettyURL() << endl;
- TDEIO::TransferJob *job = TDEIO::storedPut( dta.utf8(), upUrl, -1, true,
- false, false );
- job->addMetaData( "PropagateHttpHeader", "true" );
- if ( adaptor ) {
- job->addMetaData( "customHTTPHeader", "Content-Type: " + adaptor->mimeType() );
- }
- return job;
-}
-
-TDEIO::TransferJob *GroupwareUploadItem::createUploadNewJob(
- GroupwareDataAdaptor *adaptor, const KURL &baseurl )
-{
-kdDebug()<<"GroupwareUploadItem::createUploadNewJob, baseurl=" << baseurl.url() << endl;
- setUrl( adaptNewItemUrl( adaptor, baseurl ) );
- TDEIO::TransferJob *job = createRawUploadJob( adaptor, baseurl );
- if ( job ) {
- kdDebug() << "Adding If-None-Match " << endl;
- TQString header;
- if ( job->outgoingMetaData().contains("customHTTPHeader") ) {
- header = job->outgoingMetaData()["customHTTPHeader"];
- header += "\r\n";
- }
- header += "If-None-Match: *";
- job->addMetaData( "customHTTPHeader", header );
- }
- return job;
-}
-
-TDEIO::TransferJob *GroupwareUploadItem::createUploadJob(
- GroupwareDataAdaptor *adaptor, const KURL &baseurl )
-{
-kdDebug()<<"GroupwareUploadItem::createUploadJob" << endl;
- TDEIO::TransferJob *job = createRawUploadJob( adaptor, baseurl );
- if ( job && adaptor ) {
- kdDebug()<<"Adding If-Match header: " << adaptor->idMapper()->fingerprint( uid() ) << endl;
- TQString header;
- if ( job->outgoingMetaData().contains("customHTTPHeader") ) {
- header = job->outgoingMetaData()["customHTTPHeader"];
- header += "\r\n";
- }
-kdDebug()<<"old HEADER: " << header << endl;
- header += "If-Match: " + adaptor->idMapper()->fingerprint( uid() );
-kdDebug()<<"new HEADER: " << header << endl;
- job->addMetaData( "customHTTPHeader", header );
- }
- return job;
-}
-
-
-GroupwareDataAdaptor::GroupwareDataAdaptor()
- : TQObject(), mFolderLister( 0 ), mIdMapper( 0 )
-{
-}
-
-GroupwareDataAdaptor::~GroupwareDataAdaptor()
-{
-}
-
-void GroupwareDataAdaptor::setUserPassword( KURL &url )
-{
- kdDebug(5800) << "GroupwareDataAdaptor::setUserPassword, mUser="
- << mUser << endl;
- url.setUser( mUser );
- url.setPass( mPassword );
-}
-
-FolderLister::Entry::List GroupwareDataAdaptor::defaultFolders()
-{
- return FolderLister::Entry::List();
-}
-
-TDEIO::TransferJob *GroupwareDataAdaptor::createUploadJob( const KURL &url,
- GroupwareUploadItem *item )
-{
- if ( item ) {
- TDEIO::TransferJob *job = item->createUploadJob( this, url );
- setUidForJob( job, item->uid() );
- return job;
- } else return 0;
-}
-
-TDEIO::TransferJob *GroupwareDataAdaptor::createUploadNewJob( const KURL &url,
- GroupwareUploadItem *item )
-{
-kdDebug()<<"GroupwareDataAdaptor::createUploadNewJob, url=" << url.url() << endl;
- if ( item ) {
- TDEIO::TransferJob *job = item->createUploadNewJob( this, url );
- setUidForJob( job, item->uid() );
- return job;
- } else return 0;
-}
-
-void GroupwareDataAdaptor::processDownloadListItem( const KURL &entry,
- const TQString &newFingerprint, KPIM::FolderLister::ContentType type )
-{
- bool download = false;
- const TQString &location = entry.path();
-
- emit itemOnServer( entry );
- // if not locally present, download
- const TQString &localId = idMapper()->localId( location );
- kdDebug(5800) << "Looking up remote: " << location
- << " found: " << localId << endl;
- if ( localId.isEmpty() || !localItemExists( localId ) ) {
- //kdDebug(7000) << "Not locally present, download: " << location << endl;
- download = true;
- } else {
- kdDebug(5800) << "Locally present " << endl;
- // locally present, let's check if it's newer than what we have
- const TQString &oldFingerprint = idMapper()->fingerprint( localId );
- if ( oldFingerprint != newFingerprint ) {
- kdDebug(5800) << "Fingerprint changed old: " << oldFingerprint <<
- " new: " << newFingerprint << endl;
- // something changed on the server, check if we also changed it locally
- if ( localItemHasChanged( localId ) ) {
- // TODO conflict resolution
- kdDebug(5800) << "TODO conflict resolution" << endl;
- download = true;
- } else {
- download = true;
- }
- } else {
- kdDebug(5800) << "Fingerprint not changed, don't download this " << endl;
- }
- }
- if ( download ) {
- emit itemToDownload( entry, type );
- }
-}
-
-bool GroupwareDataAdaptor::interpretRemoveJob( TDEIO::Job *job, const TQString &/*jobData*/ )
-{
- if ( !job ) return false;
- TDEIO::DeleteJob *deljob = dynamic_cast<TDEIO::DeleteJob*>(job);
- bool error = job->error();
- const TQString err = job->errorString();
-
- if ( deljob ) {
- KURL::List urls( deljob->urls() );
- for ( KURL::List::Iterator it = urls.begin(); it != urls.end(); ++it ) {
- if ( error ) {
- emit itemDeletionError( *it, err );
- } else {
- // FIXME: Don't use TQString() here
- emit itemDeleted( TQString(), *it );
- }
- }
- return true;
- } else {
- return false;
- }
-}
-
-
-bool GroupwareDataAdaptor::interpretUploadJob( TDEIO::Job *job, const TQString &/*jobData*/ )
-{
- kdDebug(7000) << "GroupwareDataAdaptor::interpretUploadJob " << endl;
- TDEIO::TransferJob *trfjob = dynamic_cast<TDEIO::TransferJob*>(job);
- bool error = job->error();
- const TQString err = job->errorString();
-
- if ( trfjob ) {
- KURL url( trfjob->url() );
- if ( error ) {
- emit itemUploadError( url, err );
- } else {
- // We don't know the local id here (and we don't want to extract it from
- // the idMapper, that's the task of the receiver
- emit itemUploaded( uidFromJob( job ), url );
- }
- return true;
- } else {
- return false;
- }
-}
-
-bool GroupwareDataAdaptor::interpretUploadNewJob( TDEIO::Job *job, const TQString &/*jobData*/ )
-{
-// TODO: How does the incidence mapper know the old/new ids???
- kdDebug(7000) << "GroupwareDataAdaptor::interpretUploadNewJob " << endl;
- TDEIO::TransferJob *trfjob = dynamic_cast<TDEIO::TransferJob*>(job);
- bool error = job->error();
- const TQString err = job->errorString();
-
- if ( trfjob ) {
- KURL url( trfjob->url() );
- if ( error ) {
- emit itemUploadNewError( idMapper()->localId( url.path() ), err );
- } else {
- // We don't know the local id here (and we don't want to extract it from
- // the idMapper, that's the task of the receiver
- emit itemUploadedNew( uidFromJob( job ), url );
- }
- return true;
- } else {
- return false;
- }
-}
-
-TQString GroupwareDataAdaptor::uidFromJob( TDEIO::Job *job ) const
-{
-kdDebug()<<"GroupwareDataAdaptor::uidFromJob( "<<job<<")"<<endl;
- if ( mJobUIDMap.contains( job ) ) {
- kdDebug()<<" Contained: "<< mJobUIDMap[job] << endl;
- return mJobUIDMap[ job ];
- } else {
- return TQString();
- }
-}
-
-void GroupwareDataAdaptor::setUidForJob( TDEIO::Job *job, const TQString &uid )
-{
- if ( uid.isEmpty() ) {
- mJobUIDMap.remove( job );
- } else {
- mJobUIDMap[ job ] = uid;
- }
-}
-
-
-#include "groupwaredataadaptor.moc"
diff --git a/kresources/lib/groupwaredataadaptor.h b/kresources/lib/groupwaredataadaptor.h
deleted file mode 100644
index b7bd6e333..000000000
--- a/kresources/lib/groupwaredataadaptor.h
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- 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 KPIM_GROUPWAREDATAADAPTOR_H
-#define KPIM_GROUPWAREDATAADAPTOR_H
-
-#include <groupwareresourcejob.h>
-#include <folderlister.h>
-#include <kurl.h>
-#include <tqstring.h>
-#include <libkcal/listbase.h>
-#include <tqobject.h>
-#include <tdepimmacros.h>
-
-
-namespace TDEIO {
-class TransferJob;
-class Job;
-}
-
-namespace KPIM {
-
-class FolderLister;
-class IdMapper;
-class GroupwareDataAdaptor;
-//class GroupwareJob;
-
-class KDE_EXPORT GroupwareUploadItem
-{
- public:
- typedef KCal::ListBase<GroupwareUploadItem> List;
- enum UploadType {
- Added,
- Changed,
- Deleted
- };
-
- GroupwareUploadItem( UploadType type );
- virtual ~GroupwareUploadItem() {}
- KURL url() const { return mUrl; }
- void setUrl( const KURL &url ) { mUrl = url; }
-
- TQString uid() const { return mUid; }
- void setUid( const TQString &uid ) { mUid = uid; }
-
- TQString fingerprint() const { return mFingerprint; }
- void setFingerprint( const TQString &fpr ) { mFingerprint = fpr; }
-
- virtual TQString data() const { return mData; }
- virtual void setData( const TQString &data ) { mData = data; }
- virtual KURL adaptNewItemUrl( GroupwareDataAdaptor *adaptor,
- const KURL &url );
-
- virtual TDEIO::TransferJob *createRawUploadJob(
- GroupwareDataAdaptor *adaptor, const KURL &url );
- virtual TDEIO::TransferJob *createUploadNewJob(
- GroupwareDataAdaptor *adaptor, const KURL &url );
- virtual TDEIO::TransferJob *createUploadJob( GroupwareDataAdaptor *adaptor,
- const KURL &url );
- virtual KPIM::FolderLister::ContentType itemType() { return mItemType; }
- protected:
- KPIM::FolderLister::ContentType mItemType;
- private:
- KURL mUrl;
- TQString mUid;
- TQString mData;
- TQString mFingerprint;
- UploadType mType;
-};
-
-
-class KDE_EXPORT GroupwareDataAdaptor : public TQObject
-{
-Q_OBJECT
-
- public:
- GroupwareDataAdaptor();
- virtual ~GroupwareDataAdaptor();
-
- void setFolderLister( FolderLister *folderLister )
- {
- mFolderLister = folderLister;
- }
- FolderLister *folderLister()
- {
- return mFolderLister;
- }
-
- /**
- Set progress message shown by progress manager during download. It will
- be interpreted as rich text, so it might have to be escaped.
- */
- void setDownloadProgressMessage( const TQString &v )
- {
- mDownloadProgressMessage = v;
- }
- /**
- Get download progress message. See setDownloadProgressMessage().
- */
- TQString downloadProgressMessage() const
- {
- return mDownloadProgressMessage;
- }
-
- /**
- Set progress message shown by progress manager during upload. It will
- be interpreted as rich text, so it might have to be escaped.
- */
- void setUploadProgressMessage( const TQString &v )
- {
- mUploadProgressMessage = v;
- }
- /**
- Get upload progress message. See setUploadProgressMessage().
- */
- TQString uploadProgressMessage() const
- {
- return mUploadProgressMessage;
- }
-
- /**
- Set base URL.
- */
- void setBaseURL( const KURL &url )
- {
- mBaseURL = url;
- }
- /**
- Get base URL. See setBaseURL().
- */
- KURL baseURL() const
- {
- return mBaseURL;
- }
-
- /**
- Set user name.
- */
- void setUser( const TQString &v )
- {
- mUser = v;
- }
- /**
- Get user. See setUser().
- */
- TQString user() const
- {
- return mUser;
- }
-
- /**
- Set password of user.
- */
- void setPassword( const TQString &v )
- {
- mPassword = v;
- }
- /**
- Get password. See setPassword().
- */
- TQString password() const
- {
- return mPassword;
- }
-
- /**
- Set id mapper.
- */
- void setIdMapper( KPIM::IdMapper *v )
- {
- mIdMapper = v;
- }
- /**
- Get idMapper. See setIdMapper().
- */
- KPIM::IdMapper *idMapper() const
- {
- return mIdMapper;
- }
-
- void setUserPassword( KURL &url );
-
- /** Adapt the url for downloading. Sets the username and password and calls
- * customAdaptDownloadUrl, which you can reimplement for custom adaptions.
- */
- virtual void adaptDownloadUrl( KURL &url )
- {
- setUserPassword( url );
- customAdaptDownloadUrl( url );
- }
- /** Adapt the url for uploading. Sets the username and password and calls
- * customAdaptUploadUrl, which you can reimplement for custom adaptions. */
- virtual void adaptUploadUrl( KURL &url )
- {
- setUserPassword( url );
- customAdaptUploadUrl( url );
- }
- /** Apply custom adaptions to the url for downloading. Reimplement this
- * method if you want to use webdav:// instead of http:// URLs. */
- virtual void customAdaptDownloadUrl( KURL &/*url*/ ) {}
- /** Apply custom adaptions to the url for uploading. Reimplement this
- * method if you want to use webdav:// instead of http:// URLs. */
- virtual void customAdaptUploadUrl( KURL &/*url*/ ) {}
-
- /** Return the mime-type expected by the resource. */
- virtual TQString mimeType() const = 0;
- /** Identifier of the Resource. Used for the custom fields where
- resource-specific information is stored. */
- virtual TQCString identifier() const = 0;
-
- /** Returns whether the item with the given localId exists locally. */
- virtual bool localItemExists( const TQString &localId ) = 0;
- /** Returns whether the item was changed locally since the last download
- from the server. */
- virtual bool localItemHasChanged( const TQString &localId ) = 0;
- /** Remove the item from the local cache. */
- virtual void deleteItem( const TQString &localId ) = 0;
-
- /** Removed the changed flag for the item with the given uid. */
- virtual void clearChange( const TQString &uid ) = 0;
-
- virtual FolderLister::Entry::List defaultFolders();
- virtual TQValueList<FolderLister::ContentType> supportedTypes() = 0;
- virtual bool supports( FolderLister::ContentType type ) {
- return supportedTypes().contains( type );
- }
-
-
- // Creating jobs
- /** Creates the TDEIO::Job for logging in to the server. This is only
- * called if the GroupwareDataAdaptor::GWResNeedsLogin flag is set
- * for the resource. */
- virtual TDEIO::Job *createLoginJob( const KURL &, const TQString &/*user*/,
- const TQString &/*password*/ ) { return 0; }
- /** Creates the TDEIO::Job for logging off the server. This is only
- * called if the GroupwareDataAdaptor::GWResNeedsLogoff flag is set
- * for the resource. */
- virtual TDEIO::Job *createLogoffJob( const KURL &, const TQString &/*user*/,
- const TQString &/*password*/ ) { return 0; }
- /** Creates the TDEIO::Job for listing all subfolders of the given url. */
- virtual TDEIO::Job *createListFoldersJob ( const KURL & ) = 0;
- /** Creates the TDEIO::TransferJob for listing all items in the given url. */
- virtual TDEIO::TransferJob *createListItemsJob( const KURL & ) = 0;
- /** Creates the TDEIO::TransferJob for downloading one given item. */
- virtual TDEIO::TransferJob *createDownloadJob( const KURL &,
- FolderLister::ContentType ) = 0;
- /** Creates the TDEIO::TransferJob for downloading a list of items items. */
- virtual TDEIO::TransferJob *createDownloadJob( const TQMap<KURL,FolderLister::ContentType> & ) { return 0; }
- /** Create the job to remove the deletedItems from the server. The base
- URL of the server is passed as uploadurl. */
- virtual TDEIO::Job *createRemoveJob( const KURL &,
- const KPIM::GroupwareUploadItem::List &/*deletedItems*/ ) { return 0; }
- /** Create the job to remove the item from the server. The base
- URL of the server is passed as uploadurl. */
- virtual TDEIO::Job *createRemoveJob( const KURL &,
- KPIM::GroupwareUploadItem */*deletedItem*/ ) { return 0; }
- /** Create the job to change the item on the server (at the given URL) */
- virtual TDEIO::TransferJob *createUploadJob( const KURL &,
- GroupwareUploadItem *item );
- /** Create the job to change the items on the server (at the given URL) */
- virtual TDEIO::TransferJob *createUploadJob( const KURL &, const GroupwareUploadItem::List &/*items*/ ) { return 0; }
- /** Create the job to add the item to the server (at the given baseURL) */
- virtual TDEIO::TransferJob *createUploadNewJob( const KURL &,
- GroupwareUploadItem *item );
- /** Create the job to add the items to the server (at the given baseURL) */
- virtual TDEIO::TransferJob *createUploadNewJob( const KURL &, const GroupwareUploadItem::List &/*items*/ ) { return 0; }
-
-
- // Interpreting the result of the jobs
- /** Extract the success information from the login job, created by
- * createLoginJob. Return true, if the login was successfull, or false
- * if the user could not be authenticated or something else went wrong.
- * In that case the resource will not be marked as open. */
- virtual bool interpretLoginJobResult( TDEIO::Job * ) { return true; }
- /** Extract the success information from the logoff job, created by
- * createLogoffJob. */
- virtual bool interpretLogoffJobResult( TDEIO::Job * ) { return true; }
-
- virtual void interpretListFoldersJob( TDEIO::Job *, FolderLister *) = 0;
- /** Extract the list of items on the server and the list of items to be
- downloaded from the results of the job (the job was created by
- createListitemsJob). */
- virtual bool interpretListItemsJob( TDEIO::Job *, const TQString &jobData ) = 0;
- virtual bool interpretDownloadItemsJob( TDEIO::Job *job, const TQString &jobData ) = 0;
- virtual bool interpretRemoveJob( TDEIO::Job *job, const TQString &jobData );
- virtual bool interpretUploadJob( TDEIO::Job *job, const TQString &/*jobData*/ );
- virtual bool interpretUploadNewJob( TDEIO::Job *job, const TQString &/*jobData*/ );
-
- virtual void processDownloadListItem( const KURL &entry,
- const TQString &newFingerprint, KPIM::FolderLister::ContentType type );
- /** Return the default file name for a new item. */
- virtual TQString defaultNewItemName( GroupwareUploadItem * )
- {
- return TQString();
- }
- virtual TQString uidFromJob( TDEIO::Job *job ) const;
- virtual void setUidForJob( TDEIO::Job *job, const TQString &uid );
-
-
- enum {
- GWResBatchCreate = 0x0001,
- GWResBatchModify = 0x0002,
- GWResBatchDelete = 0x0004,
- GWResBatchRequest = 0x0008,
- GWResHandleSingleIncidences = 0x0020,
- GWResNeedsLogon = 0x0040,
- GWResNeedsLogoff = 0x0080
- };
- virtual long flags() const = 0;
-
-
- signals:
- void folderInfoRetrieved( const KURL &href, const TQString &name,
- KPIM::FolderLister::ContentType );
- void folderSubitemRetrieved( const KURL &, bool isFolder );
-
- void itemToDownload( const KURL &remoteURL, KPIM::FolderLister::ContentType type );
- /** passed the whole remote url (including hostname) to the receiver */
- void itemOnServer( const KURL &remoteURL );
-
- void itemDownloaded( const TQString &localID, const KURL &remoteURL,
- const TQString &fingerprint );
- void itemDeleted( const TQString &localID, const KURL &remoteURL );
- void itemUploaded( const TQString &localID, const KURL &remoteURL );
- void itemUploadedNew( const TQString &localID, const KURL &remoteURL );
-
- void itemDownloadError( const KURL &remoteURL, const TQString &error );
- void itemDeletionError( const KURL &remoteURL, const TQString &error );
- void itemUploadError( const KURL &remoteURL, const TQString &error );
- void itemUploadNewError( const TQString &localID, const TQString &error );
-
- private:
- FolderLister *mFolderLister;
- TQString mDownloadProgressMessage;
- TQString mUploadProgressMessage;
- KURL mBaseURL;
- TQString mUser;
- TQString mPassword;
- KPIM::IdMapper *mIdMapper;
- TQMap<TDEIO::Job*,TQString> mJobUIDMap;
-};
-
-}
-
-#endif
diff --git a/kresources/lib/groupwaredownloadjob.cpp b/kresources/lib/groupwaredownloadjob.cpp
deleted file mode 100644
index 9104da847..000000000
--- a/kresources/lib/groupwaredownloadjob.cpp
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- 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 "groupwaredownloadjob.h"
-
-#include "folderlister.h"
-#include "groupwaredataadaptor.h"
-
-#include <kdebug.h>
-#include <klocale.h>
-#include <kurl.h>
-#include <kio/job.h>
-#include <libemailfunctions/idmapper.h>
-#include <libtdepim/progressmanager.h>
-
-using namespace KPIM;
-
-GroupwareDownloadJob::GroupwareDownloadJob( GroupwareDataAdaptor *adaptor )
- : GroupwareJob( adaptor ), mProgress(0),
- mDownloadJob(0), mListEventsJob(0)
-{
-}
-
-void GroupwareDownloadJob::run()
-{
- kdDebug(5800) << "GroupwareDownloadJob::run()" << endl;
-
- if ( !adaptor() ) {
- error( i18n("Unable to initialize the download job.") );
- return;
- }
-
- if ( adaptor()->folderLister() ){
- mFoldersForDownload = adaptor()->folderLister()->activeFolderIds();
- } else {
- // TODO: If we don't have a folder lister, use the base URL (e.g. if all
- // communication goes through one script on the server
- }
-
- mItemsForDownload.clear();
- mCurrentlyOnServer.clear();
- connect( adaptor(), TQT_SIGNAL( itemToDownload( const KURL &, KPIM::FolderLister::ContentType ) ),
- TQT_SLOT( slotItemToDownload( const KURL &, KPIM::FolderLister::ContentType ) ) );
- connect( adaptor(), TQT_SIGNAL( itemOnServer( const KURL & ) ),
- TQT_SLOT( slotItemOnServer( const KURL & ) ) );
- connect( adaptor(), TQT_SIGNAL( itemDownloaded( const TQString &, const KURL &, const TQString & ) ),
- TQT_SLOT( slotItemDownloaded( const TQString &, const KURL &, const TQString & ) ) );
- connect( adaptor(), TQT_SIGNAL( itemDownloadError( const KURL &, const TQString & ) ),
- TQT_SLOT( slotItemDownloadError( const KURL &, const TQString & ) ) );
-
- mProgress = KPIM::ProgressManager::instance()->createProgressItem(
- KPIM::ProgressManager::getUniqueID(),
- adaptor()->downloadProgressMessage() );
- connect( mProgress,
- TQT_SIGNAL( progressItemCanceled( KPIM::ProgressItem * ) ),
- TQT_SLOT( cancelLoad() ) );
-
- listItems();
-}
-
-void GroupwareDownloadJob::listItems()
-{
- if ( mFoldersForDownload.isEmpty() ) {
- if ( mProgress ) {
- mProgress->setTotalItems( mItemsForDownload.count() + 1 );
- mProgress->setCompletedItems( 1 );
- mProgress->updateProgress();
- }
-
- /* Delete incidences no longer present on the server */
- deleteIncidencesGoneFromServer();
- downloadItem();
- } else {
-
- //kdDebug(7000) << "props: " << props.toString() << endl;
- KURL url = mFoldersForDownload.front();
- mFoldersForDownload.pop_front();
- kdDebug(5800) << "listItems: " << url.url() << endl;
-
- adaptor()->adaptDownloadUrl( url );
- kdDebug(5800) << "listItems, after adaptDownloadUrl: " << url.url() << endl;
-
- kdDebug(5800) << "OpenGroupware::listIncidences(): " << url << endl;
-
- mListItemsData = TQString();
- mListEventsJob = adaptor()->createListItemsJob( url );
-
- connect( mListEventsJob, TQT_SIGNAL( result( TDEIO::Job * ) ),
- TQT_SLOT( slotListItemsResult( TDEIO::Job * ) ) );
- connect( mListEventsJob, TQT_SIGNAL( data( TDEIO::Job *, const TQByteArray & ) ),
- TQT_SLOT( slotListItemsData( TDEIO::Job *, const TQByteArray & ) ) );
- }
-}
-
-
-void GroupwareDownloadJob::slotListItemsData( TDEIO::Job *, const TQByteArray &data )
-{
- kdDebug(5800) << "OpenGroupware::slotListItemsData()" << endl;
-
- mListItemsData.append( data.data() );
-}
-
-
-void GroupwareDownloadJob::slotListItemsResult( TDEIO::Job *job )
-{
- kdDebug(5800) << "GroupwareDownloadJob::slotListItemsResult(): " << endl;
-
- if ( job->error() ) {
- if ( mProgress ) {
- mProgress->setComplete();
- mProgress = 0;
- }
- error( job->errorString() );
- } else {
- adaptor()->interpretListItemsJob( job, mListItemsData );
- }
-
- mListItemsData = TQString();
- mListEventsJob = 0;
-
- listItems();
-}
-
-void GroupwareDownloadJob::deleteIncidencesGoneFromServer()
-{
- TQMap<TQString, TQString> remoteIds( adaptor()->idMapper()->remoteIdMap() );
- KURL::List::ConstIterator it = mCurrentlyOnServer.begin();
- while ( it != mCurrentlyOnServer.end() ) {
- remoteIds.remove( (*it).path() );
- ++it;
- }
- TQMap<TQString, TQString>::ConstIterator it2;
- for (it2 = remoteIds.begin(); it2 != remoteIds.end(); ++it2) {
- adaptor()->deleteItem( remoteIds[ it2.key() ] );
- }
-}
-
-void GroupwareDownloadJob::downloadItem()
-{
- kdDebug(7000) << " downloadItem " << endl;
- if ( mItemsForDownload.isEmpty() ) {
- if ( mProgress ) mProgress->setComplete();
-
- mItemsForDownload.clear();
- mItemsDownloading.clear();
- mItemsDownloaded.clear();
- mItemsDownloadError.clear();
-
- mProgress = 0;
- success();
- } else {
- if ( adaptor()->flags() & KPIM::GroupwareDataAdaptor::GWResBatchRequest ) {
- mDownloadItemsData = TQString();
- mDownloadJob = adaptor()->createDownloadJob( mItemsForDownload );
- mItemsDownloading = mItemsForDownload;
- mItemsForDownload.clear();
- } else {
- // Download the first item of the list
- TQMap<KURL,KPIM::FolderLister::ContentType>::Iterator it = mItemsForDownload.begin();
- KURL href( it.key() );
- KPIM::FolderLister::ContentType ctype = it.data();
- mItemsDownloading.insert( it.key(), it.data() );
- mItemsForDownload.remove( it.key() );
-
- adaptor()->adaptDownloadUrl( href );
- mDownloadItemsData = TQString();
-
- mDownloadJob = adaptor()->createDownloadJob( href, ctype );
- }
- connect( mDownloadJob, TQT_SIGNAL( result( TDEIO::Job * ) ),
- TQT_SLOT( slotDownloadItemResult( TDEIO::Job * ) ) );
- connect( mDownloadJob, TQT_SIGNAL( data( TDEIO::Job *, const TQByteArray & ) ),
- TQT_SLOT( slotDownloadItemData( TDEIO::Job *, const TQByteArray & ) ) );
- }
-}
-
-void GroupwareDownloadJob::slotDownloadItemResult( TDEIO::Job *job )
-{
- kdDebug(5800) << "GroupwareDownloadJob::slotDownloadItemResult(): " << endl;
-
- TDEIO::TransferJob *trfjob = dynamic_cast<TDEIO::TransferJob*>(job);
- if ( !trfjob ) return;
-
- if ( job->error() ) {
- error( job->errorString() );
- } else {
- adaptor()->interpretDownloadItemsJob( job, mDownloadItemsData );
- }
-
- if ( mProgress ) {
- mProgress->incCompletedItems();
- mProgress->updateProgress();
- }
- mDownloadItemsData = TQString();
- mDownloadJob = 0;
-
- downloadItem();
-}
-
-void GroupwareDownloadJob::slotDownloadItemData( TDEIO::Job *, const TQByteArray &data )
-{
- kdDebug(5800) << "OpenGroupware::slotDownloadItemData()" << endl;
-
- mDownloadItemsData.append( TQString::fromUtf8( data.data(), data.size() ) );
-}
-
-void GroupwareDownloadJob::slotItemToDownload( const KURL &remoteURL,
- KPIM::FolderLister::ContentType type )
-{
- KURL url( remoteURL );
- adaptor()->adaptDownloadUrl( url );
- if ( !mItemsForDownload.contains( url ) &&
- !mItemsDownloading.contains( url ) &&
- !mItemsDownloaded.contains( url ) ) {
- mItemsForDownload.insert( url, type );
- }
-}
-
-
-void GroupwareDownloadJob::slotItemOnServer( const KURL &remoteURL )
-{
-kdDebug()<<"GroupwareDownloadJob::slotItemOnServer( " << remoteURL.url() << ")" << endl;
- if ( !mCurrentlyOnServer.contains( remoteURL ) ) {
- mCurrentlyOnServer.append( remoteURL );
- }
-}
-
-
-void GroupwareDownloadJob::slotItemDownloadError( const KURL &remoteURL, const TQString &/*error*/ )
-{
- // TODO: Error handling!
- if ( mItemsDownloading.contains( remoteURL ) ) {
- mItemsDownloadError[ remoteURL ] = mItemsDownloading[ remoteURL ];
- } else if ( mItemsForDownload.contains( remoteURL ) ) {
- mItemsDownloadError[ remoteURL ] = mItemsForDownload[ remoteURL ];
- }
-}
-
-
-void GroupwareDownloadJob::slotItemDownloaded( const TQString &localID,
- const KURL &remoteURL, const TQString &fingerprint )
-{
-kdDebug()<<"GroupwareDownloadJob::slotItemDownloaded( " << localID << ", " << remoteURL.url() << ", " << fingerprint << ")" << endl;
- if ( mItemsForDownload.contains( remoteURL ) ) {
- mItemsDownloaded[ remoteURL ] = mItemsForDownload[ remoteURL ];
- mItemsForDownload.remove( remoteURL );
- }
- if ( mItemsDownloading.contains( remoteURL ) ) {
- mItemsDownloaded[ remoteURL ] = mItemsDownloading[ remoteURL ];
- mItemsDownloading.remove( remoteURL );
- }
- if ( !mItemsDownloaded.contains( remoteURL ) ) {
- mItemsDownloaded[ remoteURL ] = KPIM::FolderLister::Unknown;
- }
- adaptor()->idMapper()->setRemoteId( localID, remoteURL.path() );
- adaptor()->idMapper()->setFingerprint( localID, fingerprint );
-}
-
-
-
-void GroupwareDownloadJob::kill()
-{
- cancelLoad();
-}
-
-
-
-void GroupwareDownloadJob::cancelLoad()
-{
- if ( mDownloadJob ) mDownloadJob->kill();
- mDownloadJob = 0;
- if ( mListEventsJob ) mListEventsJob->kill();
- mListEventsJob = 0;
- if ( mProgress ) mProgress->setComplete();
-
-
- mProgress = 0;
-}
-
-#include "groupwaredownloadjob.moc"
diff --git a/kresources/lib/groupwaredownloadjob.h b/kresources/lib/groupwaredownloadjob.h
deleted file mode 100644
index 6cf3bf249..000000000
--- a/kresources/lib/groupwaredownloadjob.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- 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 KPIM_GROUPWAREDOWNLOADJOB_H
-#define KPIM_GROUPWAREDOWNLOADJOB_H
-
-#include "groupwareresourcejob.h"
-#include <tqstringlist.h>
-
-namespace TDEIO {
- class Job;
- class TransferJob;
-}
-
-namespace KPIM {
-
-class GroupwareDataAdaptor;
-class ProgressItem;
-
-/**
- This class provides a resource for accessing a Groupware calendar with local caching.
-*/
-class GroupwareDownloadJob : public GroupwareJob
-{
- Q_OBJECT
-
- public:
- GroupwareDownloadJob( GroupwareDataAdaptor *adaptor );
-
- void kill();
-
- protected:
- void listItems();
- void deleteIncidencesGoneFromServer();
- void downloadItem();
-
- protected slots:
- void run();
-
- void cancelLoad();
-
- void slotListItemsResult( TDEIO::Job * );
- void slotListItemsData( TDEIO::Job *, const TQByteArray & );
- void slotDownloadItemResult( TDEIO::Job * );
- void slotDownloadItemData( TDEIO::Job *, const TQByteArray & );
-
- void slotItemToDownload( const KURL &remoteURL,
- KPIM::FolderLister::ContentType type );
- void slotItemOnServer( const KURL &remoteURL );
- void slotItemDownloaded( const TQString &localID, const KURL &remoteURL,
- const TQString &fingerprint );
- void slotItemDownloadError( const KURL &remoteURL, const TQString &error );
-
- private:
- KURL::List mFoldersForDownload;
- /** mCurrentlyOnServer is the list of pathes of all items on the server.
- These pathes don't contain the server name! */
- KURL::List mCurrentlyOnServer;
-
- TQMap<KURL,KPIM::FolderLister::ContentType> mItemsForDownload;
- TQMap<KURL,KPIM::FolderLister::ContentType> mItemsDownloading;
- TQMap<KURL,KPIM::FolderLister::ContentType> mItemsDownloaded;
- TQMap<KURL,KPIM::FolderLister::ContentType> mItemsDownloadError;
-
- KPIM::ProgressItem *mProgress;
-
- TDEIO::TransferJob *mDownloadJob;
- TDEIO::TransferJob *mListEventsJob;
-
- TQString mListItemsData;
- TQString mDownloadItemsData;
-};
-
-}
-
-#endif
diff --git a/kresources/lib/groupwareresourcejob.cpp b/kresources/lib/groupwareresourcejob.cpp
deleted file mode 100644
index b7e4b57b0..000000000
--- a/kresources/lib/groupwareresourcejob.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- 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 "groupwareresourcejob.h"
-
-#include <tqtimer.h>
-
-using namespace KPIM;
-
-GroupwareJob::GroupwareJob( GroupwareDataAdaptor *adaptor )
- : mAdaptor( adaptor )
-{
- TQTimer::singleShot( 0, this, TQT_SLOT( run() ) );
-}
-
-bool GroupwareJob::error() const
-{
- return !mErrorString.isNull();
-}
-
-TQString GroupwareJob::errorString() const
-{
- return mErrorString;
-}
-
-void GroupwareJob::success()
-{
- mErrorString = TQString();
- emit( result( this ) );
-}
-
-void GroupwareJob::error( const TQString &errorString )
-{
- mErrorString = errorString;
- emit( result( this ) );
-}
-
-
-#include "groupwareresourcejob.moc"
diff --git a/kresources/lib/groupwareresourcejob.h b/kresources/lib/groupwareresourcejob.h
deleted file mode 100644
index f2818f2cd..000000000
--- a/kresources/lib/groupwareresourcejob.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- 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 KPIM_GROUPWAREJOB_H
-#define KPIM_GROUPWAREJOB_H
-
-#include <tqobject.h>
-#include <tqstring.h>
-#include "folderlister.h"
-
-namespace KPIM {
-
-class GroupwareDataAdaptor;
-
-/**
- This class provides a resource for accessing a Groupware kioslave-based
- calendar.
-*/
-class GroupwareJob : public TQObject
-{
- Q_OBJECT
-
- public:
- GroupwareJob( GroupwareDataAdaptor *adaptor );
-
- bool error() const;
- TQString errorString() const;
-
- virtual void kill() = 0;
-
- signals:
- void result( KPIM::GroupwareJob * );
-
- protected:
- void success();
- void error( const TQString & );
- GroupwareDataAdaptor *adaptor() { return mAdaptor; }
- const GroupwareDataAdaptor *adaptor() const { return mAdaptor; }
-
- protected slots:
- virtual void run() = 0;
-
- private:
- TQString mErrorString;
- GroupwareDataAdaptor *mAdaptor;
-};
-
-}
-
-#endif
diff --git a/kresources/lib/groupwareuploadjob.cpp b/kresources/lib/groupwareuploadjob.cpp
deleted file mode 100644
index cf46571fc..000000000
--- a/kresources/lib/groupwareuploadjob.cpp
+++ /dev/null
@@ -1,485 +0,0 @@
-/*
- 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 "groupwareuploadjob.h"
-
-#include "folderlister.h"
-#include "groupwaredataadaptor.h"
-
-#include <libemailfunctions/idmapper.h>
-#include <libtdepim/progressmanager.h>
-
-#include <kdebug.h>
-#include <kurl.h>
-#include <kio/job.h>
-
-#include <tqstringlist.h>
-#include <tqtimer.h>
-#include <klocale.h>
-
-using namespace KPIM;
-
-GroupwareUploadJob::GroupwareUploadJob( GroupwareDataAdaptor *adaptor )
- : GroupwareJob( adaptor ), mUploadJob(0),
- mDeletionJob(0), mUploadProgress(0)
-{
-}
-
-void GroupwareUploadJob::run()
-{
- deleteItem();
- mUploadProgress = KPIM::ProgressManager::instance()->createProgressItem(
- KPIM::ProgressManager::getUniqueID(),
- adaptor()->uploadProgressMessage() );
- connect( mUploadProgress,
- TQT_SIGNAL( progressItemCanceled( KPIM::ProgressItem * ) ),
- TQT_SLOT( cancelSave() ) );
-
- connect( adaptor(), TQT_SIGNAL( itemDeletionError( const KURL &, const TQString & ) ),
- TQT_SLOT( slotItemDeleteError( const KURL &, const TQString & ) ) );
- connect( adaptor(), TQT_SIGNAL( itemUploadError( const KURL &, const TQString & ) ),
- TQT_SLOT( slotItemUploadError( const KURL &, const TQString & ) ) );
- connect( adaptor(), TQT_SIGNAL( itemUploadNewError( const TQString &, const TQString & ) ),
- TQT_SLOT( slotItemUploadNewError( const TQString &, const TQString & ) ) );
-
- connect( adaptor(), TQT_SIGNAL( itemDeleted( const TQString &, const KURL & ) ),
- TQT_SLOT( slotItemDeleted( const TQString &, const KURL & ) ) );
- connect( adaptor(), TQT_SIGNAL( itemUploaded( const TQString &, const KURL & ) ),
- TQT_SLOT( slotItemUploaded( const TQString &, const KURL & ) ) );
- connect( adaptor(), TQT_SIGNAL( itemUploadedNew( const TQString &, const KURL& ) ),
- TQT_SLOT( slotItemUploadedNew( const TQString &, const KURL & ) ) );
-
-
- mUploadProgress->setTotalItems( mAddedItems.size() + mChangedItems.size() +
- ((mChangedItems.isEmpty())?0:1) );
- mUploadProgress->updateProgress();
-}
-
-
-
-void GroupwareUploadJob::deleteItem()
-{
- kdDebug(5800)<<"GroupwareUploadJob::deleteItem()"<<endl;
- if ( mDeletedItems.isEmpty() ) {
- TQTimer::singleShot( 0, this, TQT_SLOT( uploadItem() ) );
- } else {
- kdDebug(7000) << " Deleting " << mDeletedItems.size() << " items from the server " << endl;
-
- KURL url( adaptor()->baseURL() );
- adaptor()->adaptUploadUrl( url );
- if ( adaptor()->flags() & KPIM::GroupwareDataAdaptor::GWResBatchDelete ) {
-kdDebug() << "Using batch delete " << endl;
- mDeletionJob = adaptor()->createRemoveJob( url, mDeletedItems );
- mItemsUploading += mDeletedItems;
- mDeletedItems.clear();
- } else {
-kdDebug() << "Not using batch delete " << endl;
- KPIM::GroupwareUploadItem *item = mDeletedItems.front();
- mDeletionJob = adaptor()->createRemoveJob( url, item );
- mItemsUploading.append( mDeletedItems.front() );
- mDeletedItems.pop_front();
- }
-
- if ( mDeletionJob ) {
- mDeletionJobData = TQString();
- connect( mDeletionJob, TQT_SIGNAL( result( TDEIO::Job* ) ),
- TQT_SLOT( slotDeletionJobResult( TDEIO::Job* ) ) );
-// connect( mDeletionJob, TQT_SIGNAL( data( TDEIO::Job *, const TQByteArray & ) ),
-// TQT_SLOT( slotDeletionJobData( TDEIO::Job *, const TQByteArray & ) ) );
- } else {
- deleteItem();
- }
- }
-}
-
-
-
-void GroupwareUploadJob::slotDeletionJobData( TDEIO::Job *, const TQByteArray &data )
-{
- kdDebug(5800) << "OpenGroupware::slotDeletionData()" << endl;
-
- mDeletionJobData.append( data.data() );
-}
-
-
-
-void GroupwareUploadJob::slotDeletionJobResult( TDEIO::Job *job )
-{
- if ( job && adaptor() ) {
- adaptor()->interpretRemoveJob( job, mDeletionJobData );
- }
- mDeletionJob = 0;
- TQTimer::singleShot( 0, this, TQT_SLOT( deleteItem() ) );
-}
-
-
-
-void GroupwareUploadJob::uploadItem()
-{
- kdDebug(5800)<<"GroupwareUploadJob::uploadItem()"<<endl;
- if ( mChangedItems.isEmpty() ) {
- TQTimer::singleShot( 0, this, TQT_SLOT( uploadNewItem() ) );
- } else {
- kdDebug(5800)<<"We still have "<<mChangedItems.count()<<" changed items to upload"<<endl;
-
- KURL url( adaptor()->baseURL() );
- adaptor()->adaptUploadUrl( url );
- if ( adaptor()->flags() & KPIM::GroupwareDataAdaptor::GWResBatchModify ) {
-kdDebug() << "Using batch upload " << endl;
- mUploadJob = adaptor()->createUploadJob( url, mChangedItems );
- mItemsUploading += mChangedItems;
- mChangedItems.clear();
- } else {
-kdDebug() << "Not using batch upload " << endl;
- KPIM::GroupwareUploadItem *item = mChangedItems.front();
- mUploadJob = adaptor()->createUploadJob( url, item );
- mItemsUploading.append( mChangedItems.front() );
- mChangedItems.pop_front();
- }
-
- if ( mUploadJob ) {
- mUploadJobData = TQString();
- connect( mUploadJob, TQT_SIGNAL( result( TDEIO::Job* ) ),
- TQT_SLOT( slotUploadJobResult( TDEIO::Job* ) ) );
- connect( mUploadJob, TQT_SIGNAL( data( TDEIO::Job *, const TQByteArray & ) ),
- TQT_SLOT( slotUploadJobData( TDEIO::Job *, const TQByteArray & ) ) );
- } else {
- uploadItem();
- }
- }
-}
-
-
-void GroupwareUploadJob::slotUploadJobData( TDEIO::Job *, const TQByteArray &data )
-{
- kdDebug(5800) << "OpenGroupware::slotUploadData()" << endl;
-
- mUploadJobData.append( data.data() );
-}
-
-
-
-void GroupwareUploadJob::slotUploadJobResult( TDEIO::Job *job )
-{
- if ( job && adaptor() ) {
- adaptor()->interpretUploadJob( job, mUploadJobData );
- }
- mUploadJob = 0;
- TQTimer::singleShot( 0, this, TQT_SLOT( uploadItem() ) );
-}
-
-
-
-
-void GroupwareUploadJob::uploadNewItem()
-{
- kdDebug(5800)<<"GroupwareUploadJob::uploadNewItem()"<<endl;
- if ( !mAddedItems.isEmpty() ) {
-
- if ( adaptor()->flags() & KPIM::GroupwareDataAdaptor::GWResBatchCreate ) {
- KURL url( adaptor()->folderLister()->writeDestinationId( FolderLister::All ) );
- adaptor()->adaptUploadUrl( url );
-kdDebug() << "Using batch create to " << url.url() << endl;
- mUploadJob = adaptor()->createUploadNewJob( url, mAddedItems );
- mItemsUploading += mAddedItems;
- mAddedItems.clear();
- } else {
- KPIM::GroupwareUploadItem *item = mAddedItems.front();
- KURL url( adaptor()->folderLister()->writeDestinationId( item->itemType() ) );
- adaptor()->adaptUploadUrl( url );
-kdDebug() << "Not using batch create to " << url.url() << " for item of type " << item->itemType() << endl;
- if ( !url.isEmpty() ) {
- mUploadJob = adaptor()->createUploadNewJob( url, item );
- mItemsUploading.append( mAddedItems.front() );
- }
- mAddedItems.pop_front();
- }
-
- if ( mUploadJob ) {
- mUploadNewJobData = TQString();
- connect( mUploadJob, TQT_SIGNAL( result( TDEIO::Job* ) ),
- TQT_SLOT( slotUploadNewJobResult( TDEIO::Job* ) ) );
- connect( mUploadJob, TQT_SIGNAL( data( TDEIO::Job *, const TQByteArray & ) ),
- TQT_SLOT( slotUploadNewJobData( TDEIO::Job *, const TQByteArray & ) ) );
- } else {
- uploadNewItem();
- }
-
- } else {
- kdDebug(5800)<<"We are finished uploading all items. Setting progress to completed."<<endl;
- uploadCompleted();
- }
-}
-
-void GroupwareUploadJob::slotUploadNewJobData( TDEIO::Job *, const TQByteArray &data )
-{
- kdDebug(5800) << "OpenGroupware::slotUploadNewJobData()" << endl;
-
- mUploadNewJobData.append( data.data() );
-}
-
-
-
-void GroupwareUploadJob::slotUploadNewJobResult( TDEIO::Job *job )
-{
- if ( job && adaptor() ) {
- adaptor()->interpretUploadNewJob( job, mUploadNewJobData );
- }
- mUploadJob = 0;
- TQTimer::singleShot( 0, this, TQT_SLOT( uploadNewItem() ) );
-}
-
-
-void GroupwareUploadJob::kill()
-{
- cancelSave();
-}
-
-void GroupwareUploadJob::slotItemDeleted( const TQString &/*localId*/, const KURL &remoteURL )
-{
- kdDebug() << "GroupwareUploadJob::slotItemDeleted, removal successful: "<< remoteURL.url() << endl;
-
- const TQString &remote = remoteURL.path();
- const TQString &local = adaptor()->idMapper()->localId( remote );
- if ( !local.isEmpty() ) {
- // TODO: Is the deleted status reset in the resource?
- adaptor()->deleteItem( local );
- }
-
- KPIM::GroupwareUploadItem::List allit( mDeletedItems );
- allit += mItemsUploading;
- allit += mItemsUploadError;
-
- KPIM::GroupwareUploadItem::List::Iterator it = allit.begin();
- for ( ; it != allit.end(); ++it ) {
- if ( (*it)->url().path() == remoteURL.path() ) {
-kdDebug()<<"Found it in the list!"<<endl;
- KPIM::GroupwareUploadItem *item = (*it);
- mDeletedItems.remove( item );
- mItemsUploading.remove( item );
- mItemsUploadError.remove( item );
- mItemsUploaded.append( item );
- }
- }
-
- if ( mUploadProgress ) {
- mUploadProgress->incCompletedItems();
- mUploadProgress->updateProgress();
- }
-}
-
-
-
-void GroupwareUploadJob::slotItemUploaded( const TQString &/*localId*/, const KURL &remoteURL )
-{
- kdDebug() << "GroupwareUploadJob::slotItemUploaded, upload successful: "<< remoteURL.url() << endl;
-
- const TQString &remote = remoteURL.path();
- const TQString &local = adaptor()->idMapper()->localId( remote );
- if ( !local.isEmpty() ) {
- // TODO: Is the deleted status reset in the resource?
-// adaptor()->itemUploaded( local, remoteURL );
- }
-
- KPIM::GroupwareUploadItem::List allit( mChangedItems );
- allit += mAddedItems;
- allit += mItemsUploading;
- allit += mItemsUploadError;
-
-
- KPIM::GroupwareUploadItem::List::Iterator it = allit.begin();
- for ( ; it != allit.end(); ++it ) {
- if ( (*it)->url().path() == remoteURL.path() ) {
-kdDebug()<<"Found it in the list!"<<endl;
- KPIM::GroupwareUploadItem *item = (*it);
- mChangedItems.remove( item );
- mAddedItems.remove( item );
- mItemsUploading.remove( item );
- mItemsUploadError.remove( item );
- mItemsUploaded.append( item );
- }
- }
-
- if ( mUploadProgress ) {
- mUploadProgress->incCompletedItems();
- mUploadProgress->updateProgress();
- }
-}
-
-
-void GroupwareUploadJob::slotItemUploadedNew( const TQString &localId, const KURL &remoteURL )
-{
- kdDebug() << "GroupwareUploadJob::slotItemUploadedNew, upload successful: "<< remoteURL.url() << endl;
-
- const TQString &remote = remoteURL.path();
- // TODO: For a new item this won't return anything, so we need to insert the
- // local<=>remote id map when creating the upload job... And maybe
- const TQString &local = adaptor()->idMapper()->localId( remote );
- if ( !localId.isEmpty() ) {
- adaptor()->deleteItem( localId );
- }
- if ( !local.isEmpty() ) {
-// adaptor()->itemUploadedNew( local, remoteURL );
- }
-
- KPIM::GroupwareUploadItem::List allit( mChangedItems );
- allit += mAddedItems;
- allit += mItemsUploading;
- allit += mItemsUploadError;
-
-
- KPIM::GroupwareUploadItem::List::Iterator it = allit.begin();
- for ( ; it != allit.end(); ++it ) {
- if ( (*it)->url().path() == remoteURL.path() ) {
-kdDebug()<<"Found it in the list!"<<endl;
- KPIM::GroupwareUploadItem *item = (*it);
- mChangedItems.remove( item );
- mAddedItems.remove( item );
- mItemsUploading.remove( item );
- mItemsUploadError.remove( item );
- mItemsUploaded.append( item );
- }
- }
-
- if ( mUploadProgress ) {
- mUploadProgress->incCompletedItems();
- mUploadProgress->updateProgress();
- }
-}
-
-void GroupwareUploadJob::slotItemDeleteError( const KURL &remoteURL, const TQString &/*error*/ )
-{
- // TODO: Add to error list, remove from uploading and toUpload list
- kdDebug() << "GroupwareUploadJob::slotItemDeleteError, removal not successful: "<< remoteURL.url() << endl;
- KPIM::GroupwareUploadItem::List allit( mDeletedItems );
- allit += mItemsUploading;
- allit += mItemsUploaded;
-
- KPIM::GroupwareUploadItem::List::Iterator it = allit.begin();
- for ( ; it != allit.end(); ++it ) {
- if ( (*it)->url().path() == remoteURL.path() ) {
-kdDebug()<<"Found it in the list!"<<endl;
- KPIM::GroupwareUploadItem *item = (*it);
- mDeletedItems.remove( item );
- mItemsUploaded.remove( item );
- mItemsUploading.remove( item );
- mItemsUploadError.append( item );
- }
- }
-
- if ( mUploadProgress ) {
- mUploadProgress->incCompletedItems();
- mUploadProgress->updateProgress();
- }
-}
-
-void GroupwareUploadJob::slotItemUploadError( const KURL &remoteURL, const TQString &/*error*/ )
-{
- // TODO: Add to error list, remove from uploading and toUpload list
- kdDebug() << "GroupwareUploadJob::slotItemUploadError, removal not successful: "<< remoteURL.url() << endl;
- KPIM::GroupwareUploadItem::List allit( mChangedItems );
- allit += mItemsUploading;
- allit += mItemsUploaded;
-
- KPIM::GroupwareUploadItem::List::Iterator it = allit.begin();
- for ( ; it != allit.end(); ++it ) {
- if ( (*it)->url().path() == remoteURL.path() ) {
-kdDebug()<<"Found it in the list!"<<endl;
- KPIM::GroupwareUploadItem *item = (*it);
- mChangedItems.remove( item );
- mItemsUploaded.remove( item );
- mItemsUploading.remove( item );
- mItemsUploadError.append( item );
- }
- }
-
- if ( mUploadProgress ) {
- mUploadProgress->incCompletedItems();
- mUploadProgress->updateProgress();
- }
-}
-
-void GroupwareUploadJob::slotItemUploadNewError( const TQString &/*localID*/, const TQString &remoteURL )
-{
- kdDebug(5006) << "GroupwareUploadJob::slotItemUploadNewError, removal not successful: "<< remoteURL << endl;
- KPIM::GroupwareUploadItem::List allit( mAddedItems );
- allit += mItemsUploading;
- allit += mItemsUploaded;
- const KURL &url( remoteURL );
-
- KPIM::GroupwareUploadItem::List::Iterator it = allit.begin();
- for ( ; it != allit.end(); ++it ) {
- if ( (*it)->url().path() == url.path() ) {
-kdDebug()<<"Found it in the list!"<<endl;
- KPIM::GroupwareUploadItem *item = (*it);
- mAddedItems.remove( item );
- mItemsUploaded.remove( item );
- mItemsUploading.remove( item );
- mItemsUploadError.append( item );
- }
- }
-
- if ( mUploadProgress ) {
- mUploadProgress->incCompletedItems();
- mUploadProgress->updateProgress();
- }
-}
-
-
-void GroupwareUploadJob::cancelSave()
-{
- if ( mUploadJob ) mUploadJob->kill();
- mUploadJob = 0;
- if ( mUploadProgress ) mUploadProgress->setComplete();
- mUploadProgress = 0;
-}
-
-void GroupwareUploadJob::uploadCompleted()
-{
- if ( !mItemsUploadError.isEmpty() ) {
- error( i18n("1 item could not be uploaded.", "%n items could not be uploaded.", mItemsUploadError.count() ) );
- }
- KPIM::GroupwareUploadItem::List items( mAddedItems );
- items += mChangedItems;
- items += mDeletedItems;
- items += mItemsUploading;
- items += mItemsUploaded;
- items += mItemsUploadError;
-
- mAddedItems.clear();
- mChangedItems.clear();
- mDeletedItems.clear();
- mItemsUploading.clear();
- mItemsUploaded.clear();
- mItemsUploadError.clear();
- items.setAutoDelete( true );
- items.clear();
-
- if ( mUploadProgress ) {
- mUploadProgress->setComplete();
- mUploadProgress = 0;
- }
- success();
-
-}
-#include "groupwareuploadjob.moc"
diff --git a/kresources/lib/groupwareuploadjob.h b/kresources/lib/groupwareuploadjob.h
deleted file mode 100644
index b3a0ff756..000000000
--- a/kresources/lib/groupwareuploadjob.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- 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 KPIM_GROUPWAREUPLOADJOB_H
-#define KPIM_GROUPWAREUPLOADJOB_H
-
-#include "groupwareresourcejob.h"
-
-#include <kurl.h>
-#include <tqstringlist.h>
-#include <groupwaredataadaptor.h>
-
-namespace TDEIO {
- class Job;
- class TransferJob;
- class DeleteJob;
-}
-
-namespace KPIM {
-
-class GroupwareDataAdaptor;
-class ProgressItem;
-
-/**
- This class provides a resource for accessing a Groupware kioslave-based
- calendar.
-*/
-class GroupwareUploadJob : public GroupwareJob
-{
- Q_OBJECT
-
- public:
- GroupwareUploadJob( GroupwareDataAdaptor *adaptor );
-
- KPIM::GroupwareUploadItem::List addedItems() const
- {
- return mAddedItems;
- }
- void setAddedItems( const KPIM::GroupwareUploadItem::List &items )
- {
- mAddedItems = items;
- }
- KPIM::GroupwareUploadItem::List changedItems() const
- {
- return mChangedItems;
- }
- void setChangedItems( const KPIM::GroupwareUploadItem::List &items )
- {
- mChangedItems = items;
- }
- KPIM::GroupwareUploadItem::List deletedItems() const
- {
- return mDeletedItems;
- }
- void setDeletedItems( const KPIM::GroupwareUploadItem::List &items )
- {
- mDeletedItems = items;
- }
-
- void kill();
-
- protected slots:
- void deleteItem();
- void uploadItem();
- void uploadNewItem();
-
- protected slots:
- void run();
-
- void cancelSave();
-
- void slotDeletionJobResult( TDEIO::Job *job );
- void slotDeletionJobData( TDEIO::Job *, const TQByteArray & );
- void slotUploadJobResult( TDEIO::Job *job );
- void slotUploadJobData( TDEIO::Job *, const TQByteArray & );
- void slotUploadNewJobResult( TDEIO::Job *job );
- void slotUploadNewJobData( TDEIO::Job *, const TQByteArray & );
-
- void slotItemDeleted( const TQString &localID, const KURL &remoteURL );
- void slotItemUploaded( const TQString &localID, const KURL &remoteURL );
- void slotItemUploadedNew( const TQString &localID, const KURL &remoteURL );
-
- void slotItemDeleteError( const KURL &remoteURL, const TQString &error );
- void slotItemUploadError( const KURL &remoteURL, const TQString &error );
- void slotItemUploadNewError( const TQString &localID, const TQString &error );
-
- void uploadCompleted();
-
- private:
- KPIM::GroupwareUploadItem::List mAddedItems;
- KPIM::GroupwareUploadItem::List mChangedItems;
- KPIM::GroupwareUploadItem::List mDeletedItems;
-
- KPIM::GroupwareUploadItem::List mItemsUploading;
- KPIM::GroupwareUploadItem::List mItemsUploaded;
- KPIM::GroupwareUploadItem::List mItemsUploadError;
-
- TQString mDeletionJobData;
- TQString mUploadJobData;
- TQString mUploadNewJobData;
-
- TDEIO::TransferJob *mUploadJob;
- TDEIO::Job *mDeletionJob;
- KPIM::ProgressItem *mUploadProgress;
-
-};
-
-}
-
-#endif
-
-
diff --git a/kresources/lib/kabc_resourcegroupwarebase.cpp b/kresources/lib/kabc_resourcegroupwarebase.cpp
deleted file mode 100644
index 4700dd1f3..000000000
--- a/kresources/lib/kabc_resourcegroupwarebase.cpp
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- 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_resourcegroupwarebase.h"
-#include "kresources_groupwareprefs.h"
-
-#include "folderlister.h"
-#include "addressbookadaptor.h"
-#include "groupwaredownloadjob.h"
-#include "groupwareuploadjob.h"
-
-#include <kabc/addressee.h>
-#include <kabc/vcardconverter.h>
-#include <klocale.h>
-
-using namespace KABC;
-
-ResourceGroupwareBase::ResourceGroupwareBase( const TDEConfig *config )
- : ResourceCached( config ),
- mPrefs(0), mFolderLister(0), mAdaptor(0), mDownloadJob(0), mUploadJob(0)
-{
- if ( config ) readConfig( config );
-}
-
-ResourceGroupwareBase::~ResourceGroupwareBase()
-{
- delete mPrefs;
- mPrefs = 0;
-}
-
-KPIM::GroupwareDownloadJob *ResourceGroupwareBase::createDownloadJob(
- AddressBookAdaptor *adaptor )
-{
- return new KPIM::GroupwareDownloadJob( adaptor );
-}
-
-KPIM::GroupwareUploadJob *ResourceGroupwareBase::createUploadJob(
- AddressBookAdaptor *adaptor )
-{
- return new KPIM::GroupwareUploadJob( adaptor );
-}
-
-void ResourceGroupwareBase::setPrefs( KPIM::GroupwarePrefsBase *newprefs )
-{
- if ( !newprefs ) return;
- if ( mPrefs ) delete mPrefs;
- mPrefs = newprefs;
- mPrefs->addGroupPrefix( identifier() );
-
- mPrefs->readConfig();
- if ( mFolderLister ) mFolderLister->readConfig( mPrefs );
-}
-
-void ResourceGroupwareBase::setFolderLister( KPIM::FolderLister *folderLister )
-{
- if ( !folderLister ) return;
- if ( mFolderLister ) delete mFolderLister;
- mFolderLister = folderLister;
- if ( mPrefs ) mFolderLister->readConfig( mPrefs );
- if ( mAdaptor ) {
- mAdaptor->setFolderLister( mFolderLister );
- mFolderLister->setAdaptor( mAdaptor );
- }
-}
-
-void ResourceGroupwareBase::setAdaptor( AddressBookAdaptor *adaptor )
-{
- if ( !adaptor ) return;
- if ( mAdaptor ) delete mAdaptor;
- mAdaptor = adaptor;
- mAdaptor->setFolderLister( mFolderLister );
- if ( mFolderLister ) mFolderLister->setAdaptor( mAdaptor );
- mAdaptor->setDownloadProgressMessage( i18n("Downloading addressbook") );
- mAdaptor->setUploadProgressMessage( i18n("Uploading addressbook") );
- if ( prefs() ) {
- mAdaptor->setBaseURL( prefs()->url() );
- mAdaptor->setUser( prefs()->user() );
- mAdaptor->setPassword( prefs()->password() );
- }
- mAdaptor->setIdMapper( &idMapper() );
- mAdaptor->setResource( this );
-}
-
-void ResourceGroupwareBase::init()
-{
- mDownloadJob = 0;
-}
-
-KPIM::GroupwarePrefsBase *ResourceGroupwareBase::createPrefs()
-{
- return new KPIM::GroupwarePrefsBase();
-}
-
-
-
-void ResourceGroupwareBase::readConfig( const TDEConfig */*config*/ )
-{
- kdDebug(5700) << "KABC::ResourceGroupwareBase::readConfig()" << endl;
-// ResourceCached::readConfig( config );
- if ( mPrefs ) {
- mPrefs->readConfig();
- if ( mFolderLister )
- mFolderLister->readConfig( mPrefs );
- }
-}
-
-void ResourceGroupwareBase::writeConfig( TDEConfig *config )
-{
- Resource::writeConfig( config );
-
- if ( mPrefs ) {
- if ( mFolderLister )
- mFolderLister->writeConfig( mPrefs );
- mPrefs->writeConfig();
- }
-}
-
-Ticket *ResourceGroupwareBase::requestSaveTicket()
-{
- if ( !addressBook() ) {
- kdDebug(5700) << "no addressbook" << endl;
- return 0;
- }
-
- return createTicket( this );
-}
-
-void ResourceGroupwareBase::releaseSaveTicket( Ticket *ticket )
-{
- delete ticket;
-}
-
-bool ResourceGroupwareBase::doOpen()
-{
- return true;
-}
-
-void ResourceGroupwareBase::doClose()
-{
- kdDebug(5800) << "ResourceGroupwareBase::doClose()" << endl;
-
- if ( mDownloadJob ) mDownloadJob->kill();
-}
-
-bool ResourceGroupwareBase::load()
-{
- return asyncLoad();
-}
-
-bool ResourceGroupwareBase::asyncLoad()
-{
- if ( mDownloadJob ) {
- kdWarning() << "Download still in progress" << endl;
- return false;
- }
-
- mAddrMap.clear();
- loadCache();
-
- mDownloadJob = createDownloadJob( mAdaptor );
- connect( mDownloadJob, TQT_SIGNAL( result( KPIM::GroupwareJob * ) ),
- TQT_SLOT( slotDownloadJobResult( KPIM::GroupwareJob * ) ) );
-
- return true;
-}
-
-void ResourceGroupwareBase::slotDownloadJobResult( KPIM::GroupwareJob *job )
-{
- kdDebug(5800) << "ResourceGroupwareBase::slotJobResult(): " << endl;
-
- if ( job->error() ) {
- kdError() << "job failed: " << job->errorString() << endl;
- } else {
- emit loadingFinished( this );
- if ( addressBook() )
- addressBook()->emitAddressBookChanged();
- }
-
- mDownloadJob = 0;
-}
-
-bool ResourceGroupwareBase::save( Ticket *ticket )
-{
- return asyncSave( ticket );
-}
-
-bool ResourceGroupwareBase::asyncSave( Ticket* )
-{
- if ( mUploadJob ) {
- // FIXME: If the user cancels, need to reset the mUploadJob variable to 0.
- kdWarning() << "Upload still in progress." << endl;
- return false;
- }
-
- mUploadJob = createUploadJob( mAdaptor );
- connect( mUploadJob, TQT_SIGNAL( result( KPIM::GroupwareJob * ) ),
- TQT_SLOT( slotUploadJobResult( KPIM::GroupwareJob * ) ) );
-
- KABC::Addressee::List addr;
- KABC::Addressee::List::Iterator it;
- KPIM::GroupwareUploadItem::List addedItems, changedItems, deletedItems;
-
- addr = addedAddressees();
- for( it = addr.begin(); it != addr.end(); ++it ) {
- addedItems.append( adaptor()->newUploadItem( *it,
- KPIM::GroupwareUploadItem::Added ) );
- }
- // TODO: Check if the item has changed on the server...
- // In particular, check if the version we based our change on is still current
- // on the server
- addr = changedAddressees();
- for( it = addr.begin(); it != addr.end(); ++it ) {
- changedItems.append( adaptor()->newUploadItem( *it,
- KPIM::GroupwareUploadItem::Changed ) );
- }
- addr = deletedAddressees();
- for( it = addr.begin(); it != addr.end(); ++it ) {
- deletedItems.append( adaptor()->newUploadItem( *it,
- KPIM::GroupwareUploadItem::Deleted ) );
- }
-
- mUploadJob->setAddedItems( addedItems );
- mUploadJob->setChangedItems( changedItems );
- mUploadJob->setDeletedItems( deletedItems );
-
- return true;
-}
-
-void ResourceGroupwareBase::slotUploadJobResult( KPIM::GroupwareJob *job )
-{
- kdDebug(5800) << "ResourceGroupwareBase::slotJobResult(): " << endl;
-
- if ( job->error() ) {
- kdError() << "job failed: " << job->errorString() << endl;
- } else {
- // FIXME
- }
-
- mUploadJob = 0;
-}
-
-
-#include "kabc_resourcegroupwarebase.moc"
diff --git a/kresources/lib/kabc_resourcegroupwarebase.h b/kresources/lib/kabc_resourcegroupwarebase.h
deleted file mode 100644
index 28ce5199e..000000000
--- a/kresources/lib/kabc_resourcegroupwarebase.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- 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_RESOURCEGROUPWARE_H
-#define KABC_RESOURCEGROUPWARE_H
-
-#include <kurl.h>
-#include <kabcresourcecached.h>
-#include <tdepimmacros.h>
-
-class TDEConfig;
-
-namespace KPIM {
-class GroupwareJob;
-class GroupwareDownloadJob;
-class GroupwareUploadJob;
-class FolderLister;
-class GroupwarePrefsBase;
-}
-
-namespace KABC {
-
-class AddressBookAdaptor;
-
-class KDE_EXPORT ResourceGroupwareBase : public ResourceCached
-{
- Q_OBJECT
-
-
- public:
- ResourceGroupwareBase( const TDEConfig * );
- ~ResourceGroupwareBase();
-
- void readConfig( const TDEConfig * );
- void writeConfig( TDEConfig * );
-
- KPIM::GroupwarePrefsBase *prefs() const { return mPrefs; }
- void setPrefs( KPIM::GroupwarePrefsBase *prefs );
-
- KPIM::FolderLister *folderLister() const { return mFolderLister; }
- void setFolderLister( KPIM::FolderLister *folderLister );
-
- AddressBookAdaptor *adaptor() const { return mAdaptor; }
- void setAdaptor( AddressBookAdaptor *adaptor );
-
- bool doOpen();
- void doClose();
-
- Ticket *requestSaveTicket();
- void releaseSaveTicket( Ticket* );
-
- bool load();
- bool asyncLoad();
- bool save( Ticket * );
- bool asyncSave( Ticket * );
-
- protected:
- void init();
-
- KPIM::GroupwarePrefsBase *createPrefs();
- virtual KPIM::GroupwareDownloadJob *createDownloadJob(
- AddressBookAdaptor *adaptor );
- virtual KPIM::GroupwareUploadJob *createUploadJob(
- AddressBookAdaptor *adaptor );
-
- private slots:
- void slotDownloadJobResult( KPIM::GroupwareJob * );
- void slotUploadJobResult( KPIM::GroupwareJob * );
-
- private:
- KPIM::GroupwarePrefsBase *mPrefs;
- KPIM::FolderLister *mFolderLister;
- AddressBookAdaptor *mAdaptor;
-
- KPIM::GroupwareDownloadJob *mDownloadJob;
- KPIM::GroupwareUploadJob *mUploadJob;
-};
-
-}
-
-#endif
diff --git a/kresources/lib/kabc_resourcegroupwarebaseconfig.cpp b/kresources/lib/kabc_resourcegroupwarebaseconfig.cpp
deleted file mode 100644
index 6609a3b28..000000000
--- a/kresources/lib/kabc_resourcegroupwarebaseconfig.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- 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_resourcegroupwarebaseconfig.h"
-
-#include "kabc_resourcegroupwarebase.h"
-#include "kresources_groupwareprefs.h"
-#include "folderconfig.h"
-
-#include <kdebug.h>
-#include <kdialog.h>
-#include <klocale.h>
-#include <klineedit.h>
-#include <kurlrequester.h>
-
-#include <tqlabel.h>
-#include <tqlayout.h>
-
-using namespace KABC;
-
-ResourceGroupwareBaseConfig::ResourceGroupwareBaseConfig( TQWidget* parent, const char* name )
- : KRES::ConfigWidget( parent, name )
-{
- TQGridLayout *mainLayout = new TQGridLayout( this, 7, 2, 0, KDialog::spacingHint() );
-
- TQLabel *label = new TQLabel( i18n( "URL:" ), this );
- mURL = new KURLRequester( this );
-
- mainLayout->addWidget( label, 0, 0 );
- mainLayout->addWidget( mURL, 0, 1 );
-
- label = new TQLabel( i18n( "User:" ), this );
- mUser = new KLineEdit( this );
-
- mainLayout->addWidget( label, 1, 0 );
- mainLayout->addWidget( mUser, 1, 1 );
-
- label = new TQLabel( i18n( "Password:" ), this );
- mPassword = new KLineEdit( this );
- mPassword->setEchoMode( TQLineEdit::Password );
-
- mainLayout->addWidget( label, 2, 0 );
- mainLayout->addWidget( mPassword, 2, 1 );
-
- TQFrame *hline = new TQFrame( this );
- hline->setFrameStyle( TQFrame::HLine | TQFrame::Sunken );
-
- mainLayout->addMultiCellWidget( hline, 3, 3, 0, 1 );
-
- mFolderConfig = new KPIM::FolderConfig( this );
- connect( mFolderConfig, TQT_SIGNAL( updateFoldersClicked() ),
- TQT_SLOT( updateFolders() ) );
- mainLayout->addMultiCellWidget( mFolderConfig, 4, 4, 0, 1 );
-}
-
-void ResourceGroupwareBaseConfig::loadSettings( KRES::Resource *res )
-{
- mResource = dynamic_cast<ResourceGroupwareBase*>( res );
-
- if ( !mResource ) {
- kdDebug(5700) << "ResourceGroupwareBaseConfig::loadSettings(): cast failed" << endl;
- return;
- }
-
- mURL->setURL( mResource->prefs()->url() );
- mUser->setText( mResource->prefs()->user() );
- mPassword->setText( mResource->prefs()->password() );
-
- mFolderConfig->setFolderLister( mResource->folderLister() );
- mFolderConfig->updateFolderList();
-}
-
-void ResourceGroupwareBaseConfig::saveSettings( KRES::Resource *res )
-{
- ResourceGroupwareBase *resource = dynamic_cast<ResourceGroupwareBase*>( res );
-
- if ( !resource ) {
- kdDebug(5700) << "ResourceGroupwareBaseConfig::saveSettings(): cast failed" << endl;
- return;
- }
-
- resource->prefs()->setUrl( mURL->url() );
- resource->prefs()->setUser( mUser->text() );
- resource->prefs()->setPassword( mPassword->text() );
-
- mFolderConfig->saveSettings();
-}
-
-void ResourceGroupwareBaseConfig::updateFolders()
-{
- KURL url = mURL->url();
- url.setUser( mUser->text() );
- url.setPass( mPassword->text() );
-
- mFolderConfig->retrieveFolderList( url );
-}
-
-#include "kabc_resourcegroupwarebaseconfig.moc"
diff --git a/kresources/lib/kabc_resourcegroupwarebaseconfig.h b/kresources/lib/kabc_resourcegroupwarebaseconfig.h
deleted file mode 100644
index 47a801ae2..000000000
--- a/kresources/lib/kabc_resourcegroupwarebaseconfig.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- 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_RESOURCEGROUPWAREBASECONFIG_H
-#define KABC_RESOURCEGROUPWAREBASECONFIG_H
-
-#include <kresources/configwidget.h>
-#include <tdepimmacros.h>
-
-class KLineEdit;
-class KURLRequester;
-
-namespace KPIM {
-class FolderConfig;
-}
-
-namespace KABC {
-
-class ResourceGroupwareBase;
-
-class KDE_EXPORT ResourceGroupwareBaseConfig : public KRES::ConfigWidget
-{
- Q_OBJECT
-
-
- public:
- ResourceGroupwareBaseConfig( TQWidget* parent = 0, const char* name = 0 );
-
- public slots:
- void loadSettings( KRES::Resource* );
- void saveSettings( KRES::Resource* );
-
- protected slots:
- void updateFolders();
-
- private:
- KURLRequester *mURL;
- KLineEdit *mUser;
- KLineEdit *mPassword;
- KPIM::FolderConfig *mFolderConfig;
-
- ResourceGroupwareBase *mResource;
-};
-
-}
-
-#endif
diff --git a/kresources/lib/kcal_cachesettingsdlg.cpp b/kresources/lib/kcal_cachesettingsdlg.cpp
deleted file mode 100644
index 20b48ad9e..000000000
--- a/kresources/lib/kcal_cachesettingsdlg.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- 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 "kcal_cachesettingsdlg.h"
-
-#include "kcal_resourcegroupwarebase.h"
-#include "kresources_groupwareprefs.h"
-
-#include <libkcal/resourcecachedconfig.h>
-
-#include <klocale.h>
-#include <kdebug.h>
-#include <klineedit.h>
-#include <kdialog.h>
-
-#include <tqlabel.h>
-#include <tqlayout.h>
-
-
-using namespace KCal;
-
-CacheSettingsDialog::CacheSettingsDialog( TQWidget* parent, const char* name )
- : KDialogBase( parent, name, true, i18n("Resource Cache Settings"), KDialogBase::Close )
-{
- TQWidget *mainWidget = new TQWidget( this );
- setMainWidget( mainWidget );
-
- TQGridLayout *mainLayout = new TQGridLayout( mainWidget, 2, 2 );
- mainLayout->setSpacing( KDialog::spacingHint() );
-
- mReloadConfig = new KCal::ResourceCachedReloadConfig( mainWidget );
- mainLayout->addMultiCellWidget( mReloadConfig, 1, 3, 2, 2 );
-
- mSaveConfig = new KCal::ResourceCachedSaveConfig( mainWidget );
- mainLayout->addMultiCellWidget( mSaveConfig, 4, 4, 2, 2 );
-}
-
-void CacheSettingsDialog::loadSettings( KRES::Resource *resource )
-{
- kdDebug(7000) << "KCal::CacheSettingsDialog::loadSettings()" << endl;
-
- ResourceGroupwareBase *res = static_cast<ResourceGroupwareBase *>( resource );
- if ( res ) {
- if ( !res->prefs() ) {
- kdError() << "No PREF" << endl;
- return;
- }
-
- mReloadConfig->loadSettings( res );
- mSaveConfig->loadSettings( res );
-
- } else {
- kdError(5700) << "CacheSettingsDialog::loadSettings(): "
- "no ResourceGroupwareBase, cast failed" << endl;
- }
-}
-
-void CacheSettingsDialog::saveSettings( KRES::Resource *resource )
-{
- ResourceGroupwareBase *res = static_cast<ResourceGroupwareBase*>( resource );
- if ( res ) {
- mReloadConfig->saveSettings( res );
- mSaveConfig->saveSettings( res );
- } else {
- kdError(5700) << "CacheSettingsDialog::saveSettings(): "
- "no ResourceGroupwareBase, cast failed" << endl;
- }
-}
-
-#include "kcal_cachesettingsdlg.moc"
diff --git a/kresources/lib/kcal_cachesettingsdlg.h b/kresources/lib/kcal_cachesettingsdlg.h
deleted file mode 100644
index 1a6b369ab..000000000
--- a/kresources/lib/kcal_cachesettingsdlg.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- 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 KCAL_CACHESETTINGSDLG_H
-#define KCAL_CACHESETTINGSDLG_H
-
-#include <kdialogbase.h>
-#include <tdepimmacros.h>
-
-
-namespace KRES {
-class Resource;
-}
-
-namespace KCal {
-
-class ResourceCachedReloadConfig;
-class ResourceCachedSaveConfig;
-
-/**
- Configuration widget for groupware kioslave resource.
- @see KCalOpenGroupware
-*/
-class KDE_EXPORT CacheSettingsDialog : public KDialogBase
-{
- Q_OBJECT
-
- public:
- CacheSettingsDialog( TQWidget *parent = 0, const char *name = 0 );
-
- public slots:
- virtual void loadSettings( KRES::Resource *resource );
- virtual void saveSettings( KRES::Resource *resource );
-
- private:
- KCal::ResourceCachedReloadConfig *mReloadConfig;
- KCal::ResourceCachedSaveConfig *mSaveConfig;
-};
-
-}
-
-#endif
diff --git a/kresources/lib/kcal_resourcegroupwarebase.cpp b/kresources/lib/kcal_resourcegroupwarebase.cpp
deleted file mode 100644
index 118fc6629..000000000
--- a/kresources/lib/kcal_resourcegroupwarebase.cpp
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- 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_resourcegroupwarebase.h"
-#include "kresources_groupwareprefs.h"
-
-#include "libkcal/confirmsavedialog.h"
-#include "folderlister.h"
-#include "calendaradaptor.h"
-#include "groupwaredownloadjob.h"
-#include "groupwareuploadjob.h"
-
-#include <libkcal/icalformat.h>
-#include <kio/job.h>
-#include <klocale.h>
-
-#include <tqapplication.h>
-
-using namespace KCal;
-
-ResourceGroupwareBase::ResourceGroupwareBase()
- : ResourceCached( 0 ), mPrefs(0), mFolderLister(0),
- mLock( true ), mAdaptor(0), mDownloadJob(0), mUploadJob(0)
-{
-}
-
-ResourceGroupwareBase::ResourceGroupwareBase( const TDEConfig *config )
- : ResourceCached( config ), mPrefs(0), mFolderLister(0),
- mLock( true ), mAdaptor(0), mDownloadJob(0), mUploadJob(0)
-{
- if ( config ) readConfig( config );
-}
-
-ResourceGroupwareBase::~ResourceGroupwareBase()
-{
- disableChangeNotification();
-
- delete mPrefs;
- mPrefs = 0;
-}
-
-KPIM::GroupwarePrefsBase *ResourceGroupwareBase::createPrefs()
-{
- return new KPIM::GroupwarePrefsBase();
-}
-
-
-bool ResourceGroupwareBase::addEvent( Event *event )
-{
- if ( adaptor() && ( adaptor()->supports( KPIM::FolderLister::Event ) ||
- adaptor()->supports( KPIM::FolderLister::All ) ) ) {
- return ResourceCached::addEvent( event, TQString() );
- } else return false;
-}
-
-bool ResourceGroupwareBase::addTodo( Todo *todo )
-{
- if ( adaptor() && ( adaptor()->supports( KPIM::FolderLister::Todo ) ||
- adaptor()->supports( KPIM::FolderLister::All ) ) ) {
- return ResourceCached::addTodo( todo, TQString() );
- } else return false;
-}
-
-bool ResourceGroupwareBase::addJournal( Journal *journal )
-{
- if ( adaptor() && ( adaptor()->supports( KPIM::FolderLister::Journal ) ||
- adaptor()->supports( KPIM::FolderLister::All ) ) ) {
- return ResourceCached::addJournal( journal, TQString() );
- } else return false;
-}
-
-
-KPIM::GroupwareDownloadJob *ResourceGroupwareBase::createDownloadJob(
- CalendarAdaptor *adaptor )
-{
- return new KPIM::GroupwareDownloadJob( adaptor );
-}
-
-KPIM::GroupwareUploadJob *ResourceGroupwareBase::createUploadJob(
- CalendarAdaptor *adaptor )
-{
- return new KPIM::GroupwareUploadJob( adaptor );
-}
-
-void ResourceGroupwareBase::setPrefs( KPIM::GroupwarePrefsBase *newprefs )
-{
- if ( !newprefs ) return;
- if ( mPrefs ) delete mPrefs;
- mPrefs = newprefs;
- mPrefs->addGroupPrefix( identifier() );
-
- mPrefs->readConfig();
- if ( mFolderLister ) mFolderLister->readConfig( mPrefs );
-}
-
-void ResourceGroupwareBase::setFolderLister( KPIM::FolderLister *folderLister )
-{
- if ( !folderLister ) return;
- if ( mFolderLister ) delete mFolderLister;
- mFolderLister = folderLister;
- if ( mPrefs ) mFolderLister->readConfig( mPrefs );
- if ( adaptor() ) {
- adaptor()->setFolderLister( mFolderLister );
- mFolderLister->setAdaptor( adaptor() );
- }
-}
-
-void ResourceGroupwareBase::setAdaptor( CalendarAdaptor *adaptor )
-{
- if ( !adaptor ) return;
- if ( mAdaptor ) delete mAdaptor;
- mAdaptor = adaptor;
- mAdaptor->setFolderLister( mFolderLister );
- if ( mFolderLister ) mFolderLister->setAdaptor( mAdaptor );
- // TODO: Set the prgreess status in the up/download jobs, and set
- // the resource name as the label. This should be done in the
- // up/download jobs, but these don't have access to the resource's
- // name, do they?
-/* mAdaptor->setDownloadProgressMessage( i18n("Downloading calendar") );
- mAdaptor->setUploadProgressMessage( i18n("Uploading calendar") );*/
- if ( prefs() ) {
- mAdaptor->setBaseURL( prefs()->url() );
- mAdaptor->setUser( prefs()->user() );
- mAdaptor->setPassword( prefs()->password() );
- }
- mAdaptor->setIdMapper( &idMapper() );
- mAdaptor->setResource( this );
-}
-
-void ResourceGroupwareBase::init()
-{
- mDownloadJob = 0;
- mIsShowingError = false;
-
- enableChangeNotification();
-}
-
-KPIM::GroupwarePrefsBase *ResourceGroupwareBase::prefs()
-{
- return mPrefs;
-}
-
-void ResourceGroupwareBase::readConfig( const TDEConfig *config )
-{
- kdDebug(5800) << "KCal::ResourceGroupwareBase::readConfig()" << endl;
- ResourceCached::readConfig( config );
- if ( mPrefs ) {
- mPrefs->readConfig();
- if ( mFolderLister )
- mFolderLister->readConfig( mPrefs );
- }
-}
-
-void ResourceGroupwareBase::writeConfig( TDEConfig *config )
-{
- kdDebug(5800) << "KCal::ResourceGroupwareBase::writeConfig()" << endl;
-
- ResourceCalendar::writeConfig( config );
- ResourceCached::writeConfig( config );
-
- if ( mPrefs ) {
- if ( mFolderLister )
- mFolderLister->writeConfig( mPrefs );
- mPrefs->writeConfig();
- }
-}
-
-bool ResourceGroupwareBase::doOpen()
-{
- if ( !adaptor() )
- return false;
- if ( adaptor()->flags() & KPIM::GroupwareDataAdaptor::GWResNeedsLogon ) {
- TDEIO::Job *loginJob = adaptor()->createLoginJob( prefs()->url(), prefs()->user(), prefs()->password() );
- if ( !loginJob ) {
- return false;
- } else {
- mLoginFinished = false;
- connect( loginJob, TQT_SIGNAL( result( TDEIO::Job * ) ),
- TQT_SLOT( slotLoginJobResult( TDEIO::Job* ) ) );
- enter_loop();
- return mLoginFinished;
- }
- }
- return true;
-}
-
-// BEGIN:COPIED
-// TODO: Get rid of this hack, which is copied from TDEIO::NetAccess, which is
-// LGPL'ed and
-// Copyright (C) 1997 Torben Weis (weis@kde.org)
-// Copyright (C) 1998 Matthias Ettrich (ettrich@kde.org)
-// Copyright (C) 1999 David Faure (faure@kde.org)
-// If a troll sees this, he kills me
-void tqt_enter_modal( TQWidget *widget );
-void tqt_leave_modal( TQWidget *widget );
-
-void ResourceGroupwareBase::enter_loop()
-{
- TQWidget dummy(0,0,WType_Dialog | WShowModal);
- dummy.setFocusPolicy( TQ_NoFocus );
- tqt_enter_modal(&dummy);
- tqApp->enter_loop();
- tqt_leave_modal(&dummy);
-}
-// END:COPIED
-
-void ResourceGroupwareBase::slotLoginJobResult( TDEIO::Job *job )
-{
- if ( !adaptor() ) return;
- mLoginFinished = adaptor()->interpretLoginJobResult( job );
- tqApp->exit_loop();
-}
-
-void ResourceGroupwareBase::doClose()
-{
- ResourceCached::doClose();
- if ( mDownloadJob ) mDownloadJob->kill();
-
- if ( adaptor() &&
- adaptor()->flags() & KPIM::GroupwareDataAdaptor::GWResNeedsLogoff ) {
- TDEIO::Job *logoffJob = adaptor()->createLogoffJob( prefs()->url(), prefs()->user(), prefs()->password() );
- connect( logoffJob, TQT_SIGNAL( result( TDEIO::Job * ) ),
- TQT_SLOT( slotLogoffJobResult( TDEIO::Job* ) ) );
- // TODO: Do we really need to block while waiting for the job to return?
- enter_loop();
- }
-}
-
-void ResourceGroupwareBase::slotLogoffJobResult( TDEIO::Job *job )
-{
- if ( !adaptor() ) return;
- adaptor()->interpretLogoffJobResult( job );
- // TODO: Do we really need to block while waiting for the job to return?
- tqApp->exit_loop();
-}
-
-bool ResourceGroupwareBase::doLoad()
-{
- kdDebug(5800) << "ResourceGroupwareBase::load()" << endl;
-
- if ( mIsShowingError ) {
- kdDebug(5800) << "Still showing error" << endl;
- return true;
- }
-
- if ( mDownloadJob ) {
- kdWarning() << "Download still in progress" << endl;
- return false;
- }
-
- mCalendar.close();
- clearChanges();
- disableChangeNotification();
- loadCache();
- enableChangeNotification();
- emit resourceChanged( this );
-
- mDownloadJob = createDownloadJob( adaptor() );
- connect( mDownloadJob, TQT_SIGNAL( result( KPIM::GroupwareJob * ) ),
- TQT_SLOT( slotDownloadJobResult( KPIM::GroupwareJob * ) ) );
-
- return true;
-}
-
-void ResourceGroupwareBase::slotDownloadJobResult( KPIM::GroupwareJob *job )
-{
- kdDebug(5800) << "ResourceGroupwareBase::slotJobResult(): " << endl;
-
- if ( job->error() ) {
- mIsShowingError = true;
- loadError( job->errorString() );
- mIsShowingError = false;
- } else {
- kdDebug(5800) << "Successfully downloaded data" << endl;
-
- clearChanges();
- saveCache();
- enableChangeNotification();
-
- emit resourceChanged( this );
- emit resourceLoaded( this );
- }
-
- mDownloadJob = 0;
-}
-
-bool ResourceGroupwareBase::doSave()
-{
- kdDebug(5800) << "KCal::ResourceGroupwareBase::doSave()" << endl;
-
- saveCache();
-
- if ( !hasChanges() ) {
- kdDebug(5800) << "No changes" << endl;
- return true;
- }
- // TODO: Implement confirming of single changes i.e. it should be possible
- // to upload only certain changes and discard the rest. This is
- // particularly important for resources like the blogging resource,
- // where uploading would mean a republication of the blog, not only
- // a modifications.
- if ( !confirmSave() ) return false;
-
- mUploadJob = createUploadJob( adaptor() );
- connect( mUploadJob, TQT_SIGNAL( result( KPIM::GroupwareJob * ) ),
- TQT_SLOT( slotUploadJobResult( KPIM::GroupwareJob * ) ) );
-
- Incidence::List inc;
- Incidence::List::Iterator it;
- KPIM::GroupwareUploadItem::List addedItems, changedItems, deletedItems;
-
- inc = addedIncidences();
- for( it = inc.begin(); it != inc.end(); ++it ) {
- addedItems.append( adaptor()->newUploadItem( *it,
- KPIM::GroupwareUploadItem::Added ) );
- }
- // TODO: Check if the item has changed on the server...
- // In particular, check if the version we based our change on is still current
- // on the server
- inc = changedIncidences();
- for( it = inc.begin(); it != inc.end(); ++it ) {
- changedItems.append( adaptor()->newUploadItem( *it,
- KPIM::GroupwareUploadItem::Changed ) );
- }
- inc = deletedIncidences();
- for( it = inc.begin(); it != inc.end(); ++it ) {
- deletedItems.append( adaptor()->newUploadItem( *it,
- KPIM::GroupwareUploadItem::Deleted ) );
- }
-
- mUploadJob->setAddedItems( addedItems );
- mUploadJob->setChangedItems( changedItems );
- mUploadJob->setDeletedItems( deletedItems );
-
- // FIXME: Calling clearChanges() here is not the ideal way since the
- // upload might fail, but there is no other place to call it...
- clearChanges();
- return true;
-}
-
-void ResourceGroupwareBase::slotUploadJobResult( KPIM::GroupwareJob *job )
-{
- kdDebug(5800) << "ResourceGroupwareBase::slotUploadJobResult(): " << endl;
-
- if ( job->error() ) {
- mIsShowingError = true;
- loadError( job->errorString() );
- mIsShowingError = false;
- } else {
- kdDebug(5800) << "Successfully uploaded data" << endl;
- /*
- * After the put the server might have expanded recurring events and will
- * also change the uids of the uploaded events. Remove them from the cache
- * and get the fresh delta and download.
- */
-
- if ( !mDownloadJob ) {
- mDownloadJob = createDownloadJob( adaptor() );
- connect( mDownloadJob, TQT_SIGNAL( result( KPIM::GroupwareJob * ) ),
- TQT_SLOT( slotDownloadJobResult( KPIM::GroupwareJob * ) ) );
- } else {
- kdWarning() << k_funcinfo << "Download still in progress. "
- "Can't happen. (TM)" << endl;
- }
- }
-
- mDownloadJob = 0;
-}
-
-// FIXME: Put this into ResourceCached
-bool ResourceGroupwareBase::confirmSave()
-{
- if ( !hasChanges() ) return true;
-
- ConfirmSaveDialog dlg( resourceName(), 0 );
-
- dlg.addIncidences( addedIncidences(), i18n("Added") );
- dlg.addIncidences( changedIncidences(), i18n("Changed") );
- dlg.addIncidences( deletedIncidences(), i18n("Deleted") );
-
- int result = dlg.exec();
- return result == TQDialog::Accepted;
-}
-
-KABC::Lock *ResourceGroupwareBase::lock()
-{
- return &mLock;
-}
-
-#include "kcal_resourcegroupwarebase.moc"
diff --git a/kresources/lib/kcal_resourcegroupwarebase.h b/kresources/lib/kcal_resourcegroupwarebase.h
deleted file mode 100644
index f6b46dbf7..000000000
--- a/kresources/lib/kcal_resourcegroupwarebase.h
+++ /dev/null
@@ -1,119 +0,0 @@
- /*
- 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_RESOURCEGROUPWAREBASE_H
-#define KCAL_RESOURCEGROUPWAREBASE_H
-
-#include <kurl.h>
-#include <libkcal/resourcecached.h>
-#include <tdepimmacros.h>
-#include <kabc/locknull.h>
-
-namespace TDEIO {
-class Job;
-}
-
-namespace KPIM {
-class GroupwareJob;
-class GroupwareDownloadJob;
-class GroupwareUploadJob;
-class FolderLister;
-class GroupwarePrefsBase;
-}
-
-
-namespace KCal {
-
-class CalendarAdaptor;
-
-/**
- This class provides a resource for accessing a Groupware kioslave-based
- calendar.
-*/
-class KDE_EXPORT ResourceGroupwareBase : public ResourceCached
-{
- Q_OBJECT
-
- public:
- ResourceGroupwareBase();
-
- ResourceGroupwareBase( const TDEConfig * );
- virtual ~ResourceGroupwareBase();
-
- void readConfig( const TDEConfig *config );
- void writeConfig( TDEConfig *config );
-
- KPIM::GroupwarePrefsBase *prefs();
- KPIM::FolderLister *folderLister() { return mFolderLister; }
-
- bool doOpen();
- void doClose();
-
- bool doLoad();
- bool doSave();
-
- KABC::Lock *lock();
-
- bool addEvent( Event *event );
- bool addTodo( Todo *todo );
- bool addJournal( Journal *journal );
-
- protected:
- void init();
-
- bool confirmSave();
-
- KPIM::GroupwarePrefsBase *createPrefs();
- void setPrefs( KPIM::GroupwarePrefsBase *prefs );
- void setFolderLister( KPIM::FolderLister *folderLister );
- void setAdaptor( CalendarAdaptor *adaptor );
- CalendarAdaptor *adaptor() const { return mAdaptor; }
-
- virtual KPIM::GroupwareDownloadJob *createDownloadJob( CalendarAdaptor *adaptor );
- virtual KPIM::GroupwareUploadJob *createUploadJob( CalendarAdaptor *adaptor );
-
- protected slots:
- void slotLoginJobResult( TDEIO::Job *job );
- void slotLogoffJobResult( TDEIO::Job *job );
- void slotDownloadJobResult( KPIM::GroupwareJob * );
- void slotUploadJobResult( KPIM::GroupwareJob * );
-
- private:
- void enter_loop();
-
- KPIM::GroupwarePrefsBase *mPrefs;
- KPIM::FolderLister *mFolderLister;
- KABC::LockNull mLock;
- CalendarAdaptor *mAdaptor;
-
- KPIM::GroupwareDownloadJob *mDownloadJob;
- KPIM::GroupwareUploadJob *mUploadJob;
-
- bool mIsShowingError;
-
- bool mLoginFinished; // temp variable for the login job
-
-};
-
-}
-
-#endif
diff --git a/kresources/lib/kcal_resourcegroupwarebaseconfig.cpp b/kresources/lib/kcal_resourcegroupwarebaseconfig.cpp
deleted file mode 100644
index ed8a63f92..000000000
--- a/kresources/lib/kcal_resourcegroupwarebaseconfig.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- 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 "kcal_resourcegroupwarebaseconfig.h"
-
-#include "kcal_cachesettingsdlg.h"
-#include "kcal_resourcegroupwarebase.h"
-#include "kresources_groupwareprefs.h"
-#include "folderconfig.h"
-
-#include <libkcal/resourcecachedconfig.h>
-
-#include <klocale.h>
-#include <kdebug.h>
-#include <klineedit.h>
-#include <kdialog.h>
-#include <kpushbutton.h>
-
-#include <tqlabel.h>
-#include <tqlayout.h>
-#include <tqhbox.h>
-
-
-using namespace KCal;
-
-ResourceGroupwareBaseConfig::ResourceGroupwareBaseConfig( TQWidget* parent,
- const char* name )
- : KRES::ConfigWidget( parent, name )
-{
- resize( 245, 115 );
-
- TQGridLayout *mainLayout = new TQGridLayout( this, 2, 2 );
- mainLayout->setSpacing( KDialog::spacingHint() );
-
- TQLabel *label = new TQLabel( i18n("URL:"), this );
- mainLayout->addWidget( label, 1, 0 );
- mUrl = new KLineEdit( this );
- mainLayout->addWidget( mUrl, 1, 1 );
-
- label = new TQLabel( i18n("User:"), this );
- mainLayout->addWidget( label, 2, 0 );
- mUserEdit = new KLineEdit( this );
- mainLayout->addWidget( mUserEdit, 2, 1 );
-
- label = new TQLabel( i18n("Password:"), this );
- mainLayout->addWidget( label, 3, 0 );
- mPasswordEdit = new KLineEdit( this );
- mainLayout->addWidget( mPasswordEdit, 3, 1 );
- mPasswordEdit->setEchoMode( KLineEdit::Password );
-
- mFolderConfig = new KPIM::FolderConfig( this );
- connect( mFolderConfig, TQT_SIGNAL( updateFoldersClicked() ),
- TQT_SLOT( updateFolders() ) );
- mainLayout->addMultiCellWidget( mFolderConfig, 4, 4, 0, 1 );
-
- TQHBox *hBox = new TQHBox( this );
- mCacheSettingsButton = new KPushButton( i18n("Configure Cache Settings..."), hBox );
- mainLayout->addMultiCellWidget( hBox, 5, 5, 0, 1 );
- connect( mCacheSettingsButton, TQT_SIGNAL( clicked() ),
- TQT_SLOT( showCacheSettings() ) );
-
- mCacheDialog = new CacheSettingsDialog( this );
-}
-
-void ResourceGroupwareBaseConfig::loadSettings( KRES::Resource *resource )
-{
- kdDebug(7000) << "KCal::ResourceGroupwareBaseConfig::loadSettings()" << endl;
-
- ResourceGroupwareBase *res = static_cast<ResourceGroupwareBase *>( resource );
- if ( res ) {
- if ( !res->prefs() ) {
- kdError() << "No PREF" << endl;
- return;
- }
-
- mUrl->setText( res->prefs()->url() );
- mUserEdit->setText( res->prefs()->user() );
- mPasswordEdit->setText( res->prefs()->password() );
- if ( mCacheDialog ) mCacheDialog->loadSettings( res );
-
- mFolderConfig->setFolderLister( res->folderLister() );
- mFolderConfig->updateFolderList();
- } else {
- kdError(5700) << "KCalResourceGroupwareBaseConfig::loadSettings(): "
- "no KCalOpenGroupware, cast failed" << endl;
- }
-}
-
-void ResourceGroupwareBaseConfig::saveSettings( KRES::Resource *resource )
-{
- ResourceGroupwareBase *res = static_cast<ResourceGroupwareBase*>( resource );
- if ( res ) {
- res->prefs()->setUrl( mUrl->text() );
- res->prefs()->setUser( mUserEdit->text() );
- res->prefs()->setPassword( mPasswordEdit->text() );
- if ( mCacheDialog ) mCacheDialog->saveSettings( res );
- mFolderConfig->saveSettings();
- } else {
- kdError(5700) << "KCalResourceGroupwareBaseConfig::saveSettings(): "
- "no KCalOpenGroupware, cast failed" << endl;
- }
-}
-
-void ResourceGroupwareBaseConfig::updateFolders()
-{
- KURL url = mUrl->text();
- url.setUser( mUserEdit->text() );
- url.setPass( mPasswordEdit->text() );
-
- mFolderConfig->retrieveFolderList( url );
-}
-
-void ResourceGroupwareBaseConfig::showCacheSettings()
-{
- if ( mCacheDialog ) mCacheDialog->exec();
-}
-
-#include "kcal_resourcegroupwarebaseconfig.moc"
diff --git a/kresources/lib/kcal_resourcegroupwarebaseconfig.h b/kresources/lib/kcal_resourcegroupwarebaseconfig.h
deleted file mode 100644
index e326d0d86..000000000
--- a/kresources/lib/kcal_resourcegroupwarebaseconfig.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- 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 KCAL_RESOURCEGROUPWAREBASECONFIG_H
-#define KCAL_RESOURCEGROUPWAREBASECONFIG_H
-
-#include <kresources/configwidget.h>
-#include <tdepimmacros.h>
-
-class KPushButton;
-class KLineEdit;
-
-namespace KPIM {
-class FolderConfig;
-}
-namespace KRES {
-class Resource;
-}
-
-namespace KCal {
-
-class CacheSettingsDialog;
-
-/**
- Configuration widget for groupware kioslave resource.
-
- @see KCalOpenGroupware
-*/
-class KDE_EXPORT ResourceGroupwareBaseConfig : public KRES::ConfigWidget
-{
- Q_OBJECT
-
- public:
- ResourceGroupwareBaseConfig( TQWidget *parent = 0, const char *name = 0 );
-
- public slots:
- virtual void loadSettings( KRES::Resource *resource );
- virtual void saveSettings( KRES::Resource *resource );
-
- protected slots:
- void updateFolders();
- void showCacheSettings();
-
- private:
- KLineEdit *mUrl;
- KLineEdit *mUserEdit;
- KLineEdit *mPasswordEdit;
- KPushButton *mCacheSettingsButton;
-
- CacheSettingsDialog *mCacheDialog;
- KPIM::FolderConfig *mFolderConfig;
-};
-
-}
-
-#endif
diff --git a/kresources/lib/kresources_groupwareprefs.kcfg b/kresources/lib/kresources_groupwareprefs.kcfg
deleted file mode 100644
index a56c14d90..000000000
--- a/kresources/lib/kresources_groupwareprefs.kcfg
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
- http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
- <kcfgfile name="kresources_groupwarerc"/>
- <group name="General" >
- <entry key="Url" type="String" >
- <label>Server URL</label>
- </entry>
- <entry key="User" type="String" >
- <label>User Name</label>
- </entry>
- <entry key="Password" type="String" >
- <label>Password</label>
- </entry>
- </group>
- <group name="Folders">
- <!--entry key="FolderIds" type="StringList">
- <label>All folder IDs on the server</label>
- </entry>
- <entry key="FolderNames" type="StringList">
- <label>All folder names on the server</label>
- </entry-->
- <entry key="ActiveFolders" type="StringList">
- <label>All active folders from the server</label>
- </entry>
- <entry key="FolderNumber" type="UInt">
- <label>Number of folders on the server and in the config file</label>
- </entry>
- <entry name="Folder$(nr)" type="StringList">
- <parameter name="nr" type="Int" max="100"/>
- </entry>
- <entry name="DefaultDestinations" type="StringList">
- <label>Default destinations for the various types</label>
- <whatsthis>These are the default destinations for the different data
-types in the following order:
-Event, Todo, Journal, Contact, All, Unknown</whatsthis>
-<!-- I tried using a parametrized entry using an enum, but the config
-compiler from 3.3 is severely broken in that respect... -->
-</entry>
- <!--entry name="DefaultDestination$(Type)" type="String">
- <parameter name="Type" type="Enum">
- <values>
- <value>Event</value>
- <value>Todo</value>
- <value>Journal</value>
- <value>Contact</value>
- <value>All</value>
- <value>Unknown</value>
- </values>
- </parameter>
- <default></default>
- </entry-->
- </group>
-</kcfg>
diff --git a/kresources/lib/kresources_groupwareprefs.kcfgc b/kresources/lib/kresources_groupwareprefs.kcfgc
deleted file mode 100644
index 178dc9ac5..000000000
--- a/kresources/lib/kresources_groupwareprefs.kcfgc
+++ /dev/null
@@ -1,8 +0,0 @@
-ClassName=GroupwarePrefsBase
-File=kresources_groupwareprefs.kcfg
-GlobalEnums=false
-IncludeFiles=libtdepim/kresourceprefs.h
-Inherits=KResourcePrefs
-Mutators=true
-NameSpace=KPIM
-Singleton=false
diff --git a/kresources/lib/webdavhandler.cpp b/kresources/lib/webdavhandler.cpp
deleted file mode 100644
index fea7a0b16..000000000
--- a/kresources/lib/webdavhandler.cpp
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- 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 <kdebug.h>
-
-#include <tqdatetime.h>
-
-extern "C" {
- #include <libical/ical.h>
-}
-
-
-#include "webdavhandler.h"
-
-WebdavHandler::WebdavHandler()
-{
-}
-
-
-KURL WebdavHandler::toDAV( const KURL& url )
-{
- KURL result( url );
-
- if ( result.protocol() == "http" ) {
- if ( result.port() == 443 ) {
- // OpenGroupware.org returns 'http://server:443' instead of 'https://server'
- result.setProtocol( "webdavs" );
- result.setPort( 0 );
- } else
- result.setProtocol( "webdav" );
- } else if ( result.protocol() == "https" )
- result.setProtocol( "webdavs" );
-
- return result;
-}
-
-
-
-TQDomElement WebdavHandler::addElement( TQDomDocument &doc, TQDomNode &node,
- const TQString &tag, const TQString &value )
-{
- TQDomElement el = doc.createElement( tag );
- node.appendChild( el );
- if ( !value.isNull() ) {
- TQDomText txt = doc.createTextNode( value );
- el.appendChild( txt );
- }
- return el;
-}
-
-TQDomElement WebdavHandler::addElementNS( TQDomDocument &doc, TQDomNode &node,
- const TQString &ns, const TQString &tag, const TQString &value )
-{
- TQDomElement el = doc.createElementNS( ns, tag );
- node.appendChild( el );
- if ( !value.isNull() ) {
- TQDomText txt = doc.createTextNode( value );
- el.appendChild( txt );
- }
- return el;
-}
-
-TQDomElement WebdavHandler::addDavElement( TQDomDocument &doc, TQDomNode &node,
- const TQString &tag, const TQString &value )
-{
- return addElementNS( doc, node, "DAV:", tag, value );
-}
-
-bool WebdavHandler::extractBool( const TQDomElement &node, const TQString &entry, bool &value )
-{
- TQDomElement element = node.namedItem( entry ).toElement();
- if ( !element.isNull() ) {
- value = (element.text() != "0");
- return true;
- }
- return false;
-}
-
-bool WebdavHandler::extractLong( const TQDomElement &node, const TQString &entry, long &value )
-{
- TQDomElement element = node.namedItem( entry ).toElement();
- if ( !element.isNull() ) {
- value = element.text().toLong();
- return true;
- }
- return false;
-}
-
-bool WebdavHandler::extractFloat( const TQDomElement &node, const TQString &entry, float &value )
-{
- TQDomElement element = node.namedItem( entry ).toElement();
- if ( !element.isNull() ) {
- value = element.text().toFloat();
- return true;
- }
- return false;
-}
-
-bool WebdavHandler::extractDateTime( const TQDomElement &node, const TQString &entry, TQDateTime &value )
-{
- TQDomElement element = node.namedItem( entry ).toElement();
- if ( !element.isNull() && !element.text().isEmpty() ) {
- value = TQDateTime::fromString( element.text(), Qt::ISODate );
- return true;
- }
- return false;
-}
-
-bool WebdavHandler::extractString( const TQDomElement &node, const TQString &entry, TQString &value )
-{
- TQDomElement element = node.namedItem( entry ).toElement();
- if ( !element.isNull() ) {
- value = element.text();
- return true;
- }
- return false;
-}
-
-bool WebdavHandler::extractStringList( const TQDomElement &node, const TQString &entry, TQStringList &value )
-{
- TQDomElement element = node.namedItem( entry ).toElement();
- if ( !element.isNull() ) {
- value.clear();
- TQDomNodeList list = element.elementsByTagNameNS( "xml:", "v" );
- for( uint i=0; i < list.count(); i++ ) {
- TQDomElement item = list.item(i).toElement();
- value.append( item.text() );
- }
- return true;
- }
- return false;
-}
-
-
-const TQString WebdavHandler::getEtagFromHeaders( const TQString& headers )
-{
- int start = headers.find( "etag:", 0, false );
- if ( start < 0 ) return TQString();
- start += 6;
- return headers.mid( start, headers.find( "\n", start ) - start );
-}
-
-//TODO: should not call libical functions directly -- better to make
-// a new libkcal abstraction method.
-TQDateTime WebdavHandler::utcAsZone( const TQDateTime& utc, const TQString& timeZoneId )
-{
- int daylight;
- TQDateTime epoch;
- epoch.setTime_t( 0 );
- time_t v = epoch.secsTo( utc );
- struct icaltimetype tt =
- icaltime_from_timet_with_zone( v, 0 /*is_date*/,
- icaltimezone_get_builtin_timezone( "UTC" ) );
- int offset = icaltimezone_get_utc_offset(
- icaltimezone_get_builtin_timezone( timeZoneId.latin1() ),
- &tt, &daylight );
-kdDebug() << "Calculated offset of: " << offset << " of timezone: " << timeZoneId << endl;
- return utc.addSecs( offset );
-}
-
-//TODO: should not call libical functions directly -- better to make
-// a new libkcal abstraction method.
-TQDateTime WebdavHandler::zoneAsUtc( const TQDateTime& zone, const TQString& timeZoneId )
-{
- int daylight;
- TQDateTime epoch;
- epoch.setTime_t( 0 );
- time_t v = epoch.secsTo( zone );
- struct icaltimetype tt = icaltime_from_timet( v, 0 ); // 0: is_date=false
- int offset = icaltimezone_get_utc_offset(
- icaltimezone_get_builtin_timezone( timeZoneId.latin1() ),
- &tt, &daylight );
- return zone.addSecs( - offset );
-}
diff --git a/kresources/lib/webdavhandler.h b/kresources/lib/webdavhandler.h
deleted file mode 100644
index 0bfb33e90..000000000
--- a/kresources/lib/webdavhandler.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- 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 WEBDAVHANDLER_H
-#define WEBDAVHANDLER_H
-
-#include <tqstring.h>
-#include <tqstringlist.h>
-#include <tqdom.h>
-#include <tqdatetime.h>
-#include <kurl.h>
-#include <tdepimmacros.h>
-
-class KDE_EXPORT WebdavHandler
-{
- public:
- WebdavHandler();
-
- static KURL toDAV( const KURL& url );
-
-
- static TQDomElement addElementNS( TQDomDocument &doc, TQDomNode &node,
- const TQString &ns, const TQString &tag,
- const TQString &value = TQString() );
- static TQDomElement addElement( TQDomDocument &, TQDomNode &,
- const TQString &tag, const TQString &value = TQString() );
- static TQDomElement addDavElement( TQDomDocument &, TQDomNode &,
- const TQString &tag, const TQString &value = TQString() );
-
- static bool extractBool( const TQDomElement &node,
- const TQString &entry, bool &value );
- static bool extractLong( const TQDomElement &node,
- const TQString &entry, long &value );
- static bool extractFloat( const TQDomElement &node,
- const TQString &entry, float &value );
- static bool extractDateTime( const TQDomElement &node,
- const TQString &entry, TQDateTime &value );
- static bool extractString( const TQDomElement &node,
- const TQString &entry, TQString &value );
- static bool extractStringList( const TQDomElement &node,
- const TQString &entry, TQStringList &value );
-
- /**
- * Returns the value of the "etag" header if it can be found in the headers.
- */
- static const TQString getEtagFromHeaders( const TQString& );
-
-
- /**
- * Return the representation of utc time in the time zone indicated by timeZoneId
- */
- static TQDateTime utcAsZone( const TQDateTime& utc, const TQString& timeZoneId );
-
- /**
- * Return the UTC representation of local time in the time zone indicated by timeZoneId
- */
- static TQDateTime zoneAsUtc( const TQDateTime& zone, const TQString& timeZoneId );
-};
-
-#endif