resourcekabc.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_RESOURCEKABC_H 00022 #define KCAL_RESOURCEKABC_H 00023 00024 #include <qptrlist.h> 00025 #include <qstring.h> 00026 #include <qdatetime.h> 00027 00028 #include <kconfig.h> 00029 00030 #include "incidence.h" 00031 #include "calendarlocal.h" 00032 #include <kabc/addressbook.h> 00033 00034 #include "resourcecalendar.h" 00035 00036 namespace KIO { 00037 class FileCopyJob; 00038 class Job; 00039 } 00040 00041 namespace KCal { 00042 00046 class ResourceKABC : public ResourceCalendar 00047 { 00048 Q_OBJECT 00049 00050 friend class ResourceKABCConfig; 00051 00052 public: 00053 ResourceKABC( const KConfig * ); 00054 ResourceKABC( ); 00055 virtual ~ResourceKABC(); 00056 00057 void readConfig( const KConfig *config ); 00058 void writeConfig( KConfig* config ); 00059 00060 void setAlarm( bool ); 00061 bool alarm(); 00062 00063 void setAlarmDays( int ); 00064 int alarmDays(); 00065 00066 bool isSaving(); 00067 00068 KABC::Lock *lock(); 00069 00071 bool addEvent(Event *anEvent); 00073 void deleteEvent(Event *); 00074 00078 Event *event(const QString &UniqueStr); 00082 // Event::List events(); 00086 Event::List rawEvents(); 00091 Event::List rawEventsForDate( const QDate &date, bool sorted = false ); 00095 Event::List rawEventsForDate( const QDateTime &qdt ); 00100 Event::List rawEvents( const QDate &start, const QDate &end, 00101 bool inclusive = false ); 00102 00103 00104 /* 00105 Returns a QString with the text of the holiday (if any) that falls 00106 on the specified date. 00107 */ 00108 // QString getHolidayForDate(const QDate &qd); 00109 00113 bool addTodo( Todo *todo ); 00117 void deleteTodo( Todo * ); 00122 Todo *todo( const QString &uid ); 00126 Todo::List rawTodos(); 00130 Todo::List rawTodosForDate( const QDate &date ); 00132 virtual bool addJournal(Journal *); 00134 void deleteJournal( Journal * ); 00136 virtual Journal *journal(const QDate &); 00138 virtual Journal *journal(const QString &UID); 00140 Journal::List journals(); 00141 00143 Alarm::List alarms( const QDateTime &from, const QDateTime &to ); 00144 00146 Alarm::List alarmsTo( const QDateTime &to ); 00147 00148 void dump() const; 00149 00150 void setTimeZoneId( const QString& tzid ); 00151 00152 protected: 00153 bool doOpen(); 00154 void doClose(); 00155 bool doLoad(); 00156 bool doSave(); 00157 00158 private slots: 00159 void reload(); 00160 00161 private: 00162 void init(); 00163 00164 CalendarLocal mCalendar; 00165 00166 bool mOpen; 00167 00168 int mAlarmDays; 00169 bool mAlarm; 00170 KABC::AddressBook *mAddressbook; 00171 00172 KABC::Lock *mLock; 00173 00174 class Private; 00175 Private *d; 00176 }; 00177 00178 } 00179 00180 #endif