ACC SHELL

Path : /var/lib/named/proc/self/root/usr/share/YaST2/include/bootloader/ppc/
File Upload :
Current File : //var/lib/named/proc/self/root/usr/share/YaST2/include/bootloader/ppc/options.ycp

/**
 * File:
 *      include/bootloader/ppc/ppc_options.ycp
 *
 * Module:
 *      Bootloader installation and configuration
 *
 * Summary:
 *      Dialogs for ppc configuraion functions
 *
 * Authors:
 *      Jozef Uhliarik <juhliarik@suse.cz>
 *
 */

{

textdomain "bootloader";

import "Label";
import "BootCommon";
import "Arch";

include "bootloader/ppc/helps.ycp";


void InitDuplicatePartition(string widget) {
    list <string> devices = prep_boot_partitions;
    if (size(devices) != 0)
    {
	UI::ChangeWidget (`id ("clone"), `Items, devices);
    }
    UI::ChangeWidget (`id ("clone"), `Value, BootCommon::globals["clone"]:"");
}

void  StoreDuplicatePartition (string widget, map event) {

     BootCommon::globals["clone"]
	= (splitstring( (string)UI::QueryWidget (`id ("clone"), `Value), " "))[0]:"";
 
}


map<string,any> DuplicatePartition(){
  return  $[
            "widget" : `combobox,
            "label" : _("Partition for Boot Loader &Duplication"),
            "items" : [""],
	    "opt"   : [`editable, `hstretch],
            "help" : ppc_help_messages["clone"]:"",
            "init" : InitDuplicatePartition,
            "store" : StoreDuplicatePartition,
          ];
}

void InitBootPMAC(string widget) {
    list <string> devices = pmac_boot_partitions;
    if (size(devices) != 0)
    {
	UI::ChangeWidget (`id ("boot_pmac_custom"), `Items, devices);
    }
    UI::ChangeWidget (`id ("boot_pmac_custom"), `Value, BootCommon::globals["boot_pmac_custom"]:"");

}

void StoreBootPMAC (string widget, map event) {

   BootCommon::globals["boot_pmac_custom"]
      = (splitstring( (string)UI::QueryWidget (`id ("boot_pmac_custom"), `Value), " "))[0]:"";

}

map<string,any> BootPMAC(){
  return  $[
    "widget" : `custom,
    "custom_widget" : `VBox(
           `Frame ( _("Boot Loader Location"), `VBox(
           `Left(`HBox(`HSpacing(1),`VBox(
	      `Left(`ComboBox(`id("boot_pmac_custom"), `opt(`editable, `hstretch), _("HFS Boot &Partition"), [""]))
           )))
     ))),
     "help" : ppc_help_messages["boot_pmac_custom"]:"",
     "init" : InitBootPMAC,
     "store" : StoreBootPMAC,
  ];
}


void InitBootCHRP(string widget) {
    list <string> devices = prep_boot_partitions;
    if (size(devices) != 0)
    {
	UI::ChangeWidget (`id ("boot_chrp_custom"), `Items, devices);
    }

    UI::ChangeWidget (`id ("boot_chrp_custom"), `Value, BootCommon::globals["boot_chrp_custom"]:"");

}

void StoreBootCHRP (string widget, map event) {

   BootCommon::globals["boot_chrp_custom"]
	= (splitstring( (string)UI::QueryWidget (`id ("boot_chrp_custom"), `Value), " "))[0]:"";

}


map<string,any> BootCHRP(){
  return  $[
    "widget" : `custom,
    "custom_widget" : `VBox(
           `Frame ( _("Boot Loader Location"), `VBox(
           `Left(`HBox(`HSpacing(1),`VBox(
	      `Left(`ComboBox(`id("boot_chrp_custom"), `opt(`editable, `hstretch), _("&PReP or FAT Partition"), [""]))
           )))
     ))),
     "help" : ppc_help_messages["boot_chrp_custom"]:"",
     "init" : InitBootCHRP,
     "store" : StoreBootCHRP,
  ];
}


void InitBootPReP(string widget) {
    list <string> devices = prep_boot_partitions;
    if (size(devices) != 0)
    {
	UI::ChangeWidget (`id ("boot_prep_custom"), `Items, devices);
    }

    UI::ChangeWidget (`id ("boot_prep_custom"), `Value, BootCommon::globals["boot_prep_custom"]:"");
}

void StoreBootPReP (string widget, map event) {

   BootCommon::globals["boot_prep_custom"]
	= (splitstring( (string)UI::QueryWidget (`id ("boot_prep_custom"), `Value), " "))[0]:"";

}


map<string,any> BootPReP(){
  return  $[
    "widget" : `custom,
    "custom_widget" : `VBox(
           `Frame ( _("Boot Loader Location"), `VBox(
           `Left(`HBox(`HSpacing(1),`VBox(
	      `Left(`ComboBox(`id("boot_prep_custom"), `opt(`editable, `hstretch), _("&PReP partitions"), [""]))
           )))
     ))),
     "help" : ppc_help_messages["boot_prep_custom"]:"",
     "init" : InitBootPReP,
     "store" : StoreBootPReP,
  ];
}


void InitBootISeries(string widget) {
    list <string> devices = prep_boot_partitions;
    if (size(devices) != 0)
    {
	UI::ChangeWidget (`id ("boot_iseries_custom"), `Items, devices);
    }

    if (BootCommon::globals["boot_iseries_custom"]:"" == "")
    {
	UI::ChangeWidget (`id ("enable_iseries"), `Value, false);
	UI::ChangeWidget (`id ("boot_iseries_custom"), `Enabled, false);
    } else {
	UI::ChangeWidget (`id ("enable_iseries"), `Value, true);
	UI::ChangeWidget (`id ("boot_iseries_custom"), `Enabled, true);
    	UI::ChangeWidget (`id ("boot_iseries_custom"), `Value, BootCommon::globals["boot_iseries_custom"]:"");
    }

    if (BootCommon::globals["boot_slot"]:"" != "")
	UI::ChangeWidget (`id ("boot_slot"), `Value, BootCommon::globals["boot_slot"]:"");

    if (BootCommon::globals["boot_file"]:"" != "")
	UI::ChangeWidget (`id ("boot_file"), `Value, BootCommon::globals["boot_file"]:"");

}

symbol HandleBootISeries (string key, map event) {
  any ret = event["ID"]:nil;
  if (ret == "enable_iseries") {
	UI::ChangeWidget (`id ("boot_iseries_custom"), `Enabled, 
		(boolean) UI::QueryWidget(`id("enable_iseries"), `Value));
  }

  if (ret == "boot_file_browse") {
    string current = (string)UI::QueryWidget (`id ("boot_file"), `Value);
    // file open popup caption
    current = UI::AskForExistingFile (current, "*", _("Select File"));
    if (current != nil)
	UI::ChangeWidget (`id ("boot_file"), `Value, current);

  }
  return nil;
}





void StoreBootISeries (string widget, map event) {
   if ((boolean) UI::QueryWidget(`id("enable_iseries"), `Value))
   {
        BootCommon::globals["boot_iseries_custom"]
	   = (splitstring( (string)UI::QueryWidget (`id ("boot_iseries_custom"), `Value), " "))[0]:"";
   } else {
	BootCommon::globals["boot_iseries_custom"] = "";
   }
   BootCommon::globals["boot_slot"] 
      = (splitstring( (string)UI::QueryWidget (`id ("boot_slot"), `Value), " "))[0]:"";

   BootCommon::globals["boot_file"] =  (string)UI::QueryWidget (`id ("boot_file"), `Value);
}






map<string,any> BootISeries(){
  return  $[
    "widget" : `custom,
    "custom_widget" : `VBox(
           `Frame ( _("Boot Loader Location"), `VBox(
           `Left(`HBox(`HSpacing(1),`VBox(
	      `Left(`CheckBox(`id("enable_iseries"), `opt(`notify), _("&PReP Partition"))),
	      `Left(`ComboBox(`id("boot_iseries_custom"), `opt(`editable, `hstretch), "", [""])),
	      `Left(`HBox(
			`Left(`InputField(`id("boot_file"),`opt(`hstretch), _("Create Boot &Image in File"))),
              		`VBox(
                 		`Label(""),
                 		`PushButton(`id("boot_file_browse"),`opt(`notify), Label::BrowseButton())
              		)
              )),
	      `Left(`ComboBox(`id("boot_slot"), _("&Write to Boot Slot"), ["", "A","B","C","D"]))
           )))
     ))),
     "help" : ppc_help_messages["boot_iseries_custom"]:"",
     "init" : InitBootISeries,
     "handle" : HandleBootISeries,
     "store" : StoreBootISeries,
  ];
}


/**
 * Get the globals dialog tabs description
 * @return a map the description of the tabs
 */
map<string,map<string,any> > PPCOptions(){
  map<string,map<string,any> >  ppc_specific = $[
	"append"  : CommonInputFieldWidget(_("Global Append &String of Options to Kernel Command Line"),
				ppc_help_messages["append"]:""),
	"initrd"  : CommonInputFieldBrowseWidget(_("Nam&e of Default Initrd File"),
				ppc_help_messages["initrd"]:"", "initrd"),
	"root"	  : CommonInputFieldWidget(_("Set Default &Root Filesystem"),
				ppc_help_messages["root"]:""), 
	"activate": CommonCheckboxWidget(_("Change Boot Device in &NV-RAM"), ppc_help_messages["activate"]:""),
	// CHRP
	"force_fat": CommonCheckboxWidget(_("&Always Boot from FAT Partition"), ppc_help_messages["force_fat"]:""),

	"force" : CommonCheckboxWidget(_("&Install Boot Loader Even on Errors"), ppc_help_messages["force"]:""),

	"clone"	: DuplicatePartition(),
	// end CHRP

	// PREP also for PMAC
	"bootfolder": CommonInputFieldWidget(_("Boot &Folder Path"),
				ppc_help_messages["bootfolder"]:""),

	// end PREP

	// PMAC
	"no_os_chooser"	 : CommonCheckboxWidget(_("&Do not Use OS-chooser"), ppc_help_messages["no_os_chooser"]:""),
	"macos_timeout" : CommonIntFieldWidget (_("&Timeout in Seconds for MacOS/Linux"),
				ppc_help_messages["macos_timeout"]:"",0,60),

	// end PMAC
  ];
  return (map<string,map<string,any> >)union(ppc_specific,CommonOptions());
}



}

ACC SHELL 2018