- use the new method in KTp::Contact to retrieve contact avatar - when no avatar is available, show the blue pawn instead of presence icon
Marking as confirmed and as a junior-job. Blue pawn image loading is already done inside KTp::Contact::avatarPixmap() anyway. We need to replace all the match.setIcon() code in ContactRunner::matchContacts with something that sets the icon to contact->avatarPixmap
Turns out this isn't trivial to use avatarPixmap(); You will get an assert "QPixmap: It is not safe to use pixmaps outside the GUI thread"
For the record: the warning is not an assert (won't crash), just a qWarning(), because using some methods (like QPixmap::grabWidget()) will crash when used outside GUI thread. Simple painting/copying pixmaps should be safe. We could try adding QApplication::setAttribute(Qt::AA_X11InitThreads) to KRunner's main(), that should silence the warning.
Update: we /must/ add the attribute to KRunner, otherwise the pixmaps are blank :(
Can we turn it off inside our block of code, and re-enable it when it leaves?
Unfortunately not: Qt::AA_X11InitThreads: Calls XInitThreads() as part of the QApplication construction in order to make Xlib calls thread-safe. This attribute must be set before QApplication is constructed. [0] [0] http://qt-project.org/doc/qt-4.8/qt.html#ApplicationAttribute-enum
KTp rules have been we run on KDE Workspaces now and now-1. So we can't patch KDE workspaces now. For Qt5 this problem doesn't exist as QPixmaps aren't X11 Pixmaps underneath so can be used in any thread. Slightly more boring patch uploaded to RB.
Git commit d259b4c143e8bdf5e17194e18f60622714ad7e39 by David Edmundson. Committed on 18/09/2013 at 01:36. Pushed by davidedmundson into branch 'master'. Show blue pawn icon if no avatar is available This makes everything consistent REVIEW: 112788 FIXED-IN: 0.7.0 M +1 -1 src/contactrunner.cpp http://commits.kde.org/ktp-contact-runner/d259b4c143e8bdf5e17194e18f60622714ad7e39