]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
Add SuppressIf form support in SetupBrowser driver.
[mirror_edk2.git] / MdeModulePkg / Universal / SetupBrowserDxe / Ui.c
index dacc472652dcfa6b8c249aa7f98995cc6b14983d..db2bd27df3284d41ddd3295d39533c597205f0a3 100644 (file)
@@ -1669,6 +1669,7 @@ UiDisplayMenu (
   UINT8                           DigitUint8;\r
   UI_MENU_LIST                    *CurrentMenu;\r
   UI_MENU_LIST                    *MenuList;\r
+  FORM_BROWSER_FORM               *RefForm;\r
 \r
   CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));\r
 \r
@@ -1690,6 +1691,7 @@ UiDisplayMenu (
   NextMenuOption      = NULL;\r
   PreviousMenuOption  = NULL;\r
   SavedMenuOption     = NULL;\r
+  RefForm             = NULL;\r
 \r
   ZeroMem (&Key, sizeof (EFI_INPUT_KEY));\r
 \r
@@ -2494,7 +2496,6 @@ UiDisplayMenu (
           //\r
           // Goto another Hii Package list\r
           //\r
-          ControlFlag = CfCheckSelection;\r
           Selection->Action = UI_ACTION_REFRESH_FORMSET;\r
 \r
           StringPtr = GetToken (Statement->RefDevicePath, Selection->FormSet->HiiHandle);\r
@@ -2549,13 +2550,36 @@ UiDisplayMenu (
           //\r
           // Goto another Formset, check for uncommitted data\r
           //\r
-          ControlFlag = CfCheckSelection;\r
           Selection->Action = UI_ACTION_REFRESH_FORMSET;\r
 \r
           CopyMem (&Selection->FormSetGuid, &Statement->RefFormSetId, sizeof (EFI_GUID));\r
           Selection->FormId = Statement->RefFormId;\r
           Selection->QuestionId = Statement->RefQuestionId;\r
         } else if (Statement->RefFormId != 0) {\r
+          //\r
+          // Check Ref From is suppressed.\r
+          //\r
+          RefForm = IdToForm (Selection->FormSet, Statement->RefFormId);\r
+\r
+          if (RefForm->SuppressExpression != NULL) {\r
+            Status = EvaluateExpression (Selection->FormSet, RefForm, RefForm->SuppressExpression);\r
+            if (EFI_ERROR (Status)) {\r
+              return Status;\r
+            }\r
+\r
+            if (RefForm->SuppressExpression->Result.Value.b) {\r
+              //\r
+              // Form is suppressed. \r
+              //\r
+              do {\r
+                CreateDialog (4, TRUE, 0, NULL, &Key, gEmptyString, gFormSuppress, gPressEnter, gEmptyString);\r
+              } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);\r
+\r
+              Repaint = TRUE;\r
+              break;\r
+            }\r
+          }\r
+\r
           //\r
           // Goto another form inside this formset,\r
           //\r
@@ -2626,9 +2650,9 @@ UiDisplayMenu (
           Selection->Action = UI_ACTION_REFRESH_FORM;\r
         }\r
 \r
-          if (OptionString != NULL) {\r
-            FreePool (OptionString);\r
-          }\r
+        if (OptionString != NULL) {\r
+          FreePool (OptionString);\r
+        }\r
         break;\r
       }\r
       break;\r