-rw-r--r-- | kabc/addresseeview.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp index f3cfb23..05d604f 100644 --- a/kabc/addresseeview.cpp +++ b/kabc/addresseeview.cpp | |||
@@ -389,8 +389,9 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) | |||
389 | } | 389 | } |
390 | mText = ""; | 390 | mText = ""; |
391 | QString picString = ""; | 391 | QString picString = ""; |
392 | KABC::Picture picture = mAddressee.photo(); | 392 | KABC::Picture picture = mAddressee.photo(); |
393 | if (picture.undefined() ) picture = mAddressee.logo(); | ||
393 | bool picAvailintern = false; | 394 | bool picAvailintern = false; |
394 | bool picAvailUrl = false; | 395 | bool picAvailUrl = false; |
395 | if (! picture.undefined() ) { | 396 | if (! picture.undefined() ) { |
396 | picAvailintern = (picture.isIntern() && !picture.data().isNull()); | 397 | picAvailintern = (picture.isIntern() && !picture.data().isNull()); |
@@ -399,11 +400,36 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) | |||
399 | if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { | 400 | if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { |
400 | picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; | 401 | picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; |
401 | if ( picAvailintern ) { | 402 | if ( picAvailintern ) { |
402 | QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); | 403 | QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); |
404 | int wid = picture.data().width(); | ||
405 | int hei = picture.data().height(); | ||
406 | if ( wid > 128 || hei > 128 ) { | ||
407 | if ( wid > hei ) { | ||
408 | hei = (hei*128)/wid; | ||
409 | wid = 128; | ||
410 | } else { | ||
411 | wid = (wid*128)/hei; | ||
412 | hei = 128; | ||
413 | } | ||
414 | } | ||
415 | picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei); | ||
403 | } else { | 416 | } else { |
404 | if ( picAvailUrl ) { | 417 | if ( picAvailUrl ) { |
405 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); | 418 | QPixmap picPix( picture.url() ); |
419 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", picPix ); | ||
420 | int wid = picPix.width(); | ||
421 | int hei = picPix.height(); | ||
422 | if ( wid > 128 || hei > 128 ) { | ||
423 | if ( wid > hei ) { | ||
424 | hei = (hei*128)/wid; | ||
425 | wid = 128; | ||
426 | } else { | ||
427 | wid = (wid*128)/hei; | ||
428 | hei = 128; | ||
429 | } | ||
430 | } | ||
431 | picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei); | ||
406 | } else { | 432 | } else { |
407 | if ( !mAddressee.custom( "KADDRESSBOOK", "X-Children" ).isEmpty() ) { | 433 | if ( !mAddressee.custom( "KADDRESSBOOK", "X-Children" ).isEmpty() ) { |
408 | static bool setDefaultImageChildren = false; | 434 | static bool setDefaultImageChildren = false; |
409 | if ( !setDefaultImageChildren ) { | 435 | if ( !setDefaultImageChildren ) { |