/**
 * File:	include/security/wizards.ycp
 * Package:	Security configuration
 * Summary:	Wizards definitions
 * Authors:	Michal Svec <msvec@suse.cz>
 *
 * $Id: wizards.ycp 15666 2004-03-08 16:22:41Z msvec $
 */

{

textdomain "security";

import "Label";
import "Sequencer";
import "Wizard";

include "security/complex.ycp";
include "security/dialogs.ycp";
include "security/users.ycp";

/**
 * Main workflow of the security configuration
 * @return any Returned value from WizardSequencer() call
 */
define any MainSequence() ``{

    map aliases = $[
	"main"     : ``(MainDialog()),
	"password" : ``(PassDialog()),
	"boot"     : ``(BootDialog()),
	"login"    : ``(LoginDialog()),
	"adduser"  : ``(AdduserDialog()),
	"misc"     : ``(MiscDialog()),
    ];

    map sequence = $[
	"ws_start" : "main",
	"main" : $[
	    `abort : `abort,
	    `next : "password",
	    `finish : `next,
	],
	"password" : $[
	    `abort : `abort,
	    `next : "boot"
	],
	"boot" : $[
	    `abort : `abort,
	    `next : "login"
	],
	"login" : $[
	    `abort : `abort,
	    `next : "adduser"
	],
	"adduser" : $[
	    `abort : `abort,
	    `next : "misc"
	],
	"misc" : $[
	    `abort : `abort,
	    `next : `next,
	],
    ];

    any ret = Sequencer::Run(aliases, sequence);

    return ret;
}

/**
 * Whole configuration of security
 * @return any Returned value from WizardSequencer() call
 */
define any SecuritySequence() ``{

    map aliases = $[
	"read"	: [ ``( ReadDialog() ), true ],
	"main"	:   ``( MainSequence() ),
	"write"	: [ ``( WriteDialog() ), true ]
    ];

    map sequence = $[
	"ws_start" : "read",
	"read" : $[
	    `abort	: `abort,
	    `next	: "main"
	],
	"main" : $[
	    `abort	: `abort,
	    `next	: "write"
	],
	"write" : $[
	    `abort	: `abort,
	    `next	: `next
	]
    ];

    Wizard::CreateDialog();
    Wizard::SetDesktopIcon("security");
    any ret = Sequencer::Run(aliases, sequence);

    UI::CloseDialog();
    return ret;
}

/**
 * Whole configuration of security but without reading and writing.
 * For use with autoinstallation.
 * @return any Returned value from WizardSequencer() call
 */
define any SecurityAutoSequence() ``{

    /* Dialog caption */
    string caption = _("Security configuration");
    /* Label */
    term contents = `Label(_("Initializing ..."));

    Wizard::CreateDialog();
    Wizard::SetDesktopIcon("security");
    Wizard::SetContentsButtons(caption, contents, "",
	    Label::BackButton(), Label::NextButton());

    /* Run the main configuration workflow */
    any ret = MainSequence();

    UI::CloseDialog();
    return ret;
}

/* EOF */
}
