|
1 /* |
|
2 * Copyright (c) 2002 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: SMSICDMA.CPP* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 // Standard includes |
|
21 #include <mtmdef.h> // MTM specific definitions for constants |
|
22 #include <eikon.rsg> // Standard resources |
|
23 // Messaging includes |
|
24 #include <msvuids.h> // Msv UIDs |
|
25 // Specific includes |
|
26 #include <smum.rsg> // for resource IDs |
|
27 #include <muiu.mbg> // bitmaps |
|
28 #include <avkon.rsg> // for resource IDs |
|
29 #include <StringLoader.h> // StringLoader |
|
30 #include "smsicdma.h" |
|
31 #include "smsu.hrh" // for KMtmUiFunctionSimDialog |
|
32 #include "smsui.pan" // for panics |
|
33 #include <aknsutils.h> |
|
34 #include <aknsconstants.h> // skinned icon ids |
|
35 #include <data_caging_path_literals.hrh>// Path for Bitmap |
|
36 |
|
37 // LOCAL CONSTANTS AND MACROS |
|
38 const TInt KSmsiNumberOfZoomStates = 2; // Nothing to do with zoomstates, picture + mask = 2 |
|
39 const TUid KUidMsgTypeSMS = {0x1000102C}; |
|
40 |
|
41 _LIT(KBitmapFile, "muiu.MBM"); |
|
42 |
|
43 // MEMBER FUNCTIONS |
|
44 |
|
45 // Factory constructor function |
|
46 CSmsMtmUiDataCDMA* CSmsMtmUiDataCDMA::NewL( CRegisteredMtmDll& aRegisteredDll ) |
|
47 { |
|
48 CSmsMtmUiDataCDMA* smsmtmuidata=new ( ELeave ) CSmsMtmUiDataCDMA( aRegisteredDll ); |
|
49 CleanupStack::PushL( smsmtmuidata ); |
|
50 smsmtmuidata->ConstructL(); |
|
51 CleanupStack::Pop(); |
|
52 return smsmtmuidata; |
|
53 } |
|
54 |
|
55 // C++ constructor can NOT contain any code, that |
|
56 // might leave. |
|
57 CSmsMtmUiDataCDMA::CSmsMtmUiDataCDMA( CRegisteredMtmDll& aRegisteredDll ): |
|
58 CSmsMtmUiData( aRegisteredDll ) |
|
59 { |
|
60 } |
|
61 |
|
62 // Destructor |
|
63 CSmsMtmUiDataCDMA::~CSmsMtmUiDataCDMA() |
|
64 { |
|
65 } |
|
66 |
|
67 // --------------------------------------------------------- |
|
68 // CSmsMtmUiData::ContextIcon |
|
69 // |
|
70 // --------------------------------------------------------- |
|
71 const CBaseMtmUiData::CBitmapArray& CSmsMtmUiDataCDMA::ContextIcon( |
|
72 const TMsvEntry& aContext, |
|
73 TInt /*aStateFlags*/ ) const |
|
74 { |
|
75 __ASSERT_DEBUG(aContext.iMtm==KUidMsgTypeSMS, Panic(ESmsiWrongMtm)); |
|
76 __ASSERT_DEBUG(aContext.iType.iUid!=KUidMsvFolderEntryValue, Panic(ESmsiFoldersNotSupported)); |
|
77 __ASSERT_DEBUG(aContext.iType.iUid!=KUidMsvAttachmentEntryValue, Panic(ESmsiNoIconForAttachment)); |
|
78 |
|
79 |
|
80 // Return the set of icons appropriate to the current context |
|
81 // BIO type messages |
|
82 TInt bmpIndex; |
|
83 if (aContext.iBioType!=0) |
|
84 { |
|
85 bmpIndex = aContext.Unread() ? |
|
86 EMbmMuiuQgn_prop_mce_smart_unread : EMbmMuiuQgn_prop_mce_smart_read; |
|
87 } |
|
88 // Other SMS Messages |
|
89 else |
|
90 { |
|
91 TUint sendingState = aContext.SendingState(); |
|
92 switch( sendingState ) |
|
93 { |
|
94 case KMsvSendStateFailed: |
|
95 |
|
96 if(aContext.Priority() == EMsvHighPriority) |
|
97 { |
|
98 // Message priority is "urgent" |
|
99 bmpIndex = EMbmMuiuQgn_prop_sms_failed_urgent_cdma; |
|
100 } |
|
101 else |
|
102 { |
|
103 // Message priority is "normal" |
|
104 bmpIndex = EMbmMuiuQgn_prop_sms_failed_cdma; |
|
105 } |
|
106 |
|
107 break; |
|
108 |
|
109 case KMsvSendStateUponRequest: // Mapped to be the same |
|
110 case KMsvSendStateSuspended: |
|
111 if(aContext.Priority() == EMsvHighPriority) |
|
112 { |
|
113 // Message priority is "urgent" |
|
114 bmpIndex = EMbmMuiuQgn_prop_sms_pending_urgent_cdma; |
|
115 } |
|
116 else |
|
117 { |
|
118 // Message priority is "normal" |
|
119 bmpIndex = EMbmMuiuQgn_prop_sms_pending_cdma; |
|
120 } |
|
121 break; |
|
122 |
|
123 case KMsvSendStateScheduled: // Mapped to be the same |
|
124 case KMsvSendStateWaiting: |
|
125 if(aContext.Priority() == EMsvHighPriority) |
|
126 { |
|
127 // Message priority is "urgent" |
|
128 bmpIndex = EMbmMuiuQgn_prop_sms_waiting_urgent_cdma; |
|
129 } |
|
130 else |
|
131 { |
|
132 // Message priority is "normal" |
|
133 bmpIndex = EMbmMuiuQgn_prop_sms_waiting_cdma; |
|
134 } |
|
135 break; |
|
136 |
|
137 case KMsvSendStateResend: |
|
138 if(aContext.Priority() == EMsvHighPriority) |
|
139 { |
|
140 // Message priority is "urgent" |
|
141 bmpIndex = EMbmMuiuQgn_prop_sms_pending_urgent_cdma; |
|
142 } |
|
143 else |
|
144 { |
|
145 // Message priority is "normal" |
|
146 bmpIndex = EMbmMuiuQgn_prop_sms_pending_cdma; |
|
147 } |
|
148 break; |
|
149 |
|
150 case KMsvSendStateSent: |
|
151 if(aContext.Priority() == EMsvHighPriority) |
|
152 { |
|
153 // Message priority is "urgent" |
|
154 bmpIndex = EMbmMuiuQgn_prop_sms_sent_urgent_cdma; |
|
155 } |
|
156 else |
|
157 { |
|
158 // Message priority is "normal" |
|
159 bmpIndex = EMbmMuiuQgn_prop_sms_sent_cdma; |
|
160 } |
|
161 break; |
|
162 |
|
163 case KMsvSendStateNotApplicable: // MT |
|
164 // Check message priority to return the correct set of icons |
|
165 if(aContext.Priority() == EMsvHighPriority) |
|
166 { |
|
167 // Message priority is "urgent" |
|
168 bmpIndex = aContext.Unread() ? |
|
169 EMbmMuiuQgn_prop_mce_sms_unread_urgent : EMbmMuiuQgn_prop_mce_sms_read_urgent; |
|
170 } |
|
171 else |
|
172 { |
|
173 // Message priority is "normal" |
|
174 bmpIndex = aContext.Unread() ? |
|
175 EMbmMuiuQgn_prop_mce_sms_unread : EMbmMuiuQgn_prop_mce_sms_read; |
|
176 } |
|
177 break; |
|
178 |
|
179 default: |
|
180 { |
|
181 bmpIndex = ( aContext.Priority() == EMsvHighPriority ) ? |
|
182 EMbmMuiuQgn_prop_mce_sms_unread_urgent : EMbmMuiuQgn_prop_mce_sms_unread; |
|
183 break; |
|
184 } |
|
185 } |
|
186 } |
|
187 // Bitmaps are no longer in sequential order, need a switch case to get the correct index |
|
188 TInt i; |
|
189 switch( bmpIndex ) |
|
190 { |
|
191 // Add to iIconArrays in this order |
|
192 case EMbmMuiuQgn_prop_mce_sms_read: |
|
193 i=0; |
|
194 break; |
|
195 case EMbmMuiuQgn_prop_mce_sms_unread: |
|
196 i=1; |
|
197 break; |
|
198 case EMbmMuiuQgn_prop_mce_smart_read: |
|
199 i=2; |
|
200 break; |
|
201 case EMbmMuiuQgn_prop_mce_smart_unread: |
|
202 i=3; |
|
203 break; |
|
204 case EMbmMuiuQgn_prop_mce_sms_read_urgent: |
|
205 i=4; |
|
206 break; |
|
207 case EMbmMuiuQgn_prop_mce_sms_unread_urgent: |
|
208 i=5; |
|
209 break; |
|
210 case EMbmMuiuQgn_prop_sms_waiting_cdma: |
|
211 i=6; |
|
212 break; |
|
213 case EMbmMuiuQgn_prop_sms_failed_cdma: |
|
214 i=7; |
|
215 break; |
|
216 case EMbmMuiuQgn_prop_sms_sent_cdma: |
|
217 i=8; |
|
218 break; |
|
219 case EMbmMuiuQgn_prop_sms_pending_cdma: |
|
220 i=9; |
|
221 break; |
|
222 case EMbmMuiuQgn_prop_sms_delivered_cdma: |
|
223 i=10; |
|
224 break; |
|
225 case EMbmMuiuQgn_prop_sms_waiting_urgent_cdma: |
|
226 i=11; |
|
227 break; |
|
228 case EMbmMuiuQgn_prop_sms_failed_urgent_cdma: |
|
229 i=12; |
|
230 break; |
|
231 case EMbmMuiuQgn_prop_sms_sent_urgent_cdma: |
|
232 i=13; |
|
233 break; |
|
234 case EMbmMuiuQgn_prop_sms_pending_urgent_cdma: |
|
235 i=14; |
|
236 break; |
|
237 case EMbmMuiuQgn_prop_sms_delivered_urgent_cdma: |
|
238 i=15; |
|
239 break; |
|
240 default: |
|
241 i=0; |
|
242 break; |
|
243 } |
|
244 return *iIconArrays->At(i); |
|
245 } |
|
246 |
|
247 // --------------------------------------------------------- |
|
248 // CSmsMtmUiDataCDMA::QueryCapability |
|
249 // |
|
250 // --------------------------------------------------------- |
|
251 TInt CSmsMtmUiDataCDMA::QueryCapability( TUid aFunctionId, TInt& aResponse ) const |
|
252 { |
|
253 TInt retVal = CSmsMtmUiData::QueryCapability( aFunctionId, aResponse ); |
|
254 switch ( aFunctionId.iUid ) |
|
255 { |
|
256 case KUidMtmQueryCanSendMsgValue: |
|
257 case KUidMtmQueryCanReceiveMsgValue: |
|
258 case KUidMtmQueryCanCreateNewMsgValue: |
|
259 aResponse = ETrue; |
|
260 break; |
|
261 default: |
|
262 break; |
|
263 } |
|
264 return retVal; |
|
265 } |
|
266 |
|
267 // --------------------------------------------------------- |
|
268 // CSmsMtmUiData::PopulateArraysL |
|
269 // |
|
270 // --------------------------------------------------------- |
|
271 void CSmsMtmUiDataCDMA::PopulateArraysL() |
|
272 { |
|
273 // Read additional functions |
|
274 ReadFunctionsFromResourceFileL( R_SMSI_FUNCTION_ARRAY_CDMA ); |
|
275 |
|
276 // Trap the error |
|
277 TRAPD(err,CreateSkinnedBitmapsL( KSmsiNumberOfZoomStates )); |
|
278 if(err != KErrNone) |
|
279 User::Leave(err); |
|
280 |
|
281 } |
|
282 |
|
283 // --------------------------------------------------------- |
|
284 // CSmsMtmUiData::CreateSkinnedBitmapsL |
|
285 // |
|
286 // --------------------------------------------------------- |
|
287 |
|
288 void CSmsMtmUiDataCDMA::CreateSkinnedBitmapsL( TInt aNumZoomStates ) |
|
289 { |
|
290 MAknsSkinInstance* skins = AknsUtils::SkinInstance(); |
|
291 TAknsItemID id; |
|
292 CFbsBitmap* bitmap; |
|
293 CFbsBitmap* bitmapMask; |
|
294 TBool found = ETrue; |
|
295 |
|
296 CBitmapArray* array; |
|
297 |
|
298 |
|
299 for( TInt i=EMbmMuiuQgn_prop_mce_sms_read; i<= EMbmMuiuQgn_prop_sms_delivered_urgent_cdma_mask; i++ ) |
|
300 { |
|
301 found = ETrue; |
|
302 switch( i ) |
|
303 { |
|
304 // Add to iIconArrays in this order |
|
305 case EMbmMuiuQgn_prop_mce_sms_read: |
|
306 id.Set( KAknsIIDQgnPropMceSmsRead ); |
|
307 break; |
|
308 case EMbmMuiuQgn_prop_mce_sms_unread: |
|
309 id.Set( KAknsIIDQgnPropMceSmsUnread ); |
|
310 break; |
|
311 case EMbmMuiuQgn_prop_mce_smart_read: |
|
312 id.Set( KAknsIIDQgnPropMceSmartRead ); |
|
313 break; |
|
314 case EMbmMuiuQgn_prop_mce_smart_unread: |
|
315 id.Set( KAknsIIDQgnPropMceSmartUnread ); |
|
316 break; |
|
317 case EMbmMuiuQgn_prop_mce_sms_read_urgent: |
|
318 id.Set( KAknsIIDQgnPropMceSmsReadUrgent ); |
|
319 break; |
|
320 case EMbmMuiuQgn_prop_mce_sms_unread_urgent: |
|
321 id.Set( KAknsIIDQgnPropMceSmsUnreadUrgent ); |
|
322 break; |
|
323 case EMbmMuiuQgn_prop_sms_waiting_cdma: |
|
324 id.Set( KAknsIIDQgnPropSmsWaitingCdma ); |
|
325 break; |
|
326 case EMbmMuiuQgn_prop_sms_failed_cdma: |
|
327 id.Set( KAknsIIDQgnPropSmsFailedCdma ); |
|
328 break; |
|
329 case EMbmMuiuQgn_prop_sms_sent_cdma: |
|
330 id.Set( KAknsIIDQgnPropSmsSentCdma ); |
|
331 break; |
|
332 case EMbmMuiuQgn_prop_sms_pending_cdma: |
|
333 id.Set( KAknsIIDQgnPropSmsPendingCdma ); |
|
334 break; |
|
335 case EMbmMuiuQgn_prop_sms_delivered_cdma: |
|
336 id.Set( KAknsIIDQgnPropSmsDeliveredCdma ); |
|
337 break; |
|
338 case EMbmMuiuQgn_prop_sms_waiting_urgent_cdma: |
|
339 id.Set( KAknsIIDQgnPropSmsWaitingUrgentCdma ); |
|
340 break; |
|
341 case EMbmMuiuQgn_prop_sms_failed_urgent_cdma: |
|
342 id.Set( KAknsIIDQgnPropSmsFailedUrgentCdma ); |
|
343 break; |
|
344 case EMbmMuiuQgn_prop_sms_sent_urgent_cdma: |
|
345 id.Set( KAknsIIDQgnPropSmsSentUrgentCdma ); |
|
346 break; |
|
347 case EMbmMuiuQgn_prop_sms_pending_urgent_cdma: |
|
348 id.Set( KAknsIIDQgnPropSmsPendingUrgentCdma ); |
|
349 break; |
|
350 case EMbmMuiuQgn_prop_sms_delivered_urgent_cdma: |
|
351 id.Set( KAknsIIDQgnPropSmsDeliveredUrgentCdma ); |
|
352 break; |
|
353 default: |
|
354 found = EFalse; |
|
355 break; |
|
356 } |
|
357 if( found ) |
|
358 { |
|
359 array = new(ELeave) CArrayPtrFlat<CFbsBitmap>(aNumZoomStates); |
|
360 CleanupStack::PushL( array ); |
|
361 |
|
362 // Parse appends the correct resource path |
|
363 // /resource/apps or /system/data |
|
364 // |
|
365 TParse tp; |
|
366 tp.Set( KBitmapFile, &KDC_APP_BITMAP_DIR, NULL); |
|
367 |
|
368 AknsUtils::CreateIconL( skins, id, bitmap, |
|
369 bitmapMask, tp.FullName(), i, i + 1 ); |
|
370 |
|
371 array->AppendL(bitmap); |
|
372 array->AppendL(bitmapMask); |
|
373 iIconArrays->AppendL(array); |
|
374 |
|
375 CleanupStack::Pop();//array |
|
376 } |
|
377 } |
|
378 } |
|
379 |
|
380 // End of File |