[Kde-pim] KHolidays regions

John Layt jlayt at kde.org
Mon Jun 23 17:28:11 BST 2014


On 20 June 2014 18:28, John Layt <jlayt at kde.org> wrote:
> And I'm done with the data files.  I've taken the liberty of pushing
> this to master already without a review request, most of the code is
> generated and so noise, and the data changes are purely mechanical.  I
> I will put up a review request for the public api changes though.

I'm writing the api now and ran into a small problem with deciding how
it should work.

I've defined the categories as Flags:

    enum Category {
      AnyCategory    = 0x0000, ///< Any Holiday, used for Categories flags
      Public         = 0x0001, ///< A Public Holiday, i.e. a
NonWorkday for all people in the administrative region
      School         = 0x0002, ///< A School Holiday, i.e. a
NonWorkday for schools in the administrative region
      // etc
    };
    Q_DECLARE_FLAGS(Categories, Category)

On a Holiday object you can query the categories define for it:

    Categories categories() const;

Then on the HolidayRegion I've defined a new method to return those
holidays in a region matching some requested categories:

    Holiday::List holidays( const QDate &startDate, const QDate &endDate,
                            Holiday::Categories categories,
                            Holiday::MultidayMode multidayMode ) const;

The question is, when does a holiday match a set of flags?  When any
one of it's categories matches any one of the requested flags, or when
all of its categories match all of the flags?  What would people
expect?  I'm a bit reluctant to add an enum to control the
interpretation, but it looks like I will?

John.
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list