diff options
Diffstat (limited to 'kresources/groupware')
17 files changed, 1564 insertions, 0 deletions
diff --git a/kresources/groupware/Makefile.am b/kresources/groupware/Makefile.am new file mode 100644 index 000000000..dfb12eec9 --- /dev/null +++ b/kresources/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)/libkdepim/libkdepim.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)/libkdepim/libkdepim.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)/kresources/kcal +kcal_service_DATA = kcal_groupware.desktop + +kabc_servicedir = $(kde_servicesdir)/kresources/kabc +kabc_service_DATA = kabc_groupware.desktop + +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kres_groupware.pot diff --git a/kresources/groupware/kabc_groupware.desktop b/kresources/groupware/kabc_groupware.desktop new file mode 100644 index 000000000..6750248b7 --- /dev/null +++ b/kresources/groupware/kabc_groupware.desktop @@ -0,0 +1,50 @@ +[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[ka]=სერვერი Groupware +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-KDE-Library=kabc_groupware +Type=Service +ServiceTypes=KResources/Plugin +X-KDE-ResourceFamily=contact +X-KDE-ResourceType=groupware diff --git a/kresources/groupware/kabc_groupwareprefs.kcfgc b/kresources/groupware/kabc_groupwareprefs.kcfgc new file mode 100644 index 000000000..36ee168a9 --- /dev/null +++ b/kresources/groupware/kabc_groupwareprefs.kcfgc @@ -0,0 +1,8 @@ +ClassName=GroupwarePrefs +File=kresources_kabc_groupware.kcfg +GlobalEnums=true +IncludeFiles=libkdepim/kresourceprefs.h +Inherits=KResourcePrefs +Mutators=true +NameSpace=KABC +Singleton=false diff --git a/kresources/groupware/kabc_resourcegroupware.cpp b/kresources/groupware/kabc_resourcegroupware.cpp new file mode 100644 index 000000000..722024adf --- /dev/null +++ b/kresources/groupware/kabc_resourcegroupware.cpp @@ -0,0 +1,363 @@ +/* + This file is part of kdepim. + + 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 <qapplication.h> + +#include <kabc/addressee.h> +#include <kabc/vcardconverter.h> +#include <kconfig.h> +#include <kdebug.h> +#include <klocale.h> + +#include <libkdepim/groupwarejob.h> + +#include "kabc_groupwareprefs.h" + +#include "kabc_resourcegroupware.h" + +using namespace KABC; + +ResourceGroupware::ResourceGroupware( const KConfig *config ) + : ResourceCached( config ) +{ + init(); + + mPrefs->addGroupPrefix( identifier() ); + + if ( config ) { + readConfig( config ); + } +} + +ResourceGroupware::ResourceGroupware( const KURL &url, + const QString &user, + const QString &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 KConfig * ) +{ + mPrefs->readConfig(); + + readAddressBooks(); +} + +void ResourceGroupware::writeConfig( KConfig *config ) +{ + Resource::writeConfig( config ); + + writeAddressBooks(); + + mPrefs->writeConfig(); +} + +void ResourceGroupware::readAddressBooks() +{ +#if 0 + QStringList ids = prefs()->ids(); + QStringList names = prefs()->names(); + QStringList personals = prefs()->personals(); + QStringList 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 + QStringList ids; + QStringList names; + QStringList personals; + QStringList 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 ) { + QStringList reads; + QString 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 + QString query = "?"; + QStringList ids = mPrefs->readAddressBooks(); + QStringList::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 = QString::null; + + mDownloadJob = KPIM::GroupwareJob::getAddressBook( url ); + connect( mDownloadJob, SIGNAL( result( KIO::Job * ) ), + SLOT( slotJobResult( KIO::Job * ) ) ); + connect( mDownloadJob, SIGNAL( data( KIO::Job *, const QByteArray & ) ), + SLOT( slotJobData( KIO::Job *, const QByteArray & ) ) ); + connect( mDownloadJob, SIGNAL( percent( KIO::Job *, unsigned long ) ), + SLOT( slotJobPercent( KIO::Job *, unsigned long ) ) ); + + mProgress = KPIM::ProgressManager::instance()->createProgressItem( + KPIM::ProgressManager::getUniqueID(), i18n("Downloading addressbook") ); + connect( mProgress, + SIGNAL( progressItemCanceled( KPIM::ProgressItem * ) ), + 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( KIO::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 ); + + QString remote = addr.custom( "GWRESOURCE", "UID" ); + QString 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( KIO::Job *, const QByteArray &data ) +{ +// kdDebug() << "ResourceGroupware::slotJobData()" << endl; + + mJobData.append( data.data() ); +} + +void ResourceGroupware::slotJobPercent( KIO::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/kresources/groupware/kabc_resourcegroupware.h b/kresources/groupware/kabc_resourcegroupware.h new file mode 100644 index 000000000..cea679f39 --- /dev/null +++ b/kresources/groupware/kabc_resourcegroupware.h @@ -0,0 +1,86 @@ +/* + This file is part of kdepim. + + 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 <libkdepim/progressmanager.h> + +#include <kio/job.h> + +class KConfig; + +namespace KABC { + +class GroupwarePrefs; + +class ResourceGroupware : public ResourceCached +{ + Q_OBJECT + + public: + ResourceGroupware( const KConfig * ); + ResourceGroupware( const KURL &url, + const QString &user, const QString &password ); + ~ResourceGroupware(); + + void readConfig( const KConfig * ); + void writeConfig( KConfig * ); + + 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( KIO::Job * ); + void slotJobData( KIO::Job *, const QByteArray & ); + void slotJobPercent( KIO::Job *job, unsigned long percent ); + + void cancelLoad(); + + private: + GroupwarePrefs *mPrefs; + + KIO::TransferJob *mDownloadJob; + KPIM::ProgressItem *mProgress; + QString mJobData; +}; + +} + +#endif diff --git a/kresources/groupware/kabc_resourcegroupware_plugin.cpp b/kresources/groupware/kabc_resourcegroupware_plugin.cpp new file mode 100644 index 000000000..b486f7839 --- /dev/null +++ b/kresources/groupware/kabc_resourcegroupware_plugin.cpp @@ -0,0 +1,39 @@ +/* + This file is part of kdepim. + + 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() + { + KGlobal::locale()->insertCatalogue( "libkcal" ); + KGlobal::locale()->insertCatalogue( "kres_groupware" ); + return new ResourceGroupware; + } +} diff --git a/kresources/groupware/kabc_resourcegroupwareconfig.cpp b/kresources/groupware/kabc_resourcegroupwareconfig.cpp new file mode 100644 index 000000000..8cb656a93 --- /dev/null +++ b/kresources/groupware/kabc_resourcegroupwareconfig.cpp @@ -0,0 +1,208 @@ +/* + This file is part of kdepim. + + 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 <qlabel.h> +#include <qlayout.h> + +using namespace KABC; + +class AddressBookItem : public QCheckListItem +{ + public: + AddressBookItem( KListView *parent, const QString &id ) + : QCheckListItem( 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 + } + + QString id() const { return mId; } + + private: + QString mId; +}; + +ResourceGroupwareConfig::ResourceGroupwareConfig( QWidget* parent, const char* name ) + : KRES::ConfigWidget( parent, name ) +{ + QGridLayout *mainLayout = new QGridLayout( this, 7, 2, 0, KDialog::spacingHint() ); + + QLabel *label = new QLabel( i18n( "URL:" ), this ); + mURL = new KURLRequester( this ); + + mainLayout->addWidget( label, 0, 0 ); + mainLayout->addWidget( mURL, 0, 1 ); + + label = new QLabel( i18n( "User:" ), this ); + mUser = new KLineEdit( this ); + + mainLayout->addWidget( label, 1, 0 ); + mainLayout->addWidget( mUser, 1, 1 ); + + label = new QLabel( i18n( "Password:" ), this ); + mPassword = new KLineEdit( this ); + mPassword->setEchoMode( QLineEdit::Password ); + + mainLayout->addWidget( label, 2, 0 ); + mainLayout->addWidget( mPassword, 2, 1 ); + + QFrame *hline = new QFrame( this ); + hline->setFrameStyle( QFrame::HLine | QFrame::Sunken ); + + mainLayout->addMultiCellWidget( hline, 3, 3, 0, 1 ); + + QPushButton *updateButton = new QPushButton( 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 QLabel( i18n( "Address book for new contacts:" ), this ); + mAddressBookBox = new KComboBox( this ); + + mainLayout->addWidget( label, 6, 0 ); + mainLayout->addWidget( mAddressBookBox, 6, 1 ); + + connect( updateButton, SIGNAL( clicked() ), 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 + QStringList selectedRead; + QString selectedWrite; + + QListViewItemIterator 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 + QStringList 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/kresources/groupware/kabc_resourcegroupwareconfig.h b/kresources/groupware/kabc_resourcegroupwareconfig.h new file mode 100644 index 000000000..f8df15bc4 --- /dev/null +++ b/kresources/groupware/kabc_resourcegroupwareconfig.h @@ -0,0 +1,70 @@ +/* + This file is part of kdepim. + + 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 <kresources/configwidget.h> + +#include <qmap.h> + +class KComboBox; +class KLineEdit; +class KListView; +class KURLRequester; + +namespace KABC { + +class ResourceGroupware; + +class ResourceGroupwareConfig : public KRES::ConfigWidget +{ + Q_OBJECT + + public: + ResourceGroupwareConfig( QWidget* 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; + + QStringList mWriteAddressBookIds; + + ResourceGroupware *mResource; +}; + +} + +#endif diff --git a/kresources/groupware/kcal_groupware.desktop b/kresources/groupware/kcal_groupware.desktop new file mode 100644 index 000000000..0b43536be --- /dev/null +++ b/kresources/groupware/kcal_groupware.desktop @@ -0,0 +1,50 @@ +[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[ka]=სერვერი Groupware +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-KDE-Library=kcal_groupware +Type=Service +ServiceTypes=KResources/Plugin +X-KDE-ResourceFamily=calendar +X-KDE-ResourceType=groupware diff --git a/kresources/groupware/kcal_groupwareprefsbase.kcfgc b/kresources/groupware/kcal_groupwareprefsbase.kcfgc new file mode 100644 index 000000000..d784aa576 --- /dev/null +++ b/kresources/groupware/kcal_groupwareprefsbase.kcfgc @@ -0,0 +1,11 @@ +# Code generation options for kconfig_compiler +File=kresources_kcal_groupware.kcfg +ClassName=GroupwarePrefsBase +NameSpace=KCal +Singleton=false +Mutators=true +Inherits=KResourcePrefs +IncludeFiles=libkdepim/kresourceprefs.h +GlobalEnums=true +#ItemAccessors=true +#SetUserTexts=true diff --git a/kresources/groupware/kcal_resourcegroupware.cpp b/kresources/groupware/kcal_resourcegroupware.cpp new file mode 100644 index 000000000..9adbffdd7 --- /dev/null +++ b/kresources/groupware/kcal_resourcegroupware.cpp @@ -0,0 +1,300 @@ +/* + This file is part of kdepim. + + 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 <qapplication.h> +#include <qdatetime.h> +#include <qptrlist.h> +#include <qstringlist.h> +#include <qtimer.h> + +#include <kabc/locknull.h> +#include <kdebug.h> +#include <klocale.h> +#include <kresources/configwidget.h> +#include <kstandarddirs.h> +#include <kstringhandler.h> +#include <kurl.h> +#include <libkdepim/kpimprefs.h> +#include <libkdepim/groupwarejob.h> + +using namespace KCal; + +ResourceGroupware::ResourceGroupware() + : ResourceCached( 0 ), mLock( true ), + mProgress( 0 ) +{ + init(); + + mPrefs->addGroupPrefix( identifier() ); +} + +ResourceGroupware::ResourceGroupware( const KConfig *config ) + : ResourceCached( config ), mLock( true ) +{ + init(); + + mPrefs->addGroupPrefix( identifier() ); + + if ( config ) readConfig( config ); +} + +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 KConfig *config ) +{ + kdDebug() << "KCal::ResourceGroupware::readConfig()" << endl; + + mPrefs->readConfig(); + + ResourceCached::readConfig( config ); +} + +void ResourceGroupware::writeConfig( KConfig *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 = QString::null; + + mDownloadJob = KPIM::GroupwareJob::getCalendar( url ); + connect( mDownloadJob, SIGNAL( result( KIO::Job * ) ), + SLOT( slotJobResult( KIO::Job * ) ) ); + connect( mDownloadJob, SIGNAL( data( KIO::Job *, const QByteArray & ) ), + SLOT( slotJobData( KIO::Job *, const QByteArray & ) ) ); + + mProgress = KPIM::ProgressManager::instance()->createProgressItem( + KPIM::ProgressManager::getUniqueID(), i18n("Downloading calendar") ); + connect( mProgress, + SIGNAL( progressItemCanceled( KPIM::ProgressItem * ) ), + SLOT( cancelLoad() ) ); + + return true; +} + +void ResourceGroupware::slotJobResult( KIO::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(); + QString remote = (*it)->customProperty( "GWRESOURCE", "UID" ); + QString 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( KIO::Job *, const QByteArray &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 == QDialog::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/kresources/groupware/kcal_resourcegroupware.h b/kresources/groupware/kcal_resourcegroupware.h new file mode 100644 index 000000000..7ddece926 --- /dev/null +++ b/kresources/groupware/kcal_resourcegroupware.h @@ -0,0 +1,90 @@ + /* + This file is part of kdepim. + + 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 <libkdepim/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 KConfig * ); + virtual ~ResourceGroupware(); + + void readConfig( const KConfig *config ); + void writeConfig( KConfig *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( KIO::Job * ); + void slotJobData( KIO::Job *, const QByteArray & ); + + void cancelLoad(); + + private: + GroupwarePrefsBase *mPrefs; + KABC::LockNull mLock; + + KIO::TransferJob *mDownloadJob; + KPIM::ProgressItem *mProgress; + QString mJobData; + + bool mIsShowingError; +}; + +} + +#endif diff --git a/kresources/groupware/kcal_resourcegroupware_plugin.cpp b/kresources/groupware/kcal_resourcegroupware_plugin.cpp new file mode 100644 index 000000000..a30f47a94 --- /dev/null +++ b/kresources/groupware/kcal_resourcegroupware_plugin.cpp @@ -0,0 +1,40 @@ +/* + This file is part of kdepim. + + 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() + { + KGlobal::locale()->insertCatalogue( "libkcal" ); + KGlobal::locale()->insertCatalogue( "kres_groupware" ); + return new ResourceGroupware; + } +} diff --git a/kresources/groupware/kcal_resourcegroupwareconfig.cpp b/kresources/groupware/kcal_resourcegroupwareconfig.cpp new file mode 100644 index 000000000..d0581182d --- /dev/null +++ b/kresources/groupware/kcal_resourcegroupwareconfig.cpp @@ -0,0 +1,105 @@ +/* + This file is part of kdepim. + + 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 <qlabel.h> +#include <qlayout.h> +#include <qcheckbox.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( QWidget* parent, const char* name ) + : KRES::ConfigWidget( parent, name ) +{ + resize( 245, 115 ); + QGridLayout *mainLayout = new QGridLayout( this, 2, 2 ); + + QLabel *label = new QLabel( i18n("URL:"), this ); + mainLayout->addWidget( label, 1, 0 ); + mUrl = new KLineEdit( this ); + mainLayout->addWidget( mUrl, 1, 1 ); + + label = new QLabel( i18n("User:"), this ); + mainLayout->addWidget( label, 2, 0 ); + mUserEdit = new KLineEdit( this ); + mainLayout->addWidget( mUserEdit, 2, 1 ); + + label = new QLabel( 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/kresources/groupware/kcal_resourcegroupwareconfig.h b/kresources/groupware/kcal_resourcegroupwareconfig.h new file mode 100644 index 000000000..ab2fd424d --- /dev/null +++ b/kresources/groupware/kcal_resourcegroupwareconfig.h @@ -0,0 +1,62 @@ +/* + This file is part of kdepim. + + 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 <kresources/resource.h> +#include <kresources/configwidget.h> + +class QCheckBox; +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( QWidget *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/kresources/groupware/kresources_kabc_groupware.kcfg b/kresources/groupware/kresources_kabc_groupware.kcfg new file mode 100644 index 000000000..33dd7aa83 --- /dev/null +++ b/kresources/groupware/kresources_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="kresources_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/kresources/groupware/kresources_kcal_groupware.kcfg b/kresources/groupware/kresources_kcal_groupware.kcfg new file mode 100644 index 000000000..d86a43b59 --- /dev/null +++ b/kresources/groupware/kresources_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="kresources_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> |