ACC SHELL

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

/**
 * File:	clients/host.ycp
 * Package:	Network configuration
 * Summary:	Hosts client
 * Authors:	Michal Svec <msvec@suse.cz>
 *
 * $Id: host.ycp 21545 2005-02-11 16:37:21Z mvidner $
 *
 * Main file for hosts configuration.
 * Uses all other files.
 */

{

textdomain "network";

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

import "Host";
import "Label";
import "Wizard";

import "CommandLine";
import "RichText";

/**
 * Return a modification status
 * @return true if data was modified
 */
define boolean Modified() {
    return Host::modified;
}

include "network/runtime.ycp";
include "network/services/host.ycp";

/**
 * Main hosts GUI
 */
any HostGUI() {
    Host::Read();

    Wizard::CreateDialog();
    Wizard::SetDesktopIcon("host");
    Wizard::SetNextButton(`next, Label::FinishButton() );

    /* main ui function */
    any ret = HostsMainDialog(true);
    y2debug("ret == %1", ret);

    if(ret == `next && Host::modified) {
	Host::Write();
	/* Not needed? RestartNetwork(); */
    }

    UI::CloseDialog();
    return ret;
}

/**
 * Handler for action "list"
 * @param options action options
 */
define boolean ListHandler(map<string, string> options) {

    string summary = "";
    /* Command line output Headline */
    // configuration of hosts
    summary = "\n" + _("Host Configuration Summary:") + "\n\n" +
	RichText::Rich2Plain(Host::Summary()) + "\n";

    y2debug("%1", summary);
    CommandLine::Print(summary);
    return true;
}

/**
 * Command line definition
 */
map cmdline = $[
    /* Commandline help title */
    // configuration of hosts
    "help"	: _("Host Configuration"),
    "id"	: "host",
    "guihandler": HostGUI,
    "initialize": Host::Read,
    "finish"	: Host::Write, // FIXME
    "actions"	: $[
	"list" : $[
	    /* Commandline command help */
	    "help"	: _("Display configuration summary"),
	    "handler"	: ListHandler,
	],
    ],
];

any ret = CommandLine::Run(cmdline);
y2debug("ret=%1", ret);

/* Finish */
y2milestone("Host module finished");
y2milestone("----------------------------------------");
return ret;

/* EOF */
}

ACC SHELL 2018