ACC SHELL

Path : /usr/share/YaST2/clients/
File Upload :
Current File : //usr/share/YaST2/clients/timezone_proposal.ycp

/**
 * File:		timezone_proposal.ycp
 *
 * $Id: timezone_proposal.ycp 50347 2008-08-25 07:49:44Z jsuchome $
 *
 * Author:		Klaus Kaempf <kkaempf@suse.de>
 *
 * Purpose:		Proposal function dispatcher - timezone.
 *
 *			See also file proposal-API.txt for details.
 */
{
    textdomain "country";

    import "Timezone";
    import "Wizard";

    include "timezone/dialogs.ycp";

    string func  = (string) WFM::Args(0);
    map    param = (map) WFM::Args(1);
    map    ret   = $[];

    if ( func == "MakeProposal" )
    {
	boolean force_reset      = param["force_reset"     ]:false;
	boolean language_changed = param["language_changed"]:false;

	map m = (map) SCR::Execute( .target.bash_output, "/bin/date +%Y" );
	y2milestone ("date call: %1", m);

	if (tointeger (m["stdout"]:"0") < 2004)
	{
	    ret["raw_proposal"] = [];
	    map m = (map)SCR::Execute( .target.bash_output, "/bin/date" );
	    // error text, %1 is output of 'date' command
	    ret["warning"] = sformat( _("Time %1 is in the past.
Set a correct time before starting installation."), m["stdout"]:"" );
            ret["warning_level"] = `blocker;
	}
	else
	{
	    import "Storage";
	    if (!Timezone::windows_partition &&
		size (Storage::GetWinPrimPartitions(Storage::GetTargetMap()))>0)
	    {
		Timezone::windows_partition = true;
		y2milestone ("windows partition found: assuming local time");
	    }

	    // Fill return map
	    ret = $[
		"raw_proposal"		:
		    Timezone::MakeProposal (force_reset, language_changed),
		"language_changed"	: false
	    ];
	}
    }
    else if ( func == "AskUser" )
    {
	Wizard::OpenAcceptDialog();

	symbol result = TimezoneDialog ($[
	    "enable_next": param["has_next"]:false]
	);
	Wizard::CloseDialog();

	// Fill return map
	ret = $[
		"workflow_sequence" : result,
		"language_changed"  : false
	       ];
    }
    else if ( func == "Description" )
    {
	// Fill return map.
	//
	// Static values do just nicely here, no need to call a function.

	ret =
	    $[
	      // summary item
	      "rich_text_title"	:	_("Time Zone"),
	      // menue label text
	      "menu_title"	:	_("&Time Zone"),
	      "id"		:	"timezone_stuff"
	    ];
    }

    return ret;
}

ACC SHELL 2018