summaryrefslogtreecommitdiffabout
path: root/kabc
authorzautrix <zautrix>2005-06-26 10:43:45 (UTC)
committer zautrix <zautrix>2005-06-26 10:43:45 (UTC)
commit98bc92a09eb27fef0efa9c3dc5e963f7faa0319c (patch) (side-by-side diff)
treef80716d3e1239054a0a48bec6e9f67dd57e2156a /kabc
parentf27e8c6cc8abbd27f10167334d608c7e0af7f711 (diff)
downloadkdepimpi-98bc92a09eb27fef0efa9c3dc5e963f7faa0319c.zip
kdepimpi-98bc92a09eb27fef0efa9c3dc5e963f7faa0319c.tar.gz
kdepimpi-98bc92a09eb27fef0efa9c3dc5e963f7faa0319c.tar.bz2
details addressee better
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addresseeview.cpp200
-rw-r--r--kabc/addresseeview.h5
2 files changed, 169 insertions, 36 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp
index 667a5e2..202a718 100644
--- a/kabc/addresseeview.cpp
+++ b/kabc/addresseeview.cpp
@@ -58,2 +58,3 @@
using namespace KABC;
+bool AddresseeView::sFullDetailsMode = false;
@@ -102,16 +103,22 @@ void AddresseeView::setSource(const QString& n)
{
- //qDebug("********AddresseeView::setSource %s", n.latin1());
-
- if ( n.left( 6 ) == "mailto" )
- ExternalAppHandler::instance()->mailToOneContact( n.mid(7) );
- else if ( n.left( 7 ) == "phoneto" )
- ExternalAppHandler::instance()->callByPhone( n.mid(8) );
- else if ( n.left( 5 ) == "faxto" )
- ExternalAppHandler::instance()->callByFax( n.mid(6) );
- else if ( n.left( 5 ) == "smsto" )
- ExternalAppHandler::instance()->callBySMS( n.mid(6) );
- else if ( n.left( 7 ) == "pagerto" )
- ExternalAppHandler::instance()->callByPager( n.mid(8) );
- else if ( n.left( 5 ) == "sipto" )
- ExternalAppHandler::instance()->callBySIP( n.mid(6) );
+ qDebug("********AddresseeView::setSource %s", n.latin1());
+
+ if ( n == "allDetails" ) {
+ sFullDetailsMode = true;
+ setAddressee( mCurrentContact );
+ } else if ( n == "notAllDetails" ) {
+ sFullDetailsMode = false;
+ setAddressee( mCurrentContact );
+ } else if ( n.left( 6 ) == "mailto" )
+ ExternalAppHandler::instance()->mailToOneContact( n.mid(7) );
+ else if ( n.left( 7 ) == "phoneto" )
+ ExternalAppHandler::instance()->callByPhone( n.mid(8) );
+ else if ( n.left( 5 ) == "faxto" )
+ ExternalAppHandler::instance()->callByFax( n.mid(6) );
+ else if ( n.left( 5 ) == "smsto" )
+ ExternalAppHandler::instance()->callBySMS( n.mid(6) );
+ else if ( n.left( 7 ) == "pagerto" )
+ ExternalAppHandler::instance()->callByPager( n.mid(8) );
+ else if ( n.left( 5 ) == "sipto" )
+ ExternalAppHandler::instance()->callBySIP( n.mid(6) );
@@ -124,3 +131,3 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
//setText( QString::null );
-
+ mCurrentContact = mAddressee;
if ( mAddressee.isEmpty() ) {
@@ -189,11 +196,3 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
- if ( !mAddressee.url().url().isEmpty() ) {
- dynamicPart += QString(
- "<tr><td align=\"right\"><b>%1</b></td>"
- "<td align=\"left\">%2</td></tr>" )
- .arg( i18n( "Homepage" ) )
-//US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) );
- .arg( mAddressee.url().url() );
- //qDebug("AddresseeView::setAddressee has to be verified.");
- }
+
@@ -225,13 +224,146 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
}
+
+
+ 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("Click here to hide!") );
+
+ QString 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-Gender" );
+ if ( !tempX.isEmpty() ) {
+ notes += QString(
+ "<tr><td align=\"right\"><b>%1</b></td>"
+ "<td align=\"left\">%2</td></tr>" )
+ .arg( i18n( "Gender" ) )
+ .arg( i18n(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 );
+ }
+ 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("Click here to show!") );
+
- QString notes;
- 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.");
}
diff --git a/kabc/addresseeview.h b/kabc/addresseeview.h
index e977d8f..a4de085 100644
--- a/kabc/addresseeview.h
+++ b/kabc/addresseeview.h
@@ -51,4 +51,5 @@ class AddresseeView : public QTextBrowser
void printMe();
-
- private:
+ static bool sFullDetailsMode;
+ private:
+ Addressee mCurrentContact;
//KABC::Addressee mAddressee;