diff options
Diffstat (limited to 'kresources/remote')
-rw-r--r-- | kresources/remote/Makefile.am | 26 | ||||
-rw-r--r-- | kresources/remote/remote.desktop | 58 | ||||
-rw-r--r-- | kresources/remote/resourceremote.cpp | 336 | ||||
-rw-r--r-- | kresources/remote/resourceremote.h | 131 | ||||
-rw-r--r-- | kresources/remote/resourceremote_plugin.cpp | 41 | ||||
-rw-r--r-- | kresources/remote/resourceremoteconfig.cpp | 101 | ||||
-rw-r--r-- | kresources/remote/resourceremoteconfig.h | 68 |
7 files changed, 761 insertions, 0 deletions
diff --git a/kresources/remote/Makefile.am b/kresources/remote/Makefile.am new file mode 100644 index 000000000..52a45e8bd --- /dev/null +++ b/kresources/remote/Makefile.am @@ -0,0 +1,26 @@ +INCLUDES = -I$(top_srcdir) $(all_includes) + +lib_LTLIBRARIES = libkcal_resourceremote.la +libkcal_resourceremote_la_LDFLAGS = $(all_libraries) -no-undefined \ + -version-info 1:0:0 +libkcal_resourceremote_la_LIBADD = $(top_builddir)/libkcal/libkcal.la \ + $(top_builddir)/libkdepim/libkdepim.la +libkcal_resourceremote_la_SOURCES = resourceremote.cpp resourceremoteconfig.cpp + +kde_module_LTLIBRARIES = kcal_remote.la + +kcal_remote_la_SOURCES = resourceremote_plugin.cpp +kcal_remote_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +kcal_remote_la_LIBADD = libkcal_resourceremote.la \ + $(top_builddir)/libkdepim/libkdepim.la + +libkcalincludedir = $(includedir)/libkcal +libkcalinclude_HEADERS = resourceremoteconfig.h resourceremote.h + +servicedir = $(kde_servicesdir)/kresources/kcal +service_DATA = remote.desktop + +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kres_remote.pot diff --git a/kresources/remote/remote.desktop b/kresources/remote/remote.desktop new file mode 100644 index 000000000..66a1542af --- /dev/null +++ b/kresources/remote/remote.desktop @@ -0,0 +1,58 @@ +[Desktop Entry] +Name=Calendar in Remote File +Name[af]=Kalender in 'n afgeleë lêer +Name[bg]=Календар в отдалечен файл +Name[br]=Deiziadur e restr a-bell +Name[bs]=Kalendar u udaljenoj datoteci +Name[ca]=Calendari a un fitxer remot +Name[cs]=Kalendář ve vzdáleném souboru +Name[cy]=Calendr mewn Ffeil Pell +Name[da]=Kalender i ekstern fil +Name[de]=Kalender in Datei auf Fremdrechner +Name[el]=Ημερολόγιο σε απομακρυσμένο αρχείο +Name[es]=Calendario en un archivo remoto +Name[et]=Kalender võrgufailis +Name[eu]=Egutegia urruneko fitxategi batean +Name[fa]=تقویم در پروندۀ دور +Name[fi]=Kalenteri etätiedostossa +Name[fr]=Calendrier dans un fichier distant +Name[fy]=Aginda yn ekstern triem +Name[ga]=Féilire i gCianchomhad +Name[gl]=Calendario en ficheiro remoto +Name[hi]=रिमोट फ़ाइल में कैलेन्डर +Name[hu]=Távoli fájlban tárolt naptár +Name[is]=Dagatal í fjarlægri skrá +Name[it]=Calendario in file remoto +Name[ja]=リモートファイルのカレンダー +Name[ka]=კალენდარი გარე ფაილზე +Name[kk]=Қашықтағы файлдағы күнтізбе +Name[km]=ប្រតិទិននៅក្នុងឯកសារនៅឆ្ងាយ +Name[lt]=Kalendorius nutolusioje byloje +Name[mk]=Календар во оддалечена датотека +Name[ms]=Kalendar dalam Fail Jauh +Name[nb]=Kalender i fil på nettverk +Name[nds]=Kalenner as Datei op en anner Reekner +Name[ne]=टाढाको फाइलको क्यालेन्डर +Name[nl]=Agenda in extern bestand +Name[nn]=Kalender i ekstern fil +Name[pl]=Kalendarz w pliku zdalnym +Name[pt]=Calendário num Ficheiro Remoto +Name[pt_BR]=Calendário em Arquivo Remoto +Name[ro]=Calendar în fişier distant +Name[ru]=Календарь во внешнем файле +Name[sk]=Kalendár vo vzdialenom súbore +Name[sl]=Koledar v oddaljeni datoteki +Name[sr]=Календар у удаљеном фајлу +Name[sr@Latn]=Kalendar u udaljenom fajlu +Name[sv]=Kalender i fjärrfil +Name[ta]=தொலைதூர கோப்பில் உள்ள நாள்காட்டி +Name[tg]=Тақвимот дар файли хурӯҷӣ +Name[tr]=Uzak Dosyadaki Takvim +Name[uk]=Календар у віддаленому файлі +Name[zh_CN]=远程文件中的日历 +Name[zh_TW]=遠端檔案的行事曆 +X-KDE-Library=kcal_remote +Type=Service +ServiceTypes=KResources/Plugin +X-KDE-ResourceFamily=calendar +X-KDE-ResourceType=remote diff --git a/kresources/remote/resourceremote.cpp b/kresources/remote/resourceremote.cpp new file mode 100644 index 000000000..3c9db7695 --- /dev/null +++ b/kresources/remote/resourceremote.cpp @@ -0,0 +1,336 @@ +/* + This file is part of libkcal. + + Copyright (c) 2003,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 <typeinfo> +#include <stdlib.h> + +#include <qdatetime.h> +#include <qstring.h> +#include <qptrlist.h> + +#include <kdebug.h> +#include <kurl.h> +#include <kio/job.h> +#include <klocale.h> +#include <kstandarddirs.h> + +#include <libkcal/icalformat.h> +#include <libkcal/exceptions.h> +#include <libkcal/incidence.h> +#include <libkcal/event.h> +#include <libkcal/todo.h> +#include <libkcal/journal.h> +#include <libkcal/filestorage.h> + +#include <kabc/lock.h> + +#include <kresources/configwidget.h> + +#include "resourceremoteconfig.h" + +#include "resourceremote.h" + +using namespace KCal; + +ResourceRemote::ResourceRemote( const KConfig *config ) + : ResourceCached( config ), mUseProgressManager( true ), mUseCacheFile( true ) +{ + if ( config ) { + readConfig( config ); + } + + init(); +} + +ResourceRemote::ResourceRemote( const KURL &downloadUrl, const KURL &uploadUrl ) + : ResourceCached( 0 ), mUseProgressManager( false ), mUseCacheFile( false ) +{ + mDownloadUrl = downloadUrl; + + if ( uploadUrl.isEmpty() ) { + mUploadUrl = mDownloadUrl; + } else { + mUploadUrl = uploadUrl; + } + + init(); +} + +ResourceRemote::~ResourceRemote() +{ + close(); + + if ( mDownloadJob ) mDownloadJob->kill(); + if ( mUploadJob ) mUploadJob->kill(); + + delete mLock; +} + +void ResourceRemote::init() +{ + mDownloadJob = 0; + mUploadJob = 0; + + mProgress = 0; + + setType( "remote" ); + + mLock = new KABC::Lock( cacheFile() ); + + enableChangeNotification(); +} + +void ResourceRemote::readConfig( const KConfig *config ) +{ + QString url = config->readEntry( "DownloadUrl" ); + mDownloadUrl = KURL( url ); + + url = config->readEntry( "UploadUrl" ); + mUploadUrl = KURL( url ); + + ResourceCached::readConfig( config ); +} + +void ResourceRemote::writeConfig( KConfig *config ) +{ + kdDebug(5800) << "ResourceRemote::writeConfig()" << endl; + + ResourceCalendar::writeConfig( config ); + + config->writeEntry( "DownloadUrl", mDownloadUrl.url() ); + config->writeEntry( "UploadUrl", mUploadUrl.url() ); + + ResourceCached::writeConfig( config ); +} + +void ResourceRemote::setDownloadUrl( const KURL &url ) +{ + mDownloadUrl = url; +} + +KURL ResourceRemote::downloadUrl() const +{ + return mDownloadUrl; +} + +void ResourceRemote::setUploadUrl( const KURL &url ) +{ + mUploadUrl = url; +} + +KURL ResourceRemote::uploadUrl() const +{ + return mUploadUrl; +} + +void ResourceRemote::setUseProgressManager( bool useProgressManager ) +{ + mUseProgressManager = useProgressManager; +} + +bool ResourceRemote::useProgressManager() const +{ + return mUseProgressManager; +} + +void ResourceRemote::setUseCacheFile( bool useCacheFile ) +{ + mUseCacheFile = useCacheFile; +} + +bool ResourceRemote::useCacheFile() const +{ + return mUseCacheFile; +} + +bool ResourceRemote::doLoad() +{ + kdDebug(5800) << "ResourceRemote::load()" << endl; + + if ( mDownloadJob ) { + kdWarning() << "ResourceRemote::load(): download still in progress." + << endl; + return true; + } + if ( mUploadJob ) { + kdWarning() << "ResourceRemote::load(): upload still in progress." + << endl; + return false; + } + + mCalendar.close(); + + if ( mUseCacheFile ) { + disableChangeNotification(); + loadCache(); + enableChangeNotification(); + } + + clearChanges(); + + emit resourceChanged( this ); + + if ( mLock->lock() ) + { + kdDebug() << "Download from: " << mDownloadUrl << endl; + + mDownloadJob = KIO::file_copy( mDownloadUrl, KURL( cacheFile() ), -1, true, + false, !mUseProgressManager ); + connect( mDownloadJob, SIGNAL( result( KIO::Job * ) ), + SLOT( slotLoadJobResult( KIO::Job * ) ) ); + if ( mUseProgressManager ) { + connect( mDownloadJob, SIGNAL( percent( KIO::Job *, unsigned long ) ), + SLOT( slotPercent( KIO::Job *, unsigned long ) ) ); + mProgress = KPIM::ProgressManager::createProgressItem( + KPIM::ProgressManager::getUniqueID(), i18n("Downloading Calendar") ); + + mProgress->setProgress( 0 ); + } + } + else + kdDebug() << "ResourceRemote::load(): cache file is locked - something else must be loading the file" << endl; + return true; +} + +void ResourceRemote::slotPercent( KIO::Job *, unsigned long percent ) +{ + kdDebug() << "ResourceRemote::slotPercent(): " << percent << endl; + + mProgress->setProgress( percent ); +} + +void ResourceRemote::slotLoadJobResult( KIO::Job *job ) +{ + if ( job->error() ) { + job->showErrorDialog( 0 ); + } else { + kdDebug(5800) << "ResourceRemote::slotLoadJobResult() success" << endl; + + mCalendar.close(); + disableChangeNotification(); + loadCache(); + enableChangeNotification(); + + emit resourceChanged( this ); + } + + mDownloadJob = 0; + if ( mProgress ) { + mProgress->setComplete(); + mProgress = 0; + } + + mLock->unlock(); + emit resourceLoaded( this ); +} + +bool ResourceRemote::doSave() +{ + kdDebug(5800) << "ResourceRemote::save()" << endl; + + if ( readOnly() || !hasChanges() ) { + emit resourceSaved( this ); + return true; + } + + if ( mDownloadJob ) { + kdWarning() << "ResourceRemote::save(): download still in progress." + << endl; + return false; + } + if ( mUploadJob ) { + kdWarning() << "ResourceRemote::save(): upload still in progress." + << endl; + return false; + } + + mChangedIncidences = allChanges(); + + saveCache(); + + mUploadJob = KIO::file_copy( KURL( cacheFile() ), mUploadUrl, -1, true ); + connect( mUploadJob, SIGNAL( result( KIO::Job * ) ), + SLOT( slotSaveJobResult( KIO::Job * ) ) ); + + return true; +} + +bool ResourceRemote::isSaving() +{ + return mUploadJob; +} + +void ResourceRemote::slotSaveJobResult( KIO::Job *job ) +{ + if ( job->error() ) { + job->showErrorDialog( 0 ); + } else { + kdDebug(5800) << "ResourceRemote::slotSaveJobResult() success" << endl; + + Incidence::List::ConstIterator it; + for( it = mChangedIncidences.begin(); it != mChangedIncidences.end(); + ++it ) { + clearChange( *it ); + } + mChangedIncidences.clear(); + } + + mUploadJob = 0; + + emit resourceSaved( this ); +} + +KABC::Lock *ResourceRemote::lock() +{ + return mLock; +} + +void ResourceRemote::dump() const +{ + ResourceCalendar::dump(); + kdDebug(5800) << " DownloadUrl: " << mDownloadUrl.url() << endl; + kdDebug(5800) << " UploadUrl: " << mUploadUrl.url() << endl; + kdDebug(5800) << " ReloadPolicy: " << reloadPolicy() << endl; +} + +void ResourceRemote::addInfoText( QString &txt ) const +{ + txt += "<br>"; + txt += i18n("URL: %1").arg( mDownloadUrl.prettyURL() ); +} + +bool ResourceRemote::setValue( const QString &key, const QString &value ) +{ + if ( key == "URL" ) { + setUploadUrl( KURL( value ) ); + setDownloadUrl( KURL( value ) ); + return true; + } else if ( key == "DownloadURL" ) { + setDownloadUrl( KURL( value ) ); + return true; + } else if ( key == "UploadURL" ) { + setUploadUrl( KURL( value ) ); + return true; + } else + return ResourceCached::setValue( key, value ); +} + +#include "resourceremote.moc" diff --git a/kresources/remote/resourceremote.h b/kresources/remote/resourceremote.h new file mode 100644 index 000000000..5d32b0fc6 --- /dev/null +++ b/kresources/remote/resourceremote.h @@ -0,0 +1,131 @@ + /* + This file is part of libkcal. + + Copyright (c) 2003 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_RESOURCEREMOTEDIR_H +#define KCAL_RESOURCEREMOTEDIR_H + +#include <qptrlist.h> +#include <qstring.h> +#include <qdatetime.h> + +#include <kurl.h> +#include <kconfig.h> +#include <kdirwatch.h> +#include <kdepimmacros.h> + +#include <libkdepim/progressmanager.h> + +#include <libkcal/incidence.h> +#include <libkcal/calendarlocal.h> +#include <libkcal/icalformat.h> + +#include <libkcal/resourcecached.h> + +namespace KIO { +class FileCopyJob; +class Job; +} + +namespace KCal { + +/** + This class provides a calendar stored as a remote file. +*/ +class KDE_EXPORT ResourceRemote : public ResourceCached +{ + Q_OBJECT + + friend class ResourceRemoteConfig; + + public: + /** + Create resource from configuration information stored in KConfig object. + */ + ResourceRemote( const KConfig * ); + /** + Create remote resource. + + @param downloadUrl URL used to download iCalendar file + @param uploadUrl URL used to upload iCalendar file + */ + ResourceRemote( const KURL &downloadUrl, const KURL &uploadUrl = KURL() ); + virtual ~ResourceRemote(); + + void readConfig( const KConfig *config ); + void writeConfig( KConfig *config ); + + void setDownloadUrl( const KURL & ); + KURL downloadUrl() const; + + void setUploadUrl( const KURL & ); + KURL uploadUrl() const; + + void setUseProgressManager( bool useProgressManager ); + bool useProgressManager() const; + + void setUseCacheFile( bool useCacheFile ); + bool useCacheFile() const; + + KABC::Lock *lock(); + + bool isSaving(); + + void dump() const; + + bool setValue( const QString &key, const QString &value ); + + + protected slots: + void slotLoadJobResult( KIO::Job * ); + void slotSaveJobResult( KIO::Job * ); + + void slotPercent( KIO::Job *, unsigned long percent ); + + protected: + bool doLoad(); + bool doSave(); + + void addInfoText( QString & ) const; + + private: + void init(); + + KURL mDownloadUrl; + KURL mUploadUrl; + + bool mUseProgressManager; + bool mUseCacheFile; + + KIO::FileCopyJob *mDownloadJob; + KIO::FileCopyJob *mUploadJob; + + KPIM::ProgressItem *mProgress; + + Incidence::List mChangedIncidences; + + KABC::Lock *mLock; + + class Private; + Private *d; +}; + +} + +#endif diff --git a/kresources/remote/resourceremote_plugin.cpp b/kresources/remote/resourceremote_plugin.cpp new file mode 100644 index 000000000..85e6363e5 --- /dev/null +++ b/kresources/remote/resourceremote_plugin.cpp @@ -0,0 +1,41 @@ +/* + This file is part of libkcal. + + Copyright (c) 2003 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 "resourceremoteconfig.h" +#include "resourceremote.h" + +#include <kglobal.h> +#include <klocale.h> + +using namespace KCal; + +typedef KRES::PluginFactory<ResourceRemote,ResourceRemoteConfig> RemoteFactory; +// FIXME: Use K_EXPORT_COMPONENT_FACTORY( kcal_remote, RemoteFactory ); here +// Problem: How do I insert the catalogue??? +extern "C" +{ + void *init_kcal_remote() + { + KGlobal::locale()->insertCatalogue( "libkcal" ); + KGlobal::locale()->insertCatalogue( "kres_remote" ); + return new RemoteFactory; + } +} diff --git a/kresources/remote/resourceremoteconfig.cpp b/kresources/remote/resourceremoteconfig.cpp new file mode 100644 index 000000000..3128eaade --- /dev/null +++ b/kresources/remote/resourceremoteconfig.cpp @@ -0,0 +1,101 @@ +/* + This file is part of libkcal. + + Copyright (c) 2003,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 <typeinfo> + +#include <qlabel.h> +#include <qlayout.h> + +#include <klocale.h> +#include <kdebug.h> +#include <kmessagebox.h> +#include <kstandarddirs.h> +#include <kdialog.h> + +#include <libkcal/resourcecachedconfig.h> + +#include "resourceremote.h" + +#include "resourceremoteconfig.h" + +using namespace KCal; + +ResourceRemoteConfig::ResourceRemoteConfig( QWidget* parent, const char* name ) + : KRES::ConfigWidget( parent, name ) +{ + resize( 245, 115 ); + QGridLayout *mainLayout = new QGridLayout( this, 2, 2 ); + mainLayout->setSpacing( KDialog::spacingHint() ); + + QLabel *label = new QLabel( i18n( "Download from:" ), this ); + + mDownloadUrl = new KURLRequester( this ); + mDownloadUrl->setMode( KFile::File ); + mainLayout->addWidget( label, 1, 0 ); + mainLayout->addWidget( mDownloadUrl, 1, 1 ); + + label = new QLabel( i18n( "Upload to:" ), this ); + mUploadUrl = new KURLRequester( this ); + mUploadUrl->setMode( KFile::File ); + mainLayout->addWidget( label, 2, 0 ); + mainLayout->addWidget( mUploadUrl, 2, 1 ); + + mReloadConfig = new ResourceCachedReloadConfig( this ); + mainLayout->addMultiCellWidget( mReloadConfig, 3, 3, 0, 1 ); + + mSaveConfig = new ResourceCachedSaveConfig( this ); + mainLayout->addMultiCellWidget( mSaveConfig, 4, 4, 0, 1 ); +} + +void ResourceRemoteConfig::loadSettings( KRES::Resource *resource ) +{ + ResourceRemote *res = static_cast<ResourceRemote *>( resource ); + if ( res ) { + mDownloadUrl->setURL( res->downloadUrl().url() ); + mUploadUrl->setURL( res->uploadUrl().url() ); + mReloadConfig->loadSettings( res ); + mSaveConfig->loadSettings( res ); + } else { + kdError(5700) << "ResourceRemoteConfig::loadSettings(): no ResourceRemote, cast failed" << endl; + } +} + +void ResourceRemoteConfig::saveSettings( KRES::Resource *resource ) +{ + ResourceRemote* res = static_cast<ResourceRemote*>( resource ); + if ( res ) { + res->setDownloadUrl( KURL( mDownloadUrl->url() ) ); + res->setUploadUrl( KURL( mUploadUrl->url() ) ); + mReloadConfig->saveSettings( res ); + mSaveConfig->saveSettings( res ); + + + if ( mUploadUrl->url().isEmpty() && !resource->readOnly() ) { + KMessageBox::information( this, i18n( "You have specified no upload URL, " + "the calendar will be read-only." ), "RemoteResourseNoUploadURL" ); + resource->setReadOnly( true ); + } + } else { + kdError(5700) << "ResourceRemoteConfig::saveSettings(): no ResourceRemote, cast failed" << endl; + } +} + +#include "resourceremoteconfig.moc" diff --git a/kresources/remote/resourceremoteconfig.h b/kresources/remote/resourceremoteconfig.h new file mode 100644 index 000000000..a102bd0bd --- /dev/null +++ b/kresources/remote/resourceremoteconfig.h @@ -0,0 +1,68 @@ +/* + This file is part of libkcal. + + Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> + Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> + 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_RESOURCEREMOTECONFIG_H +#define KCAL_RESOURCEREMOTECONFIG_H + +#include <qradiobutton.h> +#include <qbuttongroup.h> +#include <kurlrequester.h> + +#include <kresources/resource.h> +#include <kresources/configwidget.h> + +#include <kdepimmacros.h> + +namespace KCal { + +class ResourceCachedReloadConfig; +class ResourceCachedSaveConfig; + +/** + Configuration widget for remote resource. + + @see ResourceRemote +*/ +class KDE_EXPORT ResourceRemoteConfig : public KRES::ConfigWidget +{ + Q_OBJECT + public: + ResourceRemoteConfig( QWidget *parent = 0, const char *name = 0 ); + + public slots: + virtual void loadSettings( KRES::Resource *resource ); + virtual void saveSettings( KRES::Resource *resource ); + + private: + KURLRequester *mDownloadUrl; + KURLRequester *mUploadUrl; + + ResourceCachedReloadConfig *mReloadConfig; + ResourceCachedSaveConfig *mSaveConfig; + + class Private; + Private *d; +}; + +} + +#endif |