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, 2004 Cornelius Schumacher <schumacher@kde.org>
0005   SPDX-FileCopyrightText: 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
0006 
0007   SPDX-License-Identifier: LGPL-2.0-or-later
0008 */
0009 
0010 #include "schedulemessage.h"
0011 
0012 #include <QString>
0013 
0014 using namespace KCalendarCore;
0015 
0016 //@cond PRIVATE
0017 class Q_DECL_HIDDEN KCalendarCore::ScheduleMessage::Private
0018 {
0019 public:
0020     Private()
0021     {
0022     }
0023 
0024     IncidenceBase::Ptr mIncidence;
0025     iTIPMethod mMethod;
0026     Status mStatus;
0027     QString mError;
0028 
0029     ~Private()
0030     {
0031     }
0032 };
0033 //@endcond
0034 
0035 ScheduleMessage::ScheduleMessage(const IncidenceBase::Ptr &incidence, iTIPMethod method, ScheduleMessage::Status status)
0036     : d(new KCalendarCore::ScheduleMessage::Private)
0037 {
0038     d->mIncidence = incidence;
0039     d->mMethod = method;
0040     d->mStatus = status;
0041 }
0042 
0043 ScheduleMessage::~ScheduleMessage()
0044 {
0045     delete d;
0046 }
0047 
0048 IncidenceBase::Ptr ScheduleMessage::event() const
0049 {
0050     return d->mIncidence;
0051 }
0052 
0053 iTIPMethod ScheduleMessage::method() const
0054 {
0055     return d->mMethod;
0056 }
0057 
0058 QString ScheduleMessage::methodName(iTIPMethod method)
0059 {
0060     switch (method) {
0061     case iTIPPublish:
0062         return QStringLiteral("Publish");
0063     case iTIPRequest:
0064         return QStringLiteral("Request");
0065     case iTIPRefresh:
0066         return QStringLiteral("Refresh");
0067     case iTIPCancel:
0068         return QStringLiteral("Cancel");
0069     case iTIPAdd:
0070         return QStringLiteral("Add");
0071     case iTIPReply:
0072         return QStringLiteral("Reply");
0073     case iTIPCounter:
0074         return QStringLiteral("Counter");
0075     case iTIPDeclineCounter:
0076         return QStringLiteral("Decline Counter");
0077     default:
0078         return QStringLiteral("Unknown");
0079     }
0080 }
0081 
0082 ScheduleMessage::Status ScheduleMessage::status() const
0083 {
0084     return d->mStatus;
0085 }
0086 
0087 QString ScheduleMessage::error() const
0088 {
0089     return d->mError;
0090 }