• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

KCal Library

  • kcal
resourcecached.h
1/*
2 This file is part of the kcal library.
3
4 Copyright (c) 2006 David Jarvie <djarvie@kde.org>
5 Copyright (c) 2003,2004 Cornelius Schumacher <schumacher@kde.org>
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
16
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
21*/
22#ifndef KCAL_RESOURCECACHED_H
23#define KCAL_RESOURCECACHED_H
24
25#include "resourcecalendar.h"
26#include "incidence.h"
27
28#include <kdatetime.h>
29
30#include <QtCore/QString>
31
32class KConfigGroup;
33namespace KRES { class IdMapper; }
34
35namespace KCal {
36
37class CalendarLocal;
38
43class KCAL_DEPRECATED_EXPORT ResourceCached : public ResourceCalendar,
44 public KCal::Calendar::CalendarObserver
45{
46 Q_OBJECT
47 public:
52 enum {
53 ReloadNever,
54 ReloadOnStartup,
55 ReloadInterval
56 };
57
62 enum {
63 SaveNever,
64 SaveOnExit,
65 SaveInterval,
66 SaveDelayed,
67 SaveAlways
68 };
69
75 enum CacheAction {
76 DefaultCache,
77 NoSyncCache,
78 SyncCache
79 };
80
81 ResourceCached();
82 explicit ResourceCached( const KConfigGroup &group );
83 virtual ~ResourceCached();
84
85 void readConfig( const KConfigGroup &group );
86 void writeConfig( KConfigGroup &group );
87
95 void setReloadPolicy( int policy );
101 int reloadPolicy() const;
102
107 void setReloadInterval( int minutes );
108
112 int reloadInterval() const;
113
122 bool inhibitDefaultReload( bool inhibit );
123 bool defaultReloadInhibited() const;
124
128 bool reloaded() const;
129
139 void setSavePolicy( int policy );
145 int savePolicy() const;
146
151 void setSaveInterval( int minutes );
152
156 int saveInterval() const;
157
161 KDateTime lastLoad() const;
162
166 KDateTime lastSave() const;
167
174 bool load( CacheAction action );
175
179 virtual bool load();
180
191 bool save( CacheAction action, Incidence *incidence = 0 );
192
196 virtual bool save( Incidence *incidence = 0 );
197
203 bool addEvent( Event *event );
204
208 bool deleteEvent( Event *event );
209
213 void deleteAllEvents();
214
218 Event *event( const QString &UniqueStr );
219
223 Event::List events();
224
228 Event::List rawEvents( EventSortField sortField = EventSortUnsorted,
229 SortDirection sortDirection = SortDirectionAscending );
230
240 Event::List rawEventsForDate( const QDate &date,
241 const KDateTime::Spec &timeSpec = KDateTime::Spec(),
242 EventSortField sortField = EventSortUnsorted,
243 SortDirection sortDirection = SortDirectionAscending );
244
248 Event::List rawEventsForDate( const KDateTime &dt );
249
260 Event::List rawEvents( const QDate &start, const QDate &end,
261 const KDateTime::Spec &timeSpec = KDateTime::Spec(),
262 bool inclusive = false );
263
269 bool addTodo( Todo *todo );
270
274 bool deleteTodo( Todo * );
275
279 void deleteAllTodos();
280
285 Todo *todo( const QString &uid );
286
290 Todo::List rawTodos( TodoSortField sortField = TodoSortUnsorted,
291 SortDirection sortDirection = SortDirectionAscending );
292
296 Todo::List rawTodosForDate( const QDate &date );
297
303 virtual KCAL_DEPRECATED bool addJournal( Journal *journal );
304
308 virtual bool deleteJournal( Journal * );
309
313 virtual void deleteAllJournals();
314
318 virtual Journal *journal( const QString &uid );
319
323 Journal::List rawJournals( JournalSortField sortField = JournalSortUnsorted,
324 SortDirection sortDirection = SortDirectionAscending );
325
329 Journal::List rawJournalsForDate( const QDate &date );
330
334 Alarm::List alarms( const KDateTime &from, const KDateTime &to );
335
339 Alarm::List alarmsTo( const KDateTime &to );
340
347 void setTimeSpec( const KDateTime::Spec &timeSpec );
348
354 KDateTime::Spec timeSpec() const;
355
362 void setTimeZoneId( const QString &timeZoneId );
363
370 QString timeZoneId() const;
371
376 virtual void shiftTimes( const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec );
377
381 Person owner() const;
382
387 void setOwner( const Person &owner );
388
389 void enableChangeNotification();
390 void disableChangeNotification();
391
392 void clearChange( Incidence *incidence );
393 void clearChange( const QString &uid );
394
395 void clearChanges();
396
397 bool hasChanges() const;
398
399 Incidence::List allChanges() const;
400
401 Incidence::List addedIncidences() const;
402 Incidence::List changedIncidences() const;
403 Incidence::List deletedIncidences() const;
404
409 bool loadFromCache();
410
414 void saveToCache();
415
419 void clearCache();
420
421 void cleanUpEventCache( const KCal::Event::List &eventList );
422 void cleanUpTodoCache( const KCal::Todo::List &todoList );
423
427 KRES::IdMapper &idMapper();
428
429 using QObject::event; // prevent warning about hidden virtual method
430
431 protected:
432 CalendarLocal *calendar() const;
433
434 // From Calendar::CalendarObserver
435 void calendarIncidenceAdded( KCal::Incidence *incidence );
436 void calendarIncidenceChanged( KCal::Incidence *incidence );
437 void calendarIncidenceDeleted( KCal::Incidence *incidence );
438
443 virtual void doClose();
444
450 virtual bool doOpen();
451
455 virtual bool doLoad( bool syncCache ) = 0;
456
463 void setReloaded( bool done );
464
473 virtual bool doSave( bool syncCache ) = 0;
474
484 virtual bool doSave( bool syncCache, Incidence *incidence );
485
489 bool checkForReload();
490
494 bool checkForSave();
495
496 void checkForAutomaticSave();
497
498 void addInfoText( QString & ) const;
499
500 void setupSaveTimer();
501 void setupReloadTimer();
502
507 virtual QString cacheFile() const;
508
512 virtual QString changesCacheFile( const QString &type ) const;
513 void loadChangesCache( QMap<Incidence *, bool> &map, const QString &type );
514 void loadChangesCache();
515 void saveChangesCache( const QMap<Incidence *, bool> &map, const QString &type );
516 void saveChangesCache();
517
518 protected Q_SLOTS:
519 void slotReload();
520 void slotSave();
521
522 void setIdMapperIdentifier();
523
524 private:
525 //@cond PRIVATE
526 Q_DISABLE_COPY( ResourceCached )
527 class Private;
528 Private *const d;
529 //@endcond
530};
531
532}
533
534#endif
KCal::TodoSortField
TodoSortField
Calendar Todo sort keys.
Definition: calendar.h:79
KCal::JournalSortField
JournalSortField
Calendar Journal sort keys.
Definition: calendar.h:91
KCal::EventSortField
EventSortField
Calendar Event sort keys.
Definition: calendar.h:69
KCal::SortDirection
SortDirection
Calendar Incidence sort directions.
Definition: calendar.h:61
KCal::CalendarLocal
This class provides a calendar stored as a local file.
Definition: calendarlocal.h:44
KCal::Calendar::CalendarObserver
The CalendarObserver class.
Definition: calendar.h:967
KCal::Event
This class provides an Event in the sense of RFC2445.
Definition: event.h:42
KCal::Incidence
Provides the abstract base class common to non-FreeBusy (Events, To-dos, Journals) calendar component...
Definition: incidence.h:70
KCal::Journal
Provides a Journal in the sense of RFC2445.
Definition: journal.h:44
KCal::ListBase
This class provides a template for lists of pointers.
Definition: listbase.h:45
KCal::Person
Represents a person, by name ane email address.
Definition: person.h:49
KCal::ResourceCached
This class provides a calendar resource using a local CalendarLocal object to cache the calendar data...
Definition: resourcecached.h:45
KCal::ResourceCached::ReloadNever
@ ReloadNever
never reload the resource automatically
Definition: resourcecached.h:53
KCal::ResourceCached::ReloadOnStartup
@ ReloadOnStartup
reload when the resource is opened
Definition: resourcecached.h:54
KCal::ResourceCached::lastSave
KDateTime lastSave() const
Return time of last save.
KCal::ResourceCached::SaveNever
@ SaveNever
never save the resource automatically
Definition: resourcecached.h:63
KCal::ResourceCached::SaveDelayed
@ SaveDelayed
save after every change, after a 15 second delay
Definition: resourcecached.h:66
KCal::ResourceCached::SaveOnExit
@ SaveOnExit
save when the resource is closed
Definition: resourcecached.h:64
KCal::ResourceCached::SaveInterval
@ SaveInterval
save at regular intervals set by setSaveInterval()
Definition: resourcecached.h:65
KCal::ResourceCached::lastLoad
KDateTime lastLoad() const
Return time of last load.
KCal::ResourceCached::CacheAction
CacheAction
Whether to update the cache file when loading a resource, or whether to upload the cache file after s...
Definition: resourcecached.h:75
KCal::ResourceCached::DefaultCache
@ DefaultCache
use the default action set by setReloadPolicy() or setSavePolicy()
Definition: resourcecached.h:76
KCal::ResourceCached::NoSyncCache
@ NoSyncCache
perform a cache-only operation, without downloading or uploading
Definition: resourcecached.h:77
KCal::ResourceCached::events
Event::List events()
Return filtered list of all events in calendar.
KCal::ResourceCached::doLoad
virtual bool doLoad(bool syncCache)=0
Do the actual loading of the resource data.
KCal::ResourceCached::doSave
virtual bool doSave(bool syncCache)=0
Do the actual saving of the resource data.
KCal::ResourceCalendar
This class provides the interfaces for a calendar resource.
Definition: resourcecalendar.h:51
KCal::Todo
Provides a To-do in the sense of RFC2445.
Definition: todo.h:45
KRES::IdMapper
incidence.h
This file is part of the API for handling calendar data and defines the Incidence class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KCal Library

Skip menu "KCal Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal