Custom Widget question

Caolán McNamara caolanm at redhat.com
Tue Feb 26 12:16:08 PST 2013


On Tue, 2013-02-26 at 13:38 -0300, Olivier Hallot wrote:
> Two other advises I need.
> 
> The first is to handle single strings in src files. Does it make sense
> to add hidden labels widget in the UI in order to fetch the strings? e.g.
> 
> String STR_INSIDE
>     {
>         Text [ en-US ] = "I~nner" ;
>     };

Yeah, its either add a hidden Label with the string (which keeps it
bundled together with the rest of the dialog) or move the String to one
of the "global" .src files, e.g. for cui cui/source/dialogs/cuires.src
like f72004dc283dce45649e5807a6345a5d08b79a21

> The second is about the list of page formats. These long lists are well
> defined in src and the Id's are very readable. E.g.
> 
> StringArray RID_SVXSTRARY_PAPERSIZE_STD
> {
>     ItemList [ en-US ] =
>     {
>         < "A6" ; PAPERSIZE_A6 ; > ;
>         < "A5" ; PAPERSIZE_A5 ; > ;
> 
> (...)
> 
> If I add this list to a listbox widget, I will need to transform
> PAPERSIZE_A6 to its numeric value, right?. Perfectly doable but

Yeah, the defines would have to be expanded to their underlying integer
values, which does suck a bit, especially for this example.

You could leave them as .src for now, no harm doing that. One
possibility I suppose in the longer run is to just store the
non-translated English names we want to show in the .ui and in code run
them through PaperInfo::fromPSName and add the translations for paper
names in one central place. Another, though still fragile I guess, is to
add an extra enum type to the glade collection (somehow) that mirrors
our Paper enum.

C.



More information about the LibreOffice mailing list