resourcecached.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
#ifndef KCAL_RESOURCECACHED_H
00022
#define KCAL_RESOURCECACHED_H
00023
00024
#include "resourcecalendar.h"
00025
00026
#include "incidence.h"
00027
#include "calendarlocal.h"
00028
00029
#include <kconfig.h>
00030
00031
#include <qptrlist.h>
00032
#include <qstring.h>
00033
#include <qdatetime.h>
00034
#include <qtimer.h>
00035
00036
namespace KCal {
00037
00042 class ResourceCached :
public ResourceCalendar,
00043
public KCal::
Calendar::Observer
00044 {
00045 Q_OBJECT
00046
public:
00052
enum { ReloadNever, ReloadOnStartup, ReloadInterval };
00058
enum { SaveNever, SaveOnExit, SaveInterval, SaveDelayed, SaveAlways };
00059
00060
ResourceCached(
const KConfig * );
00061
virtual ~
ResourceCached();
00062
00063
void readConfig(
const KConfig *config );
00064
void writeConfig( KConfig *config );
00065
00073
void setReloadPolicy(
int policy );
00079
int reloadPolicy()
const;
00080
00085
void setReloadInterval(
int minutes );
00086
00090
int reloadInterval()
const;
00091
00101
void setSavePolicy(
int policy );
00107
int savePolicy()
const;
00108
00113
void setSaveInterval(
int minutes );
00114
00118
int saveInterval()
const;
00119
00123
void setLastLoad(
const QDateTime & );
00127
QDateTime lastLoad()
const;
00128
00132
void setLastSave(
const QDateTime & );
00136
QDateTime lastSave()
const;
00137
00141
bool addEvent(
Event *anEvent);
00145
void deleteEvent(
Event *);
00146
00150
Event *
event(
const QString &UniqueStr);
00154
Event::List events();
00158
Event::List rawEvents();
00163
Event::List rawEventsForDate(
const QDate &date,
bool sorted =
false );
00167
Event::List rawEventsForDate(
const QDateTime &qdt );
00172
Event::List rawEvents(
const QDate &start,
const QDate &end,
00173
bool inclusive =
false );
00174
00175
00179
bool addTodo(
Todo *
todo );
00183
void deleteTodo(
Todo * );
00188
Todo *todo(
const QString &uid );
00192
Todo::List rawTodos();
00196
Todo::List rawTodosForDate(
const QDate &date );
00200
virtual bool addJournal(
Journal * );
00204
virtual void deleteJournal(
Journal * );
00208
virtual Journal *
journal(
const QDate & );
00212
virtual Journal *journal(
const QString &uid );
00216
Journal::List journals();
00217
00221
Alarm::List alarms(
const QDateTime &from,
const QDateTime &to );
00222
00226
Alarm::List alarmsTo(
const QDateTime &to );
00227
00231
void setTimeZoneId(
const QString& tzid );
00232
00233
QString timeZoneId()
const;
00234
00235
void enableChangeNotification();
00236
void disableChangeNotification();
00237
00238
void clearChange(
Incidence * );
00239
00240
void clearChanges();
00241
00242
bool hasChanges()
const;
00243
00244
Incidence::List allChanges()
const;
00245
00246
Incidence::List addedIncidences()
const;
00247
Incidence::List changedIncidences()
const;
00248
Incidence::List deletedIncidences()
const;
00249
00250
protected:
00251
00252
void calendarIncidenceAdded(
KCal::Incidence * );
00253
void calendarIncidenceChanged(
KCal::Incidence * );
00254
void calendarIncidenceDeleted(
KCal::Incidence * );
00255
00256
CalendarLocal mCalendar;
00257
00261
bool checkForReload();
00265
bool checkForSave();
00266
00267
void checkForAutomaticSave();
00268
00269
void addInfoText(
QString & )
const;
00270
00271
void setupSaveTimer();
00272
void setupReloadTimer();
00273
00274
protected slots:
00275
void slotReload();
00276
void slotSave();
00277
00278
private:
00279
int mReloadPolicy;
00280
int mReloadInterval;
00281
QTimer mReloadTimer;
00282
bool mReloaded;
00283
00284
int mSavePolicy;
00285
int mSaveInterval;
00286
QTimer mSaveTimer;
00287
00288
QDateTime mLastLoad;
00289
QDateTime mLastSave;
00290
00291
QMap<KCal::Incidence *,bool> mAddedIncidences;
00292
QMap<KCal::Incidence *,bool> mChangedIncidences;
00293
QMap<KCal::Incidence *,bool> mDeletedIncidences;
00294
00295
class Private;
00296 Private *d;
00297 };
00298
00299 }
00300
00301
#endif
This file is part of the documentation for libkcal Library Version 3.3.0.