1 | /* |
2 | This file is part of the kcalcore library. |
3 | |
4 | Copyright (c) 2001,2004 Cornelius Schumacher <schumacher@kde.org> |
5 | Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com> |
6 | |
7 | This library is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU Library General Public |
9 | License as published by the Free Software Foundation; either |
10 | version 2 of the License, or (at your option) any later version. |
11 | |
12 | This library is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | Library General Public License for more details. |
16 | |
17 | You should have received a copy of the GNU Library General Public License |
18 | along with this library; see the file COPYING.LIB. If not, write to |
19 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 | Boston, MA 02110-1301, USA. |
21 | */ |
22 | |
23 | #include "schedulemessage.h" |
24 | #include "incidencebase.h" |
25 | |
26 | #include <QtCore/QString> |
27 | |
28 | using namespace KCalCore; |
29 | |
30 | //@cond PRIVATE |
31 | class KCalCore::ScheduleMessage::Private |
32 | { |
33 | public: |
34 | Private() {} |
35 | |
36 | IncidenceBase::Ptr mIncidence; |
37 | iTIPMethod mMethod; |
38 | Status mStatus; |
39 | QString mError; |
40 | |
41 | ~Private() {} |
42 | }; |
43 | //@endcond |
44 | |
45 | ScheduleMessage::ScheduleMessage(IncidenceBase::Ptr incidence, |
46 | iTIPMethod method, |
47 | ScheduleMessage::Status status) |
48 | : d(new KCalCore::ScheduleMessage::Private) |
49 | { |
50 | d->mIncidence = incidence; |
51 | d->mMethod = method; |
52 | d->mStatus = status; |
53 | } |
54 | |
55 | ScheduleMessage::~ScheduleMessage() |
56 | { |
57 | delete d; |
58 | } |
59 | |
60 | IncidenceBase::Ptr ScheduleMessage::event() const |
61 | { |
62 | return d->mIncidence; |
63 | } |
64 | |
65 | iTIPMethod ScheduleMessage::method() const |
66 | { |
67 | return d->mMethod; |
68 | } |
69 | |
70 | QString ScheduleMessage::methodName(iTIPMethod method) |
71 | { |
72 | switch (method) { |
73 | case iTIPPublish: |
74 | return QLatin1String("Publish" ); |
75 | case iTIPRequest: |
76 | return QLatin1String("Request" ); |
77 | case iTIPRefresh: |
78 | return QLatin1String("Refresh" ); |
79 | case iTIPCancel: |
80 | return QLatin1String("Cancel" ); |
81 | case iTIPAdd: |
82 | return QLatin1String("Add" ); |
83 | case iTIPReply: |
84 | return QLatin1String("Reply" ); |
85 | case iTIPCounter: |
86 | return QLatin1String("Counter" ); |
87 | case iTIPDeclineCounter: |
88 | return QLatin1String("Decline Counter" ); |
89 | default: |
90 | return QLatin1String("Unknown" ); |
91 | } |
92 | } |
93 | |
94 | ScheduleMessage::Status ScheduleMessage::status() const |
95 | { |
96 | return d->mStatus; |
97 | } |
98 | |
99 | QString ScheduleMessage::error() const |
100 | { |
101 | return d->mError; |
102 | } |
103 | |