[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-02-26 22:48:47
Message-ID: 1267224527.834465.7595.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1096583 by winterz:

forward port SVN commit 1096546 by winterz:

break-out Participants as "Required Participants" and "Optional Participants"
kolab/issue4102


 M  +93 -29    incidenceformatter.cpp  


--- trunk/KDE/kdepimlibs/kcal/incidenceformatter.cpp #1096582:1096583
@@ -269,38 +269,68 @@
     tmpStr += "</tr>";
   }
 
-  // Add participant links
-  QString partStr;
+  // Add required participant links
+  QString reqpartStr;
   for ( it = attendees.constBegin(); it != attendees.constEnd(); ++it ) {
     Attendee *a = *it;
-    if ( a->role() != Attendee::ReqParticipant &&
-         a->role() != Attendee::OptParticipant ) {
-      // skip non-participants
+    if ( a->role() != Attendee::ReqParticipant ) {
+      // skip non-required-participants
       continue;
     }
     if ( a->email() == incidence->organizer().email() ) {
       // skip attendee that is also the organizer
       continue;
     }
-    partStr += displayViewLinkPerson( a->email(), a->name(), a->uid(), iconPath );
+    reqpartStr += displayViewLinkPerson( a->email(), a->name(), a->uid(), iconPath );
     if ( !a->delegator().isEmpty() ) {
-      partStr += i18n( " (delegated by %1)", a->delegator() );
+      reqpartStr += i18n( " (delegated by %1)", a->delegator() );
     }
     if ( !a->delegate().isEmpty() ) {
-      partStr += i18n( " (delegated to %1)", a->delegate() );
+      reqpartStr += i18n( " (delegated to %1)", a->delegate() );
     }
-    partStr += "<br>";
+    reqpartStr += "<br>";
    }
-   if ( partStr.endsWith( QLatin1String( "<br>" ) ) ) {
-     partStr.chop( 4 );
+   if ( reqpartStr.endsWith( QLatin1String( "<br>" ) ) ) {
+     reqpartStr.chop( 4 );
    }
-   if ( !partStr.isEmpty() ) {
+   if ( !reqpartStr.isEmpty() ) {
      tmpStr += "<tr>";
-     tmpStr += "<td><b>" + i18n( "Participants:" ) + "</b></td>";
-     tmpStr += "<td>" + partStr + "</td>";
+     tmpStr += "<td><b>" + i18n( "Required Participants:" ) + "</b></td>";
+     tmpStr += "<td>" + reqpartStr + "</td>";
      tmpStr += "</tr>";
    }
 
+  // Add optional participant links
+  QString optpartStr;
+  for ( it = attendees.begin(); it != attendees.end(); ++it ) {
+    Attendee *a = *it;
+    if ( a->role() != Attendee::OptParticipant ) {
+      // skip non-optional-participants
+      continue;
+    }
+    if ( a->email() == incidence->organizer().email() ) {
+      // skip attendee that is also the organizer
+      continue;
+    }
+    optpartStr += displayViewLinkPerson( a->email(), a->name(), a->uid(), iconPath );
+    if ( !a->delegator().isEmpty() ) {
+      optpartStr += i18n( " (delegated by %1)", a->delegator() );
+    }
+    if ( !a->delegate().isEmpty() ) {
+      optpartStr += i18n( " (delegated to %1)", a->delegate() );
+    }
+    optpartStr += "<br>";
+  }
+  if ( optpartStr.endsWith( QLatin1String( "<br>" ) ) ) {
+    optpartStr.truncate( optpartStr.length() - 4 );
+  }
+  if ( !optpartStr.isEmpty() ) {
+    tmpStr += "<tr>";
+    tmpStr += "<td><b>" + i18n( "Optional Participants:" ) + "</b></td>";
+    tmpStr += "<td>" + optpartStr + "</td>";
+    tmpStr += "</tr>";
+  }
+
   // Add observer links
   QString obsStr;
   for ( it = attendees.constBegin(); it != attendees.constEnd(); ++it ) {
@@ -2874,14 +2904,13 @@
     tmpStr += chairStr;
   }
 
-  // Add participant links
+  // Add required participant links
   i = 0;
-  QString partStr;
+  QString reqpartStr;
   for ( it = attendees.constBegin(); it != attendees.constEnd(); ++it ) {
     Attendee *a = *it;
-    if ( a->role() != Attendee::ReqParticipant &&
-         a->role() != Attendee::OptParticipant ) {
-      // skip non-participants
+    if ( a->role() != Attendee::ReqParticipant ) {
+      // skip non-required-participants
       continue;
     }
     if ( a->email() == incidence->organizer().email() ) {
@@ -2889,27 +2918,62 @@
       continue;
     }
     if ( i == maxNumAtts ) {
-      partStr += etc;
+      reqpartStr += etc;
       break;
     }
-    partStr += tooltipPerson( a->email(), a->name() );
+    reqpartStr += tooltipPerson( a->email(), a->name() );
     if ( !a->delegator().isEmpty() ) {
-      partStr += i18n( " (delegated by %1)", a->delegator() );
+      reqpartStr += i18n( " (delegated by %1)", a->delegator() );
     }
     if ( !a->delegate().isEmpty() ) {
-      partStr += i18n( " (delegated to %1)", a->delegate() );
+      reqpartStr += i18n( " (delegated to %1)", a->delegate() );
     }
-    partStr += sep;
+    reqpartStr += sep;
     i++;
   }
-  if ( partStr.endsWith( sep ) ) {
-    partStr.truncate( partStr.length() - sepLen );
+  if ( reqpartStr.endsWith( sep ) ) {
+    reqpartStr.truncate( reqpartStr.length() - sepLen );
   }
-  if ( !partStr.isEmpty() ) {
-    tmpStr += "<i>" + i18n( "Participants:" ) + "</i>" + "&nbsp;";
-    tmpStr += partStr;
+  if ( !reqpartStr.isEmpty() ) {
+    tmpStr += "<i>" + i18n( "Required Participants:" ) + "</i>" + "&nbsp;";
+    tmpStr += reqpartStr;
   }
 
+  // Add optional participant links
+  i = 0;
+  QString optpartStr;
+  for ( it = attendees.begin(); it != attendees.end(); ++it ) {
+    Attendee *a = *it;
+    if ( a->role() != Attendee::OptParticipant ) {
+      // skip non-optional-participants
+      continue;
+    }
+    if ( a->email() == incidence->organizer().email() ) {
+      // skip attendee that is also the organizer
+      continue;
+    }
+    if ( i == maxNumAtts ) {
+      optpartStr += etc;
+      break;
+    }
+    optpartStr += tooltipPerson( a->email(), a->name() );
+    if ( !a->delegator().isEmpty() ) {
+      optpartStr += i18n( " (delegated by %1)", a->delegator() );
+    }
+    if ( !a->delegate().isEmpty() ) {
+      optpartStr += i18n( " (delegated to %1)", a->delegate() );
+    }
+    optpartStr += sep;
+    i++;
+  }
+  if ( optpartStr.endsWith( sep ) ) {
+    optpartStr.truncate( optpartStr.length() - sepLen );
+  }
+  if ( !optpartStr.isEmpty() ) {
+    tmpStr += "<i>" + i18n( "Optional Participants:" ) + "</i>" + "&nbsp;";
+    tmpStr += optpartStr;
+  }
+
   // Add observer links
   i = 0;
   QString obsStr;
[prev in list] [next in list] [prev in thread] [next in thread] 

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