ACC SHELL
/**
* Module: inst_packages.ycp
* Authors: Stefan Hundhammer <sh@suse.de>
* Purpose: Show the package installation dialog
*
* $Id: inst_packages.ycp 52381 2008-10-21 08:24:11Z lslezak $
*
*/
{
textdomain "packager";
import "PackagesUI";
import "Stage";
import "Mode";
/**
* Start the detailed package selection. If 'mode' is non-nil, it will be
* passed as an option to the PackageSelector widget.
*
* Returns `accept or `cancel .
**/
symbol detailedSelection( symbol mode, boolean enable_repo_mgr, boolean display_support_status)
{
map<string,any> options = $[
"mode" : mode,
"enable_repo_mgr" : enable_repo_mgr,
"display_support_status" : display_support_status
];
return PackagesUI::RunPackageSelector(options);
}
/**
* Start the pattern selection dialog. If the UI does not support the
* PatternSelector, start the detailed selection with "selections" as the
* initial view.
**/
symbol patternSelection()
{
return PackagesUI::RunPatternSelector();
}
///////////////////////////////////////////////////////////////////////////
// MAIN
///////////////////////////////////////////////////////////////////////////
symbol result = `cancel;
y2warning("Warning: inst_packages.ycp client is obsoleted, use module PackagesUI.ycp instead");
y2milestone("Stage: %1, Mode: %2, Args: %3", Stage::stage(), Mode::mode(), WFM::Args());
// installation or update from a running system (there is a "Pattern Selection" button) (#229951)
if (size(WFM::Args()) == 0 && (Stage::initial() || (Stage::normal() && Mode::update())))
{
result = patternSelection();
}
else
{
if ( size( WFM::Args() ) > 0 && is( WFM::Args(0), map ) )
{
y2milestone("inst_packages called with options: %1", WFM::Args());
symbol mode = nil;
boolean repo_mgr = nil;
// the options may be passed in a map or in a list
if (is(WFM::Args(0), map))
{
map opts = (map) WFM::Args(0);
mode = opts["dialog_type"]:`searchMode;
repo_mgr = opts["repo_mgmt"]:false;
}
else if (is(WFM::Args(0), symbol))
{
mode = (symbol)WFM::Args(0);
if (is(WFM::Args(1), symbol))
{
repo_mgr = WFM::Args(1) == `repoMgr;
}
}
if (mode == nil)
{
mode = `searchMode;
}
if (repo_mgr == nil)
{
repo_mgr = Mode::normal();
}
if (mode == `patternSelector || mode == `pattern)
{
result = patternSelection();
}
else
{
result = detailedSelection(mode , repo_mgr, nil);
}
}
else
{
result = detailedSelection(`searchMode, false, nil);
}
}
return result;
}
ACC SHELL 2018