Make it possible to use KContacts without Qt::Gui
ClosedPublic

Authored by knauss on Jan 25 2017, 10:45 PM.

Details

Summary

Only QImage in KContacts::Picture needs Qt::Gui.
If Pictures isn't used in consumer, we do not need to threat them to
link Qt:Gui for nothing.

(Sink has no Qt::Gui dependencies right now).

Test Plan

Built all users of KContacts:

Diff Detail

Repository
R174 KContacts
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
knauss updated this revision to Diff 10568.Jan 25 2017, 10:45 PM
knauss retitled this revision from to Make it possible to use KContacts without Qt::Gui.
knauss updated this object.
knauss edited the test plan for this revision. (Show Details)
knauss added a reviewer: mlaurent.
Restricted Application added a project: KDE PIM. · View Herald TranscriptJan 25 2017, 10:45 PM
Restricted Application added a subscriber: KDE PIM. · View Herald Transcript
knauss updated this object.Jan 25 2017, 10:47 PM
knauss added a reviewer: KDE PIM.
knauss added a project: Kube.
mlaurent edited edge metadata.Jan 26 2017, 5:46 AM

Picture is used in addressee.cpp or vcardtools, so if you import vcard it will use Picture too so I don't see how you want to avoid QtGui linking.

knauss updated this revision to Diff 10583.Jan 26 2017, 11:45 AM
knauss edited edge metadata.

Update patch to show that also tests do not need QtGui anymore for linking

You can't avoid the linkage of QtGui inside KContacts, that is correct and I don't have plans to change this. The usage of QImage is only internaly in the library. The only external usage is KContacts::Picture::data/ KContacts::Picture::setData. Okay we have to move Qt:Gui to PRIVATE library.

The point I'm talking about is about using KContacts in external applications (f.ex. R9:f198198b9b08b331873185f66cd370e63ee46564 for Sink)

I'm doing only things that do not using picture at all:

Sink::ApplicationDomain::Contact contact;
KContacts::VCardConverter converter;
const auto addressee = converter.parseVCard(contact.getVcard());
contact.setUid(addressee.uid());
contact.setFn(addressee.formattedName());

until I don't really use addresse.picture.data() or addresse.picture.setData() - I don't need a full class defintion of QImage and the forward declaration of QImage is enough for the compiler/linker. I could also create and modify Picture objects without linking QtGui into Sink:

KContacts::Picture picture;
picture.setData("IMAGEBYTESTRING", "png");
[...]
mlaurent accepted this revision.Jan 29 2017, 6:35 AM
mlaurent edited edge metadata.

it seems better now.
Regards

This revision is now accepted and ready to land.Jan 29 2017, 6:35 AM
This revision was automatically updated to reflect the committed changes.