ACC SHELL

Path : /usr/share/YaST2/include/network/modem/
File Upload :
Current File : //usr/share/YaST2/include/network/modem/wizards.ycp

/**
 * File:	include/network/modem/wizards.ycp
 * Package:	Network configuration
 * Summary:	Modem configuration wizards
 * Authors:	Michal Svec <msvec@suse.cz>
 *
 * $Id: wizards.ycp 54989 2009-01-26 09:53:41Z mzugec $
 */

{

textdomain "network";

import "Label";
import "Modem";
import "Provider";
import "Sequencer";
import "Wizard";

include "network/routines.ycp";

include "network/provider/connection.ycp";
include "network/provider/details.ycp";
include "network/provider/dialogs.ycp";
include "network/provider/provider.ycp";

// FIXME: NI include "network/provider/wizards.ycp";

include "network/modem/dialogs.ycp";
include "network/modem/complex.ycp";

// FIXME: duplicated from provider/wizards.ycp

define symbol CommitProvider() {
    Provider::Commit();
    return `next;
}

define symbol OneProviderSequence(boolean country) {

    map aliases = $[
	"providers"		: ``(ProvidersDialog(false)),
	"provider"		: ``(ProviderDialog()),
	"new_provider"		: ``(ProviderDialog()),
	"connection"		: ``(ConnectionDialog()),
	"ipdetails"		: ``(IPDetailsDialog()),
	"commit"		: [ ``(CommitProvider()), true ],
    ];

    string entry = "provider";
    if(country) entry = "providers";

    map sequence = $[
	"ws_start" : entry,
	"providers" : $[
	    `next   : "provider",
	    `new    : "new_provider",
	    `abort  : `abort
	],
	"provider" : $[
	    `next   : "connection",
	    `abort  : `abort
	],
	"new_provider" : $[
	    `next   : "connection",
	    `abort  : `abort
	],
	"connection" : $[
	    `IPDetails	: "ipdetails",
	    `next   : "commit",
	    `abort  : `abort
	],
	"ipdetails" : $[
	    `next   : "connection",
	    `abort  : `abort
	],
	"commit" : $[
	    `next   : `next,
	],
    ];

    return Sequencer::Run(aliases, sequence);
}

/**
 * Workflow of the configuration of one modem
 * @param detected true if modem was detected (more entries otherwise)
 * @param edit true in case of edit sequence
 * @return sequence result
 */
define symbol OneModemProviderSequence(boolean detected, boolean edit) {

    map aliases = $[
	"parameters_detected"	: ``(ModemDialog(true)),
	"parameters"		: ``(ModemDialog(false)),
	"details"		: ``(ModemDetailsDialog()),
	"details_detected"	: ``(ModemDetailsDialog()),
	"providers"		: ``(ProvidersDialog(edit)),
	"provider"		: ``(ProviderDialog()),
	"new_provider"		: ``(ProviderDialog()),
	"connection"		: ``(ConnectionDialog()),
	"ipdetails"		: ``(IPDetailsDialog()),
	"commit"		: [ ``(Commit("")), true ],
    ];

    string entry = "parameters";
    if(detected) entry = "parameters_detected";

    map sequence = $[
	"ws_start" : entry,
	"parameters": $[
	    `next   : "providers",
	    `Details: "details",
	    `abort  : `abort
	],
	"parameters_detected" : $[
	    `next   : "providers",
	    `Details: "details_detected",
	    `abort  : `abort
	],
	"details"   : $[
	    `next   : "parameters",
	    `abort  : `abort
	],
	"details_detected" : $[
	    `next   : "parameters_detected",
	    `abort  : `abort
	],
	"providers" : $[
	    `next   : "provider",
	    `new    : "new_provider",
	    `abort  : `abort
	],
	"provider" : $[
	    `next   : "connection",
	    `abort  : `abort
	],
	"new_provider" : $[
	    `next   : "connection",
	    `abort  : `abort
	],
	"connection" : $[
	    `IPDetails   : "ipdetails",
	    `next   : "commit",
	    `abort  : `abort
	],
	"ipdetails" : $[
	    `next   : "connection",
	    `abort  : `abort
	],
	"commit" : $[
	    `next   : `next,
	],
    ];

    return Sequencer::Run(aliases, sequence);
}

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

    map aliases = $[
	"overview"	: ``(OverviewDialog()),
	"add"		: [ ``(OneModemProviderSequence(false, false)), true ],
	"edit"		: [ ``(OneModemProviderSequence(false, true)),  true ],
	// "edit"		: [ ``(OneModemSequence(false)), true ],
	"Add"		: [ ``(OneProviderSequence(true)), true ],
	"Edit"		: [ ``(OneProviderSequence(false)), true ],
    ];

    map sequence = $[
	"ws_start" : "overview",
	"overview" : $[
	    `abort	: `abort,
	    `next	: `next,
	    `add	: "add",
	    `edit	: "edit",
	    `Add	: "Add",
	    `Edit	: "Edit",
	],
	"add" : $[
	    `abort	: `abort,
	    `next	: "overview",
	],
	"edit" : $[
	    `abort	: `abort,
	    `next	: "overview",
	],
	"Add" : $[
	    `abort	: `abort,
	    `next	: "overview",
	],
	"Edit" : $[
	    `abort	: `abort,
	    `next	: "overview",
	],
    ];

    return Sequencer::Run(aliases, sequence);
}

/**
 * Workflow of the configuration of one modem
 * @param detected true if modem was detected (more entries otherwise)
 * @return sequence result
 */
define symbol OneModemSequence(boolean detected) {

    map aliases = $[
	"parameters_detected"	: ``(ModemDialog(true)),
	"parameters"		: ``(ModemDialog(false)),
	"details"		: ``(ModemDetailsDialog()),
	"details_detected"	: ``(ModemDetailsDialog()),
	"commit"		: [ ``(Commit("modem")), true ],
    ];

    string entry = "parameters";
    if(detected) entry = "parameters_detected";

    map sequence = $[
	"ws_start" : entry,
	"parameters": $[
	    `next   : "commit",
	    `Details: "details",
	    `abort  : `abort
	],
	"parameters_detected" : $[
	    `next   : "commit",
	    `Details: "details_detected",
	    `abort  : `abort
	],
	"details"   : $[
	    `next   : "parameters",
	    `abort  : `abort
	],
	"details_detected" : $[
	    `next   : "parameters_detected",
	    `abort  : `abort
	],
	"commit" : $[
	    `next   : `next,
	],
    ];

    return Sequencer::Run(aliases, sequence);
}

/**
 * Whole configuration of modems
 * @return sequence result
 */
define symbol ModemSequence() {

    map aliases = $[
	"read"		: [ ``( ReadDialog() ), true ],
	"main"		:   ``( MainSequence() ),
	"packages"	: [ ``( PackagesInstall(Modem::Packages()) ), true ],
	"write"		: [ ``( WriteDialog() ), true ],
//	"finish"	: [ ``( FinishDialog() ), true ],
    ];

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

    Wizard::OpenCancelOKDialog();
    Wizard::SetDesktopIcon("modem");

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

    UI::CloseDialog();
    return ret;
}

/**
 * Whole configuration of modems but without reading and writing.
 * For use with autoinstallation.
 * @return sequence result
 */
define symbol ModemAutoSequence() {
    string caption = _("Modem Configuration");
    term contents = `Label(_("Initializing..."));

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

    symbol ret = MainSequence();

    UI::CloseDialog();
    return ret;
}

/* EOF */
}

ACC SHELL 2018