[PATCH] KLocale (configurable first day of the week)

Lukáš Tinkl lukas.tinkl at suse.cz
Fri Jul 19 17:06:02 BST 2002


Dne pá 19. červenec 2002 15:34 Cornelius Schumacher napsal(a):
> On Friday 19 July 2002 14:49, Lukáš Tinkl wrote:
> > here's a patch that makes the first day of the week freely configurable,
> > not just Monday or Sunday as previously. It adds two new methods and one
> > new config option:
> >
> > klocale.h:
> > QString weekStartDay() const;
> > void setWeekStartDay(const QString & day);
> >
> > The config option and the methods take a three-letter English name of the
> > week day, e.g. 'Sun' if Sunday is the first day of the week (Monday being
> > the default as before).

New patch attached; comments below...

> Wouldn't it be better, if these functions would use an int compatible with
> QDate::dayOfWeek() instead of a QString?

Yes, I agree. 
I additionally added a boundary check which sets the first day to Monday if 
the day is not between 1 and 7.

Hmmm just a thought: what if some country has more days in a week than seven? 
I think we're lost then anyway. >:-> 

> > Question: is it safe to remove the private bool member
> > m_weekStartsMonday?
>
> Neither the removal of m_weekStartsMonday nor the addition of
> m_weekStartDay is binary compatible. You should put the new variable into
> KLocalePrivate and leave the old one where it is.

Thanks, I thought so :)
I corrected that and removed the "m_".

> And finally some nitpicking: I don't think it makes sense to add a comment
> "language and country" for two variables called m_language and m_country.
> That's redundant.

I didn't add it but it's removed now.

-- 
Lukáš Tinkl
KDE developer | SuSE Labs
http://czechia.kde.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: klocale.cpp.diff
Type: text/x-diff
Size: 2417 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20020719/0c68e4dc/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: klocale.h.diff
Type: text/x-diff
Size: 4449 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20020719/0c68e4dc/attachment-0001.diff>


More information about the kde-core-devel mailing list