home *** CD-ROM | disk | FTP | other *** search
- /* The Printer Configurator
- * Confirmation of an autodetected parallel/USB printer
- * Jan Holesovsky <kendy@suse.cz>, 2000
- *
- * $Id: printconf_device_confirm.ycp,v 1.4.4.3 2000/03/23 16:22:10 gs Exp $
- */
-
- /* Arguments:
- 1st: (map) the printer record
- 2nd: (bool) am I the first dialog (when configuring?)
-
- Returns:
- (map) the printer record if successful
- (void) nil otherwise
- */
-
- {
- // Help, part 1 of 3
- string help_text = UI(_("<P>Printer autoprobing was successful.</P>
- "));
- // Help, part 2 of 3
- help_text = help_text + UI(_("<P>If the printer is in the database of supported printers the name and
- the manufacturer of it should be shown.</P>
- "));
- // Help, part 3 of 3
- help_text = help_text + UI(_("<P>In the worst case, YaST2 only knows the device that the printer is
- attached to and you have to choose a similar printer or a generic one.</P>
- "));
-
- map printer = Args(0);
- boolean frst = Args(1);
- /* The end of the definitions */
-
- string|void manuf = lookup(printer, "manufacturer");
- string|void model = lookup(printer, "model");
- string|void conn_name = lookup(printer, "connection");
- map|void dev_map = lookup(printer, conn_name);
- string|void device = nil;
- if (dev_map != nil) device = lookup(dev_map, "device");
-
- if (model == nil) model = UI(_("Unknown"));
- if (manuf == nil) manuf = UI(_("Unknown"));
- if (device == nil) device = UI(_("Unknown"));
-
- string conn_lang = "";
- if (conn_name == "parallel")
- // This screen contains from some senteces
- // Dialog, sentence 1parallel of 4
- conn_lang = UI(_("YaST2 Printconf has found a parallel printer:"));
- if (conn_name == "usb")
- // Dialog, sentence 1usb of 4
- conn_lang = UI(_("YaST2 Printconf has found an USB printer:"));
-
- term contents =
- `VBox(
- `Left(`Label(conn_lang)),
- // Dialog, sentence 2 of 4
- // This means: Printer model '%1' by '%2'.
- `Label(sformat(UI(_("%1 by %2")), model, manuf)),
- // Dialog, sentence 3 of 4 (e.g. /dev/lp0)
- `Left(`Label(_("On device:"))),
- `Label(device),
- // Dialog, sentence 4 of 4
- `Left(`Label(_("Do you want to use it in your system?"))),
- `VStretch(),
- `Right(`PushButton(`id(`no), _("&No")))
- );
-
- any dlg = UI(`SetPrintconfContents(_("Autodetected printer"),
- contents, help_text, frst, _("&Yes")));
-
- any ret = UI(`UserInput());
-
- if (ret == `no) return add(printer, "add", false);
- if (ret == `next) return add(printer, "add", true);
- return nil;
- }
-