-rw-r--r-- | kabc/addresseeview.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp index 0564e85..90be928 100644 --- a/kabc/addresseeview.cpp +++ b/kabc/addresseeview.cpp | |||
@@ -211,137 +211,134 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) | |||
211 | aRole = "<tr>" | 211 | aRole = "<tr>" |
212 | "<td align=\"left\">" + mAddressee.role() + "</td>" | 212 | "<td align=\"left\">" + mAddressee.role() + "</td>" |
213 | "</tr>"; | 213 | "</tr>"; |
214 | } | 214 | } |
215 | if ( true /*!mAddressee.organization().isEmpty()*/ ) { | 215 | if ( true /*!mAddressee.organization().isEmpty()*/ ) { |
216 | aOrga = "<tr>" | 216 | aOrga = "<tr>" |
217 | "<td align=\"left\">" + mAddressee.organization() + "</td>" ; | 217 | "<td align=\"left\">" + mAddressee.organization() + "</td>" ; |
218 | "</tr>"; | 218 | "</tr>"; |
219 | } | 219 | } |
220 | mText = ""; | 220 | mText = ""; |
221 | QString picString = ""; | 221 | QString picString = ""; |
222 | KABC::Picture picture = mAddressee.photo(); | 222 | KABC::Picture picture = mAddressee.photo(); |
223 | bool picAvailintern = false; | 223 | bool picAvailintern = false; |
224 | bool picAvailUrl = false; | 224 | bool picAvailUrl = false; |
225 | if (! picture.undefined() ) { | 225 | if (! picture.undefined() ) { |
226 | picAvailintern = (picture.isIntern() && !picture.data().isNull()); | 226 | picAvailintern = (picture.isIntern() && !picture.data().isNull()); |
227 | picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); | 227 | picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); |
228 | } | 228 | } |
229 | if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { | 229 | if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { |
230 | if ( picAvailintern ) { | 230 | if ( picAvailintern ) { |
231 | QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); | 231 | QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); |
232 | } else { | 232 | } else { |
233 | if ( picAvailUrl ) { | 233 | if ( picAvailUrl ) { |
234 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); | 234 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); |
235 | } else { | 235 | } else { |
236 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", KGlobal::iconLoader()->loadIcon( "package_toys", KIcon::Desktop, 128 ) ); | 236 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", KGlobal::iconLoader()->loadIcon( "package_toys", KIcon::Desktop, 128 ) ); |
237 | } | 237 | } |
238 | } | 238 | } |
239 | picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; | 239 | picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; |
240 | mText = QString::fromLatin1( | 240 | mText = QString::fromLatin1( |
241 | "<html>" | 241 | "<html>" |
242 | "<body text=\"%1\" bgcolor=\"%2\">" // text and background color | 242 | "<body text=\"%1\" bgcolor=\"%2\">" // text and background color |
243 | "<table>" | 243 | "<table>" |
244 | "<tr>" | 244 | "<tr>" |
245 | "<td rowspan=\"3\" align=\"right\" valign=\"top\">" | 245 | "<td rowspan=\"3\" align=\"right\" valign=\"top\">" |
246 | "%3" | 246 | "%3" |
247 | "</td>" | 247 | "</td>" |
248 | "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name | 248 | "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name |
249 | "</tr>" | 249 | "</tr>" |
250 | "%5" // role | 250 | "%5" // role |
251 | "%6" // organization | 251 | "%6" // organization |
252 | "<td colspan=\"2\"> </td>" | 252 | "<td colspan=\"2\"> </td>" |
253 | "%7" // dynamic part | 253 | "%7" // dynamic part |
254 | "%8" // notes | 254 | "%8" // notes |
255 | "</table>" | 255 | "</table>" |
256 | "</body>" | 256 | "</body>" |
257 | "</html>") | 257 | "</html>") |
258 | //US | 258 | //US |
259 | .arg( /*KGlobalSettings::textColor().name()*/ "black" ) | 259 | .arg( /*KGlobalSettings::textColor().name()*/ "black" ) |
260 | //US | 260 | //US |
261 | .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) | 261 | .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) |
262 | .arg( picString ) | 262 | .arg( picString ) |
263 | .arg( name ) | 263 | .arg( name ) |
264 | .arg( aRole ) | 264 | .arg( aRole ) |
265 | .arg( aOrga ) | 265 | .arg( aOrga ) |
266 | .arg( dynamicPart ) | 266 | .arg( dynamicPart ) |
267 | .arg( notes ); | 267 | .arg( notes ); |
268 | 268 | ||
269 | } else { // no picture! | 269 | } else { // no picture! |
270 | 270 | ||
271 | mText = "<table width=\"100%\">\n"; | 271 | mText = "<table width=\"100%\">\n"; |
272 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 272 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
273 | #ifdef DESKTOP_VERSION | 273 | #ifdef DESKTOP_VERSION |
274 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; | 274 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; |
275 | mText += "<font color=\"#FFFFFF\">" + name +"</font></h1>"; | ||
275 | #else | 276 | #else |
276 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h2>"; | 277 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h3>"; |
278 | mText += "<font color=\"#FFFFFF\"> " + name +"</font></h3>"; | ||
277 | #endif | 279 | #endif |
278 | 280 | ||
279 | #ifdef DESKTOP_VERSION | ||
280 | mText += "<font color=\"#FFFFFF\"> <em>" + name+"</em></font></h1>"; | ||
281 | #else | ||
282 | mText += "<font color=\"#FFFFFF\"> <em>" + name +"</em></font></h2>"; | ||
283 | #endif | ||
284 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; | 281 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; |
285 | 282 | ||
286 | mText += "<table><td colspan=\"2\"> </td>"; | 283 | mText += "<table><td colspan=\"2\"> </td>"; |
287 | /* | 284 | /* |
288 | mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" | 285 | mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" |
289 | "<td align=\"left\"><b>%2</b></td></tr>" ) | 286 | "<td align=\"left\"><b>%2</b></td></tr>" ) |
290 | .arg( i18n(" ") ) | 287 | .arg( i18n(" ") ) |
291 | .arg( name ); | 288 | .arg( name ); |
292 | */ | 289 | */ |
293 | if ( ! mAddressee.role().isEmpty() ) | 290 | if ( ! mAddressee.role().isEmpty() ) |
294 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" | 291 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" |
295 | "<td align=\"left\">%2</td></tr>" ) | 292 | "<td align=\"left\">%2</td></tr>" ) |
296 | .arg( i18n(" ") ) | 293 | .arg( i18n(" ") ) |
297 | .arg( mAddressee.role()); | 294 | .arg( mAddressee.role()); |
298 | if ( ! mAddressee.organization().isEmpty() ) | 295 | if ( ! mAddressee.organization().isEmpty() ) |
299 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" | 296 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" |
300 | "<td align=\"left\">%2</td></tr>" ) | 297 | "<td align=\"left\">%2</td></tr>" ) |
301 | .arg( i18n(" ") ) | 298 | .arg( i18n(" ") ) |
302 | .arg( mAddressee.organization()); | 299 | .arg( mAddressee.organization()); |
303 | mText += dynamicPart; | 300 | mText += dynamicPart; |
304 | mText += notes; | 301 | mText += notes; |
305 | mText += "</table>"; | 302 | mText += "</table>"; |
306 | 303 | ||
307 | } | 304 | } |
308 | 305 | ||
309 | // at last display it... | 306 | // at last display it... |
310 | setText( mText ); | 307 | setText( mText ); |
311 | 308 | ||
312 | } | 309 | } |
313 | 310 | ||
314 | QString AddresseeView::getPhoneNumbers( bool preferred ) | 311 | QString AddresseeView::getPhoneNumbers( bool preferred ) |
315 | { | 312 | { |
316 | ExternalAppHandler* eah = ExternalAppHandler::instance(); | 313 | ExternalAppHandler* eah = ExternalAppHandler::instance(); |
317 | bool kphoneAvail = eah->isPhoneAppAvailable(); | 314 | bool kphoneAvail = eah->isPhoneAppAvailable(); |
318 | bool kfaxAvail = eah->isFaxAppAvailable(); | 315 | bool kfaxAvail = eah->isFaxAppAvailable(); |
319 | bool ksmsAvail = eah->isSMSAppAvailable(); | 316 | bool ksmsAvail = eah->isSMSAppAvailable(); |
320 | bool kpagerAvail = eah->isPagerAppAvailable(); | 317 | bool kpagerAvail = eah->isPagerAppAvailable(); |
321 | bool ksipAvail = eah->isSIPAppAvailable(); | 318 | bool ksipAvail = eah->isSIPAppAvailable(); |
322 | QString dynamicPart; | 319 | QString dynamicPart; |
323 | KABC::PhoneNumber::List phones = mAddressee.phoneNumbers(); | 320 | KABC::PhoneNumber::List phones = mAddressee.phoneNumbers(); |
324 | KABC::PhoneNumber::List::ConstIterator phoneIt; | 321 | KABC::PhoneNumber::List::ConstIterator phoneIt; |
325 | QString extension; | 322 | QString extension; |
326 | int phonetype; | 323 | int phonetype; |
327 | QString sms; | 324 | QString sms; |
328 | for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { | 325 | for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { |
329 | phonetype = (*phoneIt).type(); | 326 | phonetype = (*phoneIt).type(); |
330 | if ( ((phonetype & KABC::PhoneNumber::Pref) == 0 ) == preferred ) | 327 | if ( ((phonetype & KABC::PhoneNumber::Pref) == 0 ) == preferred ) |
331 | continue; | 328 | continue; |
332 | if (ksmsAvail && | 329 | if (ksmsAvail && |
333 | ( | 330 | ( |
334 | ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || | 331 | ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || |
335 | ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) | 332 | ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) |
336 | ) | 333 | ) |
337 | ) | 334 | ) |
338 | { | 335 | { |
339 | sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) | 336 | sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) |
340 | .arg( (*phoneIt).number() ); | 337 | .arg( (*phoneIt).number() ); |
341 | 338 | ||
342 | } | 339 | } |
343 | else | 340 | else |
344 | sms = ""; | 341 | sms = ""; |
345 | 342 | ||
346 | extension = QString::null; | 343 | extension = QString::null; |
347 | if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { | 344 | if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { |