messagingappbase/msgavkon/muiu_domain/launcher/src/MuiuMsgEditorService.cpp
branchRCL_3
changeset 17 caea42e26caa
parent 0 72b543305e3a
equal deleted inserted replaced
9:1d7827e39b52 17:caea42e26caa
    31 
    31 
    32 
    32 
    33 // CONSTANTS
    33 // CONSTANTS
    34 _LIT( KRomDriveLetter, "z:" );
    34 _LIT( KRomDriveLetter, "z:" );
    35 
    35 
    36 
    36 const TInt KSmsViewerLaunchDelay = 100000; // microseconds
       
    37 const TInt KMaxNumberOfTrials    = 25;
    37 // ---------------------------------------------------------
    38 // ---------------------------------------------------------
    38 // RMuiuMsgEditorService::OpenEntryL
    39 // RMuiuMsgEditorService::OpenEntryL
    39 // ---------------------------------------------------------
    40 // ---------------------------------------------------------
    40 //
    41 //
    41 void RMuiuMsgEditorService::OpenEntryL( const TEditorParameters aParams )
    42 void RMuiuMsgEditorService::OpenEntryL( const TEditorParameters aParams )
   102 void CMuiuMsgEditorService::ConstructL( const TEditorParameters aParams, 
   103 void CMuiuMsgEditorService::ConstructL( const TEditorParameters aParams, 
   103                                         MAknServerAppExitObserver* aObserver)
   104                                         MAknServerAppExitObserver* aObserver)
   104     {
   105     {
   105     const TUid uid = DiscoverL( aParams );
   106     const TUid uid = DiscoverL( aParams );
   106     if( uid != KNullUid )
   107     if( uid != KNullUid )
   107         {
   108         {  
   108         iService.ConnectChainedAppL( uid );
   109          // To get rid of KErrorInUse( when msgeditor is open and trying to view new message)
       
   110          //  We try to launch it again after 100 miliseconds.
       
   111         TInt err = KErrInUse;
       
   112         for ( TInt count = 0; err == KErrInUse  &&  count < KMaxNumberOfTrials ; count++ )
       
   113              {                      
       
   114              TRAP( err, iService.ConnectChainedAppL( uid )); 
       
   115              if ( err == KErrInUse )
       
   116                  {    
       
   117                   User::After( KSmsViewerLaunchDelay );
       
   118                  }
       
   119              else if( err != KErrNone )
       
   120                  {
       
   121                  User::Leave( err );
       
   122                  }
       
   123              }
       
   124 
   109         iMonitor = CApaServerAppExitMonitor::NewL( iService, 
   125         iMonitor = CApaServerAppExitMonitor::NewL( iService, 
   110                                                    *aObserver, 
   126                                                    *aObserver, 
   111                                                    CActive::EPriorityStandard );
   127                                                    CActive::EPriorityStandard );
   112         iService.OpenEntryL( aParams );
   128         iService.OpenEntryL( aParams );
   113         }
   129         }