[Libreoffice] [PATCH] Fix replacement of $filename$ in GTK SaveAs dialogs

Caolán McNamara caolanm at redhat.com
Thu Feb 24 08:30:24 PST 2011


On Thu, 2011-02-24 at 09:57 -0500, Kevin Hunter wrote:
> please do spit it back to me with, "you should implement 
> it this way instead"

OString baseName =
OString(OUStringToOString( aFileObj.getName(INetURLObject::LAST_SEGMENT,
true, INetURLObject::DECODE_WITH_CHARSET),
RTL_TEXTENCODING_UTF8).getStr());

a) the .getStr() returns a sal_Char* and then you make a OString out of
it, while OUStringToOString already is OString so drop the .getStr()
b) OUStringToOString returns a OString, so drop the intermediate ctor
as well i.e. 
- Foo apple = Foo(...);
+ Foo apple(...);
c) I wouldn't bother with the aFileObj.HasError() and return 0, i.e. I'd
prefer to get some mangled/empty string as
the filename listed in the overwrite dialog, rather than returning out
of the whole method on failure

C.



More information about the LibreOffice mailing list