From 781846ba3acc53f5e6f47e736c7d18544895b39c Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Tue, 1 Dec 2015 12:10:34 +0000 Subject: [PATCH] Fixed right click menu which showed active menu items when it shouldn't in Search Only mode. --- source/search/frmSearch-contact.cpp | 2 +- source/widgets/XABContactMenu.cpp | 26 ++++++++++++++++++++------ source/widgets/XABContactMenu.h | 6 ++++-- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/source/search/frmSearch-contact.cpp b/source/search/frmSearch-contact.cpp index f5c18b8..2f168bb 100644 --- a/source/search/frmSearch-contact.cpp +++ b/source/search/frmSearch-contact.cpp @@ -137,7 +137,7 @@ void frmSearch::RevealContact( wxCommandEvent& event ){ void frmSearch::ShowContactMenu( wxMouseEvent& event ){ - ContactMenu->SetupPointers(this, lstResults); + ContactMenu->SetupPointersSearch(this, lstResults, SearchMode); PopupMenu(ContactMenu->MenuPointer(), wxDefaultPosition); diff --git a/source/widgets/XABContactMenu.cpp b/source/widgets/XABContactMenu.cpp index fc3f59a..b468833 100644 --- a/source/widgets/XABContactMenu.cpp +++ b/source/widgets/XABContactMenu.cpp @@ -109,11 +109,13 @@ void XABContactMenu::AppendMenuItem(wxString ObjectName, } -void XABContactMenu::SetupPointers(wxWindow* WindowPtrIn, - wxListCtrl* ContactListCtrlIn){ +void XABContactMenu::SetupPointersSearch(wxWindow* WindowPtrIn, + wxListCtrl* ContactListCtrlIn, + bool SearchModeOnlyIn){ WindowPtr = WindowPtrIn; ContactListCtrl = ContactListCtrlIn; + SearchModeOnly = SearchModeOnlyIn; } @@ -177,10 +179,22 @@ wxMenu* XABContactMenu::MenuPointer(){ std::map::iterator MenuItemIter = MenuItems.find("opencontact"); MenuItemIter->second->Enable(ContactSelected); - MenuItemIter = MenuItems.find("editcontact"); - MenuItemIter->second->Enable(ContactSelected); - MenuItemIter = MenuItems.find("revealcontact"); - MenuItemIter->second->Enable(ContactSelected); + + if (SearchModeOnly == TRUE){ + + MenuItemIter = MenuItems.find("editcontact"); + MenuItemIter->second->Enable(FALSE); + MenuItemIter = MenuItems.find("revealcontact"); + MenuItemIter->second->Enable(FALSE); + + } else { + + MenuItemIter = MenuItems.find("editcontact"); + MenuItemIter->second->Enable(ContactSelected); + MenuItemIter = MenuItems.find("revealcontact"); + MenuItemIter->second->Enable(ContactSelected); + + } } diff --git a/source/widgets/XABContactMenu.h b/source/widgets/XABContactMenu.h index c90c8d3..13e0cff 100644 --- a/source/widgets/XABContactMenu.h +++ b/source/widgets/XABContactMenu.h @@ -51,6 +51,7 @@ class XABContactMenu : public XABContactMenuADT wxListCtrl *ContactListCtrl = NULL; wxWindow *WindowPtr = NULL; bool EnableAccountSettings = FALSE; + bool SearchModeOnly = FALSE; void AppendMenuItem(wxString ObjectName, wxString MenuName, wxString MenuDescription, @@ -61,8 +62,9 @@ class XABContactMenu : public XABContactMenuADT public: XABContactMenu(int MenuType); ~XABContactMenu(); - void SetupPointers(wxWindow* WindowPtrIn, - wxListCtrl* ContactListCtrlIn); + void SetupPointersSearch(wxWindow* WindowPtrIn, + wxListCtrl* ContactListCtrlIn, + bool SearchModeOnlyIn); void SetupPointers(wxWindow* WindowPtrIn, wxListCtrl* ContactListCtrlIn, bool EnableAccountSettingsIn); -- 2.39.5