home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * $Id: inst_ask_config.ycp,v 1.21 2000/03/10 12:59:20 kkaempf Exp $
- *
- * Module: inst_ask_config.ycp
- *
- * Author: Stefan Hundhammer <sh@suse.de>
- *
- * Purpose: Let the user branch into various configuration dialogs:
- *
- * user_settings: To be defined
- */
- {
-
- if (false) {
- // this is a multiprocessor system
- // the installed kernel modules are smp
- // but the running kernel is still uniprocessor (from installing)
- // configuration now does not work, because the smp modules can't
- // be loaded while the uniprocessor kernel is running.
- // tell the user to reboot (with the smp kernel) and do
- // the configuration later (after reboot).
- UI(`DisplayMessage(_("\
- This is a multiprocessor system.\n
- \n
- You must finish the installation now,\n
- reboot and use YaST2 later\n")));
- }
-
- list aprobe = [];
- map device = $[];
- string sub_vendor = "";
- string sub_device = "";
-
- // default text below "Detected:" for printer
- string printer_name = UI(_("no printer detected"));
- aprobe = SCR(`Read(.probe.byclass.printer));
- if (size (aprobe) > 0) {
- device = select (aprobe, 0);
- sub_vendor = lookup (device, "sub_vendor", "");
- sub_device = lookup (device, "sub_device", "");
- if ((sub_vendor != "") && (sub_device != ""))
- printer_name = sub_vendor + " " + sub_device;
- else
- printer_name = lookup (device, "vendor", "") + " " + lookup (device, "device", "");
- y2log (.milestone, "ask_config", 1, "printer: "+ printer_name);
- }
-
- // default text below "Detected:" for sound cards
- string sound_card_name = UI(_("no sound card detected"));
- aprobe = SCR(`Read(.probe.byclass.multimedia.audio));
- if (size (aprobe) > 0) {
- device = select (aprobe, 0);
- sub_vendor = lookup (device, "sub_vendor", "");
- sub_device = lookup (device, "sub_device", "");
- if ((sub_vendor != "") && (sub_device != ""))
- sound_card_name = sub_vendor + "\n" + sub_device;
- else
- sound_card_name = lookup (device, "vendor", "") + "\n" + lookup (device, "device", "");
- y2log (.milestone, "ask_config", 1, "sound: "+ sound_card_name);
- }
-
- // default text below "Detected:" for dialup internet
- string modem_name = UI(_("no modem or isdn card detected"));
- aprobe = SCR(`Read(.probe.byclass.modem));
- if (size (aprobe) == 0) {
- aprobe = SCR(`Read(.probe.byclass.isdn));
- }
- if (size (aprobe) > 0) {
- device = select (aprobe, 0);
- sub_vendor = lookup (device, "sub_vendor", "");
- sub_device = lookup (device, "sub_device", "");
- if ((sub_vendor != "") && (sub_device != ""))
- modem_name = sub_vendor + "\n" + sub_device;
- else
- modem_name = lookup (device, "vendor", "") + "\n" + lookup (device, "device", "");
- y2log (.milestone, "ask_config", 1, "modem: "+ modem_name);
- }
-
- // default text below "Detected:" for network
- string network_card_name = UI(_("no ethernet card detected"));
- aprobe = SCR(`Read(.probe.byclass.network));
- if (size (aprobe) > 0) {
- device = select (aprobe, 0);
- sub_vendor = lookup (device, "sub_vendor", "");
- sub_device = lookup (device, "sub_device", "");
- if ((sub_vendor != "") && (sub_device != ""))
- network_card_name = sub_vendor + "\n" + sub_device;
- else
- network_card_name = lookup (device, "vendor", "") + "\n" + lookup (device, "device", "");
- y2log (.milestone, "ask_config", 1, "network: "+ network_card_name);
- }
-
-
- // Build window contents
-
- term contents = `HBox(
- `HWeight( 3, `HStretch() ),
- `HWeight( 100,
- `HVCenter(
- `VBox(
- `VWeight( 3, `VStretch() ),
-
- `VWeight( 15,
- `Frame ( _( "Printer" ),
- `HBox(
- `HWeight( 55,
- // Constant text: Headline for detected hardware
- // The name of the hardware is displayed in the line below
- // `Left( `Label( _( "Detected:" ) ) ),
- `Left( `Label( printer_name ) )
- ),
-
- `HWeight( 45,
- // PushButton: Branch to printer configuration dialog
- `PushButton ( `id( `printer ), `opt( `hstretch ), _( "Configure &Printer..." ) )
- )
- )
- )
- ),
-
- `VWeight( 5, `VStretch() ),
- `VWeight( 15,
- `Frame ( _( "Sound" ),
- `HBox(
- `HWeight( 55,
- // Constant text: Headline for detected hardware
- // The name of the hardware is displayed in the line below
- // `Left( `Label( _( "Detected:" ) ) ),
- `Left( `Label( sound_card_name ) )
- ),
-
- `HWeight( 45,
- // PushButton: Branch to sound configuration dialog
- `PushButton ( `id( `sound ), `opt( `hstretch ), _( "Configure &Sound..." ) )
- )
- )
- )
- ),
-
- `VWeight( 5, `VStretch() ),
- `VWeight( 15,
- `Frame ( _( "Internet" ),
- `HBox(
- `HWeight( 55,
- // Constant text: Headline for detected hardware
- // The name of the hardware is displayed in the line below
- // `Left( `Label( _( "Detected:" ) ) ),
- `Left( `Label( modem_name ) )
- ),
-
- `HWeight( 45,
- // PushButton: Branch to internet configuration dialog
- `PushButton ( `id( `internet ), `opt( `hstretch ), _( "Configure &Internet..." ) )
- )
- )
- )
- ),
-
- `VWeight( 5, `VStretch() ),
- `VWeight( 15,
- `Frame ( _( "Network" ),
- `HBox(
- `HWeight( 55,
- // Constant text: Headline for detected hardware
- // The name of the hardware is displayed in the line below
- // `Left( `Label( _( "Detected:" ) ) ),
- `Left( `Label( network_card_name ) )
- ),
-
- `HWeight( 45,
- // PushButton: Branch to network configuration dialog
- `PushButton ( `id( `network ), `opt( `hstretch ), _( "Configure &Network..." ) )
- )
- )
- )
- ),
-
- `VWeight( 10, `VStretch() )
- )
- )
- ),
- `HWeight( 3, `HStretch() )
- );
-
- // Help text for inst_ask_config_x11.ycp:
- // The user is prompted to branch into various configuration dialogs.
- //
- // Help text (HTML-like) START
- string help_text = UI( _( "<p>
- Configure any of the system components shown.
- </p>" ) );
-
- // Help text (HTML-like) continued
- help_text = help_text + UI( _( "<p>
- If you wish, you can <b><i>skip those configurations now and instead finish the installaton</i></b>.
- You can perform those configurations later at any time.
- </p>" ) );
-
-
- // Help text (HTML-like) continued
- help_text = help_text + UI( _( "<p>
- Any of the configuration dialogs will take you back to this screen here after they are finished.
- </p>" ) );
-
- // Help text (HTML-like) END
- help_text = help_text + UI( _( "<p>
- Please notice that not all kinds of hardware can be detected automatically.
- If your hardware is not shown here, you may still be able to configure it manually.
- Just press the appropriate configuration button in this dialog.
- </p>" ) );
-
-
- UI(`SetWizardContents(
- // Headline for gerneral configuration screen:
- // The user can perform various configurations from here,
- // e.g. printer, sound, internet, network.
- _("System Component Configuration"),
- contents,
- help_text,
- Args(0), // have_back_button
- Args(1) // have_next_button
- )
- );
-
- UI(`ReplaceWizardNextButton(
- // new caption for "Next" button ("&Installation abschliessen" in german !)
- `PushButton(`id(`next), _("&Finish installation") )
- ));
-
- // Event loop
-
- any ret = nil;
-
- repeat
- {
- ret = UI(`UserInput());
- if ( ret == `printer ) CallModule( "printconf", [] );
- else if ( ret == `sound ) CallModule( "sound", [] );
- else if ( ret == `internet ) CallModule( "dialup", [] );
- else if ( ret == `network ) {
- CallModule( "lan", [] );
- // we're at the end of installation here, dhclient will
- // be restarted during bootup after we exit isnt_ask_config
- Shell("/sbin/init.d/dhclient stop 2>/dev/null"); // just in case
- }
- else if ( ret == `back )
- UI(`RestoreWizardNextButton());
-
- } until (ret == `next || ret == `back);
-
- UI(`SetModulename("inst_ask_config"));
-
- if (ret == `next)
- {
- // Popup window that is displayed after successful installation
- UI(`DisplayMessage(sformat(UI(_("\
- Your system is now installed.\n\
- Now you can log in as `%1'.")),
- lookup (user_settings, "loginname"))));
- }
-
- return ret;
- }
-