https://bugs.freedesktop.org/show_bug.cgi?id=66485
Julien Nabet <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #4 from Julien Nabet <[email protected]> --- Michael: I wonder if it could be a problem of OUString/String/NSString convertion. So I thought about replacing String vars by OUString vars since: - comphelper::string::remove returns an OUString when called from an OUString (http://opengrok.libreoffice.org/xref/core/include/comphelper/string.hxx#84) - createNSString uses an OUString (see http://opengrok.libreoffice.org/xref/core/vcl/quartz/utils.cxx#65) Badfully, I didn't find any replacement for Erase so put something a bit ugly and perhaps wrong but it was to give the idea. Of course, I don't pretend at all to fix the bug but at least simplify conversions and perhaps help a bit. Here's the patch: diff --git a/vcl/aqua/source/window/salmenu.cxx b/vcl/aqua/source/window/salmenu.cxx index 350be25..b8d017c 100644 --- a/vcl/aqua/source/window/salmenu.cxx +++ b/vcl/aqua/source/window/salmenu.cxx @@ -676,19 +676,24 @@ void AquaSalMenu::SetItemText( unsigned /*i_nPos*/, SalMenuItem* i_pSalMenuItem, AquaSalMenuItem *pAquaSalMenuItem = (AquaSalMenuItem *) i_pSalMenuItem; // Delete mnemonics - String aText( comphelper::string::remove(i_rText, '~') ); + OUString aText( comphelper::string::remove(i_rText, '~') ); /* #i90015# until there is a correct solution strip out any appended (.*) in menubar entries */ if( mbMenuBar ) { - xub_StrLen nPos = aText.SearchBackward( sal_Unicode( '(' ) ); - if( nPos != STRING_NOTFOUND ) + sal_Int32 nPos = aText.lastIndexOf( sal_Unicode( '(' ) ); + if( nPos > 0) { - xub_StrLen nPos2 = aText.Search( sal_Unicode( ')' ) ); - if( nPos2 != STRING_NOTFOUND ) - aText.Erase( nPos, nPos2-nPos+1 ); + sal_Int32 nPos2 = aText.indexOf( sal_Unicode( ')' ) ); + if( nPos2 > 0) + { + if (nPos2 < aText.length - 1) + aText = aText.copy(0, nPos - 1) + aText.copy(nPos2 + 1, nPos2-nPos+1); + else + aText = aText.copy(0, nPos - 1); + } } } What do you think? -- You are receiving this mail because: You are the assignee for the bug.
_______________________________________________ Libreoffice-bugs mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs
