print(“improvements”)

I was quite happy with print-manager progress as you can read on my last post, in about 3 weeks of work it looked like almost everything was done, so I started to create the Add Printer Assistant, and my first problem was: “I really need threads now”. My idea was to add threads support on KDE SC 4.6, till there we would have UI freezes but not so much… The problem was that the cups method to get new printers hangs for 30 seconds, so it’s not a short freeze anymore.

The pain of threads… My graduation project was an application called doKa that downloaded using threads, well it was a really nice project and working with threads there gave me lot’s of ground to start putting threads in printer-manager, but this time I had a really hard work :P. The problem is that when the authentication dialog comes up we need to do some event loop locking, as the thread needs to wait for the end of the dialog and the UI must only return when the user type it’s password. It worked when just one thing was done at time, but as the printers list has to be updated we got into a dead lock, all the calls to cups started a QEventLoop so we could call exit on it when the cups request was finished, but the first call to cups would only exit after the second call exited which never happens, even if we explicit called loop->exit(). Thiago Maciera helped a lot with some stuff I was doing wrong but after that the problem got intermittent 😛

I was almost giving up… I had lots of ideas and lots of ways of how not to do it! But finally I had the async idea that solved every thing, now each request returns a request object that emits finished when it’s done so no more locking with QEventLoops and no more dead locks 😀

Right, so now is just the Add Printers UI right?

Well yes, but no, Riddell invited me to go to UDS to talk about KPackageKit/aptcc and printer-manager stuff and being there one of the developers of the gnome printer applet showed to me what I’d need to do in the Add Printer UI which is not so simple stuff. There is lots of magic (logic) to find a good match to the printer driver, samba searches, queue searches… how to handle when a printer is plugged in. This was very important, since I was doing a simple http://localhost:631 replacement and then I saw that doing these things would be very important… So yes, no printer-manager in KDE SC 4.5.

But hey! Don’t be sad, today I and some oxygen friends made some UI improvements, and it’s looking really nice, pinheiro is also working on some more icons (fax, MFP…) so here you can see some progress, hopefully soon I’ll have the Add Printer doing some stuff, and maybe you distro can backport that 😀

System Settings Module
Supply Levels
Print Queue
System Preferences
Chosing a PPD driver
Configure Printer Settings
Permissions

You have made known to me the path of life; you will fill me with joy in your presence, with eternal pleasures at your right hand. Psalm 16:11 (NIV)

print(“improvements”)