author | zautrix <zautrix> | 2005-06-26 10:43:45 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-26 10:43:45 (UTC) |
commit | 98bc92a09eb27fef0efa9c3dc5e963f7faa0319c (patch) (side-by-side diff) | |
tree | f80716d3e1239054a0a48bec6e9f67dd57e2156a | |
parent | f27e8c6cc8abbd27f10167334d608c7e0af7f711 (diff) | |
download | kdepimpi-98bc92a09eb27fef0efa9c3dc5e963f7faa0319c.zip kdepimpi-98bc92a09eb27fef0efa9c3dc5e963f7faa0319c.tar.gz kdepimpi-98bc92a09eb27fef0efa9c3dc5e963f7faa0319c.tar.bz2 |
details addressee better
-rw-r--r-- | bin/kdepim/kaddressbook/germantranslation.txt | 12 | ||||
-rw-r--r-- | kabc/addresseeview.cpp | 200 | ||||
-rw-r--r-- | kabc/addresseeview.h | 5 |
3 files changed, 181 insertions, 36 deletions
diff --git a/bin/kdepim/kaddressbook/germantranslation.txt b/bin/kdepim/kaddressbook/germantranslation.txt index 5e5ed4c..473aa0e 100644 --- a/bin/kdepim/kaddressbook/germantranslation.txt +++ b/bin/kdepim/kaddressbook/germantranslation.txt @@ -765,17 +765,29 @@ { " days"," Tage" },
{ "Creating backup ... please wait ...","Erzeuge Backup ... bitte warten ..." },
{ "Backup Failed!","Backup Problem!" },
{ "Try again now","Versuche jetzt nochmal" },
{ "Try again later","Versuche später nochmal" },
{ "Try again tomorrow","Versuche morgen nochmal" },
{ "Disable backup","Schalte Backup ab" },
{ "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" },
{ "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" },
{ "Choose action","Wähle Aktion" },
{ "&Configure KA/Pi...","Konfiguriere KA/Pi..." },
{ "Global Settings...","Globale Einstellungen..." },
+{ "Spouse","Ehegatte" },
+{ "Notes","Notizen" },
+{ "Messanger","Messanger" },
+{ "Assistant","Assistent" },
+{ "Manager","Manager" },
+{ "Secrecy","Sichtbar" },
+{ "male","männlich" },
+{ "female","weiblich" },
+{ "","" },
+{ "","" },
+{ "","" },
+{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
\ No newline at end of file diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp index 667a5e2..202a718 100644 --- a/kabc/addresseeview.cpp +++ b/kabc/addresseeview.cpp @@ -47,24 +47,25 @@ #include "externalapphandler.h" #include <kabc/addresseeview.h> //US #ifndef DESKTOP_VERSION //US #include <qtopia/qcopenvelope_qws.h> //US #include <qpe/qpeapplication.h> //US #endif //US static int kphoneInstalled = 0; using namespace KABC; +bool AddresseeView::sFullDetailsMode = false; AddresseeView::AddresseeView( QWidget *parent, const char *name ) : QTextBrowser( parent, name ) { //US setWrapPolicy( QTextEdit::AtWordBoundary ); setLinkUnderline( false ); // setVScrollBarMode( QScrollView::AlwaysOff ); //setHScrollBarMode( QScrollView::AlwaysOff ); //US QStyleSheet *sheet = styleSheet(); @@ -91,47 +92,53 @@ void AddresseeView::printMe() if ( dx < dy ) scale = dx; else scale = dy; p.translate( m.width()/10,0 ); p.scale( scale, scale ); drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); p.end(); #endif } 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) ); } void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) { bool kemailAvail = ExternalAppHandler::instance()->isEmailAppAvailable(); // mAddressee = addr; // clear view //setText( QString::null ); - + mCurrentContact = mAddressee; if ( mAddressee.isEmpty() ) { setText( QString::null); return; } #if 0 QString name = ( mAddressee.assembledName().isEmpty() ? mAddressee.formattedName() : mAddressee.assembledName() ); #endif QString name = mAddressee.realName(); QString dynamicPart; @@ -178,33 +185,25 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) .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 ); } } - 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."); - } + 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( @@ -214,35 +213,168 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) .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("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."); } 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>" diff --git a/kabc/addresseeview.h b/kabc/addresseeview.h index e977d8f..a4de085 100644 --- a/kabc/addresseeview.h +++ b/kabc/addresseeview.h @@ -40,26 +40,27 @@ class AddresseeView : public QTextBrowser /** Sets the addressee object. The addressee is displayed immediately. @param addr The addressee object. */ void setAddressee( const KABC::Addressee& addr ); void setSource(const QString& n); /** Returns the current addressee object. */ //KABC::Addressee addressee() const; void printMe(); - - private: + static bool sFullDetailsMode; + private: + Addressee mCurrentContact; //KABC::Addressee mAddressee; QString mText; QString getPhoneNumbers( KABC::PhoneNumber::List phones, bool preferred ); void addTag(const QString & tag,const QString & text); //class AddresseeViewPrivate; //AddresseeViewPrivate *d; }; class AddresseeChooser : public KDialogBase { Q_OBJECT public: |