From 15fd857beeb3838dea083ea6122d360dbaff1424 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 7 Sep 2023 20:39:16 +0300 Subject: NewStory: no need to display event actions if there's no event --- plugins/NewStory/src/history_menus.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'plugins/NewStory/src/history_menus.cpp') diff --git a/plugins/NewStory/src/history_menus.cpp b/plugins/NewStory/src/history_menus.cpp index fe5d4714dc..c03c8587f3 100644 --- a/plugins/NewStory/src/history_menus.cpp +++ b/plugins/NewStory/src/history_menus.cpp @@ -11,6 +11,7 @@ enum static int hMenuObject; static HANDLE hEventPreBuildMenu; static HGENMENU hmiHistory, hmiCopy, hmiSaveAs, hmiDownload, hmiQuote; +static HGENMENU hmiEdit, hmiBookmark, hmiDelete; HMENU NSMenu_Build(NewstoryListData *data, ItemData *item) { @@ -25,6 +26,11 @@ HMENU NSMenu_Build(NewstoryListData *data, ItemData *item) } Menu_ShowItem(hmiQuote, data->pMsgDlg != nullptr); + + bool bShowEventActions = item->hEvent != 0; + Menu_ShowItem(hmiEdit, bShowEventActions); + Menu_ShowItem(hmiDelete, bShowEventActions); + Menu_ShowItem(hmiBookmark, bShowEventActions); NotifyEventHooks(hEventPreBuildMenu, item->hContact, (LPARAM)&item->dbe); @@ -198,15 +204,15 @@ void InitMenus() mi.position = 200000; mi.name.a = LPGEN("Edit"); - Menu_AddNewStoryMenuItem(&mi, MENU_EDIT); + hmiEdit = Menu_AddNewStoryMenuItem(&mi, MENU_EDIT); mi.position = 200001; mi.name.a = LPGEN("Delete"); - Menu_AddNewStoryMenuItem(&mi, MENU_DELETE); + hmiDelete = Menu_AddNewStoryMenuItem(&mi, MENU_DELETE); mi.position = 200002; mi.name.a = LPGEN("Toggle bookmark"); - Menu_AddNewStoryMenuItem(&mi, MENU_BOOKMARK); + hmiBookmark = Menu_AddNewStoryMenuItem(&mi, MENU_BOOKMARK); mi.position = 300000; mi.name.a = LPGEN("Select all"); -- cgit v1.2.3