From 30516cfd877bf99f56ef43a7fe50ff8154f703b8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 2 Nov 2023 16:25:16 +0300 Subject: =?UTF-8?q?fixes=20#3596=20(ICQ:=20"Copy=20URL"=20=D0=B2=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BD=D1=82=D0=B5=D0=BA=D1=81=D1=82=D0=BD=D0=BE=D0=BC=20?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D1=8E=20=D0=B6=D1=83=D1=80=D0=BD=D0=B0=D0=BB?= =?UTF-8?q?=D0=B0/=D0=B8=D1=81=D1=82=D0=BE=D1=80=D0=B8=D0=B8=20=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=BE=D1=84=D1=84=D0=BB=D0=B0=D0=B9=D0=BD=20=D1=84?= =?UTF-8?q?=D0=B0=D0=B9=D0=BB=D0=B5=20=D0=BE=D1=82=D0=B4=D0=B0=D0=B5=D1=82?= =?UTF-8?q?=20=D0=B1=D0=B5=D1=81=D1=81=D0=BC=D1=8B=D1=81=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=BD=D1=83=D1=8E=20=D1=81=D1=81=D1=8B=D0=BB=D0=BA=D1=83)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/NewStory/src/history_control.cpp | 13 +++++++++++++ plugins/NewStory/src/history_control.h | 1 + plugins/NewStory/src/history_menus.cpp | 28 +++++++++++++++++++--------- 3 files changed, 33 insertions(+), 9 deletions(-) (limited to 'plugins') diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index c95a155fb8..a5cb42ee01 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -300,6 +300,19 @@ void NewstoryListData::Copy(bool bTextOnly) Utils_ClipboardCopy(res); } +void NewstoryListData::CopyUrl() +{ + if (auto *pItem = GetItem(caret)) { + DB::EventInfo dbei(pItem->hEvent); + DB::FILE_BLOB blob(dbei); + + //if (pItem->m_bOfflineDownloaded) +// Utils_ClipboardCopy(blob.getLocalName()); + // else + Srmm_DownloadOfflineFile(pItem->hContact, pItem->hEvent, OFD_COPYURL); + } +} + void NewstoryListData::DeleteItems(void) { if (IDYES != MessageBoxW(m_hwnd, TranslateT("Are you sure to remove selected event(s)?"), _T(MODULETITLE), MB_YESNOCANCEL | MB_ICONQUESTION)) diff --git a/plugins/NewStory/src/history_control.h b/plugins/NewStory/src/history_control.h index 332c8eb7d7..b773c43c6b 100644 --- a/plugins/NewStory/src/history_control.h +++ b/plugins/NewStory/src/history_control.h @@ -63,6 +63,7 @@ struct NewstoryListData : public MZeroedObject void Clear(); void ClearSelection(int iFirst, int iLast); void Copy(bool bTextOnly = false); + void CopyUrl(); void DeleteItems(void); void Download(int iOptions); void EndEditItem(bool bAccept); diff --git a/plugins/NewStory/src/history_menus.cpp b/plugins/NewStory/src/history_menus.cpp index 71bdb16ce8..2a5186e49e 100644 --- a/plugins/NewStory/src/history_menus.cpp +++ b/plugins/NewStory/src/history_menus.cpp @@ -20,7 +20,7 @@ along with this program. If not, see . enum { - MENU_COPY, MENU_COPYTEXT, MENU_QUOTE, + MENU_COPY, MENU_COPYTEXT, MENU_COPYURL, MENU_QUOTE, MENU_SAVEAS, MENU_DOWNLOAD, MENU_EDIT, MENU_DELETE, MENU_SELECTALL, MENU_BOOKMARK, @@ -28,17 +28,19 @@ enum static int hMenuObject; static HANDLE hEventPreBuildMenu; -static HGENMENU hmiHistory, hmiCopy, hmiSaveAs, hmiDownload, hmiQuote; +static HGENMENU hmiHistory, hmiCopy, hmiCopyUrl, hmiSaveAs, hmiDownload, hmiQuote; static HGENMENU hmiEdit, hmiBookmark, hmiDelete; HMENU NSMenu_Build(NewstoryListData *data, ItemData *item) { if (item->m_bOfflineFile) { - Menu_ModifyItem(hmiCopy, (item->m_bOfflineDownloaded) ? TranslateT("Copy file name") : TranslateT("Copy URL")); + Menu_ModifyItem(hmiCopyUrl, (item->m_bOfflineDownloaded) ? TranslateT("Copy file name") : TranslateT("Copy URL")); + Menu_ShowItem(hmiCopyUrl, true); Menu_ShowItem(hmiSaveAs, true); Menu_ShowItem(hmiDownload, !item->m_bOfflineDownloaded); } else { + Menu_ShowItem(hmiCopyUrl, false); Menu_ShowItem(hmiSaveAs, false); Menu_ShowItem(hmiDownload, false); } @@ -84,6 +86,10 @@ static INT_PTR NSMenuHelper(WPARAM wParam, LPARAM lParam) pData->Copy(true); break; + case MENU_COPYURL: + pData->CopyUrl(); + break; + case MENU_QUOTE: pData->Quote(); break; @@ -204,19 +210,23 @@ void InitMenus() mi.name.a = LPGEN("Copy"); hmiCopy = Menu_AddNewStoryMenuItem(&mi, MENU_COPY); - mi.position = 100001; + mi.position++; mi.name.a = LPGEN("Copy text"); hmiCopy = Menu_AddNewStoryMenuItem(&mi, MENU_COPYTEXT); - mi.position = 100002; + mi.position++; + mi.name.a = LPGEN("Copy URL"); + hmiCopyUrl = Menu_AddNewStoryMenuItem(&mi, MENU_COPYURL); + + mi.position++; mi.name.a = LPGEN("Quote"); hmiQuote = Menu_AddNewStoryMenuItem(&mi, MENU_QUOTE); - mi.position = 100003; + mi.position++; mi.name.a = LPGEN("Save as"); hmiSaveAs = Menu_AddNewStoryMenuItem(&mi, MENU_SAVEAS); - mi.position = 100004; + mi.position++; mi.name.a = LPGEN("Download"); hmiDownload = Menu_AddNewStoryMenuItem(&mi, MENU_DOWNLOAD); @@ -224,11 +234,11 @@ void InitMenus() mi.name.a = LPGEN("Edit"); hmiEdit = Menu_AddNewStoryMenuItem(&mi, MENU_EDIT); - mi.position = 200001; + mi.position++; mi.name.a = LPGEN("Delete"); hmiDelete = Menu_AddNewStoryMenuItem(&mi, MENU_DELETE); - mi.position = 200002; + mi.position++; mi.name.a = LPGEN("Toggle bookmark"); hmiBookmark = Menu_AddNewStoryMenuItem(&mi, MENU_BOOKMARK); -- cgit v1.2.3