-rw-r--r-- | kabc/addresseeview.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp index 2691d9a..f3cfb23 100644 --- a/kabc/addresseeview.cpp +++ b/kabc/addresseeview.cpp @@ -173,227 +173,231 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) "<td align=\"left\">%2</td></tr>" ) .arg( i18n ("Birthday") ) .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) ); } dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(), false ); for ( ; emailIt != emails.end(); ++emailIt ) { if ( kemailAvail ) { dynamicPart += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) .arg( type ) .arg( name ) .arg( *emailIt ) .arg( *emailIt ); } else { dynamicPart += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( type ) .arg( *emailIt ); } } KABC::Address::List addresses = mAddressee.addresses(); KABC::Address::List::ConstIterator addrIt; for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { if ( true /*(*addrIt).label().isEmpty()*/ ) { QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace(); //US formattedAddress = formattedAddress.replace( '\n', "<br>" ); //qDebug("adresss %s ",formattedAddress.latin1() ); formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" ); //qDebug("AddresseeView::setAddressee has to be verified."); dynamicPart += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) .arg( formattedAddress ); } else { dynamicPart += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) //US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); } } QString notes; if ( sFullDetailsMode ) { notes = QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\"><a href=\"notAllDetails\">%4</a></td></tr>" ) .arg( i18n("Details") ) .arg( i18n("Hide!") ); QString tempX = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); if ( !tempX.isEmpty() ) { - notes += QString( - "<tr><td align=\"right\"><b>%1</b></td>" - "<td align=\"left\">%2</td></tr>" ) - .arg( i18n( "" ) ) - .arg( i18n(tempX) ); + if ( tempX == "male" || tempX == "female" ) { + notes += QString( + "<tr><td align=\"right\"><b>%1</b></td>" + "<td align=\"left\">%2</td></tr>" ) + .arg( i18n( "" ) ) + .arg( i18n(tempX) ); + } } tempX = mAddressee.secrecy().asString(); notes += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( "" ) .arg( tempX ); tempX = mAddressee.categories().join(" - "); if ( !tempX.isEmpty() ) { notes += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( i18n( "Category" ) ) .arg( tempX ); } tempX = mAddressee.custom( "KADDRESSBOOK", "X-Profession" ); if ( !tempX.isEmpty() ) { notes += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( i18n( "Profession" ) ) .arg( tempX ); } tempX = mAddressee.custom( "KADDRESSBOOK", "X-Office" ); if ( !tempX.isEmpty() ) { notes += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( i18n( "Office" ) ) .arg( tempX ); } tempX = mAddressee.custom( "KADDRESSBOOK", "X-Department" ); if ( !tempX.isEmpty() ) { notes += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( i18n( "Department" ) ) .arg( tempX ); } tempX = mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ); if ( !tempX.isEmpty() ) { notes += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( i18n( "Manager" ) ) .arg( tempX ); } tempX = mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ); if ( !tempX.isEmpty() ) { notes += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( i18n( "Assistant" ) ) .arg( tempX ); } if ( !mAddressee.url().url().isEmpty() ) { notes += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( i18n( "Homepage" ) ) .arg( mAddressee.url().url() ); } tempX = mAddressee.nickName(); if ( !tempX.isEmpty() ) { notes += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( i18n( "Nickname" ) ) .arg( tempX ); } tempX = mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ); if ( !tempX.isEmpty() ) { notes += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( i18n( "Messanger" ) ) .arg( tempX ); } tempX = mAddressee.custom( "KADDRESSBOOK", "X-Anniversary" ); if ( !tempX.isEmpty() ) { QDate dt = KGlobal::locale()->readDate( tempX, "%Y-%m-%d"); - tempX = KGlobal::locale()->formatDate(dt, true); - notes += QString( - "<tr><td align=\"right\"><b>%1</b></td>" - "<td align=\"left\">%2</td></tr>" ) - .arg( i18n( "Anniversary" ) ) - .arg( tempX ); + if ( dt.isValid () ) { + tempX = KGlobal::locale()->formatDate(dt, true); + notes += QString( + "<tr><td align=\"right\"><b>%1</b></td>" + "<td align=\"left\">%2</td></tr>" ) + .arg( i18n( "Anniversary" ) ) + .arg( tempX ); + } } tempX = mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ); if ( !tempX.isEmpty() ) { notes += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( i18n( "Spouse" ) ) .arg( tempX ); } tempX = mAddressee.custom( "KADDRESSBOOK", "X-Children" ); if ( !tempX.isEmpty() ) { notes += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( i18n( "Children" ) ) .arg( tempX ); } if ( !mAddressee.note().isEmpty() ) { notes += QString( "<tr>" "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label "<td align=\"left\">%2</td>" // note "</tr>" ).arg( i18n( "Notes" ) ) //US .arg( mAddressee.note().replace( '\n', "<br>" ) ); .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); //qDebug("AddresseeView::setAddressee has to be verified."); } } else { notes = QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\"><a href=\"allDetails\">%4</a></td></tr>" ) .arg( i18n("Details") ) .arg( i18n("Show!") ); } QString aRole = ""; QString aOrga = ""; if ( true /*!mAddressee.role().isEmpty()*/ ) { aRole = "<tr>" "<td align=\"left\">" + mAddressee.role() + "</td>" "</tr>"; } if ( true /*!mAddressee.organization().isEmpty()*/ ) { aOrga = "<tr>" "<td align=\"left\">" + mAddressee.organization() + "</td>" "</tr>"; } mText = ""; QString picString = ""; KABC::Picture picture = mAddressee.photo(); bool picAvailintern = false; bool picAvailUrl = false; if (! picture.undefined() ) { picAvailintern = (picture.isIntern() && !picture.data().isNull()); picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); } if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; if ( picAvailintern ) { QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); } else { |