mirror of https://github.com/acidanthera/audk.git
Restore the whole form set to default value when user enter F9, old logical only for form level.
Signed-off-by:ydong10 Reviewed-by:lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11911 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
006fecd5a1
commit
4f33c8384d
|
@ -2538,56 +2538,65 @@ GetQuestionDefault (
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reset Questions in a Form to their default value.
|
Reset Questions in a Formset to their default value.
|
||||||
|
|
||||||
@param FormSet FormSet data structure.
|
@param FormSet FormSet data structure.
|
||||||
@param Form The Form which to be reset.
|
|
||||||
@param DefaultId The Class of the default.
|
@param DefaultId The Class of the default.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The function completed successfully.
|
@retval EFI_SUCCESS The function completed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ExtractFormDefault (
|
ExtractFormSetDefault (
|
||||||
IN FORM_BROWSER_FORMSET *FormSet,
|
IN FORM_BROWSER_FORMSET *FormSet,
|
||||||
IN FORM_BROWSER_FORM *Form,
|
|
||||||
IN UINT16 DefaultId
|
IN UINT16 DefaultId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
LIST_ENTRY *Link;
|
LIST_ENTRY *FormLink;
|
||||||
|
LIST_ENTRY *StatementLink;
|
||||||
FORM_BROWSER_STATEMENT *Question;
|
FORM_BROWSER_STATEMENT *Question;
|
||||||
|
FORM_BROWSER_FORM *Form;
|
||||||
|
|
||||||
Link = GetFirstNode (&Form->StatementListHead);
|
FormLink = GetFirstNode (&FormSet->FormListHead);
|
||||||
while (!IsNull (&Form->StatementListHead, Link)) {
|
while (!IsNull (&FormSet->FormListHead, FormLink)) {
|
||||||
Question = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
|
Form = FORM_BROWSER_FORM_FROM_LINK (FormLink);
|
||||||
Link = GetNextNode (&Form->StatementListHead, Link);
|
|
||||||
|
//
|
||||||
|
// Extract Form default
|
||||||
|
//
|
||||||
|
StatementLink = GetFirstNode (&Form->StatementListHead);
|
||||||
|
while (!IsNull (&Form->StatementListHead, StatementLink)) {
|
||||||
|
Question = FORM_BROWSER_STATEMENT_FROM_LINK (StatementLink);
|
||||||
|
StatementLink = GetNextNode (&Form->StatementListHead, StatementLink);
|
||||||
|
|
||||||
//
|
//
|
||||||
// If Question is disabled, don't reset it to default
|
// If Question is disabled, don't reset it to default
|
||||||
//
|
//
|
||||||
if (Question->DisableExpression != NULL) {
|
if (Question->DisableExpression != NULL) {
|
||||||
Status = EvaluateExpression (FormSet, Form, Question->DisableExpression);
|
Status = EvaluateExpression (FormSet, Form, Question->DisableExpression);
|
||||||
if (!EFI_ERROR (Status) && Question->DisableExpression->Result.Value.b) {
|
if (!EFI_ERROR (Status) && Question->DisableExpression->Result.Value.b) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Reset Question to its default value
|
||||||
|
//
|
||||||
|
Status = GetQuestionDefault (FormSet, Form, Question, DefaultId);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Reset Question to its default value
|
// Synchronize Buffer storage's Edit buffer
|
||||||
//
|
//
|
||||||
Status = GetQuestionDefault (FormSet, Form, Question, DefaultId);
|
if ((Question->Storage != NULL) &&
|
||||||
if (EFI_ERROR (Status)) {
|
(Question->Storage->Type != EFI_HII_VARSTORE_EFI_VARIABLE)) {
|
||||||
continue;
|
SetQuestionValue (FormSet, Form, Question, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Synchronize Buffer storage's Edit buffer
|
|
||||||
//
|
|
||||||
if ((Question->Storage != NULL) &&
|
|
||||||
(Question->Storage->Type != EFI_HII_VARSTORE_EFI_VARIABLE)) {
|
|
||||||
SetQuestionValue (FormSet, Form, Question, TRUE);
|
|
||||||
}
|
}
|
||||||
|
FormLink = GetNextNode (&FormSet->FormListHead, FormLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
@ -2848,13 +2857,9 @@ InitializeCurrentSetting (
|
||||||
//
|
//
|
||||||
// Extract default from IFR binary
|
// Extract default from IFR binary
|
||||||
//
|
//
|
||||||
Link = GetFirstNode (&FormSet->FormListHead);
|
Status = ExtractFormSetDefault (FormSet, EFI_HII_DEFAULT_CLASS_STANDARD);
|
||||||
while (!IsNull (&FormSet->FormListHead, Link)) {
|
if (EFI_ERROR (Status)) {
|
||||||
Form = FORM_BROWSER_FORM_FROM_LINK (Link);
|
return Status;
|
||||||
|
|
||||||
Status = ExtractFormDefault (FormSet, Form, EFI_HII_DEFAULT_CLASS_STANDARD);
|
|
||||||
|
|
||||||
Link = GetNextNode (&FormSet->FormListHead, Link);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -1014,19 +1014,17 @@ InitializeFormSet (
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reset Questions in a Form to their default value.
|
Reset Questions in a Formset to their default value.
|
||||||
|
|
||||||
@param FormSet FormSet data structure.
|
@param FormSet FormSet data structure.
|
||||||
@param Form The Form which to be reset.
|
|
||||||
@param DefaultId The Class of the default.
|
@param DefaultId The Class of the default.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The function completed successfully.
|
@retval EFI_SUCCESS The function completed successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ExtractFormDefault (
|
ExtractFormSetDefault (
|
||||||
IN FORM_BROWSER_FORMSET *FormSet,
|
IN FORM_BROWSER_FORMSET *FormSet,
|
||||||
IN FORM_BROWSER_FORM *Form,
|
|
||||||
IN UINT16 DefaultId
|
IN UINT16 DefaultId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -3234,14 +3234,10 @@ UiDisplayMenu (
|
||||||
|
|
||||||
case CfUiDefault:
|
case CfUiDefault:
|
||||||
ControlFlag = CfCheckSelection;
|
ControlFlag = CfCheckSelection;
|
||||||
if (!Selection->FormEditable) {
|
//
|
||||||
//
|
// Reset to default values for the whole formset
|
||||||
// This Form is not editable, ignore the F9 (reset to default)
|
//
|
||||||
//
|
Status = ExtractFormSetDefault (Selection->FormSet, DefaultId);
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = ExtractFormDefault (Selection->FormSet, Selection->Form, DefaultId);
|
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Selection->Action = UI_ACTION_REFRESH_FORM;
|
Selection->Action = UI_ACTION_REFRESH_FORM;
|
||||||
|
|
Loading…
Reference in New Issue