summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-08-17 23:32:26 (UTC)
committer zautrix <zautrix>2005-08-17 23:32:26 (UTC)
commit9de953866db87933c9773b98502f07ac408c8ef7 (patch) (unidiff)
tree34a7ce77ad554c69fb13102b22dcdfcf0178f078
parenta685e90ea183cba87e852d6f6272e54704034347 (diff)
downloadkdepimpi-9de953866db87933c9773b98502f07ac408c8ef7.zip
kdepimpi-9de953866db87933c9773b98502f07ac408c8ef7.tar.gz
kdepimpi-9de953866db87933c9773b98502f07ac408c8ef7.tar.bz2
fix picture kapi
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt4
-rw-r--r--kabc/addresseeview.cpp28
2 files changed, 31 insertions, 1 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index d75ff7e..013c3f8 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -14,6 +14,10 @@ KA/Pi:
14Added a config option to turn on asking before a contact is deleted. 14Added a config option to turn on asking before a contact is deleted.
15Fixed a problem with the default view and view selection at startup. 15Fixed a problem with the default view and view selection at startup.
16Formatted name is now set on import, if formatted name is empty. 16Formatted name is now set on import, if formatted name is empty.
17Fixed a problem of displaying images in the contact details view:
18Now the wid/hei ratio is not changed.
19I a picture is larger than 128 pixels in wid or hei it is downscaled to
20max 128 pixels wid/hei.
17 21
18********** VERSION 2.2.0 ************ 22********** VERSION 2.2.0 ************
19 23
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp
index f3cfb23..05d604f 100644
--- a/kabc/addresseeview.cpp
+++ b/kabc/addresseeview.cpp
@@ -390,6 +390,7 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
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() ) {
@@ -400,9 +401,34 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
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;