Add fancy date format option to KLocale
David Jarvie
lists at astrojar.org.uk
Sun Apr 8 00:48:33 BST 2007
Tom Albers asked to add a fancy date/time string format option to KDateTime
(if the date is in the last week, replace it by Today, Yesterday, or the
weekday name). This is a function currently in kdepimlibs/kmime. I think that
this really belongs in KLocale rather than KDateTime, since only KLocale
knows the format in which a date/time value should be displayed in the
current locale. I therefore propose to amend KLocale::formatDateTime() and
formatDate() to replace the second (bool shortFormat) parameter with an enum:
enum DateFormat {
ShortDate, LongDate, FancyDate
};
QString formatDate(const QDate&, DateFormat = ShortDate);
QString formatDateTime(const QDateTime&, DateFormat = ShortDate,
bool includeSeconds = false);
QString formatDateTime(const KDateTime&, DateFormat = ShortDate,
bool includeSeconds = false, bool includeTimeZone = false);
I will initially add these methods and deprecate the existing formatDateTime()
ones, since I doubt whether I'll be able to convert the whole of KDE by the
end of Monday. I'll complete the conversion as soon as I can during the week
to come, and remove the deprecated methods a week on Monday.
Please let me know if there are any objections.
--
David Jarvie.
KAlarm author and maintainer.
http://www.astrojar.org.uk/kalarm
More information about the kde-core-devel
mailing list