diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-26 13:17:50 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-26 13:17:50 -0600 |
commit | b363d2579af0a11b77e698aed2e1021c2233b644 (patch) | |
tree | f4a47b87354b7a6a3b266c8121bd8ddaeb7accaa /kresources/remote | |
parent | 61bddfe3a7226b18c68a76124b727c736f431688 (diff) | |
download | tdepim-b363d2579af0a11b77e698aed2e1021c2233b644.tar.gz tdepim-b363d2579af0a11b77e698aed2e1021c2233b644.zip |
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'kresources/remote')
-rw-r--r-- | kresources/remote/CMakeLists.txt | 56 | ||||
-rw-r--r-- | kresources/remote/Makefile.am | 26 | ||||
-rw-r--r-- | kresources/remote/remote.desktop | 57 | ||||
-rw-r--r-- | kresources/remote/resourceremote.cpp | 352 | ||||
-rw-r--r-- | kresources/remote/resourceremote.h | 132 | ||||
-rw-r--r-- | kresources/remote/resourceremote_plugin.cpp | 41 | ||||
-rw-r--r-- | kresources/remote/resourceremoteconfig.cpp | 101 | ||||
-rw-r--r-- | kresources/remote/resourceremoteconfig.h | 69 |
8 files changed, 0 insertions, 834 deletions
diff --git a/kresources/remote/CMakeLists.txt b/kresources/remote/CMakeLists.txt deleted file mode 100644 index d1a4b57b1..000000000 --- a/kresources/remote/CMakeLists.txt +++ /dev/null @@ -1,56 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_SOURCE_DIR} - ${CMAKE_SOURCE_DIR}/libtdepim - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -##### headers ################################### - -install( FILES - resourceremoteconfig.h resourceremote.h - DESTINATION ${INCLUDE_INSTALL_DIR}/libkcal ) - - -##### other data ################################ - -install( FILES - remote.desktop - DESTINATION ${SERVICES_INSTALL_DIR}/kresources/kcal ) - - -##### kcal_remote (module) ###################### - -tde_add_kpart( kcal_remote AUTOMOC - SOURCES resourceremote_plugin.cpp - LINK kcal_resourceremote-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) - - -##### kcal_resourceremote (shared) ############## - -tde_add_library( kcal_resourceremote SHARED AUTOMOC - SOURCES - resourceremote.cpp resourceremoteconfig.cpp - VERSION 1.0.0 - LINK tdepim-shared - DESTINATION ${LIB_INSTALL_DIR} -) diff --git a/kresources/remote/Makefile.am b/kresources/remote/Makefile.am deleted file mode 100644 index a2dfe4f6f..000000000 --- a/kresources/remote/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -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)/libtdepim/libtdepim.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)/libtdepim/libtdepim.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 deleted file mode 100644 index 4b003173c..000000000 --- a/kresources/remote/remote.desktop +++ /dev/null @@ -1,57 +0,0 @@ -[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[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-TDE-Library=kcal_remote -Type=Service -ServiceTypes=KResources/Plugin -X-TDE-ResourceFamily=calendar -X-TDE-ResourceType=remote diff --git a/kresources/remote/resourceremote.cpp b/kresources/remote/resourceremote.cpp deleted file mode 100644 index 3803ecbef..000000000 --- a/kresources/remote/resourceremote.cpp +++ /dev/null @@ -1,352 +0,0 @@ -/* - 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 <tqdatetime.h> -#include <tqstring.h> -#include <tqptrlist.h> - -#include <kdebug.h> -#include <kurl.h> -#include <kio/job.h> -#include <klocale.h> -#include <kmessagebox.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 TDEConfig *config ) - : ResourceCached( config ), mUseProgressManager( true ), mUseCacheFile( true ) -{ - if ( config ) { - readConfig( config ); - } else { - setResourceName( i18n( "Remote Calendar" ) ); - } - - 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 TDEConfig *config ) -{ - TQString url = config->readEntry( "DownloadUrl" ); - mDownloadUrl = KURL( url ); - - url = config->readEntry( "UploadUrl" ); - mUploadUrl = KURL( url ); - - ResourceCached::readConfig( config ); -} - -void ResourceRemote::writeConfig( TDEConfig *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 = TDEIO::file_copy( mDownloadUrl, KURL( cacheFile() ), -1, true, - false, !mUseProgressManager ); - connect( mDownloadJob, TQT_SIGNAL( result( TDEIO::Job * ) ), - TQT_SLOT( slotLoadJobResult( TDEIO::Job * ) ) ); - if ( mUseProgressManager ) { - connect( mDownloadJob, TQT_SIGNAL( percent( TDEIO::Job *, unsigned long ) ), - TQT_SLOT( slotPercent( TDEIO::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( TDEIO::Job *, unsigned long percent ) -{ - kdDebug() << "ResourceRemote::slotPercent(): " << percent << endl; - - mProgress->setProgress( percent ); -} - -void ResourceRemote::slotLoadJobResult( TDEIO::Job *job ) -{ - if ( job->error() ) { - // TODO: Should detect 404, 401 etc. vs host not found and prompt to create new resource only when 404 is returned - TQString warningString = TQString("<b>") + i18n("Remote data access failure") + TQString("</b><p>") + i18n("Detailed information") \ - + TQString(":<br>") + job->errorString() + TQString("<p>") + i18n("What would you like to do?"); - int rc = KMessageBox::warningContinueCancel(0, - warningString, i18n("Remote Data Access Failure"), i18n("&Continue with cached resource")); - if ( rc == KMessageBox::Continue ) { - mCalendar.close(); - disableChangeNotification(); - loadCache(); - enableChangeNotification(); - - emit resourceChanged( this ); - } - //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 = TDEIO::file_copy( KURL( cacheFile() ), mUploadUrl, -1, true ); - connect( mUploadJob, TQT_SIGNAL( result( TDEIO::Job * ) ), - TQT_SLOT( slotSaveJobResult( TDEIO::Job * ) ) ); - - return true; -} - -bool ResourceRemote::isSaving() -{ - return mUploadJob; -} - -void ResourceRemote::slotSaveJobResult( TDEIO::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( TQString &txt ) const -{ - txt += "<br>"; - txt += i18n("URL: %1").arg( mDownloadUrl.prettyURL() ); -} - -bool ResourceRemote::setValue( const TQString &key, const TQString &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 deleted file mode 100644 index 2c3fd5fad..000000000 --- a/kresources/remote/resourceremote.h +++ /dev/null @@ -1,132 +0,0 @@ - /* - 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 <tqptrlist.h> -#include <tqstring.h> -#include <tqdatetime.h> - -#include <kurl.h> -#include <kconfig.h> -#include <kdirwatch.h> -#include <tdepimmacros.h> - -#include <libtdepim/progressmanager.h> - -#include <libkcal/incidence.h> -#include <libkcal/calendarlocal.h> -#include <libkcal/icalformat.h> - -#include <libkcal/resourcecached.h> - -namespace TDEIO { -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 TDEConfig object. - */ - ResourceRemote( const TDEConfig * ); - /** - 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 TDEConfig *config ); - void writeConfig( TDEConfig *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 TQString &key, const TQString &value ); - - - protected slots: - void slotLoadJobResult( TDEIO::Job * ); - void slotSaveJobResult( TDEIO::Job * ); - - void slotPercent( TDEIO::Job *, unsigned long percent ); - - protected: - bool doLoad(); - bool doSave(); - - void addInfoText( TQString & ) const; - - private: - void init(); - - KURL mDownloadUrl; - KURL mUploadUrl; - - bool mUseProgressManager; - bool mUseCacheFile; - - TDEIO::FileCopyJob *mDownloadJob; - TDEIO::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 deleted file mode 100644 index 67eaa92fe..000000000 --- a/kresources/remote/resourceremote_plugin.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - 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() - { - TDEGlobal::locale()->insertCatalogue( "libkcal" ); - TDEGlobal::locale()->insertCatalogue( "kres_remote" ); - return new RemoteFactory; - } -} diff --git a/kresources/remote/resourceremoteconfig.cpp b/kresources/remote/resourceremoteconfig.cpp deleted file mode 100644 index 67d7f4b94..000000000 --- a/kresources/remote/resourceremoteconfig.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - 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 <tqlabel.h> -#include <tqlayout.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( TQWidget* parent, const char* name ) - : KRES::ConfigWidget( parent, name ) -{ - resize( 245, 115 ); - TQGridLayout *mainLayout = new TQGridLayout( this, 2, 2 ); - mainLayout->setSpacing( KDialog::spacingHint() ); - - TQLabel *label = new TQLabel( i18n( "Download from:" ), this ); - - mDownloadUrl = new KURLRequester( this ); - mDownloadUrl->setMode( KFile::File ); - mainLayout->addWidget( label, 1, 0 ); - mainLayout->addWidget( mDownloadUrl, 1, 1 ); - - label = new TQLabel( 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 deleted file mode 100644 index 595a5d73c..000000000 --- a/kresources/remote/resourceremoteconfig.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - 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 <tqradiobutton.h> -#include <tqbuttongroup.h> -#include <kurlrequester.h> - -#include <kresources/resource.h> -#include <kresources/configwidget.h> - -#include <tdepimmacros.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( TQWidget *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 |