[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdepim/kresources/kolab/kcal
From: David Faure <faure () kde ! org>
Date: 2004-10-21 18:49:21
Message-ID: 20041021184921.48AF416C2A () office ! kde ! org
[Download RAW message or body]
CVS commit by faure:
Complement to Bo's fix for https://intevation.de/roundup/kolab/issue450
(Rebuilding imap cache makes all events disappear) : remove entries in mUidMap
before calling e.g. deleteAllEvents().
M +28 -1 resourcekolab.cpp 1.9
M +1 -0 resourcekolab.h 1.6
--- kdepim/kresources/kolab/kcal/resourcekolab.cpp #1.8:1.9
@@ -179,4 +179,5 @@ bool ResourceKolab::doLoadAll( ResourceM
bool ResourceKolab::loadAllEvents()
{
+ removeIncidences( "Event" );
mCalendar.deleteAllEvents();
return doLoadAll( mEventSubResources, eventAttachmentMimeType );
@@ -185,4 +186,5 @@ bool ResourceKolab::loadAllEvents()
bool ResourceKolab::loadAllTodos()
{
+ removeIncidences( "Todo" );
mCalendar.deleteAllTodos();
return doLoadAll( mTodoSubResources, todoAttachmentMimeType );
@@ -191,8 +193,31 @@ bool ResourceKolab::loadAllTodos()
bool ResourceKolab::loadAllJournals()
{
+ removeIncidences( "Journal" );
mCalendar.deleteAllJournals();
return doLoadAll( mJournalSubResources, journalAttachmentMimeType );
}
+void ResourceKolab::removeIncidences( const QCString& incidenceType )
+{
+ Kolab::UidMap::Iterator mapIt = mUidMap.begin();
+ while ( mapIt != mUidMap.end() )
+ {
+ Kolab::UidMap::Iterator it = mapIt++;
+ // Check the type of this uid: event, todo or journal.
+ // Need to look up in mCalendar for that. Given the implementation of incidence(uid),
+ // better call event(uid), todo(uid) etc. directly.
+
+ // A faster but hackish way would probably be to check the type of the resource,
+ // like mEventSubResources.find( it.data().resource() ) != mEventSubResources.end() ?
+ const QString& uid = it.key();
+ if ( incidenceType == "Event" && mCalendar.event( uid ) )
+ mUidMap.remove( it );
+ else if ( incidenceType == "Todo" && mCalendar.todo( uid ) )
+ mUidMap.remove( it );
+ else if ( incidenceType == "Journal" && mCalendar.journal( uid ) )
+ mUidMap.remove( it );
+ }
+}
+
bool ResourceKolab::doSave()
{
@@ -622,4 +647,6 @@ void ResourceKolab::fromKMailRefresh( co
else if ( type == "Journal" )
loadAllJournals();
+ else
+ kdWarning(5006) << "KCal Kolab resource: fromKMailRefresh: unknown type " << type << endl;
mResourceChangedTimer.changeInterval( 100 );
}
@@ -772,5 +799,5 @@ void ResourceKolab::setSubresourceActive
void ResourceKolab::slotEmitResourceChanged()
{
- kdDebug(5650) << "Emitting resource changed " << endl;
+ kdDebug(5650) << "KCal Kolab resource: emitting resource changed " << endl;
emit resourceChanged( this );
mResourceChangedTimer.stop();
--- kdepim/kresources/kolab/kcal/resourcekolab.h #1.5:1.6
@@ -129,4 +129,5 @@ protected slots:
private:
+ void removeIncidences( const QCString& incidenceType );
void resolveConflict( KCal::Incidence*, const QString& subresource, Q_UINT32 sernum );
void addIncidence( const char* mimetype, const QString& xml,
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic