Bug 112369 - Improve the workflow of adding items to menus
Summary: Improve the workflow of adding items to menus
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
6.0.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Baltasar
URL:
Whiteboard: target:7.2.0
Keywords: difficultyMedium, easyHack, skillCpp, topicUI
Depends on:
Blocks: Customise-Dialog
  Show dependency treegraph
 
Reported: 2017-09-13 10:37 UTC by Muhammet Kara
Modified: 2021-05-24 09:18 UTC (History)
5 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 Muhammet Kara 2017-09-13 10:37:37 UTC
This is a spin off from https://bugs.documentfoundation.org/show_bug.cgi?id=112133

 Muhammet Kara 2017-09-13 10:09:37 UTC
(In reply to Heiko Tietze from comment #12)
> When adding a command to a menu or context menu that already contains this
> items a confirmation box is shown telling the user that this operation is
> not possible. Not the best approach, and you better disable the add button.

This requires some more dev effort than the polishing task itself requires. Let's separate it.

Instead of checking for duplicates after pressing the add button, we may check for duplicates in SvxMenuConfigPage::UpdateButtonStates(), and make sure it is called from both SelectMenu and SelectFunctionHdl.

Note that SelectMenu is in SvxMenuConfigConfigPage, while SelectFunctionHdl is in SvxConfigPage. So it might be a good idea to move one of them to the parent or to the child class.
Comment 1 Muhammet Kara 2021-03-13 16:49:56 UTC
Relevant code is in cui/source/customize/SvxMenuConfigPage.cxx and cui/source/customize/cfg.cxx

The part checking for the duplicate menu item and showing a message is in the if block under this comment: "// check that this function is not already in the menu"
Comment 2 Baltasar 2021-04-23 08:15:45 UTC
I'd like to assign this bug to me. Is this okay?
Comment 3 Baltasar 2021-05-04 08:37:01 UTC
I've created a fix to this bug:
https://gerrit.libreoffice.org/c/core/+/115057
Comment 4 Commit Notification 2021-05-18 07:04:07 UTC
baltasarq committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/43b985b35be324b3398d48585d943f6fb64ae066

tdf#112369 allow to disable the add command button in menu customize

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 5 BogdanB 2021-05-24 05:50:46 UTC
An option could NOT be added now twice.

Verified in Version: 7.2.0.0.alpha1+ / LibreOffice Community
Build ID: b238522ca121ca8f863fe4d3394ade088a65ad01
CPU threads: 4; OS: Linux 5.8; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded

Could this be done to Customize - Toolbar?
Now it is working for: Menus and Context menus, but not for Toolbar.
Comment 6 Baltasar 2021-05-24 08:29:30 UTC
I suppose so. I will have to take a deep look, however, since that situation was not included in the original code (i.e., if you added a toolbar button twice, no message box appeared).
Comment 7 Muhammet Kara 2021-05-24 09:18:49 UTC
(In reply to BogdanB from comment #5)
> An option could NOT be added now twice.
> 
> Verified in Version: 7.2.0.0.alpha1+ / LibreOffice Community
> Build ID: b238522ca121ca8f863fe4d3394ade088a65ad01
> CPU threads: 4; OS: Linux 5.8; UI render: default; VCL: gtk3
> Locale: ro-RO (ro_RO.UTF-8); UI: en-US
> Calc: threaded
> 
> Could this be done to Customize - Toolbar?
> Now it is working for: Menus and Context menus, but not for Toolbar.

Yes, it could be, but it is out of the scope of this easyhack. IIRC, it was discussed in the past, and we decided not to limit users' ability to add commands more than once to a toolbar.