libkcal Library API Documentation

calendar.h

00001 /* 00002 This file is part of libkcal. 00003 00004 Copyright (c) 1998 Preston Brown 00005 Copyright (c) 2001,2003,2004 Cornelius Schumacher <schumacher@kde.org> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00020 Boston, MA 02111-1307, USA. 00021 */ 00022 #ifndef KCAL_CALENDAR_H 00023 #define KCAL_CALENDAR_H 00024 00025 #include <qobject.h> 00026 #include <qstring.h> 00027 #include <qdatetime.h> 00028 #include <qptrlist.h> 00029 #include <qdict.h> 00030 00031 #include "customproperties.h" 00032 #include "event.h" 00033 #include "todo.h" 00034 #include "journal.h" 00035 #include "kcalversion.h" 00036 00037 #define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */ 00038 00039 class KConfig; 00040 00041 namespace KCal { 00042 00043 class CalFilter; 00044 00061 class Calendar : public QObject, public CustomProperties, 00062 public IncidenceBase::Observer 00063 { 00064 Q_OBJECT 00065 public: 00066 Calendar(); 00067 Calendar(const QString &timeZoneId); 00068 virtual ~Calendar(); 00069 00073 virtual void close() = 0; 00074 00078 virtual void save() = 0; 00079 00080 virtual bool isSaving() { return false; } 00081 00085 const QString &getOwner() const; 00089 void setOwner( const QString &os ); 00093 const QString &getEmail(); 00097 void setEmail( const QString & ); 00098 00103 void setTimeZoneId( const QString & ); 00107 QString timeZoneId() const; 00111 void setLocalTime(); 00115 bool isLocalTime() const; 00116 00122 virtual bool addIncidence( Incidence * ); 00128 virtual bool deleteIncidence( Incidence * ); 00132 virtual Incidence::List incidences(); 00133 virtual Incidence::List incidences( const QDate &qdt ); 00134 00138 virtual Incidence::List rawIncidences(); 00139 00143 QStringList incidenceCategories(); 00144 00151 virtual bool addEvent( Event *anEvent ) = 0; 00155 virtual void deleteEvent( Event * ) = 0; 00159 virtual Event *event( const QString &UniqueStr ) = 0; 00165 Event::List events( const QDate &date, bool sorted = false ); 00170 Event::List events( const QDateTime &qdt ); 00176 Event::List events( const QDate &start, const QDate &end, 00177 bool inclusive = false); 00181 virtual Event::List events(); 00185 virtual Event::List rawEvents() = 0; 00186 00192 virtual bool addTodo( Todo *todo ) = 0; 00196 virtual void deleteTodo( Todo * ) = 0; 00200 virtual Todo::List todos(); 00205 virtual Todo *todo( const QString &uid ) = 0; 00209 virtual Todo::List todos( const QDate &date ); 00213 virtual Todo::List rawTodos() = 0; 00217 virtual Todo::List rawTodosForDate( const QDate &date ) = 0; 00218 00224 virtual bool addJournal( Journal * ) = 0; 00228 virtual void deleteJournal( Journal * ) = 0; 00232 virtual Journal *journal( const QDate & ) = 0; 00236 virtual Journal *journal( const QString &UID ) = 0; 00240 virtual Journal::List journals() = 0; 00241 // TODO: Add rawJournals() and rawJournal( QDate ) 00242 00247 Incidence *incidence( const QString &UID ); 00248 00252 virtual void setupRelations( Incidence * ); 00256 virtual void removeRelations( Incidence * ); 00257 00262 void setFilter( CalFilter * ); 00266 CalFilter *filter(); 00267 00271 virtual Alarm::List alarms( const QDateTime &from, 00272 const QDateTime &to ) = 0; 00273 00274 class Observer { 00275 public: 00276 virtual void calendarModified( bool, Calendar * ) {}; 00277 00278 virtual void calendarIncidenceAdded( Incidence * ) {} 00279 virtual void calendarIncidenceChanged( Incidence * ) {} 00280 virtual void calendarIncidenceDeleted( Incidence * ) {} 00281 }; 00282 00283 void registerObserver( Observer * ); 00284 void unregisterObserver( Observer * ); 00285 00286 void setModified( bool ); 00287 00292 void setLoadedProductId( const QString & ); 00297 QString loadedProductId(); 00298 00302 static Incidence::List mergeIncidenceList( const Event::List &, 00303 const Todo::List &, 00304 const Journal::List & ); 00305 00306 virtual bool beginChange( Incidence * ); 00307 virtual bool endChange( Incidence * ); 00308 00316 Incidence *dissociateOccurrence( Incidence *incidence, QDate date, 00317 bool single = true ); 00318 00319 signals: 00320 void calendarChanged(); 00321 void calendarSaved(); 00322 void calendarLoaded(); 00323 00324 public: 00328 virtual Event::List rawEventsForDate( const QDateTime &qdt ) = 0; 00332 virtual Event::List rawEventsForDate( const QDate &date, 00333 bool sorted = false ) = 0; 00338 virtual Event::List rawEvents( const QDate &start, const QDate &end, 00339 bool inclusive = false ) = 0; 00340 protected: 00344 virtual void doSetTimeZoneId( const QString & ) {} 00345 00346 void notifyIncidenceAdded( Incidence * ); 00347 void notifyIncidenceChanged( Incidence * ); 00348 void notifyIncidenceDeleted( Incidence * ); 00349 00350 void setObserversEnabled( bool enabled ); 00351 00352 private: 00353 void init(); 00354 00355 QString mOwner; // who the calendar belongs to 00356 QString mOwnerEmail; // email address of the owner 00357 int mTimeZone; // timezone OFFSET from GMT (MINUTES) 00358 bool mLocalTime; // use local time, not UTC or a time zone 00359 00360 CalFilter *mFilter; 00361 CalFilter *mDefaultFilter; 00362 00363 QString mTimeZoneId; 00364 00365 QPtrList<Observer> mObservers; 00366 bool mNewObserver; 00367 bool mObserversEnabled; 00368 00369 bool mModified; 00370 00371 QString mLoadedProductId; 00372 00373 // This list is used to put together related todos 00374 QDict<Incidence> mOrphans; 00375 QDict<Incidence> mOrphanUids; 00376 00377 class Private; 00378 Private *d; 00379 }; 00380 00381 } 00382 00383 #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:42 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003