logsui/EngineSrc/CLogsEngine.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 event
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <featmgr.h>
       
    22 #include <charconv.h>
       
    23 
       
    24 #include "CLogsEngine.h"
       
    25 #include "CLogsModelFactory.h"
       
    26 #include "CLogsClearLogFactory.h"
       
    27 #include "CLogsReaderFactory.h"
       
    28 #include "CLogsConfigFactory.h"
       
    29 #include "CLogsGetEventFactory.h"
       
    30 #include "CLogsSharedDataFactory.h"
       
    31 #include "CLogsSystemAgentFactory.h"
       
    32 #include "CLogsEventUpdater.h"
       
    33 #include "CLogsSMSEventUpdater.h"
       
    34 #include "CLogsCntLinkChecker.h"
       
    35 
       
    36 #include "MLogsClearLog.h"
       
    37 #include "MLogsStateHolder.h"
       
    38 #include "MLogsReader.h"
       
    39 #include "MLogsConfig.h"
       
    40 #include "MLogsGetEvent.h"
       
    41 #include "MLogsSharedData.h"
       
    42 #include "MLogsSystemAgent.h"
       
    43 
       
    44 
       
    45 // #include <TelephonyInternalPSKeys.h> 
       
    46 
       
    47 // CONSTANTS
       
    48 
       
    49 // ----------------------------------------------------------------------------
       
    50 // CLogsEngine::NewL
       
    51 // ----------------------------------------------------------------------------
       
    52 //
       
    53 EXPORT_C CLogsEngine* CLogsEngine::NewL()
       
    54     {
       
    55     CLogsEngine* self = new (ELeave) CLogsEngine();
       
    56     CleanupStack::PushL( self );
       
    57     self->ConstructL();
       
    58     CleanupStack::Pop();
       
    59     return self;
       
    60     }
       
    61 
       
    62 // ----------------------------------------------------------------------------
       
    63 // CLogsEngine::CLogsEngine
       
    64 // ----------------------------------------------------------------------------
       
    65 //
       
    66 CLogsEngine::CLogsEngine() 
       
    67     {
       
    68     }
       
    69 
       
    70 // ----------------------------------------------------------------------------
       
    71 // CLogsEngine::
       
    72 // ----------------------------------------------------------------------------
       
    73 //
       
    74 EXPORT_C CLogsEngine::~CLogsEngine()
       
    75     {
       
    76     delete iMainModel;
       
    77     delete iReceivedModel;
       
    78     delete iDialledModel;
       
    79     delete iMissedModel;
       
    80     delete iClearLogs;
       
    81     delete iSMSUpdater;
       
    82     delete iEventUpdater;
       
    83     delete iCntLinkChecker;
       
    84     delete iConfig;
       
    85     delete iGetEvent;    
       
    86     delete iLogClient;    
       
    87     delete iSharedData;
       
    88     delete iSystemAgent;
       
    89     delete iConverter;
       
    90     delete iClearNewMissed;
       
    91 
       
    92     iFsSession.Close();
       
    93     }
       
    94 
       
    95 
       
    96 // ----------------------------------------------------------------------------
       
    97 // CLogsEngine::ConstructL
       
    98 // ----------------------------------------------------------------------------
       
    99 //
       
   100 void CLogsEngine::ConstructL( )
       
   101     {
       
   102     User::LeaveIfError( iFsSession.Connect() );
       
   103     iLogClient = CLogClient::NewL( iFsSession );
       
   104 
       
   105     //Texts in LOGWRAP.RLS / LOGWRAP.RSS        
       
   106     User::LeaveIfError( iLogClient->GetString( iStrings.iInDirection, R_LOG_DIR_IN ) );
       
   107     User::LeaveIfError( iLogClient->GetString( iStrings.iOutDirection, R_LOG_DIR_OUT ) );
       
   108     User::LeaveIfError( iLogClient->GetString( iStrings.iMissedDirection, R_LOG_DIR_MISSED ) );
       
   109 	User::LeaveIfError( iLogClient->GetString( iStrings.iUnKnownNumber, R_LOG_REMOTE_UNKNOWN ) ); //"Unknown" (Logwrap.rls)
       
   110     User::LeaveIfError( iLogClient->GetString( iStrings.iInDirectionAlt, R_LOG_DIR_IN_ALT ) );    //"Incoming on alternate line"
       
   111     User::LeaveIfError( iLogClient->GetString( iStrings.iOutDirectionAlt, R_LOG_DIR_OUT_ALT ) );
       
   112     User::LeaveIfError( iLogClient->GetString( iStrings.iFetched, R_LOG_DIR_FETCHED) );           //"Fetched"
       
   113 
       
   114     iSharedData = CLogsSharedDataFactory::SharedDataL();
       
   115 
       
   116     //Construct Unicode converter to convert 8-bit strings to 16-bit strings and check to see if the 
       
   117     //character set is supported - if not then leave.
       
   118     iConverter = CCnvCharacterSetConverter::NewL();
       
   119     if (iConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierIso88591, iFsSession ) 
       
   120         != CCnvCharacterSetConverter::EAvailable)
       
   121         {
       
   122         User::Leave(KErrNotSupported);
       
   123         }
       
   124 
       
   125     //Contruct system agent immediately
       
   126     SystemAgentL();
       
   127     }
       
   128 
       
   129 
       
   130 // ----------------------------------------------------------------------------
       
   131 // CLogsEngine::Model
       
   132 // ----------------------------------------------------------------------------
       
   133 //
       
   134 EXPORT_C MLogsModel* CLogsEngine::Model(TLogsModel aModel) const
       
   135     {
       
   136     switch( aModel )
       
   137         {
       
   138         case ELogsMainModel:
       
   139             return iMainModel;
       
   140             //break;
       
   141         case ELogsReceivedModel:
       
   142             return iReceivedModel;
       
   143             //break;
       
   144 
       
   145         case ELogsDialledModel:
       
   146             return iDialledModel;
       
   147             //break;
       
   148 
       
   149         case ELogsMissedModel:
       
   150             return iMissedModel;
       
   151             //break;
       
   152 
       
   153         default:
       
   154             return NULL;
       
   155             //break;
       
   156         }
       
   157     }
       
   158 
       
   159 // ----------------------------------------------------------------------------
       
   160 // CLogsEngine::ClearLogsL
       
   161 // ----------------------------------------------------------------------------
       
   162 //
       
   163 EXPORT_C MLogsClearLog* CLogsEngine::ClearLogsL()
       
   164     {
       
   165     if( ! iClearLogs )
       
   166         {
       
   167         iClearLogs = CLogsClearLogFactory::LogsClearLogL( iFsSession, this ); 
       
   168         }
       
   169         
       
   170     return iClearLogs;
       
   171     }
       
   172 
       
   173 
       
   174 // ----------------------------------------------------------------------------
       
   175 // CLogsEngine::ClearNewMissedL
       
   176 // ----------------------------------------------------------------------------
       
   177 //
       
   178 EXPORT_C MLogsClearNewMissed* CLogsEngine::ClearNewMissedL()
       
   179     {
       
   180     if( !iClearNewMissed )
       
   181         {
       
   182         iClearNewMissed = CLogsClearNewMissed::NewL( iFsSession ); 
       
   183         }
       
   184         
       
   185     return iClearNewMissed;
       
   186     }
       
   187 
       
   188 // ----------------------------------------------------------------------------
       
   189 // CLogsEngine::DeleteClearNewMissedL
       
   190 // ----------------------------------------------------------------------------
       
   191 //
       
   192 void CLogsEngine::DeleteClearNewMissedL()
       
   193     {
       
   194     delete iClearNewMissed;
       
   195     iClearNewMissed = NULL;
       
   196     }
       
   197 
       
   198 
       
   199 // ----------------------------------------------------------------------------
       
   200 // CLogsEngine::EventUpdaterL
       
   201 // ----------------------------------------------------------------------------
       
   202 //
       
   203 EXPORT_C MLogsReader* CLogsEngine::EventUpdaterL()
       
   204     {
       
   205     if( ! iEventUpdater )
       
   206         {
       
   207         iEventUpdater = CLogsEventUpdater::NewL( 
       
   208                     iFsSession,        
       
   209                     this,                                                                
       
   210                     CVPbkPhoneNumberMatchStrategy::EVPbkExactMatchFlag  );                                                       
       
   211         }
       
   212     return iEventUpdater;
       
   213     }
       
   214 
       
   215 // ----------------------------------------------------------------------------
       
   216 // CLogsEngine::CntLinkCheckerL
       
   217 // ----------------------------------------------------------------------------
       
   218 //
       
   219 EXPORT_C CLogsCntLinkChecker* CLogsEngine::CntLinkCheckerL()
       
   220     {
       
   221     if( ! iCntLinkChecker )
       
   222         {
       
   223         iCntLinkChecker = CLogsCntLinkChecker::NewL( 
       
   224                     iFsSession,        
       
   225                     NULL );                                                       
       
   226         }
       
   227     return iCntLinkChecker;
       
   228     }
       
   229 // ----------------------------------------------------------------------------
       
   230 // CLogsEngine::ConfigL
       
   231 //
       
   232 // For Log db settings manipulation
       
   233 // ----------------------------------------------------------------------------
       
   234 //
       
   235 EXPORT_C MLogsConfig* CLogsEngine::ConfigL()
       
   236     {
       
   237     if( ! iConfig )
       
   238         {
       
   239         iConfig = CLogsConfigFactory::LogsConfigL( iFsSession ); 
       
   240         }
       
   241     return iConfig;
       
   242     }
       
   243 
       
   244 // ----------------------------------------------------------------------------
       
   245 // CLogsEngine::GetEventL
       
   246 //
       
   247 // Reads full Event data for Logs detail view
       
   248 // ----------------------------------------------------------------------------
       
   249 //
       
   250 EXPORT_C MLogsGetEvent* CLogsEngine::GetEventL()
       
   251     {
       
   252     if( ! iGetEvent )
       
   253         {
       
   254         iGetEvent = CLogsGetEventFactory::LogsGetEventL( iFsSession, 
       
   255                         iStrings );
       
   256         }
       
   257     return iGetEvent;
       
   258     }
       
   259 
       
   260 // ----------------------------------------------------------------------------
       
   261 // CLogsEngine::SharedDataL
       
   262 // ----------------------------------------------------------------------------
       
   263 //
       
   264 EXPORT_C MLogsSharedData* CLogsEngine::SharedDataL()
       
   265     {
       
   266 	if ( !iSharedData )
       
   267 		{
       
   268 		iSharedData = CLogsSharedDataFactory::SharedDataL();
       
   269 		}
       
   270     return iSharedData;
       
   271     }
       
   272 
       
   273 // ----------------------------------------------------------------------------
       
   274 // CLogsEngine::SystemAgentL
       
   275 // ----------------------------------------------------------------------------
       
   276 //
       
   277 EXPORT_C MLogsSystemAgent* CLogsEngine::SystemAgentL()
       
   278     {
       
   279     if( ! iSystemAgent )
       
   280         {
       
   281         iSystemAgent = CLogsSystemAgentFactory::LogsSystemAgentL( NULL, this );
       
   282         }
       
   283     return iSystemAgent;
       
   284     }
       
   285 
       
   286 // ----------------------------------------------------------------------------
       
   287 // CLogsEngine::DeleteGetEvent
       
   288 // ----------------------------------------------------------------------------
       
   289 //
       
   290 EXPORT_C void CLogsEngine::DeleteGetEvent()
       
   291     {
       
   292     delete iGetEvent;
       
   293     iGetEvent = NULL;
       
   294     }
       
   295 
       
   296 // ----------------------------------------------------------------------------
       
   297 // CLogsEngine::DeleteEventUpdater
       
   298 // ----------------------------------------------------------------------------
       
   299 //
       
   300 EXPORT_C void CLogsEngine::DeleteEventUpdater()
       
   301     {
       
   302     delete iEventUpdater;
       
   303     iEventUpdater = NULL;
       
   304     }
       
   305 
       
   306 // ----------------------------------------------------------------------------
       
   307 // CLogsEngine::DeleteCntLinkChecker
       
   308 // ----------------------------------------------------------------------------
       
   309 //
       
   310 EXPORT_C void CLogsEngine::DeleteCntLinkChecker()
       
   311     {
       
   312     delete iCntLinkChecker;
       
   313     iCntLinkChecker = NULL;
       
   314     }
       
   315 // ----------------------------------------------------------------------------
       
   316 // CLogsEngine::DeleteSMSEventUpdater
       
   317 // ----------------------------------------------------------------------------
       
   318 //
       
   319 EXPORT_C void CLogsEngine::DeleteSMSEventUpdater()
       
   320     {
       
   321     delete iSMSUpdater;
       
   322     iSMSUpdater = NULL;
       
   323     }
       
   324 
       
   325 // ----------------------------------------------------------------------------
       
   326 // CLogsEngine::DeleteSystemAgent
       
   327 // ----------------------------------------------------------------------------
       
   328 //
       
   329 EXPORT_C void CLogsEngine::DeleteSystemAgent()
       
   330     {
       
   331     delete iSystemAgent;
       
   332     iSystemAgent = NULL;
       
   333     }
       
   334 
       
   335 // ----------------------------------------------------------------------------
       
   336 // CLogsEngine::DeleteConfig
       
   337 // ----------------------------------------------------------------------------
       
   338 //
       
   339 EXPORT_C void CLogsEngine::DeleteConfig()
       
   340     {
       
   341     delete iConfig;
       
   342     iConfig = NULL;
       
   343     }
       
   344 
       
   345 // ----------------------------------------------------------------------------
       
   346 // CLogsEngine::DeleteClearLog
       
   347 // ----------------------------------------------------------------------------
       
   348 //
       
   349 EXPORT_C void CLogsEngine::DeleteClearLog()
       
   350     {
       
   351     delete iClearLogs;
       
   352     iClearLogs = NULL;
       
   353     }
       
   354 
       
   355 // ----------------------------------------------------------------------------
       
   356 // CLogsEngine::CreateModelL
       
   357 // ----------------------------------------------------------------------------
       
   358 //
       
   359 EXPORT_C void CLogsEngine::CreateModelL( TLogsModel aModel )
       
   360     {
       
   361     switch( aModel )
       
   362         {
       
   363         case ELogsMainModel:
       
   364             if( ! iMainModel )
       
   365                 {
       
   366                 iMainModel = CLogsModelFactory::ModelL( iFsSession, 
       
   367                                         ELogsMainModel, iStrings, this );
       
   368                 }
       
   369             break;
       
   370 
       
   371         case ELogsReceivedModel:
       
   372             if( ! iReceivedModel )
       
   373                 {
       
   374                 iReceivedModel = CLogsModelFactory::ModelL( iFsSession, 
       
   375                                         ELogsReceivedModel, iStrings, this  );
       
   376                 }
       
   377             break;
       
   378 
       
   379         case ELogsDialledModel:
       
   380         if( ! iDialledModel )
       
   381                 {
       
   382                 iDialledModel = CLogsModelFactory::ModelL( iFsSession, 
       
   383                                         ELogsDialledModel, iStrings, this  );
       
   384                 }
       
   385             break;
       
   386 
       
   387         case ELogsMissedModel:
       
   388             if( ! iMissedModel )
       
   389                 {
       
   390                 iMissedModel = CLogsModelFactory::ModelL( iFsSession, 
       
   391                                         ELogsMissedModel, iStrings, this  );
       
   392                 }
       
   393             break;
       
   394 
       
   395         default:
       
   396             break;
       
   397         }
       
   398     }
       
   399 
       
   400 // ----------------------------------------------------------------------------
       
   401 // CLogsEngine::StartSMSEventUpdaterL
       
   402 // ----------------------------------------------------------------------------
       
   403 //
       
   404 EXPORT_C void CLogsEngine::StartSMSEventUpdaterL(  )
       
   405     {
       
   406     if( ! iSMSUpdater )
       
   407         {
       
   408 		TInt err = KErrNone;
       
   409 
       
   410 		TRAP( err,	
       
   411               iSMSUpdater = CLogsSMSEventUpdater::NewL( 
       
   412                       iFsSession, 
       
   413                       this, //MLogsObserver
       
   414                       CVPbkPhoneNumberMatchStrategy::EVPbkStopOnFirstMatchFlag );
       
   415 		              // fore SMS event updater we use the same match flag that messaging uses
       
   416                                                                                  
       
   417 			  iSMSUpdater->StartL()
       
   418 			);
       
   419 
       
   420 		// If there is an error, we can't use CLogsSMSEventUpdater
       
   421 		// delete and return
       
   422 		// As the CLogsEngine::StartSMSEventUpdaterL is used in DoActivateL, it's better not to leave, but return
       
   423 		// since view won't be activated and it will mess up viewstack
       
   424 		if( err )
       
   425 			{
       
   426 			delete iSMSUpdater;
       
   427 			iSMSUpdater = NULL;
       
   428 
       
   429 			return;
       
   430 			}
       
   431 		User::LeaveIfError( err ); 
       
   432 		}
       
   433     }
       
   434 
       
   435 // ----------------------------------------------------------------------------
       
   436 // CLogsEngine::StateChangedL
       
   437 // ----------------------------------------------------------------------------
       
   438 //
       
   439 void CLogsEngine::StateChangedL( MLogsStateHolder* aHolder )
       
   440     {    
       
   441     if( aHolder->State() == EStateClearLogFinished ||
       
   442         aHolder->State() == EStateEventUpdaterFinished     )//We have finished deleting/updating an entry in LogDb
       
   443         {                                                   //and have to now reread the corresponding view data
       
   444                                                             //from db. See also CLogsBaseReader::HandleLogViewChangeEventDeletedL
       
   445         
       
   446         // If event updater finished, don't reset the array. 
       
   447         // Avoids unnecessary flicker of "Retrieving data" text 
       
   448         // since the old list is anyway shown before event reading starts.
       
   449         TBool resetArray(ETrue);        
       
   450         if ( aHolder->State() == EStateEventUpdaterFinished )
       
   451             {
       
   452             resetArray = EFalse;
       
   453             }
       
   454         
       
   455         if( iReceivedModel )
       
   456             {
       
   457             iReceivedModel->KickStartL( resetArray );//Does nothing if model is deactivated state
       
   458             }
       
   459         if( iDialledModel )
       
   460             {
       
   461             iDialledModel->KickStartL( resetArray ); //Does nothing if model is deactivated state
       
   462             }
       
   463         if( iMissedModel )
       
   464             {
       
   465             iMissedModel->KickStartL( resetArray );  //Does nothing if model is deactivated state
       
   466             }
       
   467         }
       
   468 
       
   469     //Delete unneeded objects when finished
       
   470     if( aHolder->State() == EStateEventUpdaterFinished )
       
   471         {
       
   472         //FIXME: We cannot do this here because VPbk processing maybe ongoing, this is only
       
   473         //ok when all the asyncronous opening processes for Vpbk have completed successfully
       
   474         //(see CLogsBaseUpdater::BaseConstructL)
       
   475         //DeleteEventUpdater();  
       
   476         }
       
   477 
       
   478     if( aHolder->State() == EStateClearLogFinished )
       
   479         {
       
   480         DeleteClearLog(); 
       
   481         }
       
   482     }
       
   483 
       
   484 /********************************************
       
   485 EXPORT_C void CLogsEngine::CreateSharedDataL()
       
   486 	{
       
   487 	if ( !iSharedData )
       
   488 		{
       
   489 		iSharedData = CLogsSharedDataFactory::SharedDataL();
       
   490 		}
       
   491 	}
       
   492 *********************************************/	
       
   493 
       
   494 // ----------------------------------------------------------------------------
       
   495 // CLogsEngine::FreeResourcesForBGModeL
       
   496 // ----------------------------------------------------------------------------
       
   497 //
       
   498 EXPORT_C void CLogsEngine::FreeResourcesForBGModeL()
       
   499 	{
       
   500 	// Read heap-related statistics for debug use
       
   501 //	RHeap heap = User::Heap();
       
   502 //	TInt size1 = heap.Size();
       
   503 //	TInt bb1;
       
   504 //	TInt avail1 = heap.Available( bb1 );
       
   505 //	TInt frees1;
       
   506 //	TInt count1 = heap.Count( frees1 );
       
   507 
       
   508 	DeleteClearLog();
       
   509 	DeleteSMSEventUpdater();
       
   510 	DeleteEventUpdater();
       
   511 	DeleteConfig();             //Logs settings 
       
   512 	DeleteGetEvent();
       
   513     DeleteClearNewMissedL();
       
   514 	User::LeaveIfError( User::CompressAllHeaps() );
       
   515 	
       
   516 	// Read heap-related statistics for debug use
       
   517 //	TInt size2 = heap.Size();
       
   518 //	TInt bb2;
       
   519 //	TInt avail2 = heap.Available( bb2 );
       
   520 //	TInt frees2;
       
   521 //	TInt count2 = heap.Count( frees2 );
       
   522 	}
       
   523 
       
   524 
       
   525 // ----------------------------------------------------------------------------
       
   526 // CLogsEngine::ConvertToUnicode
       
   527 // ----------------------------------------------------------------------------
       
   528 //
       
   529 EXPORT_C TInt CLogsEngine::ConvertToUnicode(
       
   530     const TDesC8& aForeignText,
       
   531     TDes16& aConvertedText )
       
   532     {       
       
   533     TInt ret = KErrNone;
       
   534     TInt maxConvertLength = aForeignText.Length();        
       
   535     aConvertedText.SetLength(0);    // reset the output buffer
       
   536 
       
   537     //If aConvertedText is too small, truncate input
       
   538     if( aForeignText.Length() > aConvertedText.MaxLength() )
       
   539         {
       
   540         maxConvertLength = aConvertedText.MaxLength();        
       
   541         ret = KErrOverflow;
       
   542         }
       
   543 
       
   544     TBuf16<20> outputBuffer;        // Create a small output buffer 
       
   545 
       
   546     // Initialise a pointer for the unconverted text
       
   547     TPtrC8 remainderOfForeignText( aForeignText.Left( maxConvertLength ) ); 
       
   548 
       
   549     // Create a "state" variable and initialise it with CCnvCharacterSetConverter::KStateDefault
       
   550     // After initialisation the state variable must not be tampered with.
       
   551     // Simply pass into each subsequent call of ConvertToUnicode()
       
   552     TInt state=CCnvCharacterSetConverter::KStateDefault;
       
   553 
       
   554     for(;;) // conversion loop
       
   555         {
       
   556         // Start conversion. When the output buffer is full, return the number
       
   557         // of characters that were not converted
       
   558         const TInt returnValue=iConverter->ConvertToUnicode(outputBuffer, remainderOfForeignText, state);
       
   559 
       
   560         // check to see that the descriptor isn’t corrupt - leave if it is
       
   561         if (returnValue==CCnvCharacterSetConverter::EErrorIllFormedInput)
       
   562             {
       
   563             return KErrCorrupt;//User::Leave(KErrCorrupt);
       
   564             }
       
   565         else if (returnValue<0) // future-proof against "TError" expanding
       
   566             {
       
   567             return KErrGeneral; //User::Leave(KErrGeneral);
       
   568             }
       
   569         
       
   570         aConvertedText.Append(outputBuffer);    // Store the contents of the output buffer. There should be 
       
   571                                                 // enough space as we've already checked Length() of buffer.
       
   572 
       
   573         // Finish conversion if there are no unconverted characters in the remainder buffer
       
   574         if (returnValue==0)
       
   575             {
       
   576             break;
       
   577             }
       
   578 
       
   579         // Remove converted source text from the remainder buffer.
       
   580         // The remainder buffer is then fed back into loop
       
   581         remainderOfForeignText.Set(remainderOfForeignText.Right(returnValue));
       
   582         }
       
   583         
       
   584     return ret;
       
   585     }
       
   586 
       
   587 // ----------------------------------------------------------------------------
       
   588 // CLogsEngine::LogDbStrings
       
   589 //
       
   590 // Returns identification strings used by Log database
       
   591 // ----------------------------------------------------------------------------
       
   592 //
       
   593 EXPORT_C TLogsEventStrings CLogsEngine::LogDbStrings()
       
   594 	{
       
   595 	return iStrings;
       
   596 	}
       
   597 
       
   598 
       
   599 // ----------------------------------------------------------------------------
       
   600 // CLogsEngine::LogDbStrings
       
   601 //
       
   602 // Returns identification strings used by Log database
       
   603 // ----------------------------------------------------------------------------
       
   604 //
       
   605 EXPORT_C CLogClient* CLogsEngine::CLogClientRef()
       
   606 	{
       
   607 	return iLogClient;
       
   608 	}
       
   609 
       
   610 // ----------------------------------------------------------------------------
       
   611 // CLogsEngine::CallStateChangedL
       
   612 // ----------------------------------------------------------------------------
       
   613 //
       
   614 void CLogsEngine::CallStateChangedL( TInt /* aCallState */ )
       
   615     {
       
   616 /****if telephone status changes need to be observed, here can be added code to call the iCallObserver->CallStateChangedL
       
   617      (add call code to CLogsSystemAgent too)
       
   618 
       
   619     switch( aCallState )      //see TelephonyInternalPSKeys.h
       
   620         {
       
   621         case EPSTelephonyCallStateAlerting:
       
   622         case EPSTelephonyCallStateRinging:
       
   623             {
       
   624             //We must immediately stop any db activities as otherwise there is risk that ring tune loading
       
   625             //fails because of too much I/O happening in phone (EMSH-6JDFBV)
       
   626             if( iMissedModel )
       
   627                 {
       
   628                 iMissedModel->DoDeactivate( MLogsModel::ESkipClearing, ETrue  ); 
       
   629                 }
       
   630             if( iReceivedModel )
       
   631                 {
       
   632                 iReceivedModel->DoDeactivate( MLogsModel::ENormalOperation, ETrue );
       
   633                 }
       
   634             if( iDialledModel )
       
   635                 {
       
   636                 iDialledModel->DoDeactivate( MLogsModel::ENormalOperation, ETrue  );
       
   637                 }
       
   638             if( iMainModel )
       
   639                 {
       
   640                 iMainModel->DoDeactivate( MLogsModel::ENormalOperation, ETrue  );
       
   641                 }
       
   642                 
       
   643             FLOG( _L("CLogsEngine: CallState deactivate") );                   
       
   644                 
       
   645             }
       
   646             break;
       
   647             
       
   648         case EPSTelephonyCallStateUninitialized:
       
   649         case EPSTelephonyCallStateNone:
       
   650         case EPSTelephonyCallStateDialling:
       
   651         case EPSTelephonyCallStateAnswering:
       
   652         case EPSTelephonyCallStateDisconnecting:
       
   653         case EPSTelephonyCallStateConnected:
       
   654         case EPSTelephonyCallStateHold:
       
   655             
       
   656         default:            
       
   657             {
       
   658             //We must asap recover the db activities in order to provide the user quick perceived performance
       
   659             if( iMissedModel )
       
   660                 {
       
   661                 iMissedModel->DoActivateL( EFalse );
       
   662                 }
       
   663             if( iReceivedModel )
       
   664                 {
       
   665                 iReceivedModel->DoActivateL( EFalse );
       
   666                 }
       
   667             if( iDialledModel )
       
   668                 {
       
   669                 iDialledModel->DoActivateL( EFalse );
       
   670                 }
       
   671             if( iMainModel )
       
   672                 {
       
   673                 iMainModel->DoActivateL( EFalse );
       
   674                 }
       
   675                 
       
   676             FLOG( _L("CLogsEngine: CallState activate") );                                   
       
   677             
       
   678             }
       
   679             break;            
       
   680         }
       
   681 ****************/        
       
   682     }
       
   683 
       
   684 
       
   685