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.
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"
I'd like to assign this bug to me. Is this okay?
I've created a fix to this bug: https://gerrit.libreoffice.org/c/core/+/115057
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.
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.
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).
(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.