libkcal Library API Documentation

resourcecalendar.h

00001 /* 00002 This file is part of libkcal. 00003 00004 Copyright (c) 1998 Preston Brown 00005 Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org> 00006 Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Library General Public 00010 License as published by the Free Software Foundation; either 00011 version 2 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Library General Public License for more details. 00017 00018 You should have received a copy of the GNU Library General Public License 00019 along with this library; see the file COPYING.LIB. If not, write to 00020 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00021 Boston, MA 02111-1307, USA. 00022 */ 00023 00024 #ifndef KCAL_RESOURCECALENDAR_H 00025 #define KCAL_RESOURCECALENDAR_H 00026 00027 #include <qstring.h> 00028 #include <qdatetime.h> 00029 #include <qptrlist.h> 00030 00031 #include <kconfig.h> 00032 00033 #include "alarm.h" 00034 #include "todo.h" 00035 #include "event.h" 00036 #include "journal.h" 00037 00038 #include <kresources/resource.h> 00039 #include <kresources/manager.h> 00040 #include <kabc/lock.h> 00041 00042 namespace KCal { 00043 00044 class CalFormat; 00045 00053 class ResourceCalendar : public KRES::Resource 00054 { 00055 Q_OBJECT 00056 public: 00057 ResourceCalendar( const KConfig * ); 00058 virtual ~ResourceCalendar(); 00059 00060 virtual void writeConfig( KConfig* config ); 00061 00066 virtual QString infoText() const; 00067 00087 bool load(); 00088 00103 bool save(); 00104 00109 virtual bool isSaving() { return false; } 00110 00114 virtual KABC::Lock *lock() = 0; 00115 00119 virtual bool addIncidence( Incidence * ); 00120 00124 virtual bool addEvent( Event *event ) = 0; 00125 00129 virtual void deleteEvent( Event * ) = 0; 00130 00134 virtual Event *event( const QString &uid ) = 0; 00135 00140 virtual Event::List rawEvents() = 0; 00141 00146 virtual Event::List rawEventsForDate( const QDate &date, 00147 bool sorted = false ) = 0; 00148 00152 virtual Event::List rawEventsForDate( const QDateTime &qdt ) = 0; 00153 00158 virtual Event::List rawEvents( const QDate &start, const QDate &end, 00159 bool inclusive = false ) = 0; 00160 00161 signals: 00168 void resourceChanged( ResourceCalendar * ); 00169 00174 void resourceLoaded( ResourceCalendar * ); 00179 void resourceSaved( ResourceCalendar * ); 00180 00184 void resourceLoadError( ResourceCalendar *, const QString &error ); 00188 void resourceSaveError( ResourceCalendar *, const QString &error ); 00189 00193 void signalSubresourceAdded( ResourceCalendar *, const QString& type, 00194 const QString& subresource, const QString& label ); 00195 00196 void signalSubresourceAdded( ResourceCalendar *, const QString& type, 00197 const QString& subresource ); 00198 00202 void signalSubresourceRemoved( ResourceCalendar *, const QString &, 00203 const QString & ); 00204 00205 public: 00209 virtual bool addTodo( Todo *todo ) = 0; 00213 virtual void deleteTodo( Todo * ) = 0; 00219 virtual Todo *todo( const QString &uid ) = 0; 00223 virtual Todo::List rawTodos() = 0; 00227 virtual Todo::List rawTodosForDate( const QDate &date ) = 0; 00228 00229 00233 virtual bool addJournal( Journal * ) = 0; 00234 00238 virtual void deleteJournal( Journal * ) = 0; 00239 00243 virtual Journal *journal( const QDate & ) = 0; 00244 00248 virtual Journal *journal( const QString &uid ) = 0; 00249 00253 virtual Journal::List journals() = 0; 00254 00255 00259 virtual Alarm::List alarms( const QDateTime &from, 00260 const QDateTime &to ) = 0; 00261 00265 virtual Alarm::List alarmsTo( const QDateTime &to ) = 0; 00266 00267 00269 Incidence::List rawIncidences(); 00270 00274 virtual void setTimeZoneId( const QString &tzid ) = 0; 00275 00281 virtual QStringList subresources() const { return QStringList(); } 00282 00286 virtual bool subresourceActive( const QString& ) const { return true; } 00287 00291 virtual const QString labelForSubresource( const QString& resource ) const 00292 { 00293 // the resource identifier is a sane fallback 00294 return resource; 00295 }; 00296 00297 public slots: 00301 virtual void setSubresourceActive( const QString &, bool active ); 00302 00303 protected: 00307 virtual bool doLoad() = 0; 00311 virtual bool doSave() = 0; 00312 00316 virtual void addInfoText( QString & ) const {}; 00317 00321 void loadError( const QString &errorMessage = QString::null ); 00325 void saveError( const QString &errorMessage = QString::null ); 00326 00327 private: 00328 bool mReceivedLoadError; 00329 bool mReceivedSaveError; 00330 00331 class Private; 00332 Private *d; 00333 }; 00334 00335 typedef KRES::Manager<ResourceCalendar> CalendarResourceManager; 00336 00337 } 00338 00339 #endif
KDE Logo
This file is part of the documentation for libkcal Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Oct 1 15:18:43 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003