178. Printer

Module for printer.

178.1. Summary of Module Globals

List of Global Functions

List of Global Variables

  • autodetected - List of autodetected printers. For documentation see yast2-lib-printer.

  • conf_detected - Configuring printer, which is result of detection?

  • confmode - Current mode of configuration `det for configuring from detected printers dialog `adm for configuring from printer administration dialog

  • connection_subtype_selected - Selected item from 2nd-level connection type dialog

  • connection_type_selected - Selected item from main connection type dialog

  • default_queue - Default queue name

  • deleted - List of printers that were deleted during this configuration session.

  • detect - Shall be printers detected If nil, ask user

  • detection - Type of start, true if autodetection

  • dirty - Were settings changed?

  • hp_driver - Driver (backend) for HP all-in-one devices, one of "ptal" and "hp"

  • index - Index of printer we are working with.

  • inform_about_config - Inform user that using different driver may be possible

  • printcap - List of print queues. See description of map printer for members structure.

  • printcap_backup - Backup list of print queues. See description of map printer for members structure.

  • printer - Print queue we are currently working with.

  • read_done - Were settings read?

  • runAutoprobedListDialog__current - Selected item of the list of detected printers

  • save_all - Has to be saved all?

  • skip_autodetection - True if autodetection should be skipped

  • tested - At least one queue has been tested - because of hw proposal

  • version - Version of YaST2 printer module for updates handling

  • write_only - Don't run SuSEconfig, don't restart services if true and possible

178.2. Global Functions

178.2.1. DeletedNames

get list of names of deleted printers.

Return value

  • list - List of names.

178.2.2. Detect

Autodetect printers.

Return value

  • list<map<string,any> > - autodetected printers

178.2.3. Export

Export module settings to map.

Return value

  • map<string, any> - Map of module settings.

178.2.4. Import

Import module settings.

Function parameters

  • map<string, any> settings

Return value

  • void

178.2.5. Propose

Autoconfigure all printers that haven't been configured yet.

Return value

  • void

178.2.6. Read

Read settings from disk or where.

Return value

  • boolean - success?

178.2.7. Reset

Reset all settings...

Return value

  • void

178.2.8. SaveQueue

Save queue

Function parameters

  • map<string,any> queue

Return value

  • boolean - sucefully save

178.2.9. Summary

Creates summary from autodetected printers and printcap.

Function parameters

  • list style

Return value

  • string - summary string

178.2.10. Write

Write settings.

Return value

  • boolean - success state

178.2.11. addToDeleted

Adds a queue to the deleted list

Function parameters

  • string name

  • string printer_type

Return value

  • void

178.2.12. adjustQueueName

Check if queue name is OK. Otherwise adds number at the end.

Function parameters

  • string name

  • list forbidden_names

Return value

  • string - new queue name.

178.2.13. alreadyConfigured

Has the printer been already configured?

Function parameters

  • string uk

Return value

  • boolean - true or false

178.2.14. assignDefault

Set implicit default queue if no queue is set as default

Return value

  • void

178.2.15. assignState

Assign states to a printer

Function parameters

  • map<string,any> p

  • boolean changed

Return value

  • map<string,any> - a map printer with assigned states

178.2.16. checkGhostscript

Check if GhostScript is installed

Return value

  • boolean - true if is installed

178.2.17. checkSpooler

Detect spooler currently in use

Return value

  • boolean - true on success

178.2.18. cupsRead

Read the CUPS settings.

Return value

  • list<map<string,any> > - a list of printers

178.2.19. deleteDeletedPrinters

Delete printers marked for being deleted

Return value

  • boolean - true on success

178.2.20. deletePrinter

Delete currently selected printer.

Return value

  • void

178.2.21. doPrinterDetection

Check if it is safe, ask user if needed, and detect local printers

Return value

  • boolean - true on success TODO error checking

178.2.22. editDetected

Prepare detected printer to be configured.

Function parameters

  • map det

Return value

  • void

178.2.23. fixPrinter

Add unpresent entries into a map

Function parameters

  • map<string,any> p

Return value

  • map<string,any> - modified map

178.2.24. generateClassName

generate class name

Function parameters

  • list forbidden_names

Return value

  • string - new class name

178.2.25. generateQueueName

TODO: create test case

Function parameters

  • string name

  • string uri

  • string vendor_name

  • string device_name

  • list<string> forbidden_names

