KLocale method for removing accelerator markers

Chusslove Illich caslav.ilic at gmx.net
Sat Nov 15 18:45:09 GMT 2008

At places KDE code does <some_ui_label>.remove('&'), when a UI label needs
to be used without the accelerator marker. E.g. action text when used as
toolbar button label. However, this does not work in presence of escaped
ampersand ("Foo && Bar"), and, in particular, for CJK-style markers (
"&Open With..." -> "アプリケーションで開く(&O)...", where complete "(&O)" should be
removed as marker).

So far we encountered several places in kdelibs where accelerator marker is
being removed, and one in Gwenview and Konsole. It's possible to patch them
on case-by-case basis, but I think it merits a dedicated method of KLocale.
The patch attached. Units tests show desired behavior.

Chusslove Illich (Часлав Илић)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: klocale-removeacceleratormarker-01.diff
Type: text/x-diff
Size: 5506 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20081115/a99bd77e/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20081115/a99bd77e/attachment.sig>

More information about the kde-core-devel mailing list