Description: KAlarm

# KAlarm Design Notes

See the KAlarmCal design notes (kalarmcal/DESIGN.html) for details of calendar storage.

## Classes

This section summarises some of the C++ classes used to build KAlarm.

### Calendar Resource Classes

Class | Base class | Description
--- | --- | ---
Generic Resource and Event Classes
`ResourceType` | `QObject` | Abstract base class representing an alarm calendar resource. Classes inherited from this class are accessed via the Resource class, which encapsulates them.
`Resource` | `` | Represents an alarm calendar resource. Contains a shared pointer to a ResourceType object. It is designed to be safe to use even if the pointer to the ResourceType object is null.
`Resources` | `QObject` | Singleton class which contains all ResourceType instances. It allows connection to signals from all resource instances.
`ResourceCreator` | `QObject` | Base class to interactively create a resource.
`CalendarUpdater` | `QObject` | Base class to update the backend calendar format of a single alarm calendar.
`ResourceSelectDialog` | `QDialog` | A dialog which shows a list of resources and allows the user to select one.
`DataModel` | `` | A namespace which provides functions independent of which data model type (Akonadi, etc.) is being used
`ResourceDataModelBase` | `` | Base class for models containing all calendars and the events (alarms and templates) within them.
`ResourceFilterModel` | `QSortFilterProxyModel` | Proxy filter model providing all calendar resources (not events) of a specified alarm type (active/archived/template). The selected alarm type may be changed as desired.
`ResourceListModel` | `KDescendantsProxyModel` | Proxy model converting the resource tree into a flat list. The model may be restricted to specified alarm types. It can optionally be restricted to writable and/or enabled resources.
`ResourceCheckListModel` | `KCheckableProxyModel` | Proxy model providing a checkable list of all resources. An alarm type is specified, whereby resources which are enabled for that alarm type are checked; Resources which do not contain that alarm type, or which are disabled for that alarm type, are unchecked.
`ResourceFilterCheckListModel` | `QSortFilterProxyModel` | Proxy model providing a checkable resource list, filtered to contain only one alarm type. The selected alarm type may be changed as desired.
`EventListModel` | `QSortFilterProxyModel` | Proxy filter model providing all events of a specified alarm type (active alarms, archived alarms or alarm templates), in enabled resources.
`AlarmListModel` | `EventListModel` | Filter proxy model containing all alarms of specified types (active, archived, template), in enabled resources.
`TemplateListModel` | `EventListModel` | Filter proxy model containing alarm templates, optionally for specified alarm action types (display, command, etc.), in enabled resources.
`BirthdayModel` | `Akonadi::ContactsTreeModel` | Provides the model for all contacts.
`BirthdaySortModel` | `QSortFilterProxyModel` | Filters and sorts contacts for display.
`ResourceView` | `QListView` | View for a ResourceFilterCheckListModel.
`EventListView` | `QTreeView` | View for an EventListModel.
`AlarmListView` | `EventListView` | View showing a list of alarms.
`TemplateListView` | `EventListView` | View showing a list of alarm templates.
`EventListDelegate` | `QItemDelegate` | Delegate for an EventListView.
`AlarmListDelegate` | `EventListDelegate` | Delegate for an AlarmListView. Handles editing and display of the alarm list.
`TemplateListDelegate` | `EventListDelegate` | Delegate for a TemplateListView. Handles editing and display of the list of alarm templates.
Akonadi Resource and Event Classes
`AkonadiDataModel` | `Akonadi::EntityTreeModel, ResourceDataModelBase` | Contains all KAlarm collections and the items (alarms and templates) within them.
`CollectionSearch` | `QObject` | Fetches a list of all Akonadi collections which handle a specified mime type, and then optionally fetches or deletes all Items from them with a given GID.
`AkonadiResourceMigrator` | `QObject` | Migrates KResources alarm calendars from pre-Akonadi versions of KAlarm, and creates default calendar resources if none exist.
`AkonadiResourceCreator` | `ResourceCreator` | Interactively creates an Akonadi resource.
`AkonadiCalendarUpdater` | `CalendarUpdater` | Updates the backend calendar format of one Akonadi alarm calendar.