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

List:       kde-commits
Subject:    branches/kdepim/enterprise/kdepim/libkcal
From:       Allen Winter <winter () kde ! org>
Date:       2010-09-29 23:12:27
Message-ID: 20100929231227.14F12AC88E () svn ! kde ! org
[Download RAW message or body]

SVN commit 1181075 by winterz:

refactor: new htmlAddUidLink() for creating a uid: html link
kolab/issue4483

MERGE: trunk


 M  +26 -28    incidenceformatter.cpp  


--- branches/kdepim/enterprise/kdepim/libkcal/incidenceformatter.cpp #1181074:1181075
@@ -87,6 +87,22 @@
   return str;
 }
 
+static QString htmlAddUidLink( const QString &email, const QString &name, const QString &uid )
+{
+  QString str;
+
+  if ( !uid.isEmpty() ) {
+    // There is a UID, so make a link to the addressbook
+    if ( name.isEmpty() ) {
+      // Use the email address for text
+      str += htmlAddLink( "uid:" + uid, email );
+    } else {
+      str += htmlAddLink( "uid:" + uid, name );
+    }
+  }
+  return str;
+}
+
 static QString htmlAddTag( const QString & tag, const QString & text )
 {
   int numLineBreaks = text.contains( "\n" );
@@ -285,14 +301,8 @@
 
   // Make the uid link
   if ( !printUid.isEmpty() ) {
-    // There is a UID, so make a link to the addressbook
-    if ( printName.isEmpty() ) {
-      // Use the email address for text
-      personString += htmlAddLink( "uid:" + printUid, email );
+    personString += htmlAddUidLink( email, printName, printUid );
     } else {
-      personString += htmlAddLink( "uid:" + printUid, printName );
-    }
-  } else {
     // No UID, just show some text
     personString += ( printName.isEmpty() ? email : printName );
   }
@@ -320,14 +330,8 @@
 
   // Make the uid link
   if ( !printUid.isEmpty() ) {
-    // There is a UID, so make a link to the addressbook
-    if ( printName.isEmpty() ) {
-      // Use the email address for text
-      personString += htmlAddLink( "uid:" + printUid, email );
+    personString += htmlAddUidLink( email, printName, printUid );
     } else {
-      personString += htmlAddLink( "uid:" + printUid, printName );
-    }
-  } else {
     // No UID, just show some text
     personString += ( printName.isEmpty() ? email : printName );
   }
@@ -1324,29 +1328,23 @@
   const QString printName = s.first;
   const QString printUid = s.second;
 
-  // Show the attendee
-  QString tmpString;
+  QString personString;
+  // Make the uid link
   if ( !printUid.isEmpty() ) {
-    // There is a UID, so make a link to the addressbook
-    if ( printName.isEmpty() ) {
-      // Use the email address for text
-      tmpString += htmlAddLink( "uid:" + printUid, email );
+    personString += htmlAddUidLink( email, printName, printUid );
     } else {
-      tmpString += htmlAddLink( "uid:" + printUid, printName );
-    }
-  } else {
     // No UID, just show some text
-    tmpString += ( printName.isEmpty() ? email : printName );
+    personString += ( printName.isEmpty() ? email : printName );
   }
-  tmpString += '\n';
+  personString += '\n';
 
   // Make the mailto link
   if ( !email.isEmpty() ) {
-    tmpString += "&nbsp;" + htmlAddMailtoLink( email, printName );
+    personString += "&nbsp;" + htmlAddMailtoLink( email, printName );
   }
-  tmpString += "\n";
+  personString += "\n";
 
-  return tmpString;
+  return personString;
 }
 
 static QString invitationDetailsIncidence( Incidence *incidence, bool noHtmlMode )
[prev in list] [next in list] [prev in thread] [next in thread] 

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