Refine the save action for the browser.
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@15639 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -913,6 +913,8 @@ DestroyForm (
|
||||
FreePool (Form->SuppressExpression);
|
||||
}
|
||||
|
||||
UiFreeMenuList (&Form->FormViewListHead);
|
||||
|
||||
//
|
||||
// Free this Form
|
||||
//
|
||||
@@ -1227,6 +1229,7 @@ ParseOpCodes (
|
||||
|
||||
InitializeListHead (&FormSet->StatementListOSF);
|
||||
InitializeListHead (&FormSet->StorageListHead);
|
||||
InitializeListHead (&FormSet->SaveFailStorageListHead);
|
||||
InitializeListHead (&FormSet->DefaultStoreListHead);
|
||||
InitializeListHead (&FormSet->FormListHead);
|
||||
InitializeListHead (&FormSet->ExpressionListHead);
|
||||
@@ -1604,6 +1607,7 @@ ParseOpCodes (
|
||||
InitializeListHead (&CurrentForm->ExpressionListHead);
|
||||
InitializeListHead (&CurrentForm->StatementListHead);
|
||||
InitializeListHead (&CurrentForm->ConfigRequestHead);
|
||||
InitializeListHead (&CurrentForm->FormViewListHead);
|
||||
|
||||
CurrentForm->FormType = STANDARD_MAP_FORM_TYPE;
|
||||
CopyMem (&CurrentForm->FormId, &((EFI_IFR_FORM *) OpCodeData)->FormId, sizeof (UINT16));
|
||||
@@ -1645,6 +1649,8 @@ ParseOpCodes (
|
||||
InitializeListHead (&CurrentForm->ExpressionListHead);
|
||||
InitializeListHead (&CurrentForm->StatementListHead);
|
||||
InitializeListHead (&CurrentForm->ConfigRequestHead);
|
||||
InitializeListHead (&CurrentForm->FormViewListHead);
|
||||
|
||||
CopyMem (&CurrentForm->FormId, &((EFI_IFR_FORM *) OpCodeData)->FormId, sizeof (UINT16));
|
||||
|
||||
MapMethod = (EFI_IFR_FORM_MAP_METHOD *) (OpCodeData + sizeof (EFI_IFR_FORM_MAP));
|
||||
|
@@ -905,8 +905,6 @@ ProcessAction (
|
||||
IN UINT16 DefaultId
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// This is caused by use press ESC, and it should not combine with other action type.
|
||||
//
|
||||
@@ -928,10 +926,7 @@ ProcessAction (
|
||||
}
|
||||
|
||||
if ((Action & BROWSER_ACTION_SUBMIT) == BROWSER_ACTION_SUBMIT) {
|
||||
Status = SubmitForm (gCurrentSelection->FormSet, gCurrentSelection->Form, gBrowserSettingScope);
|
||||
if (EFI_ERROR (Status)) {
|
||||
PopupErrorMessage(BROWSER_SUBMIT_FAIL, NULL, NULL);
|
||||
}
|
||||
SubmitForm (gCurrentSelection->FormSet, gCurrentSelection->Form, gBrowserSettingScope);
|
||||
}
|
||||
|
||||
if ((Action & BROWSER_ACTION_RESET) == BROWSER_ACTION_RESET) {
|
||||
@@ -1186,7 +1181,8 @@ ProcessChangedData (
|
||||
IN BROWSER_SETTING_SCOPE Scope
|
||||
)
|
||||
{
|
||||
BOOLEAN RetValue;
|
||||
BOOLEAN RetValue;
|
||||
EFI_STATUS Status;
|
||||
|
||||
RetValue = TRUE;
|
||||
switch (mFormDisplay->ConfirmDataChange()) {
|
||||
@@ -1195,7 +1191,10 @@ ProcessChangedData (
|
||||
break;
|
||||
|
||||
case BROWSER_ACTION_SUBMIT:
|
||||
SubmitForm (Selection->FormSet, Selection->Form, Scope);
|
||||
Status = SubmitForm (Selection->FormSet, Selection->Form, Scope);
|
||||
if (EFI_ERROR (Status)) {
|
||||
RetValue = FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case BROWSER_ACTION_NONE:
|
||||
@@ -1306,7 +1305,7 @@ ProcessGotoOpCode (
|
||||
//
|
||||
// Not found the EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL protocol.
|
||||
//
|
||||
PopupErrorMessage(BROWSER_PROTOCOL_NOT_FOUND, NULL, NULL);
|
||||
PopupErrorMessage(BROWSER_PROTOCOL_NOT_FOUND, NULL, NULL, NULL);
|
||||
FreePool (StringPtr);
|
||||
return Status;
|
||||
}
|
||||
@@ -1383,7 +1382,7 @@ ProcessGotoOpCode (
|
||||
//
|
||||
// Form is suppressed.
|
||||
//
|
||||
PopupErrorMessage(BROWSER_FORM_SUPPRESS, NULL, NULL);
|
||||
PopupErrorMessage(BROWSER_FORM_SUPPRESS, NULL, NULL, NULL);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -1630,6 +1629,12 @@ DisplayForm (
|
||||
gCurrentSelection->FormId, gCurrentSelection->QuestionId);
|
||||
ASSERT (CurrentMenu != NULL);
|
||||
}
|
||||
|
||||
//
|
||||
// Back up the form view history data for this form.
|
||||
//
|
||||
UiCopyMenuList(&gCurrentSelection->Form->FormViewListHead, &mPrivateData.FormBrowserEx2.FormViewHistoryHead);
|
||||
|
||||
gCurrentSelection->CurrentMenu = CurrentMenu;
|
||||
|
||||
//
|
||||
@@ -1660,6 +1665,7 @@ DisplayForm (
|
||||
// and an valid value has return.
|
||||
// EFI_SUCCESS: Success shows form and get user input in UserInput paramenter.
|
||||
//
|
||||
ASSERT (gDisplayFormData.BrowserStatus == BROWSER_SUCCESS);
|
||||
Status = mFormDisplay->FormDisplay (&gDisplayFormData, &UserInput);
|
||||
if (EFI_ERROR (Status) && Status != EFI_NOT_FOUND) {
|
||||
FreeDisplayFormData();
|
||||
@@ -1849,7 +1855,7 @@ FindNextMenu (
|
||||
//
|
||||
if ((gBrowserSettingScope == FormLevel && IsNvUpdateRequiredForForm (Selection->Form)) ||
|
||||
(gBrowserSettingScope == FormSetLevel && IsNvUpdateRequiredForFormSet(Selection->FormSet) && Scope == FormSetLevel)) {
|
||||
if (!ProcessChangedData(Selection, Scope)) {
|
||||
if (!ProcessChangedData(Selection, gBrowserSettingScope)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -2309,7 +2315,7 @@ SetupBrowser (
|
||||
//
|
||||
// Form is suppressed.
|
||||
//
|
||||
PopupErrorMessage(BROWSER_FORM_SUPPRESS, NULL, NULL);
|
||||
PopupErrorMessage(BROWSER_FORM_SUPPRESS, NULL, NULL, NULL);
|
||||
Status = EFI_NOT_FOUND;
|
||||
goto Done;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -164,6 +164,8 @@ typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
LIST_ENTRY SaveFailLink;
|
||||
|
||||
UINT16 VarStoreId;
|
||||
|
||||
BROWSER_STORAGE *BrowserStorage;
|
||||
@@ -174,6 +176,7 @@ typedef struct {
|
||||
} FORMSET_STORAGE;
|
||||
|
||||
#define FORMSET_STORAGE_FROM_LINK(a) CR (a, FORMSET_STORAGE, Link, FORMSET_STORAGE_SIGNATURE)
|
||||
#define FORMSET_STORAGE_FROM_SAVE_FAIL_LINK(a) CR (a, FORMSET_STORAGE, SaveFailLink, FORMSET_STORAGE_SIGNATURE)
|
||||
|
||||
typedef union {
|
||||
EFI_STRING_ID VarName;
|
||||
@@ -373,6 +376,8 @@ typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
LIST_ENTRY SaveFailLink;
|
||||
|
||||
CHAR16 *ConfigRequest; // <ConfigRequest> = <ConfigHdr> + <RequestElement>
|
||||
UINTN ElementCount; // Number of <RequestElement> in the <ConfigRequest>
|
||||
UINTN SpareStrLen;
|
||||
@@ -380,6 +385,7 @@ typedef struct {
|
||||
BROWSER_STORAGE *Storage;
|
||||
} FORM_BROWSER_CONFIG_REQUEST;
|
||||
#define FORM_BROWSER_CONFIG_REQUEST_FROM_LINK(a) CR (a, FORM_BROWSER_CONFIG_REQUEST, Link, FORM_BROWSER_CONFIG_REQUEST_SIGNATURE)
|
||||
#define FORM_BROWSER_CONFIG_REQUEST_FROM_SAVE_FAIL_LINK(a) CR (a, FORM_BROWSER_CONFIG_REQUEST, SaveFailLink, FORM_BROWSER_CONFIG_REQUEST_SIGNATURE)
|
||||
|
||||
#define FORM_BROWSER_FORM_SIGNATURE SIGNATURE_32 ('F', 'F', 'R', 'M')
|
||||
#define STANDARD_MAP_FORM_TYPE 0x01
|
||||
@@ -397,6 +403,7 @@ typedef struct {
|
||||
BOOLEAN ModalForm; // Whether this is a modal form.
|
||||
BOOLEAN Locked; // Whether this form is locked.
|
||||
|
||||
LIST_ENTRY FormViewListHead; // List of type FORMID_INFO is Browser View Form History List.
|
||||
LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)
|
||||
LIST_ENTRY StatementListHead; // List of Statements and Questions (FORM_BROWSER_STATEMENT)
|
||||
LIST_ENTRY ConfigRequestHead; // List of configreques for all storage.
|
||||
@@ -422,6 +429,8 @@ typedef struct {
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
LIST_ENTRY SaveFailLink;
|
||||
|
||||
EFI_HII_HANDLE HiiHandle; // unique id for formset.
|
||||
EFI_HANDLE DriverHandle;
|
||||
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
|
||||
@@ -442,15 +451,20 @@ typedef struct {
|
||||
|
||||
FORM_BROWSER_STATEMENT *StatementBuffer; // Buffer for all Statements and Questions
|
||||
EXPRESSION_OPCODE *ExpressionBuffer; // Buffer for all Expression OpCode
|
||||
FORM_BROWSER_FORM *SaveFailForm; // The form which failed to save.
|
||||
FORM_BROWSER_STATEMENT *SaveFailStatement; // The Statement which failed to save.
|
||||
|
||||
LIST_ENTRY StatementListOSF; // Statement list out side of the form.
|
||||
LIST_ENTRY StorageListHead; // Storage list (FORMSET_STORAGE)
|
||||
LIST_ENTRY SaveFailStorageListHead; // Storage list for the save fail storage.
|
||||
LIST_ENTRY DefaultStoreListHead; // DefaultStore list (FORMSET_DEFAULTSTORE)
|
||||
LIST_ENTRY FormListHead; // Form list (FORM_BROWSER_FORM)
|
||||
LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)
|
||||
} FORM_BROWSER_FORMSET;
|
||||
#define FORM_BROWSER_FORMSET_FROM_LINK(a) CR (a, FORM_BROWSER_FORMSET, Link, FORM_BROWSER_FORMSET_SIGNATURE)
|
||||
|
||||
#define FORM_BROWSER_FORMSET_FROM_SAVE_FAIL_LINK(a) CR (a, FORM_BROWSER_FORMSET, SaveFailLink, FORM_BROWSER_FORMSET_SIGNATURE)
|
||||
|
||||
typedef struct {
|
||||
LIST_ENTRY Link;
|
||||
EFI_EVENT RefreshEvent;
|
||||
@@ -534,9 +548,10 @@ typedef enum {
|
||||
// Get/set question value from/to.
|
||||
//
|
||||
typedef enum {
|
||||
GetSetValueWithEditBuffer, // Get/Set question value from/to editbuffer in the storage.
|
||||
GetSetValueWithEditBuffer = 0, // Get/Set question value from/to editbuffer in the storage.
|
||||
GetSetValueWithBuffer, // Get/Set question value from/to buffer in the storage.
|
||||
GetSetValueWithHiiDriver, // Get/Set question value from/to hii driver.
|
||||
GetSetValueWithBothBuffer, // Compare the editbuffer with buffer for this question, not use the question value.
|
||||
GetSetValueWithMax // Invalid value.
|
||||
} GET_SET_QUESTION_VALUE_WITH;
|
||||
|
||||
@@ -1523,6 +1538,19 @@ UiFindParentMenu (
|
||||
IN FORM_ENTRY_INFO *CurrentMenu
|
||||
);
|
||||
|
||||
/**
|
||||
Copy current Menu list to the new menu list.
|
||||
|
||||
@param NewMenuListHead New create Menu list.
|
||||
@param CurrentMenuListHead Current Menu list.
|
||||
|
||||
**/
|
||||
VOID
|
||||
UiCopyMenuList (
|
||||
OUT LIST_ENTRY *NewMenuListHead,
|
||||
IN LIST_ENTRY *CurrentMenuListHead
|
||||
);
|
||||
|
||||
/**
|
||||
Search an Option of a Question by its value.
|
||||
|
||||
@@ -1713,13 +1741,15 @@ ValueChangedValidation (
|
||||
Pop up the error info.
|
||||
|
||||
@param BrowserStatus The input browser status.
|
||||
@param HiiHandle The HiiHandle for this error opcode.
|
||||
@param OpCode The opcode use to get the erro info and timeout value.
|
||||
@param ErrorString Error string used by BROWSER_NO_SUBMIT_IF.
|
||||
|
||||
**/
|
||||
VOID
|
||||
UINT32
|
||||
PopupErrorMessage (
|
||||
IN UINT32 BrowserStatus,
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_IFR_OP_HEADER *OpCode, OPTIONAL
|
||||
IN CHAR16 *ErrorString
|
||||
);
|
||||
|
Reference in New Issue
Block a user