KLocale::formatDate()

Adriaan de Groot groot at kde.org
Sun Feb 4 21:18:22 GMT 2007


On Sunday 04 February 2007 21:54, Reinhold Kainhofer wrote:
> Am Son Feb 4 2007 schrieb David Faure:
> > On Saturday 03 February 2007, Adriaan de Groot wrote:
> > > I'm asking in particular because I found some code that does:
> >
> > Why doesn't this code create a different KLocale object, set the date
> > format on it, and use it to format dates?
>
> Because I needed a workaround for the "missing" general formatDate( const
> QDate &, const QString &format) method, and this was the first hack that
> came to my mind...

Reinhold: I was trying to anonymize the code, eh.
David: API bloat follows, but no code duplication since you end up with

/* static */ QString KLocale::formatDate(const QDate&, const QString &format);
QString KLocale::formatDate(const QDate &d)
{
	formatDate(d,dateFormat());
}

Well, almost, since you need the calendar() object from the locale, too. I 
don't know what it costs to create a spare KLocale object, it just seems very 
extra-kludgy to me.


-- 
KDE Quality Team  http://www.englishbreakfastnetwork.org/
GPG: FEA2 A3FE    http://people.fruitsalad.org/adridg/




More information about the kde-core-devel mailing list