Use RETRIEVE instead of CHANGING for refresh question.

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@14727 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Eric Dong 2013-09-25 12:40:31 +00:00 committed by ydong10
parent b1362258ef
commit 798e4d22c4
3 changed files with 45 additions and 20 deletions

View File

@ -160,7 +160,7 @@ UpdateStatement (
// //
// Question value may be changed, need invoke its Callback() // Question value may be changed, need invoke its Callback()
// //
ProcessCallBackFunction (gCurrentSelection, Statement, EFI_BROWSER_ACTION_CHANGING, FALSE); ProcessCallBackFunction (gCurrentSelection, gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, EFI_BROWSER_ACTION_RETRIEVE, FALSE);
if (mHiiPackageListUpdated) { if (mHiiPackageListUpdated) {
// //
@ -1364,7 +1364,7 @@ ProcessGotoOpCode (
// //
// Check whether the device path string is a valid string. // Check whether the device path string is a valid string.
// //
if (Statement->HiiValue.Value.ref.DevicePath != 0 && StringPtr != NULL) { if (Statement->HiiValue.Value.ref.DevicePath != 0 && StringPtr != NULL && StringPtr[0] != L'\0') {
if (Selection->Form->ModalForm) { if (Selection->Form->ModalForm) {
return Status; return Status;
} }
@ -2038,6 +2038,8 @@ FindNextMenu (
about the Selection, form and formset to be displayed. about the Selection, form and formset to be displayed.
On output, Selection return the screen item that is selected On output, Selection return the screen item that is selected
by user. by user.
@param FormSet The formset this question belong to.
@param Form The form this question belong to.
@param Question The Question which need to call. @param Question The Question which need to call.
@param Action The action request. @param Action The action request.
@param SkipSaveOrDiscard Whether skip save or discard action. @param SkipSaveOrDiscard Whether skip save or discard action.
@ -2048,6 +2050,8 @@ FindNextMenu (
EFI_STATUS EFI_STATUS
ProcessCallBackFunction ( ProcessCallBackFunction (
IN OUT UI_MENU_SELECTION *Selection, IN OUT UI_MENU_SELECTION *Selection,
IN FORM_BROWSER_FORMSET *FormSet,
IN FORM_BROWSER_FORM *Form,
IN FORM_BROWSER_STATEMENT *Question, IN FORM_BROWSER_STATEMENT *Question,
IN EFI_BROWSER_ACTION Action, IN EFI_BROWSER_ACTION Action,
IN BOOLEAN SkipSaveOrDiscard IN BOOLEAN SkipSaveOrDiscard
@ -2067,7 +2071,7 @@ ProcessCallBackFunction (
EFI_IFR_TYPE_VALUE BackUpValue; EFI_IFR_TYPE_VALUE BackUpValue;
UINT8 *BackUpBuffer; UINT8 *BackUpBuffer;
ConfigAccess = Selection->FormSet->ConfigAccess; ConfigAccess = FormSet->ConfigAccess;
SubmitFormIsRequired = FALSE; SubmitFormIsRequired = FALSE;
SettingLevel = FormSetLevel; SettingLevel = FormSetLevel;
DiscardFormIsRequired = FALSE; DiscardFormIsRequired = FALSE;
@ -2080,10 +2084,10 @@ ProcessCallBackFunction (
return EFI_SUCCESS; return EFI_SUCCESS;
} }
Link = GetFirstNode (&Selection->Form->StatementListHead); Link = GetFirstNode (&Form->StatementListHead);
while (!IsNull (&Selection->Form->StatementListHead, Link)) { while (!IsNull (&Form->StatementListHead, Link)) {
Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link); Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
Link = GetNextNode (&Selection->Form->StatementListHead, Link); Link = GetNextNode (&Form->StatementListHead, Link);
// //
// if Question != NULL, only process the question. Else, process all question in this form. // if Question != NULL, only process the question. Else, process all question in this form.
@ -2100,7 +2104,7 @@ ProcessCallBackFunction (
// Check whether Statement is disabled. // Check whether Statement is disabled.
// //
if (Statement->Expression != NULL) { if (Statement->Expression != NULL) {
if (EvaluateExpressionList(Statement->Expression, TRUE, Selection->FormSet, Selection->Form) == ExpressDisable) { if (EvaluateExpressionList(Statement->Expression, TRUE, FormSet, Form) == ExpressDisable) {
continue; continue;
} }
} }
@ -2188,7 +2192,7 @@ ProcessCallBackFunction (
// "retrieve" should update to the question's temp buffer. // "retrieve" should update to the question's temp buffer.
// //
if (Action == EFI_BROWSER_ACTION_CHANGING || Action == EFI_BROWSER_ACTION_RETRIEVE) { if (Action == EFI_BROWSER_ACTION_CHANGING || Action == EFI_BROWSER_ACTION_RETRIEVE) {
SetQuestionValue(Selection->FormSet, Selection->Form, Statement, GetSetValueWithEditBuffer); SetQuestionValue(FormSet, Form, Statement, GetSetValueWithEditBuffer);
} }
} else { } else {
// //
@ -2203,7 +2207,7 @@ ProcessCallBackFunction (
CopyMem (&HiiValue->Value, &BackUpValue, sizeof (EFI_IFR_TYPE_VALUE)); CopyMem (&HiiValue->Value, &BackUpValue, sizeof (EFI_IFR_TYPE_VALUE));
} }
SetQuestionValue(Selection->FormSet, Selection->Form, Statement, GetSetValueWithEditBuffer); SetQuestionValue(FormSet, Form, Statement, GetSetValueWithEditBuffer);
} }
// //
@ -2212,7 +2216,7 @@ ProcessCallBackFunction (
// //
if ((Action == EFI_BROWSER_ACTION_CHANGING && Status != EFI_UNSUPPORTED) || if ((Action == EFI_BROWSER_ACTION_CHANGING && Status != EFI_UNSUPPORTED) ||
Action == EFI_BROWSER_ACTION_RETRIEVE) { Action == EFI_BROWSER_ACTION_RETRIEVE) {
GetQuestionValue(Selection->FormSet, Selection->Form, Statement, GetSetValueWithEditBuffer); GetQuestionValue(FormSet, Form, Statement, GetSetValueWithEditBuffer);
} }
if (Status == EFI_UNSUPPORTED) { if (Status == EFI_UNSUPPORTED) {
@ -2229,11 +2233,11 @@ ProcessCallBackFunction (
} }
if (SubmitFormIsRequired && !SkipSaveOrDiscard) { if (SubmitFormIsRequired && !SkipSaveOrDiscard) {
SubmitForm (Selection->FormSet, Selection->Form, SettingLevel); SubmitForm (FormSet, Form, SettingLevel);
} }
if (DiscardFormIsRequired && !SkipSaveOrDiscard) { if (DiscardFormIsRequired && !SkipSaveOrDiscard) {
DiscardForm (Selection->FormSet, Selection->Form, SettingLevel); DiscardForm (FormSet, Form, SettingLevel);
} }
if (NeedExit) { if (NeedExit) {
@ -2335,6 +2339,11 @@ SetupBrowser (
return Status; return Status;
} }
if ((Selection->Handle != mCurrentHiiHandle) ||
(!CompareGuid (&Selection->FormSetGuid, &mCurrentFormSetGuid))) {
gFinishRetrieveCall = FALSE;
}
// //
// Initialize current settings of Questions in this FormSet // Initialize current settings of Questions in this FormSet
// //
@ -2413,7 +2422,7 @@ SetupBrowser (
CopyGuid (&mCurrentFormSetGuid, &Selection->FormSetGuid); CopyGuid (&mCurrentFormSetGuid, &Selection->FormSetGuid);
mCurrentFormId = Selection->FormId; mCurrentFormId = Selection->FormId;
Status = ProcessCallBackFunction (Selection, NULL, EFI_BROWSER_ACTION_FORM_OPEN, FALSE); Status = ProcessCallBackFunction (Selection, gCurrentSelection->FormSet, Selection->Form, NULL, EFI_BROWSER_ACTION_FORM_OPEN, FALSE);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
goto Done; goto Done;
} }
@ -2436,6 +2445,11 @@ SetupBrowser (
goto Done; goto Done;
} }
//
// Finish call RETRIEVE callback for this formset.
//
gFinishRetrieveCall = TRUE;
// //
// IFR is updated during callback of read value, force to reparse the IFR binary // IFR is updated during callback of read value, force to reparse the IFR binary
// //
@ -2461,7 +2475,7 @@ SetupBrowser (
if ((ConfigAccess != NULL) && if ((ConfigAccess != NULL) &&
((Statement->QuestionFlags & EFI_IFR_FLAG_CALLBACK) == EFI_IFR_FLAG_CALLBACK) && ((Statement->QuestionFlags & EFI_IFR_FLAG_CALLBACK) == EFI_IFR_FLAG_CALLBACK) &&
(Statement->Operand != EFI_IFR_PASSWORD_OP)) { (Statement->Operand != EFI_IFR_PASSWORD_OP)) {
Status = ProcessCallBackFunction(Selection, Statement, EFI_BROWSER_ACTION_CHANGING, FALSE); Status = ProcessCallBackFunction(Selection, Selection->FormSet, Selection->Form, Statement, EFI_BROWSER_ACTION_CHANGING, FALSE);
if (Statement->Operand == EFI_IFR_REF_OP) { if (Statement->Operand == EFI_IFR_REF_OP) {
// //
// Process dynamic update ref opcode. // Process dynamic update ref opcode.
@ -2483,7 +2497,7 @@ SetupBrowser (
} }
if (!EFI_ERROR (Status) && Statement->Operand != EFI_IFR_REF_OP) { if (!EFI_ERROR (Status) && Statement->Operand != EFI_IFR_REF_OP) {
ProcessCallBackFunction(Selection, Statement, EFI_BROWSER_ACTION_CHANGED, FALSE); ProcessCallBackFunction(Selection, Selection->FormSet, Selection->Form, Statement, EFI_BROWSER_ACTION_CHANGED, FALSE);
} }
} else if (Statement->Operand != EFI_IFR_PASSWORD_OP) { } else if (Statement->Operand != EFI_IFR_PASSWORD_OP) {
SetQuestionValue (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithEditBuffer); SetQuestionValue (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithEditBuffer);
@ -2521,7 +2535,7 @@ SetupBrowser (
(!CompareGuid (&Selection->FormSetGuid, &mCurrentFormSetGuid)) || (!CompareGuid (&Selection->FormSetGuid, &mCurrentFormSetGuid)) ||
(Selection->FormId != mCurrentFormId))) { (Selection->FormId != mCurrentFormId))) {
Status = ProcessCallBackFunction (Selection, NULL, EFI_BROWSER_ACTION_FORM_CLOSE, FALSE); Status = ProcessCallBackFunction (Selection, Selection->FormSet, Selection->Form, NULL, EFI_BROWSER_ACTION_FORM_CLOSE, FALSE);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
goto Done; goto Done;
} }

View File

@ -48,6 +48,7 @@ LIST_ENTRY gBrowserFormSetList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserFor
LIST_ENTRY gBrowserHotKeyList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserHotKeyList); LIST_ENTRY gBrowserHotKeyList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserHotKeyList);
LIST_ENTRY gBrowserStorageList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserStorageList); LIST_ENTRY gBrowserStorageList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserStorageList);
BOOLEAN gFinishRetrieveCall;
BOOLEAN gResetRequired; BOOLEAN gResetRequired;
BOOLEAN gExitRequired; BOOLEAN gExitRequired;
BROWSER_SETTING_SCOPE gBrowserSettingScope = FormSetLevel; BROWSER_SETTING_SCOPE gBrowserSettingScope = FormSetLevel;
@ -257,8 +258,11 @@ LoadAllHiiFormset (
EFI_GUID ZeroGuid; EFI_GUID ZeroGuid;
EFI_STATUS Status; EFI_STATUS Status;
FORM_BROWSER_FORMSET *OldFormset; FORM_BROWSER_FORMSET *OldFormset;
BOOLEAN OldRetrieveValue;
OldFormset = mSystemLevelFormSet; OldFormset = mSystemLevelFormSet;
OldRetrieveValue = gFinishRetrieveCall;
gFinishRetrieveCall = FALSE;
// //
// Get all the Hii handles // Get all the Hii handles
@ -307,6 +311,7 @@ LoadAllHiiFormset (
// //
FreePool (HiiHandles); FreePool (HiiHandles);
gFinishRetrieveCall = OldRetrieveValue;
mSystemLevelFormSet = OldFormset; mSystemLevelFormSet = OldFormset;
} }
@ -365,6 +370,7 @@ SendForm (
// //
SaveBrowserContext (); SaveBrowserContext ();
gFinishRetrieveCall = FALSE;
gResetRequired = FALSE; gResetRequired = FALSE;
gExitRequired = FALSE; gExitRequired = FALSE;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
@ -3651,7 +3657,8 @@ LoadFormConfig (
// Call the Retrieve call back function for all questions. // Call the Retrieve call back function for all questions.
// //
if ((FormSet->ConfigAccess != NULL) && (Selection != NULL) && if ((FormSet->ConfigAccess != NULL) && (Selection != NULL) &&
((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) == EFI_IFR_FLAG_CALLBACK)) { ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) == EFI_IFR_FLAG_CALLBACK) &&
!gFinishRetrieveCall) {
// //
// Check QuestionValue does exist. // Check QuestionValue does exist.
// //
@ -3675,7 +3682,7 @@ LoadFormConfig (
); );
} }
Status = ProcessCallBackFunction(Selection, Question, EFI_BROWSER_ACTION_RETRIEVE, TRUE); Status = ProcessCallBackFunction(Selection, FormSet, Form, Question, EFI_BROWSER_ACTION_RETRIEVE, TRUE);
} }
// //

View File

@ -541,7 +541,7 @@ extern EDKII_FORM_DISPLAY_ENGINE_PROTOCOL *mFormDisplay;
extern BOOLEAN gResetRequired; extern BOOLEAN gResetRequired;
extern BOOLEAN gExitRequired; extern BOOLEAN gExitRequired;
extern BOOLEAN gFinishRetrieveCall;
extern LIST_ENTRY gBrowserFormSetList; extern LIST_ENTRY gBrowserFormSetList;
extern LIST_ENTRY gBrowserHotKeyList; extern LIST_ENTRY gBrowserHotKeyList;
extern BROWSER_SETTING_SCOPE gBrowserSettingScope; extern BROWSER_SETTING_SCOPE gBrowserSettingScope;
@ -1157,7 +1157,9 @@ IsStorageDataChangedForFormSet (
about the Selection, form and formset to be displayed. about the Selection, form and formset to be displayed.
On output, Selection return the screen item that is selected On output, Selection return the screen item that is selected
by user. by user.
@param Statement The Question which need to call. @param FormSet The formset this question belong to.
@param Form The form this question belong to.
@param Question The Question which need to call.
@param Action The action request. @param Action The action request.
@param SkipSaveOrDiscard Whether skip save or discard action. @param SkipSaveOrDiscard Whether skip save or discard action.
@ -1167,6 +1169,8 @@ IsStorageDataChangedForFormSet (
EFI_STATUS EFI_STATUS
ProcessCallBackFunction ( ProcessCallBackFunction (
IN OUT UI_MENU_SELECTION *Selection, IN OUT UI_MENU_SELECTION *Selection,
IN FORM_BROWSER_FORMSET *FormSet,
IN FORM_BROWSER_FORM *Form,
IN FORM_BROWSER_STATEMENT *Question, IN FORM_BROWSER_STATEMENT *Question,
IN EFI_BROWSER_ACTION Action, IN EFI_BROWSER_ACTION Action,
IN BOOLEAN SkipSaveOrDiscard IN BOOLEAN SkipSaveOrDiscard