ACC SHELL

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

/**
 * File:	clients/modem_proposal.ycp
 * Package:	Network configuration
 * Summary:	Modem configuration proposal
 * Authors:	Michal Svec <msvec@suse.cz>
 *
 * $Id: modem_proposal.ycp 56442 2009-03-27 12:27:10Z kmachalkova $
 */

{

textdomain "network";

/* The main () */
y2milestone("----------------------------------------");
y2milestone("Modem proposal started");
y2milestone("Arguments: %1", WFM::Args());

import "Modem";
import "Popup";
import "Progress";
import "GetInstArgs";

include "network/routines.ycp";

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

/* create a textual proposal */
if(func == "MakeProposal") {
    string proposal = "";
    string warning = nil;
    symbol warning_level = nil;
    boolean force_reset = param["force_reset"]:false;

    if(force_reset || !Modem::proposal_valid) {
	Modem::proposal_valid = true;
	if (! GetInstArgs::automatic_configuration())
	    /* Popup text */
	    BusyPopup(_("Detecting modems..."));

	boolean progress_orig = Progress::set (false);
	Modem::Read();
	// no Modem::Propose () ?
	if (! GetInstArgs::automatic_configuration())
	{
	    Progress::set (progress_orig);
	    BusyPopupClose();
	}
    }
    list sum = Modem::Summary(false);
    proposal = sum[0]:"";

    ret = $[
	"preformatted_proposal" : proposal,
	"warning_level" : warning_level,
	"warning" : warning,
    ];
}
/* run the module */
else if(func == "AskUser") {
    map stored = Modem::Export();
    symbol result = (symbol) WFM::CallFunction("modem", [.propose]);
    if(result != `next) Modem::Import(stored);
    y2debug("stored=%1", stored);
    y2debug("result=%1", result);
    ret = $[ "workflow_sequence" : result ];
}
/* create titles */
else if(func == "Description") {
    ret = $[
	/* RichText label */
	"rich_text_title" : _("Modems"),
	/* Menu label */
	"menu_title" : _("&Modems"),
	"id" : "modem",
    ];
}
/* write the proposal */
else if(func == "Write") {
    if(PackagesInstall(Modem::Packages()) != `next) {
	/* Popup text */
	Popup::Error("Required packages installation failed.
Modem configuration cannot be saved.");
	y2error("Packages installation failure, not saving");
    }
    else
	Modem::Write();
}
/* unknown function */
else {
    y2error("unknown function: %1", func);
}

/* Finish */
y2debug("ret=%1",ret);
y2milestone("Modem proposal finished");
y2milestone("----------------------------------------");
return ret;

/* EOF */
}

ACC SHELL 2018