Swimming Upstream

This discussion is closed: you can't post new comments.

After a pleasant break during KDE 4.4 when I worked on stuff I wanted to do, I guess it's time to drag myself back to my penance, err I mean Printing, and trying to get the needed features up-streamed into Qt.  This primarily means taking the big mess of code I did last year, adding support across all the official Qt platforms and automated unit tests, and breaking it up into nice small bite-sized pieces to feed to the Trolls via Gitorious merge requests.

My first merge request for the Current Page option in the print dialog has already been accepted and will be in Qt 4.7.  This was a very simple change to do, but was a good way to test out the process as to took a few iterations to change it to how Qt wanted it.  Note that any apps that wish to use the feature will need to enable the option as it can't be turned on by default.

My next merge request, just submitted, is for Multiple Page Ranges (e.g. "1,3-5,7-9").  The 'fun' and time-consuming part here was to set up a Virtualbox Windows development environment to compile and test the code on that platform (eventually I'll have to set up a Mac one too, but for now I'm not bothering as OS X doesn't support these features).  If it survives the merge review and the Nokia lawyers, it should be in Qt 4.8 (sorry, no sooner than that).

The next few feature submissions in fairly short order should be:

  •   Page Set (Odd/Even pages)
  •   Print Page List to simplify app code
  •   File Printing
  •   Cups options on Unix (n-up, banners, job control, etc)
  •   Server-side page selection
  •   Page Order support on Windows
  •   Application tabs support on Windows and Mac OS X

After that I'll take a break to go back to some coding on KHolidays, KLocale, Calendar Systems, and the Plasma Clock for KDE 4.5, before moving onto the biggie: saving and restoring print settings.

Right now, however, I'm looking for some help on the Page Set code on Windows, so any Windows hackers out there keep reading!

Windows does not provide a built-in option for Page Set, so I need to add a new combo control to their print dialog.  From reading MSDN it appears I need to define a new custom template for the standard Print Properties Sheet:

I think the required steps are:

  •   Copy the PRINTDLGEXORD template from Prnsetup.dlg (to where?) and add the new control
  •   Set the PRINTDLGEX PD_ENABLEPRINTTEMPLATE flag
  •   Set the PRINTDLGEX PD_USELARGETEMPLATE flag if the custom template is larger
  •   Create an object in memory from the custom template (how?)
  •   Set the PRINTDLGEX hInstance to the in-memory object
  •   Create a IPrintDialogCallback object (how?)
  •   Use the callback object to set and read the Page Set (how?)

That's the theory, but I have no idea how to actually do this.  It's probably elementary to a Windows hacker, but I'm over my head here :-)

I've coded up what I can and pushed it to Gitorious.  Commit f55cd14a is for the common framework and other platforms, and commit f73119eb sketches out where I think the Windows dialog code needs implementing.  All you need to do is fill in the TODO items :-)

Once this is done, it should then be easy to add support for the Page Order feature by adding a tickbox for "Reverse pages".

It should also help with using the PRINTDLGEX lphPropertyPages feature to implement the QAbstractPrintDialog::setOptionTabs() feature.  Bonus points for figuring out how to make that happen!

So if this looks like something you'd like to help with, drop me a line, I'm john (squiqly thingy) layt (dotty thingy) net.

Oh, and if you do send code, it should be stating the obvious that you must be willing to agree to Nokia's contribution agreement.