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

List:       kde-commits
Subject:    KDE/kdepimlibs/kcal
From:       Allen Winter <winter () kde ! org>
Date:       2010-07-06 0:24:32
Message-ID: 20100706002432.53398AC85D () svn ! kde ! org
[Download RAW message or body]

SVN commit 1146427 by winterz:

merge forward SVN commit 1146384 by winterz:

When comparing Attendees for current and updated invitations only check
for removed Attendees on request methods, not on reply methods.
Also don't count the organizer as an attendee.
kolab/issue4437

MERGE: 4.5


 M  +18 -13    incidenceformatter.cpp  


--- trunk/KDE/kdepimlibs/kcal/incidenceformatter.cpp #1146426:1146427
@@ -36,14 +36,14 @@
 
 #include "incidenceformatter.h"
 #include "attachment.h"
-#include "event.h"
-#include "todo.h"
-#include "journal.h"
 #include "calendar.h"
 #include "calendarlocal.h"
+#include "calendarresources.h"
+#include "event.h"
+#include "freebusy.h"
 #include "icalformat.h"
-#include "freebusy.h"
-#include "calendarresources.h"
+#include "journal.h"
+#include "todo.h"
 
 #include "kpimutils/email.h"
 #include "kabc/phonenumber.h"
@@ -395,7 +395,6 @@
   //TODO: add a birthday cake icon
   QString tmpStr = displayViewLinkPerson( email_1, name_1, uid_1, iconPath );
 
-
   return tmpStr;
 }
 
@@ -2150,7 +2149,7 @@
 {
   public:
     IncidenceCompareVisitor() : mExistingIncidence( 0 ) {}
-    bool act( IncidenceBase *incidence, Incidence *existingIncidence )
+    bool act( IncidenceBase *incidence, Incidence *existingIncidence, iTIPMethod method )
     {
       if ( !existingIncidence ) {
         return false;
@@ -2160,6 +2159,7 @@
         return false;
       }
       mExistingIncidence = existingIncidence;
+      mMethod = method;
       return incidence->accept( *this );
     }
 
@@ -2178,18 +2178,18 @@
     bool visit( Event *event )
     {
       compareEvents( event, dynamic_cast<Event*>( mExistingIncidence ) );
-      compareIncidences( event, mExistingIncidence );
+      compareIncidences( event, mExistingIncidence, mMethod );
       return !mChanges.isEmpty();
     }
     bool visit( Todo *todo )
     {
       compareTodos( todo, dynamic_cast<Todo*>( mExistingIncidence ) );
-      compareIncidences( todo, mExistingIncidence );
+      compareIncidences( todo, mExistingIncidence, mMethod );
       return !mChanges.isEmpty();
     }
     bool visit( Journal *journal )
     {
-      compareIncidences( journal, mExistingIncidence );
+      compareIncidences( journal, mExistingIncidence, mMethod );
       return !mChanges.isEmpty();
     }
     bool visit( FreeBusy *fb )
@@ -2262,7 +2262,7 @@
       }
     }
 
-    void compareIncidences( Incidence *newInc, Incidence *oldInc )
+    void compareIncidences( Incidence *newInc, Incidence *oldInc, iTIPMethod method )
     {
       if ( !oldInc || !newInc ) {
         return;
@@ -2298,17 +2298,22 @@
         }
       }
 
+      if ( method == iTIPRequest ) {
       for ( Attendee::List::ConstIterator it = oldAttendees.constBegin();
             it != oldAttendees.constEnd(); ++it ) {
+          if ( (*it)->email() != oldInc->organizer().email() ) {
         Attendee *newAtt = newInc->attendeeByMail( (*it)->email() );
         if ( !newAtt ) {
           mChanges += i18n( "Attendee %1 has been removed", (*it)->fullName() );
         }
       }
     }
+      }
+    }
 
   private:
     Incidence *mExistingIncidence;
+    iTIPMethod mMethod;
     QStringList mChanges;
 };
 //@endcond
@@ -2517,7 +2522,7 @@
 
   if ( msg->method() == iTIPRequest ) {
     IncidenceFormatter::IncidenceCompareVisitor compareVisitor;
-    if ( compareVisitor.act( incBase, existingIncidence ) ) {
+    if ( compareVisitor.act( incBase, existingIncidence, msg->method() ) ) {
       html += "<p align=\"left\">";
       html += i18n( "The following changes have been made by the organizer:" );
       html += "</p>";
@@ -2526,7 +2531,7 @@
   }
   if ( msg->method() == iTIPReply ) {
     IncidenceCompareVisitor compareVisitor;
-    if ( compareVisitor.act( incBase, existingIncidence ) ) {
+    if ( compareVisitor.act( incBase, existingIncidence, msg->method() ) ) {
       html += "<p align=\"left\">";
       if ( !sender.isEmpty() ) {
         html += i18n( "The following changes have been made by %1:", sender );
[prev in list] [next in list] [prev in thread] [next in thread] 

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