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

List:       kde-commits
Subject:    tags/kdepim/enterprise35.0.20090724.1001831/kdepim/libkcal
From:       Allen Winter <winter () kde ! org>
Date:       2009-07-30 15:25:20
Message-ID: 1248967520.659809.29861.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1004604 by winterz:

merge SVN commit 1004601 by winterz:

possible fix for kolab/issue3724 and kolab/issue3780, whereby multiple
persons having write access to a folder can confuse things for other
users accessing that folder.



 M  +25 -2     incidenceformatter.cpp  


--- tags/kdepim/enterprise35.0.20090724.1001831/kdepim/libkcal/incidenceformatter.cpp #1004603:1004604
@@ -1522,6 +1522,25 @@
   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 )
 {
@@ -1540,14 +1559,18 @@
 
   IncidenceBase *incBase = msg->event();
 
-  // Determine if this incidence is in my calendar
+  // Determine if this incidence is in my calendar (and owned by me)
   Incidence *existingIncidence = 0;
   if ( incBase && 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