diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-08-30 07:52:23 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-08-30 07:52:23 +0000 |
commit | 4f6c584bacc8c3c694228f36ada3de77a76614a6 (patch) | |
tree | a4b40426f0bce6016a20b6f657fe588dfca9ff0f /libkcal | |
parent | 5572a114be163aeae75648f8e82ce692d4a77517 (diff) | |
download | tdepim-4f6c584bacc8c3c694228f36ada3de77a76614a6.tar.gz tdepim-4f6c584bacc8c3c694228f36ada3de77a76614a6.zip |
* Fixed CalDAV tasks loading when event loading fails
* Added calendar control functions to allow for a partial cache clear of only events, todos, or journals
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1169887 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkcal')
-rw-r--r-- | libkcal/calendar.h | 15 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 39 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 15 | ||||
-rw-r--r-- | libkcal/calendarnull.h | 15 | ||||
-rw-r--r-- | libkcal/calendarresources.cpp | 45 | ||||
-rw-r--r-- | libkcal/calendarresources.h | 15 | ||||
-rw-r--r-- | libkcal/resourcecached.cpp | 15 | ||||
-rw-r--r-- | libkcal/resourcecached.h | 15 |
8 files changed, 174 insertions, 0 deletions
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 4c6c0f988..a53ef5a06 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h @@ -285,6 +285,21 @@ class LIBKCAL_EXPORT Calendar : public TQObject, public CustomProperties, virtual void close() = 0; /** + Clears out the current Calendar, freeing all used memory etc. + */ + virtual void closeEvents() = 0; + + /** + Clears out the current Calendar, freeing all used memory etc. + */ + virtual void closeTodos() = 0; + + /** + Clears out the current Calendar, freeing all used memory etc. + */ + virtual void closeJournals() = 0; + + /** Sync changes in memory to persistant storage. */ virtual void save() = 0; diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 716fa5e98..27b27e0e2 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -104,6 +104,45 @@ void CalendarLocal::close() setObserversEnabled( true ); } +void CalendarLocal::closeEvents() +{ + setObserversEnabled( false ); + mFileName = TQString::null; + + deleteAllEvents(); + + mDeletedIncidences.clear(); + setModified( false ); + + setObserversEnabled( true ); +} + +void CalendarLocal::closeTodos() +{ + setObserversEnabled( false ); + mFileName = TQString::null; + + deleteAllTodos(); + + mDeletedIncidences.clear(); + setModified( false ); + + setObserversEnabled( true ); +} + +void CalendarLocal::closeJournals() +{ + setObserversEnabled( false ); + mFileName = TQString::null; + + deleteAllJournals(); + + mDeletedIncidences.clear(); + setModified( false ); + + setObserversEnabled( true ); +} + bool CalendarLocal::addEvent( Event *event ) { diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index 7326a2343..5a8e3cd76 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h @@ -78,6 +78,21 @@ class LIBKCAL_EXPORT CalendarLocal : public Calendar */ void close(); + /** + Clears out the current calendar, freeing all used memory etc. etc. + */ + void closeEvents(); + + /** + Clears out the current calendar, freeing all used memory etc. etc. + */ + void closeTodos(); + + /** + Clears out the current calendar, freeing all used memory etc. etc. + */ + void closeJournals(); + void save() {} /** diff --git a/libkcal/calendarnull.h b/libkcal/calendarnull.h index d6c758442..8ea0afa91 100644 --- a/libkcal/calendarnull.h +++ b/libkcal/calendarnull.h @@ -72,6 +72,21 @@ class LIBKCAL_EXPORT CalendarNull : public Calendar void close() {} /** + Clears out the current Calendar, freeing all used memory etc. + */ + void closeEvents() {} + + /** + Clears out the current Calendar, freeing all used memory etc. + */ + void closeTodos() {} + + /** + Clears out the current Calendar, freeing all used memory etc. + */ + void closeJournals() {} + + /** Sync changes in memory to persistant storage. */ void save() {} diff --git a/libkcal/calendarresources.cpp b/libkcal/calendarresources.cpp index 94ce0ca31..42f618dc3 100644 --- a/libkcal/calendarresources.cpp +++ b/libkcal/calendarresources.cpp @@ -204,6 +204,51 @@ void CalendarResources::close() } } +void CalendarResources::closeEvents() +{ + kdDebug(5800) << "CalendarResources::close" << endl; + + if ( mOpen ) { + CalendarResourceManager::ActiveIterator it; + for ( it = mManager->activeBegin(); it != mManager->activeEnd(); ++it ) { + (*it)->close(); + } + + setModified( false ); + mOpen = false; + } +} + +void CalendarResources::closeTodos() +{ + kdDebug(5800) << "CalendarResources::close" << endl; + + if ( mOpen ) { + CalendarResourceManager::ActiveIterator it; + for ( it = mManager->activeBegin(); it != mManager->activeEnd(); ++it ) { + (*it)->close(); + } + + setModified( false ); + mOpen = false; + } +} + +void CalendarResources::closeJournals() +{ + kdDebug(5800) << "CalendarResources::close" << endl; + + if ( mOpen ) { + CalendarResourceManager::ActiveIterator it; + for ( it = mManager->activeBegin(); it != mManager->activeEnd(); ++it ) { + (*it)->close(); + } + + setModified( false ); + mOpen = false; + } +} + void CalendarResources::save() { kdDebug(5800) << "CalendarResources::save()" << endl; diff --git a/libkcal/calendarresources.h b/libkcal/calendarresources.h index 9d3436348..32c48ba41 100644 --- a/libkcal/calendarresources.h +++ b/libkcal/calendarresources.h @@ -188,6 +188,21 @@ class LIBKCAL_EXPORT CalendarResources : void close(); /** + Clear out the current Calendar, freeing all used memory etc. + */ + void closeEvents(); + + /** + Clear out the current Calendar, freeing all used memory etc. + */ + void closeTodos(); + + /** + Clear out the current Calendar, freeing all used memory etc. + */ + void closeJournals(); + + /** Save this Calendar. If the save is successfull, the Ticket is deleted. Otherwise, the caller must release the Ticket with releaseSaveTicket() to abandon diff --git a/libkcal/resourcecached.cpp b/libkcal/resourcecached.cpp index 155d24a0d..1a4e8b19e 100644 --- a/libkcal/resourcecached.cpp +++ b/libkcal/resourcecached.cpp @@ -321,6 +321,21 @@ void ResourceCached::clearCache() mCalendar.close(); } +void ResourceCached::clearEventsCache() +{ + mCalendar.closeEvents(); +} + +void ResourceCached::clearTodosCache() +{ + mCalendar.closeTodos(); +} + +void ResourceCached::clearJournalsCache() +{ + mCalendar.closeJournals(); +} + void ResourceCached::cleanUpEventCache( const Event::List &eventList ) { CalendarLocal calendar ( TQString::fromLatin1( "UTC" ) ); diff --git a/libkcal/resourcecached.h b/libkcal/resourcecached.h index 42212272b..60976698a 100644 --- a/libkcal/resourcecached.h +++ b/libkcal/resourcecached.h @@ -270,6 +270,21 @@ class KDE_EXPORT ResourceCached : public ResourceCalendar, */ void clearCache(); + /** + Clear events cache. + */ + void clearEventsCache(); + + /** + Clear todos cache. + */ + void clearTodosCache(); + + /** + Clear journals cache. + */ + void clearJournalsCache(); + void cleanUpEventCache( const KCal::Event::List &eventList ); void cleanUpTodoCache( const KCal::Todo::List &todoList ); |