Return value

  • string - new queue name

178.2.26. getArgsOfType

separates from config map only values of specified type

Function parameters

  • map config

  • string type

Return value

  • map - of selected values

178.2.27. getForbiddenNames

Return list(set) of names that can not be used as printer name. There can be same name for more printers in /etc/printcap. It was impossible to add printer, because all names were invalid because size (union (forbidden_names, new_names)) != size (forbidden_names) + size (new_names).

Return value

  • list<string> - a list of already used names

178.2.28. getQueueSuffix

Get the suffix for the queue name.

Function parameters

  • list<map<string,any> > queues

Return value

  • string - suffix

178.2.29. getUriType

Get type of currently selected printer. Just a shortcut to Printerlib::getUriType (...)

Return value

  • string - printer type

178.2.30. queuesRead

Old read function, called from new Read function TODO: better integrate TODO: error handling

Return value

  • boolean - true on success

178.2.31. saveDefaultQueue

Save default queue to appropriate location

Return value

  • boolean - true on success

178.2.32. savePrinters

Save all queues

Return value

  • boolean - true on success

178.2.33. selectPrinter

Select printer to edit or something.

Function parameters

  • integer i

Return value

  • void

178.2.34. selectPrinterByName

Let print queue named name be currently edited. If printer is not found, then queue will be $[] and index -1

Function parameters

  • string name

Return value

  • void

178.2.35. setDefaultPrinter

Set current printer as default printer

Return value

  • void

178.2.36. setUniqueKeys

Set unique keys after configuration reading

Return value

  • void

178.2.37. sortPrinters

Sorts entries of printcap

Return value

  • void

178.2.38. spoolerSpecQueuesRead

Read queues set for spooler

Return value

  • list<map<string,any> > - a list of queues

178.2.39. stateRead

Read the contents of /var/lib/YaST2/printers

Return value

  • boolean - true on success TODO error handling

178.2.40. storePrinter

Save currently edited printer.

Return value

  • void

178.2.41. testAbort

Test for abort.

Return value

  • boolean - true if abort was pressed

178.2.42. updateConfig

Update configuration if cfg. saved by previous version

Function parameters

  • integer read_version

Return value

  • void

178.2.43. wipePrinter

deletes printers

Function parameters

  • map printer

Return value

  • boolean - success state

178.3. Global Variables

178.3.1. autodetected

List of autodetected printers. For documentation see yast2-lib-printer.

178.3.2. conf_detected

Configuring printer, which is result of detection?

178.3.3. confmode

Current mode of configuration `det for configuring from detected printers dialog `adm for configuring from printer administration dialog

178.3.4. connection_subtype_selected

Selected item from 2nd-level connection type dialog

178.3.5. connection_type_selected

Selected item from main connection type dialog

178.3.6. default_queue

Default queue name

178.3.7. deleted

List of printers that were deleted during this configuration session.

178.3.8. detect

Shall be printers detected If nil, ask user

178.3.9. detection

Type of start, true if autodetection

178.3.10. dirty

Were settings changed?

178.3.11. hp_driver

Driver (backend) for HP all-in-one devices, one of "ptal" and "hp"

178.3.12. index

Index of printer we are working with.

178.3.13. inform_about_config

Inform user that using different driver may be possible

178.3.14. printcap

List of print queues. See description of map printer for members structure.

178.3.15. printcap_backup

Backup list of print queues. See description of map printer for members structure.

178.3.16. printer

Print queue we are currently working with.

178.3.17. read_done

Were settings read?

178.3.18. runAutoprobedListDialog__current

Selected item of the list of detected printers

178.3.19. save_all

Has to be saved all?

178.3.20. skip_autodetection

True if autodetection should be skipped

178.3.21. tested

At least one queue has been tested - because of hw proposal

178.3.22. version

Version of YaST2 printer module for updates handling

178.3.23. write_only

Don't run SuSEconfig, don't restart services if true and possible

178.4. Module Requirements

178.4.1. Module Imports

  • Arch
  • CUPS
  • Confirm
  • Crash
  • HTML
  • Label
  • Message
  • Mode
  • Package
  • Popup
  • Printerdb
  • Printerlib
  • Progress
  • Report
  • Service
  • Spooler
  • Stage
  • String
  • SuSEFirewall
  • Summary
  • URL

178.4.2. Module Includes