home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
boot
/
i386
/
root
/
usr
/
share
/
YaST2
/
clients
/
software_proposal.ycp
< prev
next >
Wrap
Text File
|
2006-11-29
|
3KB
|
128 lines
/**
* Module: software_proposal.ycp
*
* Author: Klaus Kaempf <kkaempf@suse.de>
*
* Purpose: Proposal function dispatcher - software.
*
* See also file proposal-API.txt for details.
*/
{
textdomain "packager";
import "Packages";
import "Storage";
import "Language";
string func = (string) WFM::Args(0);
map param = (map) WFM::Args(1);
map ret = $[];
if ( func == "MakeProposal" )
{
boolean force_reset = param["force_reset" ]:false;
boolean language_changed = param["language_changed"]:false;
boolean reinit = false;
boolean partition_changed = false;
if ( Packages::timestamp != Storage::GetTargetChangeTime() )
{
// don't set flag partition_changed if it's the first "change"
if ( Packages::timestamp != 0 )
{
partition_changed = true;
}
}
// save information about target change time in module Packages
Packages::timestamp = Storage::GetTargetChangeTime();
if (Pkg::GetLocale () != Language::language)
{
language_changed = true;
Pkg::SetLocale (Language::language);
}
if (! contains (Pkg::GetAdditionalLocales (), Language::language))
{
// FIXME this is temporary fix
// language_changed = true;
Pkg::SetAdditionalLocales (
add (Pkg::GetAdditionalLocales (), Language::language));
}
if ( language_changed || partition_changed )
{
reinit = true;
}
y2milestone("package proposal: force reset: %1, reinit: %2, language changed: %3", force_reset, reinit, language_changed );
ret = Packages::Proposal( force_reset, // user decision: reset to default
reinit, // reinitialize due to language or partition change
false ); // simple version
if ( language_changed && !force_reset)
{
// if the language has changed the software proposal is reset to the default settings
if (! haskey (ret, "warning"))
{
// the language_changed flag has NOT been set by the NLD frame
ret = add( ret, "warning", _("The software proposal is reset to default values.") );
}
}
if (Packages::solve_errors > 0)
{
// the proposal for the packages requires manual intervention
ret = union (ret, $[
/* warning text */
"warning" : _("Cannot solve dependencies automatically. Manual intervention is required."),
"warning_level" : `blocker ]);
}
}
else if ( func == "AskUser" )
{
boolean has_next = param["has_next"]:false;
// call some function that displays a user dialog
// or a sequence of dialogs here:
//
// sequence = DummyMod::AskUser( has_next );
any chosen_id = param["chosen_id"]:nil;
if (chosen_id == "mediacheck")
{
symbol result = (symbol)WFM::CallFunction("checkmedia", WFM::Args());
ret = $[ "workflow_sequence" : result ];
}
else
{
symbol result = `again;
string client_to_call = "inst_sw_select";
while ( result == `again )
{
result = (symbol) WFM::CallFunction (client_to_call, [true, true]);
}
// Fill return map
ret = $[ "workflow_sequence" : result ];
}
}
else if ( func == "Description" )
{
// Fill return map.
//
// Static values do just nicely here, no need to call a function.
ret =
$[
// this is a heading
"rich_text_title" : _("Software"),
// this is a menu entry
"menu_title" : _("&Software"),
"id" : "software_stuff"
];
}
return ret;
}