mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-07 19:45:07 +02:00
Update the logic, only check the value change status for user input action, not detect the change caused by Hii driver change through SetBrowserData function.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15229 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
c8d54a6d8d
commit
892eccc8d8
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Utility functions for UI presentation.
|
||||
|
||||
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@ -963,6 +963,99 @@ GetBrowserStatement (
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
Update the ValueChanged status for questions in this form.
|
||||
|
||||
@param FormSet FormSet data structure.
|
||||
@param Form Form data structure.
|
||||
|
||||
**/
|
||||
VOID
|
||||
UpdateStatementStatusForForm (
|
||||
IN FORM_BROWSER_FORMSET *FormSet,
|
||||
IN FORM_BROWSER_FORM *Form
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *Link;
|
||||
FORM_BROWSER_STATEMENT *Question;
|
||||
|
||||
Link = GetFirstNode (&Form->StatementListHead);
|
||||
while (!IsNull (&Form->StatementListHead, Link)) {
|
||||
Question = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
|
||||
Link = GetNextNode (&Form->StatementListHead, Link);
|
||||
|
||||
IsQuestionValueChanged(FormSet, Form, Question, GetSetValueWithBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Update the ValueChanged status for questions in this formset.
|
||||
|
||||
@param FormSet FormSet data structure.
|
||||
|
||||
**/
|
||||
VOID
|
||||
UpdateStatementStatusForFormSet (
|
||||
IN FORM_BROWSER_FORMSET *FormSet
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *Link;
|
||||
FORM_BROWSER_FORM *Form;
|
||||
|
||||
Link = GetFirstNode (&FormSet->FormListHead);
|
||||
while (!IsNull (&FormSet->FormListHead, Link)) {
|
||||
Form = FORM_BROWSER_FORM_FROM_LINK (Link);
|
||||
Link = GetNextNode (&FormSet->FormListHead, Link);
|
||||
|
||||
UpdateStatementStatusForForm (FormSet, Form);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Update the ValueChanged status for questions.
|
||||
|
||||
@param FormSet FormSet data structure.
|
||||
@param Form Form data structure.
|
||||
@param SettingScope Setting Scope for Default action.
|
||||
|
||||
**/
|
||||
VOID
|
||||
UpdateStatementStatus (
|
||||
IN FORM_BROWSER_FORMSET *FormSet,
|
||||
IN FORM_BROWSER_FORM *Form,
|
||||
IN BROWSER_SETTING_SCOPE SettingScope
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *Link;
|
||||
FORM_BROWSER_FORMSET *LocalFormSet;
|
||||
|
||||
switch (SettingScope) {
|
||||
case SystemLevel:
|
||||
Link = GetFirstNode (&gBrowserFormSetList);
|
||||
while (!IsNull (&gBrowserFormSetList, Link)) {
|
||||
LocalFormSet = FORM_BROWSER_FORMSET_FROM_LINK (Link);
|
||||
Link = GetNextNode (&gBrowserFormSetList, Link);
|
||||
if (!ValidateFormSet(LocalFormSet)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
UpdateStatementStatusForFormSet (LocalFormSet);
|
||||
}
|
||||
break;
|
||||
|
||||
case FormSetLevel:
|
||||
UpdateStatementStatusForFormSet (FormSet);
|
||||
break;
|
||||
|
||||
case FormLevel:
|
||||
UpdateStatementStatusForForm (FormSet, Form);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Process the action request in user input.
|
||||
@ -998,6 +1091,7 @@ ProcessAction (
|
||||
|
||||
if ((Action & BROWSER_ACTION_DEFAULT) == BROWSER_ACTION_DEFAULT) {
|
||||
ExtractDefault (gCurrentSelection->FormSet, gCurrentSelection->Form, DefaultId, gBrowserSettingScope, GetDefaultForAll, NULL, FALSE);
|
||||
UpdateStatementStatus (gCurrentSelection->FormSet, gCurrentSelection->Form, gBrowserSettingScope);
|
||||
}
|
||||
|
||||
if ((Action & BROWSER_ACTION_SUBMIT) == BROWSER_ACTION_SUBMIT) {
|
||||
@ -1618,6 +1712,7 @@ ProcessUserInput (
|
||||
// Reset Question to default value specified by DefaultId
|
||||
//
|
||||
Status = ExtractDefault (gCurrentSelection->FormSet, NULL, Statement->DefaultId, FormSetLevel, GetDefaultForAll, NULL, FALSE);
|
||||
UpdateStatementStatus (gCurrentSelection->FormSet, NULL, FormSetLevel);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -2493,6 +2588,11 @@ SetupBrowser (
|
||||
} else if (Statement->Operand != EFI_IFR_PASSWORD_OP) {
|
||||
SetQuestionValue (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithEditBuffer);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify whether question value has checked, update the ValueChanged flag in Question.
|
||||
//
|
||||
IsQuestionValueChanged(gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithBuffer);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1787,14 +1787,6 @@ SetQuestionValue (
|
||||
//
|
||||
CopyMem (Storage->Buffer + Question->VarStoreInfo.VarOffset, Src, StorageWidth);
|
||||
}
|
||||
//
|
||||
// Check whether question value has been changed.
|
||||
//
|
||||
if (CompareMem (Storage->Buffer + Question->VarStoreInfo.VarOffset, Storage->EditBuffer + Question->VarStoreInfo.VarOffset, StorageWidth) != 0) {
|
||||
Question->ValueChanged = TRUE;
|
||||
} else {
|
||||
Question->ValueChanged = FALSE;
|
||||
}
|
||||
} else {
|
||||
if (IsString) {
|
||||
//
|
||||
@ -1831,14 +1823,6 @@ SetQuestionValue (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Check whether question value has been changed.
|
||||
//
|
||||
if (StrCmp (Node->Value, Node->EditValue) != 0) {
|
||||
Question->ValueChanged = TRUE;
|
||||
} else {
|
||||
Question->ValueChanged = FALSE;
|
||||
}
|
||||
}
|
||||
} else if (SetValueTo == GetSetValueWithHiiDriver) {
|
||||
//
|
||||
@ -3453,6 +3437,8 @@ IsQuestionValueChanged (
|
||||
FreePool (BackUpBuffer);
|
||||
}
|
||||
|
||||
Question->ValueChanged = ValueChanged;
|
||||
|
||||
return ValueChanged;
|
||||
}
|
||||
|
||||
@ -3534,11 +3520,6 @@ LoadFormConfig (
|
||||
Status = ProcessCallBackFunction(Selection, FormSet, Form, Question, EFI_BROWSER_ACTION_RETRIEVE, TRUE);
|
||||
}
|
||||
|
||||
//
|
||||
// Update Question Value changed flag.
|
||||
//
|
||||
Question->ValueChanged = IsQuestionValueChanged(FormSet, Form, Question, GetSetValueWithBuffer);
|
||||
|
||||
Link = GetNextNode (&Form->StatementListHead, Link);
|
||||
}
|
||||
|
||||
@ -4174,6 +4155,94 @@ LoadStorage (
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Get Value changed status from old question.
|
||||
|
||||
@param NewFormSet FormSet data structure.
|
||||
@param OldQuestion Old question which has value changed.
|
||||
|
||||
**/
|
||||
VOID
|
||||
SyncStatusForQuestion (
|
||||
IN OUT FORM_BROWSER_FORMSET *NewFormSet,
|
||||
IN FORM_BROWSER_STATEMENT *OldQuestion
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *Link;
|
||||
LIST_ENTRY *QuestionLink;
|
||||
FORM_BROWSER_FORM *Form;
|
||||
FORM_BROWSER_STATEMENT *Question;
|
||||
|
||||
//
|
||||
// For each form in one formset.
|
||||
//
|
||||
Link = GetFirstNode (&NewFormSet->FormListHead);
|
||||
while (!IsNull (&NewFormSet->FormListHead, Link)) {
|
||||
Form = FORM_BROWSER_FORM_FROM_LINK (Link);
|
||||
Link = GetNextNode (&NewFormSet->FormListHead, Link);
|
||||
|
||||
//
|
||||
// for each question in one form.
|
||||
//
|
||||
QuestionLink = GetFirstNode (&Form->StatementListHead);
|
||||
while (!IsNull (&Form->StatementListHead, QuestionLink)) {
|
||||
Question = FORM_BROWSER_STATEMENT_FROM_LINK (QuestionLink);
|
||||
QuestionLink = GetNextNode (&Form->StatementListHead, QuestionLink);
|
||||
|
||||
if (Question->QuestionId == OldQuestion->QuestionId) {
|
||||
Question->ValueChanged = TRUE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Get Value changed status from old formset.
|
||||
|
||||
@param NewFormSet FormSet data structure.
|
||||
@param OldFormSet FormSet data structure.
|
||||
|
||||
**/
|
||||
VOID
|
||||
SyncStatusForFormSet (
|
||||
IN OUT FORM_BROWSER_FORMSET *NewFormSet,
|
||||
IN FORM_BROWSER_FORMSET *OldFormSet
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *Link;
|
||||
LIST_ENTRY *QuestionLink;
|
||||
FORM_BROWSER_FORM *Form;
|
||||
FORM_BROWSER_STATEMENT *Question;
|
||||
|
||||
//
|
||||
// For each form in one formset.
|
||||
//
|
||||
Link = GetFirstNode (&OldFormSet->FormListHead);
|
||||
while (!IsNull (&OldFormSet->FormListHead, Link)) {
|
||||
Form = FORM_BROWSER_FORM_FROM_LINK (Link);
|
||||
Link = GetNextNode (&OldFormSet->FormListHead, Link);
|
||||
|
||||
//
|
||||
// for each question in one form.
|
||||
//
|
||||
QuestionLink = GetFirstNode (&Form->StatementListHead);
|
||||
while (!IsNull (&Form->StatementListHead, QuestionLink)) {
|
||||
Question = FORM_BROWSER_STATEMENT_FROM_LINK (QuestionLink);
|
||||
QuestionLink = GetNextNode (&Form->StatementListHead, QuestionLink);
|
||||
|
||||
if (!Question->ValueChanged) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Find the same question in new formset and update the value changed flag.
|
||||
//
|
||||
SyncStatusForQuestion (NewFormSet, Question);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Get current setting of Questions.
|
||||
|
||||
@ -4195,6 +4264,7 @@ InitializeCurrentSetting (
|
||||
//
|
||||
OldFormSet = GetFormSetFromHiiHandle (FormSet->HiiHandle);
|
||||
if (OldFormSet != NULL) {
|
||||
SyncStatusForFormSet (FormSet, OldFormSet);
|
||||
RemoveEntryList (&OldFormSet->Link);
|
||||
DestroyFormSet (OldFormSet);
|
||||
}
|
||||
@ -5000,6 +5070,7 @@ ExecuteAction (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
UpdateStatementStatus (FormSet, Form, gBrowserSettingScope);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Private MACRO, structure and function definitions for Setup Browser module.
|
||||
|
||||
Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@ -712,6 +712,35 @@ IsQuestionValueChanged (
|
||||
IN GET_SET_QUESTION_VALUE_WITH GetValueFrom
|
||||
);
|
||||
|
||||
/**
|
||||
Validate the FormSet. If the formset is not validate, remove it from the list.
|
||||
|
||||
@param FormSet The input FormSet which need to validate.
|
||||
|
||||
@retval TRUE The handle is validate.
|
||||
@retval FALSE The handle is invalidate.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
ValidateFormSet (
|
||||
FORM_BROWSER_FORMSET *FormSet
|
||||
);
|
||||
|
||||
/**
|
||||
Update the ValueChanged status for questions.
|
||||
|
||||
@param FormSet FormSet data structure.
|
||||
@param Form Form data structure.
|
||||
@param SettingScope Setting Scope for Default action.
|
||||
|
||||
**/
|
||||
VOID
|
||||
UpdateStatementStatus (
|
||||
IN FORM_BROWSER_FORMSET *FormSet,
|
||||
IN FORM_BROWSER_FORM *Form,
|
||||
IN BROWSER_SETTING_SCOPE SettingScope
|
||||
);
|
||||
|
||||
/**
|
||||
Get Question's current Value.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user