diff options
author | George Hazan <george.hazan@gmail.com> | 2023-11-02 16:25:16 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-11-02 16:25:22 +0300 |
commit | 30516cfd877bf99f56ef43a7fe50ff8154f703b8 (patch) | |
tree | 084861977edb60bbdaf38ea904fa055d13f8419e /plugins | |
parent | c3fb56beba551ba6f40e2ba8b9b0dc8b862c53e6 (diff) |
fixes #3596 (ICQ: "Copy URL" в контекстном меню журнала/истории на оффлайн файле отдает бессмысленную ссылку)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/NewStory/src/history_control.cpp | 13 | ||||
-rw-r--r-- | plugins/NewStory/src/history_control.h | 1 | ||||
-rw-r--r-- | plugins/NewStory/src/history_menus.cpp | 28 |
3 files changed, 33 insertions, 9 deletions
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 <http://www.gnu.org/licenses/>. 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); |