Bug 139935 - Insert menu in Master Navigator context menu should "deactivate/grey out" Text as an option when Text is the selected item
Summary: Insert menu in Master Navigator context menu should "deactivate/grey out" Tex...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.2.0.0.alpha0+
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard: target:24.2.0
Keywords:
Depends on:
Blocks: Navigator
  Show dependency treegraph
 
Reported: 2021-01-27 00:07 UTC by sdc.blanco
Modified: 2023-11-07 13:46 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sdc.blanco 2021-01-27 00:07:06 UTC
With Navigator for a Master Document (.odm)

2 problems (enhancements) in relation to "Insert Text"

A.  Context menu

1. Select "text" in Navigator (in content view).
2. Right-click and choose "Insert"

Actual:  "Insert" submenu shows "Text" as an active option.

Expected:  "Text" is "greyed out" and not active.

Reason:  Cannot insert text "next to" a "text" in Master document.

In general, "Text" should be greyed out in Insert context menu when it is not possible to insert a "Text Field.


B.  Insert icon (at top panel of Master Navigator deck)

Click "Insert" icon.

Actual:   Only shows "Text" as an option, when it is possible to insert "text"

Expected: Should always show "Text" as option, but should be greyed-out, when not possible to use.

(underlying UI principle:  show all possible/potential actions, but grey-out and deactivate, when not applicable.)
Comment 1 Jim Raykowski 2021-01-27 01:42:34 UTC
code pointers:

sw/uiconfig/swriter/ui/mastercontextmenu.ui

sw/source/uibase/utlui/glbltree.cxx
IMPL_LINK(SwGlobalTree, CommandHdl, const CommandEvent&, rCEvt, bool)

An "insertmenu" weld::Menu needs to be instantiated using xBuilder and then used to set the sensitivity for the insert sub menu items.
Comment 2 Jim Raykowski 2023-09-16 05:04:04 UTC
(In reply to Jim Raykowski from comment #1)
> code pointers:
> 
> sw/uiconfig/swriter/ui/mastercontextmenu.ui
> 
> sw/source/uibase/utlui/glbltree.cxx
> IMPL_LINK(SwGlobalTree, CommandHdl, const CommandEvent&, rCEvt, bool)
> 
> An "insertmenu" weld::Menu needs to be instantiated using xBuilder and then
> used to set the sensitivity for the insert sub menu items.
Wow! I don't remember leaving this pointer.

While poking around for a solution to bug 155741 I ran across this and was going to report. I even made a video demo :).

I *don't* repro this bug using gtk3. I *do* repro for x11 and qt5 vcl plugins. 

Part B.
Gtk3 greys-out disabled entries while sal instance users (x11, qt5, win) hide them. The reason for this was give in:

https://bugs.documentfoundation.org/show_bug.cgi?id=138246#c11

Now it's here:

https://opengrok.libreoffice.org/xref/core/vcl/source/window/menu.cxx?r=b6b26421&mo=94553&fi=2875#2875
Comment 3 Jim Raykowski 2023-09-16 23:19:43 UTC
Proposed patch for part A:
https://gerrit.libreoffice.org/c/core/+/156980

Proposed patch for part B:
https://gerrit.libreoffice.org/c/core/+/156979
Comment 4 Jim Raykowski 2023-09-21 15:59:36 UTC
The commit message for the patch for part A was mistakenly labeled as tdf#139923.

Here is the commit notification message:

Jim Raykowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/91ca15e3f8ae13b22531745a634459a2d9b4596a

tdf#139923 Part A: Master Navigator: Fix Insert popup menu

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2023-09-27 05:13:17 UTC
Jim Raykowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a0955317900075371d6adb7f924af24c22f02d09

tdf#139935 Part B: Show all menu items possible/potential actions,

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Jim Raykowski 2023-09-27 05:43:53 UTC
Thanks to Samuel Mehrbrodt for pointing out the DontHideDisabledEntry option (Menu > Tools > Options > LibreOffice > Advanced > Open Expert Configuration) which is now used by VCL PopupMenu to make disabled menu items hidden or shown greyed out.