libkcal Library API Documentation

calendarresources.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_CALENDARRESOURCES_H 00022 #define KCAL_CALENDARRESOURCES_H 00023 00024 #include <qintdict.h> 00025 #include <qmap.h> 00026 00027 #include "calendar.h" 00028 #include "resourcecalendar.h" 00029 00030 #include <kresources/manager.h> 00031 00032 class QWidget; 00033 00034 namespace KCal { 00035 00036 class CalFormat; 00037 00041 class CalendarResources : public Calendar, 00042 public KRES::ManagerObserver<ResourceCalendar> 00043 { 00044 Q_OBJECT 00045 public: 00046 class DestinationPolicy 00047 { 00048 public: 00049 DestinationPolicy( CalendarResourceManager *manager ) 00050 : mManager( manager ) {} 00051 00052 virtual ResourceCalendar *destination( Incidence * ) = 0; 00053 00054 protected: 00055 CalendarResourceManager *resourceManager() { return mManager; } 00056 00057 private: 00058 CalendarResourceManager *mManager; 00059 }; 00060 00061 class StandardDestinationPolicy : public DestinationPolicy 00062 { 00063 public: 00064 StandardDestinationPolicy( CalendarResourceManager *manager ) 00065 : DestinationPolicy( manager ) {} 00066 00067 ResourceCalendar *destination( Incidence * ); 00068 00069 private: 00070 class Private; 00071 Private *d; 00072 }; 00073 00074 class AskDestinationPolicy : public DestinationPolicy 00075 { 00076 public: 00077 AskDestinationPolicy( CalendarResourceManager *manager, 00078 QWidget *parent = 0 ) 00079 : DestinationPolicy( manager ), mParent( parent ) {} 00080 00081 ResourceCalendar *destination( Incidence * ); 00082 00083 private: 00084 QWidget *mParent; 00085 00086 class Private; 00087 Private *d; 00088 }; 00089 00090 class Ticket 00091 { 00092 friend class CalendarResources; 00093 public: 00094 ResourceCalendar *resource() const { return mResource; } 00095 00096 private: 00097 Ticket( ResourceCalendar *r ) : mResource( r ) {} 00098 00099 ResourceCalendar *mResource; 00100 00101 class Private; 00102 Private *d; 00103 }; 00104 00106 CalendarResources(); 00108 CalendarResources( const QString &timeZoneId ); 00109 ~CalendarResources(); 00110 00114 CalendarResourceManager *resourceManager() const 00115 { 00116 return mManager; 00117 } 00118 00122 void setStandardDestinationPolicy(); 00126 void setAskDestinationPolicy(); 00127 00129 void close(); 00130 00136 Ticket *requestSaveTicket( ResourceCalendar * ); 00142 virtual bool save( Ticket * ); 00146 virtual void releaseSaveTicket( Ticket *ticket ); 00147 00148 void save(); 00149 00150 bool isSaving(); 00151 00152 bool addIncidence( Incidence * ); 00153 00155 bool addEvent(Event *anEvent); 00157 bool addEvent(Event *anEvent, ResourceCalendar *resource); 00159 void deleteEvent(Event *); 00160 00164 Event *event(const QString &UniqueStr); 00168 // Event::List events(); 00172 Event::List rawEvents(); 00173 00174 /* 00175 Returns a QString with the text of the holiday (if any) that falls 00176 on the specified date. 00177 */ 00178 QString getHolidayForDate(const QDate &qd); 00179 00183 bool addTodo( Todo *todo ); 00185 bool addTodo(Todo *todo, ResourceCalendar *resource); 00189 void deleteTodo( Todo * ); 00194 Todo *todo( const QString &uid ); 00198 Todo::List rawTodos(); 00202 Todo::List todos( const QDate &date ); 00208 Todo::List todos() { return Calendar::todos(); } 00209 00211 bool addJournal(Journal *); 00213 void deleteJournal( Journal * ); 00215 bool addJournal(Journal *journal, ResourceCalendar *resource); 00217 Journal *journal(const QDate &); 00219 Journal *journal(const QString &UID); 00221 Journal::List journals(); 00222 00224 Alarm::List alarms( const QDateTime &from, const QDateTime &to ); 00225 00227 Alarm::List alarmsTo( const QDateTime &to ); 00228 00230 ResourceCalendar *resource(Incidence *); 00231 00232 bool beginChange( Incidence * ); 00233 bool endChange( Incidence * ); 00234 00235 signals: 00236 void signalResourceAdded( ResourceCalendar * ); 00237 void signalResourceModified( ResourceCalendar * ); 00238 void signalResourceDeleted( ResourceCalendar * ); 00239 00240 protected: 00244 void incidenceUpdated( IncidenceBase * ); 00245 00250 Event::List rawEventsForDate( const QDate &date, bool sorted = false ); 00254 Event::List rawEventsForDate( const QDateTime &qdt ); 00259 Event::List rawEvents( const QDate &start, const QDate &end, 00260 bool inclusive = false ); 00261 00262 void connectResource( ResourceCalendar * ); 00263 00264 void resourceAdded( ResourceCalendar *resource ); 00265 void resourceModified( ResourceCalendar *resource ); 00266 void resourceDeleted( ResourceCalendar *resource ); 00267 00268 virtual void doSetTimeZoneId( const QString& tzid ); 00269 00270 int incrementChangeCount( ResourceCalendar * ); 00271 int decrementChangeCount( ResourceCalendar * ); 00272 00273 private: 00274 void init(); 00275 00276 bool mOpen; 00277 00278 KRES::Manager<ResourceCalendar>* mManager; 00279 QMap <Incidence*, ResourceCalendar*> mResourceMap; 00280 00281 DestinationPolicy *mDestinationPolicy; 00282 StandardDestinationPolicy *mStandardPolicy; 00283 AskDestinationPolicy *mAskPolicy; 00284 00285 QMap<ResourceCalendar *, Ticket *> mTickets; 00286 QMap<ResourceCalendar *, int> mChangeCounts; 00287 00288 class Private; 00289 Private *d; 00290 }; 00291 00292 } 00293 00294 #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 Wed Jul 28 23:57:44 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003