author | zautrix <zautrix> | 2005-08-17 23:32:26 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-08-17 23:32:26 (UTC) |
commit | 9de953866db87933c9773b98502f07ac408c8ef7 (patch) (side-by-side diff) | |
tree | 34a7ce77ad554c69fb13102b22dcdfcf0178f078 | |
parent | a685e90ea183cba87e852d6f6272e54704034347 (diff) | |
download | kdepimpi-9de953866db87933c9773b98502f07ac408c8ef7.zip kdepimpi-9de953866db87933c9773b98502f07ac408c8ef7.tar.gz kdepimpi-9de953866db87933c9773b98502f07ac408c8ef7.tar.bz2 |
fix picture kapi
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 4 | ||||
-rw-r--r-- | kabc/addresseeview.cpp | 28 |
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 @@ -9,16 +9,20 @@ Added an error message dialog if saving of calendar files is not possible. Made it impossible to close KO/Pi if saving fails. Fixed a problem adding calendars on windows such that these calendars can be used on the memory stick. Added config options for conflict detection. KA/Pi: Added a config option to turn on asking before a contact is deleted. Fixed a problem with the default view and view selection at startup. Formatted name is now set on import, if formatted name is empty. +Fixed a problem of displaying images in the contact details view: +Now the wid/hei ratio is not changed. +I a picture is larger than 128 pixels in wid or hei it is downscaled to +max 128 pixels wid/hei. ********** VERSION 2.2.0 ************ New stable release! Fixed some minor usability problems. Added writing of next alarm to a file for usage on pdaXrom. diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp index f3cfb23..05d604f 100644 --- a/kabc/addresseeview.cpp +++ b/kabc/addresseeview.cpp @@ -385,29 +385,55 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) if ( true /*!mAddressee.organization().isEmpty()*/ ) { aOrga = "<tr>" "<td align=\"left\">" + mAddressee.organization() + "</td>" "</tr>"; } mText = ""; QString picString = ""; KABC::Picture picture = mAddressee.photo(); + if (picture.undefined() ) picture = mAddressee.logo(); bool picAvailintern = false; bool picAvailUrl = false; if (! picture.undefined() ) { picAvailintern = (picture.isIntern() && !picture.data().isNull()); picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); } if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; if ( picAvailintern ) { QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); + int wid = picture.data().width(); + int hei = picture.data().height(); + if ( wid > 128 || hei > 128 ) { + if ( wid > hei ) { + hei = (hei*128)/wid; + wid = 128; + } else { + wid = (wid*128)/hei; + hei = 128; + } + } + picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei); } else { if ( picAvailUrl ) { - QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); + QPixmap picPix( picture.url() ); + QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", picPix ); + int wid = picPix.width(); + int hei = picPix.height(); + if ( wid > 128 || hei > 128 ) { + if ( wid > hei ) { + hei = (hei*128)/wid; + wid = 128; + } else { + wid = (wid*128)/hei; + hei = 128; + } + } + picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei); } else { if ( !mAddressee.custom( "KADDRESSBOOK", "X-Children" ).isEmpty() ) { static bool setDefaultImageChildren = false; if ( !setDefaultImageChildren ) { QMimeSourceFactory::defaultFactory()->setPixmap( "familyIcon", KGlobal::iconLoader()->loadIcon( "ic_kids", KIcon::Desktop, 128 ) ); setDefaultImageChildren = true; } picString = "<img src=\"familyIcon\" width=\"64\" height=\"64\">"; |