kplato
KPlato::Calendar Class Reference
#include <kptcalendar.h>
Detailed Description
Calendar defines the working and nonworking days and hours.A day can have the three states None (Undefined), NonWorking, or Working. A calendar can have a parent calendar that defines the days that are undefined in this calendar. If a day is still undefined, it defaults to Nonworking. A Working day has one or more work intervals to define the work hours.
The definition can consist of two parts: Weekdays and Day. Day has highest priority.
A typical calendar hierarchy could include calendars on three levels: 1. Definition of normal weekdays and national holidays/vacation days. 2. Definition of the company's special workdays/-time and vacation days. 3. Definitions for groups of resources/individual resources.
Definition at line 203 of file kptcalendar.h.
Public Member Functions | |
Calendar () | |
Calendar (QString name, Calendar *parent=0) | |
Calendar (Calendar *calendar) | |
~Calendar () | |
QString | name () const |
void | setName (QString name) |
Calendar * | parent () const |
void | setParent (Calendar *parent) |
Project * | project () const |
void | setProject (Project *project) |
bool | isDeleted () const |
void | setDeleted (bool yes) |
QString | id () const |
bool | setId (QString id) |
void | generateId () |
bool | load (QDomElement &element) |
void | save (QDomElement &element) const |
CalendarDay * | findDay (const QDate &date, bool skipUndefined=false) const |
bool | addDay (CalendarDay *day) |
bool | removeDay (CalendarDay *day) |
CalendarDay * | takeDay (CalendarDay *day) |
const QPtrList< CalendarDay > & | days () const |
int | parentDayState (const QDate &date) const |
IntMap | weekdaysMap () |
void | setWeekday (IntMap::iterator it, int state) |
CalendarWeekdays * | weekdays () |
CalendarDay * | weekday (int day) const |
QString | parentId () const |
void | setParentId (QString id) |
bool | hasParent (Calendar *cal) |
Duration | effort (const QDate &date, const QTime &start, const QTime &end) const |
Duration | effort (const DateTime &start, const DateTime &end) const |
QPair< DateTime, DateTime > | firstInterval (const DateTime &start, const DateTime &end) const |
QPair< QTime, QTime > | firstInterval (const QDate &date, const QTime &start, const QTime &end) const |
bool | hasInterval (const DateTime &start, const DateTime &end) const |
bool | hasInterval (const QDate &date, const QTime &start, const QTime &end) const |
DateTime | firstAvailableAfter (const DateTime &time, const DateTime &limit) |
DateTime | firstAvailableBefore (const DateTime &time, const DateTime &limit) |
Calendar * | findCalendar () const |
Calendar * | findCalendar (const QString &id) const |
bool | removeId () |
bool | removeId (const QString &id) |
void | insertId (const QString &id) |
void | printDebug (QCString indent="") |
Protected Member Functions | |
const Calendar & | copy (Calendar &calendar) |
void | init () |
Member Function Documentation
Returns the amount of 'worktime' that can be done in the interval from start to end.
Definition at line 729 of file kptcalendar.cc.
Duration KPlato::Calendar::effort | ( | const QDate & | date, | |
const QTime & | start, | |||
const QTime & | end | |||
) | const |
Returns the amount of 'worktime' that can be done on the date date between the times start and end.
Definition at line 691 of file kptcalendar.cc.
CalendarDay * KPlato::Calendar::findDay | ( | const QDate & | date, | |
bool | skipUndefined = false | |||
) | const |
Find the definition for the day date.
If skipUndefined=true the day is NOT returned if it has state None (Undefined).
Definition at line 667 of file kptcalendar.cc.
Find the first available time after time before limit.
Return invalid datetime if not available.
Definition at line 853 of file kptcalendar.cc.
Find the first available time backwards from time.
Search until limit. Return invalid datetime if not available.
Definition at line 867 of file kptcalendar.cc.
QPair< QTime, QTime > KPlato::Calendar::firstInterval | ( | const QDate & | date, | |
const QTime & | start, | |||
const QTime & | end | |||
) | const |
Returns the first 'work interval' on date for the interval starting at start and ending at end.
If no 'work interval' exists, returns an interval with first==second. You can also use hasInterval() to check if a 'work interval' exists.
Definition at line 755 of file kptcalendar.cc.
QPair< DateTime, DateTime > KPlato::Calendar::firstInterval | ( | const DateTime & | start, | |
const DateTime & | end | |||
) | const |
Returns the first 'work interval' for the interval starting at start and ending at end.
If no 'work interval' exists, returns an interval with invalid DateTime. You can also use hasInterval() to check if a 'work interval' exists.
Definition at line 774 of file kptcalendar.cc.
bool KPlato::Calendar::hasInterval | ( | const QDate & | date, | |
const QTime & | start, | |||
const QTime & | end | |||
) | const |
Returns true if at least a part of a 'work interval' exists for the interval on date, starting at start and ending at end.
Definition at line 808 of file kptcalendar.cc.
Returns true if at least a part of a 'work interval' exists for the interval starting at start and ending at end.
Definition at line 827 of file kptcalendar.cc.
int KPlato::Calendar::parentDayState | ( | const QDate & | date | ) | const |
Returns the state of definition for parents day date in it.
Also checks the parents recursively.
The documentation for this class was generated from the following files: