In current UI code, we use oneof opcode without storage for language
menu. If we change the language form A->B, then go to another form and
then go back to the front page, the language menu always shows A. Now
we fix this issue by retrieving the value of oneof opcode(language menu)
when display it.

Notes:
v1->V2:
-Change the subject from 'Get current language when open front page'
to 'Retrieve the value of language menu'.
-Get the value of oneof opcode(language menu) in retrieve callback instead
of geting the value when open the form.

Cc: Liming Gao <liming....@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan...@intel.com>
Reviewed-by: Eric Dong <eric.d...@intel.com>
---
 .../Application/UiApp/FrontPageCustomizedUiSupport.c        | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/MdeModulePkg/Application/UiApp/FrontPageCustomizedUiSupport.c 
b/MdeModulePkg/Application/UiApp/FrontPageCustomizedUiSupport.c
index dc5d1c6..da0cff7 100644
--- a/MdeModulePkg/Application/UiApp/FrontPageCustomizedUiSupport.c
+++ b/MdeModulePkg/Application/UiApp/FrontPageCustomizedUiSupport.c
@@ -54,10 +54,11 @@ typedef struct {
 
 CHAR8                        *gLanguageString;
 EFI_STRING_ID                *gLanguageToken;
 UI_HII_DRIVER_INSTANCE       *gHiiDriverList;
 extern EFI_HII_HANDLE        gStringPackHandle;
+UINT8                        gCurrentLanguageIndex;
 
 
 /**
   Get next language from language code list (with separator ';').
 
@@ -128,10 +129,11 @@ LanguageChangeHandler (
   LangCode = gLanguageString;
   while (*LangCode != 0) {
     GetNextLanguage (&LangCode, Lang);
 
     if (Index == Value->u8) {
+      gCurrentLanguageIndex = Value->u8;
       break;
     }
 
     Index++;
   }
@@ -188,10 +190,20 @@ UiSupportLibCallbackHandler (
       QuestionId != FRONT_PAGE_KEY_RESET &&
       QuestionId != FRONT_PAGE_KEY_LANGUAGE) {
     return FALSE;
   }
 
+  if (Action == EFI_BROWSER_ACTION_RETRIEVE) {
+    if (QuestionId == FRONT_PAGE_KEY_LANGUAGE) {
+      Value->u8 = gCurrentLanguageIndex;
+      *Status = EFI_SUCCESS;
+    } else {
+      *Status = EFI_UNSUPPORTED;
+    }
+    return TRUE;
+  }
+
   if (Action != EFI_BROWSER_ACTION_CHANGED) {
     //
     // Do nothing for other UEFI Action. Only do call back when data is 
changed.
     //
     *Status = EFI_UNSUPPORTED;
@@ -345,10 +357,11 @@ UiCreateLanguageMenu (
         gLanguageToken[OptionCount],
         EFI_IFR_OPTION_DEFAULT,
         EFI_IFR_NUMERIC_SIZE_1,
         (UINT8) OptionCount
         );
+      gCurrentLanguageIndex = (UINT8) OptionCount;
     } else {
       HiiCreateOneOfOptionOpCode (
         OptionsOpCodeHandle,
         gLanguageToken[OptionCount],
         0,
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to