From kde-commits Thu Sep 30 23:22:42 2010 From: Allen Winter Date: Thu, 30 Sep 2010 23:22:42 +0000 To: kde-commits Subject: branches/kdepim/enterprise/kdepim/libkcal Message-Id: <20100930232242.41E26AC892 () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=128588900130307 SVN commit 1181415 by winterz: gee.. displayViewLinkPerson() and displayViewFormatPerson().. and they do almost the same thing. make them one. MERGE: trunk M +5 -35 incidenceformatter.cpp --- branches/kdepim/enterprise/kdepim/libkcal/incidenceformatter.cpp #1181414:1181415 @@ -283,17 +283,14 @@ * Helper functions for the extensive display (display viewer) *******************************************************************/ -static QString displayViewLinkPerson( const QString &email, const QString &name, - const QString &uid, Attendee::PartStat status ) +static QString displayViewFormatPerson( const QString &email, const QString &name, + const QString &uid, const QString &iconPath ) { // Search for new print name or uid, if needed. QPair s = searchNameAndUid( email, name, uid ); const QString printName = s.first; const QString printUid = s.second; - // Get the icon corresponding to the attendee participation status. - QString iconPath = attendeeStatusIconPath( status ); - QString personString; if ( !iconPath.isEmpty() ) { personString += "" + " "; @@ -316,34 +313,11 @@ } static QString displayViewFormatPerson( const QString &email, const QString &name, - const QString &uid, const QString &iconPath ) + const QString &uid, Attendee::PartStat status ) { - // Search for new print name or uid, if needed. - QPair s = searchNameAndUid( email, name, uid ); - const QString printName = s.first; - const QString printUid = s.second; - - QString personString; - if ( !iconPath.isEmpty() ) { - personString += "" + " "; + return displayViewFormatPerson( email, name, uid, attendeeStatusIconPath( status ) ); } - // Make the uid link - if ( !printUid.isEmpty() ) { - personString += htmlAddUidLink( email, printName, printUid ); - } else { - // No UID, just show some text - personString += ( printName.isEmpty() ? email : printName ); - } - - // Make the mailto link - if ( !email.isEmpty() ) { - personString += " " + htmlAddMailtoLink( email, printName ); - } - - return personString; -} - static QString displayViewFormatAttendeeRoleList( Incidence *incidence, Attendee::Role role ) { QString tmpStr; @@ -360,7 +334,7 @@ // skip attendee that is also the organizer continue; } - tmpStr += displayViewLinkPerson( a->email(), a->name(), a->uid(), a->status() ); + tmpStr += displayViewFormatPerson( a->email(), a->name(), a->uid(), a->status() ); if ( !a->delegator().isEmpty() ) { tmpStr += i18n(" (delegated by %1)" ).arg( a->delegator() ); } @@ -491,16 +465,12 @@ QString uid = event->customProperty("KABC","UID-1"); QString name = event->customProperty("KABC","NAME-1"); QString email= event->customProperty("KABC","EMAIL-1"); - - QString iconPath = KGlobal::iconLoader()->iconPath( "organizer", KIcon::Small ); QString tmpStr = displayViewFormatPerson( email, name, uid, QString() ); if ( event->customProperty( "KABC", "ANNIVERSARY") == "YES" ) { uid = event->customProperty("KABC","UID-2"); name = event->customProperty("KABC","NAME-2"); email= event->customProperty("KABC","EMAIL-2"); - - iconPath = KGlobal::iconLoader()->iconPath( "organizer", KIcon::Small ); tmpStr += "
" + displayViewFormatPerson( email, name, uid, QString() ); }