Description: KAlarm

# KAlarm Design Notes

See the KAlarm calendar design notes (DESIGN-calendar.html) for details of calendar storage.

## Classes

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

Class | Base class | Description
--- | --- | ---
`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. This class is only used to access KOrganizer collections.

### 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 class which provides functions independent of which data model type (Akonadi or file resource) 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.
`DirResourceImportDialog` | `KAssistantDialog` | Dialogue for importing a calendar directory resource. For use when migrating Akonadi alarm calendars.
Akonadi Resource and Event Classes
`AkonadiDataModel` | `Akonadi::EntityTreeModel, ResourceDataModelBase` | Contains all KAlarm collections and the items (alarms and templates) within them.
`AkonadiResource` | `ResourceType` | An Akonadi calendar resource.
`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.
Non-Akonadi Resource and Event Classes
`FileResourceDataModel` | `QAbstractItemModel, ResourceDataModelBase` | Model containing all file system calendar resources and the events (alarms and templates) within them.
`FileResource` | `ResourceType` | Abstract base class for a file system calendar resource.
`SingleFileResource` | `FileResource` | A file system calendar resource held in a single file.
`SingleFileResourceConfigDialog` | `QDialog` | Configuration dialogue for a SingleFileResource resource.
`FileResourceMigrator` | `QObject` | Migrates Akonadi or KResources alarm calendars from previous versions of KAlarm, and creates default calendar resources if none exist.
`FileResourceCreator` | `ResourceCreator` | Interactively creates a file resource.
`FileResourceConfigManager` | `` | Manager for file system resource configuration files. Reads configuration files and creates resources at startup, and updates configuration files with resource configuration changes.
`FileResourceSettings` | `` | Encapsulates the configuration settings of a file system resource.
`FileResourceCalendarUpdater` | `CalendarUpdater` | Updates the backend calendar format of one file resource alarm calendar.