diff options
author | George Hazan <george.hazan@gmail.com> | 2023-11-14 12:57:15 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-11-14 12:57:15 +0300 |
commit | 02dc4b49ff1d2384ddca4c50e87148235bb9efc7 (patch) | |
tree | 02eb89c87bc8a4271dce5f3c527de36a07e9eb19 /plugins | |
parent | 9d45fb3bd79a2d81d8d95b2ee50c1d1a74e14b54 (diff) |
fixes #3920 (NewStory: отсутствует возможность попасть в меню комнаты, если в чате нет истории)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/NewStory/src/history_control.cpp | 8 | ||||
-rw-r--r-- | plugins/NewStory/src/history_menus.cpp | 34 |
2 files changed, 23 insertions, 19 deletions
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index 7fdd524050..74d1e76197 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -66,11 +66,7 @@ NewstoryListData::NewstoryListData(HWND _1) : void NewstoryListData::OnContextMenu(int index, POINT pt) { - ItemData *item = LoadItem(index); - if (item == nullptr) - return; - - HMENU hMenu = NSMenu_Build(this, item); + HMENU hMenu = NSMenu_Build(this, LoadItem(index)); if (pMsgDlg != nullptr && pMsgDlg->isChat()) Chat_CreateMenu(hMenu, pMsgDlg->getChat(), nullptr); @@ -1008,8 +1004,8 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM data->SetCaret(idx); if (!data->HasSelection()) data->SetSelection(idx, idx); - data->OnContextMenu(idx, pt); } + data->OnContextMenu(idx, pt); break; case WM_KILLFOCUS: diff --git a/plugins/NewStory/src/history_menus.cpp b/plugins/NewStory/src/history_menus.cpp index b82194ce3b..48d747b0f1 100644 --- a/plugins/NewStory/src/history_menus.cpp +++ b/plugins/NewStory/src/history_menus.cpp @@ -33,27 +33,35 @@ static HGENMENU hmiEdit, hmiBookmark, hmiDelete; HMENU NSMenu_Build(NewstoryListData *data, ItemData *item) { - if (item->m_bOfflineFile) { - Menu_ModifyItem(hmiCopyUrl, (item->m_bOfflineDownloaded) ? TranslateT("Copy file path") : TranslateT("Copy URL")); - Menu_ShowItem(hmiCopyUrl, true); - Menu_ShowItem(hmiSaveAs, true); - Menu_ShowItem(hmiDownload, !item->m_bOfflineDownloaded); + Menu_ShowItem(hmiQuote, data->pMsgDlg != nullptr); + Menu_ShowItem(hmiSaveAs, false); + Menu_ShowItem(hmiCopyUrl, false); + Menu_ShowItem(hmiDownload, false); + + bool bShowEventActions; + if (item != nullptr) { + if (item->m_bOfflineFile) { + Menu_ModifyItem(hmiCopyUrl, (item->m_bOfflineDownloaded) ? TranslateT("Copy file path") : TranslateT("Copy URL")); + Menu_ShowItem(hmiCopyUrl, true); + Menu_ShowItem(hmiSaveAs, true); + Menu_ShowItem(hmiDownload, !item->m_bOfflineDownloaded); + } + + bShowEventActions = item->hEvent != 0; + + NotifyEventHooks(hEventPreBuildMenu, item->hContact, (LPARAM)&item->dbe); } else { - Menu_ShowItem(hmiCopyUrl, false); - Menu_ShowItem(hmiSaveAs, false); - Menu_ShowItem(hmiDownload, false); - } + bShowEventActions = false; - Menu_ShowItem(hmiQuote, data->pMsgDlg != nullptr); + DB::EventInfo dbei; + NotifyEventHooks(hEventPreBuildMenu, 0, (LPARAM)&dbei); + } - bool bShowEventActions = item->hEvent != 0; Menu_ShowItem(hmiEdit, bShowEventActions); Menu_ShowItem(hmiDelete, bShowEventActions); Menu_ShowItem(hmiBookmark, bShowEventActions); - NotifyEventHooks(hEventPreBuildMenu, item->hContact, (LPARAM)&item->dbe); - HMENU hMenu = CreatePopupMenu(); Menu_Build(hMenu, hMenuObject); return hMenu; |