Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Store apps for Edit-capabilities #12802

Closed
Tracked in #12805
AliveDevil opened this issue Jan 20, 2022 · 8 comments · Fixed by #13030
Closed
Tracked in #12805

Support Store apps for Edit-capabilities #12802

AliveDevil opened this issue Jan 20, 2022 · 8 comments · Fixed by #13030
Assignees
Milestone

Comments

@AliveDevil
Copy link
Contributor

@AliveDevil AliveDevil commented Jan 20, 2022

SHAssocEnumHandlers1 can be used to directly invoke a handler, and doesn't rely on registry hacks to find OpenWithList and shell/open/command to be defined.

Footnotes

  1. https://stackoverflow.com/questions/48400038/use-shassocenumhandlers-in-c-sharp

@AliveDevil AliveDevil added the interface label Jan 20, 2022
@AliveDevil AliveDevil added this to the 9.0 milestone Jan 20, 2022
@AliveDevil AliveDevil self-assigned this Jan 20, 2022
@dkocher
Copy link
Contributor

@dkocher dkocher commented Jan 20, 2022

Might also help to resolve #11770.

@AliveDevil
Copy link
Contributor Author

@AliveDevil AliveDevil commented Jan 20, 2022

Might also help to resolve #11770.

This would make all implementations for finding applications currently in place in Cyberduck Windows obsolete, as I'd like to just create one implementation which is capable of opening a file with any application, through Windows Shell.

@AliveDevil
Copy link
Contributor Author

@AliveDevil AliveDevil commented Mar 29, 2022

Discussion here:
This will result in preferences having to remove the Default-editor setting, as everything will be handled by underlying User preference in Windows.

New behavior for editing files:

  • If none is returned in SHAssocEnumHandlers use SHOpenWithDialog1.
  • If any is returned, use isRecommended property to determine first and Edit toolbar option default application
    • Any other is appended by IEnumAssocHandler2 order
    • Append last item "Open With …" which uses SHOpenWithDialog.

Unsure how to fit this into EditorFactory and ApplicationFinder though.
Need to extend Application class to allow for passing IAssocHandler down the line and invoked with a file path.
Cannot use ApplicationLauncher or ApplicationFinder as provided by AbstractEditor as that relies on Process.Start, which is unavailable here.

Footnotes

  1. https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shopenwithdialog

  2. https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-ienumassochandlers

@AliveDevil
Copy link
Contributor Author

@AliveDevil AliveDevil commented Mar 29, 2022

CLI behavior changes to following:
--edit downloads file and opens default/recommended handler. If non available use SHOpenWithDialog
Adding --edit=with or --edit-with always uses SHOpenWithDialog. Opinions here?

@AliveDevil
Copy link
Contributor Author

@AliveDevil AliveDevil commented Mar 29, 2022

Currently blocked by microsoft/win32metadata#918.

@AliveDevil
Copy link
Contributor Author

@AliveDevil AliveDevil commented Mar 30, 2022

Behavior will need to address for situations where there is no editor defined for a file type, i.e.:
For .mp4 there is no editor defined on my system, but an application which is set as default viewer.
Do we want to allow fast editing (Ctrl+K) for files with no registered application capable of editing a file type?

SHAssocEnumHandlers will return any application with registered open verb of file type, not necessarily only handlers which are edit capable. There is no way of determining whether IAssocHandler can edit a particular file.

@AliveDevil
Copy link
Contributor Author

@AliveDevil AliveDevil commented Mar 30, 2022

ProgIdApplication app = new(defaultQuery.ToString(), friendlyAppName, defaultIcon);

We can ShellExecuteEx any arbitrary ProgId with specified verbs. This will need PInvoke, as ProcessStartInfo/Process.Start cannot use lpClass-field for starting a ProgId.
Need to differentiate in ApplicationLauncher between ProgIdApplication and ShellApplication, which use different ways of invoking (IAssocHandler.Invoke/ShellExecuteEx).

@AliveDevil
Copy link
Contributor Author

@AliveDevil AliveDevil commented Mar 31, 2022

It's something.

2022-03-31.12-47-06.mp4

@AliveDevil AliveDevil linked a pull request May 4, 2022 that will close this issue
dkocher added a commit that referenced this issue May 4, 2022
@dkocher dkocher modified the milestones: 9.0, 8.4.0 May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants