Add a 'Properties' entry in the Places panel context menu
ClosedPublic

Authored by thsurrel on Oct 3 2018, 8:23 PM.

Details

Summary

BUG: 181880

Test Plan

Right-click on a place or on a device in the Places panel now show a Properties entry.
Clicking on it will open its folder property.

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.
thsurrel created this revision.Oct 3 2018, 8:23 PM
Restricted Application added a project: Dolphin. · View Herald TranscriptOct 3 2018, 8:23 PM
Restricted Application added a subscriber: kfm-devel. · View Herald Transcript
thsurrel requested review of this revision.Oct 3 2018, 8:23 PM

In that context menu, the 'Edit' entry (when righ-clicking on a 'Place', not on a 'Device') uses the same icon that is elsewhere used for 'Properties'. Could you suggest what to do here, VDG ?

abetts added a subscriber: abetts.Oct 3 2018, 8:26 PM

Can you please share a screenshot or before/after image that shows your changes?

thsurrel edited the summary of this revision. (Show Details)Oct 3 2018, 8:35 PM

abetts added a comment.Oct 3 2018, 8:38 PM

I would not be opposed to this change. Any other thoughts?

ngraham added a subscriber: ngraham.Oct 3 2018, 8:44 PM

This fixes an ancient bug and plugs an obvious hole (you right-click on a disk and then wonder "Where's the properties menu item?". +1. Will review in detail later today.

ngraham retitled this revision from Add a 'Propreties' entry in the Places panel context menu to Add a 'Properties' entry in the Places panel context menu.Oct 3 2018, 8:44 PM

Note that I don't know if it is a good idea to add this 'Properties' entry to Places in addition to Devices.
Maybe it is useful to Devices alone. Plus it adds this problem of identical icon with Edit, as pointed in my first comment.

I would not be opposed to adding a Properties menu item for other Places panel items, too. But you're right: the Edit... menu item is using the wrong icon. It should be changed (in another patch) to edit-entry.

One more thing before I do the formal review: KIO also has Places Panel code. Could this be done there so we don't have code duplication? Or if code duplication is unfortunately necessary, could we get (in another patch obviously) the same feature added to the KIO Places Panel implementation too?

Now you are talking about something I don't know about yet. I will look into it.

thsurrel updated this revision to Diff 42818.Oct 3 2018, 9:43 PM

Fix: filter out all remote types to have the additionnal 'Properties'

cfeck added a subscriber: cfeck.Oct 3 2018, 10:09 PM

Should 'Properties' be last item in the menu?

cfeck added a comment.Oct 3 2018, 10:33 PM

Actually, I retract previous comment, it should be the last entry in the first section ('Open in ...'), and the separator that is shown above the 'Edit...' entry should also be visible when the 'Edit...' is hidden.

Open in Window
Open in Tab
Properties ...
-------------------
(Edit....)
Hide Entry
Hide Section

Works great! We should figure out if this should be here or in KIO though.

src/panels/places/placesitemmodel.h
52 ↗(On Diff #42818)

Is this necessary?

Actually, I retract previous comment, it should be the last entry in the first section ('Open in ...'), and the separator that is shown above the 'Edit...' entry should also be visible when the 'Edit...' is hidden.

Does this mean that we should also add a separator between Properties and the 'hiding' entries in the Device context menu ?

Unmount
-------------------
Open in Window
Open in Tab
Properties ...
-------------------         <- to be added ?
Hide Entry
Hide Section
thsurrel updated this revision to Diff 42844.Oct 4 2018, 11:53 AM

Keep parent reference as a QObject*

thsurrel marked an inline comment as done.Oct 4 2018, 11:53 AM

I'm okay with doing this here for now as long as we get another patch for KIO as well so that we don't lose any features when we move Dolphin to using KIO's own implementation.

The KIO places panel code is uses everywhere but dolphin, so it can be tested in a file open/save dialog, Gwenview, etc.

cfeck added a comment.Oct 4 2018, 7:46 PM

Yes, I would prefer if the 'Hide' and 'Edit' entries are always preceeded by the separator, separating the items that act on the actual device and the items that act on the places entry.

But it looks like the separator is a completely unrelated change, so I am fine with a separate diff to fix that.

cfeck added a comment.Oct 4 2018, 7:49 PM

Maybe I should actually read the code ... I guess what I want is that you move the 'Properties' above the seperator, not after the 'Edit ...' entry.

I'm pretty sure this can be implemented in KFilePlacesModel without the need to duplicate the feature here in dolphin.

Maybe I should actually read the code ... I guess what I want is that you move the 'Properties' above the seperator, not after the 'Edit ...' entry.

Just to be sure I understand you, you mean like this (for Places):

Properties ...
Open in Window
Open in Tab
-------------------
(Edit....)
Hide Entry
Hide Section

And for Devices:

Unmount
-------------------
Properties ...
Open in Window
Open in Tab
Hide Entry
Hide Section

Or should we also add a separtor between 'Open's and 'Hide's in the Devices case ?
(and yes, probably better in another patch, since this one is not sure to make its way in anyway)

cfeck added a comment.Oct 4 2018, 8:29 PM

No, the see the first 'screenshot' I added.

Sorry, I misplaced the Properties entry indeed.

But then I am coming back to my question (in my first 'screenshot' as well): shouldn't we add a sperator there ?
Sorry, we are going a bit in circle :)

cfeck added a comment.Oct 5 2018, 12:22 AM

There already is a separator (original line 202), but it is (for whatever reason) not always added. You can remove the if for the separator either in this commit, or in a separate patch, because it is unrelated to the addition of the Properties item.

What I am trying to get fixed before you commit this is the placement of the new Properties item. Order should be:

Open in Window
Open in Tab
(Properties)
--------
(Edit...)
(Remove)
Hide
Hide Section

If I understand your patch, currently the order would be:

Open in Window
Open in Tab
--------
(Edit...)
(Properties)
(Remove)
Hide
Hide Section

(Items in parens are not always visible)

I hope this clarifies the confusion I added by my previous comments.

Very clear, there is indeed something to correct in my patch and I will.
But my question was on a different point. The _Devices_ context menu is slightly different than the _Places_ one. I was wondering if we should add a separator between the 'Open in ..." and the 'Hide ...' entries there.

anthonyfieroni added inline comments.
src/panels/places/placesitemmodel.cpp
65 ↗(On Diff #42844)

Not needed

313 ↗(On Diff #42844)

Check for device against nullptr again.

338 ↗(On Diff #42844)

Don't use parent when it is not needed, Qt::WA_DeleteOnClose is fair enough.

342 ↗(On Diff #42844)

Same as above.

src/panels/places/placesitemmodel.h
237 ↗(On Diff #42844)

Not needed.

src/panels/places/placespanel.cpp
178

Remove unrelated changes.

236

Remove white-space line

thsurrel updated this revision to Diff 42912.Oct 5 2018, 8:34 AM

Fixes per anthonyfieroni comments. Thanks for the review
Moved the new 'Properties' entry above 'Edit'
Simplified filtering by comparing scheme to "file"

thsurrel marked 7 inline comments as done.Oct 5 2018, 8:34 AM
thsurrel updated this revision to Diff 42983.Oct 6 2018, 7:49 PM

Use isLocalFile

ngraham accepted this revision.Oct 6 2018, 10:44 PM

Code looks nice and clean now, and it works well. Maybe wait for @elvisangelaccio and/or @anthonyfieroni to give their thumbs-up as well before landing the patch.

I'm pretty sure this can be implemented in KFilePlacesModel without the need to duplicate the feature here in dolphin.

Looks like no, unfortunately. D15973 does not automatically result in Dolphin getting the feature.

This revision is now accepted and ready to land.Oct 6 2018, 10:44 PM
elvisangelaccio requested changes to this revision.Oct 7 2018, 8:59 AM
elvisangelaccio added inline comments.
src/panels/places/placesitemmodel.cpp
302 ↗(On Diff #42983)

The dialog needs a parent, otherwise the window stack will be wrong.

This revision now requires changes to proceed.Oct 7 2018, 8:59 AM
thsurrel added inline comments.Oct 7 2018, 1:18 PM
src/panels/places/placesitemmodel.cpp
302 ↗(On Diff #42983)

On the corresponding line in a previous version, anthonyfieroni had commented: "Don't use parent when it is not needed, Qt::WA_DeleteOnClose is fair enough."
Now I am a bit confused when parent is needed or not ...

elvisangelaccio added inline comments.Oct 7 2018, 1:36 PM
src/panels/places/placesitemmodel.cpp
302 ↗(On Diff #42983)

Yes, it is needed. In general, any dialog window needs a parent to preserve the window stacking. To check it:

  1. Open a properties dialog from the places panel
  2. Start the 'Present Windows' kwin effect
  3. Select the dolphin window

Without parent, the properties dialog will be behind the dolphin window (which is wrong).

If you repeat the steps using a properties dialog from the dolphin view instead, the dialog will be still visible.

thsurrel updated this revision to Diff 43039.Oct 7 2018, 1:59 PM

Pass parent to KPropertiesDialog

thsurrel updated this revision to Diff 43073.Oct 7 2018, 6:53 PM

dfaure's comment from D15973 also applies here: it is better to show the dialog
from the view instead of the model.

elvisangelaccio accepted this revision.Oct 14 2018, 10:17 AM
This revision is now accepted and ready to land.Oct 14 2018, 10:17 AM
This revision was automatically updated to reflect the committed changes.