|
1 /* |
|
2 * Copyright (c) 2005 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 * Provides Postcard UI data methods. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "PostcardUiData.h" |
|
23 |
|
24 #include <mtclbase.h> |
|
25 #include <eikon.rsg> |
|
26 #include <data_caging_path_literals.hrh> |
|
27 #include <bautils.h> // FileExists |
|
28 |
|
29 #include <coemain.h> |
|
30 #include <AknsUtils.h> |
|
31 #include <AknsConstants.h> |
|
32 #include <fbs.h> |
|
33 #include <featmgr.h> |
|
34 |
|
35 #include <mtmuids.h> |
|
36 #include <msvids.h> |
|
37 #include <msvuids.h> |
|
38 #include <mtmuidef.hrh> |
|
39 |
|
40 #include <PostcardUi.rsg> |
|
41 #include <avkon.rsg> |
|
42 |
|
43 // MACROS |
|
44 // LOCAL CONSTANTS AND MACROS |
|
45 _LIT( KPostcardUiResourceFile,"PostcardUi.rsc"); |
|
46 _LIT( KPostcardDriveZ,"z:"); |
|
47 // MODULE DATA STRUCTURES |
|
48 // LOCAL FUNCTION PROTOTYPES |
|
49 |
|
50 // ==================== LOCAL FUNCTIONS ==================== |
|
51 |
|
52 // --------------------------------------------------------- |
|
53 // NewPostcardUiDataL |
|
54 // Factory function |
|
55 // --------------------------------------------------------- |
|
56 // |
|
57 EXPORT_C CBaseMtmUiData* NewPostcardUiDataL( CRegisteredMtmDll& aRegisteredDll ) |
|
58 { |
|
59 // Get supported features from feature manager. |
|
60 FeatureManager::InitializeLibL(); |
|
61 if ( !FeatureManager::FeatureSupported( KFeatureIdMmsPostcard ) ) |
|
62 { |
|
63 FeatureManager::UnInitializeLib(); |
|
64 User::Leave( KErrNotSupported ); |
|
65 } |
|
66 FeatureManager::UnInitializeLib(); |
|
67 |
|
68 return CPostcardUiData::NewL( aRegisteredDll ); |
|
69 } |
|
70 |
|
71 |
|
72 // ================= MEMBER FUNCTIONS ======================= |
|
73 |
|
74 // --------------------------------------------------------- |
|
75 // CPostcardUiData::CPostcardUiData |
|
76 // C++ constructor |
|
77 // --------------------------------------------------------- |
|
78 // |
|
79 CPostcardUiData::CPostcardUiData( CRegisteredMtmDll& aRegisteredDll ) |
|
80 : CBaseMtmUiData( aRegisteredDll ) |
|
81 { |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------- |
|
85 // CPostcardUiData::ConstructL |
|
86 // Symbian OS default constructor can leave. |
|
87 // --------------------------------------------------------- |
|
88 // |
|
89 void CPostcardUiData::ConstructL() |
|
90 { |
|
91 CBaseMtmUiData::ConstructL(); |
|
92 } |
|
93 |
|
94 |
|
95 // --------------------------------------------------------- |
|
96 // CPostcardUiData::NewL |
|
97 // Two-phased constructor. |
|
98 // --------------------------------------------------------- |
|
99 // |
|
100 CPostcardUiData* CPostcardUiData::NewL( CRegisteredMtmDll& aRegisteredDll ) |
|
101 { |
|
102 CPostcardUiData* self = new ( ELeave ) CPostcardUiData( aRegisteredDll ); |
|
103 |
|
104 CleanupStack::PushL( self ); |
|
105 self->ConstructL(); |
|
106 CleanupStack::Pop( self ); |
|
107 |
|
108 return self; |
|
109 } |
|
110 |
|
111 |
|
112 // --------------------------------------------------------- |
|
113 // CPostcardUiData::CPostcardUiData |
|
114 // Destructor. |
|
115 // --------------------------------------------------------- |
|
116 // |
|
117 CPostcardUiData::~CPostcardUiData() |
|
118 { |
|
119 } |
|
120 |
|
121 |
|
122 // --------------------------------------------------------- |
|
123 // CPostcardUiData::OperationSupportedL |
|
124 // --------------------------------------------------------- |
|
125 // |
|
126 TInt CPostcardUiData::OperationSupportedL( |
|
127 TInt aFunctionId, |
|
128 const TMsvEntry& aContext ) const |
|
129 { |
|
130 // Only Message Info for messages is a supported operation |
|
131 if ( ( aFunctionId == KMtmUiFunctionMessageInfo ) && |
|
132 ( aContext.iType == KUidMsvMessageEntry ) ) |
|
133 { |
|
134 return 0; |
|
135 } |
|
136 |
|
137 return R_EIK_TBUF_NOT_AVAILABLE; |
|
138 } |
|
139 |
|
140 |
|
141 // --------------------------------------------------------- |
|
142 // CPostcardUiData::QueryCapability |
|
143 // The default UI capability checker (UI MTM may have also minimal |
|
144 // UI specific checks also) |
|
145 // --------------------------------------------------------- |
|
146 // |
|
147 TInt CPostcardUiData::QueryCapability( |
|
148 TUid aFunctionId, |
|
149 TInt& aResponse ) const |
|
150 { |
|
151 TInt error = KErrNone; |
|
152 |
|
153 switch ( aFunctionId.iUid ) |
|
154 { |
|
155 // Supported: |
|
156 case KUidMtmQueryCanSendMsgValue: |
|
157 case KUidMtmQueryCanCreateNewMsgValue: |
|
158 case KUidMsvMtmQueryMessageInfo: |
|
159 break; |
|
160 |
|
161 case KUidMsvMtmQuerySupportEditor: |
|
162 case KUidMtmQuerySupportAttachmentsValue: // For SendUi |
|
163 aResponse = ETrue; |
|
164 break; |
|
165 |
|
166 default: |
|
167 // All others - Not Supported. At least these: |
|
168 //KUidMtmQuerySupportedBodyValue: text part(s) are attachments! |
|
169 //KUidMtmQueryMaxBodySizeValue: texts part(s) are attachments! |
|
170 //KUidMtmQuerySupportSubjectValue: subject is supported in Viewer, but not in Editor |
|
171 //KUidMsvMtmUiQueryCanPrintPreviewMsgValue: no printing in Series 60 |
|
172 //KUidMsvMtmUiQueryCanPrintMsgValue: no printing in Series 60 |
|
173 //KUidMtmQueryMaxRecipientCountValue |
|
174 //KUidMtmQuerySupportsBioMsgValue |
|
175 //KUidMtmQuerySendAsRequiresRenderedImageValue |
|
176 //KUidMtmQuerySendAsRenderingUidValue |
|
177 //KUidMsvMtmUiQueryExtendedOpenProgress |
|
178 //KUidMsvMtmUiQueryExtendedGetMailProgress |
|
179 //KUidMsvMtmUiQueryConnectionOrientedServices |
|
180 //KUidMsvMtmUiQueryServiceAttributes |
|
181 //KUidMsvMtmUiQueryCanGetNew |
|
182 //KUidMsvMtmUiQueryCanOpenServiceOnAction |
|
183 //KUidMtmQueryOffLineAllowedValue |
|
184 //KUidMtmQuerySupportsSchedulingValue |
|
185 //KUidMtmQuerySupportsFolderValue |
|
186 |
|
187 //KUidMtmQueryMaxTotalMsgSizeValue: |
|
188 //KUidMsvMtmQueryEditorUidValue: |
|
189 //KUidMsvMtmQueryViewerUidValue: |
|
190 //KUidMsvMtmQuerySupportLinks: // flow through |
|
191 //KUidMsvMtmUiQueryMessagingInitialisation: // flow through. This is also in UI MTM! |
|
192 //KUidMsvMtmQueryFactorySettings: // This is also in UI MTM! |
|
193 |
|
194 error = KErrNotSupported; |
|
195 } |
|
196 return error; |
|
197 } |
|
198 |
|
199 |
|
200 |
|
201 // --------------------------------------------------------- |
|
202 // CPostcardUiData::ContextIcon |
|
203 // Returns the array of icons relevant to given entry |
|
204 // --------------------------------------------------------- |
|
205 // |
|
206 |
|
207 const CBaseMtmUiData::CBitmapArray& CPostcardUiData::ContextIcon( |
|
208 const TMsvEntry& /*aContext*/, |
|
209 TInt /*aStateFlags*/ ) const |
|
210 { |
|
211 CArrayPtrFlat<CFbsBitmap>* array (NULL); |
|
212 TRAP_IGNORE( array = new (ELeave) CArrayPtrFlat<CFbsBitmap>( 0 ) ); |
|
213 return *array; |
|
214 } |
|
215 |
|
216 // --------------------------------------------------------- |
|
217 // CPostcardUiData::CanCreateEntryL |
|
218 // --------------------------------------------------------- |
|
219 // |
|
220 TBool CPostcardUiData::CanCreateEntryL( |
|
221 const TMsvEntry& /*aParent*/, |
|
222 TMsvEntry& /*aNewEntry*/, |
|
223 TInt& aReasonResourceId ) const |
|
224 { |
|
225 aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE; |
|
226 return EFalse; |
|
227 } |
|
228 |
|
229 // --------------------------------------------------------- |
|
230 // CPostcardUiData::CanOpenEntryL |
|
231 // --------------------------------------------------------- |
|
232 // |
|
233 TBool CPostcardUiData::CanOpenEntryL( |
|
234 const TMsvEntry& /*aContext*/, |
|
235 TInt& aReasonResourceId ) const |
|
236 { |
|
237 aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE; |
|
238 return EFalse; |
|
239 } |
|
240 |
|
241 // --------------------------------------------------------- |
|
242 // CPostcardUiData::CanCloseEntryL |
|
243 // --------------------------------------------------------- |
|
244 // |
|
245 TBool CPostcardUiData::CanCloseEntryL( |
|
246 const TMsvEntry& /*aContext*/, |
|
247 TInt& aReasonResourceId ) const |
|
248 { |
|
249 aReasonResourceId=R_EIK_TBUF_NOT_AVAILABLE; |
|
250 return EFalse; |
|
251 } |
|
252 |
|
253 // --------------------------------------------------------- |
|
254 // CPostcardUiData::CanViewEntryL |
|
255 // --------------------------------------------------------- |
|
256 // |
|
257 TBool CPostcardUiData::CanViewEntryL( |
|
258 const TMsvEntry& /*aContext*/, |
|
259 TInt& aReasonResourceId ) const |
|
260 { |
|
261 aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE; |
|
262 return EFalse; |
|
263 } |
|
264 |
|
265 // --------------------------------------------------------- |
|
266 // CPostcardUiData::CanEditEntryL |
|
267 // --------------------------------------------------------- |
|
268 // |
|
269 TBool CPostcardUiData::CanEditEntryL( |
|
270 const TMsvEntry& /*aContext*/, |
|
271 TInt& aReasonResourceId ) const |
|
272 { |
|
273 aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE; |
|
274 return EFalse; |
|
275 } |
|
276 |
|
277 // --------------------------------------------------------- |
|
278 // CPostcardUiData::CanDeleteFromEntryL |
|
279 // --------------------------------------------------------- |
|
280 // |
|
281 TBool CPostcardUiData::CanDeleteFromEntryL( |
|
282 const TMsvEntry& /*aContext*/, |
|
283 TInt& aReasonResourceId ) const |
|
284 { |
|
285 aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE; |
|
286 return EFalse; |
|
287 } |
|
288 |
|
289 // --------------------------------------------------------- |
|
290 // CPostcardUiData::CanDeleteServiceL |
|
291 // --------------------------------------------------------- |
|
292 // |
|
293 TBool CPostcardUiData::CanDeleteServiceL( |
|
294 const TMsvEntry& /*aService*/, |
|
295 TInt& aReasonResourceId ) const |
|
296 { |
|
297 aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE; |
|
298 return EFalse; |
|
299 } |
|
300 |
|
301 // --------------------------------------------------------- |
|
302 // CPostcardUiData::CanCopyMoveToEntryL |
|
303 // --------------------------------------------------------- |
|
304 // |
|
305 TBool CPostcardUiData::CanCopyMoveToEntryL( |
|
306 const TMsvEntry& /*aContext*/, |
|
307 TInt& aReasonResourceId ) const |
|
308 { |
|
309 aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE; |
|
310 return EFalse; |
|
311 } |
|
312 |
|
313 // --------------------------------------------------------- |
|
314 // CPostcardUiData::CanCopyMoveFromEntryL |
|
315 // --------------------------------------------------------- |
|
316 // |
|
317 TBool CPostcardUiData::CanCopyMoveFromEntryL( |
|
318 const TMsvEntry& /*aContext*/, |
|
319 TInt& aReasonResourceId ) const |
|
320 { |
|
321 aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE; |
|
322 return EFalse; |
|
323 } |
|
324 |
|
325 // --------------------------------------------------------- |
|
326 // CPostcardUiData::CanReplyToEntryL |
|
327 // --------------------------------------------------------- |
|
328 // |
|
329 TBool CPostcardUiData::CanReplyToEntryL( |
|
330 const TMsvEntry& /*aContext*/, |
|
331 TInt& aReasonResourceId ) const |
|
332 { |
|
333 aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE; |
|
334 return EFalse; |
|
335 } |
|
336 |
|
337 // --------------------------------------------------------- |
|
338 // CPostcardUiData::CanForwardEntryL |
|
339 // --------------------------------------------------------- |
|
340 // |
|
341 TBool CPostcardUiData::CanForwardEntryL( |
|
342 const TMsvEntry& /*aContext*/, |
|
343 TInt& aReasonResourceId ) const |
|
344 { |
|
345 aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE; |
|
346 return EFalse; |
|
347 } |
|
348 |
|
349 // --------------------------------------------------------- |
|
350 // CPostcardUiData::CanCancelL |
|
351 // --------------------------------------------------------- |
|
352 // |
|
353 TBool CPostcardUiData::CanCancelL( |
|
354 const TMsvEntry& /*aContext*/, |
|
355 TInt& aReasonResourceId ) const |
|
356 { |
|
357 aReasonResourceId = R_EIK_TBUF_NOT_AVAILABLE; |
|
358 return EFalse; |
|
359 } |
|
360 |
|
361 // --------------------------------------------------------- |
|
362 // CPostcardUiData::StatusTextL |
|
363 // Shows the text in outbox |
|
364 // --------------------------------------------------------- |
|
365 // |
|
366 HBufC* CPostcardUiData::StatusTextL( const TMsvEntry& /*aContext*/ ) const |
|
367 { |
|
368 return HBufC::NewL( 0 ); |
|
369 } |
|
370 |
|
371 void CPostcardUiData::PopulateArraysL( ) |
|
372 { |
|
373 ReadFunctionsFromResourceFileL( R_POCA_MTM_FUNCTION_ARRAY ); |
|
374 } |
|
375 |
|
376 void CPostcardUiData::GetResourceFileName( TFileName& aFileName ) const |
|
377 { |
|
378 TFileName tmpName; |
|
379 |
|
380 // Append the Resource Files Directory |
|
381 tmpName.Append( KDC_MTM_RESOURCE_DIR ); |
|
382 // Append the Ressource File Name |
|
383 tmpName.Append( KPostcardUiResourceFile ); |
|
384 |
|
385 // Obtain the drive where the DLL is installed |
|
386 TFileName dllDrive; |
|
387 Dll::FileName( dllDrive ); |
|
388 |
|
389 // Obtain the Complete path for the Resource File |
|
390 TParse parse; |
|
391 parse.Set( dllDrive, NULL, NULL ); |
|
392 parse.Set( parse.Drive(), &tmpName, NULL ); |
|
393 TFileName fileName; |
|
394 fileName.Append( parse.FullName()); |
|
395 |
|
396 // Get language of resource file |
|
397 BaflUtils::NearestLanguageFile( iCoeEnv->FsSession( ), fileName ); |
|
398 |
|
399 if( !BaflUtils::FileExists( iCoeEnv->FsSession( ), fileName) ) |
|
400 { // If it's not on dll drive -> try Z |
|
401 fileName.Replace( 0, 2, KPostcardDriveZ ); |
|
402 BaflUtils::NearestLanguageFile( iCoeEnv->FsSession( ), fileName ); |
|
403 } |
|
404 |
|
405 aFileName = fileName; |
|
406 |
|
407 return; |
|
408 } |
|
409 |
|
410 |
|
411 // ================= OTHER EXPORTED FUNCTIONS ============== |
|
412 |
|
413 // End of File |