summaryrefslogtreecommitdiffstats
path: root/tderesources/groupware
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-26 13:17:50 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-26 13:17:50 -0600
commitb363d2579af0a11b77e698aed2e1021c2233b644 (patch)
treef4a47b87354b7a6a3b266c8121bd8ddaeb7accaa /tderesources/groupware
parent61bddfe3a7226b18c68a76124b727c736f431688 (diff)
downloadtdepim-b363d2579af0a11b77e698aed2e1021c2233b644.tar.gz
tdepim-b363d2579af0a11b77e698aed2e1021c2233b644.zip
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'tderesources/groupware')
-rw-r--r--tderesources/groupware/Makefile.am42
-rw-r--r--tderesources/groupware/kabc_groupware.desktop49
-rw-r--r--tderesources/groupware/kabc_groupwareprefs.kcfgc8
-rw-r--r--tderesources/groupware/kabc_resourcegroupware.cpp365
-rw-r--r--tderesources/groupware/kabc_resourcegroupware.h87
-rw-r--r--tderesources/groupware/kabc_resourcegroupware_plugin.cpp39
-rw-r--r--tderesources/groupware/kabc_resourcegroupwareconfig.cpp208
-rw-r--r--tderesources/groupware/kabc_resourcegroupwareconfig.h71
-rw-r--r--tderesources/groupware/kcal_groupware.desktop49
-rw-r--r--tderesources/groupware/kcal_groupwareprefsbase.kcfgc11
-rw-r--r--tderesources/groupware/kcal_resourcegroupware.cpp304
-rw-r--r--tderesources/groupware/kcal_resourcegroupware.h91
-rw-r--r--tderesources/groupware/kcal_resourcegroupware_plugin.cpp40
-rw-r--r--tderesources/groupware/kcal_resourcegroupwareconfig.cpp105
-rw-r--r--tderesources/groupware/kcal_resourcegroupwareconfig.h63
-rw-r--r--tderesources/groupware/tderesources_kabc_groupware.kcfg18
-rw-r--r--tderesources/groupware/tderesources_kcal_groupware.kcfg22
17 files changed, 1572 insertions, 0 deletions
diff --git a/tderesources/groupware/Makefile.am b/tderesources/groupware/Makefile.am
new file mode 100644
index 000000000..08c257bac
--- /dev/null
+++ b/tderesources/groupware/Makefile.am
@@ -0,0 +1,42 @@
+INCLUDES = -I$(top_srcdir) $(all_includes)
+
+lib_LTLIBRARIES = libkcal_groupware.la libkabc_groupware.la
+
+libkcal_groupware_la_SOURCES = kcal_resourcegroupware.cpp \
+ kcal_resourcegroupwareconfig.cpp \
+ kcal_groupwareprefsbase.kcfgc
+libkcal_groupware_la_LDFLAGS = $(KDE_RPATH) $(all_libraries) \
+ -version-info 1:0:0 -no-undefined
+libkcal_groupware_la_LIBADD = \
+ $(top_builddir)/libkcal/libkcal.la \
+ $(top_builddir)/libtdepim/libtdepim.la
+
+libkabc_groupware_la_SOURCES = kabc_resourcegroupware.cpp \
+ kabc_resourcegroupwareconfig.cpp \
+ kabc_groupwareprefs.kcfgc
+libkabc_groupware_la_LDFLAGS = $(KDE_RPATH) $(all_libraries) \
+ -version-info 1:0:0 -no-undefined
+libkabc_groupware_la_LIBADD = $(top_builddir)/libkcal/libkcal.la \
+ $(top_builddir)/libtdepim/libtdepim.la \
+ -lkabc
+
+kde_module_LTLIBRARIES = kcal_groupware.la kabc_groupware.la
+
+kcal_groupware_la_SOURCES = kcal_resourcegroupware_plugin.cpp
+kcal_groupware_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+kcal_groupware_la_LIBADD = libkcal_groupware.la
+
+kabc_groupware_la_SOURCES = kabc_resourcegroupware_plugin.cpp
+kabc_groupware_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+kabc_groupware_la_LIBADD = libkabc_groupware.la
+
+kcal_servicedir = $(kde_servicesdir)/tderesources/kcal
+kcal_service_DATA = kcal_groupware.desktop
+
+kabc_servicedir = $(kde_servicesdir)/tderesources/kabc
+kabc_service_DATA = kabc_groupware.desktop
+
+METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/kres_groupware.pot
diff --git a/tderesources/groupware/kabc_groupware.desktop b/tderesources/groupware/kabc_groupware.desktop
new file mode 100644
index 000000000..dee5d9c24
--- /dev/null
+++ b/tderesources/groupware/kabc_groupware.desktop
@@ -0,0 +1,49 @@
+[Desktop Entry]
+Name=Groupware Server
+Name[af]=Groupware bediener
+Name[ar]=خادم البرمجيات الجماعية
+Name[bg]=Сървър Groupware
+Name[br]=Servijer strollant
+Name[ca]=Servidor Groupware
+Name[cs]=Groupware server
+Name[el]=Εξυπηρετητής Groupware
+Name[es]=Servidor de Groupware
+Name[et]=Grupitöö server
+Name[eu]=Groupware zerbitzaria
+Name[fa]=کارساز Groupware
+Name[fi]=Groupware-palvelin
+Name[fr]=Serveur de travail collaboratif
+Name[fy]=Groupware-tsjinner
+Name[ga]=Freastalaí Groupware
+Name[gl]=Servidor de Traballo en Grupo
+Name[hu]=Groupware kiszolgáló
+Name[is]=Groupware þjónn
+Name[it]=Server Groupware
+Name[ja]=グループウェアサーバ
+Name[kk]=Groupware сервері
+Name[km]=ម៉ាស៊ីន​បម្រើ​កម្មវិធី​ពហុ​អ្នកប្រើ
+Name[lt]=Grupinio darbo serveris
+Name[ms]=Pelayan Groupware
+Name[nb]=Groupware-tjener
+Name[nds]=Groupware-Server
+Name[ne]=ग्रुपवेयर सर्भर
+Name[nl]=Groupware-server
+Name[nn]=Groupware-tenar
+Name[pl]=Serwer Groupware
+Name[pt]=Servidor de Groupware
+Name[pt_BR]=Servidor Groupware
+Name[ru]=Сервер Groupware
+Name[sl]=Strežnik za skupinsko delo
+Name[sr]=Groupware сервер
+Name[sr@Latn]=Groupware server
+Name[sv]=Grupprogramserver
+Name[ta]=குழுவாரி சேவகன்
+Name[tr]=Grupyazılımı(Groupware) Sunucusu
+Name[uk]=Сервер Groupware
+Name[zh_CN]=群件服务器
+Name[zh_TW]=群組伺服器
+X-TDE-Library=kabc_groupware
+Type=Service
+ServiceTypes=KResources/Plugin
+X-TDE-ResourceFamily=contact
+X-TDE-ResourceType=groupware
diff --git a/tderesources/groupware/kabc_groupwareprefs.kcfgc b/tderesources/groupware/kabc_groupwareprefs.kcfgc
new file mode 100644
index 000000000..771ddccf4
--- /dev/null
+++ b/tderesources/groupware/kabc_groupwareprefs.kcfgc
@@ -0,0 +1,8 @@
+ClassName=GroupwarePrefs
+File=tderesources_kabc_groupware.kcfg
+GlobalEnums=true
+IncludeFiles=libtdepim/kresourceprefs.h
+Inherits=KResourcePrefs
+Mutators=true
+NameSpace=KABC
+Singleton=false
diff --git a/tderesources/groupware/kabc_resourcegroupware.cpp b/tderesources/groupware/kabc_resourcegroupware.cpp
new file mode 100644
index 000000000..3c9d9792c
--- /dev/null
+++ b/tderesources/groupware/kabc_resourcegroupware.cpp
@@ -0,0 +1,365 @@
+/*
+ This file is part of tdepim.
+
+ Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
+
+ 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 <tqapplication.h>
+
+#include <kabc/addressee.h>
+#include <kabc/vcardconverter.h>
+#include <kconfig.h>
+#include <kdebug.h>
+#include <klocale.h>
+
+#include <libtdepim/groupwarejob.h>
+
+#include "kabc_groupwareprefs.h"
+
+#include "kabc_resourcegroupware.h"
+
+using namespace KABC;
+
+ResourceGroupware::ResourceGroupware( const TDEConfig *config )
+ : ResourceCached( config )
+{
+ init();
+
+ mPrefs->addGroupPrefix( identifier() );
+
+ if ( config ) {
+ readConfig( config );
+ } else {
+ setResourceName( i18n( "Groupware Server" ) );
+ }
+}
+
+ResourceGroupware::ResourceGroupware( const KURL &url,
+ const TQString &user,
+ const TQString &password )
+ : ResourceCached( 0 )
+{
+ init();
+
+ mPrefs->addGroupPrefix( identifier() );
+
+ mPrefs->setUrl( url.url() );
+ mPrefs->setUser( user );
+ mPrefs->setPassword( password );
+}
+
+void ResourceGroupware::init()
+{
+ mDownloadJob = 0;
+ mProgress = 0;
+
+ mPrefs = new GroupwarePrefs;
+
+ setType( "groupware" );
+}
+
+ResourceGroupware::~ResourceGroupware()
+{
+ delete mPrefs;
+ mPrefs = 0;
+}
+
+void ResourceGroupware::readConfig( const TDEConfig * )
+{
+ mPrefs->readConfig();
+
+ readAddressBooks();
+}
+
+void ResourceGroupware::writeConfig( TDEConfig *config )
+{
+ Resource::writeConfig( config );
+
+ writeAddressBooks();
+
+ mPrefs->writeConfig();
+}
+
+void ResourceGroupware::readAddressBooks()
+{
+#if 0
+ TQStringList ids = prefs()->ids();
+ TQStringList names = prefs()->names();
+ TQStringList personals = prefs()->personals();
+ TQStringList frequents = prefs()->frequents();
+
+ if ( ids.count() != names.count() || ids.count() != personals.count() ||
+ ids.count() != frequents.count() ) {
+ kdError() << "Corrupt addressbook configuration" << endl;
+ return;
+ }
+
+ mAddressBooks.clear();
+
+ for( uint i = 0; i < ids.count(); ++i ) {
+ Groupware::AddressBook ab;
+ ab.id = ids[ i ];
+ ab.name = names[ i ];
+ ab.isPersonal = personals[ i ] == "1";
+ ab.isFrequentContacts = frequents[ i ] == "1";
+
+ mAddressBooks.append( ab );
+ }
+#endif
+}
+
+void ResourceGroupware::writeAddressBooks()
+{
+#if 0
+ TQStringList ids;
+ TQStringList names;
+ TQStringList personals;
+ TQStringList frequents;
+ Groupware::AddressBook::List::ConstIterator it;
+ for( it = mAddressBooks.begin(); it != mAddressBooks.end(); ++it ) {
+ ids.append( (*it).id );
+ names.append( (*it).name );
+ personals.append( (*it).isPersonal ? "1" : "0" );
+ frequents.append( (*it).isFrequentContacts ? "1" : "0" );
+ }
+ prefs()->setIds( ids );
+ prefs()->setNames( names );
+ prefs()->setPersonals( personals );
+ prefs()->setFrequents( frequents );
+#endif
+}
+
+void ResourceGroupware::retrieveAddressBooks()
+{
+#if 0
+ bool firstRetrieve = mAddressBooks.isEmpty();
+
+ GroupwareServer server( prefs()->url(),
+ prefs()->user(),
+ prefs()->password(), this );
+
+ server.login();
+ mAddressBooks = server.addressBookList();
+ server.logout();
+
+ if ( firstRetrieve ) {
+ TQStringList reads;
+ TQString write;
+
+ Groupware::AddressBook::List::ConstIterator it;
+ for( it = mAddressBooks.begin(); it != mAddressBooks.end(); ++it ) {
+ if ( (*it).isPersonal ) {
+ reads.append( (*it).id );
+ if ( write.isEmpty() ) write = (*it).id;
+ }
+ }
+
+ prefs()->setReadAddressBooks( reads );
+ prefs()->setWriteAddressBook( write );
+ }
+#endif
+}
+
+Ticket *ResourceGroupware::requestSaveTicket()
+{
+ if ( !addressBook() ) {
+ kdDebug(5700) << "no addressbook" << endl;
+ return 0;
+ }
+
+ return createTicket( this );
+}
+
+void ResourceGroupware::releaseSaveTicket( Ticket *ticket )
+{
+ delete ticket;
+}
+
+bool ResourceGroupware::doOpen()
+{
+ return true;
+}
+
+void ResourceGroupware::doClose()
+{
+ kdDebug() << "ResourceGroupware::doClose()" << endl;
+
+ cancelLoad();
+}
+
+bool ResourceGroupware::load()
+{
+ return asyncLoad();
+}
+
+bool ResourceGroupware::asyncLoad()
+{
+ if ( mDownloadJob ) {
+ kdWarning() << "Download still in progress" << endl;
+ return false;
+ }
+
+ mAddrMap.clear();
+ loadCache();
+
+#if 0
+ if ( addressBooks().isEmpty() ) {
+ kdDebug() << "Retrieving default addressbook list." << endl;
+ retrieveAddressBooks();
+ writeAddressBooks();
+ }
+#endif
+
+ KURL url( prefs()->url() );
+ url.setUser( prefs()->user() );
+ url.setPass( prefs()->password() );
+
+#if 0
+ TQString query = "?";
+ TQStringList ids = mPrefs->readAddressBooks();
+ TQStringList::ConstIterator it;
+ for( it = ids.begin(); it != ids.end(); ++it ) {
+ if ( it != ids.begin() ) query += "&";
+ query += "addressbookid=" + *it;
+ }
+ url.setQuery( query );
+#endif
+
+ kdDebug() << "Download URL: " << url << endl;
+
+ mJobData = TQString();
+
+ mDownloadJob = KPIM::GroupwareJob::getAddressBook( url );
+ connect( mDownloadJob, TQT_SIGNAL( result( TDEIO::Job * ) ),
+ TQT_SLOT( slotJobResult( TDEIO::Job * ) ) );
+ connect( mDownloadJob, TQT_SIGNAL( data( TDEIO::Job *, const TQByteArray & ) ),
+ TQT_SLOT( slotJobData( TDEIO::Job *, const TQByteArray & ) ) );
+ connect( mDownloadJob, TQT_SIGNAL( percent( TDEIO::Job *, unsigned long ) ),
+ TQT_SLOT( slotJobPercent( TDEIO::Job *, unsigned long ) ) );
+
+ mProgress = KPIM::ProgressManager::instance()->createProgressItem(
+ KPIM::ProgressManager::getUniqueID(), i18n("Downloading addressbook") );
+ connect( mProgress,
+ TQT_SIGNAL( progressItemCanceled( KPIM::ProgressItem * ) ),
+ TQT_SLOT( cancelLoad() ) );
+
+ return true;
+}
+
+bool ResourceGroupware::save( Ticket *ticket )
+{
+ return asyncSave( ticket );
+}
+
+bool ResourceGroupware::asyncSave( Ticket* )
+{
+#if 0
+ if ( !mServer->login() ) return false;
+
+ KABC::Addressee::List::Iterator it;
+
+ KABC::Addressee::List addedList = addedAddressees();
+ for ( it = addedList.begin(); it != addedList.end(); ++it ) {
+ if ( mServer->insertAddressee( mPrefs->writeAddressBook(), *it ) ) {
+ clearChange( *it );
+ idMapper().setRemoteId( (*it).uid(), (*it).custom( "GWRESOURCE", "UID" ) );
+ }
+ }
+
+ KABC::Addressee::List changedList = changedAddressees();
+ for ( it = changedList.begin(); it != changedList.end(); ++it ) {
+ if ( mServer->changeAddressee( *it ) )
+ clearChange( *it );
+ }
+
+ KABC::Addressee::List deletedList = deletedAddressees();
+ for ( it = deletedList.begin(); it != deletedList.end(); ++it ) {
+ if ( mServer->removeAddressee( *it ) )
+ clearChange( *it );
+ }
+
+ saveCache();
+
+ mServer->logout();
+#endif
+
+ return true;
+}
+
+void ResourceGroupware::slotJobResult( TDEIO::Job *job )
+{
+ kdDebug() << "ResourceGroupware::slotJobResult(): " << endl;
+
+ if ( job->error() ) {
+ kdError() << job->errorString() << endl;
+ emit loadingError( this, job->errorString() );
+ } else {
+ mAddrMap.clear();
+
+ KABC::VCardConverter conv;
+ Addressee::List addressees = conv.parseVCards( mJobData );
+ Addressee::List::ConstIterator it;
+ for( it = addressees.begin(); it != addressees.end(); ++it ) {
+ KABC::Addressee addr = *it;
+ if ( !addr.isEmpty() ) {
+ addr.setResource( this );
+
+ TQString remote = addr.custom( "GWRESOURCE", "UID" );
+ TQString local = idMapper().localId( remote );
+ if ( local.isEmpty() ) {
+ idMapper().setRemoteId( addr.uid(), remote );
+ } else {
+ addr.setUid( local );
+ }
+
+ insertAddressee( addr );
+ clearChange( addr );
+ }
+ }
+ }
+
+ saveCache();
+
+ emit loadingFinished( this );
+
+ mDownloadJob = 0;
+ if ( mProgress ) mProgress->setComplete();
+ mProgress = 0;
+}
+
+void ResourceGroupware::slotJobData( TDEIO::Job *, const TQByteArray &data )
+{
+// kdDebug() << "ResourceGroupware::slotJobData()" << endl;
+
+ mJobData.append( data.data() );
+}
+
+void ResourceGroupware::slotJobPercent( TDEIO::Job *, unsigned long percent )
+{
+ kdDebug() << "ResourceGroupware::slotJobPercent() " << percent << endl;
+ if ( mProgress ) mProgress->setProgress( percent );
+}
+
+void ResourceGroupware::cancelLoad()
+{
+ if ( mDownloadJob ) mDownloadJob->kill();
+ mDownloadJob = 0;
+ if ( mProgress ) mProgress->setComplete();
+ mProgress = 0;
+}
+
+#include "kabc_resourcegroupware.moc"
diff --git a/tderesources/groupware/kabc_resourcegroupware.h b/tderesources/groupware/kabc_resourcegroupware.h
new file mode 100644
index 000000000..53c1d007a
--- /dev/null
+++ b/tderesources/groupware/kabc_resourcegroupware.h
@@ -0,0 +1,87 @@
+/*
+ This file is part of tdepim.
+
+ Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
+
+ 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 <kabcresourcecached.h>
+
+#include <libtdepim/progressmanager.h>
+
+#include <kio/job.h>
+
+class TDEConfig;
+
+namespace KABC {
+
+class GroupwarePrefs;
+
+class ResourceGroupware : public ResourceCached
+{
+ Q_OBJECT
+
+
+ public:
+ ResourceGroupware( const TDEConfig * );
+ ResourceGroupware( const KURL &url,
+ const TQString &user, const TQString &password );
+ ~ResourceGroupware();
+
+ void readConfig( const TDEConfig * );
+ void writeConfig( TDEConfig * );
+
+ void readAddressBooks();
+ void writeAddressBooks();
+
+ void retrieveAddressBooks();
+
+ GroupwarePrefs *prefs() const { return mPrefs; }
+
+ bool doOpen();
+ void doClose();
+
+ Ticket *requestSaveTicket();
+ void releaseSaveTicket( Ticket* );
+
+ bool load();
+ bool asyncLoad();
+ bool save( Ticket * );
+ bool asyncSave( Ticket * );
+
+ protected:
+ void init();
+
+ private slots:
+ void slotJobResult( TDEIO::Job * );
+ void slotJobData( TDEIO::Job *, const TQByteArray & );
+ void slotJobPercent( TDEIO::Job *job, unsigned long percent );
+
+ void cancelLoad();
+
+ private:
+ GroupwarePrefs *mPrefs;
+
+ TDEIO::TransferJob *mDownloadJob;
+ KPIM::ProgressItem *mProgress;
+ TQString mJobData;
+};
+
+}
+
+#endif
diff --git a/tderesources/groupware/kabc_resourcegroupware_plugin.cpp b/tderesources/groupware/kabc_resourcegroupware_plugin.cpp
new file mode 100644
index 000000000..c7266b181
--- /dev/null
+++ b/tderesources/groupware/kabc_resourcegroupware_plugin.cpp
@@ -0,0 +1,39 @@
+/*
+ This file is part of tdepim.
+
+ Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
+
+ 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_resourcegroupware.h"
+#include "kabc_resourcegroupwareconfig.h"
+
+#include <kglobal.h>
+#include <klocale.h>
+
+using namespace KABC;
+
+typedef KRES::PluginFactory<ResourceGroupware, ResourceGroupwareConfig> GroupwareFactory;
+
+extern "C"
+{
+ void *init_kabc_groupware()
+ {
+ TDEGlobal::locale()->insertCatalogue( "libkcal" );
+ TDEGlobal::locale()->insertCatalogue( "kres_groupware" );
+ return new ResourceGroupware;
+ }
+}
diff --git a/tderesources/groupware/kabc_resourcegroupwareconfig.cpp b/tderesources/groupware/kabc_resourcegroupwareconfig.cpp
new file mode 100644
index 000000000..956ee4321
--- /dev/null
+++ b/tderesources/groupware/kabc_resourcegroupwareconfig.cpp
@@ -0,0 +1,208 @@
+/*
+ This file is part of tdepim.
+
+ Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
+
+ 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_resourcegroupwareconfig.h"
+
+#include "kabc_resourcegroupware.h"
+#include "kabc_groupwareprefs.h"
+
+#include <kcombobox.h>
+#include <kdebug.h>
+#include <kdialog.h>
+#include <klocale.h>
+#include <klineedit.h>
+#include <klistview.h>
+#include <kurlrequester.h>
+
+#include <tqlabel.h>
+#include <tqlayout.h>
+
+using namespace KABC;
+
+class AddressBookItem : public TQCheckListItem
+{
+ public:
+ AddressBookItem( KListView *parent, const TQString &id )
+ : TQCheckListItem( parent, "", CheckBox ),
+ mId( id )
+ {
+ setText( 0, mId );
+#if 0
+ if ( ab.isPersonal ) setText( 1, "Yes" );
+ else setText( 1, "No" );
+ if ( ab.isFrequentContacts ) setText( 2, "Yes" );
+ else setText( 2, "No" );
+#endif
+ }
+
+ TQString id() const { return mId; }
+
+ private:
+ TQString mId;
+};
+
+ResourceGroupwareConfig::ResourceGroupwareConfig( 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 );
+
+ TQPushButton *updateButton = new TQPushButton( i18n( "Retrieve Address Book List From Server" ), this );
+ mainLayout->addMultiCellWidget( updateButton, 4, 4, 0, 1 );
+
+ mAddressBookView = new KListView( this );
+ mAddressBookView->addColumn( i18n( "Address Book" ) );
+#if 0
+ mAddressBookView->addColumn( i18n( "Personal" ) );
+ mAddressBookView->addColumn( i18n( "Frequent Contacts" ) );
+#endif
+ mAddressBookView->setFullWidth( true );
+
+ mainLayout->addMultiCellWidget( mAddressBookView, 5, 5, 0, 1 );
+
+ label = new TQLabel( i18n( "Address book for new contacts:" ), this );
+ mAddressBookBox = new KComboBox( this );
+
+ mainLayout->addWidget( label, 6, 0 );
+ mainLayout->addWidget( mAddressBookBox, 6, 1 );
+
+ connect( updateButton, TQT_SIGNAL( clicked() ), TQT_SLOT( updateAddressBookList() ) );
+}
+
+void ResourceGroupwareConfig::loadSettings( KRES::Resource *res )
+{
+ mResource = dynamic_cast<ResourceGroupware*>( res );
+
+ if ( !mResource ) {
+ kdDebug(5700) << "ResourceGroupwareConfig::loadSettings(): cast failed" << endl;
+ return;
+ }
+
+ mURL->setURL( mResource->prefs()->url() );
+ mUser->setText( mResource->prefs()->user() );
+ mPassword->setText( mResource->prefs()->password() );
+
+ updateAddressBookView();
+}
+
+void ResourceGroupwareConfig::saveSettings( KRES::Resource *res )
+{
+ ResourceGroupware *resource = dynamic_cast<ResourceGroupware*>( res );
+
+ if ( !resource ) {
+ kdDebug(5700) << "ResourceGroupwareConfig::saveSettings(): cast failed" << endl;
+ return;
+ }
+
+ saveServerSettings( resource );
+
+ saveAddressBookSettings();
+}
+
+void ResourceGroupwareConfig::saveServerSettings( ResourceGroupware *resource )
+{
+ resource->prefs()->setUrl( mURL->url() );
+ resource->prefs()->setUser( mUser->text() );
+ resource->prefs()->setPassword( mPassword->text() );
+}
+
+void ResourceGroupwareConfig::updateAddressBookList()
+{
+ saveServerSettings( mResource );
+
+ mResource->retrieveAddressBooks();
+
+ updateAddressBookView();
+}
+
+void ResourceGroupwareConfig::saveAddressBookSettings()
+{
+#if 0
+ TQStringList selectedRead;
+ TQString selectedWrite;
+
+ TQListViewItemIterator it2( mAddressBookView );
+ while ( it2.current() ) {
+ AddressBookItem *item = static_cast<AddressBookItem*>( it2.current() );
+ if ( item->isOn() )
+ selectedRead.append( item->id() );
+
+ ++it2;
+ }
+
+ selectedWrite = mWriteAddressBookIds[ mAddressBookBox->currentItem() ];
+
+ mResource->prefs()->setReadAddressBooks( selectedRead );
+ mResource->prefs()->setWriteAddressBook( selectedWrite );
+#endif
+}
+
+void ResourceGroupwareConfig::updateAddressBookView()
+{
+ if ( mAddressBookBox->count() != 0 ) // we loaded it already
+ saveAddressBookSettings();
+
+ mAddressBookView->clear();
+ mAddressBookBox->clear();
+ mWriteAddressBookIds.clear();
+
+#if 0
+ TQStringList selectedRead = mResource->prefs()->readAddressBooks();
+
+ Groupware::AddressBook::List addressBooks = mResource->addressBooks();
+ Groupware::AddressBook::List::ConstIterator abIt;
+ for ( abIt = addressBooks.begin(); abIt != addressBooks.end(); ++abIt ) {
+ AddressBookItem *item = new AddressBookItem( mAddressBookView, *abIt );
+ if ( selectedRead.find( (*abIt).id ) != selectedRead.end() )
+ item->setOn( true );
+
+ mAddressBookBox->insertItem( (*abIt).name );
+ mWriteAddressBookIds.append( (*abIt).id );
+ }
+
+ int index = mWriteAddressBookIds.findIndex( mResource->prefs()->writeAddressBook() );
+ mAddressBookBox->setCurrentItem( index );
+#endif
+}
+
+#include "kabc_resourcegroupwareconfig.moc"
diff --git a/tderesources/groupware/kabc_resourcegroupwareconfig.h b/tderesources/groupware/kabc_resourcegroupwareconfig.h
new file mode 100644
index 000000000..bad560d17
--- /dev/null
+++ b/tderesources/groupware/kabc_resourcegroupwareconfig.h
@@ -0,0 +1,71 @@
+/*
+ This file is part of tdepim.
+
+ Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
+
+ 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_RESOURCEGROUPWARECONFIG_H
+#define KABC_RESOURCEGROUPWARECONFIG_H
+
+#include <tderesources/configwidget.h>
+
+#include <tqmap.h>
+
+class KComboBox;
+class KLineEdit;
+class KListView;
+class KURLRequester;
+
+namespace KABC {
+
+class ResourceGroupware;
+
+class ResourceGroupwareConfig : public KRES::ConfigWidget
+{
+ Q_OBJECT
+
+
+ public:
+ ResourceGroupwareConfig( TQWidget* parent = 0, const char* name = 0 );
+
+ public slots:
+ void loadSettings( KRES::Resource* );
+ void saveSettings( KRES::Resource* );
+
+ protected slots:
+ void updateAddressBookList();
+
+ private:
+ void updateAddressBookView();
+ void saveAddressBookSettings();
+ void loadAddressBookSettings();
+ void saveServerSettings( ResourceGroupware *resource );
+
+ KURLRequester *mURL;
+ KLineEdit *mUser;
+ KLineEdit *mPassword;
+
+ KListView *mAddressBookView;
+ KComboBox *mAddressBookBox;
+
+ TQStringList mWriteAddressBookIds;
+
+ ResourceGroupware *mResource;
+};
+
+}
+
+#endif
diff --git a/tderesources/groupware/kcal_groupware.desktop b/tderesources/groupware/kcal_groupware.desktop
new file mode 100644
index 000000000..42c4bc9aa
--- /dev/null
+++ b/tderesources/groupware/kcal_groupware.desktop
@@ -0,0 +1,49 @@
+[Desktop Entry]
+Name=Groupware Server
+Name[af]=Groupware bediener
+Name[ar]=خادم البرمجيات الجماعية
+Name[bg]=Сървър Groupware
+Name[br]=Servijer strollant
+Name[ca]=Servidor Groupware
+Name[cs]=Groupware server
+Name[el]=Εξυπηρετητής Groupware
+Name[es]=Servidor de Groupware
+Name[et]=Grupitöö server
+Name[eu]=Groupware zerbitzaria
+Name[fa]=کارساز Groupware
+Name[fi]=Groupware-palvelin
+Name[fr]=Serveur de travail collaboratif
+Name[fy]=Groupware-tsjinner
+Name[ga]=Freastalaí Groupware
+Name[gl]=Servidor de Traballo en Grupo
+Name[hu]=Groupware kiszolgáló
+Name[is]=Groupware þjónn
+Name[it]=Server Groupware
+Name[ja]=グループウェアサーバ
+Name[kk]=Groupware сервері
+Name[km]=ម៉ាស៊ីន​បម្រើ​កម្មវិធី​ពហុ​អ្នកប្រើ
+Name[lt]=Grupinio darbo serveris
+Name[ms]=Pelayan Groupware
+Name[nb]=Groupware-tjener
+Name[nds]=Groupware-Server
+Name[ne]=ग्रुपवेयर सर्भर
+Name[nl]=Groupware-server
+Name[nn]=Groupware-tenar
+Name[pl]=Serwer Groupware
+Name[pt]=Servidor de Groupware
+Name[pt_BR]=Servidor Groupware
+Name[ru]=Сервер Groupware
+Name[sl]=Strežnik za skupinsko delo
+Name[sr]=Groupware сервер
+Name[sr@Latn]=Groupware server
+Name[sv]=Grupprogramserver
+Name[ta]=குழுவாரி சேவகன்
+Name[tr]=Grupyazılımı(Groupware) Sunucusu
+Name[uk]=Сервер Groupware
+Name[zh_CN]=群件服务器
+Name[zh_TW]=群組伺服器
+X-TDE-Library=kcal_groupware
+Type=Service
+ServiceTypes=KResources/Plugin
+X-TDE-ResourceFamily=calendar
+X-TDE-ResourceType=groupware
diff --git a/tderesources/groupware/kcal_groupwareprefsbase.kcfgc b/tderesources/groupware/kcal_groupwareprefsbase.kcfgc
new file mode 100644
index 000000000..7e243ddc0
--- /dev/null
+++ b/tderesources/groupware/kcal_groupwareprefsbase.kcfgc
@@ -0,0 +1,11 @@
+# Code generation options for kconfig_compiler
+File=tderesources_kcal_groupware.kcfg
+ClassName=GroupwarePrefsBase
+NameSpace=KCal
+Singleton=false
+Mutators=true
+Inherits=KResourcePrefs
+IncludeFiles=libtdepim/kresourceprefs.h
+GlobalEnums=true
+#ItemAccessors=true
+#SetUserTexts=true
diff --git a/tderesources/groupware/kcal_resourcegroupware.cpp b/tderesources/groupware/kcal_resourcegroupware.cpp
new file mode 100644
index 000000000..f515bd06e
--- /dev/null
+++ b/tderesources/groupware/kcal_resourcegroupware.cpp
@@ -0,0 +1,304 @@
+/*
+ This file is part of tdepim.
+
+ Copyright (c) 2004 Cornelius Schumacher <schumacher@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.
+*/
+
+#include "kcal_resourcegroupware.h"
+
+#include "kcal_groupwareprefsbase.h"
+#include "kcal_resourcegroupwareconfig.h"
+
+#include <libkcal/confirmsavedialog.h>
+#include <libkcal/icalformat.h>
+#include <libkcal/calendarlocal.h>
+
+#include <tqapplication.h>
+#include <tqdatetime.h>
+#include <tqptrlist.h>
+#include <tqstringlist.h>
+#include <tqtimer.h>
+
+#include <kabc/locknull.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <tderesources/configwidget.h>
+#include <kstandarddirs.h>
+#include <kstringhandler.h>
+#include <kurl.h>
+#include <libtdepim/kpimprefs.h>
+#include <libtdepim/groupwarejob.h>
+
+using namespace KCal;
+
+ResourceGroupware::ResourceGroupware()
+ : ResourceCached( 0 ), mLock( true ),
+ mProgress( 0 )
+{
+ init();
+
+ mPrefs->addGroupPrefix( identifier() );
+}
+
+ResourceGroupware::ResourceGroupware( const TDEConfig *config )
+ : ResourceCached( config ), mLock( true )
+{
+ init();
+
+ mPrefs->addGroupPrefix( identifier() );
+
+ if ( config ) {
+ readConfig( config );
+ } else {
+ setResourceName( i18n( "Groupware Server" ) );
+ }
+}
+
+ResourceGroupware::~ResourceGroupware()
+{
+ disableChangeNotification();
+
+ delete mPrefs;
+ mPrefs = 0;
+}
+
+void ResourceGroupware::init()
+{
+ mDownloadJob = 0;
+ mProgress = 0;
+
+ mIsShowingError = false;
+
+ mPrefs = new GroupwarePrefsBase();
+
+ setType( "groupware" );
+
+ enableChangeNotification();
+}
+
+GroupwarePrefsBase *ResourceGroupware::prefs()
+{
+ return mPrefs;
+}
+
+void ResourceGroupware::readConfig( const TDEConfig *config )
+{
+ kdDebug() << "KCal::ResourceGroupware::readConfig()" << endl;
+
+ mPrefs->readConfig();
+
+ ResourceCached::readConfig( config );
+}
+
+void ResourceGroupware::writeConfig( TDEConfig *config )
+{
+ kdDebug() << "KCal::ResourceGroupware::writeConfig()" << endl;
+
+ ResourceCalendar::writeConfig( config );
+
+ mPrefs->writeConfig();
+
+ ResourceCached::writeConfig( config );
+}
+
+bool ResourceGroupware::doOpen()
+{
+ return true;
+}
+
+void ResourceGroupware::doClose()
+{
+ ResourceCached::doClose();
+}
+
+bool ResourceGroupware::doLoad()
+{
+ kdDebug() << "ResourceGroupware::load()" << endl;
+
+ if ( mIsShowingError ) {
+ kdDebug() << "Still showing error" << endl;
+ return true;
+ }
+
+ if ( mDownloadJob ) {
+ kdWarning() << "Download still in progress" << endl;
+ return false;
+ }
+
+ mCalendar.close();
+
+ disableChangeNotification();
+ loadCache();
+ enableChangeNotification();
+
+ emit resourceChanged( this );
+
+ clearChanges();
+
+ KURL url( prefs()->url() );
+ url.setUser( prefs()->user() );
+ url.setPass( prefs()->password() );
+
+ kdDebug() << "Download URL: " << url << endl;
+
+ mJobData = TQString();
+
+ mDownloadJob = KPIM::GroupwareJob::getCalendar( url );
+ connect( mDownloadJob, TQT_SIGNAL( result( TDEIO::Job * ) ),
+ TQT_SLOT( slotJobResult( TDEIO::Job * ) ) );
+ connect( mDownloadJob, TQT_SIGNAL( data( TDEIO::Job *, const TQByteArray & ) ),
+ TQT_SLOT( slotJobData( TDEIO::Job *, const TQByteArray & ) ) );
+
+ mProgress = KPIM::ProgressManager::instance()->createProgressItem(
+ KPIM::ProgressManager::getUniqueID(), i18n("Downloading calendar") );
+ connect( mProgress,
+ TQT_SIGNAL( progressItemCanceled( KPIM::ProgressItem * ) ),
+ TQT_SLOT( cancelLoad() ) );
+
+ return true;
+}
+
+void ResourceGroupware::slotJobResult( TDEIO::Job *job )
+{
+ kdDebug() << "ResourceGroupware::slotJobResult(): " << endl;
+
+ if ( job->error() ) {
+ mIsShowingError = true;
+ loadError( job->errorString() );
+ mIsShowingError = false;
+ } else {
+ disableChangeNotification();
+
+ clearCache();
+
+ // FIXME: This does not take into account the time zone!
+ CalendarLocal calendar;
+ ICalFormat ical;
+ if ( !ical.fromString( &calendar, mJobData ) ) {
+ loadError( i18n("Error parsing calendar data.") );
+ } else {
+ Incidence::List incidences = calendar.incidences();
+ Incidence::List::ConstIterator it;
+ for( it = incidences.begin(); it != incidences.end(); ++it ) {
+// kdDebug() << "INCIDENCE: " << (*it)->summary() << endl;
+ Incidence *i = (*it)->clone();
+ TQString remote = (*it)->customProperty( "GWRESOURCE", "UID" );
+ TQString local = idMapper().localId( remote );
+ if ( local.isEmpty() ) {
+ idMapper().setRemoteId( i->uid(), remote );
+ } else {
+ i->setUid( local );
+ }
+ addIncidence( i );
+ }
+ }
+ saveCache();
+ enableChangeNotification();
+
+ clearChanges();
+
+ emit resourceChanged( this );
+ emit resourceLoaded( this );
+ }
+
+ mDownloadJob = 0;
+ if ( mProgress ) mProgress->setComplete();
+ mProgress = 0;
+}
+
+void ResourceGroupware::slotJobData( TDEIO::Job *, const TQByteArray &data )
+{
+// kdDebug() << "ResourceGroupware::slotJobData()" << endl;
+
+ mJobData.append( data.data() );
+}
+
+void ResourceGroupware::loadFinished()
+{
+ saveCache();
+ enableChangeNotification();
+
+ emit resourceChanged( this );
+ emit resourceLoaded( this );
+}
+
+bool ResourceGroupware::doSave()
+{
+ kdDebug() << "KCal::ResourceGroupware::doSave()" << endl;
+
+ saveCache();
+
+ if ( !hasChanges() ) {
+ kdDebug() << "No changes" << endl;
+ return true;
+ }
+
+ if ( !confirmSave() ) return false;
+
+#if 0
+ Incidence::List::ConstIterator it;
+
+ Incidence::List added = addedIncidences();
+ for( it = added.begin(); it != added.end(); ++it ) {
+ if ( mServer->addIncidence( *it, this ) ) {
+ clearChange( *it );
+ saveCache();
+ }
+ }
+ Incidence::List changed = changedIncidences();
+ for( it = changed.begin(); it != changed.end(); ++it ) {
+ if ( mServer->changeIncidence( *it ) ) clearChange( *it );
+ }
+ Incidence::List deleted = deletedIncidences();
+ for( it = deleted.begin(); it != deleted.end(); ++it ) {
+ if ( mServer->deleteIncidence( *it ) ) clearChange( *it );
+ }
+#endif
+
+ return true;
+}
+
+// FIXME: Put this into ResourceCached
+bool ResourceGroupware::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 *ResourceGroupware::lock()
+{
+ return &mLock;
+}
+
+void ResourceGroupware::cancelLoad()
+{
+ if ( mDownloadJob ) mDownloadJob->kill();
+ mDownloadJob = 0;
+ if ( mProgress ) mProgress->setComplete();
+ mProgress = 0;
+}
+
+#include "kcal_resourcegroupware.moc"
diff --git a/tderesources/groupware/kcal_resourcegroupware.h b/tderesources/groupware/kcal_resourcegroupware.h
new file mode 100644
index 000000000..d3c809db7
--- /dev/null
+++ b/tderesources/groupware/kcal_resourcegroupware.h
@@ -0,0 +1,91 @@
+ /*
+ This file is part of tdepim.
+
+ Copyright (c) 2004 Cornelius Schumacher <schumacher@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.
+*/
+#ifndef KCAL_RESOURCEGROUPWARE_H
+#define KCAL_RESOURCEGROUPWARE_H
+
+#include <libtdepim/progressmanager.h>
+
+#include <libkcal/resourcecached.h>
+
+#include <kabc/locknull.h>
+#include <kio/job.h>
+#include <kconfig.h>
+
+namespace KPIM {
+class GroupwarePrefsBase;
+}
+
+namespace KCal {
+
+/**
+ This class provides a resource for accessing a Groupware kioslave-based
+ calendar.
+*/
+class ResourceGroupware : public ResourceCached
+{
+ Q_OBJECT
+
+ public:
+ ResourceGroupware();
+
+ ResourceGroupware( const TDEConfig * );
+ virtual ~ResourceGroupware();
+
+ void readConfig( const TDEConfig *config );
+ void writeConfig( TDEConfig *config );
+
+ GroupwarePrefsBase *prefs();
+
+ bool doOpen();
+ void doClose();
+
+ bool doLoad();
+ bool doSave();
+
+ KABC::Lock *lock();
+
+ protected:
+ void init();
+
+ bool confirmSave();
+
+ protected slots:
+ void loadFinished();
+
+ void slotJobResult( TDEIO::Job * );
+ void slotJobData( TDEIO::Job *, const TQByteArray & );
+
+ void cancelLoad();
+
+ private:
+ GroupwarePrefsBase *mPrefs;
+ KABC::LockNull mLock;
+
+ TDEIO::TransferJob *mDownloadJob;
+ KPIM::ProgressItem *mProgress;
+ TQString mJobData;
+
+ bool mIsShowingError;
+};
+
+}
+
+#endif
diff --git a/tderesources/groupware/kcal_resourcegroupware_plugin.cpp b/tderesources/groupware/kcal_resourcegroupware_plugin.cpp
new file mode 100644
index 000000000..992a95d58
--- /dev/null
+++ b/tderesources/groupware/kcal_resourcegroupware_plugin.cpp
@@ -0,0 +1,40 @@
+/*
+ This file is part of tdepim.
+
+ Copyright (c) 2004 Cornelius Schumacher <schumacher@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.
+*/
+
+#include "kcal_resourcegroupware.h"
+#include "kcal_resourcegroupwareconfig.h"
+
+#include <kglobal.h>
+#include <klocale.h>
+
+using namespace KCal;
+
+typedef KRES::PluginFactory<ResourceGroupware, ResourceGroupwareConfig> GroupwareFactory;
+
+extern "C"
+{
+ void *init_kcal_groupware()
+ {
+ TDEGlobal::locale()->insertCatalogue( "libkcal" );
+ TDEGlobal::locale()->insertCatalogue( "kres_groupware" );
+ return new ResourceGroupware;
+ }
+}
diff --git a/tderesources/groupware/kcal_resourcegroupwareconfig.cpp b/tderesources/groupware/kcal_resourcegroupwareconfig.cpp
new file mode 100644
index 000000000..9a191bc30
--- /dev/null
+++ b/tderesources/groupware/kcal_resourcegroupwareconfig.cpp
@@ -0,0 +1,105 @@
+/*
+ This file is part of tdepim.
+
+ Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
+
+ 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 <typeinfo>
+
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqcheckbox.h>
+
+#include <klocale.h>
+#include <kdebug.h>
+#include <kstandarddirs.h>
+#include <klineedit.h>
+
+#include <libkcal/resourcecachedconfig.h>
+
+#include "kcal_resourcegroupware.h"
+#include "kcal_groupwareprefsbase.h"
+
+#include "kcal_resourcegroupwareconfig.h"
+
+using namespace KCal;
+
+ResourceGroupwareConfig::ResourceGroupwareConfig( TQWidget* parent, const char* name )
+ : KRES::ConfigWidget( parent, name )
+{
+ resize( 245, 115 );
+ TQGridLayout *mainLayout = new TQGridLayout( this, 2, 2 );
+
+ 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 );
+
+ mReloadConfig = new KCal::ResourceCachedReloadConfig( this );
+ mainLayout->addMultiCellWidget( mReloadConfig, 5, 5, 0, 1 );
+
+ mSaveConfig = new KCal::ResourceCachedSaveConfig( this );
+ mainLayout->addMultiCellWidget( mSaveConfig, 6, 6, 0, 1 );
+}
+
+void ResourceGroupwareConfig::loadSettings( KRES::Resource *resource )
+{
+ kdDebug() << "KCal::ResourceGroupwareConfig::loadSettings()" << endl;
+
+ ResourceGroupware *res = static_cast<ResourceGroupware *>( 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() );
+ mReloadConfig->loadSettings( res );
+ mSaveConfig->loadSettings( res );
+ } else {
+ kdError(5700) << "KCalResourceGroupwareConfig::loadSettings(): no KCalResourceGroupware, cast failed" << endl;
+ }
+}
+
+void ResourceGroupwareConfig::saveSettings( KRES::Resource *resource )
+{
+ ResourceGroupware *res = static_cast<ResourceGroupware*>( resource );
+ if ( res ) {
+ res->prefs()->setUrl( mUrl->text() );
+ res->prefs()->setUser( mUserEdit->text() );
+ res->prefs()->setPassword( mPasswordEdit->text() );
+ mReloadConfig->saveSettings( res );
+ mSaveConfig->saveSettings( res );
+ } else {
+ kdError(5700) << "KCalResourceGroupwareConfig::saveSettings(): no KCalResourceGroupware, cast failed" << endl;
+ }
+}
+
+#include "kcal_resourcegroupwareconfig.moc"
diff --git a/tderesources/groupware/kcal_resourcegroupwareconfig.h b/tderesources/groupware/kcal_resourcegroupwareconfig.h
new file mode 100644
index 000000000..dd6a93afa
--- /dev/null
+++ b/tderesources/groupware/kcal_resourcegroupwareconfig.h
@@ -0,0 +1,63 @@
+/*
+ This file is part of tdepim.
+
+ Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
+
+ 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 KCALRESOURCEGROUPWARECONFIG_H
+#define KCALRESOURCEGROUPWARECONFIG_H
+
+#include <kurlrequester.h>
+
+#include <tderesources/resource.h>
+#include <tderesources/configwidget.h>
+
+class TQCheckBox;
+class KLineEdit;
+
+namespace KCal {
+
+class ResourceCachedReloadConfig;
+class ResourceCachedSaveConfig;
+
+/**
+ Configuration widget for groupware kioslave resource.
+
+ @see KCalResourceGroupware
+*/
+class ResourceGroupwareConfig : public KRES::ConfigWidget
+{
+ Q_OBJECT
+
+ public:
+ ResourceGroupwareConfig( TQWidget *parent = 0, const char *name = 0 );
+
+ public slots:
+ virtual void loadSettings( KRES::Resource *resource );
+ virtual void saveSettings( KRES::Resource *resource );
+
+ private:
+ KLineEdit *mUrl;
+ KLineEdit *mUserEdit;
+ KLineEdit *mPasswordEdit;
+
+ ResourceCachedReloadConfig *mReloadConfig;
+ ResourceCachedSaveConfig *mSaveConfig;
+};
+
+}
+
+#endif
diff --git a/tderesources/groupware/tderesources_kabc_groupware.kcfg b/tderesources/groupware/tderesources_kabc_groupware.kcfg
new file mode 100644
index 000000000..9beca9c98
--- /dev/null
+++ b/tderesources/groupware/tderesources_kabc_groupware.kcfg
@@ -0,0 +1,18 @@
+<?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="tderesources_kabc_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>
+</kcfg>
diff --git a/tderesources/groupware/tderesources_kcal_groupware.kcfg b/tderesources/groupware/tderesources_kcal_groupware.kcfg
new file mode 100644
index 000000000..a84bbb5dc
--- /dev/null
+++ b/tderesources/groupware/tderesources_kcal_groupware.kcfg
@@ -0,0 +1,22 @@
+<?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="tderesources_kcal_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>
+ <entry key="Port" type="UInt" >
+ <label>TCP Port</label>
+ <default>80</default>
+ </entry>
+ </group>
+</kcfg>