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 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 00036 #define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */ 00037 00038 class KConfig; 00039 00040 namespace KCal { 00041 00042 class CalFilter; 00043 00060 class Calendar : public QObject, public CustomProperties, 00061 public IncidenceBase::Observer 00062 { 00063 Q_OBJECT 00064 public: 00065 Calendar(); 00066 Calendar(const QString &timeZoneId); 00067 virtual ~Calendar(); 00068 00072 virtual void close() = 0; 00073 00077 virtual void save() = 0; 00078 00079 virtual bool isSaving() { return false; } 00080 00084 const QString &getOwner() const; 00088 void setOwner( const QString &os ); 00092 const QString &getEmail(); 00096 void setEmail( const QString & ); 00097 00102 void setTimeZoneId( const QString & ); 00106 QString timeZoneId() const; 00110 void setLocalTime(); 00114 bool isLocalTime() const; 00115 00121 virtual bool addIncidence( Incidence * ); 00127 virtual bool deleteIncidence( Incidence * ); 00131 virtual Incidence::List incidences(); 00132 00136 virtual Incidence::List rawIncidences(); 00137 00144 virtual bool addEvent( Event *anEvent ) = 0; 00148 virtual void deleteEvent( Event * ) = 0; 00152 virtual Event *event( const QString &UniqueStr ) = 0; 00158 Event::List events( const QDate &date, bool sorted = false); 00163 Event::List events( const QDateTime &qdt ); 00169 Event::List events( const QDate &start, const QDate &end, 00170 bool inclusive = false); 00174 virtual Event::List events(); 00178 virtual Event::List rawEvents() = 0; 00179 00185 virtual bool addTodo( Todo *todo ) = 0; 00189 virtual void deleteTodo( Todo * ) = 0; 00193 virtual Todo::List todos(); 00198 virtual Todo *todo( const QString &uid ) = 0; 00202 virtual Todo::List todos( const QDate &date ) = 0; 00206 virtual Todo::List rawTodos() = 0; 00207 00213 virtual bool addJournal( Journal * ) = 0; 00217 virtual void deleteJournal( Journal * ) = 0; 00221 virtual Journal *journal( const QDate & ) = 0; 00225 virtual Journal *journal( const QString &UID ) = 0; 00229 virtual Journal::List journals() = 0; 00230 00235 Incidence* incidence( const QString&UID ); 00236 00240 virtual void setupRelations( Incidence * ); 00244 virtual void removeRelations( Incidence * ); 00245 00250 void setFilter( CalFilter * ); 00254 CalFilter *filter(); 00255 00259 virtual Alarm::List alarms( const QDateTime &from, 00260 const QDateTime &to ) = 0; 00261 00262 class Observer { 00263 public: 00264 virtual void calendarModified( bool, Calendar * ) = 0; 00265 }; 00266 00267 void registerObserver( Observer * ); 00268 00269 void setModified( bool ); 00270 00275 void setLoadedProductId( const QString & ); 00280 QString loadedProductId(); 00281 00285 static Incidence::List mergeIncidenceList( const Event::List &, 00286 const Todo::List &, 00287 const Journal::List & ); 00288 00289 virtual bool beginChange( Incidence * ); 00290 virtual bool endChange( Incidence * ); 00291 00292 signals: 00293 void calendarChanged(); 00294 void calendarSaved(); 00295 void calendarLoaded(); 00296 00297 protected: 00301 virtual Event::List rawEventsForDate( const QDateTime &qdt ) = 0; 00305 virtual Event::List rawEventsForDate( const QDate &date, 00306 bool sorted = false ) = 0; 00311 virtual Event::List rawEvents( const QDate &start, const QDate &end, 00312 bool inclusive = false ) = 0; 00316 virtual void doSetTimeZoneId( const QString & ) {} 00317 00318 private: 00319 void init(); 00320 00321 QString mOwner; // who the calendar belongs to 00322 QString mOwnerEmail; // email address of the owner 00323 int mTimeZone; // timezone OFFSET from GMT (MINUTES) 00324 bool mLocalTime; // use local time, not UTC or a time zone 00325 00326 CalFilter *mFilter; 00327 CalFilter *mDefaultFilter; 00328 00329 QString mTimeZoneId; 00330 00331 Observer *mObserver; 00332 bool mNewObserver; 00333 00334 bool mModified; 00335 00336 QString mLoadedProductId; 00337 00338 // This list is used to put together related todos 00339 QDict<Incidence> mOrphans; 00340 QDict<Incidence> mOrphanUids; 00341 00342 class Private; 00343 Private *d; 00344 }; 00345 00346 } 00347 00348 #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