Repository navigation
Reimplement the windows context menu - #1190
Conversation
fracturehill
left a comment
There was a problem hiding this comment.
partial review, will continue with the rest later
| #define OC_EXPLORER_COMMAND_CLSID_STRING "850FD5BE-2D56-4653-9DD7-C6F5DF8143B3" | ||
|
|
||
| // keep in sync with the target name in shell_integration/windows/CMakeLists.txt | ||
| #define OC_EXPLORER_COMMAND_DLL_NAME "OpenCloudExplorerCommand.dll" |
There was a problem hiding this comment.
Hm, how about getting rid of this header and passing the values from CMake directly? Will keep us from manually keeping this value in sync, and also we avoid needing to include the whole folder in src/gui
There was a problem hiding this comment.
If I manage to make the sparse install work, we won't need that header at all because we can get rid of the dynamic loading.
| using OCShell::ExplorerCommand; | ||
| CoCreatableClass(ExplorerCommand) | ||
|
|
||
| BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID) |
There was a problem hiding this comment.
unnecessary indentation
There was a problem hiding this comment.
Hmm I guess the missing ; in the line before confused clang-format
| return; | ||
| } | ||
|
|
||
| QSettings server(QStringLiteral("HKEY_CURRENT_USER\\" OC_EXPLORER_COMMAND_CLSID_KEY), QSettings::NativeFormat); |
There was a problem hiding this comment.
I don't like that we're adding the keys in the main process but removing them in the dll. Why not put this in DLLRegisterServer()?
There was a problem hiding this comment.
This is just a hack for dev purposes.
| if (!enumerator) { | ||
| return E_OUTOFMEMORY; | ||
| } | ||
| return enumerator.CopyTo(enumCommands); |
There was a problem hiding this comment.
Why not Detach() and avoid a copy of the whole list?
There was a problem hiding this comment.
how owuld that look?
There was a problem hiding this comment.
i think something like this should work:
auto asInterface = enumerator.As<IEnumExplorerCommand>();
*enumCommands = asInterface.Detach();
return S_OK;
There was a problem hiding this comment.
Or maybe even you could even directly assign *enumCommands = asInterface and ignore the detach part? I don't have a Windows setup yet to test myself, but I vaguely remember this working before...
|
|
||
| namespace { | ||
|
|
||
| // EnumSubCommands is called before the selection is known, so we provide a fixed number of sub commands |
There was a problem hiding this comment.
Suggestion outside the scope of this PR: change the socket API in a way that adds a call for all possible context menu items (incl. ordering and separators), and then change what's visible based on the value of the GET_MENU_ITEMS call
f768812 to
f2f5b3f
Compare
Fixes: #640