/**
 * File:	clients/network.ycp
 * Package:	Network configuration
 * Summary:	Main network client
 * Authors:	Michal Svec <msvec@suse.cz>
 *
 * $Id: network.ycp 21341 2005-02-07 16:15:59Z mvidner $
 *
 * Main file for the network configuration.
 * Uses all other files.
 */

{

textdomain "network";

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

import "Label";
import "Wizard";

/* 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;

/* EOF */
}
