In 30 minutes of hacking after lunch I came up with this:
The printer-applet has been ported to KStatusNotifierItem in all its glory. I like KStatusNotifierItem. Besides the obvious presentation improvements, I was even able to remove a few custom functions for hiding/restoring the main menu and the tray icon for free. The less cruft, the better!
Unfortunately this is way too late for KDE 4.4. I probably would have tackled this earlier, except that the python bindings haven’t been in a working state this whole cycle, only starting to compile with 4.4 RC2.😦
I committed the patch to svn and only moments later realized I had made an i18n mistake. As long as you grab both revisions, the patch should be fairly safe to backport to distro packages. I’ve done a bit of testing to make sure nothing obvious broke, but it’s a new feature and as such may not be perfect. It’ll probably be OK since most distros aren’t releasing 4.4-based distros for another few months, which should be plenty of time to test. The Kubuntu packages for RC3 will have this patch, for the record.
Also in printer-applet trunkland, I did a few optimizations in regards to QStrings. (Using QLatin1String with QString.startsWith, using remove() rather than replace()-ing a char with an empty string, etc) Between switching to KStatusNotifierItem and this my unscientific testing shows that the printer-applet in 4.5 uses ~200 kilobytes less RAM than in 4.3.98. Not much considering it still takes up 19.1 MB of RAM on startup with my machine, but it’s still a bit better. It would be nice if somebody could port over the “don’t-start-the-gui-until-needed” code from the GTK+ printer-applet, as that would really help the situation a lot. Oh well, until either that or a C++ equivalent turn up, at least printer-applet integrates well with the systray in the meantime.
Edit: Include the fixes from r1084373 too, sorry ’bout that.