home *** CD-ROM | disk | FTP | other *** search
- /**
- * File:
- * include/bootloader/generic/wizards.ycp
- *
- * Module:
- * Bootloader installation and configuration
- *
- * Summary:
- * Generic wizard sequences for bootloader installation/configuration
- *
- * Authors:
- * Joachim Plack <jplack@suse.de>
- *
- * $Id: wizards.ycp 27748 2006-02-08 15:15:11Z jplack $
- *
- */
-
-
- {
- textdomain "bootloader";
-
- import "Sequencer";
- import "Report";
- import "Bootloader";
- import "CWMTab";
-
-
- // calculate the list of available section types
- list<string> section_types () {
- list<string> st_list = [];
-
- map functions = Bootloader::getFunctions (BootCommon::getLoaderType (false));
- list<string>() toEval = (list<string>())functions["section_types"]:nil;
-
- if (toEval != nil)
- st_list = toEval ();
-
- return st_list;
- }
-
-
- /**
- * Run dialog for generic section editation
- * @return symbol for wizard sequencer
- */
- symbol SectionEditDialog () {
- string type = BootCommon::current_section["type"]:"";
- list<string> st = section_types ();
-
- if (!contains(st, type)) {
- y2error("Found unknown section type %1", type);
- type = st[0]:nil;
- BootCommon::current_section["type"] = type;
- }
- string se_type = "section_edit_" + type;
- map<string,map<string,any> > widget_descr = (map<string,map<string,any> >)
- union (CommonSectionWidgets (), Bootloader::blWidgetMaps ());
-
- if (! haskey(widget_descr, se_type) ) {
- y2error("Could not find a dialog %1", se_type);
- return nil;
- }
-
- term contents = `HBox (
- `HSpacing (2),
- `VBox (
- `VStretch (),
- // heading
- `Left (`Heading (_("Section Editor"))),
- `VSpacing (1),
- "name",
- `VStretch (),
- // frame
- `Frame (_("Section Settings"),
- `HBox (
- `HSpacing (2),
- se_type,
- `HSpacing (2)
- )
- ),
- `VStretch ()
- ),
- `HSpacing (2)
- );
-
- return CWM::ShowAndRun ($[
- "widget_descr" : widget_descr,
- "widget_names" : ["name", se_type],
- "contents" : contents,
- "caption" : _("Boot Loader Settings: Section Management"),
- "back_button" : Label::BackButton (),
- "abort_button" : Label::AbortButton (),
- "next_button" : Label::OKButton (),
- "fallback_functions" : section_handlers,
- ]);
- }
-
-
- /**
- * Store the modified section
- * @return symbol always `next
- */
- symbol GenericStoreSection () {
- BootCommon::current_section["__changed"] = true;
-
- y2debug ("Storing section: index: %1, contents: %2",
- BootCommon::current_section_index,
- BootCommon::current_section);
- if (BootCommon::current_section_index == -1)
- {
- BootCommon::sections
- = add (BootCommon::sections, BootCommon::current_section);
- }
- else
- {
- BootCommon::sections[BootCommon::current_section_index]
- = BootCommon::current_section;
- }
- return `next;
- }
-
-
-
-
-
-
-
- /*
- * Imported from routines/dialogs.ycp ... temporarily
- */
-
-
- /**
- * Run dialog with detailed settings
- * @param type string specification of the type of detail settings
- * @return symbol for wizard sequencer
- */
- symbol _DetailsDialog (string type) {
- map<string,symbol()> dialogs = Bootloader::blDialogs ();
- if (! haskey (dialogs, type))
- {
- Report::Message (
- // message
- _("There are no options to set for the current boot loader."));
- return `back;
- }
- symbol () dialog = (symbol())dialogs[type]:nil;
- return dialog ();
- }
-
-
-
- /*
- * End of imported stuff from routines/dialogs.ycp ...
- */
-
-
-
-
-
-
-
- /**
- * Run wizard sequencer
- * @return `next, `back or `abort
- */
- symbol GenericMainSequence () {
- // run a generic sequence
- map aliases = $[
- "main" : ``(MainDialog ()),
- "installation_details" : ``(DetailsDialog ("installation")),
- "loader_details" : ``(DetailsDialog ("loader")),
- "add_new_section" : ``(AddNewSectionDialog ()),
- "store_section" : [``(GenericStoreSection ()), true],
- "manual_edit" : ``(runEditFilesDialog ()),
- "section_edit" : ``( SectionEditDialog()),
- ];
-
- return_tab = Bootloader::getLoaderType () != "none"
- ? "sections"
- : "installation";
-
- map sequence = $[
- "ws_start" : "main",
- "main" : $[
- `next : `next,
- `abort : `abort,
- `add : "add_new_section",
- `edit : "section_edit",
- `inst_details : "installation_details",
- `loader_details : "loader_details",
- `manual : "manual_edit",
- `redraw : "main",
- ],
- "manual_edit" : $[
- `abort : `abort,
- `next : "main",
- ],
- "installation_details" : $[
- `next : "main",
- `abort : `abort,
- ],
- "loader_details" : $[
- `next : "main",
- `abort : `abort,
- ],
- "add_new_section" : $[
- `next : "section_edit",
- `abort : `abort,
- ],
- "store_section" : $[
- `next : "main",
- ],
- "section_edit" : $[
- `next : "store_section",
- `abort : `abort,
- ],
- ];
-
-
-
- // FIXME DetailDialog is not yet replaced by a generic function
-
-
- foreach (string st, section_types(), {
- string section = st + "_section";
- string details = st + "_details";
-
- aliases = add(aliases, details, ``( DetailsDialog (section)));
-
- sequence = add(sequence, details, $[
- `next : "section_edit",
- `abort : `abort,
- ]);
-
- });
-
- return Sequencer::Run (aliases, sequence);
- }
-
-
- } // EOF
-