Skip to content

Reimplement the windows context menu - #1190

Merged
TheOneRing merged 1 commit into
mainfrom
work/new_context_menu
Oct 26, 2026
Merged

TheOneRing merged 1 commit into
mainfrom
work/new_context_menu

Conversation

@TheOneRing

Copy link
Copy Markdown
Contributor

Fixes: #640

@fracturehill fracturehill left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

partial review, will continue with the rest later

Comment thread shell_integration/CMakeLists.txt Resolved
#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"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread shell_integration/windows/dllmain.cpp Outdated
using OCShell::ExplorerCommand;
CoCreatableClass(ExplorerCommand)

BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary indentation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a hack for dev purposes.

if (!enumerator) {
return E_OUTOFMEMORY;
}
return enumerator.CopyTo(enumCommands);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not Detach() and avoid a copy of the whole list?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how owuld that look?

@fracturehill fracturehill Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think something like this should work:

auto asInterface = enumerator.As<IEnumExplorerCommand>();
*enumCommands = asInterface.Detach();
return S_OK;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@TheOneRing
TheOneRing force-pushed the work/new_context_menu branch from f768812 to f2f5b3f Compare October 22, 2026 13:31
@TheOneRing
TheOneRing merged commit 4ae796d into main Oct 26, 2026
@TheOneRing
TheOneRing deleted the work/new_context_menu branch October 26, 2026 09:12
@openclouders openclouders mentioned this pull request Nov 13, 2026
1 task
@saw-jan saw-jan mentioned this pull request Nov 25, 2026
9 of 22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reimplement Windows file explorer context menue

2 participants