Re: [Bug 90509] Account types can not be translated in account dialog

Thomas McGuire <[email protected]>
Newsgroups gmane.comp.kde.devel.kmail
Message-ID <[email protected]>
Hi,

On Tuesday 17 July 2007, Ingo Klöcker wrote:
> On Tuesday 17 July 2007 20:58, Thomas McGuire wrote:
> > ------- Additional Comments From Thomas.McGuire gmx net  2007-07-17
> > 20:58 ------- SVN commit 689148 by tmcguire:
> >
> > Update the way the type of the account is stored.
> > Now, we use enums instead of strings.
> > Add the names of the types to KAccount. They can now be translated.
> > Also, provide an update script for easy config migration.
>
> Storing enums as int values is evil because the next guy will add an
> enum value in the middle instead of appending it or some other guy will
> sort the enums alpha-numerical. So far the worst incident caused by
> enums stored as int values was POP filters deleting messages from the
> POP server instead of downloading them (because somebody had re-ordered
> the enum values).
Uhh, that sounds very bad indeed.

> The lesson to learn: Never ever store enum values as int values. Always
> store them as strings.
>
> The good thing is that Qt provides very nice means for this as Simon
> showed us in Glasgow. Simon, where can we find the slides of your talk
> and the sources of your examples?
>
> [snip explanation]
>
OK, I've changed that in revision 689633. Thanks for the explanation on how to 
do it.

> Of course, this does not cover the translation of the display names
> corresponding to the enum values. For this something like
> KAccount::typeName() will still be needed. FWIW, I would put the code
>
> >from typeName() into a static method displayNameForType(
>
> KAccount::Type ) so that it can also be called without an actual
> instance of KAccount, e.g. for filling a combobox (or whatever) with
> the display names of available account types as for example in
> KMAcctSelDlg.
Done, in revision 689472.

Ingo, thanks for watching over my commits!

Regards,
Thomas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.