|
1 /* |
|
2 * Copyright (c) 2006 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: |
|
15 * SMTP MTM Ui data layer base API |
|
16 * |
|
17 */ |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <coemain.h> // ccoeenv |
|
21 #include <eikon.rsg> |
|
22 |
|
23 // Messaging includes |
|
24 #include <mtclbase.h> |
|
25 #include <mtmuidef.hrh> |
|
26 #include <smtcmtm.h>// ksmtcmaxtextmessagesize, kuidmsgtypesmtp |
|
27 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
28 #include <mtmdef.hrh> |
|
29 #else |
|
30 #include <mtmdef.hrh> |
|
31 #include <mtmuidsdef.hrh> |
|
32 #endif |
|
33 #include <MtmExtendedCapabilities.hrh> |
|
34 |
|
35 // Specific includes |
|
36 #include "SmtpMtmUiData.h" |
|
37 #include "ImumPanic.h" |
|
38 #include <muiu.mbg> |
|
39 #include <imum.rsg> |
|
40 #include "EmailEditorViewerUids.h" |
|
41 |
|
42 #include <AknsUtils.h> |
|
43 #include <AknsConstants.h>//skinned icon ids |
|
44 #include <data_caging_path_literals.hrh> |
|
45 #include <featmgr.h> |
|
46 |
|
47 // CONSTANTS |
|
48 const TInt KImumSmtpBitmapIndex = 0; // only one bitmap for create email |
|
49 const TInt KSmtpMtmUdNumberOfZoomStates = 2; // second one is mask! |
|
50 _LIT(KSmtpMtmUdResourceFile, "IMUM"); |
|
51 // Correct path is added to literal when it is used. |
|
52 _LIT(KSmtpMtmUdBitmapFile, "z:MUIU.MBM"); |
|
53 |
|
54 |
|
55 // ==================== LOCAL FUNCTIONS ==================== |
|
56 |
|
57 // ================= MEMBER FUNCTIONS ======================= |
|
58 |
|
59 // ---------------------------------------------------------------------------- |
|
60 //NewSMTIMtmUiDataLayerL |
|
61 // ---------------------------------------------------------------------------- |
|
62 EXPORT_C CBaseMtmUiData* NewSMTIMtmUiDataLayerL(CRegisteredMtmDll& aRegisteredDll) |
|
63 { |
|
64 return CSmtpMtmUiData::NewL(aRegisteredDll); |
|
65 } |
|
66 |
|
67 |
|
68 // ---------------------------------------------------------------------------- |
|
69 //NewL |
|
70 // ---------------------------------------------------------------------------- |
|
71 CSmtpMtmUiData* CSmtpMtmUiData::NewL(CRegisteredMtmDll& aRegisteredDll) |
|
72 { |
|
73 CSmtpMtmUiData* self=new(ELeave) CSmtpMtmUiData(aRegisteredDll); |
|
74 CleanupStack::PushL(self); |
|
75 self->ConstructL(); |
|
76 CleanupStack::Pop(); |
|
77 return self; |
|
78 } |
|
79 |
|
80 // ---------------------------------------------------------------------------- |
|
81 // ~CSmtpMtmUiData |
|
82 // ---------------------------------------------------------------------------- |
|
83 CSmtpMtmUiData::~CSmtpMtmUiData() |
|
84 { |
|
85 } |
|
86 |
|
87 // ---------------------------------------------------------------------------- |
|
88 // OperationSupportedL |
|
89 // ---------------------------------------------------------------------------- |
|
90 TInt CSmtpMtmUiData::OperationSupportedL(TInt aOperationId, const TMsvEntry& aContext) const |
|
91 { |
|
92 TInt rid=R_EIK_TBUF_NOT_AVAILABLE; |
|
93 if (CheckEntry(aContext)) |
|
94 { |
|
95 if (aContext.iType.iUid==KUidMsvMessageEntryValue) |
|
96 { |
|
97 switch (aOperationId) |
|
98 { |
|
99 case KMtmUiFunctionSendAs: |
|
100 case KMtmUiFunctionMessageInfo: |
|
101 rid=0; // Operation is supported |
|
102 break; |
|
103 default: |
|
104 break; |
|
105 } |
|
106 } |
|
107 } |
|
108 return rid; |
|
109 } |
|
110 |
|
111 // ---------------------------------------------------------------------------- |
|
112 // QueryCapability |
|
113 // ---------------------------------------------------------------------------- |
|
114 TInt CSmtpMtmUiData::QueryCapability(TUid aCapability, TInt& aResponse) const |
|
115 { |
|
116 switch (aCapability.iUid) |
|
117 { |
|
118 // --- Supported valued capabilities --- |
|
119 case KUidMtmQueryMaxBodySizeValue: |
|
120 aResponse=KMaxTInt; |
|
121 break; |
|
122 case KUidMtmQueryMaxTotalMsgSizeValue: |
|
123 aResponse=KMaxTInt; |
|
124 break; |
|
125 case KUidMsvMtmQueryEditorUidValue: |
|
126 aResponse=KUidMsgInternetMailEditorAppValue; |
|
127 break; |
|
128 case KUidMsvMtmQueryViewerUidValue: |
|
129 aResponse=KUidMsgInternetMailViewerAppValue; |
|
130 break; |
|
131 case KUidMtmQuerySupportedBodyValue: |
|
132 aResponse = KMtm7BitBody | KMtm8BitBody | KMtm16BitBody; |
|
133 break; |
|
134 |
|
135 // |
|
136 // --- Support depends on variation --- |
|
137 case KUidMsvMtmQuerySupportEditor: |
|
138 aResponse = ETrue; |
|
139 break; |
|
140 // --- Supported non-valued capabilities --- |
|
141 case KUidMtmQueryCanCreateNewMsgValue: |
|
142 case KUidMtmQuerySupportAttachmentsValue: |
|
143 case KUidMtmQueryCanSendMsgValue: |
|
144 case KUidMsvMtmQueryMessageInfo: |
|
145 break; |
|
146 default: |
|
147 return KErrNotSupported; |
|
148 }; |
|
149 return KErrNone; |
|
150 } |
|
151 |
|
152 |
|
153 #ifdef _DEBUG |
|
154 const CBaseMtmUiData::CBitmapArray& CSmtpMtmUiData::ContextIcon(const TMsvEntry& aContext,TInt /*aStateFlags*/) const |
|
155 #else |
|
156 const CBaseMtmUiData::CBitmapArray& CSmtpMtmUiData::ContextIcon(const TMsvEntry& /*aContext*/,TInt /*aStateFlags*/) const |
|
157 #endif |
|
158 { |
|
159 __ASSERT_DEBUG(CheckEntry(aContext), User::Panic(KImumMtmUiPanic, ESmtpMtmUdNoIconAvailable)); |
|
160 __ASSERT_DEBUG(aContext.iType!=KUidMsvAttachmentEntry, User::Panic(KImumMtmUiPanic, ESmtpMtmUdNoIconForAttachment)); |
|
161 |
|
162 return *iIconArrays->At( KImumSmtpBitmapIndex ); // smtp has only one icon |
|
163 } |
|
164 |
|
165 // ---------------------------------------------------------------------------- |
|
166 // CSmtpMtmUiData |
|
167 // ---------------------------------------------------------------------------- |
|
168 CSmtpMtmUiData::CSmtpMtmUiData(CRegisteredMtmDll& aRegisteredDll) |
|
169 : CBaseMtmUiData(aRegisteredDll) |
|
170 { |
|
171 __ASSERT_DEBUG(aRegisteredDll.MtmTypeUid()==KUidMsgTypeSMTP, User::Panic(KImumMtmUiPanic, ESmtpMtmUdWrongMtmType)); |
|
172 } |
|
173 |
|
174 // ---------------------------------------------------------------------------- |
|
175 // PopulateArraysL |
|
176 // ---------------------------------------------------------------------------- |
|
177 void CSmtpMtmUiData::PopulateArraysL() |
|
178 { |
|
179 FeatureManager::InitializeLibL(); |
|
180 iFFEmailVariation = |
|
181 FeatureManager::FeatureSupported( KFeatureIdFfEmailFramework ); |
|
182 FeatureManager::UnInitializeLib(); |
|
183 |
|
184 // --- Populate function array --- |
|
185 ReadFunctionsFromResourceFileL( iFFEmailVariation ? |
|
186 R_SMTPUD_FUNCTION_ARRAY_FFEMAIL : R_SMTPUD_FUNCTION_ARRAY ); |
|
187 |
|
188 // |
|
189 // --- Populate bitmap array --- |
|
190 CreateSkinnedBitmapsL( KSmtpMtmUdNumberOfZoomStates ); |
|
191 } |
|
192 |
|
193 // ---------------------------------------------------------------------------- |
|
194 // GetResourceFileName |
|
195 // ---------------------------------------------------------------------------- |
|
196 void CSmtpMtmUiData::GetResourceFileName(TFileName& aFileName) const |
|
197 { |
|
198 aFileName=KSmtpMtmUdResourceFile; |
|
199 } |
|
200 |
|
201 // ---------------------------------------------------------------------------- |
|
202 // CanCreateEntryL |
|
203 // ---------------------------------------------------------------------------- |
|
204 TBool CSmtpMtmUiData::CanCreateEntryL(const TMsvEntry& aParent, TMsvEntry& aNewEntry, TInt& aReasonResourceId) const |
|
205 { |
|
206 if (CheckEntry(aNewEntry)) |
|
207 { |
|
208 aReasonResourceId=0; |
|
209 // |
|
210 // --- Can create services if they are off root --- |
|
211 if (aNewEntry.iType.iUid == KUidMsvServiceEntryValue) |
|
212 return (aParent.Id() == KMsvRootIndexEntryIdValue); |
|
213 // |
|
214 // --- Can create messages in local folders --- |
|
215 if (aNewEntry.iType.iUid == KUidMsvMessageEntryValue) |
|
216 return (aParent.iMtm.iUid == KMsvLocalServiceIndexEntryIdValue); |
|
217 } |
|
218 // |
|
219 // --- Can't create other types --- |
|
220 aReasonResourceId=R_EIK_TBUF_NOT_AVAILABLE; |
|
221 return EFalse; |
|
222 } |
|
223 |
|
224 // ---------------------------------------------------------------------------- |
|
225 // CanOpenEntryL |
|
226 // ---------------------------------------------------------------------------- |
|
227 TBool CSmtpMtmUiData::CanOpenEntryL(const TMsvEntry& /*aContext*/, TInt& aReasonResourceId) const |
|
228 { |
|
229 // not used, just return EFalse |
|
230 aReasonResourceId=R_EIK_TBUF_NOT_AVAILABLE; |
|
231 return EFalse; |
|
232 } |
|
233 |
|
234 // ---------------------------------------------------------------------------- |
|
235 // CanCloseEntryL |
|
236 // ---------------------------------------------------------------------------- |
|
237 TBool CSmtpMtmUiData::CanCloseEntryL(const TMsvEntry& /*aContext*/, TInt& aReasonResourceId) const |
|
238 { |
|
239 aReasonResourceId=R_EIK_TBUF_NOT_AVAILABLE; |
|
240 return EFalse; |
|
241 } |
|
242 |
|
243 // ---------------------------------------------------------------------------- |
|
244 // CanViewEntryL |
|
245 // ---------------------------------------------------------------------------- |
|
246 TBool CSmtpMtmUiData::CanViewEntryL(const TMsvEntry& /*aContext*/, TInt& aReasonResourceId) const |
|
247 { |
|
248 aReasonResourceId=R_EIK_TBUF_NOT_AVAILABLE; |
|
249 return EFalse; |
|
250 } |
|
251 |
|
252 // ---------------------------------------------------------------------------- |
|
253 // CanEditEntryL |
|
254 // ---------------------------------------------------------------------------- |
|
255 TBool CSmtpMtmUiData::CanEditEntryL(const TMsvEntry& /*aContext*/, TInt& aReasonResourceId) const |
|
256 { |
|
257 aReasonResourceId=R_EIK_TBUF_NOT_AVAILABLE; |
|
258 return EFalse; |
|
259 } |
|
260 |
|
261 // ---------------------------------------------------------------------------- |
|
262 // CanDeleteServiceL |
|
263 // ---------------------------------------------------------------------------- |
|
264 TBool CSmtpMtmUiData::CanDeleteServiceL(const TMsvEntry& /*aService*/, TInt& aReasonResourceId) const |
|
265 { |
|
266 aReasonResourceId=R_EIK_TBUF_NOT_AVAILABLE; |
|
267 return EFalse; |
|
268 } |
|
269 |
|
270 // ---------------------------------------------------------------------------- |
|
271 // CanDeleteFromEntryL |
|
272 // ---------------------------------------------------------------------------- |
|
273 TBool CSmtpMtmUiData::CanDeleteFromEntryL(const TMsvEntry& /*aContext*/, TInt& aReasonResourceId) const |
|
274 { |
|
275 aReasonResourceId=R_EIK_TBUF_NOT_AVAILABLE; |
|
276 return EFalse; |
|
277 } |
|
278 |
|
279 // ---------------------------------------------------------------------------- |
|
280 // CanCopyMoveToEntryL |
|
281 // ---------------------------------------------------------------------------- |
|
282 TBool CSmtpMtmUiData::CanCopyMoveToEntryL(const TMsvEntry& /*aContext*/, TInt& aReasonResourceId) const |
|
283 { |
|
284 aReasonResourceId=R_EIK_TBUF_NOT_AVAILABLE; |
|
285 return EFalse; |
|
286 } |
|
287 |
|
288 // ---------------------------------------------------------------------------- |
|
289 // CanCopyMoveFromEntryL |
|
290 // ---------------------------------------------------------------------------- |
|
291 TBool CSmtpMtmUiData::CanCopyMoveFromEntryL(const TMsvEntry& /*aContext*/, TInt& aReasonResourceId) const |
|
292 { |
|
293 aReasonResourceId=R_EIK_TBUF_NOT_AVAILABLE; |
|
294 return EFalse; |
|
295 } |
|
296 |
|
297 // ---------------------------------------------------------------------------- |
|
298 // CanReplyToEntryL |
|
299 // ---------------------------------------------------------------------------- |
|
300 TBool CSmtpMtmUiData::CanReplyToEntryL(const TMsvEntry& /*aContext*/, TInt& aReasonResourceId) const |
|
301 { |
|
302 aReasonResourceId=R_EIK_TBUF_NOT_AVAILABLE; |
|
303 return EFalse; |
|
304 } |
|
305 |
|
306 // ---------------------------------------------------------------------------- |
|
307 // CanForwardEntryL |
|
308 // ---------------------------------------------------------------------------- |
|
309 TBool CSmtpMtmUiData::CanForwardEntryL(const TMsvEntry& /*aContext*/, TInt& aReasonResourceId) const |
|
310 { |
|
311 aReasonResourceId=R_EIK_TBUF_NOT_AVAILABLE; |
|
312 return EFalse; |
|
313 } |
|
314 |
|
315 // ---------------------------------------------------------------------------- |
|
316 // CanCancelL |
|
317 // ---------------------------------------------------------------------------- |
|
318 TBool CSmtpMtmUiData::CanCancelL(const TMsvEntry& /*aContext*/, TInt& aReasonResourceId) const |
|
319 { |
|
320 aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE; |
|
321 return EFalse; |
|
322 } |
|
323 |
|
324 // ---------------------------------------------------------------------------- |
|
325 // StatusTextL |
|
326 // ---------------------------------------------------------------------------- |
|
327 HBufC* CSmtpMtmUiData::StatusTextL(const TMsvEntry& aContext) const |
|
328 { |
|
329 TInt res = 0; |
|
330 switch(aContext.SendingState()) |
|
331 { |
|
332 case KMsvSendStateFailed: |
|
333 res = R_SMTP_OUTBOX_STATUS_FAILED; |
|
334 break; |
|
335 // Functionally identical states. (Don't send on next connection) |
|
336 case KMsvSendStateUponRequest: |
|
337 case KMsvSendStateSuspended: |
|
338 res = R_SMTP_OUTBOX_STATUS_SUSPENDED; |
|
339 break; |
|
340 |
|
341 // Functionally identical states. (Send on next connection) |
|
342 case KMsvSendStateWaiting: |
|
343 case KMsvSendStateResend: |
|
344 case KMsvSendStateScheduled: |
|
345 res = R_SMTP_OUTBOX_STATUS_QUEUED; |
|
346 break; |
|
347 |
|
348 // Sending in progress. |
|
349 case KMsvSendStateSending: |
|
350 res = R_SMTP_OUTBOX_STATUS_SENDING; |
|
351 break; |
|
352 |
|
353 case KMsvSendStateSent: |
|
354 // how these should be handled? |
|
355 break; |
|
356 |
|
357 // Unknown (!) |
|
358 case KMsvSendStateUnknown: |
|
359 default: |
|
360 #ifdef _DEBUG |
|
361 User::Panic(KImumMtmUiPanic, ESmtpMtmUdUnknownMsgStatus); |
|
362 #endif |
|
363 break; |
|
364 } |
|
365 if(!res) |
|
366 return HBufC::NewL(0); |
|
367 else |
|
368 return iCoeEnv->AllocReadResourceL(res); |
|
369 } |
|
370 |
|
371 // ---------------------------------------------------------------------------- |
|
372 // CheckEntry |
|
373 // ---------------------------------------------------------------------------- |
|
374 TBool CSmtpMtmUiData::CheckEntry(const TMsvEntry& aContext) const |
|
375 { |
|
376 return ( (aContext.iMtm==KUidMsgTypeSMTP) && (aContext.iType.iUid!=KUidMsvFolderEntryValue) ); |
|
377 } |
|
378 |
|
379 // ---------------------------------------------------------------------------- |
|
380 // CSmtpMtmUiData::CreateSkinnedBitmapsL |
|
381 // |
|
382 // ---------------------------------------------------------------------------- |
|
383 void CSmtpMtmUiData::CreateSkinnedBitmapsL( TInt aNumZoomStates ) |
|
384 { |
|
385 MAknsSkinInstance* skins = AknsUtils::SkinInstance(); |
|
386 TAknsItemID id; |
|
387 CFbsBitmap* bitmap; |
|
388 CFbsBitmap* bitmapMask; |
|
389 |
|
390 CBitmapArray* array = NULL; |
|
391 |
|
392 id.Set( KAknsIIDQgnPropMceMailFetRead ); |
|
393 |
|
394 array = new(ELeave) CArrayPtrFlat<CFbsBitmap>( aNumZoomStates ); |
|
395 CleanupStack::PushL( array ); |
|
396 |
|
397 TParse tp; |
|
398 tp.Set( KSmtpMtmUdBitmapFile, &KDC_APP_BITMAP_DIR, NULL ); |
|
399 |
|
400 AknsUtils::CreateIconL( skins, id, bitmap, |
|
401 bitmapMask, tp.FullName(), EMbmMuiuQgn_prop_mce_mail_fet_read, |
|
402 EMbmMuiuQgn_prop_mce_mail_fet_read_mask ); |
|
403 |
|
404 |
|
405 array->AppendL( bitmap ); |
|
406 array->AppendL( bitmapMask ); |
|
407 iIconArrays->AppendL( array ); |
|
408 |
|
409 CleanupStack::Pop();//array |
|
410 } |
|
411 |
|
412 // End of File |
|
413 |