ACC SHELL

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

/**
 * File:	clients/network.ycp
 * Package:	Network configuration
 * Summary:	Main network client
 * Authors:	Michal Svec <msvec@suse.cz>
 *
 * $Id: network.ycp 33494 2006-10-18 12:17:01Z kmachalkova $
 *
 * Main file for the network configuration.
 * Uses all other files.
 */

{

textdomain "network";

/* The main () */
y2milestone("----------------------------------------");
y2milestone("Network module started");

import "Label";
import "Wizard";
import "CommandLine";

any startDialog(){
 /* Network dialog caption */
 string caption = _("Network Configuration");

 /* Network dialog help */
 string help = _("<p>Choose one of the available network modules to configure
 the corresponding devices and press <b>Launch</b>.</p>");

 /* Network dialog contents */
 term contents = `HBox(
    `HSpacing(8),
    /* Frame label */
    //`Frame(_("Available network modules:"), `HBox(`HSpacing(2),
    `VBox(
	`VSpacing(3),
	/* Selection box label */
	`SelectionBox(`id(`modules), `opt(`notify), _("&Available Network Modules:"), [
	    /* Selection box item */
	    `item(`id("lan"), _("Network Card"), true),
	    /* Selection box item */
	    `item(`id("isdn"), _("ISDN Card")),
	    /* Selection box item */
	    `item(`id("modem"), _("Modem")),
	    /* Selection box item */
	    `item(`id("dsl"), _("DSL Connection"))
	]),
	`VSpacing(3)
	),
	//`HSpacing(2))),
    `HSpacing(8)
 );

 Wizard::CreateDialog();
 Wizard::SetDesktopIcon("network");
 Wizard::SetContentsButtons(caption, contents, help,
	Label::BackButton(), /* Label::FinishButton() */ _("&Launch"));

 UI::SetFocus(`id(`modules));

 any ret = nil;
 while(true) {

    ret = UI::UserInput();

    /* abort? */
    if(ret == `abort || ret == `cancel) {
	/* if(ReallyAbort()) break;
	else continue; */
	break;
    }
    /* next */
    else if(ret == `next || ret == `modules) {
	/* check_* */
	ret = `next;
	break;
    }
    /* back */
    else if(ret == `back) {
	break;
    }
    else {
	y2error("unexpected retcode: %1", ret);
	continue;
    }
 }

 string launch = "lan";
 if(ret == `next) {
    launch = (string) UI::QueryWidget(`id(`modules), `CurrentItem);
    y2debug("launch=%1", launch);
 }

 UI::CloseDialog();

 /* Finish */
 y2milestone("Network module finished");
 y2milestone("----------------------------------------");

 if(ret == `next)
     return WFM::CallFunction(launch, WFM::Args());
 else
     return `back;
}

/* is this proposal or not? */
boolean propose = false;
list args = WFM::Args();
if(size(args) > 0) {
    if(is(WFM::Args(0), path) && WFM::Args(0) == .propose) {
        y2milestone("Using PROPOSE mode");
        propose = true;
    }
}

boolean runHandler(map<string, any> options){
// CommandLine::Print(_("bla"));
 return true;
}

void initNet(){
}

void finishNet(){
}

map cmdline_description = $[
    "id" 	: "network",
    // translators: command line help for HTTP server module
    "help"	: _("Configuration of network.
This is only executer of network sub-modules.
You can run this network modules:

lan	")+ _("Network Card")	+("
isdn	")+ _("ISDN Card")	+("
modem	")+ _("Modem")		+("
dsl	")+ _("DSL Connection") +("
"),
    "guihandler" : startDialog,
    "initialize" : initNet,
    "finish"	 : finishNet,
/*
	"actions" : $[
	   "run" : $[
		"handler" : runHandler,
		"help" : _("Run network modules")
		    ],
		],
*/
	"options" : $[
		],
	"mapping" : $[
//		"run" : [  ],
		]
];


/* main ui function */
any ret = nil;

if(propose) ret = startDialog();
        else {
//	y2internal("%1", CommandLine::Parse(cmdline_description));
	 ret = CommandLine::Run(cmdline_description);
	}
y2debug("ret=%1", ret);


return `next;

/* EOF */
}

ACC SHELL 2018