Proposal: consistency for dateFormat()

Jarosław Staniek js at iidea.pl
Fri Jan 20 15:37:20 GMT 2006


Stephan Kulow said the following, On 2006-01-20 15:58:

> Am Freitag, 20. Januar 2006 10:45 schrieb Jaroslaw Staniek:
> 
>>Hello,
>>My proposal is to change the default of shortFormat to true for KDElibs4
>>here:
>>
>>QString KLocale::formatDate(const QDate &pDate, bool shortFormat = false)
>>const;
>>
>>Why? Many of KLocale data/time-related functions default to short formats,
>>in particular, shortFormat is true by default here:
>>
>>   QString KLocale::formatDateTime(const QDateTime &pDateTime,
>>			 bool shortFormat = true,
>>			 bool includeSecs = false) const;
>>
>>I must admit that at least two times I used formatDate(const QDate &)
>>expecting short format as in formatDateTime() and was surprised that long
>>format was printed.
> 
> 
> Objection! That is a suprise regression from KDE3 to KDE4. I wouldn't object 
> if you change the interface to use some well defined enum for that, so that 
> the developer needs to change his code to follow the new API

Ah, OK, I can propose an enum for both booleans.
But then we still couldn't have the default option in if we do not want to 
surprise developers, could we?

KLocale::formatDateTime(const QDateTime &pDateTime, int options = 
DateTimeFormat::ShortDateTimeFormat),

(Yes we can use QFlags here).

-- 
regards / pozdrawiam,
  Jaroslaw Staniek / OpenOffice Polska

  Kexi Developer:      http://www.kexi-project.org | http://koffice.org/kexi
  Kexi Support:        http://www.kexi-project.org/support.html
  Kexi For MS Windows: http://kexi.pl/wiki/index.php/Kexi_for_MS_Windows
  KDE3, KDE4 Libraries For Developing MS Windows Applications:
                       http://www.kdelibs.com/wiki




More information about the kde-core-devel mailing list