libkcal Library API Documentation

resourceremote.h

00001  /*
00002     This file is part of libkcal.
00003 
00004     Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019     Boston, MA 02111-1307, USA.
00020 */
00021 #ifndef KCAL_RESOURCEREMOTEDIR_H
00022 #define KCAL_RESOURCEREMOTEDIR_H
00023 
00024 #include <qptrlist.h>
00025 #include <qstring.h>
00026 #include <qdatetime.h>
00027 
00028 #include <kurl.h>
00029 #include <kconfig.h>
00030 #include <kdirwatch.h>
00031 
00032 #include "incidence.h"
00033 #include "calendarlocal.h"
00034 #include "icalformat.h"
00035 
00036 #include "resourcecached.h"
00037 
00038 namespace KIO {
00039 class FileCopyJob;
00040 class Job;
00041 }
00042 
00043 namespace KCal {
00044 
00048 class ResourceRemote : public ResourceCached
00049 {
00050     Q_OBJECT
00051 
00052     friend class ResourceRemoteConfig;
00053 
00054   public:
00060     enum { ReloadNever, ReloadOnStartup, ReloadOnceADay, ReloadAlways };
00061   
00065     ResourceRemote( const KConfig * );
00072     ResourceRemote( const KURL &downloadUrl, const KURL &uploadUrl = KURL() );
00073     virtual ~ResourceRemote();
00074 
00075     void readConfig( const KConfig *config );
00076     void writeConfig( KConfig *config );
00077 
00078     void setDownloadUrl( const KURL & );
00079     KURL downloadUrl() const;
00080     
00081     void setUploadUrl( const KURL & );
00082     KURL uploadUrl() const;
00083 
00092     void setReloadPolicy( int policy );
00098     int reloadPolicy() const;
00099 
00103     QString cacheFile();
00104 
00105     bool load();
00106 
00107     bool save();
00108 
00109     KABC::Lock *lock();
00110 
00111     bool isSaving();
00112 
00113     void dump() const;
00114 
00115   protected slots:
00116     void slotLoadJobResult( KIO::Job * );
00117     void slotSaveJobResult( KIO::Job * );
00118 
00119   protected:
00120     bool doOpen();
00121 
00123     void doClose();
00124 
00128     virtual void update(IncidenceBase *incidence);
00129  
00130   private:
00131     void init();
00132 
00133     KURL mDownloadUrl;
00134     KURL mUploadUrl;
00135 
00136     int mReloadPolicy;
00137 
00138     ICalFormat mFormat;
00139 
00140     bool mOpen;
00141 
00142     KIO::FileCopyJob *mDownloadJob;
00143     KIO::FileCopyJob *mUploadJob;
00144     
00145     KABC::Lock *mLock;
00146 
00147     class Private;
00148     Private *d;
00149 };
00150 
00151 }
00152 
00153 #endif
KDE Logo
This file is part of the documentation for libkcal Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:36:23 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003