[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/kdepim/enterprise/kdepim/kresources/kolab/kcal
From:       Sergio Luis Martins <iamsergio () gmail ! com>
Date:       2010-09-20 14:37:53
Message-ID: 20100920143753.CD65FAC7CB () svn ! kde ! org
[Download RAW message or body]

SVN commit 1177549 by smartins:

KOrganizer and libkcal like calling two Incidence::updated() for only one user \
change.

That's because after a change, IncidenceChanger calls incidence->setRevision( rev++ \
); which also calls Incidence::updated()

I did a little optimization in :incidenceUpdateSilent( IncidenceBase * ) to prevent \
sending two updates to the kolab server.

But this optimization should only be made when ResourceKolab::incidenceUpdated() was \
triggered from the outside (through CalendarObserver's interface) not when \
ResourceKolab calls it directly.

MERGE: trunk? didn't look yet

Part of work done in kolab/issue2109

 M  +5 -2      resourcekolab.cpp  
 M  +13 -0     resourcekolab.h  


--- branches/kdepim/enterprise/kdepim/kresources/kolab/kcal/resourcekolab.cpp \
#1177548:1177549 @@ -71,7 +71,7 @@
 ResourceKolab::ResourceKolab( const KConfig *config )
   : ResourceCalendar( config ), ResourceKolabBase( "ResourceKolab-libkcal" ),
     mCalendar( QString::fromLatin1("UTC") ), mOpen( false ),mResourceChangedTimer( \
                0,
-        "mResourceChangedTimer" ), mBatchAddingInProgress( false )
+        "mResourceChangedTimer" ), mBatchAddingInProgress( false ), \
mDisableOptimization( false )  {
   if ( !config ) {
     setResourceName( i18n( "Kolab Server" ) );
@@ -319,7 +319,7 @@
     return;
   }
 
-  { // start optimization
+  if ( !mDisableOptimization ) { // start optimization
     /**
        KOrganizer and libkcal like calling two Incidence::updated()
        for only one user change. That's because after a change,
@@ -732,7 +732,10 @@
       mSilent = false; // we do want to tell KMail
       mPendingUpdates.remove( uid );
       mUidsPendingAdding.remove( uid );
+
+      mDisableOptimization = true;
       incidenceUpdated( update );
+      mDisableOptimization = false;
     } else {
       /* If the uid was added by KMail, KOrganizer needs to be told, so
        * schedule emitting of the resourceChanged signal. */
--- branches/kdepim/enterprise/kdepim/kresources/kolab/kcal/resourcekolab.h \
#1177548:1177549 @@ -261,6 +261,19 @@
   */
   QMap<QString,int> mLastKnownRevisions;
 
+  /**
+     incidenceUpdated( IncidenceBase * ) does an optimization so an incidence isn't \
sent twice +     to kolab server.
+     This optimization should only be done when this method call is triggered from \
the outside, i.e. +     from the CalendarObserver mechanism ( Incidence::update() ).
+
+     When it's called directly by ResourceKolab, we set this variable to true so we \
don't optimize +     in incidenceUpdated( IncidenceBase *).
+
+     I didn't just add a new parameter to incidenceUpdated() because it's a \
re-implementation +     of a pure virtual in KCal::CalendarObserver. */
+  bool mDisableOptimization;
+
 };
 
 struct TemporarySilencer {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic