10-09-2013 08:04 AM
I have a question about the Recurrence class.
Is this a material/bean class or does it contain calculation logic?
If i create a Recurrence instance and set, lets say, startDate to today, endDate to today in 1 year and dayInWeek to 1:
Could i query the object and get a list of QDateTimes that represent the occurrence?
If not, is there an exposed API that calculates the occurrences?
10-09-2013 10:28 AM
hope I haven't misunderstood your question but doesn't the occurrenceDates() function give you what you're referring to?
10-09-2013 10:31 AM
yes, my question is if this method returns a list of items (i.e. creates them) if some parameters were set.
Or if it is just a bean class without any logic in it.
10-09-2013 10:38 AM
OK, I see what you mean now :-)
I don't know.... so why don't I find out and get back to you?
10-09-2013 10:54 AM
It seems like it is not a "smart class", only a bean.
bb::pim::calendar::Recurrence recurrence; QDateTime current = QDateTime::currentDateTime(); recurrence.setStart(current); recurrence.setEnd(current.addYears(1)); recurrence.setFrequency(bb::pim::calendar::Frequen
cy::Daily); QList<QDateTime> occurrenceDates = recurrence.occurrenceDates(); qDebug() << "occurrenceDates:"<<occurrenceDates.size();
It should print 365, but gives 0.
It would be really great if you could ask around internally if I could somehow access the algorithm to calculate the occurrences.
I already created a theoretical model that should work, but it is quite complex and error prone, and if i could spend the week i would probably need to implement and test it on something else i would be quite happy
10-09-2013 11:33 AM
I did pretty much the same as you and reached the same conclusion :-)
Yes, I'll do that.
10-10-2013 11:25 AM
Yes, confirmed by development that this is just a "data container" as they call it.... a bean.
When asked about algorithm they pointed out the existence of a couple of libraries in the open source world, one in C and the other in python:
This is written in c.
This is written in python.
Hope this helps
10-10-2013 11:41 AM
10-10-2013 11:42 AM
I should have been quicker answering :-)
I'll ask and let you know what they say. With a bit of luck it will be an easy port if they haven't.