Printing/KDE4 API

From KDE Community Wiki
Revision as of 09:04, 27 May 2011 by Jlayt (talk | contribs) (Created page with '=Changes Needed to the KPrinter API= Can we inherit QPrinter? QPrinter lets us set our own QPrintEngine and QPaintDevice. Is this enough? ==Changes or additions for QPrinter ...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Changes Needed to the KPrinter API

Can we inherit QPrinter? QPrinter lets us set our own QPrintEngine and QPaintDevice. Is this enough?

Changes or additions for QPrinter Compatibility

  • collate(), setCollate(CollateType) and the CollateType enum should be replaced by collateCopies() and setCollateCopies(bool)
  • printEngine() - we probably don't want this anyway
  • printRange(), setPrintRange(PrintRage)
  • setWinPageSize(int)
  • QList<PaperSource> supportedPaperSources()
  • setWinPageSize(int), winPageSize() - not portable, probably ignore


QPrinter Qt3 support methods in KPrinter

  • aborted() - Use printerState() == QPrinter::Aborted instead; used by extragear/graphics/ligature/shell, koffice/kugar/lib/mreportviewer.cpp
  • margins(int*, int*, int*, int*), margins() - use pageRect() and paperRect() instead. Note that the setMargins() compatibility code in KPrinter apparently doesn't work, as the setting is ignored by the QPrintEngine backends, which get the info directly from the CUPS etc. or the fullPage setting; used by Okular (for widths - should be easy to port), KHTML (only in debug statements), KAddressBook, KOrganizer, KTimeTracker, Umbrello, KFax and probably KOffice
  • maxPage(), minPage(), setMinMax(int,int) - use QPrintDialog::maxPage(), QPrintDialog::minPage(), QPrintDialog::setMinMax(int,int) instead; used by KGhostView, KOffice, Okular, Ligature/Shell
  • outputToFile(), setOutputToFile(bool) - inferred from whether outputFileName() is empty; used by Umbrello (unnecessarily) and KBackGammon (just saves the setting)
  • setup(QWidget*), although the KPrinter version has a different signature (two extra args). The Qt4 way is to pass the QPrinter as an argument to the QPrintDialog constructor. Used everywhere

Extra goodies in KPrinter

  • PageSetType pageSet() - all, odd, even. No corresponding setPageSet()
  • previewOnly()/setPreviewOnly() - used for print-preview
  • QString option(QString) - allows fetching options set in the custom dialog pages
  • errorMessage() - the API docs lie and claim it's not implemented
  • autoConfigure(QString,QWidget*) - sets up the printer without need for a dialog. Does show a dialog if a pseudo-printer needing a file name is selected
  • docFileName()/setDocFileName()/docDirectory()/setDocDirectory()
  • static addDialogPage(), static addStandardPage(), static removeStandardPage() - dialog configuration, should probably be removed or deprecated if we go the Qt4 route for doing dialog setup
  • static pageSelection() - if the underlying print system can't handle page selection (eg: 1,4,7-9) then the application may be able to instead. This function allows the application to tell KPrinter that it can do this.

Deprecated/Internal methods in KPrinter

  • realPageSize()/setRealPageSize() - deprecated and marked as internal use only; realPageSize() not used outside KPrinter, setRealPageSize() used by KPrinterImpl
  • realDrawableArea()/setRealDrawableArea() - deprecated and marked as internal use only; not used outside KPrinter
  • implementation() - marked as internal use only
  • options/setOptions()/initOptions - marked as internal use only; initOptions() is only used by kprinter utility
  • searchName()/setSearchName() - marked as internal use only; searchName() is only used by KPrintDialog, setSearchName() is used by the kprinter utility, KMManager, KMPrinter, KMVirtualManager, and KPrintDialog; stored as kde-searchname in options
  • setErrorMessage() - marked as internal use only
  • static applicationType()/setApplicationType() - for "standalone" print applications - used by the kprinter utility and the cups job manager