|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "obexutilsuilayer.h" |
|
21 #include "obexutilslaunchwaiter.h" |
|
22 #include "obexutilsdebug.h" |
|
23 |
|
24 #include <secondarydisplay/obexutilssecondarydisplayapi.h> |
|
25 #include <Obexutils.rsg> |
|
26 #include <aknnotewrappers.h> |
|
27 #include <AknGlobalConfirmationQuery.h> |
|
28 #include <eikon.rsg> |
|
29 #include <avkon.rsg> |
|
30 #ifdef NO101APPDEPFIXES |
|
31 #include <muiu.mbg> |
|
32 #else //NO101APPDEPFIXES |
|
33 enum TMuiuConsts |
|
34 { |
|
35 EMbmMuiuQgn_prop_mce_ir_unread = 16402, |
|
36 EMbmMuiuQgn_prop_mce_ir_unread_mask = 16403, |
|
37 EMbmMuiuQgn_prop_mce_ir_read = 16404, |
|
38 EMbmMuiuQgn_prop_mce_ir_read_mask = 16405, |
|
39 EMbmMuiuQgn_prop_mce_bt_unread = 16406, |
|
40 EMbmMuiuQgn_prop_mce_bt_unread_mask = 16407, |
|
41 EMbmMuiuQgn_prop_mce_bt_read = 16408, |
|
42 EMbmMuiuQgn_prop_mce_bt_read_mask = 16409 |
|
43 }; |
|
44 #endif //NO101APPDEPFIXES |
|
45 #include <bautils.h> |
|
46 #include <featmgr.h> |
|
47 |
|
48 #include <stringresourcereader.h> |
|
49 #include <StringLoader.h> |
|
50 |
|
51 // Launching file manager related header files |
|
52 #include <AiwServiceHandler.h> // The AIW service handler |
|
53 #include <apgcli.h> |
|
54 #include <apacmdln.h> |
|
55 #include <AknLaunchAppService.h> // Used to launch file manager in embedded mode. |
|
56 #include <e32property.h> //for checking backup status |
|
57 |
|
58 //Constants |
|
59 const TInt KFileManagerUID3 = 0x101F84EB; /// File Manager application UID3 |
|
60 const TInt KUiNumberOfZoomStates = 2; // second for the mask |
|
61 const TInt KSortNumMax = 2; |
|
62 const TInt KNfcUnreadIconIndex = 10; |
|
63 const TInt KNfcReadIconIndex = 8; |
|
64 |
|
65 |
|
66 // ============================ MEMBER FUNCTIONS =============================== |
|
67 |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // TObexUtilsUiLayer::LaunchEditorApplicationOperationL |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 EXPORT_C CMsvOperation* TObexUtilsUiLayer::LaunchEditorApplicationOperationL( |
|
74 CMsvSession& aMsvSession, |
|
75 CMsvEntry* aMessage, |
|
76 TRequestStatus& aObserverRequestStatus ) |
|
77 { |
|
78 FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::LaunchEditorApplicationOperationL()")); |
|
79 CObexUtilsLaunchWaiter* waiterOperation = CObexUtilsLaunchWaiter::NewL( |
|
80 aMsvSession, |
|
81 aMessage, |
|
82 aObserverRequestStatus ); |
|
83 |
|
84 return waiterOperation; |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // TObexUtilsUiLayer::LaunchEditorApplication |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 EXPORT_C TInt TObexUtilsUiLayer::LaunchEditorApplicationL( CMsvEntry* /*aMessage*/, |
|
92 CMsvSession& /*aSession*/ ) |
|
93 { |
|
94 // Obsolete |
|
95 return KErrNotSupported; |
|
96 } |
|
97 |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CObexUtilsMessageHandler::LaunchFileManager |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 EXPORT_C void TObexUtilsUiLayer::LaunchFileManagerL( |
|
104 TDesC& aPath, |
|
105 TInt aSortMethod, |
|
106 TBool isEmbeddedMode ) |
|
107 { |
|
108 if ( isEmbeddedMode ) |
|
109 { |
|
110 FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::LaunchFileManager() Embedded mode")); |
|
111 |
|
112 CAiwGenericParamList* inParams = CAiwGenericParamList::NewLC(); |
|
113 inParams->AppendL(TAiwGenericParam( EGenericParamDir, TAiwVariant( aPath ) ) ); |
|
114 inParams->AppendL(TAiwGenericParam( EGenericParamDir, TAiwVariant( aSortMethod ) ) ); |
|
115 |
|
116 CAknLaunchAppService* launchService = CAknLaunchAppService::NewL(TUid::Uid( KFileManagerUID3 ), // Use File Manager app UID directly |
|
117 NULL, |
|
118 inParams ); |
|
119 CleanupStack::PopAndDestroy( inParams ); |
|
120 FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::LaunchFileManager() Embedded mode completed ")); |
|
121 } |
|
122 else |
|
123 { |
|
124 FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::LaunchFileManager() ")); |
|
125 TApaAppInfo appInfo; |
|
126 RApaLsSession apaLsSession; |
|
127 User::LeaveIfError( apaLsSession.Connect() ); |
|
128 CleanupClosePushL( apaLsSession ); |
|
129 User::LeaveIfError( apaLsSession.GetAppInfo( appInfo, TUid::Uid( KFileManagerUID3 ) ) ); // Use File Manager app UID directly |
|
130 CApaCommandLine* apaCmdLine = CApaCommandLine::NewLC(); |
|
131 apaCmdLine->SetExecutableNameL( appInfo.iFullName ); |
|
132 apaCmdLine->SetCommandL( EApaCommandOpen ); |
|
133 apaCmdLine->SetDocumentNameL( aPath ); |
|
134 TBuf8<KSortNumMax> sortMode; |
|
135 sortMode.AppendNum( aSortMethod ); |
|
136 apaCmdLine->SetTailEndL( sortMode ); |
|
137 TThreadId dummy; |
|
138 User::LeaveIfError( apaLsSession.StartApp( *apaCmdLine, dummy ) ); |
|
139 CleanupStack::PopAndDestroy( apaCmdLine ); |
|
140 CleanupStack::PopAndDestroy( &apaLsSession ); |
|
141 FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::LaunchFileManager() standalone mode completed ")); |
|
142 } |
|
143 } |
|
144 |
|
145 // ----------------------------------------------------------------------------- |
|
146 // CObexUtilsMessageHandler::LaunchEditorApplication |
|
147 // ----------------------------------------------------------------------------- |
|
148 // |
|
149 EXPORT_C void TObexUtilsUiLayer::LaunchEditorApplicationL (TMsvId& aMsvIdParent) |
|
150 { |
|
151 FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::LaunchEditorApplication() ")); |
|
152 CDummySessionObserver* sessionObs = new( ELeave )CDummySessionObserver; |
|
153 CleanupStack::PushL( sessionObs ); //1st push |
|
154 CMsvSession* msvSession = CMsvSession::OpenSyncL( *sessionObs ); |
|
155 CleanupStack::PushL( msvSession ); //2nd push |
|
156 |
|
157 // 1st, 2nd push? |
|
158 CMsvEntry* parentEntry = msvSession->GetEntryL(aMsvIdParent); |
|
159 CleanupStack::PushL(parentEntry); // 3th push |
|
160 |
|
161 TRequestStatus status = KRequestPending; |
|
162 CObexUtilsLaunchWaiter* waiterOperation = CObexUtilsLaunchWaiter::NewL( |
|
163 *msvSession, |
|
164 parentEntry, |
|
165 status); |
|
166 CleanupStack::PopAndDestroy(3); // parentEntry, sessionObs, msvSession |
|
167 |
|
168 FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::LaunchEditorApplication() completed ")); |
|
169 } |
|
170 |
|
171 |
|
172 // ----------------------------------------------------------------------------- |
|
173 // TObexUtilsUiLayer::ShowErrorNoteL |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 EXPORT_C void TObexUtilsUiLayer::ShowErrorNoteL( const TInt& aResourceID ) |
|
177 { |
|
178 FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ShowErrorNoteL()")); |
|
179 |
|
180 TBuf<KObexUtilsMaxChar> textdata; |
|
181 ReadResourceL( textdata, aResourceID ); |
|
182 |
|
183 CAknErrorNote* note = new( ELeave )CAknErrorNote( ETrue ); |
|
184 CleanupStack::PushL( note ); |
|
185 PrepareDialogExecuteL( aResourceID, note ); |
|
186 CleanupStack::Pop( note ); |
|
187 note->ExecuteLD( textdata ); |
|
188 |
|
189 FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ShowErrorNoteL() completed")); |
|
190 |
|
191 } |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // TObexUtilsUiLayer::ShowInformationNoteL |
|
195 // ----------------------------------------------------------------------------- |
|
196 // |
|
197 EXPORT_C void TObexUtilsUiLayer::ShowInformationNoteL( const TInt& aResourceID ) |
|
198 { |
|
199 FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ShowInformationNoteL()")); |
|
200 |
|
201 TBuf<KObexUtilsMaxChar> textdata; |
|
202 ReadResourceL( textdata, aResourceID ); |
|
203 |
|
204 CAknInformationNote* note = new( ELeave )CAknInformationNote; |
|
205 CleanupStack::PushL( note ); |
|
206 PrepareDialogExecuteL( aResourceID, note ); |
|
207 CleanupStack::Pop( note ); |
|
208 note->ExecuteLD( textdata ); |
|
209 |
|
210 FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ShowInformationNoteL() completed")); |
|
211 } |
|
212 |
|
213 // ----------------------------------------------------------------------------- |
|
214 // TObexUtilsUiLayer::ShowGlobalInformationNoteL |
|
215 // ----------------------------------------------------------------------------- |
|
216 // |
|
217 EXPORT_C void TObexUtilsUiLayer::ShowGlobalConfirmationQueryL( const TInt& aResourceID ) |
|
218 { |
|
219 FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ShowGlobalInformationNoteL()")); |
|
220 |
|
221 TBuf<KObexUtilsMaxChar> textdata; |
|
222 TRequestStatus status; |
|
223 |
|
224 ReadResourceL( textdata, aResourceID ); |
|
225 CAknGlobalConfirmationQuery* note = CAknGlobalConfirmationQuery::NewLC(); |
|
226 |
|
227 status=KRequestPending; |
|
228 note->ShowConfirmationQueryL(status, |
|
229 textdata, |
|
230 R_AVKON_SOFTKEYS_OK_EMPTY, |
|
231 R_QGN_NOTE_ERROR_ANIM,KNullDesC, |
|
232 0, |
|
233 0, |
|
234 CAknQueryDialog::EErrorTone |
|
235 ); |
|
236 User::WaitForRequest(status); |
|
237 |
|
238 CleanupStack::PopAndDestroy(note ); |
|
239 |
|
240 FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ShowGlobalInformationNoteL() completed")); |
|
241 } |
|
242 |
|
243 // ----------------------------------------------------------------------------- |
|
244 // TObexUtilsUiLayer::ShowGlobalConfirmationQueryPlainL |
|
245 // ----------------------------------------------------------------------------- |
|
246 // |
|
247 EXPORT_C TBool TObexUtilsUiLayer::ShowGlobalConfirmationQueryPlainL( const TInt& aResourceID) |
|
248 { |
|
249 CAknGlobalConfirmationQuery* pQ = CAknGlobalConfirmationQuery::NewL(); |
|
250 CleanupStack::PushL(pQ); |
|
251 HBufC* stringholder = NULL; |
|
252 stringholder = StringLoader::LoadLC( aResourceID); |
|
253 TRequestStatus status = KRequestPending; |
|
254 pQ->ShowConfirmationQueryL(status,*stringholder,R_AVKON_SOFTKEYS_YES_NO); |
|
255 User::WaitForRequest(status); |
|
256 CleanupStack::PopAndDestroy(2);//PQ and Stringholder |
|
257 return (status.Int() == EAknSoftkeyYes); |
|
258 } |
|
259 |
|
260 |
|
261 // ----------------------------------------------------------------------------- |
|
262 // TObexUtilsUiLayer::ShowGlobalFileOpenConfirmationQueryL |
|
263 // ----------------------------------------------------------------------------- |
|
264 // |
|
265 EXPORT_C TBool TObexUtilsUiLayer::ShowGlobalFileOpenConfirmationQueryL( const TInt& aResourceID, const TDesC& aFilePath) |
|
266 { |
|
267 // Read string from resource file |
|
268 TFileName fileName; |
|
269 fileName += KObexUtilsFileDrive; |
|
270 fileName += KDC_RESOURCE_FILES_DIR; |
|
271 fileName += KObexUtilsResourceFileName; |
|
272 |
|
273 CStringResourceReader* stringResourceReader = CStringResourceReader::NewL(fileName); |
|
274 CleanupStack::PushL(stringResourceReader); |
|
275 const TDesC& resString = stringResourceReader->ReadResourceString(aResourceID); |
|
276 RBuf manipString; |
|
277 manipString.Assign(resString.AllocL()); |
|
278 CleanupStack::PopAndDestroy(stringResourceReader); |
|
279 manipString.CleanupClosePushL(); |
|
280 |
|
281 // Remove bracket section |
|
282 _LIT(KPrefix, "["); |
|
283 _LIT(KSuffix, "]"); |
|
284 TInt prefixPos = manipString.Find(KPrefix); |
|
285 if (prefixPos != KErrNotFound) |
|
286 { |
|
287 TInt keyLength = 0; |
|
288 TInt suffixPos = manipString.Find(KSuffix); |
|
289 keyLength = (manipString.Mid(prefixPos)).Length()-(manipString.Mid(suffixPos)).Length()+1; |
|
290 manipString.Delete(prefixPos, keyLength); |
|
291 } |
|
292 |
|
293 // Replace "%U" string parameter with file path |
|
294 _LIT(KString, "%U"); |
|
295 TInt replacePos = manipString.Find(KString); |
|
296 if( replacePos == KErrNotFound ) |
|
297 { |
|
298 User::Leave(KErrNotFound); |
|
299 } |
|
300 const TInt minRequiredSize = manipString.Length() - KString().Length() + aFilePath.Length(); |
|
301 // ensure that the buffer is big enough (otherwise re-alloc) |
|
302 if(manipString.MaxLength() < minRequiredSize) |
|
303 { |
|
304 manipString.ReAllocL(minRequiredSize); |
|
305 } |
|
306 manipString.Replace(replacePos, KString().Length(), aFilePath); |
|
307 |
|
308 // Initiate query dialog |
|
309 TRequestStatus status = KRequestPending; |
|
310 |
|
311 CAknGlobalConfirmationQuery* pQ = CAknGlobalConfirmationQuery::NewL(); |
|
312 CleanupStack::PushL(pQ); |
|
313 pQ->ShowConfirmationQueryL(status, manipString, R_AVKON_SOFTKEYS_YES_NO); |
|
314 User::WaitForRequest(status); |
|
315 CleanupStack::PopAndDestroy(2, &manipString); // pQ, manipString |
|
316 return (status.Int() == EAknSoftkeyYes); |
|
317 } |
|
318 |
|
319 |
|
320 // ----------------------------------------------------------------------------- |
|
321 // TObexUtilsUiLayer::ReadResourceL |
|
322 // ----------------------------------------------------------------------------- |
|
323 // |
|
324 EXPORT_C void TObexUtilsUiLayer::ReadResourceL( TDes& aBuf, const TInt& aResourceID ) |
|
325 { |
|
326 FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ReadResourceL()")); |
|
327 |
|
328 RFs fileSession; |
|
329 CleanupClosePushL<RFs>( fileSession ); |
|
330 User::LeaveIfError( fileSession.Connect() ); |
|
331 |
|
332 TFileName fileName; |
|
333 fileName += KObexUtilsFileDrive; |
|
334 fileName += KDC_RESOURCE_FILES_DIR; |
|
335 fileName += KObexUtilsResourceFileName; |
|
336 |
|
337 BaflUtils::NearestLanguageFile( fileSession, fileName ); |
|
338 |
|
339 RResourceFile resourcefile; |
|
340 CleanupClosePushL<RResourceFile>( resourcefile ); |
|
341 resourcefile.OpenL( fileSession, fileName ); |
|
342 resourcefile.ConfirmSignatureL( 0 ); |
|
343 HBufC8* readBuffer = resourcefile.AllocReadLC( aResourceID ); |
|
344 |
|
345 const TPtrC16 ptrReadBuffer( (TText16*) readBuffer->Ptr(),( readBuffer->Length() + 1 ) >> 1 ); |
|
346 HBufC16* textBuffer=HBufC16::NewLC( ptrReadBuffer.Length() ); |
|
347 *textBuffer = ptrReadBuffer; |
|
348 aBuf.Copy( *textBuffer ); |
|
349 |
|
350 CleanupStack::PopAndDestroy( 4 ); // textBuffer, fileSession, resourcefile, readBuffer |
|
351 |
|
352 FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ReadResourceL() completed")); |
|
353 } |
|
354 |
|
355 // ----------------------------------------------------------------------------- |
|
356 // TObexUtilsUiLayer::OperationNotSupported |
|
357 // ----------------------------------------------------------------------------- |
|
358 // |
|
359 EXPORT_C TInt TObexUtilsUiLayer::OperationNotSupported() |
|
360 { |
|
361 return R_EIK_TBUF_NOT_AVAILABLE; |
|
362 } |
|
363 |
|
364 // ----------------------------------------------------------------------------- |
|
365 // TObexUtilsUiLayer::ContextIcon |
|
366 // ----------------------------------------------------------------------------- |
|
367 // |
|
368 EXPORT_C TInt TObexUtilsUiLayer::ContextIcon( const TMsvEntry& aContext, TContextMedia aMedia ) |
|
369 { |
|
370 FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ContextIcon()")); |
|
371 |
|
372 TInt icon = 0; |
|
373 if( aMedia == EBluetooth ) |
|
374 { |
|
375 if( aContext.Unread() ) |
|
376 { |
|
377 icon = EMbmMuiuQgn_prop_mce_bt_unread - EMbmMuiuQgn_prop_mce_ir_unread; |
|
378 } |
|
379 else |
|
380 { |
|
381 icon = EMbmMuiuQgn_prop_mce_bt_read - EMbmMuiuQgn_prop_mce_ir_unread; |
|
382 } |
|
383 } |
|
384 else if( aMedia == EInfrared ) |
|
385 { |
|
386 if( aContext.Unread() ) |
|
387 { |
|
388 icon = 0; |
|
389 } |
|
390 else |
|
391 { |
|
392 icon = EMbmMuiuQgn_prop_mce_ir_read - EMbmMuiuQgn_prop_mce_ir_unread; |
|
393 } |
|
394 } |
|
395 else if( aMedia == ENfc ) |
|
396 { |
|
397 if( aContext.Unread() ) |
|
398 { |
|
399 icon = KNfcUnreadIconIndex; |
|
400 } |
|
401 else |
|
402 { |
|
403 icon = KNfcReadIconIndex; |
|
404 } |
|
405 } |
|
406 |
|
407 FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ContextIcon() completed")); |
|
408 |
|
409 return icon; |
|
410 } |
|
411 |
|
412 // ----------------------------------------------------------------------------- |
|
413 // TObexUtilsUiLayer::UpdateBitmaps |
|
414 // ----------------------------------------------------------------------------- |
|
415 // |
|
416 EXPORT_C void TObexUtilsUiLayer::UpdateBitmaps( TUid aMedia, |
|
417 TInt& aNumberOfZoomStates, TFileName& aBitmapFile, TInt& aStartBitmap, |
|
418 TInt& aEndBitmap ) |
|
419 { |
|
420 FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::UpdateBitmaps()")); |
|
421 |
|
422 aBitmapFile = KCommonUiBitmapFile; |
|
423 aNumberOfZoomStates = KUiNumberOfZoomStates; |
|
424 if( aMedia == KUidMsgTypeBt ) |
|
425 { |
|
426 aStartBitmap = EMbmMuiuQgn_prop_mce_ir_unread; |
|
427 aEndBitmap = EMbmMuiuQgn_prop_mce_bt_read_mask; |
|
428 } |
|
429 else |
|
430 { |
|
431 aStartBitmap = EMbmMuiuQgn_prop_mce_ir_unread; |
|
432 aEndBitmap = EMbmMuiuQgn_prop_mce_bt_unread_mask; |
|
433 } |
|
434 |
|
435 FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::UpdateBitmaps() completed")); |
|
436 } |
|
437 |
|
438 // ----------------------------------------------------------------------------- |
|
439 // TObexUtilsUiLayer::DeleteCBitMapArray |
|
440 // ----------------------------------------------------------------------------- |
|
441 // |
|
442 inline void DeleteCBitMapArray(TAny* aPtr) |
|
443 { |
|
444 if (aPtr) |
|
445 { |
|
446 TObexUtilsUiLayer::CBitmapArray* array = |
|
447 reinterpret_cast<TObexUtilsUiLayer::CBitmapArray*>(aPtr); |
|
448 array->ResetAndDestroy(); |
|
449 delete array; |
|
450 } |
|
451 } |
|
452 |
|
453 // ----------------------------------------------------------------------------- |
|
454 // TObexUtilsUiLayer::CreateAndAppendBitmapL |
|
455 // ----------------------------------------------------------------------------- |
|
456 // |
|
457 void CreateAndAppendBitmapL(const TAknsItemID& aID, |
|
458 const TInt aFileBitmapId, |
|
459 CArrayPtr<TObexUtilsUiLayer::CBitmapArray>* aIconArrays ) |
|
460 { |
|
461 TFileName muiubmpFilename; |
|
462 muiubmpFilename += KObexUtilsFileDrive; |
|
463 muiubmpFilename += KDC_APP_BITMAP_DIR; |
|
464 muiubmpFilename += KCommonUiBitmapFile; |
|
465 |
|
466 TObexUtilsUiLayer::CBitmapArray* array=NULL; |
|
467 array=new(ELeave) CArrayPtrFlat<CFbsBitmap>(KUiNumberOfZoomStates); |
|
468 CleanupStack::PushL(TCleanupItem(DeleteCBitMapArray, array)); |
|
469 |
|
470 CFbsBitmap* bitmap=0, *mask=0; |
|
471 |
|
472 //Can not use CreateIconLC since the order in which bitmap and mask are pushed into Cleanup Stack is undefined. |
|
473 AknsUtils::CreateIconL( |
|
474 AknsUtils::SkinInstance(), |
|
475 aID, |
|
476 bitmap, |
|
477 mask, |
|
478 muiubmpFilename, |
|
479 aFileBitmapId, |
|
480 aFileBitmapId+1); |
|
481 CleanupStack::PushL(mask); |
|
482 CleanupStack::PushL(bitmap); |
|
483 |
|
484 // warning: bmp is deleted by the array CleanupItem. Immediately Pop or risk double deletion upon a Leave. |
|
485 array->AppendL(bitmap); |
|
486 CleanupStack::Pop(bitmap); |
|
487 |
|
488 // warning: bmp is deleted by the array CleanupItem. Immediately Pop or risk double deletion upon a Leave. |
|
489 array->AppendL(mask); |
|
490 CleanupStack::Pop(mask); |
|
491 |
|
492 aIconArrays->AppendL(array); |
|
493 CleanupStack::Pop(array); |
|
494 } |
|
495 |
|
496 // ----------------------------------------------------------------------------- |
|
497 // TObexUtilsUiLayer::CreateIconsL |
|
498 // ----------------------------------------------------------------------------- |
|
499 // |
|
500 EXPORT_C void TObexUtilsUiLayer::CreateIconsL( |
|
501 TUid aMedia, |
|
502 CArrayPtr<TObexUtilsUiLayer::CBitmapArray>* aIconArrays ) |
|
503 { |
|
504 if( aMedia == KUidMsgTypeBt ) //Bluetooth |
|
505 { |
|
506 CreateAndAppendBitmapL( |
|
507 KAknsIIDQgnPropMceIrUnread, |
|
508 EMbmMuiuQgn_prop_mce_ir_unread, |
|
509 aIconArrays); |
|
510 CreateAndAppendBitmapL( |
|
511 KAknsIIDQgnPropMceIrRead, |
|
512 EMbmMuiuQgn_prop_mce_ir_read, |
|
513 aIconArrays); |
|
514 CreateAndAppendBitmapL( |
|
515 KAknsIIDQgnPropMceBtUnread, |
|
516 EMbmMuiuQgn_prop_mce_bt_unread, |
|
517 aIconArrays); |
|
518 CreateAndAppendBitmapL( |
|
519 KAknsIIDQgnPropMceBtRead, |
|
520 EMbmMuiuQgn_prop_mce_bt_read, |
|
521 aIconArrays); |
|
522 CreateAndAppendBitmapL( |
|
523 KAknsIIDQgnPropMceNfcRead, |
|
524 0, |
|
525 aIconArrays); |
|
526 CreateAndAppendBitmapL( |
|
527 KAknsIIDQgnPropMceNfcUnread, |
|
528 0, |
|
529 aIconArrays); |
|
530 } |
|
531 else //Infrared |
|
532 { |
|
533 CreateAndAppendBitmapL( |
|
534 KAknsIIDQgnPropMceIrUnread, |
|
535 EMbmMuiuQgn_prop_mce_ir_unread, |
|
536 aIconArrays); |
|
537 CreateAndAppendBitmapL( |
|
538 KAknsIIDQgnPropMceIrRead, |
|
539 EMbmMuiuQgn_prop_mce_ir_read, |
|
540 aIconArrays); |
|
541 CreateAndAppendBitmapL( |
|
542 KAknsIIDQgnPropMceBtUnread, |
|
543 EMbmMuiuQgn_prop_mce_bt_unread, |
|
544 aIconArrays); |
|
545 } |
|
546 } |
|
547 |
|
548 // ----------------------------------------------------------------------------- |
|
549 // TObexUtilsUiLayer::IsBackupRunning |
|
550 // ----------------------------------------------------------------------------- |
|
551 // |
|
552 EXPORT_C TBool TObexUtilsUiLayer::IsBackupRunning() |
|
553 { |
|
554 const TUint32 KFileManagerBkupStatus = 0x00000001; |
|
555 |
|
556 TInt status = EFileManagerBkupStatusUnset; |
|
557 TBool retValue = EFalse; |
|
558 TInt err = RProperty::Get( TUid::Uid(KFileManagerUID3), KFileManagerBkupStatus, |
|
559 status ); |
|
560 if ( err == KErrNone ) |
|
561 { |
|
562 if ( status == EFileManagerBkupStatusBackup || |
|
563 status == EFileManagerBkupStatusRestore ) |
|
564 { |
|
565 TSecureId fileManagerSecureId( KFileManagerUID3 ); |
|
566 //only returning ETrue if backup process is still active |
|
567 retValue = ProcessExists( fileManagerSecureId ); |
|
568 } |
|
569 } |
|
570 |
|
571 return retValue; |
|
572 } |
|
573 |
|
574 // ----------------------------------------------------------------------------- |
|
575 // TObexUtilsUiLayer::PrepareDialogExecuteL |
|
576 // ----------------------------------------------------------------------------- |
|
577 // |
|
578 void TObexUtilsUiLayer::PrepareDialogExecuteL( const TInt& aResourceID, CEikDialog* aDialog ) |
|
579 { |
|
580 if (IsCoverDisplayL()) |
|
581 { |
|
582 TInt dialogIndex = |
|
583 ((aResourceID & KResourceNumberMask) - KFirstResourceOffset) + KEnumStart; |
|
584 aDialog->PublishDialogL( dialogIndex, KObexUtilsCategory ); |
|
585 } |
|
586 } |
|
587 |
|
588 // ----------------------------------------------------------------------------- |
|
589 // TObexUtilsUiLayer::IsCoverDisplayL() |
|
590 // ----------------------------------------------------------------------------- |
|
591 // |
|
592 TBool TObexUtilsUiLayer::IsCoverDisplayL() |
|
593 { |
|
594 TBool coverDisplay = EFalse; |
|
595 FeatureManager::InitializeLibL(); |
|
596 if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) ) |
|
597 { |
|
598 coverDisplay = ETrue; |
|
599 } |
|
600 FeatureManager::UnInitializeLib(); |
|
601 return coverDisplay; |
|
602 } |
|
603 |
|
604 // ----------------------------------------------------------------------------- |
|
605 // TObexUtilsUiLayer::ProcessExists |
|
606 // ----------------------------------------------------------------------------- |
|
607 // |
|
608 TBool TObexUtilsUiLayer::ProcessExists( const TSecureId& aSecureId ) |
|
609 { |
|
610 _LIT( KFindPattern, "*" ); |
|
611 TFindProcess finder(KFindPattern); |
|
612 TFullName processName; |
|
613 while( finder.Next( processName ) == KErrNone ) |
|
614 { |
|
615 RProcess process; |
|
616 if ( process.Open( processName ) == KErrNone ) |
|
617 { |
|
618 TSecureId processId( process.SecureId() ); |
|
619 process.Close(); |
|
620 if( processId == aSecureId ) |
|
621 { |
|
622 return ETrue; |
|
623 } |
|
624 } |
|
625 } |
|
626 return EFalse; |
|
627 } |
|
628 // End of File |