home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 May / Chip_2000-05_cd2.bin / suse / inst-sys / lib / YaST2 / clients / printconf_device_confirm.ycp < prev    next >
Encoding:
Text File  |  2000-03-30  |  2.5 KB  |  78 lines

  1. /* The Printer Configurator
  2.  * Confirmation of an autodetected parallel/USB printer
  3.  * Jan Holesovsky <kendy@suse.cz>, 2000
  4.  *
  5.  * $Id: printconf_device_confirm.ycp,v 1.4.4.3 2000/03/23 16:22:10 gs Exp $
  6.  */
  7.  
  8. /* Arguments:
  9.      1st: (map)  the printer record
  10.      2nd: (bool) am I the first dialog (when configuring?)
  11.  
  12.    Returns:
  13.      (map)       the printer record if successful
  14.      (void)      nil otherwise
  15. */
  16.  
  17. {
  18. // Help, part 1 of 3
  19.   string help_text = UI(_("<P>Printer autoprobing was successful.</P>
  20. "));
  21. // Help, part 2 of 3
  22.   help_text = help_text + UI(_("<P>If the printer is in the database of supported printers the name and
  23. the manufacturer of it should be shown.</P>
  24. "));
  25. // Help, part 3 of 3
  26.   help_text = help_text + UI(_("<P>In the worst case, YaST2 only knows the device that the printer is
  27. attached to and you have to choose a similar printer or a generic one.</P>
  28. "));
  29.  
  30.   map printer  = Args(0);
  31.   boolean frst = Args(1);
  32.   /* The end of the definitions */
  33.  
  34.   string|void manuf = lookup(printer, "manufacturer");
  35.   string|void model = lookup(printer, "model");
  36.   string|void conn_name = lookup(printer, "connection");
  37.   map|void dev_map = lookup(printer, conn_name);
  38.   string|void device = nil; 
  39.   if (dev_map != nil) device = lookup(dev_map, "device");
  40.  
  41.   if (model == nil)  model = UI(_("Unknown"));
  42.   if (manuf == nil)  manuf = UI(_("Unknown"));
  43.   if (device == nil) device = UI(_("Unknown"));
  44.  
  45.   string conn_lang = "";
  46.   if (conn_name == "parallel")
  47.     // This screen contains from some senteces
  48.     // Dialog, sentence 1parallel of 4
  49.     conn_lang = UI(_("YaST2 Printconf has found a parallel printer:"));
  50.   if (conn_name == "usb")
  51.     // Dialog, sentence 1usb of 4
  52.     conn_lang = UI(_("YaST2 Printconf has found an USB printer:"));
  53.   
  54.   term contents = 
  55.     `VBox(
  56.       `Left(`Label(conn_lang)),
  57.       // Dialog, sentence 2 of 4
  58.       // This means: Printer model '%1' by '%2'.
  59.       `Label(sformat(UI(_("%1 by %2")), model, manuf)),
  60.       // Dialog, sentence 3 of 4 (e.g. /dev/lp0)
  61.       `Left(`Label(_("On device:"))),
  62.       `Label(device),
  63.       // Dialog, sentence 4 of 4
  64.       `Left(`Label(_("Do you want to use it in your system?"))),
  65.       `VStretch(),
  66.       `Right(`PushButton(`id(`no), _("&No")))
  67.     );
  68.       
  69.   any dlg = UI(`SetPrintconfContents(_("Autodetected printer"),
  70.       contents, help_text, frst, _("&Yes")));
  71.     
  72.   any ret = UI(`UserInput());
  73.   
  74.   if (ret == `no) return add(printer, "add", false);
  75.   if (ret == `next) return add(printer, "add", true);
  76.   return nil;
  77. }
  78.