Warning, file /pim/kalarm/src/displaycalendar.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  *  displaycalendar.h  -  KAlarm display calendar file access
0003  *  Program:  kalarm
0004  *  SPDX-FileCopyrightText: 2001-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/kaevent.h"
0012 
0013 #include <KCalendarCore/FileStorage>
0014 #include <KCalendarCore/Event>
0015 
0016 #include <QHash>
0017 
0018 using namespace KAlarmCal;
0019 
0020 
0021 /** Provides read and write access to the display calendar.
0022  *  This stores alarms currently being displayed, to enable them to be
0023  *  redisplayed if KAlarm is killed and restarted.
0024  */
0025 class DisplayCalendar
0026 {
0027 public:
0028     static bool                       save();
0029     static KCalendarCore::Event::Ptr  kcalEvent(const QString& uniqueID);
0030     static KCalendarCore::Event::List kcalEvents(CalEvent::Type s = CalEvent::EMPTY);
0031     static bool                       addEvent(KAEvent&);
0032     static bool                       deleteEvent(const QString& eventID, bool save = false);
0033     static bool                       isOpen()               { return mInitialised && mOpen; }
0034     static void                       adjustStartOfDay();
0035 
0036     static void                       initialise();
0037     static bool                       open();
0038     static void                       terminate();
0039 
0040 private:
0041     enum CalType { LOCAL_ICAL, LOCAL_VCAL };
0042 
0043     static int                        load();
0044     static void                       close();
0045     static bool                       saveCal(const QString& newFile = QString());
0046     static bool                       isValid()    { return !mCalendarStorage.isNull(); }
0047     static void                       updateKAEvents();
0048 
0049     static bool                       mInitialised;        // whether the calendar has been initialised
0050     static KAEvent::List              mEventList;
0051     static QHash<QString, KAEvent*>   mEventMap;           // lookup of all events by UID
0052     static KCalendarCore::FileStorage::Ptr mCalendarStorage;
0053     static QString                    mDisplayCalPath;     // path of display calendar file
0054     static QString                    mDisplayICalPath;    // path of display iCalendar file
0055     static CalType                    mCalType;            // mCalendar's type (ical/vcal)
0056     static bool                       mOpen;               // true if the calendar file is open
0057 };
0058 
0059 // vim: et sw=4: