Qt API | Qtopia API | Qtopia Documentation |

# PimEvent Class Reference
[qpepim module]

The PimEvent class holds the data of a calendar event. More...

`#include <qtopia/pim/event.h>`

Inherits PimRecord.

List of all member functions.

## Public Members

- enum RepeatType { NoRepeat, Daily, Weekly, MonthlyDate, MonthlyDay, Yearly, MonthlyEndDay }
- enum SoundTypeChoice { Silent, Loud }
- PimEvent ()
- PimEvent ( const QDateTime & start, const QDateTime & end )
- virtual ~PimEvent ()
- QString description () const
- QString location () const
- QDateTime start () const
- QDateTime startInCurrentTZ () const
- QDateTime end () const
- QDateTime endInCurrentTZ () const
- QString notes () const
- TimeZone timeZone () const
- bool hasAlarm () const
- int alarmDelay () const
- SoundTypeChoice alarmSound () const
- RepeatType repeatType () const
- bool hasRepeat () const
- int frequency () const
- int weekOffset () const
- QDate repeatTill () const
- QDate repeatTillInCurrentTZ () const
- bool repeatForever () const
- bool showOnNearest () const
- bool repeatOnWeekDay ( int day ) const
- bool isException () const
- QUuid seriesUid () const
- bool hasExceptions () const
- bool isValid () const
- bool isAllDay () const
- void setAllDay ( bool enable = TRUE )
- void setDescription ( const QString & text )
- void setLocation ( const QString & text )
- void setStart ( const QDateTime & time )
- void setEnd ( const QDateTime & time )
- void setNotes ( const QString & text )
- void setTimeZone ( const TimeZone & zone )
- void setAlarm ( int minutes, SoundTypeChoice s )
- void clearAlarm ()
- void setRepeatType ( RepeatType t )
- void setFrequency ( int freq )
- void setRepeatTill ( const QDate & date )
- void setRepeatForever ( bool b )
- void setShowOnNearest ( bool b )
- void setRepeatOnWeekDay ( int day, bool enable )
- QDate nextOccurrence ( const QDate & from, bool * ok = 0 ) const
- QColor color () const

## Static Public Members

- void writeVCalendar ( const QString & filename, const QValueList<PimEvent> & events )
- void writeVCalendar ( const QString & filename, const PimEvent & event )
- QValueList<PimEvent> readVCalendar ( const QString & filename )

## Detailed Description

The PimEvent class holds the data of a calendar event.

This data includes descriptive data of the event and schedualing information.

See also QPEPIM Library.

## Member Type Documentation

### PimEvent::RepeatType

This enum type defines how an event repeats.

- NoRepeat - Event occurs only once.
- Daily - Event occurs every N days.
- Weekly - Event occurs every N weeks.
- MonthlyDate - Event occurs on the Xth day of the month every N months.
- MonthlyDay - Event occurs on the Xth week of the month every N months.
- MonthlyEndDay - Event occurs on the Xth last week of the month every N months.
- Yearly - Event occurs every N years.

See also frequency(), weekOffset(), showOnNearest() and repeatOnWeekDay().

### PimEvent::SoundTypeChoice

This enum type defines what kind of sound is made when an alarm occurs for an event. The currently defined types are:

- Silent - No sound is produced.
- Loud - A loud sound is produced.

See also setAlarm() and alarmSound().

## Member Function Documentation

### PimEvent::PimEvent ()

Constructs a new PimEvent.

### PimEvent::PimEvent ( const QDateTime & start, const QDateTime & end )

Constructs a new PimEvent starting at start and running till end.

### PimEvent::~PimEvent ()`[virtual]`

Destroys a PimEvent.

### int PimEvent::alarmDelay () const

Returns the number of minutes before the event to activate the alarm for the event.

See also setAlarm().

### SoundTypeChoice PimEvent::alarmSound () const

Returns the type of alarm to sound.

See also setAlarm() and SoundTypeChoice.

### void PimEvent::clearAlarm ()

Clears any alarms set for the event.

See also setAlarm().

### QColor PimEvent::color () const

returns the color associated with the event.

### QString PimEvent::description () const

Returns the description of the event.

See also setDescription().

### QDateTime PimEvent::end () const

Returns when the first occurrence of the event starts.

See also endInCurrentTZ() and setEnd().

### QDateTime PimEvent::endInCurrentTZ () const

Returns the end time of the event in the current system timezone.

See also end().

### int PimEvent::frequency () const

Returns how often the event repeats.

See also setFrequency().

### bool PimEvent::hasAlarm () const

Returns TRUE if there is an alarm set for the event. Otherwise returns FALSE.

See also setAlarm().

### bool PimEvent::hasExceptions () const

Returns TRUE if the event is a repeating event that has exceptions to the repeat pattern for that event. Otherwise returns FALSE.

See also isException() and seriesUid().

### bool PimEvent::hasRepeat () const

Returns FALSE if the event has repeat type NoRepeat. Otherwise returns TRUE.

See also setRepeatType() and RepeatType.

### bool PimEvent::isAllDay () const

Returns TRUE if the event is an all day event. Otherwise returns FALSE.

See also setAllDay().

### bool PimEvent::isException () const

Returns TRUE if this event represents an exception to the repeat pattern of another event. Otherwise returns FALSE.

For example if a daily event at 10am starts on 11am one day, the 11am would be represent an exception to the 10am repeating event.

See also hasExceptions() and seriesUid().

### bool PimEvent::isValid () const

Returns TRUE if the event can occur. Otherwise returns FALSE.

### QString PimEvent::location () const

Returns the location of the event.

See also setLocation().

### QDate PimEvent::nextOccurrence ( const QDate & from, bool * ok = 0 ) const

