[Kde-pim] Review Request: Don't always recompress contact photos when saving

Sebastian Scheibner asamk at gmx.de
Sat Oct 6 17:15:11 BST 2012



> On Oct. 6, 2012, 4:05 p.m., Kevin Krammer wrote:
> > kabc/picture.cpp, line 135
> > <http://git.reviewboard.kde.org/r/106745/diff/1/?file=88533#file88533line135>
> >
> >     I am wondering if this needs to be done here or if it couldn't be moved to ::data()
> >     That way decoding is only necessary when the QImage is actually retrieved, not when the Picture is only passed around.
> >

yeah, however ::data() couldn't store the QImage in d->mData because it's const, as well as VCardTool::createPicture(), ...
So the Image is loaded every time it's accessed through ::data(), if that is not too often for one Picture, it shouldn't be a problem.


- Sebastian


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/106745/#review20008
-----------------------------------------------------------


On Oct. 6, 2012, 3:45 p.m., Sebastian Scheibner wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/106745/
> -----------------------------------------------------------
> 
> (Updated Oct. 6, 2012, 3:45 p.m.)
> 
> 
> Review request for KDEPIM-Libraries.
> 
> 
> Description
> -------
> 
> When changing a contact with a photo, the photo is recompressed when saving (even though the photo wasn't changed). That's because the photo is loaded into a QImage and when the contact is saved, the QImage is compressed as JPEG again (or PNG if it contains an alpha-channel, which most don't).
> 
> This patch stores the raw base64 photo data from the vcard as a QByteArray in KABC::Picture. If the photo is not changed, this QByteArray is simply used when saving the contact, so there's no recompression and quality loss. If the photo was changed it gets compressed as JPEG as before.
> 
> fixes this bug: https://bugs.kde.org/show_bug.cgi?id=307570
> 
> 
> This addresses bug 307570.
>     http://bugs.kde.org/show_bug.cgi?id=307570
> 
> 
> Diffs
> -----
> 
>   kabc/picture.h bf9745c 
>   kabc/picture.cpp 0a51c8b 
>   kabc/vcardtool.cpp a742788 
> 
> Diff: http://git.reviewboard.kde.org/r/106745/diff/
> 
> 
> Testing
> -------
> 
> compiled kdepimlibs/kabc with kde 4.9.2
> 
> - created a new contact in kaddressbook and added a photo. exported the contact.
> - changed the photo and exported the contact again
> - the image data in the exported file didn't change
> 
> 
> Thanks,
> 
> Sebastian Scheibner
> 
>

_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list