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

List:       kde-commits
Subject:    KDE/kdepimlibs/kcal
From:       David Jarvie <software () astrojar ! org ! uk>
Date:       2007-11-13 0:09:09
Message-ID: 1194912549.974304.23205.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 735911 by djarvie:

Don't notify change if none has taken place

 M  +13 -4     incidencebase.cpp  


--- trunk/KDE/kdepimlibs/kcal/incidencebase.cpp #735910:735911
@@ -52,7 +52,11 @@
 class KCal::IncidenceBase::Private
 {
   public:
-    Private(): mUpdateGroupLevel( 0 ), mAllDay( true ), mHasDuration( false )
+    Private()
+      : mUpdateGroupLevel( 0 ),
+        mUpdatedPending( false ),
+        mAllDay( true ),
+        mHasDuration( false )
     { mAttendees.setAutoDelete( true ); }
 
     Private( const Private &other )
@@ -61,7 +65,8 @@
         mOrganizer( other.mOrganizer ),
         mUid( other.mUid ),
         mDuration( other.mDuration ),
-	mUpdateGroupLevel( 0 ),
+        mUpdateGroupLevel( 0 ),
+        mUpdatedPending( false ),
         mAllDay( other.mAllDay ),
         mHasDuration( other.mHasDuration )
         //????? mComments
@@ -75,6 +80,7 @@
     QString mUid;                // incidence unique id
     Duration mDuration;          // incidence duration
     int mUpdateGroupLevel;       // if non-zero, suppresses update() calls
+    bool mUpdatedPending;        // true if an update has occurred since startUpdates()
     bool mAllDay;                // true if the incidence is all-day
     bool mHasDuration;           // true if the incidence has a duration
 
@@ -436,7 +442,9 @@
 
 void IncidenceBase::updated()
 {
-  if ( !d->mUpdateGroupLevel ) {
+  if ( d->mUpdateGroupLevel ) {
+    d->mUpdatedPending = true;
+  } else {
     foreach ( IncidenceObserver *o, d->mObservers ) {
       o->incidenceUpdated( this );
     }
@@ -451,7 +459,8 @@
 void IncidenceBase::endUpdates()
 {
   if ( d->mUpdateGroupLevel > 0 ) {
-    if ( --d->mUpdateGroupLevel == 0 ) {
+    if ( --d->mUpdateGroupLevel == 0 && d->mUpdatedPending ) {
+      d->mUpdatedPending = false;
       updated();
     }
   }
[prev in list] [next in list] [prev in thread] [next in thread] 

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