[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-pim
Subject:    [Kde-pim] About non-gregorian calendar systems
From:       Cornelius Schumacher <schumacher () kde ! org>
Date:       2002-02-26 0:39:49
[Download RAW message or body]

First of all let me say that I find it great that some activity seems 
to emerge to implement non-gregorian calendar systems in KOrganizer. I 
think this is one of the things that make open-source such a great 
concept, that even features only useful to a small number of users get 
realized and make KDE a truly global desktop.

Now to the technical problems: I don't think that it helps very much to 
implement specific Date classes. A Date object should represent a 
certain day, regardless of the calendar system and QDate is perfect for 
this purpose.

The problem is that each calendar system has its own view of how long a 
month is, how many months belong to a year, what a week is, how special 
days like holidays are calculated. In fact, supporting different 
calendar systems is not a problem of internal represenation of a date, 
but a problem of how calendars are displayed.

Currently many aspects of the gregorian system are hard-coded, e.g. the 
number of days in a month, the length of a week, the position of the 
days in the week (at least it's possible to switch between a week 
starting on sunday and a week starting on monday). In addition to that 
all the weekday and month names are hardcoded.

To make it possible to use different calendar systems, we don't need to 
subclass QDate, we need a new interface class CalendarSystem, which 
provides functions to return for a given QDate object, which year it 
belongs to, how many months that year has, to which month it belongs, 
how many days the month has, how the month is called, etc. This 
implicitly also contains the conversion functions from and to gregorian 
dates, but so we have QDate as reference and only have to implement 
conversions for this system and not for converting between two 
non-gregorian systems.

The different calendar views then have to use the CalendarSystem class 
to find out the information they currently have hard-coded.

Each different calendar system would have to be implemented as a 
subclass of CalendarSystems, which provides all the required 
information through the common abstract interface.

Holidays are something different. It is probably a common case that the 
standard gregorian calendar is used, but some special dates are based 
on some calculation, which can't be expressed as a fixed date. For 
these holidays or holiday systems I think currently the best and 
easiest way is to provide them through a plugin. This will not require 
any additional changes and provides the information for those who are 
interested in addition to the normal calendar information.

-- 
Cornelius Schumacher <schumacher@kde.org>
_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic