YaST2 Developers Documentation: Printer configurator



functions
files
intro

Printer configurator

misc.ycp
Miscelaneous defines.
Miscelaneous defines.

Imports

  • CUPS
  • Encoding
  • Label
  • Mode
  • PackageCallbacksInit
  • PackageSystem
  • Popup
  • Printer
  • Printerdb
  • Printerlib
  • Spooler
  • Wizard

Local Functions

local getFoomaticAutoQueues (string vendor, string model, string config) -> list<map<string,any> >

Get auto queues for printer when using foomatic database

Parameters:
vendor string vendor db key
model string model db key
config string choosen ppd file, nil = auto
Return value:
a list of PPD files

local sortitems (map<string,string> items) -> list<term>

Sort items according to locale

Parameters:
items map items (item key -> item label)
Return value:
a list of items to be used for selectionbox

local adjustPaperSize (map<string,any> p) -> map<string,any>

Check if paper size is set and if not, then set the defaul Don't change if already set

Parameters:
p map of printer to adjust paper size
Return value:
a map of printer with adjusted paper size

local replaceAll (string src, string from, string to) -> string

replaces all occurences of 'from' to 'to' in src

Parameters:
src input string
from string to be replaced
to string to be replaced by
Return value:
modified string

local getConfiguredPrinters () -> list<map>

Get printers (physical devices), which are configured

Return value:
a list of printers maps (one queue of each printer)

local isPrinterConfigured (string manuf, string model, string uri, string unique_key) -> boolean

Has a printer (physical) been already configured (contains at least one queue?

Parameters:
manuf string manufacturer of the printer
model string model of the printer
uri string URI of the printer
unique_key string unique_key of the printer
Return value:
true if already configured

local reinstallAll () -> boolean

Reinstall all printing related packages using package-manager

Return value:
true if success

local getHostnames (string type) -> list<string>

Get hosts available on local network. Reads from .net.hostnames. Shows popup window: Wait please.

Parameters:
type "ipp", "samba", "lpd" or ""
Return value:
a list Sorted list of hosts.

local DeleteItem (list source, any item) -> list

Return list without item.

Parameters:
source source list
item item to delete
Return value:
List without item. If item was not present in list, list is unchanged.

local testBaudRate (integer brate) -> boolean

Displays message when baud rate is 0.

Parameters:
brate Baud rate.
Return value:
Is baud rate ok?

local checkHostName (string name) -> boolean

Is the hostname correct? Check it for allowed characters. Display message if bad hostname.

Parameters:
name Hostname to check
Return value:
true if hostname is correct.

local checkUserName (string name) -> boolean

Is the username correct? Check it for allowed characters. Display message if bad username.

Parameters:
name Username to check
Return value:
true if username is correct.

local checkPassword (string name) -> boolean

Is the password correct? Check it for allowed characters. Display message if bad password.

Parameters:
name password to check
Return value:
true if hostname is correct.

local checkRemotePrinter (string remote_printer) -> boolean

Check if remote_printer is not nil. Display message otherwise.

Parameters:
remote_printer Printer name to check
Return value:
true if name is OK

local generateClassName (list forbidden_names) -> string

generate class name

Parameters:
forbidden_names list of forbidden names
Return value:
new class name

local reallyAbort () -> boolean

Ask if really abort. Uses boolean Printer::dirty. Sets boolean do_abort_now.

Return value:
true if user really wants to abort

local reallyExit () -> boolean

Ask if really exit. Uses boolean Printer::dirty. Sets boolean do_abort_now.

Return value:
true if user really wants to abort

local getDevicesItems (list<string> devices, string device) -> list

Get list of available devices in nice-names.

Parameters:
devices list of devices to show
device device that should be selected. If "" then first device will be selected.
Return value:
Items for selection box. One of the items is selected.

local printcapTable () -> list

Create the content of table of all entries in the printcap.

Return value:
List of items. Item id is index of printer in printcap.

local checkLocalQueueName (string name, list forbidden_names) -> boolean

Is the name of local queue correct? If not, display message.

Parameters:
name string queue name
forbidden_names list of forbidden names
Return value:
true if correct

local checkQueueName (string name) -> boolean

Is the name of the remote printer correct? If not, display message.

Parameters:
name Hostname to check
Return value:
true if hostname is correct.

local getWidgetForOption (string option_type, list values) -> term

Creates UI widgets from values.

Parameters:
option_type string type of the option (pick_one, pick_many, boolean)
values list values
Return value:
UI representation of vals

local filter1284 (string id) -> string

Remove characters that are not allowed by ieee1284.

Parameters:
id string to check
Return value:
updated string

local diffUppFiles (string file1, string file2) -> boolean

Compare saved gs_upp file with the generated one.

Parameters:
file1 contents of one upp file
file2 contents of the other upp file
Return value:
true if files are the same

local havePaperSize (map<string,any> selected) -> boolean

Looks if selected options contain paper size.

Parameters:
selected currently selected options
Return value:
true if they contain paper size

YaST2 Developers Documentation