207. Printer

207.1. Authors

    207.2. Summary of Module Globals

    List of Global Functions

    • Abort - Abort function

    • AddQueue - Add new queue or overwrite existing queue

    • AutoPackages - Return packages needed to be installed and removed during Autoinstallation to insure module has all needed software installed.

    • AutodetectQueues - Autodetect queues by calling a bash script which calls "lpstat -v" and processes its output and stores the results as YCP list in a temporary file and then read the temporary file (SCR::Read) to get the YCP list of @ref autodetected_queue_map

    • ConnectionItems - Create a list of items from the autodetected connections which is used for the SelectionBox in the BasicAddDialog and SelectConnectionDialog

    • DeleteQueue - Delete queue

    • DetermineDriverOptions - Determine driver options by calling a bash script which calls "lpoptions -l" and processes its output and stores the results as YCP list in a temporary file and then read the temporary file (SCR::Read) to get the YCP list of @ref autodetected_queue_map

    • DriverItems - Create a list of items from the PPD database entries which is used for the SelectionBox in the BasicAddDialog and SelectDriverDialog

    • DriverOptionItems - Create a list of tree widget items from the driver_options which is used for the tree widget in the DriverOptionsDialog

    • Export - Dump the printer settings to a single map (For use by autoinstallation.)

    • FirewallConfig - Determined and set at runtime in the "Print via Network" and "Sharing" dialogs by calling Printer::FirewallConfig("read") and Printer::FirewallConfig("write")

    • Import - Get all printer settings from the first parameter (For use by autoinstallation.)

    • Modified - Prototypes

    • Modified - Data was modified?

    • NewQueueName - Create a valid new queue name.

    • QueueItems - Create the list of queues for the Table in the OverviewDialog

    • Read - Initialize printer configuration (checks only the installed packages) see http://en.opensuse.org/YaST/Development/Printer_Enhancement#Basic_Implementation_Principles: for background information

    • Write - Finish printer configuration (does actually nothing except to exit verbosely) see http://en.opensuse.org/YaST/Development/Printer_Enhancement#Basic_Implementation_Principles: for background information

    List of Global Variables

    • connections - Autodetected printers: Determined at runtime via Printer::AutodetectPrinters() which calls the bash script "/usr/lib/YaST2/bin/autodetect_printers" which outputs on stdout a YCP list of @ref autodetected_printer_map where the last list entry is an emtpy map.

    • driver_options - Driver options (options in the PPD for one specific existing queue): Determined at runtime via Printer::DetermineDriverOptions( "queue_name") which calls the bash script "/usr/lib/YaST2/bin/determine_printer_driver_options" which outputs on stdout a YCP list of @ref driver_option_map where the last list entry is an emtpy map.

    • firewall_config - Firewall configuration: Determined and set at runtime in the "Print via Network" and "Sharing" dialogs by calling Printer::FirewallConfig("read") and Printer::FirewallConfig("write") which calls SuSEFirewall functions to fill in the map @ref firewall_config except "ui_browsing_from_int", "ui_access_from_int", and "ui_deny_from_ext" which are the user settings in the dialog or change the SuSEFirewall settings according to "ui_browsing_from_int", "ui_access_from_int", and "ui_deny_from_ext". The entries are such that "true" is the default, reasonable and intended setting. In particular it is reasonable to deny CUPS Browsing packages (port 631 UDP) from the EXT zone to avoid "print job phishing" by announcing local queue names from a malicious external host, see http://www.cups.org/newsgroups.php?gcups.general+T+Q"print+job+phishing"

    • modified - Data was modified?

    • number_chars - Explicite listing of all alphanumeric ASCII characters. The reason is that in certain special locales for example [a-z] is not equivalent to "abcdefghijklmnopqrstuvwxyz" because in certain special languages the 'z' is not the last character in the alphabet, e.g. the Estonian alphabet ends with ... s ... z ... t u v w ... x y (non-ASCII characters omitted here) so that [a-z] would exclude t u v w x y in an Estonian locale. Therefore uppercase and lowercase characters are both explicitely listed to avoid any unexpected result e.g. of "tolower(uppercase_characters)".

    • ppds - PPD database: the database is created anew in Printer::CreateDatabase() which calls the bash script "/usr/lib/YaST2/bin/create_ppd_database" which outputs on stdout a YCP list of @ref printer_ppd_map where the last list entry is an emtpy map. Printer::CreateDatabase() leaves manufacturer and modelname empty because it would take several minutes (instead of a few seconds) to fill them up (see the comments in create_ppd_database). Both fields can be filled up during runtime for particular PPDs (e.g. for a more detailed PPD selection among several PPDs which match to a particular model or manufacturer but not for all the thousands of PPDs which are installed in the system).

    • proposal_valid -

    • queue_filter_show_local - Queue filter string: Can be either "all" or "local" or "remote" depending on which kind of queues from the queues list (of queue maps) the user wants to see in the overview dialog. Preset to "all" which indicates that all queues are shown.

    • queues - Autodetected queues: Determined at runtime via Printer::AutodetectQueues() which calls the bash script "/usr/lib/YaST2/bin/autodetect_print_queues" which outputs on stdout a YCP list of @ref autodetected_queue_map where the last list entry is an emtpy map.

    • selected_connections_index - Selected autodetected printer index: The index in the autodetected printers list (of connection maps) for the connection which was selected by the user. Preset to -1 which indicates that no connection is selected.

    • selected_ppds_index - Selected PPD database index: The index in the PPD database list (of PPD maps) for the PPD which was selected by the user. Preset to -1 which indicates that no PPD is selected.

    • selected_queues_index - Selected queue index: The index in the queues list (of queue maps) for the queue which was selected by the user. Preset to -1 which indicates that no queue is selected.

    • write_only - Write only, used during autoinstallation. Don't run services and SuSEconfig, it's all done at one place.

    207.3. Global Functions

    207.3.1. Abort

    Abort function

    Return value

    • boolean - return true if abort

    207.3.2. AddQueue

    Add new queue or overwrite existing queue

    Function parameters

    • string queue_name

    Return value

    • boolean - true on success

    207.3.3. AutoPackages

    Return packages needed to be installed and removed during Autoinstallation to insure module has all needed software installed.

    Return value

    • map - with 2 lists.

    207.3.4. AutodetectQueues

    Autodetect queues by calling a bash script which calls "lpstat -v" and processes its output and stores the results as YCP list in a temporary file and then read the temporary file (SCR::Read) to get the YCP list of @ref autodetected_queue_map

    Return value

    • boolean - true on success

    207.3.5. ConnectionItems

    Create a list of items from the autodetected connections which is used for the SelectionBox in the BasicAddDialog and SelectConnectionDialog

    Function parameters

    • string connection_filter_string

    Return value

    • list - of connections (i.e. DeviceURI, model, and info of the "lpinfo -l -v" output)

    207.3.6. DeleteQueue

    Delete queue

    Function parameters

    • string queue_name

    Return value

    • boolean - true on success

    207.3.7. DetermineDriverOptions

    Determine driver options by calling a bash script which calls "lpoptions -l" and processes its output and stores the results as YCP list in a temporary file and then read the temporary file (SCR::Read) to get the YCP list of @ref autodetected_queue_map

    Function parameters

    • string queue_name

    Return value

    • boolean - true on success

    207.3.8. DriverItems

    Create a list of items from the PPD database entries which is used for the SelectionBox in the BasicAddDialog and SelectDriverDialog

    Function parameters

    • string driver_filter_string

    • boolean preselection

    Return value

    • list - of drivers (i.e. the NickName entries of the PPDs)

    207.3.9. DriverOptionItems

    Create a list of tree widget items from the driver_options which is used for the tree widget in the DriverOptionsDialog

    Function parameters

    • string selected_keyword

    • string selected_value

    Return value

    • list - of driver options items for a tree widget

    207.3.10. Export

    Dump the printer settings to a single map (For use by autoinstallation.)

    Return value

    • map - Dumped settings (later acceptable by Import ())

    207.3.11. FirewallConfig

    Determined and set at runtime in the "Print via Network" and "Sharing" dialogs by calling Printer::FirewallConfig("read") and Printer::FirewallConfig("write")

    Function parameters

    • string action

    Return value

    • boolean - true on success

    207.3.12. Import

    Get all printer settings from the first parameter (For use by autoinstallation.)

    Function parameters

    • map settings

    Return value

    • boolean - True on success

    207.3.13. Modified

    Prototypes

    Return value

    • boolean

    207.3.14. Modified

    Data was modified?

    Return value

    • boolean - true if modified

    207.3.15. NewQueueName

    Create a valid new queue name.

    Function parameters

    • string proposal

    Return value

    • string

    207.3.16. QueueItems

    Create the list of queues for the Table in the OverviewDialog

    Function parameters

    • boolean local

    • boolean remote

    Return value

    • list - table items

    207.3.17. Read

    Initialize printer configuration (checks only the installed packages) see http://en.opensuse.org/YaST/Development/Printer_Enhancement#Basic_Implementation_Principles: for background information

    Return value

    • boolean - true on success

    207.3.18. Write

    Finish printer configuration (does actually nothing except to exit verbosely) see http://en.opensuse.org/YaST/Development/Printer_Enhancement#Basic_Implementation_Principles: for background information

    Return value

    • boolean - true in any case (because it only exits)

    207.4. Global Variables

    207.4.1. connections

    Autodetected printers: Determined at runtime via Printer::AutodetectPrinters() which calls the bash script "/usr/lib/YaST2/bin/autodetect_printers" which outputs on stdout a YCP list of @ref autodetected_printer_map where the last list entry is an emtpy map.

    autodetected_printer_map
     $[ "uri":"the full CUPS DeviceURI (required)",
        "model":"the manufacturer and model, often "Unknown" (may be the empty string)",
        "deviceID":"what the printer reported as its device ID (often the empty string)",
        "info":"arbitrary info regarding this connection (may be the empty string)",
        "class":"the kind of connection, e.g. "direct","network","file" (may be the empty string)"
      ]

    207.4.2. driver_options

    Driver options (options in the PPD for one specific existing queue): Determined at runtime via Printer::DetermineDriverOptions( "queue_name") which calls the bash script "/usr/lib/YaST2/bin/determine_printer_driver_options" which outputs on stdout a YCP list of @ref driver_option_map where the last list entry is an emtpy map.

    driver_option_map
     $[ "keyword":"the main keyword of the option in the PPD (required)",
        "translation":"the translation string of the main keyword (may be the empty string)",
        "values":["a list of the option keywords in the PPD (at least one non-empty entry is required)
                   i.e. the values for the main keyword (i.e. the values for this option)
                   where the currently set option value of the queue is marked by a leading '*'
                   and where the last list entry is an emtpy string"],
        "selected":"the curently selected value in the DriverOptionsDialog (may be the empty string)"
      ]

    207.4.3. firewall_config

    Firewall configuration: Determined and set at runtime in the "Print via Network" and "Sharing" dialogs by calling Printer::FirewallConfig("read") and Printer::FirewallConfig("write") which calls SuSEFirewall functions to fill in the map @ref firewall_config except "ui_browsing_from_int", "ui_access_from_int", and "ui_deny_from_ext" which are the user settings in the dialog or change the SuSEFirewall settings according to "ui_browsing_from_int", "ui_access_from_int", and "ui_deny_from_ext". The entries are such that "true" is the default, reasonable and intended setting. In particular it is reasonable to deny CUPS Browsing packages (port 631 UDP) from the EXT zone to avoid "print job phishing" by announcing local queue names from a malicious external host, see http://www.cups.org/newsgroups.php?gcups.general+T+Q"print+job+phishing"

    firewall_config
     $[ "suse_firewall_used":"true if Suse Firewall and no other firewall is used",
        "firewall_active":"true if Suse Firewall is actually running",
        "no_firewall_for_int":"true if Suse Firewall does not potect the INT zone",
        "browsing_from_int":"true if Suse Firewall does not deny CUPS Browsing (port 631 UDP) from the INT zone",
        "ui_browsing_from_int":"true if user has set in dialog not to deny CUPS Browsing from the INT zone",
        "access_from_int":"true if Suse Firewall does not deny CUPS access (port 631 TCP) from the INT zone",
        "ui_access_from_int":"true if user has set in dialog not to deny CUPS access from the INT zone",
        "deny_from_ext":"true if any CUPS access (port 631 UDP and TCP) is denied from the EXT zone",
        "ui_deny_from_ext":"true if user has set in dialog to deny any CUPS access from the EXT zone"
      ]

    207.4.4. modified

    Data was modified?

    207.4.5. number_chars

    Explicite listing of all alphanumeric ASCII characters. The reason is that in certain special locales for example [a-z] is not equivalent to "abcdefghijklmnopqrstuvwxyz" because in certain special languages the 'z' is not the last character in the alphabet, e.g. the Estonian alphabet ends with ... s ... z ... t u v w ... x y (non-ASCII characters omitted here) so that [a-z] would exclude t u v w x y in an Estonian locale. Therefore uppercase and lowercase characters are both explicitely listed to avoid any unexpected result e.g. of "tolower(uppercase_characters)".

    207.4.6. ppds

    PPD database: the database is created anew in Printer::CreateDatabase() which calls the bash script "/usr/lib/YaST2/bin/create_ppd_database" which outputs on stdout a YCP list of @ref printer_ppd_map where the last list entry is an emtpy map. Printer::CreateDatabase() leaves manufacturer and modelname empty because it would take several minutes (instead of a few seconds) to fill them up (see the comments in create_ppd_database). Both fields can be filled up during runtime for particular PPDs (e.g. for a more detailed PPD selection among several PPDs which match to a particular model or manufacturer but not for all the thousands of PPDs which are installed in the system).

    printer_ppd_map
     $[ "ppd":"the PPD file name with path below /usr/share/cups/model/ (required)",
        "nickname":"the NickName entry in the PPD (required)",
        "deviceID":"the 1284DeviceID entry in the PPD (may be the empty string)",
        "language":"the language of the PPD, usually "en" (may be the empty string)",
        "manufacturer":"the Manufacturer entry in the PPD (initially the empty string)",
        "modelname":"the ModelName entry in the PPD (initially the empty string)"
      ]

    207.4.7. proposal_valid

    207.4.8. queue_filter_show_local

    Queue filter string: Can be either "all" or "local" or "remote" depending on which kind of queues from the queues list (of queue maps) the user wants to see in the overview dialog. Preset to "all" which indicates that all queues are shown.

    207.4.9. queues

    Autodetected queues: Determined at runtime via Printer::AutodetectQueues() which calls the bash script "/usr/lib/YaST2/bin/autodetect_print_queues" which outputs on stdout a YCP list of @ref autodetected_queue_map where the last list entry is an emtpy map.

    autodetected_queue_map
     $[ "name":"the queue name (required)",
        "uri":"the full CUPS DeviceURI (required)",
        "description":"(may be the empty string)",
        "location":"(may be the empty string)",
        "ppd":"/etc/cups/ppd/<queue-name>.ppd (may be the empty string)",
        "default":"'yes' if it is a DefaultPrinter in /etc/cups/printers.conf, otherwise the empty string",
        "disabled":"'yes' if printing is disabled, otherwise 'no'",
        "rejecting":"'yes' if print job are rejected, otherwise 'no'",
        "config":"either 'local' if the queue exists in /etc/cups/printers.conf, otherwise 'remote' (required)"
      ]

    207.4.10. selected_connections_index

    Selected autodetected printer index: The index in the autodetected printers list (of connection maps) for the connection which was selected by the user. Preset to -1 which indicates that no connection is selected.

    207.4.11. selected_ppds_index

    Selected PPD database index: The index in the PPD database list (of PPD maps) for the PPD which was selected by the user. Preset to -1 which indicates that no PPD is selected.

    207.4.12. selected_queues_index

    Selected queue index: The index in the queues list (of queue maps) for the queue which was selected by the user. Preset to -1 which indicates that no queue is selected.

    207.4.13. write_only

    Write only, used during autoinstallation. Don't run services and SuSEconfig, it's all done at one place.

    207.5. Module Requirements

    207.5.1. Module Imports

    • Popup
    • Printerlib
    • Progress
    • SuSEFirewall
    • Summary

    207.5.2. Module Includes