Returns the first date on or after from that the event will next occur. If the event only occurs once (no repeat) will return the date of the start of the event if the start of the event is on or after from.

If ok is non-NULL, *ok is set to TRUE if the event occurs on or after from and FALSE if the event does not occur on or after from.

### QString PimEvent::notes () const

Returns the notes of the event.

See also setNotes().

### QValueList<PimEvent> PimEvent::readVCalendar ( const QString & filename )`[static]`

Reads the file specified by filename as a list of vCalendar objects and returns the list of near equivalent events.

See also writeVCalendar().

### bool PimEvent::repeatForever () const

Returns TRUE if the event will repeat forever. Otherwise returns FALSE.

See also repeatTill() and setRepeatForever().

### bool PimEvent::repeatOnWeekDay ( int day ) const

If the repeat type of the event is Weekly and the event is set to repeat on day of the week, then returns TRUE. Otherwise returns FALSE.

See also setRepeatOnWeekDay().

### QDate PimEvent::repeatTill () const

Returns the date the event will repeat until

See also repeatForever() and setRepeatTill().

### QDate PimEvent::repeatTillInCurrentTZ () const

Returns the date the event will repeat till in the current system timezone.

See also repeatTill().

### RepeatType PimEvent::repeatType () const

Returns the RepeatType of the event.

See also setRepeatType() and RepeatType.

### QUuid PimEvent::seriesUid () const

Returns the UID for the recurring event this event is an exception to. If this event does nto represent an exception to another repeating event, an empty UID will be returned.

See also hasExceptions() and isException().

### void PimEvent::setAlarm ( int minutes, SoundTypeChoice s )

Sets an alarm for the event, minutes before the start of the event, with an alarm type of s.

See also clearAlarm(), hasAlarm(), alarmSound() and alarmDelay().

### void PimEvent::setAllDay ( bool enable = TRUE )

Sets whether the event is an an all day event to enable. All day events have a no set time-zone (empty string).

See also isAllDay() and setTimeZone().

### void PimEvent::setDescription ( const QString & text )

Sets the description of the event to text.

See also description().

### void PimEvent::setEnd ( const QDateTime & time )

Sets the end time of the event to time. This will also change the duration of the event. time must be at least 5 minutes after the start time of the event.

See also end() and endInCurrentTZ().

### void PimEvent::setFrequency ( int freq )

Sets the frequency of the event to freq. If freq is less than 1 will set the frequency of the event to 1.

See also frequency().

### void PimEvent::setLocation ( const QString & text )

Set the location of the event to text.

See also location().

### void PimEvent::setNotes ( const QString & text )

Sets the notes of the event to text.

See also notes().

### void PimEvent::setRepeatForever ( bool b )

If b is TRUE then sets the event to repeat forever. Otherwise event will repeat until repeatUntil()

See also repeatForever().

### void PimEvent::setRepeatOnWeekDay ( int day, bool enable )

Sets the event to repeat on the day of the wekif enable is TRUE. Otherwise sets the event not to repeat on the day of the week.

Event will always repeat on the day of the week that it started on.

See also repeatOnWeekDay().

### void PimEvent::setRepeatTill ( const QDate & date )

Sets the date the event will repeat until to date. If date is before the end of the first event will set the event to occur once.

See also repeatTill() and repeatForever().

### void PimEvent::setRepeatType ( RepeatType t )

Sets the repeat type of the event to t.

See also repeatType(), hasRepeat() and RepeatType.

### void PimEvent::setShowOnNearest ( bool b )

Sets whether to show a repeating event on the nearest previous date if the day it would repeat on does not exist to b.

An example would be a repeating event that occures on the 31st of each month. Setting showOnNearest to TRUE will have the event show up on the 30th on months that do not have 31 days, (or 28/29 in the case of Febuary).

See also showOnNearest().

### void PimEvent::setStart ( const QDateTime & time )

Sets the start time of the event to time. This will change the end time fo the event to maintain the same duration.

See also start() and startInCurrentTZ().

### void PimEvent::setTimeZone ( const TimeZone & zone )

Sets the time zone of the event to zone. This will affect when the event occurs in UTC. All day events cannot have a time zone set.

Setting the time zone to an invalid TimeZone will cause the event to have no associated time zone.

See also timeZone() and isAllDay().

### bool PimEvent::showOnNearest () const

Returns if the event should be shown on the nearest match of an occurrence if the exact date the event would occur is not a valid date.

See also setShowOnNearest().

### QDateTime PimEvent::start () const

Returns when the first occurrence of the event starts.

See also startInCurrentTZ() and setStart().

### QDateTime PimEvent::startInCurrentTZ () const

Returns the start time of the event in the current system timezone.

See also start().

### TimeZone PimEvent::timeZone () const

Returns the time zone of the event or an invalid TimeZone if the event has no time zone. All day events allways have no time zone.

See also setTimeZone() and isAllDay().

### int PimEvent::weekOffset () const

Returns the instance of the week the event will occur for the repeat types MonthlyDay and MonthlyEndDay. The week offset is determined by the starting date of the event.

if (weekOffset() == 1) event occurs in first week of the month. if (weekOffset() == 3) event occurs in third week of the month. if (weekOffset() == -1) event occurs in last week of the month.

Returns 0 if there is no week offset for the event.

### void PimEvent::writeVCalendar ( const QString & filename, const QValueList<PimEvent> & events )`[static]`

Write the list of events as vCalendar objects to the file specified by filename.

See also readVCalendar().

### void PimEvent::writeVCalendar ( const QString & filename, const PimEvent & event )`[static]`

Write the event as a vCalendar to the file specified by filename.

See also readVCalendar().

This file is part of the Qtopia , copyright © 1995-2002 Trolltech, all rights reserved.