From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D42F681BC9 for ; Sun, 15 Jan 2017 21:58:31 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 15 Jan 2017 21:58:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,237,1477983600"; d="scan'208";a="1094589040" Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by fmsmga001.fm.intel.com with ESMTP; 15 Jan 2017 21:58:31 -0800 From: Dandan Bi To: edk2-devel@lists.01.org Cc: Eric Dong , Liming Gao , Jiewen Yao Date: Mon, 16 Jan 2017 13:57:25 +0800 Message-Id: <1484546246-54936-2-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1484546246-54936-1-git-send-email-dandan.bi@intel.com> References: <1484546246-54936-1-git-send-email-dandan.bi@intel.com> Subject: [patch 2/3] MdeModulePkg/FileExplorer: Update QuesrionId when Updating FileExplore form X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jan 2017 05:58:32 -0000 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 Cc: Liming Gao Cc: Jiewen Yao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi --- 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