File indexing completed on 2024-11-24 04:42:24

0001 /*
0002  *  kaeventformatter.h  -  converts KAlarmCal::KAEvent properties to text
0003  *  SPDX-FileCopyrightText: 2010-2022 David Jarvie <djarvie@kde.org>
0004  *
0005  *  SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 #pragma once
0009 
0010 #include <kalarmcal/kaevent.h>
0011 
0012 #include <QString>
0013 
0014 using namespace KAlarmCal;
0015 
0016 class KAEventFormatter
0017 {
0018 public:
0019     // KAEvent parameter identifiers.
0020     // Note that parameters stored in Akonadi attributes are not included.
0021     enum Parameter
0022     {
0023         Id,
0024         AlarmType,
0025         AlarmCategory,
0026         Name,
0027         TemplateName,
0028         CreatedTime,
0029         StartTime,
0030         TemplateAfterTime,
0031         Recurs,             // does the event recur?
0032         Recurrence,
0033         NextRecurrence,     // next alarm time excluding repetitions, including reminder/deferral
0034         SubRepetition,      // is there a sub-repetition?
0035         RepeatInterval,
0036         RepeatCount,
0037         NextRepetition,     // next repetition count
0038         LateCancel,
0039         AutoClose,
0040         WorkTimeOnly,
0041         HolidaysExcluded,
0042         CopyKOrganizer,
0043         Enabled,
0044         ReadOnly,
0045         Archive,
0046         Revision,
0047         CustomProperties,
0048 
0049         MessageText,
0050         MessageFile,
0051         FgColour,
0052         BgColour,
0053         Font,
0054         PreAction,
0055         PreActionCancel,
0056         PreActionNoError,
0057         PostAction,
0058         ConfirmAck,
0059         AkonadiItem,
0060         Sound,
0061         SoundRepeat,
0062         SoundVolume,
0063         SoundFadeVolume,
0064         SoundFadeTime,
0065         Reminder,
0066         ReminderOnce,
0067         Notify,
0068         DeferralType,
0069         DeferralTime,
0070         DeferDefault,
0071         DeferDefaultDate,
0072 
0073         Command,
0074         LogFile,
0075         CommandXTerm,
0076         CommandHideError,
0077 
0078         EmailSubject,
0079         EmailFromId,
0080         EmailTo,
0081         EmailBcc,
0082         EmailBody,
0083         EmailAttachments
0084     };
0085 
0086     KAEventFormatter() = default;
0087 
0088     KAEventFormatter(const KAEvent& e, bool falseForUnspecified);
0089     bool isApplicable(Parameter) const;
0090     QString value(Parameter) const;
0091     const KAEvent& event() const
0092     {
0093         return mEvent;
0094     }
0095 
0096     static QString label(Parameter);
0097 
0098 private:
0099     KAEvent mEvent;
0100     QString mUnspecifiedValue;
0101 };
0102 
0103 // vim: et sw=4: