File indexing completed on 2024-11-24 04:42:28
0001 /* 0002 * datamodel.h - model independent access to calendar functions 0003 * Program: kalarm 0004 * SPDX-FileCopyrightText: 2019-2022 David Jarvie <djarvie@kde.org> 0005 * 0006 * SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #pragma once 0010 0011 #include "kalarmcalendar/kacalendar.h" 0012 0013 class Resource; 0014 class ResourceListModel; 0015 class ResourceFilterCheckListModel; 0016 class AlarmListModel; 0017 class TemplateListModel; 0018 class ResourceCreator; 0019 0020 0021 /*============================================================================= 0022 = Class: DataModel 0023 = Static methods providing model independent access to the resource data model. 0024 =============================================================================*/ 0025 class DataModel 0026 { 0027 public: 0028 /** Initialise the data model. */ 0029 static void initialise(); 0030 0031 /** Terminate access to the data model, and tidy up. */ 0032 static void terminate(); 0033 0034 /** Reload all resources' data from storage. 0035 * @note In the case of Akonadi, this does not reload from the backend storage. 0036 */ 0037 static void reload(); 0038 0039 /** Reload a resource's data from storage. 0040 * @note In the case of Akonadi, this does not reload from the backend storage. 0041 */ 0042 static bool reload(Resource&); 0043 0044 /** Return whether calendar migration/creation at initialisation has completed. */ 0045 static bool isMigrationComplete(); 0046 0047 /** Check for, and remove, any duplicate resources, i.e. those which use 0048 * the same calendar file/directory. 0049 */ 0050 static void removeDuplicateResources(); 0051 0052 /** Disable the widget if the database engine is not available, and display an 0053 * error overlay. 0054 */ 0055 static void widgetNeedsDatabase(QWidget*); 0056 0057 /** Create a ResourceCreator instance for the model. */ 0058 static ResourceCreator* createResourceCreator(KAlarmCal::CalEvent::Type defaultType, QWidget* parent); 0059 0060 /** Update a resource's backend calendar file to the current KAlarm format. */ 0061 static void updateCalendarToCurrentFormat(Resource&, bool ignoreKeepFormat, QObject* parent); 0062 0063 static ResourceListModel* createResourceListModel(QObject* parent); 0064 static ResourceFilterCheckListModel* createResourceFilterCheckListModel(QObject* parent); 0065 static AlarmListModel* createAlarmListModel(QObject* parent); 0066 static AlarmListModel* allAlarmListModel(); 0067 static TemplateListModel* createTemplateListModel(QObject* parent); 0068 static TemplateListModel* allTemplateListModel(); 0069 }; 0070 0071 // vim: et sw=4: