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