1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Concrete Class for Location Events. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // System Includes |
|
20 |
|
21 // User Includes |
|
22 #include "evtevent.h" |
|
23 #include "evtaction.h" |
|
24 |
|
25 // ================ Member funtions for CEvtEvent class ====================== |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // CEvtEvent::CEvtEvent |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 CEvtEvent::CEvtEvent(): |
|
32 iEventId( 0 ), |
|
33 iEventStatus( EDraft ), |
|
34 iRadius( 0.1 ), |
|
35 iRepeat( EFalse ) |
|
36 { |
|
37 } |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // CEvtEvent::~CEvtEvent |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 CEvtEvent::~CEvtEvent() |
|
44 { |
|
45 delete iSubject; |
|
46 delete iPlace; |
|
47 delete iDescription; |
|
48 if( iAction ) |
|
49 delete iAction; |
|
50 delete iLocation; |
|
51 } |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // CEvtEvent::NewL |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 EXPORT_C CEvtEvent* CEvtEvent::NewL() |
|
58 { |
|
59 CEvtEvent* self = NewLC( ); |
|
60 CleanupStack::Pop( self ); |
|
61 return self; |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // CEvtEvent::NewLC |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 EXPORT_C CEvtEvent* CEvtEvent::NewLC() |
|
69 { |
|
70 CEvtEvent* self = new ( ELeave )CEvtEvent( ); |
|
71 CleanupStack::PushL( self ); |
|
72 self->ConstructL( ); |
|
73 return self; |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // CEvtEvent::ConstructL |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 EXPORT_C void CEvtEvent::ConstructL() |
|
81 { |
|
82 // Allocate the Null string by default |
|
83 iSubject = KNullDesC().AllocL(); |
|
84 iPlace = KNullDesC().AllocL(); |
|
85 iDescription = KNullDesC().AllocL(); |
|
86 iLocation = new TPosition(); |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // CEvtEvent::EventId |
|
91 // --------------------------------------------------------------------------- |
|
92 // |
|
93 EXPORT_C TEvtEventId CEvtEvent::EventId() const |
|
94 { |
|
95 return iEventId; |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------------------------- |
|
99 // CEvtEvent::SetEventId |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 EXPORT_C void CEvtEvent::SetEventId( const TEvtEventId aId ) |
|
103 { |
|
104 iEventId = aId; |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------------------------- |
|
108 // CEvtEvent::Subject |
|
109 // --------------------------------------------------------------------------- |
|
110 // |
|
111 EXPORT_C TPtrC CEvtEvent::Subject() const |
|
112 { |
|
113 return iSubject->Des(); |
|
114 } |
|
115 |
|
116 // --------------------------------------------------------------------------- |
|
117 // CEvtEvent::SetSubjectL |
|
118 // --------------------------------------------------------------------------- |
|
119 // |
|
120 EXPORT_C void CEvtEvent::SetSubjectL( const TDesC& aSubject ) |
|
121 { |
|
122 delete iSubject; |
|
123 iSubject = NULL; |
|
124 iSubject = aSubject.AllocL(); |
|
125 } |
|
126 |
|
127 // --------------------------------------------------------------------------- |
|
128 // CEvtEvent::Place |
|
129 // --------------------------------------------------------------------------- |
|
130 // |
|
131 EXPORT_C TPtrC CEvtEvent::Place() const |
|
132 { |
|
133 return *iPlace; |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------------------------- |
|
137 // CEvtEvent::SetPlaceL |
|
138 // --------------------------------------------------------------------------- |
|
139 // |
|
140 EXPORT_C void CEvtEvent::SetPlaceL( const TDesC& aPlace ) |
|
141 { |
|
142 delete iPlace; |
|
143 iPlace = NULL; |
|
144 iPlace = aPlace.AllocL(); |
|
145 } |
|
146 |
|
147 // --------------------------------------------------------------------------- |
|
148 // CEvtEvent::EventStatus |
|
149 // --------------------------------------------------------------------------- |
|
150 // |
|
151 EXPORT_C TEvtEventStatus CEvtEvent::EventStatus() const |
|
152 { |
|
153 return iEventStatus; |
|
154 } |
|
155 |
|
156 // --------------------------------------------------------------------------- |
|
157 // CEvtEvent::SetEventStatus |
|
158 // --------------------------------------------------------------------------- |
|
159 // |
|
160 EXPORT_C void CEvtEvent::SetEventStatus( |
|
161 const TEvtEventStatus aEventStatus ) |
|
162 { |
|
163 iEventStatus = aEventStatus; |
|
164 } |
|
165 |
|
166 // --------------------------------------------------------------------------- |
|
167 // CEvtEvent::Radius |
|
168 // --------------------------------------------------------------------------- |
|
169 // |
|
170 EXPORT_C TReal CEvtEvent::Radius() const |
|
171 { |
|
172 return iRadius; |
|
173 } |
|
174 |
|
175 // --------------------------------------------------------------------------- |
|
176 // CEvtEvent::SetRadius |
|
177 // radius will always be in km. |
|
178 // --------------------------------------------------------------------------- |
|
179 // |
|
180 EXPORT_C void CEvtEvent::SetRadius( const TReal aRadius ) |
|
181 { |
|
182 iRadius = aRadius; |
|
183 } |
|
184 |
|
185 // --------------------------------------------------------------------------- |
|
186 // CEvtEvent::Repeat |
|
187 // --------------------------------------------------------------------------- |
|
188 // |
|
189 EXPORT_C TBool CEvtEvent::Repeat() const |
|
190 { |
|
191 return iRepeat; |
|
192 } |
|
193 |
|
194 // --------------------------------------------------------------------------- |
|
195 // CEvtEvent::SetRepeat |
|
196 // --------------------------------------------------------------------------- |
|
197 // |
|
198 EXPORT_C void CEvtEvent::SetRepeat( const TBool aRepeat ) |
|
199 { |
|
200 iRepeat = aRepeat; |
|
201 } |
|
202 |
|
203 // --------------------------------------------------------------------------- |
|
204 // CEvtEvent::Description |
|
205 // --------------------------------------------------------------------------- |
|
206 // |
|
207 EXPORT_C TPtrC CEvtEvent::Description() const |
|
208 { |
|
209 return iDescription->Des(); |
|
210 } |
|
211 |
|
212 // --------------------------------------------------------------------------- |
|
213 // CEvtEvent::SetDescriptionL |
|
214 // --------------------------------------------------------------------------- |
|
215 // |
|
216 EXPORT_C void CEvtEvent::SetDescriptionL( const TDesC& aDescription ) |
|
217 { |
|
218 delete iDescription; |
|
219 iDescription = NULL; |
|
220 iDescription = aDescription.AllocL(); |
|
221 } |
|
222 |
|
223 // --------------------------------------------------------------------------- |
|
224 // CEvtEvent::Action |
|
225 // --------------------------------------------------------------------------- |
|
226 // |
|
227 EXPORT_C CEvtAction& CEvtEvent::Action() const |
|
228 { |
|
229 return *iAction; |
|
230 } |
|
231 |
|
232 // --------------------------------------------------------------------------- |
|
233 // CEvtEvent::SetActionL |
|
234 // --------------------------------------------------------------------------- |
|
235 // |
|
236 EXPORT_C void CEvtEvent::SetActionL( CEvtAction* aAction ) |
|
237 { |
|
238 // Clear Action , if the aAction is NULL |
|
239 if( !aAction ) |
|
240 { |
|
241 if( iAction ) |
|
242 { |
|
243 delete iAction; |
|
244 iAction = NULL; |
|
245 } |
|
246 return; |
|
247 } |
|
248 |
|
249 // Set the Action Id and String if aAction is present. |
|
250 TInt64 id = aAction->Id(); |
|
251 if(iAction) |
|
252 { |
|
253 id = iAction->Id(); |
|
254 delete iAction; |
|
255 iAction = NULL; |
|
256 } |
|
257 iAction = aAction; |
|
258 iAction->SetId( id ); |
|
259 iAction->SetEvtId(EventId()); |
|
260 } |
|
261 |
|
262 // --------------------------------------------------------------------------- |
|
263 // CEvtEvent::HasAction |
|
264 // --------------------------------------------------------------------------- |
|
265 // |
|
266 EXPORT_C TBool CEvtEvent::HasAction( ) |
|
267 { |
|
268 return (iAction)?ETrue:EFalse; |
|
269 } |
|
270 |
|
271 // --------------------------------------------------------------------------- |
|
272 // CEvtEvent::Location |
|
273 // --------------------------------------------------------------------------- |
|
274 // |
|
275 EXPORT_C TPosition& CEvtEvent::Location() const |
|
276 { |
|
277 return *iLocation; |
|
278 } |
|
279 |
|
280 // --------------------------------------------------------------------------- |
|
281 // CEvtEvent::HasAction |
|
282 // --------------------------------------------------------------------------- |
|
283 // |
|
284 void CEvtEvent::SetLocationL(TPosition& aLocation) |
|
285 { |
|
286 *iLocation = aLocation; |
|
287 } |
|
288 // End of File |
|