KAlarm Design Notes

The terms "alarm" and "event" are often used interchangeably in the context of KAlarm (including in source code comments). Technically speaking, a KAlarm "alarm" is really an event which contains one or more alarms. Each event is held in a KAEvent object and is stored as an iCalendar VEVENT. Each event normally contains the "main" alarm together with other subsidiary alarms; subsidiary alarms are used to represent reminders, deferrals, sounds, at-login alarms, pre-alarm actions and post-alarm actions. However, if the "main" alarm has expired but a subsidiary alarm is still due (e.g. a deferral), the event may no longer contain the "main" alarm. Individual alarms in the event may be fetched as KAAlarm objects.

Repeat-at-login events do not allow a reminder before the alarm, late-cancellation, or copying to KOrganizer, since these are incompatible with an alarm with no fixed trigger time.

The limit for deferring an alarm is as follows. Note that reminders are not triggered for sub-repetitions, just recurrences.
Recurs?Sub-
repetition?
Reminder
type
Deferral limit
-
  • No limit
  • Before
  • Main alarm: no limit
  • Reminder: before main alarm
  • After
  • Main alarm: no limit
  • Reminder: no limit
  • Y-
  • Last recurrence: no limit
  • Other recurrences: before next recurrence
  • YBefore
  • Main alarm last recurrence: no limit
  • Main alarm other recurrences: before next reminder
  • YAfter
  • Main alarm last recurrence: no limit
  • Main alarm other recurrences: before next recurrence
  • Reminder last recurrence: no limit
  • Reminder other recurrences: before next recurrence
  • YY-
  • Last sub-repetition of last recurrence: no limit
  • Other occurrences: before next recurrence or sub-repetition
  • YYBefore
  • Main alarm last sub-repetition of last recurrence: no limit
  • Main alarm other occurrences: before next recurrence or sub-repetition or reminder
  • Reminder: before next recurrence
  • YYAfter
  • Main alarm last sub-repetition of last recurrence: no limit
  • Main alarm other occurrences: before next recurrence or sub-repetition
  • Reminder: before next sub-repetition
  • Calendar Storage

    KAlarm uses the iCalendar format defined in RFC2445.

    The DTSTART property is always set as a date/time value, never a date-only value; a date-only event is indicated by the DATE parameter in the X-KDE-KALARM-FLAGS property. This is necessary for two reasons: 1) to allow a time zone to be specified for a date-only event; 2) KAlarm allows the trigger time to float within the 24-hour period defined by the start-of-day time (which is user-dependent and therefore can't be written into the calendar) rather than midnight to midnight, and there is no RFC2445 conformant way to specify this.

    The following VALARM components are stored within a VEVENT:
    Alarm typeACTION
    property
    Description
    Main alarmanyThe main alarm. This is always present unless it is a recurring alarm and the last recurrence has already triggered, but a subsidiary alarm is still pending. Possible pending alarms are either sub-repetitions, a deferral, or a reminder after the main alarm.
    At-login alarmanyIf the event is configured to trigger each time KAlarm starts up (normally at each login), this alarm has a trigger time in the past, which ensures that it always triggers at startup.
    Reminder alarmDISPLAYIf a reminder is configured, and it is due before the next or only recurrence of the main alarm, this alarm triggers the reminder.
    Deferral alarmDISPLAYIf the user has deferred an alarm (either the main alarm or a reminder), this alarm triggers at the deferral time.
    Audio alarmAUDIOIf it is a display event, and any type of sound is configured (beep, speaking or audio file), this alarm is set to trigger at the same time as the next due alarm (main, at-login, reminder, or deferral).
    Pre-alarm action alarmPROCEDUREIf a pre-alarm action is configured, this alarm is set to trigger at the same time as the next due alarm.
    Post‑alarm action alarmPROCEDUREIf a post-alarm action is configured, this alarm is set to trigger at the same time as the next due alarm.
    Displaying alarmDISPLAYIf an alarm is currently being displayed, this alarm held in the displaying calendar contains information necessary to redisplay the alarm window after a logout or crash.

    Alarm trigger times are always set as an offset from the next or current recurrence of the main alarm as set in DTSTART (for a non-recurring alarm) or in the X-KDE-KALARM-NEXTRECUR property (for a recurring alarm). An offset is used because RFC2445 stipulates that if the TRIGGER property value is an absolute time, it must be a UTC date/time value, which is in general not suitable. Note that the main alarm's trigger offset must always be zero, because if it was non-zero, exception dates and rules would not work since they apply to the event time, not the alarm time.

    Custom properties

    Compliant with the iCalendar specification, KAlarm defines a number of custom fields prefixed by X-KDE-KALARM- for use in the calendar. These are listed here, together with their possible parameters. All properties are optional unless stated to be mandatory.

    Note that in the iCalendar format, the property name is separated from its parameter(s) by a semi-colon. Multiple parameters are also semi-colon separated.

    Calendar-level custom properties
    The following custom properties are used within a VCALENDAR element.
    Property    ParameterDescription
    X-KDE-KALARM-VERSIONMandatory. The single parameter contains the KAlarm calendar format version used to write this calendar. Note that this version may be older than the actual KAlarm application version; the calendar format version is only updated when the calendar format changes.
    versionKAlarm calendar format version, in the format n.n.n . E.g. 2.3.10
    Event-level custom properties
    The following custom properties are used within a VEVENT element.
    PropertyParameterDescription
    X-KDE-KALARM-TYPEMandatory. Multiple parameters hold the alarm's type. The first two parameters are always in the following order:
    typeThe event's type, one of ACTIVE, ARCHIVED, TEMPLATE, DISPLAYING
    resourceThe saved Akonadi collection ID, or KResources resource ID. Note that this is not the collection/resource which the event is in.
    DEFERFor an event in the displaying calendar, indicates that the Defer button should be shown in the alarm window. Optional.
    EDITFor an event in the displaying calendar, indicates that the Edit button should be shown in the alarm window. Optional.
    X-KDE-KALARM-FLAGSMultiple parameters specify various properties of the event
    DATEThe event time is date-only, i.e. its time is ignored and it triggers at the first opportunity on the specified date (after the start-of-day time configured by the user). Note that this is used instead of specifying a start date (DTSTART) without a time.
    ACKCONFFor a display alarm, when the user acknowledges the alarm (i.e. closes the alarm window), a confirmation prompt will be output
    KORGThe event was copied as an alarm to KOrganizer
    EXHOLIDAYSThe alarm will not trigger on holidays (as defined for the holiday region configured by the user)
    WORKTIMEThe alarm will not trigger during working hours on working days (as configured by the user)
    DEFER;intervalRecords the default deferral parameters for the alarm, used when the Defer dialogue is displayed. interval holds the deferral interval in minutes, with an optional D suffix to specify a date-only deferral. E.g. DEFER;1440D = 1 day, date-only
    LATECANCEL;intervalHow late the alarm can trigger (in minutes) before it will be cancelled; default = 1 minute
    LATECLOSE;intervalFor a display alarm, how long after the trigger time (in minutes) until the alarm window is automatically closed; default = 1 minute. It will also be cancelled if it triggers after this time.
    TMPLAFTTIME;intervalFor a template alarm, holds the value (in minutes) of the "After time" option
    KMAIL;sernumThe KMail serial number of the email whose text forms the alarm message
    BCCFor an email alarm, the email will be blind copied to the user
    REMINDER;[ONCE;]intervalThe reminder interval for the alarm: < 0 for a reminder before the main alarm, > 0 for a reminder after the main alarm. A suffix indicates the time units: M = minutes, H = hours, D = days. E.g. -12M. If ONCE is specified, this indicates that the reminder should be shown only for the first recurrence.
    LOGINFor an active alarm, when its main alarm has expired, records that the original alarm was triggered each time KAlarm started up (normally at each login)
    ARCHIVEFor an active alarm, indicates that the alarm has triggered at least once and should be archived when it expires or is deleted
    X-KDE-KALARM-NEXTRECURThe single parameter records the next due recurrence date/time of the main alarm or, if sub-repetitions are still pending after the latest recurrence, the date/time of that recurrence
    date-timeThe date and optional time, in the format YYYYMMDDTHHMMSS for a date/time alarm, or YYYYMMDD for a date-only alarm. E.g. 19990131T120000
    X-KDE-KALARM-REPEATUsed for an active alarm when its main alarm has expired, holds the alarm's sub-repetition information. (Normally, this is held in the main alarm.)
    interval:countSub-repetition interval (in minutes) and count
    X-KDE-KALARM-LOGThe single parameter specifies where command alarm output should go; default = discard
    xterm:Display command output in a terminal window
    display:Display command output in an alarm window
    filenameStore command output in the specified file
    Alarm-level custom properties
    The following custom properties are used within a VALARM element.
    PropertyParameterDescription
    X-KDE-KALARM-TYPEMultiple parameters hold information about the alarm's type. If this property is missing, the alarm is the "main" alarm for the event.
    LOGINThe alarm should be triggered each time KAlarm starts up (normally at each login)
    FILEFor a display alarm, indicates that the alarm text holds the name of a file whose contents should form the alarm message
    REMINDERThe alarm is a subsidiary reminder alarm. If combined with DEFERRAL or DATE_DEFERRAL, the alarm is a deferred reminder alarm.
    DEFERRALThe alarm is a subsidiary timed deferral alarm
    DATE_DEFERRALThe alarm is a subsidiary date-only deferral alarm
    PREThe alarm is a subsidiary pre-alarm action command, which is executed immediately before the main alarm
    POSTThe alarm is a subsidiary post-alarm action command, which is executed immediately after the user acknowledges the main display alarm
    SOUNDREPEATFor an audio alarm, indicates that the sound file should be repeated indefinitely
    DISPLAYINGThe alarm is currently being displayed, i.e. in the displaying calendar
    X-KDE-KALARM-FLAGSMultiple parameters specify various properties of the alarm
    HIDEFor an alarm of type REMINDER, indicates that it is suppressed by a deferral alarm whose trigger time is later than this alarm. Allows the reminder alarm to be reinstated if the deferral is subsequently cancelled.
    SPEAKFor an audio alarm in an event whose main alarm is a display or command alarm, specifies that the alarm text should be spoken
    ERRCANCELFor a command alarm containing a pre-alarm action, indicates that the alarm should be cancelled if the pre-alarm action fails
    ERRNOSHOWFor a command alarm containing a pre-alarm action, indicates that there should be no error notification if the pre-alarm action fails
    EMAILID;uoidFor an email alarm, holds the email ID (the KDE email UOID) to use in the 'From' field.
    X-KDE-KALARM-NEXTREPEATThe single parameter holds the repetition count of the next due sub-repetition: 0 = the main recurrence, 1 = the first sub-repetition, etc.
    countRepetition number
    X-KDE-KALARM-FONTCOLORFor a display alarm, holds the colours to use in the alarm message window
    [background][;foreground]The optional background colour (default = white) and optional foreground colour (default = black)
    X-KDE-KALARM-VOLUMEHolds volume settings for an audio alarm
    [volume][;fadevolume;fadeinterval]Contains the optional volume (floating point, range 0 - 1), and optionally the fade volume (floating point, range 0 - 1) and fade interval in seconds. E.g. 0.75 to set volume with no fade, ;0.3;10 for default volume with fade, 0.75;0.3;10 to specify volume and fade

    Custom status field values

    The following custom parameter value is used in the STATUS property in VEVENT: