Implementation for handling the User Interface option processing.\r
\r
\r
-Copyright (c) 2004 - 2010, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
http://opensource.org/licenses/bsd-license.php\r
EFI_STATUS Status;\r
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;\r
EFI_BROWSER_ACTION_REQUEST ActionRequest;\r
- EFI_HII_VALUE *QuestionValue;\r
+ EFI_IFR_TYPE_VALUE IfrTypeValue;\r
\r
- QuestionValue = &MenuOption->ThisTag->HiiValue;\r
ConfigAccess = Selection->FormSet->ConfigAccess;\r
if (ConfigAccess == NULL) {\r
return EFI_UNSUPPORTED;\r
// Prepare password string in HII database\r
//\r
if (String != NULL) {\r
- QuestionValue->Value.string = NewString (String, Selection->FormSet->HiiHandle);\r
+ IfrTypeValue.string = NewString (String, Selection->FormSet->HiiHandle);\r
} else {\r
- QuestionValue->Value.string = 0;\r
+ IfrTypeValue.string = 0;\r
}\r
\r
//\r
ConfigAccess,\r
EFI_BROWSER_ACTION_CHANGING,\r
MenuOption->ThisTag->QuestionId,\r
- QuestionValue->Type,\r
- &QuestionValue->Value,\r
+ MenuOption->ThisTag->HiiValue.Type,\r
+ &IfrTypeValue,\r
&ActionRequest\r
);\r
\r
// Remove password string from HII database\r
//\r
if (String != NULL) {\r
- DeleteString (QuestionValue->Value.string, Selection->FormSet->HiiHandle);\r
+ DeleteString (IfrTypeValue.string, Selection->FormSet->HiiHandle);\r
}\r
\r
return Status;\r
UINTN Index2;\r
UINT8 *ValueArray;\r
UINT8 ValueType;\r
+ EFI_STRING_ID StringId;\r
\r
Status = EFI_SUCCESS;\r
\r
StringPtr = NULL;\r
Character[1] = L'\0';\r
*OptionString = NULL;\r
+ StringId = 0;\r
\r
ZeroMem (FormattedNumber, 21 * sizeof (CHAR16));\r
BufferSize = (gOptionBlockWidth + 1) * 2 * gScreenDimensions.BottomRow;\r
SetArrayData (ValueArray, ValueType, Index2, 0);\r
\r
Status = SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);\r
- UpdateStatusBar (NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);\r
+ UpdateStatusBar (Selection, NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);\r
\r
FreePool (*OptionString);\r
*OptionString = NULL;\r
!Option->SuppressExpression->Result.Value.b) {\r
CopyMem (QuestionValue, &Option->Value, sizeof (EFI_HII_VALUE));\r
SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);\r
- UpdateStatusBar (NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);\r
+ UpdateStatusBar (Selection, NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);\r
break;\r
}\r
\r
Suppress = FALSE;\r
CopyMem (QuestionValue, &OneOfOption->Value, sizeof (EFI_HII_VALUE));\r
SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);\r
- UpdateStatusBar (NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);\r
- gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT | FIELD_BACKGROUND);\r
+ UpdateStatusBar (Selection, NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);\r
+ gST->ConOut->SetAttribute (gST->ConOut, PcdGet8 (PcdBrowserFieldTextColor) | FIELD_BACKGROUND);\r
break;\r
}\r
\r
// Save Question value\r
//\r
Status = SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);\r
- UpdateStatusBar (NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);\r
+ UpdateStatusBar (Selection, NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);\r
}\r
\r
if (QuestionValue->Value.b) {\r
\r
Status = ReadString (MenuOption, gPromptForData, StringPtr);\r
if (!EFI_ERROR (Status)) {\r
- CopyMem (Question->BufferValue, StringPtr, Maximum * sizeof (CHAR16));\r
- SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);\r
+ HiiSetString(Selection->FormSet->HiiHandle, Question->HiiValue.Value.string, StringPtr, NULL);\r
+ Status = ValidateQuestion(Selection->FormSet, Selection->Form, Question, EFI_HII_EXPRESSION_INCONSISTENT_IF);\r
+ if (EFI_ERROR (Status)) {\r
+ HiiSetString(Selection->FormSet->HiiHandle, Question->HiiValue.Value.string, (CHAR16*)Question->BufferValue, NULL);\r
+ } else {\r
+ CopyMem (Question->BufferValue, StringPtr, Maximum * sizeof (CHAR16));\r
+ SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);\r
\r
- UpdateStatusBar (NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);\r
+ UpdateStatusBar (Selection, NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);\r
+ }\r
}\r
\r
FreePool (StringPtr);\r
//\r
*StringPtr = 0;\r
Status = PasswordCallback (Selection, MenuOption, StringPtr);\r
- if (Status == EFI_NOT_AVAILABLE_YET) {\r
+ if (Status == EFI_NOT_AVAILABLE_YET || Status == EFI_UNSUPPORTED) {\r
//\r
+ // Callback is not supported, or\r
// Callback request to terminate password input\r
//\r
FreePool (StringPtr);\r
//\r
if (StrCmp (StringPtr, TempString) == 0) {\r
//\r
- // Two password match, send it to Configuration Driver\r
+ // Prepare the Question->HiiValue.Value.string for ValidateQuestion use.\r
//\r
- if ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) {\r
- PasswordCallback (Selection, MenuOption, StringPtr);\r
+ if((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) {\r
+ StringId = Question->HiiValue.Value.string;\r
+ Question->HiiValue.Value.string = NewString (StringPtr, Selection->FormSet->HiiHandle);\r
} else {\r
- CopyMem (Question->BufferValue, StringPtr, Maximum * sizeof (CHAR16));\r
- SetQuestionValue (Selection->FormSet, Selection->Form, Question, FALSE);\r
+ HiiSetString(Selection->FormSet->HiiHandle, Question->HiiValue.Value.string, StringPtr, NULL);\r
+ }\r
+ \r
+ Status = ValidateQuestion(Selection->FormSet, Selection->Form, Question, EFI_HII_EXPRESSION_INCONSISTENT_IF);\r
+\r
+ //\r
+ // Researve the Question->HiiValue.Value.string.\r
+ //\r
+ if((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) {\r
+ DeleteString(Question->HiiValue.Value.string, Selection->FormSet->HiiHandle);\r
+ Question->HiiValue.Value.string = StringId;\r
+ } \r
+ \r
+ if (EFI_ERROR (Status)) {\r
+ //\r
+ // Reset state machine for interactive password\r
+ //\r
+ if ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) {\r
+ PasswordCallback (Selection, MenuOption, NULL);\r
+ } else {\r
+ //\r
+ // Researve the Question->HiiValue.Value.string.\r
+ //\r
+ HiiSetString(Selection->FormSet->HiiHandle, Question->HiiValue.Value.string, (CHAR16*)Question->BufferValue, NULL); \r
+ }\r
+ } else {\r
+ //\r
+ // Two password match, send it to Configuration Driver\r
+ //\r
+ if ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) {\r
+ PasswordCallback (Selection, MenuOption, StringPtr);\r
+ } else {\r
+ CopyMem (Question->BufferValue, StringPtr, Maximum * sizeof (CHAR16));\r
+ SetQuestionValue (Selection->FormSet, Selection->Form, Question, FALSE);\r
+ }\r
}\r
} else {\r
//\r