/**
 * File:	include/sysconfig/wizards.ycp
 * Package:	Configuration of sysconfig
 * Summary:	Wizards definitions
 * Authors:	Ladislav Slezak <lslezak@suse.cz>
 *
 * $Id: wizards.ycp,v 1.15 2004/10/27 07:26:41 lslezak Exp $
 */

{

textdomain "sysconfig";

import "Wizard";
import "Sysconfig";

import "Popup";
import "Label";
import "Sequencer";

include "sysconfig/complex.ycp";
include "sysconfig/dialogs.ycp";

/**
 * Main workflow of the sysconfig configuration
 * @return sequence result
 */
 define symbol MainSequence() ``{

    map aliases = $[
	"main"	:   ``(MainDialog())
    ];

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

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

    return ret;
}

/**
 * Whole configuration of sysconfig but without reading and writing.
 * For use with autoinstallation.
 * @return sequence result
 */
 define symbol SysconfigAutoSequence() ``{
    Wizard::CreateDialog();
    Wizard::SetDesktopIcon(Sysconfig::powertweak_mode ? "powertweak" : "sysconfig");

    // initialization
    if (Mode::config() && !Sysconfig::Modified() && (Sysconfig::tree_content == nil || size(Sysconfig::tree_content) == 0))
    {
	Sysconfig::Read();
    }

    symbol ret = MainSequence();

    UI::CloseDialog();
    return ret;
}

/**
 * Whole configuration of sysconfig
 * @return sequence result
 */
 define boolean SysconfigSequence() ``{

    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(Sysconfig::powertweak_mode ? "powertweak" : "sysconfig");

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

    UI::CloseDialog();

    return ret == `next;
}


/* EOF */
}
