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

List:       kde-commits
Subject:    branches/kdepim/enterprise/kdepim/libkcal
From:       Volker Krause <vkrause () kde ! org>
Date:       2008-02-28 17:05:10
Message-ID: 1204218310.456960.30080.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 780286 by vkrause:

Try to ignore incidences in shared calendars, they are most likely
events created by other users who got the same invitation.

Kolab issue 2312


 M  +18 -1     incidenceformatter.cpp  


--- branches/kdepim/enterprise/kdepim/libkcal/incidenceformatter.cpp #780285:780286
@@ -1201,6 +1201,21 @@
   return res;
 }
 
+// Check if the given incidence is likely one that we own instead one from
+// a shared calendar (Kolab-specific)
+static bool incidenceOwnedByMe( Calendar* calendar, Incidence *incidence )
+{
+  CalendarResources* cal = dynamic_cast<CalendarResources*>( calendar );
+  if ( !cal || !incidence )
+    return true;
+  ResourceCalendar* res = cal->resource( incidence );
+  if ( !res )
+    return true;
+  const QString subRes = res->subresourceIdentifier( incidence );
+  if ( !subRes.contains( "/.INBOX.directory/" ) )
+    return false;
+  return true;
+}
 
 QString IncidenceFormatter::formatICalInvitation( QString invitation, Calendar \
*mCalendar,  InvitationFormatterHelper *helper )
@@ -1223,10 +1238,12 @@
   Incidence* existingIncidence = 0;
   if ( helper->calendar() ) {
     existingIncidence = helper->calendar()->incidence( incBase->uid() );
+    if ( !incidenceOwnedByMe( helper->calendar(), existingIncidence ) )
+      existingIncidence = 0;
     if ( !existingIncidence ) {
       const Incidence::List list = helper->calendar()->incidences();
       for ( Incidence::List::ConstIterator it = list.begin(), end = list.end(); it \
                != end; ++it ) {
-        if ( (*it)->schedulingID() == incBase->uid() ) {
+        if ( (*it)->schedulingID() == incBase->uid() && incidenceOwnedByMe( \
helper->calendar(), *it ) ) {  existingIncidence = *it;
           break;
         }


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

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