KCalCore Library
memorycalendar.h
Go to the documentation of this file.
00001 /* 00002 This file is part of the kcalcore library. 00003 00004 Copyright (c) 1998 Preston Brown <pbrown@kde.org> 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., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 00021 */ 00032 #ifndef KCALCORE_MEMORYCALENDAR_H 00033 #define KCALCORE_MEMORYCALENDAR_H 00034 00035 #include "kcalcore_export.h" 00036 #include "calendar.h" 00037 00038 namespace KCalCore { 00039 00040 class CalFormat; 00041 00046 class KCALCORE_EXPORT MemoryCalendar : public Calendar 00047 { 00048 public: 00049 00053 typedef QSharedPointer<MemoryCalendar> Ptr; 00054 00059 explicit MemoryCalendar( const KDateTime::Spec &timeSpec ); 00060 00065 explicit MemoryCalendar( const QString &timeZoneId ); 00066 00071 ~MemoryCalendar(); 00072 00076 void close(); 00077 00082 bool deleteIncidence( const Incidence::Ptr &incidence ); 00083 00088 bool deleteIncidenceInstances( const Incidence::Ptr &incidence ); 00089 00094 bool addIncidence( const Incidence::Ptr &incidence ); 00095 00096 // Event Specific Methods // 00097 00102 bool addEvent( const Event::Ptr &event ); 00103 00108 bool deleteEvent( const Event::Ptr &event ); 00109 00114 bool deleteEventInstances( const Event::Ptr &event ); 00115 00120 void deleteAllEvents(); 00121 00126 Event::List rawEvents( 00127 EventSortField sortField = EventSortUnsorted, 00128 SortDirection sortDirection = SortDirectionAscending ) const; 00129 00134 Event::List rawEvents( const QDate &start, const QDate &end, 00135 const KDateTime::Spec &timeSpec = KDateTime::Spec(), 00136 bool inclusive = false ) const; 00137 00149 Event::List rawEventsForDate( 00150 const QDate &date, const KDateTime::Spec &timeSpec = KDateTime::Spec(), 00151 EventSortField sortField = EventSortUnsorted, 00152 SortDirection sortDirection = SortDirectionAscending ) const; 00153 00158 Event::List rawEventsForDate( const KDateTime &dt ) const; 00159 00164 Event::Ptr event( 00165 const QString &uid, 00166 const KDateTime &recurrenceId = KDateTime() ) const; 00167 00172 Event::Ptr deletedEvent( 00173 const QString &uid, const KDateTime &recurrenceId = KDateTime() ) const; 00174 00179 Event::List deletedEvents( 00180 EventSortField sortField = EventSortUnsorted, 00181 SortDirection sortDirection = SortDirectionAscending ) const; 00182 00187 Event::List eventInstances( 00188 const Incidence::Ptr &event, 00189 EventSortField sortField = EventSortUnsorted, 00190 SortDirection sortDirection = SortDirectionAscending ) const; 00191 00192 // To-do Specific Methods // 00193 00198 bool addTodo( const Todo::Ptr &todo ); 00199 00204 bool deleteTodo( const Todo::Ptr &todo ); 00205 00210 bool deleteTodoInstances( const Todo::Ptr &todo ); 00211 00216 void deleteAllTodos(); 00217 00222 Todo::List rawTodos( 00223 TodoSortField sortField = TodoSortUnsorted, 00224 SortDirection sortDirection = SortDirectionAscending ) const; 00225 00230 Todo::List rawTodos( 00231 const QDate &start, const QDate &end, 00232 const KDateTime::Spec ×pec = KDateTime::Spec(), 00233 bool inclusive = false ) const; 00234 00239 Todo::List rawTodosForDate( const QDate &date ) const; 00240 00245 Todo::Ptr todo( const QString &uid, 00246 const KDateTime &recurrenceId = KDateTime() ) const; 00247 00252 Todo::Ptr deletedTodo( const QString &uid, const KDateTime &recurrenceId = KDateTime() ) const; 00253 00258 Todo::List deletedTodos( 00259 TodoSortField sortField = TodoSortUnsorted, 00260 SortDirection sortDirection = SortDirectionAscending ) const; 00261 00266 Todo::List todoInstances( const Incidence::Ptr &todo, 00267 TodoSortField sortField = TodoSortUnsorted, 00268 SortDirection sortDirection = SortDirectionAscending ) const; 00269 00270 // Journal Specific Methods // 00271 00276 bool addJournal( const Journal::Ptr &journal ); 00277 00282 bool deleteJournal( const Journal::Ptr &journal ); 00283 00288 bool deleteJournalInstances( const Journal::Ptr &journal ); 00289 00294 void deleteAllJournals(); 00295 00300 Journal::List rawJournals( 00301 JournalSortField sortField = JournalSortUnsorted, 00302 SortDirection sortDirection = SortDirectionAscending ) const; 00303 00308 Journal::List rawJournalsForDate( const QDate &date ) const; 00309 00314 Journal::Ptr journal( const QString &uid, 00315 const KDateTime &recurrenceId = KDateTime() ) const; 00316 00321 Journal::Ptr deletedJournal( const QString &uid, 00322 const KDateTime &recurrenceId = KDateTime() ) const; 00323 00328 Journal::List deletedJournals( 00329 JournalSortField sortField = JournalSortUnsorted, 00330 SortDirection sortDirection = SortDirectionAscending ) const; 00331 00336 Journal::List journalInstances( const Incidence::Ptr &journal, 00337 JournalSortField sortField = JournalSortUnsorted, 00338 SortDirection sortDirection = SortDirectionAscending ) const; 00339 00340 // Alarm Specific Methods // 00341 00346 Alarm::List alarms( const KDateTime &from, const KDateTime &to ) const; 00347 00354 Alarm::List alarmsTo( const KDateTime &to ) const; 00355 00360 void incidenceUpdate( const QString &uid, const KDateTime &recurrenceId ); 00361 00366 void incidenceUpdated( const QString &uid, const KDateTime &recurrenceId ); 00367 00368 using QObject::event; // prevent warning about hidden virtual method 00369 00370 protected: 00375 virtual void virtual_hook( int id, void *data ); 00376 00377 private: 00378 //@cond PRIVATE 00379 class Private; 00380 Private *const d; 00381 //@endcond 00382 00383 Q_DISABLE_COPY( MemoryCalendar ) 00384 }; 00385 00386 } 00387 00388 #endif