File indexing completed on 2024-04-21 03:52:53

0001 /*
0002   This file is part of the kcalcore library.
0003 
0004   SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher <schumacher@kde.org>
0005 
0006   SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 #ifndef KCALCORE_SCHEDULEMESSAGE_H
0009 #define KCALCORE_SCHEDULEMESSAGE_H
0010 
0011 #include "incidencebase.h"
0012 
0013 #include "kcalendarcore_export.h"
0014 
0015 namespace KCalendarCore
0016 {
0017 class IncidenceBase;
0018 
0019 /**
0020    iTIP methods.
0021 */
0022 enum iTIPMethod {
0023     iTIPPublish, /**< Event, to-do, journal or freebusy posting */
0024     iTIPRequest, /**< Event, to-do or freebusy scheduling request */
0025     iTIPReply, /**< Event, to-do or freebusy reply to request */
0026     iTIPAdd, /**< Event, to-do or journal additional property request */
0027     iTIPCancel, /**< Event, to-do or journal cancellation notice */
0028     iTIPRefresh, /**< Event or to-do description update request */
0029     iTIPCounter, /**< Event or to-do submit counter proposal */
0030     iTIPDeclineCounter, /**< Event or to-do decline a counter proposal */
0031     iTIPNoMethod, /**< No method */
0032 };
0033 
0034 /**
0035   @brief
0036   A Scheduling message class.
0037 
0038   This class provides an encapsulation of a scheduling message.
0039   It associates an incidence with an iTIPMethod and status information.
0040 */
0041 class KCALENDARCORE_EXPORT ScheduleMessage
0042 {
0043 public:
0044     /**
0045       Message status.
0046     */
0047     enum Status {
0048         PublishNew, /**< New message posting */
0049         PublishUpdate, /**< Updated message */
0050         Obsolete, /**< obsolete */
0051         RequestNew, /**< Request new message posting */
0052         RequestUpdate, /**< Request updated message */
0053         Unknown, /**< No status */
0054     };
0055 
0056     /**
0057       A shared pointer to a ScheduleMessage.
0058     */
0059     typedef QSharedPointer<ScheduleMessage> Ptr;
0060 
0061     /**
0062       Creates a scheduling message with method as defined in iTIPMethod and a status.
0063       @param incidence a pointer to a valid Incidence to be associated with this message.
0064       @param method an iTIPMethod.
0065       @param status a Status.
0066     */
0067     ScheduleMessage(const IncidenceBase::Ptr &incidence, iTIPMethod method, Status status);
0068 
0069     /**
0070       Destructor.
0071     */
0072     ~ScheduleMessage();
0073 
0074     /**
0075       Returns the event associated with this message.
0076     */
0077     IncidenceBase::Ptr event() const;
0078 
0079     /**
0080       Returns the iTIP method associated with this message.
0081     */
0082     Q_REQUIRED_RESULT iTIPMethod method() const;
0083 
0084     /**
0085       Returns a machine-readable (not translatable) name for a iTIP method.
0086       @param method an iTIPMethod.
0087     */
0088     Q_REQUIRED_RESULT static QString methodName(iTIPMethod method);
0089 
0090     /**
0091       Returns the status of this message.
0092     */
0093     Q_REQUIRED_RESULT Status status() const;
0094 
0095     /**
0096       Returns the error message if there is any.
0097     */
0098     Q_REQUIRED_RESULT QString error() const;
0099 
0100 private:
0101     //@cond PRIVATE
0102     Q_DISABLE_COPY(ScheduleMessage)
0103     class Private;
0104     Private *const d;
0105     //@endcond
0106 };
0107 
0108 }
0109 
0110 #endif