Don't show "Open With" menu items for empty directories
ClosedPublic

Authored by ngraham on Mon, Apr 8, 10:07 PM.

Details

Summary

Any app that registers itself as able to open directories generally can't do anything
useful with an empty directory. So, don't show the Open With menu items for them.

Test Plan

Before:

After:

The Open With items still appear for non-empty directories.

Diff Detail

Repository
R318 Dolphin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
ngraham created this revision.Mon, Apr 8, 10:07 PM
Restricted Application added a project: Dolphin. · View Herald TranscriptMon, Apr 8, 10:07 PM
Restricted Application added a subscriber: kfm-devel. · View Herald Transcript
ngraham requested review of this revision.Mon, Apr 8, 10:07 PM
trmdi added a subscriber: trmdi.Mon, Apr 8, 10:16 PM

What happens if the user wants to open this directory with another program e.g. Dolphin (root mode), Krusader... ?

What happens if the user wants to open this directory with another program e.g. Dolphin (root mode), Krusader... ?

Then they'll be using one of the file action plugins, e.g. the "Root Actions" plugin. Also, this is not exactly an activity we encourage.

trmdi added a comment.Mon, Apr 8, 10:26 PM

What happens if the user wants to open this directory with another program e.g. Dolphin (root mode), Krusader... ?

Then they'll be using one of the file action plugins, e.g. the "Root Actions" plugin. Also, this is not exactly an activity we encourage.

Make sense. :)

elvisangelaccio accepted this revision.Tue, Apr 9, 8:55 PM
This revision is now accepted and ready to land.Tue, Apr 9, 8:55 PM
This revision was automatically updated to reflect the committed changes.

Any app that registers itself as able to open directories generally can't do anything useful with an empty directory.

If I may offer a counter-example (rather late, I know), one category of applications that an "Open with" on an empty dir is quite useful for are code editors. The way many people start new projects, for example, is by creating a new dir (in Dolphin) and using "Open with" to open it in their editor (like VS Code).

I know this workflow can be re-created with an action (like the one for Konsole), but at least to me, "Open with" seems more intuitive for this.

Any app that registers itself as able to open directories generally can't do anything useful with an empty directory.

If I may offer a counter-example (rather late, I know), one category of applications that an "Open with" on an empty dir is quite useful for are code editors. The way many people start new projects, for example, is by creating a new dir (in Dolphin) and using "Open with" to open it in their editor (like VS Code).

I know this workflow can be re-created with an action (like the one for Konsole), but at least to me, "Open with" seems more intuitive for this.

Most code editors I'm aware of don't install MIME type handlers for directories though, so they don't even show up in the Open With menu by default. You would need to set that up yourself. However I can see how once you do, it could be very useful.