• Skip to content
  • Skip to link menu
KDE 4.7 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • KDE Home
  • Contact Us
 

KCal Library

resourcecached.h
00001 /*
00002   This file is part of the kcal library.
00003 
00004   Copyright (c) 2006 David Jarvie <djarvie@kde.org>
00005   Copyright (c) 2003,2004 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 */
00022 #ifndef KCAL_RESOURCECACHED_H
00023 #define KCAL_RESOURCECACHED_H
00024 
00025 #include "resourcecalendar.h"
00026 #include "incidence.h"
00027 
00028 #include <kdatetime.h>
00029 
00030 #include <QtCore/QString>
00031 
00032 class KConfigGroup;
00033 namespace KRES { class IdMapper; }
00034 
00035 namespace KCal {
00036 
00037 class CalendarLocal;
00038 
00043 class KCAL_EXPORT_DEPRECATED ResourceCached : public ResourceCalendar,
00044                                               public KCal::Calendar::CalendarObserver
00045 {
00046   Q_OBJECT
00047   public:
00052     enum {
00053       ReloadNever,     
00054       ReloadOnStartup, 
00055       ReloadInterval   
00056     };
00057 
00062     enum {
00063       SaveNever,    
00064       SaveOnExit,   
00065       SaveInterval, 
00066       SaveDelayed,  
00067       SaveAlways    
00068     };
00069 
00075     enum CacheAction {
00076       DefaultCache,
00077       NoSyncCache, 
00078       SyncCache    
00079     };
00080 
00081     ResourceCached();
00082     explicit ResourceCached( const KConfigGroup &group );
00083     virtual ~ResourceCached();
00084 
00085     void readConfig( const KConfigGroup &group );
00086     void writeConfig( KConfigGroup &group );
00087 
00095     void setReloadPolicy( int policy );
00101     int reloadPolicy() const;
00102 
00107     void setReloadInterval( int minutes );
00108 
00112     int reloadInterval() const;
00113 
00122     bool inhibitDefaultReload( bool inhibit );
00123     bool defaultReloadInhibited() const;
00124 
00128     bool reloaded() const;
00129 
00139     void setSavePolicy( int policy );
00145     int savePolicy() const;
00146 
00151     void setSaveInterval( int minutes );
00152 
00156     int saveInterval() const;
00157 
00161     KDateTime lastLoad() const;
00162 
00166     KDateTime lastSave() const;
00167 
00174     bool load( CacheAction action );
00175 
00179     virtual bool load();
00180 
00191     bool save( CacheAction action, Incidence *incidence = 0 );
00192 
00196     virtual bool save( Incidence *incidence = 0 );
00197 
00203     bool addEvent( Event *event );
00204 
00208     bool deleteEvent( Event *event );
00209 
00213     void deleteAllEvents();
00214 
00218     Event *event( const QString &UniqueStr );
00219 
00223     Event::List events();
00224 
00228     Event::List rawEvents( EventSortField sortField = EventSortUnsorted,
00229                            SortDirection sortDirection = SortDirectionAscending );
00230 
00240     Event::List rawEventsForDate( const QDate &date,
00241                                   const KDateTime::Spec &timeSpec = KDateTime::Spec(),
00242                                   EventSortField sortField = EventSortUnsorted,
00243                                   SortDirection sortDirection = SortDirectionAscending );
00244 
00248     Event::List rawEventsForDate( const KDateTime &dt );
00249 
00260     Event::List rawEvents( const QDate &start, const QDate &end,
00261                            const KDateTime::Spec &timeSpec = KDateTime::Spec(),
00262                            bool inclusive = false );
00263 
00269     bool addTodo( Todo *todo );
00270 
00274     bool deleteTodo( Todo * );
00275 
00279     void deleteAllTodos();
00280 
00285     Todo *todo( const QString &uid );
00286 
00290     Todo::List rawTodos( TodoSortField sortField = TodoSortUnsorted,
00291                          SortDirection sortDirection = SortDirectionAscending );
00292 
00296     Todo::List rawTodosForDate( const QDate &date );
00297 
00303     virtual KDE_DEPRECATED bool addJournal( Journal *journal );
00304 
00308     virtual bool deleteJournal( Journal * );
00309 
00313     virtual void deleteAllJournals();
00314 
00318     virtual Journal *journal( const QString &uid );
00319 
00323     Journal::List rawJournals( JournalSortField sortField = JournalSortUnsorted,
00324                                SortDirection sortDirection = SortDirectionAscending );
00325 
00329     Journal::List rawJournalsForDate( const QDate &date );
00330 
00334     Alarm::List alarms( const KDateTime &from, const KDateTime &to );
00335 
00339     Alarm::List alarmsTo( const KDateTime &to );
00340 
00347     void setTimeSpec( const KDateTime::Spec &timeSpec );
00348 
00354     KDateTime::Spec timeSpec() const;
00355 
00362     void setTimeZoneId( const QString &timeZoneId );
00363 
00370     QString timeZoneId() const;
00371 
00376     virtual void shiftTimes( const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec );
00377 
00381     Person owner() const;
00382 
00387     void setOwner( const Person &owner );
00388 
00389     void enableChangeNotification();
00390     void disableChangeNotification();
00391 
00392     void clearChange( Incidence *incidence );
00393     void clearChange( const QString &uid );
00394 
00395     void clearChanges();
00396 
00397     bool hasChanges() const;
00398 
00399     Incidence::List allChanges() const;
00400 
00401     Incidence::List addedIncidences() const;
00402     Incidence::List changedIncidences() const;
00403     Incidence::List deletedIncidences() const;
00404 
00409     bool loadFromCache();
00410 
00414     void saveToCache();
00415 
00419     void clearCache();
00420 
00421     void cleanUpEventCache( const KCal::Event::List &eventList );
00422     void cleanUpTodoCache( const KCal::Todo::List &todoList );
00423 
00427     KRES::IdMapper &idMapper();
00428 
00429     using QObject::event;   // prevent warning about hidden virtual method
00430 
00431   protected:
00432     CalendarLocal *calendar() const;
00433 
00434     // From Calendar::CalendarObserver
00435     void calendarIncidenceAdded( KCal::Incidence *incidence );
00436     void calendarIncidenceChanged( KCal::Incidence *incidence );
00437     void calendarIncidenceDeleted( KCal::Incidence *incidence );
00438 
00443     virtual void doClose();
00444 
00450     virtual bool doOpen();
00451 
00455     virtual bool doLoad( bool syncCache ) = 0;
00456 
00463     void setReloaded( bool done );
00464 
00473     virtual bool doSave( bool syncCache ) = 0;
00474 
00484     virtual bool doSave( bool syncCache, Incidence *incidence );
00485 
00489     bool checkForReload();
00490 
00494     bool checkForSave();
00495 
00496     void checkForAutomaticSave();
00497 
00498     void addInfoText( QString & ) const;
00499 
00500     void setupSaveTimer();
00501     void setupReloadTimer();
00502 
00507     virtual QString cacheFile() const;
00508 
00512     virtual QString changesCacheFile( const QString &type ) const;
00513     void loadChangesCache( QMap<Incidence *, bool> &map, const QString &type );
00514     void loadChangesCache();
00515     void saveChangesCache( const QMap<Incidence *, bool> &map, const QString &type );
00516     void saveChangesCache();
00517 
00518   protected Q_SLOTS:
00519     void slotReload();
00520     void slotSave();
00521 
00522     void setIdMapperIdentifier();
00523 
00524   private:
00525     //@cond PRIVATE
00526     Q_DISABLE_COPY( ResourceCached )
00527     class Private;
00528     Private *const d;
00529     //@endcond
00530 };
00531 
00532 }
00533 
00534 #endif

KCal Library

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

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.7.5
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal