|
1 /* |
|
2 * Copyright (c) 2002-2009 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: Edit before send list pop-up query |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "emailtrace.h" |
|
21 #include "cesmrglobalnote.h" |
|
22 #include "esmrhelper.h"//locateresourcefile |
|
23 //<cmail> |
|
24 #include "esmrdef.h" |
|
25 //</cmail> |
|
26 #include <AknGlobalNote.h> |
|
27 #include <bautils.h> |
|
28 #include <esmrgui.rsg> |
|
29 #include <eikenv.h> |
|
30 #include <avkon.hrh> |
|
31 #include <data_caging_path_literals.hrh> |
|
32 |
|
33 // CONSTANTS |
|
34 // Unnamed namespace for local definitions |
|
35 namespace { |
|
36 |
|
37 _LIT(KResourceFileName,"esmrgui.rsc"); |
|
38 |
|
39 #ifdef _DEBUG |
|
40 |
|
41 // Panic literal |
|
42 _LIT( KESMRGlobalNote, "ESMRGlobalNote" ); |
|
43 |
|
44 /** |
|
45 * Panic codes |
|
46 */ |
|
47 enum TESMRGlobalNotePanic |
|
48 { |
|
49 ENoteStringNotFound // Note string not found |
|
50 }; |
|
51 |
|
52 /** |
|
53 * Raises system panic |
|
54 */ |
|
55 void Panic( TESMRGlobalNotePanic aPanic ) |
|
56 { |
|
57 User::Panic( KESMRGlobalNote, aPanic ); |
|
58 } |
|
59 |
|
60 #endif // _DEBUG |
|
61 |
|
62 } // namespace |
|
63 |
|
64 // ======== MEMBER FUNCTIONS ======== |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CESMRGlobalNote::CESMRGlobalNote |
|
68 // C++ default constructor can NOT contain any code, that |
|
69 // might leave. |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 CESMRGlobalNote::CESMRGlobalNote( |
|
73 TESMGlobalNoteType aType) |
|
74 : iType(aType) |
|
75 { |
|
76 FUNC_LOG; |
|
77 // Do nothing |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CESMRGlobalNote::~CESMRGlobalNote |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 CESMRGlobalNote::~CESMRGlobalNote() |
|
85 { |
|
86 FUNC_LOG; |
|
87 iEnv->DeleteResourceFile(iResourceOffset); |
|
88 } |
|
89 |
|
90 // ----------------------------------------------------------------------------- |
|
91 // CESMRGlobalNote::NewL |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 EXPORT_C CESMRGlobalNote* CESMRGlobalNote::NewL( |
|
95 TESMGlobalNoteType aType) |
|
96 { |
|
97 FUNC_LOG; |
|
98 CESMRGlobalNote* self = |
|
99 new (ELeave) CESMRGlobalNote(aType); |
|
100 CleanupStack::PushL( self ); |
|
101 self->ConstructL( ); |
|
102 CleanupStack::Pop( self ); |
|
103 return self; |
|
104 } |
|
105 |
|
106 // ----------------------------------------------------------------------------- |
|
107 // CESMRGlobalNote::ConstructL |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 void CESMRGlobalNote::ConstructL() |
|
111 { |
|
112 FUNC_LOG; |
|
113 TFileName filename; |
|
114 iEnv = CEikonEnv::Static();// codescanner::eikonenvstatic |
|
115 |
|
116 ESMRHelper::LocateResourceFile( |
|
117 KResourceFileName, |
|
118 KDC_RESOURCE_FILES_DIR, |
|
119 filename, |
|
120 &iEnv->FsSession() ); |
|
121 |
|
122 |
|
123 //for localization |
|
124 BaflUtils::NearestLanguageFile(iEnv->FsSession(),filename); |
|
125 iResourceOffset = iEnv->AddResourceFileL(filename); |
|
126 } |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // CESMRGlobalNote::ExecuteL |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 EXPORT_C void CESMRGlobalNote::ExecuteL(TESMGlobalNoteType aType) |
|
133 { |
|
134 FUNC_LOG; |
|
135 CESMRGlobalNote* query = CESMRGlobalNote::NewL( aType ); |
|
136 CleanupStack::PushL(query); |
|
137 query->ExecuteLD(); |
|
138 CleanupStack::Pop(query); |
|
139 } |
|
140 |
|
141 // ----------------------------------------------------------------------------- |
|
142 // CESMRGlobalNote::NoteType |
|
143 // ----------------------------------------------------------------------------- |
|
144 // |
|
145 TAknGlobalNoteType CESMRGlobalNote::NoteType() |
|
146 { |
|
147 FUNC_LOG; |
|
148 TAknGlobalNoteType type(EAknGlobalInformationNote); |
|
149 switch ( iType ) |
|
150 { |
|
151 case EESMRCorruptedMR: |
|
152 { |
|
153 type = EAknGlobalErrorNote; |
|
154 break; |
|
155 } |
|
156 case EESMRCalenLaterDate: // FALLTHROUGH |
|
157 case EESMREndsBeforeStarts: // FALLTHROUGH |
|
158 case EESMREntryEndEarlierThanItStart: // FALLTHROUGH |
|
159 case EESMRRepeatEndEarlierThanItStart: // FALLTHROUGH |
|
160 case EESMRAlarmAlreadyPassed: // FALLTHROUGH |
|
161 case EESMRDiffMoreThanMonth: // FALLTHROUGH |
|
162 case EESMREntrySaved: // FALLTHROUGH |
|
163 case EESMRTodoEntrySaved: // FALLTHROUGH |
|
164 case EESMRRepeatDifferentStartAndEndDate: |
|
165 case EESMRRepeatReSchedule: |
|
166 case EESMRCannotDisplayMuchMore: |
|
167 case EESMRRepeatInstanceTooEarly: |
|
168 { |
|
169 type = EAknGlobalInformationNote; |
|
170 break; |
|
171 } |
|
172 default: |
|
173 { |
|
174 break; |
|
175 } |
|
176 } |
|
177 return type; |
|
178 } |
|
179 |
|
180 // ----------------------------------------------------------------------------- |
|
181 // CESMRGlobalNote::NoteTextLC |
|
182 // ----------------------------------------------------------------------------- |
|
183 // |
|
184 HBufC* CESMRGlobalNote::NoteTextLC() |
|
185 { |
|
186 FUNC_LOG; |
|
187 HBufC* noteText = NULL; |
|
188 switch ( iType ) |
|
189 { |
|
190 case EESMRCorruptedMR: |
|
191 { |
|
192 noteText = iEnv->AllocReadResourceAsDes16LC( |
|
193 R_QTN_MEET_REQ_CORRUPTED_NOTE); |
|
194 break; |
|
195 } |
|
196 case EESMREndsBeforeStarts: |
|
197 { |
|
198 noteText = iEnv->AllocReadResourceAsDes16LC( |
|
199 R_QTN_MEET_REQ_INFO_NOTE_ENDS_BEFORE); |
|
200 break; |
|
201 } |
|
202 case EESMRCalenLaterDate: |
|
203 { |
|
204 noteText = iEnv->AllocReadResourceAsDes16LC( |
|
205 R_QTN_MEET_REQ_LATER_DATE); |
|
206 break; |
|
207 } |
|
208 case EESMREntryEndEarlierThanItStart: |
|
209 { |
|
210 noteText = iEnv->AllocReadResourceAsDes16LC( |
|
211 R_QTN_MEET_REQ_INFO_NOTE_ENDS_BEFORE ); |
|
212 break; |
|
213 } |
|
214 case EESMRRepeatEndEarlierThanItStart: |
|
215 { |
|
216 noteText = iEnv->AllocReadResourceAsDes16LC( |
|
217 R_QTN_CALENDAR_INFO_REPEAT_INVALID ); |
|
218 break; |
|
219 } |
|
220 case EESMRAlarmAlreadyPassed: |
|
221 { |
|
222 noteText = iEnv->AllocReadResourceAsDes16LC( |
|
223 R_QTN_CALENDAR_ALARM_PASSED ); |
|
224 break; |
|
225 } |
|
226 case EESMRDiffMoreThanMonth: |
|
227 { |
|
228 noteText = iEnv->AllocReadResourceAsDes16LC( |
|
229 R_QTN_CALENDAR_ALARM_DIFFERENCE ); |
|
230 break; |
|
231 } |
|
232 case EESMREntrySaved: |
|
233 { |
|
234 noteText = iEnv->AllocReadResourceAsDes16LC( |
|
235 R_QTN_MEET_REQ_NOTE_SAVED ); |
|
236 break; |
|
237 } |
|
238 case EESMRTodoEntrySaved: |
|
239 { |
|
240 noteText = iEnv->AllocReadResourceAsDes16LC( |
|
241 R_QTN_MEET_REQ_TODO_SAVED ); |
|
242 break; |
|
243 } |
|
244 case EESMRRepeatDifferentStartAndEndDate: |
|
245 { |
|
246 noteText = iEnv->AllocReadResourceAsDes16LC( |
|
247 R_QTN_MEET_REQ_INFO_START_END_DATE ); |
|
248 } |
|
249 break; |
|
250 case EESMRRepeatReSchedule: |
|
251 { |
|
252 noteText = iEnv->AllocReadResourceAsDes16LC( |
|
253 R_MEET_REQ_RESCHEDULE_INSTANCE ); |
|
254 } |
|
255 break; |
|
256 case EESMRCannotDisplayMuchMore: |
|
257 { |
|
258 noteText = iEnv->AllocReadResourceAsDes16LC( |
|
259 R_QTN_MEET_REQ_LONG_DESCRIPTION ); |
|
260 } |
|
261 break; |
|
262 case EESMRRepeatInstanceTooEarly: |
|
263 { |
|
264 noteText = iEnv->AllocReadResourceAsDes16LC( |
|
265 R_MEET_REQ_INSTANCE_STARTS_EARLIER_THAN_SERIES ); |
|
266 } |
|
267 break; |
|
268 case EESMRUnableToEdit: |
|
269 { |
|
270 noteText = iEnv->AllocReadResourceAsDes16LC( |
|
271 R_QTN_MEET_REQ_INFO_FIELD_LOCKED ); |
|
272 } |
|
273 break; |
|
274 case EESMROverlapsExistingInstance: |
|
275 { |
|
276 noteText = iEnv->AllocReadResourceAsDes16LC( |
|
277 R_MEET_REQ_INSTANCE_OVERLAPS_EXISTING_INSTANCE ); |
|
278 } |
|
279 break; |
|
280 case EESMRInstanceAlreadyExistsOnThisDay: |
|
281 { |
|
282 noteText = iEnv->AllocReadResourceAsDes16LC( |
|
283 R_MEET_REQ_INSTANCE_ALREADY_EXISTS_ON_THIS_DAY ); |
|
284 } |
|
285 break; |
|
286 case EESMRInstanceOutOfSequence: |
|
287 { |
|
288 noteText = iEnv->AllocReadResourceAsDes16LC( |
|
289 R_MEET_REQ_INSTANCE_OUT_OF_SEQUENCE ); |
|
290 } |
|
291 break; |
|
292 default: |
|
293 { |
|
294 break; |
|
295 } |
|
296 } |
|
297 |
|
298 __ASSERT_DEBUG( noteText, Panic( ENoteStringNotFound) ); |
|
299 return noteText; |
|
300 } |
|
301 |
|
302 // ----------------------------------------------------------------------------- |
|
303 // CESMRGlobalNote::ExecuteLD |
|
304 // ----------------------------------------------------------------------------- |
|
305 // |
|
306 EXPORT_C void CESMRGlobalNote::ExecuteLD() |
|
307 { |
|
308 FUNC_LOG; |
|
309 CAknGlobalNote* note = CAknGlobalNote::NewLC(); |
|
310 HBufC* noteText = NoteTextLC(); |
|
311 |
|
312 note->ShowNoteL( |
|
313 NoteType(), |
|
314 *noteText ); |
|
315 |
|
316 CleanupStack::PopAndDestroy( noteText ); |
|
317 noteText = NULL; |
|
318 |
|
319 CleanupStack::PopAndDestroy( note ); |
|
320 note = NULL; |
|
321 |
|
322 // Deleting 'this' object because this id D-method. |
|
323 delete this; |
|
324 } |
|
325 |
|
326 // EOF |
|
327 |