public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Dong, Eric" <eric.dong@intel.com>
To: "Bi, Dandan" <dandan.bi@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Gao, Liming" <liming.gao@intel.com>,
	"Yao, Jiewen" <jiewen.yao@intel.com>
Subject: Re: [patch 2/3] MdeModulePkg/FileExplorer: Update QuesrionId when Updating FileExplore form
Date: Wed, 18 Jan 2017 02:50:28 +0000	[thread overview]
Message-ID: <ED077930C258884BBCB450DB737E66224A8ECDEC@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1484546246-54936-2-git-send-email-dandan.bi@intel.com>

Reviewed-by: Eric Dong <eric.dong@intel.com>

-----Original Message-----
From: Bi, Dandan 
Sent: Monday, January 16, 2017 1:57 PM
To: edk2-devel@lists.01.org
Cc: Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
Subject: [patch 2/3] MdeModulePkg/FileExplorer: Update QuesrionId when Updating FileExplore form

https://bugzilla.tianocore.org/show_bug.cgi?id=342

When user select and enter a directory, File Explorer will update the form based on the new folders and files in the directory. But when creating question opcodes, the question id is same with previous one and this will cause browser to show the highlight menu incorrectly.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 MdeModulePkg/Library/FileExplorerLib/FileExplorer.c | 12 ++++++++----  MdeModulePkg/Library/FileExplorerLib/FileExplorer.h |  2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
index 9cd366d..315868a 100644
--- a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
+++ b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
@@ -70,10 +70,11 @@ HII_VENDOR_DEVICE_PATH  FeHiiVendorDevicePath = {
 
 VOID                *mLibStartOpCodeHandle = NULL;
 VOID                *mLibEndOpCodeHandle = NULL;
 EFI_IFR_GUID_LABEL  *mLibStartLabel = NULL;  EFI_IFR_GUID_LABEL  *mLibEndLabel = NULL;
+UINT16              mQuestionIdUpdate;
 
 /**
   This function allows a caller to extract the current configuration for one
   or more named elements from the target driver.
 
@@ -1181,21 +1182,23 @@ LibUpdateFileExplorePage (
   NewFileContext  = NULL;
 
   LibRefreshUpdateData ();
   MenuOption = gFileExplorerPrivate.FsOptionMenu;
 
+  mQuestionIdUpdate += QUESTION_ID_UPDATE_STEP;
+
   for (Index = 0; Index < MenuOption->MenuNumber; Index++) {
     NewMenuEntry    = LibGetMenuEntry (MenuOption, Index);
     NewFileContext  = (FILE_CONTEXT *) NewMenuEntry->VariableContext;
 
     if (!NewFileContext->IsDir) {
       //
       // Create Text opcode for directory, also create Text opcode for file in FileExplorerStateBootFromFile.
       //
       HiiCreateActionOpCode (
         mLibStartOpCodeHandle,
-        (UINT16) (FILE_OPTION_OFFSET + Index),
+        (UINT16) (FILE_OPTION_OFFSET + Index + mQuestionIdUpdate),
         NewMenuEntry->DisplayStringToken,
         STRING_TOKEN (STR_NULL_STRING),
         EFI_IFR_FLAG_CALLBACK,
         0
         );
@@ -1207,11 +1210,11 @@ LibUpdateFileExplorePage (
         mLibStartOpCodeHandle,
         FORM_FILE_EXPLORER_ID,
         NewMenuEntry->DisplayStringToken,
         STRING_TOKEN (STR_NULL_STRING),
         EFI_IFR_FLAG_CALLBACK,
-        (UINT16) (FILE_OPTION_OFFSET + Index)
+        (UINT16) (FILE_OPTION_OFFSET + Index + mQuestionIdUpdate)
         );
     }
   }
 
   HiiUpdateForm (
@@ -1242,11 +1245,11 @@ LibUpdateFileExplorer (
   FILE_CONTEXT    *NewFileContext;
   EFI_STATUS      Status;
   EFI_FILE_HANDLE FileHandle;
 
   Status = EFI_SUCCESS;
-  FileOptionMask = (UINT16) (FILE_OPTION_MASK & KeyValue);
+  FileOptionMask = (UINT16) (FILE_OPTION_MASK & KeyValue) - 
+ mQuestionIdUpdate;
   NewMenuEntry   = LibGetMenuEntry (gFileExplorerPrivate.FsOptionMenu, FileOptionMask);
   NewFileContext = (FILE_CONTEXT *) NewMenuEntry->VariableContext;
 
   if (NewFileContext->IsDir) {
     RemoveEntryList (&NewMenuEntry->Link); @@ -1277,11 +1280,11 @@ LibGetDevicePath (  {
   UINT16          FileOptionMask;
   MENU_ENTRY      *NewMenuEntry;
   FILE_CONTEXT    *NewFileContext;
 
-  FileOptionMask    = (UINT16) (FILE_OPTION_MASK & KeyValue);
+  FileOptionMask    = (UINT16) (FILE_OPTION_MASK & KeyValue) - mQuestionIdUpdate;
 
   NewMenuEntry = LibGetMenuEntry (gFileExplorerPrivate.FsOptionMenu, FileOptionMask);
 
   NewFileContext = (FILE_CONTEXT *) NewMenuEntry->VariableContext;
 
@@ -1326,10 +1329,11 @@ ChooseFile (
 
   if ((ChooseHandler == NULL) && (File == NULL)) {
     return EFI_INVALID_PARAMETER;
   }
 
+  mQuestionIdUpdate = 0;
   FileName = NULL;
 
   gFileExplorerPrivate.RetDevicePath = NULL;
   gFileExplorerPrivate.ChooseHandler = ChooseHandler;
   if (FileType != NULL) {
diff --git a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.h b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.h
index 4b5f601..ea0ad3d 100644
--- a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.h
+++ b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.h
@@ -111,11 +111,11 @@ extern UINT8    FileExplorerVfrBin[];
 /// Define the maximum characters that will be accepted.
 ///
 #define MAX_CHAR                480
 #define FILE_OPTION_OFFSET      0x8000
 #define FILE_OPTION_MASK        0x7FFF
-
+#define QUESTION_ID_UPDATE_STEP 200
 
 /**
   This function processes the results of changes in configuration.
   When user select a interactive opcode, this callback will be triggered.
   Based on the Question(QuestionId) that triggers the callback, the corresponding
--
1.9.5.msysgit.1



  reply	other threads:[~2017-01-18  2:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-16  5:57 [patch 1/3] MdeModulePkg/FileExplorer: Remove the codes of searching load file protocol Dandan Bi
2017-01-16  5:57 ` [patch 2/3] MdeModulePkg/FileExplorer: Update QuesrionId when Updating FileExplore form Dandan Bi
2017-01-18  2:50   ` Dong, Eric [this message]
2017-01-16  5:57 ` [patch 3/3] MdeModulePkg/FileExplorer: Enable functionality of creating new file/folder Dandan Bi
2017-01-18  2:50   ` Dong, Eric
2017-01-18  2:50 ` [patch 1/3] MdeModulePkg/FileExplorer: Remove the codes of searching load file protocol Dong, Eric

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ED077930C258884BBCB450DB737E66224A8ECDEC@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox