diff options
Diffstat (limited to 'c')
-rw-r--r-- | c/episodelistview.cpp | 4 | ||||
-rw-r--r-- | c/ext.cpp | 23 | ||||
-rw-r--r-- | c/ext.h | 1 | ||||
-rw-r--r-- | c/main.cpp | 1 | ||||
-rw-r--r-- | c/res.h | 27 | ||||
-rw-r--r-- | c/res.rc | 1 |
6 files changed, 44 insertions, 13 deletions
diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp index 320f98f..e6ff288 100644 --- a/c/episodelistview.cpp +++ b/c/episodelistview.cpp @@ -74,6 +74,10 @@ void EpisodeListView::HandleContextMenu(const WORD command) OpenOnline(parent.cfg, lvi.lParam); break; + case IDM_SHOW_IN_EXPLORER: + ShowInExplorer(parent.cfg, parent.fvElv.At(lvi.lParam-1)); + break; + case IDM_TOGGLE: e.bWatched = !e.bWatched; break; @@ -1,4 +1,5 @@ #include <ctype.h> +#include <shlobj.h> #include <string> #include <string_view> @@ -119,3 +120,25 @@ bool OpenLocally(CfgA& cfg, const ElvDataA& e) } else return false; } + +bool ShowInExplorer(CfgA& cfg, const ElvDataA& e) +{ + wchar_t file[MAX_PATH]; + if (FindMatchingFile(file, cfg.root, e.siEp)) { + /* ILCreateFromPath does not support forward slashes. */ + for (wchar_t *f = file; *f; f++) + if (*f == L'/') + *f = L'\\'; + + if (ITEMIDLIST* idl = ILCreateFromPath(file)) { + HRESULT r = SHOpenFolderAndSelectItems(idl, 0, 0, 0); + ILFree(idl); + if (FAILED(r)) { + SetLastError(r); + throw Err(WINDOWS, L"File "s + file + L" could not be shown in Explorer"); + } + } + return true; + } else + return false; +} @@ -6,5 +6,6 @@ bool OpenOnline(const CfgA& cfg, int iEp); bool OpenWiki(const DlvDataA& d); bool OpenLocally(CfgA& cfg, const ElvDataA& e); +bool ShowInExplorer(CfgA& cfg, const ElvDataA& e); #endif @@ -351,6 +351,7 @@ LRESULT CALLBACK Window::WndProc(const HWND hWnd, const UINT uMsg, const WPARAM const wchar_t* vTipCtx[] = { /*IDM_WATCH_LOCALLY*/L"Open local copy of episode, if available.", /*IDM_WATCH_ONLINE*/L"Open episode in the web browser.", + /*IDM_SHOW_IN_EXPLORER*/L"Show episode in Explorer.", /*IDM_TOGGLE*/L"Toggle watched/unwatched status.", /*IDM_WIKI*/L"Show Detective Conan Wiki entry for episode.", /*IDM_RATE0*/L"Remove episode rating.", @@ -47,19 +47,20 @@ /* Context menu items. */ #define IDM_WATCH_LOCALLY 0x0400 #define IDM_WATCH_ONLINE 0x0401 -#define IDM_TOGGLE 0x0402 -#define IDM_WIKI 0x0403 -#define IDM_RATE0 0x1404 -#define IDM_RATE1 0x1405 -#define IDM_RATE2 0x1406 -#define IDM_RATE3 0x1407 -#define IDM_RATE4 0x1408 -#define IDM_RATE5 0x1409 -#define IDM_RATE6 0x140a -#define IDM_RATE7 0x140b -#define IDM_RATE8 0x140c -#define IDM_RATE9 0x140d -#define IDM_RATE10 0x140e +#define IDM_SHOW_IN_EXPLORER 0x0402 +#define IDM_TOGGLE 0x0403 +#define IDM_WIKI 0x0404 +#define IDM_RATE0 0x1405 +#define IDM_RATE1 0x1406 +#define IDM_RATE2 0x1407 +#define IDM_RATE3 0x1408 +#define IDM_RATE4 0x1409 +#define IDM_RATE5 0x140a +#define IDM_RATE6 0x140b +#define IDM_RATE7 0x140c +#define IDM_RATE8 0x140d +#define IDM_RATE9 0x140e +#define IDM_RATE10 0x140f #define ID_RATING(i) ((i) - IDM_RATE0) @@ -35,6 +35,7 @@ BEGIN BEGIN MENUITEM "&Watch Locally", IDM_WATCH_LOCALLY MENUITEM "Watch &Online", IDM_WATCH_ONLINE + MENUITEM "&Show In Explorer", IDM_SHOW_IN_EXPLORER MENUITEM "&Toggle", IDM_TOGGLE MENUITEM "Wi&ki", IDM_WIKI POPUP "&Rate" |