Bug 138246 - Disable 'Edit' and 'Rename' context menu items for built-in templates
Summary: Disable 'Edit' and 'Rename' context menu items for built-in templates
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard: target:7.2.0 reviewed:2022
Keywords: difficultyMedium, easyHack, skillCpp, topicUI
: 103620 134140 (view as bug list)
Depends on:
Blocks: Template-Manager
  Show dependency treegraph
 
Reported: 2020-11-15 23:30 UTC by sdc.blanco
Modified: 2022-09-13 13:46 UTC (History)
9 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 2020-11-15 23:30:22 UTC
Built-in templates cannot be edited or renamed.

Enhancement:  Context menu items should not be active for built-in templates.
Comment 1 Heiko Tietze 2020-12-07 11:53:14 UTC
Agree. Shouldn't be too difficult... sfx2/source/doc/templatedlg.cxx
Comment 3 Commit Notification 2020-12-23 10:40:01 UTC
Vert D committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/86f3fa919a6de6767177193d5b7714f8f6dbd5c4

tdf#138246 Disable edit rename delete contextmenu items for built-in templates

It will be available in 7.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 4 sdc.blanco 2021-01-17 23:36:15 UTC
(In reply to Commit Notification from comment #3)
> Vert D committed a patch related to this issue.
> Affected users are encouraged to test the fix and report feedback.
LGTM.

"system" templates only have "Open" and "Set as Default" in context menu  (which exhaust the permissible actions), while user-defined actions have the full set of possible actions in the context.

Appears properly both in Thumbnail and List View, and all commands work as expected.
Comment 5 Buovjaga 2021-01-18 07:03:14 UTC
*** Bug 134140 has been marked as a duplicate of this bug. ***
Comment 6 Buovjaga 2021-01-18 07:11:06 UTC
*** Bug 103620 has been marked as a duplicate of this bug. ***
Comment 7 sdc.blanco 2021-01-18 09:14:54 UTC
(In reply to Commit Notification from comment #3)
> Affected users are encouraged to test the fix and report feedback.
@Heiko -- iirc -- your preference is that context menus should show all possible actions, but grey-out those actions which cannot be applied.

The present patch simply eliminates showing the controls for predefined templates.
Perhaps you would prefer that they are visible, but deactivated?
Comment 8 Buovjaga 2021-01-18 09:33:19 UTC
(In reply to sdc.blanco from comment #7)
> (In reply to Commit Notification from comment #3)
> > Affected users are encouraged to test the fix and report feedback.
> @Heiko -- iirc -- your preference is that context menus should show all
> possible actions, but grey-out those actions which cannot be applied.
> 
> The present patch simply eliminates showing the controls for predefined
> templates.
> Perhaps you would prefer that they are visible, but deactivated?

Absolutely. Disabling means that they are greyed out. If they were removed, then the change is not correct.
Comment 9 Heiko Tietze 2021-01-18 10:18:14 UTC
Thought set_sensitive() does exactly this, disabling the entry.
Comment 10 Jim Raykowski 2021-01-23 06:53:20 UTC
I think for gtk3 set_sensitive disabled greys out the item, for win, x11, qt5 it is removed.
Comment 11 Jim Raykowski 2021-01-23 07:28:15 UTC
Here is where this is made so:
https://opengrok.libreoffice.org/xref/core/vcl/source/window/menu.cxx?r=cf730619#2903
Comment 12 Hossein 2021-02-25 20:08:30 UTC
Confirming the different behavior in gtk3 and qt5 VCL plugins on Ubuntu 20.04.
Start LibreOffice with qt5 VCL plugin:

    SAL_USE_VCLPLUGIN=qt5 ./instdir/program/soffice.bin

then go to Templates > Manage Templates. In gtk3, 'Edit', 'Rename' and 'Delete' buttons are grayed out, but in qt5, these buttons are removed.
Comment 13 Hossein 2022-09-13 13:46:39 UTC
Re-evaluating the EasyHack in 2022

This enhancement is still relevant. The behavior in Qt5 is still different.