summaryrefslogtreecommitdiffabout
path: root/kabc/addresseeview.cpp
Unidiff
Diffstat (limited to 'kabc/addresseeview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addresseeview.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp
index 90be928..7a4336b 100644
--- a/kabc/addresseeview.cpp
+++ b/kabc/addresseeview.cpp
@@ -85,28 +85,25 @@ void AddresseeView::setSource(const QString& n)
85 else if ( n.left( 5 ) == "sipto" ) 85 else if ( n.left( 5 ) == "sipto" )
86 ExternalAppHandler::instance()->callBySIP( n.mid(6) ); 86 ExternalAppHandler::instance()->callBySIP( n.mid(6) );
87 87
88} 88}
89void AddresseeView::setAddressee( const KABC::Addressee& addr ) 89void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
90{ 90{
91 ExternalAppHandler* eah = ExternalAppHandler::instance(); 91 bool kemailAvail = ExternalAppHandler::instance()->isEmailAppAvailable();
92 bool kemailAvail = eah->isEmailAppAvailable(); 92 // mAddressee = addr;
93
94
95
96 mAddressee = addr;
97 // clear view 93 // clear view
98 setText( QString::null ); 94 //setText( QString::null );
99
100 if ( mAddressee.isEmpty() )
101 return;
102 95
96 if ( mAddressee.isEmpty() ) {
97 setText( QString::null);
98 return;
99 }
103 QString name = ( mAddressee.assembledName().isEmpty() ? 100 QString name = ( mAddressee.assembledName().isEmpty() ?
104 mAddressee.formattedName() : mAddressee.assembledName() ); 101 mAddressee.formattedName() : mAddressee.assembledName() );
105 102
106 QString dynamicPart; 103 QString dynamicPart;
107 104
108 dynamicPart += getPhoneNumbers( true ); 105 dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(),true );
109 QStringList emails = mAddressee.emails(); 106 QStringList emails = mAddressee.emails();
110 QStringList::ConstIterator emailIt; 107 QStringList::ConstIterator emailIt;
111 QString type = i18n( "Email" ); 108 QString type = i18n( "Email" );
112 emailIt = emails.begin(); 109 emailIt = emails.begin();
@@ -135,9 +132,9 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr )
135 "<td align=\"left\">%2</td></tr>" ) 132 "<td align=\"left\">%2</td></tr>" )
136 .arg( i18n ("Birthday") ) 133 .arg( i18n ("Birthday") )
137 .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) ); 134 .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) );
138 } 135 }
139 dynamicPart += getPhoneNumbers( false ); 136 dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(), false );
140 137
141 for ( ; emailIt != emails.end(); ++emailIt ) { 138 for ( ; emailIt != emails.end(); ++emailIt ) {
142 if ( kemailAvail ) { 139 if ( kemailAvail ) {
143 dynamicPart += QString( 140 dynamicPart += QString(
@@ -307,18 +304,17 @@ mText = "<table width=\"100%\">\n";
307 setText( mText ); 304 setText( mText );
308 305
309} 306}
310 307
311QString AddresseeView::getPhoneNumbers( bool preferred ) 308QString AddresseeView::getPhoneNumbers( KABC::PhoneNumber::List phones ,bool preferred )
312{ 309{
313 ExternalAppHandler* eah = ExternalAppHandler::instance(); 310 ExternalAppHandler* eah = ExternalAppHandler::instance();
314 bool kphoneAvail = eah->isPhoneAppAvailable(); 311 bool kphoneAvail = eah->isPhoneAppAvailable();
315 bool kfaxAvail = eah->isFaxAppAvailable(); 312 bool kfaxAvail = eah->isFaxAppAvailable();
316 bool ksmsAvail = eah->isSMSAppAvailable(); 313 bool ksmsAvail = eah->isSMSAppAvailable();
317 bool kpagerAvail = eah->isPagerAppAvailable(); 314 bool kpagerAvail = eah->isPagerAppAvailable();
318 bool ksipAvail = eah->isSIPAppAvailable(); 315 bool ksipAvail = eah->isSIPAppAvailable();
319 QString dynamicPart; 316 QString dynamicPart;
320 KABC::PhoneNumber::List phones = mAddressee.phoneNumbers();
321 KABC::PhoneNumber::List::ConstIterator phoneIt; 317 KABC::PhoneNumber::List::ConstIterator phoneIt;
322 QString extension; 318 QString extension;
323 int phonetype; 319 int phonetype;
324 QString sms; 320 QString sms;
@@ -376,12 +372,14 @@ QString AddresseeView::getPhoneNumbers( bool preferred )
376 } 372 }
377 } 373 }
378 return dynamicPart; 374 return dynamicPart;
379} 375}
376/*
380KABC::Addressee AddresseeView::addressee() const 377KABC::Addressee AddresseeView::addressee() const
381{ 378{
382 return mAddressee; 379 return mAddressee;
383} 380}
381*/
384void AddresseeView::addTag(const QString & tag,const QString & text) 382void AddresseeView::addTag(const QString & tag,const QString & text)
385{ 383{
386 if ( text.isEmpty() ) 384 if ( text.isEmpty() )
387 return; 385 return;