Add options for hiding some useless entries from Media Menu
ClosedPublic

Authored by S-trace on Mar 26 2020, 10:18 AM.

Details

Summary

Add "Ignore SquashFS" option to the "Panel/Media Menu/" settings page:
Snap creates many SquashFS-mounted partitions, which are almost
useless in the Media Menu, because snap manages them.
So, let's allow the user to hide SquashFS mounts from the Media Menu

Add the list of mount points hidden in Media Menu to the "Panel/Media Menu/" page:
I'm using Media Menu for quick mount/umount of removable media or
normally umounted fixed media, and don't want to see in the Media Menu any
obliviously non-umountable partitions like / and /home - so, let's allow
user to hide some media by the mount point.

Test Plan
  1. Mount a SquashFS image
  2. Make sure SquashFS image mount is shown in the Media Menu
  3. Check "Hide SquashFS entries" checkbox on the "Panel/Media Menu/" page
  4. Make sure SquashFS image mount is no longer shown in the Media Menu
  5. Uncheck "Hide SquashFS entries" checkbox on the "Panel/Media Menu/" page
  6. Make sure SquashFS image mount is shown again in the Media Menu
  1. Make sure the root mount point is shown in Media Menu
  2. Add / to "Hide following mountpoints:" list on the "Panel/Media Menu/" page
  3. Make sure the root mount point is not shown in the Media Menu anymore
  4. Remove / from "Hide following mountpoints:" list on the "Panel/Media Menu/" page
  5. Make sure the root mount point is shown again in the Media Menu

Diff Detail

Repository
R167 Krusader
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
S-trace requested review of this revision.Mar 26 2020, 10:18 AM
S-trace created this revision.
S-trace updated this revision to Diff 78531.Mar 26 2020, 10:32 AM
S-trace retitled this revision from Add "Ignore SquashFS" option to the "Panel/Media Menu/" settings page to Add options for hiding some useless entries from Media Menu.
S-trace edited the summary of this revision. (Show Details)
S-trace edited the test plan for this revision. (Show Details)

Add the list of mount points to hide in Media Menu to the "Panel/Media Menu/" page

I'm using Media Menu for quick mount/umount of removable media or normally umounted fixed media, and don't want to see in the Media Menu any obliviously non-umountable partitions like / and /home - so, let's allow the user to hide some media by the mount point.

My list to hide:
/
/boot/efi
/boot
/home

S-trace updated this revision to Diff 78533.Mar 26 2020, 10:35 AM

Merge 2 features into a single diff

yurchor added inline comments.
krusader/GUI/mediabutton.cpp
173

Can it be some kind of

qDebug() << "isMountPointHidden is called for " << mountPoint;

?
Thanks in advance for your answer.

S-trace added inline comments.Mar 26 2020, 11:05 AM
krusader/GUI/mediabutton.cpp
173

Oh, of course.
Forgot to remove this line.
How do you think, do we need this line in any form?

yurchor added inline comments.Mar 26 2020, 11:09 AM
krusader/GUI/mediabutton.cpp
173

I'm not sure. I'm just a documentation maintainer of the project. Let's see what our developers think... ;)

S-trace edited the test plan for this revision. (Show Details)Mar 26 2020, 5:02 PM
asensi added inline comments.Mar 29 2020, 10:12 AM
krusader/GUI/mediabutton.cpp
173

I also think that this line can be removed, developers can always add it when they need it.

While we are at it, we can remove the isMountPointHidden() function, and substitute

if (isMountPointHidden(&cfg, path)) {
    return false;
}

with

if (cfg.readEntry("Hidden Mountpoints", QStringList()).contains(path)) {
    return false;
}
asensi added a comment.EditedMar 29 2020, 10:18 AM

There is more information in Bug 294162 - Wish: Hide/Show special devices/mounts from devices-dropdown list. There, a possible example (https://phabricator.kde.org/D27019) of how to fix the issue was suggested.

@S-trace, I wondered if there was any particular doubt or any suggestion :-?

asensi added a comment.May 6 2020, 8:36 PM

Meanwhile, I performed tests under Kubuntu 18.04 and 20.04 and the resulting code worked. I've been using it since March 29, having its advantages without seeing any problem. As previously written, it avoids cases like the one in https://i.stack.imgur.com/QTx1O.jpg (from https://askubuntu.com/questions/1109715/hide-loop-partitions-snaps-in-krusader).

Are there any objections for me to commit the resulting code, which takes into account Yuri's recommendations and improves the current situation in a lot of cases?

gengisdave accepted this revision.May 6 2020, 9:34 PM
gengisdave added a subscriber: gengisdave.

Used in last month, no problems found.

This revision is now accepted and ready to land.May 6 2020, 9:34 PM

If someone is thinking about another option, please feel free to talk about it.
Thanks, S-trace! (and Davide and Yuri :-) )

This revision was automatically updated to reflect the committed changes.