logsui/EngineSrc/CLogsBaseUpdater.cpp
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     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 *     Implements interface for Logs reader. Common functionality of updater.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <e32base.h>
       
    22 #include <logview.h>
       
    23 #include <logcli.h>
       
    24 
       
    25 #include <CPbk2StoreConfiguration.h>
       
    26 #include <CVPbkContactManager.h>
       
    27 #include <VPbkContactStoreUris.h>
       
    28 #include <CVPbkContactStoreUriArray.h>
       
    29 #include <MVPbkContactLinkArray.h>
       
    30 #include <MVPbkContactLink.h>
       
    31 #include <centralrepository.h>
       
    32 #include <telconfigcrkeys.h>  //For retrieving number of digits to match 
       
    33 #include <TVPbkContactStoreUriPtr.h>
       
    34 #include <MVPbkContactStore.h>
       
    35 #include <MVPbkContactStoreProperties.h>
       
    36 #include <MVPbkContactStoreList.h>
       
    37 #include <CVPbkPhoneNumberMatchStrategy.h>
       
    38 #include <MVPbkContactOperationBase.h>
       
    39 #include <MVPbkStoreContact.h>
       
    40 #include <MVPbkFieldType.h>
       
    41 #include <MVPbkContactFieldTextData.h>
       
    42 #include <MVPbkContactStoreListObserver.h>
       
    43 #include <CPbk2SortOrderManager.h>
       
    44 #include <MPbk2ContactNameFormatter.h>
       
    45 #include <Pbk2ContactNameFormatterFactory.h>
       
    46 
       
    47 #include "CLogsBaseUpdater.h"
       
    48 #include "MLogsObserver.h"
       
    49 
       
    50 
       
    51 
       
    52 // CONSTANTS
       
    53 const TInt KContactMaxLength = 70;
       
    54 
       
    55 
       
    56 // ----------------------------------------------------------------------------
       
    57 // CLogsBaseUpdater::CLogsBaseUpdater
       
    58 // ----------------------------------------------------------------------------
       
    59 //
       
    60 CLogsBaseUpdater::CLogsBaseUpdater( 
       
    61     RFs& aFsSession, 
       
    62     MLogsObserver* aObserver) : 
       
    63         CActive( EPriorityStandard ),
       
    64         iStoreConfigChanged(EFalse),
       
    65         iPbkOperationsOngoing(EFalse),
       
    66         iFsSession( aFsSession ),
       
    67         iObserver( aObserver ),
       
    68         iPhase( EInitNotDone ),
       
    69         iState( EStateUndefined )
       
    70     {
       
    71     }
       
    72 
       
    73 // ----------------------------------------------------------------------------
       
    74 // CLogsBaseUpdater::~CLogsBaseUpdater
       
    75 // ----------------------------------------------------------------------------
       
    76 //
       
    77 CLogsBaseUpdater::~CLogsBaseUpdater()
       
    78     {
       
    79     Cancel();   //Active scheduler eventually calls DoCancel here
       
    80 
       
    81     if( iLogViewEvent )
       
    82         {
       
    83         delete iLogViewEvent;
       
    84         }
       
    85 
       
    86     if( iLogClient )
       
    87         {
       
    88         delete iLogClient;
       
    89         }  
       
    90 
       
    91     delete iEvent;
       
    92     delete iFilter;
       
    93     delete iName;
       
    94     delete iSortOrderManager;
       
    95     delete iNameFormatter;                
       
    96     delete iPhoneNumberMatchStrategy;
       
    97 	delete iContactManager;        
       
    98     delete iStoreArray;    	
       
    99     delete iOperation;  
       
   100     delete iStoreConfiguration;
       
   101     }
       
   102 
       
   103 // ----------------------------------------------------------------------------
       
   104 // CLogsBaseUpdater::BaseConstructL
       
   105 // ----------------------------------------------------------------------------
       
   106 //          //------------------------
       
   107 void CLogsBaseUpdater::BaseConstructL( CVPbkPhoneNumberMatchStrategy::TVPbkPhoneNumberMatchFlags aMatchFlags )
       
   108     {
       
   109         
       
   110 	//Get number of digits used to match
       
   111     CRepository* repository = NULL;
       
   112     TInt error = KErrNone;
       
   113   
       
   114     TRAP( error, repository = CRepository::NewL( KCRUidTelConfiguration ));
       
   115     
       
   116     if ( error == KErrNone)
       
   117         {
       
   118         error = repository->Get( KTelMatchDigits , iDigitsToMatch );
       
   119         delete repository;
       
   120         
       
   121         if( error )
       
   122             {
       
   123             iDigitsToMatch =  7; //KMmsNumberOfDigitsToMatch;
       
   124             }
       
   125     	} 
       
   126     	
       
   127     User::LeaveIfError( error );
       
   128     
       
   129     iMatchFlags = aMatchFlags;
       
   130 
       
   131     iStoreConfiguration = CPbk2StoreConfiguration::NewL();
       
   132     iStoreConfiguration->AddObserverL(*this);
       
   133     ConfigureVPbkStoresL();
       
   134    
       
   135     //Open log db interface
       
   136     iLogClient = CLogClient::NewL( iFsSession );    
       
   137     iEvent = CLogEvent::NewL();
       
   138     iFilter = CLogFilter::NewL();
       
   139       
       
   140     iName = HBufC::NewL( KContactMaxLength );
       
   141     }
       
   142             
       
   143     //Set preferred pbk stores, create Contact Manager and open stores
       
   144     //iStoreArray = CVPbkContactStoreUriArray::NewL();    
       
   145 
       
   146 //    if( aStore == EAllStores || aStore == EPbkAndSim || aStore == ESimOnly )
       
   147 // ----------------------------------------------------------------------------
       
   148 // CLogsBaseUpdater::ConfigurationChanged
       
   149 // ----------------------------------------------------------------------------
       
   150 //
       
   151 void CLogsBaseUpdater::ConfigurationChanged()
       
   152     {
       
   153     // wait until ConfigurationChangedComplete
       
   154     }
       
   155     
       
   156 // ----------------------------------------------------------------------------
       
   157 // CLogsBaseUpdater::ConfigurationChangedComplete
       
   158 // ----------------------------------------------------------------------------
       
   159 //
       
   160 void CLogsBaseUpdater::ConfigurationChangedComplete()
       
   161     {
       
   162     iStoreConfigChanged = ETrue;
       
   163     }
       
   164 
       
   165 // ----------------------------------------------------------------------------
       
   166 // CLogsBaseUpdater::ReConfigureVPbkStoresL
       
   167 // ----------------------------------------------------------------------------
       
   168 //
       
   169 void CLogsBaseUpdater::ReConfigureVPbkStoresL() 
       
   170     {
       
   171     if (!iPbkOperationsOngoing)
       
   172         {
       
   173         iContactManager->ContactStoresL().CloseAll( *this ); 
       
   174     
       
   175         delete iSortOrderManager;
       
   176         iSortOrderManager = NULL;
       
   177         delete iNameFormatter;       
       
   178         iNameFormatter = NULL;
       
   179         delete iPhoneNumberMatchStrategy;
       
   180         iPhoneNumberMatchStrategy = NULL;
       
   181         delete iContactManager;  
       
   182         iContactManager = NULL;      
       
   183         delete iStoreArray;  
       
   184         iStoreArray = NULL;
       
   185 
       
   186         ConfigureVPbkStoresL();
       
   187         }
       
   188     }
       
   189 
       
   190 // ----------------------------------------------------------------------------
       
   191 // CLogsBaseUpdater::ConfigureVPbkStoresL
       
   192 // ----------------------------------------------------------------------------
       
   193 //
       
   194 void CLogsBaseUpdater::ConfigureVPbkStoresL() 
       
   195     {
       
   196     iPhase = EInitNotDone;
       
   197     iPbkOperationsOngoing = ETrue;
       
   198     iStoreConfigChanged = EFalse;
       
   199     
       
   200     iStoreArray = iStoreConfiguration->CurrentConfigurationL(); 
       
   201  
       
   202     iContactManager = CVPbkContactManager::NewL( *iStoreArray, &iFsSession );
       
   203     iContactManager->ContactStoresL().OpenAllL( *this );  //Wait until OpenComplete() is called before executing searches.
       
   204 
       
   205     //Create default search strategy. We use same search order that is already set in the iStoreArray
       
   206     CVPbkPhoneNumberMatchStrategy::TConfig config = 
       
   207         CVPbkPhoneNumberMatchStrategy::TConfig(
       
   208                 iDigitsToMatch,                                        //MaxMatchDigits, 
       
   209                 *iStoreArray,                                         //Store priority order
       
   210                 CVPbkPhoneNumberMatchStrategy::EVPbkSequentialMatch,  //EVPbkSequentialMatch / EVPbkParallelMatch
       
   211                 iMatchFlags ); 
       
   212                     //EVPbkExactMatchFlag: Quarantees that only contacts with an exact match are included in the result set
       
   213                     //EVPbkStopOnFirstMatchFlag: Stops the search once at least one contact is found
       
   214 
       
   215     iPhoneNumberMatchStrategy = CVPbkPhoneNumberMatchStrategy::NewL( config, *iContactManager, *this );                                               
       
   216                                
       
   217     //Create name formatter for contact name
       
   218     iSortOrderManager = CPbk2SortOrderManager::NewL( iContactManager->FieldTypes() );
       
   219     iNameFormatter = Pbk2ContactNameFormatterFactory::CreateL(
       
   220             iContactManager->FieldTypes(),  
       
   221             *iSortOrderManager );   //Ref, ownership here
       
   222 
       
   223     iOperation = NULL; 
       
   224     }
       
   225 
       
   226 
       
   227 // ----------------------------------------------------------------------------
       
   228 // CLogsBaseUpdater::OpenComplete
       
   229 //
       
   230 // From MVPbkContactStoreListObserver. Called when the opening process is complete, ie. all 
       
   231 // stores have been reported either failed or successfully opened.
       
   232 // ----------------------------------------------------------------------------
       
   233 //
       
   234 void CLogsBaseUpdater::OpenComplete()
       
   235     {
       
   236     //Note1 We will start running the search only when open attempts of all requested stores are processed. 
       
   237     //In case it takes too long, we may need to consider creating a search strategy already in 
       
   238     //CLogsBaseUpdater::StoreReady and starting the search there and upgrading strategy when the slowly opening
       
   239     //stores are available too.
       
   240     //Note2 Here we assume that at least one store (pbk itself) is always successfully opened, so we don't check 
       
   241     //availability of stores.
       
   242     
       
   243     iPbkOperationsOngoing = EFalse;
       
   244        
       
   245     if( iPhase == EInitNotDoneStartReq )    
       
   246         {
       
   247         iPhase = EInitDone; 
       
   248         TInt err;
       
   249         TRAP( err, StartRunningL()); //We have a pending start request, so start immediately               
       
   250         }
       
   251     else 
       
   252         {
       
   253         iPhase = EInitDone;  
       
   254         }
       
   255     }
       
   256 
       
   257 // ----------------------------------------------------------------------------
       
   258 // CLogsBaseUpdater::StoreReady
       
   259 //
       
   260 // From MVPbkContactStoreListObserver. Called when a contact store is ready to use.
       
   261 // ----------------------------------------------------------------------------
       
   262 //
       
   263 void CLogsBaseUpdater::StoreReady(MVPbkContactStore& aContactStore)
       
   264     {
       
   265     //Note. We start a pending search only when open attempts of all stores are 
       
   266     // processed (see CLogsBaseUpdater::OpenComplete)    
       
   267     const TDesC& uri = aContactStore.StoreProperties().Name().UriDes();    
       
   268     }
       
   269 
       
   270 // ----------------------------------------------------------------------------
       
   271 // CLogsBaseUpdater::StoreUnavailable
       
   272 //
       
   273 // Called when a contact store becomes unavailable.
       
   274 // ----------------------------------------------------------------------------
       
   275 //
       
   276 void CLogsBaseUpdater::StoreUnavailable(MVPbkContactStore& aContactStore, TInt /* aReason */ )
       
   277     {
       
   278     const TDesC& uri = aContactStore.StoreProperties().Name().UriDes();
       
   279     
       
   280     if ( uri == VPbkContactStoreUris::SimGlobalOwnNumberUri() )
       
   281         {
       
   282                     //Sim pbk not ok
       
   283         }
       
   284     else if ( uri == VPbkContactStoreUris::DefaultCntDbUri() )        
       
   285         {
       
   286                     //Normal phonebook not ok        
       
   287         }
       
   288     else
       
   289         {
       
   290         }        
       
   291     }
       
   292 
       
   293 // ----------------------------------------------------------------------------
       
   294 // CLogsBaseUpdater::HandleStoreEventL
       
   295 //
       
   296 // Called when changes occur in the contact store.
       
   297 // ----------------------------------------------------------------------------
       
   298 //
       
   299 void CLogsBaseUpdater::HandleStoreEventL( MVPbkContactStore&     /* aContactStore */, 
       
   300                                           TVPbkContactStoreEvent /* aStoreEvent */)
       
   301     {
       
   302     }
       
   303 
       
   304 // ----------------------------------------------------------------------------
       
   305 // CLogsBaseUpdater::FindCompleteL
       
   306 //
       
   307 // from MVPbkContactFindObserver
       
   308 // Called when find is complete. We must take ownership of the results at the end
       
   309 // of this function in case we would use the the results after this function has 
       
   310 // exited.
       
   311 // ----------------------------------------------------------------------------
       
   312 //
       
   313 void CLogsBaseUpdater::FindCompleteL(MVPbkContactLinkArray* aResults)
       
   314     {
       
   315     //In case of an error during find, the aResults may contain only partial results of the find.
       
   316     if( aResults->Count() == 1 )   
       
   317         {
       
   318         // The operation needs to be deleted later to avoid memory leak, so we need to store it                             
       
   319         iOperation = iContactManager->RetrieveContactL( aResults->At( 0 ), *this );
       
   320         }    
       
   321     else    // Fix to error EKCN-73N7VN. In case there was no contact found, we still need to 
       
   322         {   // set the KLogEventContactSearched flag, so the sms is shown in the Log view
       
   323         iPbkOperationsOngoing = EFalse;
       
   324         ContinueRunningL( KErrNotFound );    
       
   325         }
       
   326       
       
   327     delete aResults;    //We don't take ownersip, so delete results (caller will take care
       
   328     aResults = NULL;    // of it's cleanupstack)
       
   329     }
       
   330 
       
   331 // ----------------------------------------------------------------------------
       
   332 // CLogsBaseUpdater::FindFailed
       
   333 //
       
   334 // Called in case the find fails for some reason.
       
   335 // ----------------------------------------------------------------------------
       
   336 //
       
   337 void CLogsBaseUpdater::FindFailed(TInt /* aError */)
       
   338     {
       
   339     iPbkOperationsOngoing = EFalse;
       
   340     //If find not successful,we can stop processing here
       
   341     }
       
   342 
       
   343 // ----------------------------------------------------------------------------
       
   344 // CLogsBaseUpdater::VPbkSingleContactOperationComplete
       
   345 //
       
   346 // from MVPbkSingleContactOperationObserver. Called when operation is completed.
       
   347 //
       
   348 // @param aOperation the completed operation.
       
   349 // @param aContact  the contact returned by the operation.
       
   350 //                  Client must take the ownership immediately.
       
   351 //
       
   352 //                  !!! NOTICE !!!
       
   353 //                  If you use Cleanupstack for MVPbkStoreContact
       
   354 //                  Use MVPbkStoreContact::PushL or
       
   355 //                  CleanupDeletePushL from e32base.h.
       
   356 //                  (Do Not Use CleanupStack::PushL(TAny*) because
       
   357 //                  then the virtual destructor of the M-class
       
   358 //                  won't be called when the object is deleted).
       
   359 // ----------------------------------------------------------------------------
       
   360 //
       
   361 void CLogsBaseUpdater::VPbkSingleContactOperationComplete(
       
   362     MVPbkContactOperationBase&  aOperation,
       
   363     MVPbkStoreContact*          aContact) //must take the ownership immediately
       
   364     {
       
   365     TInt err;
       
   366     TRAP( err, ProcessVPbkSingleContactOperationCompleteL( 
       
   367                     aOperation, aContact)); 
       
   368                     
       
   369     // At this point, the operation can be deleted
       
   370     delete iOperation;
       
   371     iOperation = NULL;
       
   372     iPbkOperationsOngoing = EFalse;
       
   373     }
       
   374 
       
   375 // ----------------------------------------------------------------------------
       
   376 // CLogsBaseUpdater::ProcessVPbkSingleContactOperationCompleteL
       
   377 // ----------------------------------------------------------------------------
       
   378 //
       
   379 void CLogsBaseUpdater::ProcessVPbkSingleContactOperationCompleteL(
       
   380     MVPbkContactOperationBase& aOperation,
       
   381     MVPbkStoreContact* aContact ) //must take the ownership immediately
       
   382     {
       
   383     CleanupDeletePushL( aContact ); //take ownership 
       
   384     ProcessVPbkSingleContactOperationCompleteImplL( aOperation, aContact );
       
   385     CleanupStack::PopAndDestroy( aContact ); 
       
   386     ContinueRunningL( 0 );   //FieldId   <<<<<FIXME      
       
   387     }
       
   388 
       
   389 // ----------------------------------------------------------------------------
       
   390 // CLogsBaseUpdater::ProcessVPbkSingleContactOperationCompleteImplL
       
   391 // ----------------------------------------------------------------------------
       
   392 //
       
   393 void CLogsBaseUpdater::ProcessVPbkSingleContactOperationCompleteImplL(
       
   394     MVPbkContactOperationBase& /* aOperation */,
       
   395     MVPbkStoreContact* aContact )
       
   396     {
       
   397     TPtr name( iName->Des() );
       
   398     name.Zero();  
       
   399     MVPbkStoreContactFieldCollection& fields = aContact->Fields();
       
   400 
       
   401     HBufC* formattedName = NULL;
       
   402     formattedName = iNameFormatter->GetContactTitleOrNullL( fields, 0 );
       
   403         
       
   404     CleanupStack::PushL( formattedName );
       
   405     
       
   406     if (formattedName != NULL) 
       
   407     	{
       
   408     
       
   409 	    TPtr formatted( formattedName->Des() );
       
   410 	    name.Copy(formatted.Left( name.MaxLength() )); //If MaxLength greater than the length, Left()
       
   411 	   
       
   412 	    /*  FIXME: WE need to retrieve field id 
       
   413 	    TInt count = fields.FieldCount();
       
   414 
       
   415 	    for(TInt i = 0; i < count; i++ )
       
   416 	        {
       
   417 	        MVPbkStoreContactField& field = fields.FieldAt( i ); 
       
   418 	            // const MVPbkFieldType* fieldType = field.BestMatchingFieldType(); 
       
   419 	            //fldType->Matches(TVPbkFieldVersitProperty , 0)
       
   420 	        const MVPbkContactFieldData& fieldData = field.FieldData();  
       
   421 	        
       
   422 	        if ( fieldData.DataType() == EVPbkFieldStorageTypeText )
       
   423 	            {
       
   424 	            const MVPbkContactFieldTextData& textData = MVPbkContactFieldTextData::Cast(fieldData);
       
   425 	            TPtrC text = textData.Text();
       
   426 	            name.Copy(text.Left( name.MaxLength() )); //If MaxLength greater than the length, Left()
       
   427 	                                                      //just extracts the whole of the descriptor  
       
   428 	            //no contact id anymore available
       
   429 	            }
       
   430 	        }        
       
   431 	    */        
       
   432     	
       
   433    		}
       
   434    		
       
   435     CleanupStack::PopAndDestroy( formattedName );  //  just extracts the whole of the descriptor    
       
   436     }
       
   437 
       
   438 // ----------------------------------------------------------------------------
       
   439 // CLogsBaseUpdater::VPbkSingleContactOperationFailed
       
   440 //
       
   441 // Called if the operation fails.
       
   442 // ----------------------------------------------------------------------------
       
   443 //
       
   444 void CLogsBaseUpdater::VPbkSingleContactOperationFailed( 
       
   445     MVPbkContactOperationBase& /* aOperation */,
       
   446     TInt                       /* aError */)
       
   447     {
       
   448     TInt err;
       
   449     TRAP( err,  ContinueRunningL( KErrNotFound )); //If not successful,end processing
       
   450     
       
   451     // At this point, the operation can be deleted
       
   452     delete iOperation;
       
   453     iOperation = NULL;
       
   454     iPbkOperationsOngoing = EFalse;
       
   455     }         
       
   456 
       
   457 // ----------------------------------------------------------------------------
       
   458 // CLogsBaseUpdater::SearchRemotePartyL
       
   459 //
       
   460 // Perform search from Virtual phonbook
       
   461 // ----------------------------------------------------------------------------
       
   462 //
       
   463 TBool CLogsBaseUpdater::SearchRemotePartyL( const TDesC& aNumber )
       
   464     {
       
   465     iPbkOperationsOngoing = ETrue;
       
   466     iPhoneNumberMatchStrategy->MatchL( aNumber );    
       
   467     return ETrue;
       
   468     }
       
   469 
       
   470 // ----------------------------------------------------------------------------
       
   471 // CLogsBaseUpdater::SearchContactLinkL
       
   472 // ----------------------------------------------------------------------------
       
   473 //
       
   474 void  CLogsBaseUpdater::SearchContactLinkL (const TDesC8& aContactLink)
       
   475     {
       
   476     iPbkOperationsOngoing = ETrue;
       
   477     MVPbkContactLinkArray* contactLinkArray = iContactManager->CreateLinksLC( aContactLink );
       
   478     
       
   479     const MVPbkContactLink& contactLink = contactLinkArray->At( 0 );
       
   480     
       
   481     // Retrieve the contact asynchronously
       
   482     iOperation = iContactManager->RetrieveContactL( contactLink, *this );
       
   483     
       
   484     CleanupStack::Pop();
       
   485     delete contactLinkArray;
       
   486     contactLinkArray = NULL;
       
   487     
       
   488     return;
       
   489     }
       
   490 
       
   491 // ----------------------------------------------------------------------------
       
   492 // CLogsBaseUpdater::StartUpdaterL
       
   493 // ----------------------------------------------------------------------------
       
   494 //
       
   495 void CLogsBaseUpdater::StartUpdaterL()   //Called from CLogsBaseView
       
   496     {
       
   497     if( iPhase == EInitNotDone || iPhase == EInitNotDoneStartReq )    
       
   498         {
       
   499         iPhase = EInitNotDoneStartReq;  //Cannot yet start, so set pending search request
       
   500         return;
       
   501         }
       
   502     else 
       
   503         {
       
   504         StartRunningL();            
       
   505         }
       
   506     }
       
   507 
       
   508 // ----------------------------------------------------------------------------
       
   509 // CLogsBaseUpdater::StartL
       
   510 // ----------------------------------------------------------------------------
       
   511 //
       
   512 void CLogsBaseUpdater::StartL()     //Default retrieval functionality in case StartUpdaterL
       
   513     {//was not directly called.
       
   514     if (  !IsActive() && iState != EStateActive  )
       
   515         {
       
   516         iState = EStateInitializing;
       
   517         
       
   518         if (iStoreConfigChanged)
       
   519             {
       
   520             ReConfigureVPbkStoresL();
       
   521             }
       
   522         
       
   523         StartUpdaterL();
       
   524         }
       
   525     }
       
   526 
       
   527 // ----------------------------------------------------------------------------
       
   528 // CLogsBaseUpdater::IsInterrupted
       
   529 // ----------------------------------------------------------------------------
       
   530 //
       
   531 TBool CLogsBaseUpdater::IsInterrupted() const
       
   532     {
       
   533     return EFalse;
       
   534     }
       
   535 
       
   536 // ----------------------------------------------------------------------------
       
   537 // CLogsBaseUpdater::Interrupt
       
   538 // ----------------------------------------------------------------------------
       
   539 //
       
   540 void CLogsBaseUpdater::Interrupt()
       
   541     {
       
   542     }
       
   543 
       
   544 // ----------------------------------------------------------------------------
       
   545 // CLogsBaseUpdater::State
       
   546 // ----------------------------------------------------------------------------
       
   547 //
       
   548 TLogsState CLogsBaseUpdater::State() const
       
   549     {
       
   550     return iState;
       
   551     }
       
   552 
       
   553 // ----------------------------------------------------------------------------
       
   554 // CLogsBaseUpdater::SetObserver
       
   555 // ----------------------------------------------------------------------------
       
   556 //
       
   557 void CLogsBaseUpdater::SetObserver( MLogsObserver* aObserver )
       
   558     {
       
   559     iObserver = aObserver;
       
   560     }
       
   561 
       
   562 // ----------------------------------------------------------------------------
       
   563 // CLogsBaseUpdater::ContinueL
       
   564 // ----------------------------------------------------------------------------
       
   565 //
       
   566 void CLogsBaseUpdater::ContinueL()
       
   567     {
       
   568     }
       
   569 
       
   570 // ----------------------------------------------------------------------------
       
   571 // CLogsBaseUpdater::Stop
       
   572 // ----------------------------------------------------------------------------
       
   573 //
       
   574 void CLogsBaseUpdater::Stop()
       
   575     {
       
   576     iState = EStateInterrupted;
       
   577     Cancel();
       
   578     }
       
   579 
       
   580 // ----------------------------------------------------------------------------
       
   581 // CLogsBaseUpdater::DoCancel
       
   582 // ----------------------------------------------------------------------------
       
   583 //
       
   584 void CLogsBaseUpdater::DoCancel()
       
   585     {
       
   586     iPhase = EInitDone;   //We are always already initialised when DoCancel is called.
       
   587     iState = EStateInterrupted;
       
   588     
       
   589     if( iLogViewEvent )
       
   590         {
       
   591         iLogViewEvent->Cancel();
       
   592         }
       
   593     
       
   594     if( iLogClient )
       
   595         {
       
   596         iLogClient->Cancel();
       
   597         }
       
   598     }
       
   599 
       
   600 // ----------------------------------------------------------------------------
       
   601 // CLogsBaseUpdater::RunL
       
   602 // ----------------------------------------------------------------------------
       
   603 //
       
   604 void CLogsBaseUpdater::RunL()
       
   605     {
       
   606     }
       
   607 
       
   608 // ----------------------------------------------------------------------------
       
   609 // CLogsBaseUpdater::RunError
       
   610 // ----------------------------------------------------------------------------
       
   611 //
       
   612 TInt CLogsBaseUpdater::RunError(TInt aError)
       
   613 	{
       
   614 	if( aError == KErrAccessDenied )    //E.g. if DB is currently being backed up there's no access to it.
       
   615 		{
       
   616 		return KErrNone;
       
   617 		}
       
   618 	else
       
   619 		{
       
   620 		return aError;
       
   621 		}
       
   622 	}
       
   623 
       
   624 // ----------------------------------------------------------------------------
       
   625 // CLogsBaseUpdater::ConfigureL
       
   626 // ----------------------------------------------------------------------------
       
   627 //
       
   628 void CLogsBaseUpdater::ConfigureL( const MLogsReaderConfig* /*aConfig*/ )
       
   629     {
       
   630     }
       
   631 
       
   632 // ----------------------------------------------------------------------------
       
   633 // CLogsBaseUpdater::ActivateL
       
   634 // ----------------------------------------------------------------------------
       
   635 //
       
   636 void CLogsBaseUpdater::ActivateL() //Overridden method in derived classes may leave, that's why
       
   637     {                              // name of this function indicates that this may leave.
       
   638     //no op
       
   639     }
       
   640 
       
   641 // ----------------------------------------------------------------------------
       
   642 // CLogsBaseUpdater::DeActivate
       
   643 // ----------------------------------------------------------------------------
       
   644 //
       
   645 void CLogsBaseUpdater::DeActivate()
       
   646     {
       
   647     //no op
       
   648     }
       
   649 
       
   650 // ----------------------------------------------------------------------------
       
   651 // CLogsBaseUpdater::IsDirty
       
   652 // ----------------------------------------------------------------------------
       
   653 //
       
   654 TBool CLogsBaseUpdater::IsDirty() const
       
   655     {
       
   656     return EFalse;
       
   657     }
       
   658 
       
   659 // ----------------------------------------------------------------------------
       
   660 // CLogsBaseUpdater::SetDirty
       
   661 // ----------------------------------------------------------------------------
       
   662 //
       
   663 void CLogsBaseUpdater::SetDirty()
       
   664     {
       
   665     //no op
       
   666     }
       
   667 
       
   668 
       
   669