Bug 161574 - Name index-related context menu items based on the type of index that was right-clicked
Summary: Name index-related context menu items based on the type of index that was rig...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: low trivial
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: TableofContents-Indexes UNO-Command-Label
  Show dependency treegraph
 
Reported: 2024-06-14 15:40 UTC by Buovjaga
Modified: 2024-06-24 13:50 UTC (History)
4 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 Buovjaga 2024-06-14 15:40:36 UTC
A user on Twitter pointed out that we always say "Update/Edit/Remove Index" in the right-click context menu for an index. Ideally we should name the exact type instead of just Index there.

If you're wondering about the cultural history of indexes:
https://en.wikipedia.org/wiki/Index_(publishing)

We have seven types of indexes, so implementing this would require creating 21 new translatable strings.

The Navigator also has "Delete Index", but the use there is clearer as the user is looking at a tree named "Indexes".

The commands are

FN_UPDATE_CUR_TOX aka .uno:UpdateCurIndex
FN_EDIT_CURRENT_TOX aka .uno:EditCurIndex
FN_REMOVE_CUR_TOX aka .uno:RemoveTableOf

The .uno commands you will find in many .xml files defining popup menus.

Their visibility in the context menu is controlled in

SwTextShell::GetIdxState() of sw/source/uibase/shells/textidx.cxx
SwView::GetState() of sw/source/uibase/uiview/viewstat.cxx

Probably a pile of conditions would be required to satisfy this request.
Comment 1 Heiko Tietze 2024-06-17 09:58:16 UTC
The seven types are: Table of Contents, Alphabetical Index, Table of Figures, Index of Tables, User-Defined, Table of Objects, Bibliography. Concatenation might work like "Edit %1" translated to "%1 ändern" with possible issues regarding upper case. And the "User-Defined" ToC is awkward.
Comment 2 Heiko Tietze 2024-06-21 06:03:30 UTC
Kira, are you interested in this issue?
Comment 3 Buovjaga 2024-06-21 06:10:19 UTC
(In reply to Heiko Tietze from comment #1)
> The seven types are: Table of Contents, Alphabetical Index, Table of
> Figures, Index of Tables, User-Defined, Table of Objects, Bibliography.
> Concatenation might work like "Edit %1" translated to "%1 ändern" with
> possible issues regarding upper case. And the "User-Defined" ToC is awkward.

Due to differences in languages, easy shortcuts like %1 might indeed not work.
Comment 4 Kira Tubo 2024-06-22 06:03:48 UTC
(In reply to Heiko Tietze from comment #2)
> Kira, are you interested in this issue?

I'll take some time to review this, thanks.
Comment 5 Kira Tubo 2024-06-24 08:19:24 UTC
If the ask is to create strings that would ONLY affect the labels displayed in the context menu items (I assume this means multiple labels can apply to one .uno command), then I'm not certain how to approach this. 

However, I can kind of see how to fix the issue by creating new .uno commands for each of the new strings, then utilizing the disableItem() method (found in sw/source/uibase/shells/textidx.cxx and sw/source/uibase/uiview/viewstat.cxx) to remove the item from the context menu if the TOXTypes do not match. Something along the lines of: 

if (TOXType != TOX_TABLES)
{
   //3 new UNO commands for update/edit/remove index of tables
   disableItem(FN_UPDATE_CUR_TOX_TABLES)
   disableItem(FN_EDIT_CURRENT_TOX_TABLES)
   disableItem(FN_REMOVE_CUR_TOX_TABLES)
}

...etc... but not sure if this is what you're looking for :)
Comment 6 Buovjaga 2024-06-24 08:43:42 UTC
I'm not sure, if this is even worth doing, but just wanted to bring this into discussion as it was mentioned in a public channel.
Comment 7 Heiko Tietze 2024-06-24 13:50:22 UTC
Not worth the effort for l10n (adding different labels or even UNO commands) but if we can easily change the label when the context menu pops-up it might be worth a few minutes work.

Hossein, please take a look if this can be made an easyhack. IIRC we have menu dynamic labels somewhere. If not we better abstain from effort.