kplato

KPlato::Calendar Class Reference

#include <kptcalendar.h>

List of all members.


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)
Calendarparent () const
void setParent (Calendar *parent)
Projectproject () 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
CalendarDayfindDay (const QDate &date, bool skipUndefined=false) const
bool addDay (CalendarDay *day)
bool removeDay (CalendarDay *day)
CalendarDaytakeDay (CalendarDay *day)
const QPtrList< CalendarDay > & days () const
int parentDayState (const QDate &date) const
IntMap weekdaysMap ()
void setWeekday (IntMap::iterator it, int state)
CalendarWeekdaysweekdays ()
CalendarDayweekday (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, DateTimefirstInterval (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)
CalendarfindCalendar () const
CalendarfindCalendar (const QString &id) const
bool removeId ()
bool removeId (const QString &id)
void insertId (const QString &id)
void printDebug (QCString indent="")

Protected Member Functions

const Calendarcopy (Calendar &calendar)
void init ()

Member Function Documentation

Duration KPlato::Calendar::effort const DateTime start,
const DateTime end
const
 

Returns the amount of 'worktime' that can be done in the interval from start to end.

Definition at line 728 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 690 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 666 of file kptcalendar.cc.

DateTime KPlato::Calendar::firstAvailableAfter const DateTime time,
const DateTime limit
 

Find the first available time after time before limit.

Return invalid datetime if not available.

Definition at line 852 of file kptcalendar.cc.

DateTime KPlato::Calendar::firstAvailableBefore const DateTime time,
const DateTime limit
 

Find the first available time backwards from time.

Search until limit. Return invalid datetime if not available.

Definition at line 866 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 754 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 773 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 807 of file kptcalendar.cc.

bool KPlato::Calendar::hasInterval const DateTime start,
const DateTime end
const
 

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 826 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:
KDE Home | KDE Accessibility Home | Description of Access Keys