diff options
author | George Hazan <george.hazan@gmail.com> | 2024-01-13 12:36:01 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-01-13 12:36:05 +0300 |
commit | a76d633fcee305009b2c8798d577e16f8dd0d931 (patch) | |
tree | 160df24813a5dd0ae0e9d92fe102d6d92be81d9c /plugins/NewStory | |
parent | fba3c4711bff68cff5caba08cf8d4f5ea451fea2 (diff) |
fixes #4118 (no "Copy URL" menu item for downloaded files)
Diffstat (limited to 'plugins/NewStory')
-rw-r--r-- | plugins/NewStory/src/history_control.cpp | 12 | ||||
-rw-r--r-- | plugins/NewStory/src/history_control.h | 1 | ||||
-rw-r--r-- | plugins/NewStory/src/history_menus.cpp | 17 |
3 files changed, 22 insertions, 8 deletions
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index e5a7a446f8..165d918de0 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -286,16 +286,20 @@ void NewstoryListData::Copy(bool bTextOnly) Utils_ClipboardCopy(GatherSelected(bTextOnly)); } -void NewstoryListData::CopyUrl() +void NewstoryListData::CopyPath() { - if (auto *pItem = GetItem(caret)) { + if (auto *pItem = GetItem(caret)) if (pItem->completed()) { DB::EventInfo dbei(pItem->hEvent); DB::FILE_BLOB blob(dbei); Utils_ClipboardCopy(blob.getLocalName()); } - else Srmm_DownloadOfflineFile(pItem->hContact, pItem->hEvent, OFD_COPYURL); - } +} + +void NewstoryListData::CopyUrl() +{ + if (auto *pItem = GetItem(caret)) + Srmm_DownloadOfflineFile(pItem->hContact, pItem->hEvent, OFD_COPYURL); } void NewstoryListData::DeleteItems(void) diff --git a/plugins/NewStory/src/history_control.h b/plugins/NewStory/src/history_control.h index c60b57a667..206f9514ac 100644 --- a/plugins/NewStory/src/history_control.h +++ b/plugins/NewStory/src/history_control.h @@ -47,6 +47,7 @@ struct NewstoryListData : public MZeroedObject void Clear(); void ClearSelection(int iFirst, int iLast); void Copy(bool bTextOnly = false); + void CopyPath(); void CopyUrl(); void DeleteItems(void); void Download(int iOptions); diff --git a/plugins/NewStory/src/history_menus.cpp b/plugins/NewStory/src/history_menus.cpp index 28688cf626..16600a7999 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_COPYURL, MENU_OPENFOLDER, MENU_QUOTE, + MENU_COPY, MENU_COPYTEXT, MENU_COPYURL, MENU_COPYPATH, MENU_OPENFOLDER, MENU_QUOTE, MENU_SAVEAS, MENU_DOWNLOAD, MENU_EDIT, MENU_DELETE, MENU_REPLY, MENU_SELECTALL, MENU_BOOKMARK, @@ -28,7 +28,7 @@ enum static int hMenuObject; static HANDLE hEventPreBuildMenu; -static HGENMENU hmiHistory, hmiOpenFolder, hmiCopyUrl, hmiSaveAs, hmiDownload, hmiQuote; +static HGENMENU hmiHistory, hmiOpenFolder, hmiCopyUrl, hmiCopyPath, hmiSaveAs, hmiDownload, hmiQuote; static HGENMENU hmiCopy, hmiCopyText, hmiEdit, hmiBookmark, hmiDelete, hmiReply; HMENU NSMenu_Build(NewstoryListData *data, ItemData *item) @@ -45,15 +45,16 @@ HMENU NSMenu_Build(NewstoryListData *data, ItemData *item) Menu_ShowItem(hmiReply, false); Menu_ShowItem(hmiSaveAs, false); Menu_ShowItem(hmiCopyUrl, false); + Menu_ShowItem(hmiCopyPath, false); Menu_ShowItem(hmiDownload, false); Menu_ShowItem(hmiOpenFolder, false); bool bShowEventActions, bEditable; 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, bNotProtected); + Menu_ShowItem(hmiCopyUrl, true); + Menu_ShowItem(hmiCopyPath, item->m_bOfflineDownloaded); Menu_ShowItem(hmiDownload, !item->m_bOfflineDownloaded && bNotProtected); Menu_ShowItem(hmiOpenFolder, item->m_bOfflineDownloaded); } @@ -116,6 +117,10 @@ static INT_PTR NSMenuHelper(WPARAM wParam, LPARAM lParam) pData->CopyUrl(); break; + case MENU_COPYPATH: + pData->CopyPath(); + break; + case MENU_OPENFOLDER: pData->OpenFolder(); break; @@ -254,6 +259,10 @@ void InitMenus() hmiCopyUrl = Menu_AddNewStoryMenuItem(&mi, MENU_COPYURL); mi.position++; + mi.name.a = LPGEN("Copy file path"); + hmiCopyPath = Menu_AddNewStoryMenuItem(&mi, MENU_COPYPATH); + + mi.position++; mi.name.a = LPGEN("Show in folder"); hmiOpenFolder = Menu_AddNewStoryMenuItem(&mi, MENU_OPENFOLDER); |