* 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
v3.5.13-sru
tpearson 14 years ago
parent 5572a114be
commit 4f6c584bac

@ -501,7 +501,7 @@ bool ResourceCalDav::parseData(const TQString& data) {
}
log("clearing cache");
clearCache();
clearEventsCache();
disableChangeNotification();
@ -557,6 +557,9 @@ bool ResourceCalDav::parseTasksData(const TQString& data) {
return false;
}
log("clearing cache");
clearTodosCache();
disableChangeNotification();
log("actually parsing the data");

@ -284,6 +284,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.
*/

@ -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 )
{

@ -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() {}
/**

@ -71,6 +71,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.
*/

@ -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;

@ -187,6 +187,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

@ -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" ) );

@ -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 );

Loading…
Cancel
Save