omads/omadsappui/AspSyncUtil/src/AspLogDialog.cpp
branchRCL_3
changeset 52 4f0867e42d62
parent 0 dab8a81a92de
equal deleted inserted replaced
51:8e7494275d3a 52:4f0867e42d62
       
     1 /*
       
     2 * Copyright (c) 2005 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 
       
    21 #include "AspLogDialog.h"
       
    22 #include "AspDialogUtil.h"
       
    23 #include "AspUtil.h"
       
    24 #include "AspDebug.h"
       
    25 
       
    26 #include <SyncMLErr.h>  // sync error codes
       
    27 #include "AspSchedule.h"
       
    28 
       
    29 
       
    30 
       
    31 /*******************************************************************************
       
    32  * class CAspLogDialog
       
    33  *******************************************************************************/
       
    34 
       
    35 
       
    36 
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // CAspLogDialog::ShowDialogL
       
    40 // 
       
    41 // -----------------------------------------------------------------------------
       
    42 void CAspLogDialog::ShowDialogL()
       
    43 	{
       
    44 	HBufC* hBuf = CAspResHandler::ReadLC(R_SML_LOG_SYNCLOG_TITLE);
       
    45 
       
    46     TDialogUtil::ShowPopupDialog2L(hBuf->Des(), iList);
       
    47     
       
    48    	CleanupStack::PopAndDestroy(hBuf);
       
    49 	}
       
    50 
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CAspLogDialog::NewL
       
    54 //
       
    55 // -----------------------------------------------------------------------------
       
    56 CAspLogDialog* CAspLogDialog::NewL(const TAspParam& aParam)
       
    57     {
       
    58     CAspLogDialog* self = new (ELeave) CAspLogDialog(aParam);
       
    59     CleanupStack::PushL(self);
       
    60     self->ConstructL();
       
    61     CleanupStack::Pop(self);
       
    62 
       
    63     return(self);
       
    64     }
       
    65 
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // CAspLogDialog::CAspLogDialog
       
    69 // 
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 CAspLogDialog::CAspLogDialog(const TAspParam& aParam)
       
    73 	{
       
    74     iProfileId = aParam.iProfileId;
       
    75 	iSyncSession = aParam.iSyncSession;
       
    76 
       
    77 	__ASSERT_ALWAYS(iSyncSession, TUtil::Panic(KErrArgument));
       
    78     }
       
    79 
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CAspLogDialog::ConstructL
       
    83 //
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 void CAspLogDialog::ConstructL()
       
    87     {
       
    88     iResHandler = CAspResHandler::NewL();
       
    89     iList = new (ELeave) CDesCArrayFlat(1);
       
    90    		
       
    91     TAspParam param(KErrNotFound, iSyncSession);
       
    92 	CAspProfile* profile = CAspProfile::NewLC(param);   		
       
    93 	profile->OpenL(iProfileId, CAspProfile::EOpenRead, CAspProfile::EAllProperties);
       
    94 	
       
    95     TAspParam param2(KErrNotFound, iSyncSession);
       
    96 	param2.iProfile = profile;
       
    97 	param2.iMode = CAspContentList::EInitAll;
       
    98 	CAspContentList* taskList = CAspContentList::NewLC(param2);
       
    99 	
       
   100 	CreateListL(iList, profile, taskList);
       
   101 	
       
   102 	CleanupStack::PopAndDestroy(taskList);
       
   103 	CleanupStack::PopAndDestroy(profile);
       
   104     } 
       
   105 
       
   106 
       
   107 // ----------------------------------------------------------------------------
       
   108 // Destructor
       
   109 //
       
   110 // ----------------------------------------------------------------------------
       
   111 //
       
   112 CAspLogDialog::~CAspLogDialog()
       
   113     {
       
   114 	delete iResHandler;
       
   115     delete iList;
       
   116     }
       
   117 
       
   118 
       
   119 // -----------------------------------------------------------------------------
       
   120 // CAspLogDialog::CreateListL
       
   121 // 
       
   122 // Example log format:
       
   123 //
       
   124 // Profile: PC Suite
       
   125 // Server: PC Suite
       
   126 // Date: 13/10/2004
       
   127 // Time: 11:04
       
   128 // Status: Complete
       
   129 //
       
   130 // Phone:  
       
   131 //
       
   132 // Added Contacts:
       
   133 //  4
       
   134 // Added Notes:
       
   135 //  12
       
   136 // Deleted Calendar:
       
   137 //  2
       
   138 //
       
   139 // Server:
       
   140 //
       
   141 // Added contacts:
       
   142 //  12
       
   143 // 
       
   144 // -----------------------------------------------------------------------------
       
   145 void CAspLogDialog::CreateListL(CDesCArray* aList, CAspProfile* aProfile,
       
   146                                 CAspContentList* aTaskList)
       
   147 	{
       
   148 	_LIT(KTab, "\t");
       
   149 	
       
   150 	aList->Reset();
       
   151 	
       
   152 	const CSyncMLHistoryJob* historyJob = aProfile->LatestHistoryJob();
       
   153    	if (!historyJob)
       
   154    		{
       
   155    		User::Leave(KErrNotFound);  // this profile has not been synced
       
   156    		}
       
   157 
       
   158 		
       
   159 	TTime time = historyJob->TimeStamp();
       
   160 	
       
   161 	CAspResHandler::ReadL(iBuf, R_QTN_SML_LOG_PROFILE); //profile name heading
       
   162 	iBuf.Append(KTab);
       
   163 
       
   164 #ifdef RD_DSUI_TIMEDSYNC
       
   165 	 CAspSchedule* schedule = CAspSchedule::NewLC();
       
   166 	 TInt asProfileId = schedule->AutoSyncProfileId();
       
   167 	 if (asProfileId == aProfile->ProfileId())
       
   168 		{
       
   169 		TInt profileId = schedule->ProfileId();
       
   170 		TAspParam param(KErrNotFound, iSyncSession);
       
   171 		CAspProfile* profile = CAspProfile::NewLC(param);
       
   172 		profile->OpenL(profileId, CAspProfile::EOpenRead, CAspProfile::EAllProperties);
       
   173 
       
   174 		profile->GetName(iBuf2);
       
   175 		CleanupStack::PopAndDestroy(profile);
       
   176 		}
       
   177 	 else
       
   178 		{
       
   179 		aProfile->GetName(iBuf2);
       
   180 		}
       
   181 	 CleanupStack::PopAndDestroy(schedule);
       
   182 #else	 
       
   183 	aProfile->GetName(iBuf2);
       
   184 #endif
       
   185 	iBuf.Append(iBuf2);
       
   186 	AddLineL(aList, iBuf);
       
   187     
       
   188 	CAspResHandler::ReadL(iBuf, R_QTN_SML_LOG_REMOTE); //server name heading
       
   189 	iBuf.Append(KTab);
       
   190 
       
   191 	if(aProfile->IsPCSuiteProfile(aProfile))
       
   192 	{
       
   193 		aProfile->GetLocalisedPCSuite(iBuf2);
       
   194 	}
       
   195 	else
       
   196 	{
       
   197 		TInt num = 0;
       
   198 		aProfile->GetHostAddress(iBuf2, num);
       
   199 	}	
       
   200 	iBuf.Append(iBuf2);
       
   201 	AddLineL(aList, iBuf);
       
   202 		
       
   203     CAspResHandler::ReadL(iBuf, R_QTN_SML_LOG_DATE); // sync date heading
       
   204 	iBuf.Append(KTab);
       
   205 	TUtil::GetDateTextL(iBuf2, time);
       
   206 	iBuf.Append(iBuf2);
       
   207 	AddLineL(aList, iBuf);
       
   208 
       
   209 	CAspResHandler::ReadL(iBuf, R_QTN_SML_LOG_TIME); // sync time heading
       
   210 	iBuf.Append(KTab);
       
   211     TUtil::GetTimeTextL(iBuf2, time);
       
   212 	iBuf.Append(iBuf2);
       
   213 	AddLineL(aList, iBuf);	
       
   214 		
       
   215 
       
   216 	//
       
   217 	// check sync errors
       
   218 	//
       
   219 	CAspResHandler::ReadL(iBuf, R_QTN_SML_LOG_STATUS); // status heading
       
   220 	iBuf.Append(KTab);	
       
   221 		
       
   222 	TInt syncError = historyJob->ResultCode();
       
   223 	if (syncError != KErrNone && syncError != SyncMLError::KErrSlowSync)
       
   224 		{
       
   225 		if (syncError == KErrCancel)
       
   226 			{
       
   227 			CAspResHandler::ReadL(iBuf2, R_QTN_SML_LOG_CANCELLED);
       
   228 			}
       
   229 		else
       
   230 			{
       
   231 			CAspResHandler::ReadL(iBuf2, R_QTN_SML_LOG_ERR);
       
   232 			}
       
   233 		
       
   234 		iBuf.Append(iBuf2);
       
   235 		AddLineL(aList, iBuf);
       
   236 		
       
   237 		// Added for syncml engine error handling and displaying in view logs
       
   238 		if (syncError <= SyncMLError::KErrSyncEngineErrorBase)
       
   239 			{
       
   240 			TInt id = TAspSyncError::GetSmlErrorValue (syncError) ;
       
   241 			CAspResHandler::ReadL(iBuf, R_QTN_SML_LOG_ERROR); // sync error heading
       
   242 			iBuf.Append(KTab);
       
   243 			CAspResHandler::ReadL(iBuf2, id);
       
   244 			iBuf.Append(iBuf2);
       
   245 			AddLineL(aList, iBuf);
       
   246 			}
       
   247 		
       
   248 		return;
       
   249 		}
       
   250 	
       
   251 	if (HasTaskErrors(historyJob))
       
   252 		{
       
   253 		CAspResHandler::ReadL(iBuf2, R_QTN_SML_LOG_ERR);
       
   254 		iBuf.Append(iBuf2);
       
   255     	AddLineL(aList, iBuf);
       
   256 		}
       
   257     else
       
   258     	{
       
   259     	CAspResHandler::ReadL(iBuf2, R_QTN_SML_LOG_OK);
       
   260 	    iBuf.Append(iBuf2);
       
   261     	AddLineL(aList, iBuf);
       
   262     	}
       
   263 		
       
   264 	
       
   265 	if (PhoneModified(historyJob))
       
   266 		{
       
   267 		CAspResHandler::ReadL(iBuf, R_QTN_SML_LOG_PHONE);
       
   268 	    iBuf.Append(KTab);
       
   269    	    AddLineL(aList, iBuf);
       
   270 
       
   271         AddLogItemsL(aList, historyJob, aTaskList, ELogAddedPhone);
       
   272         AddLogItemsL(aList, historyJob, aTaskList, ELogUpdatedPhone);
       
   273         AddLogItemsL(aList, historyJob, aTaskList, ELogDeletedPhone);
       
   274         AddLogItemsL(aList, historyJob, aTaskList, ELogDiscardedPhone);
       
   275         AddLogItemsL(aList, historyJob, aTaskList, ELogMovedPhone);
       
   276 		}
       
   277 
       
   278 	
       
   279 	if (ServerModified(historyJob))
       
   280 		{
       
   281 		CAspResHandler::ReadL(iBuf, R_QTN_SML_LOG_SERVER);
       
   282 	    iBuf.Append(KTab);
       
   283    	    AddLineL(aList, iBuf);
       
   284 
       
   285         AddLogItemsL(aList, historyJob, aTaskList, ELogAddedServer);
       
   286         AddLogItemsL(aList, historyJob, aTaskList, ELogUpdatedServer);
       
   287         AddLogItemsL(aList, historyJob, aTaskList, ELogDeletedServer);
       
   288         AddLogItemsL(aList, historyJob, aTaskList, ELogDiscardedServer);
       
   289         AddLogItemsL(aList, historyJob, aTaskList, ELogMovedServer);
       
   290 		}
       
   291 
       
   292 	if (HasTaskErrors(historyJob))
       
   293 		{
       
   294 		CAspResHandler::ReadL(iBuf, R_QTN_SML_LOG_ERROR);
       
   295 	    iBuf.Append(KTab);
       
   296    	    AddLineL(aList, iBuf);
       
   297 
       
   298         AddTaskErrorsL(aList, historyJob, aTaskList);
       
   299 		}
       
   300 	}
       
   301 
       
   302 
       
   303 // -----------------------------------------------------------------------------
       
   304 // CAspLogDialog::AddLogItemsL
       
   305 // 
       
   306 // -----------------------------------------------------------------------------
       
   307 void CAspLogDialog::AddLogItemsL(CDesCArray* aList, const CSyncMLHistoryJob* aHistoryJob, 
       
   308                                  CAspContentList* aTaskList, TInt aType)
       
   309 	{
       
   310 	_LIT(KFormat, "%S\t%d");
       
   311 	
       
   312 	TInt taskCount = aHistoryJob->TaskCount();
       
   313 	for (TInt i=0; i<taskCount; i++)
       
   314 		{
       
   315 		const CSyncMLHistoryJob::TTaskInfo& taskInfo = aHistoryJob->TaskAt(i);
       
   316         	
       
   317         TInt index = aTaskList->FindProviderIndexForTask(taskInfo.iTaskId);
       
   318         if (index == KErrNotFound)
       
   319     	    {
       
   320        	    continue; // profile no longer has this task
       
   321     	    }
       
   322        	TAspProviderItem& provider = aTaskList->ProviderItem(index);
       
   323      
       
   324      
       
   325 		TInt count = SyncedItemCount(taskInfo, aType);
       
   326 		if (count == 0)
       
   327 			{
       
   328 			continue;
       
   329 			}
       
   330 
       
   331 		HBufC* hBuf = LogItemTextLC(aType, provider.iDataProviderId, provider.iDisplayName);
       
   332 	    TPtr ptr = hBuf->Des();
       
   333 	    iBuf.Format(KFormat, &ptr, count);
       
   334 	    CleanupStack::PopAndDestroy(hBuf);
       
   335 	    
       
   336        	AddLineL(aList, iBuf);
       
   337 		}
       
   338 	}
       
   339 
       
   340 
       
   341 // -----------------------------------------------------------------------------
       
   342 // CAspLogDialog::AddTaskErrorsL
       
   343 // 
       
   344 // -----------------------------------------------------------------------------
       
   345 void CAspLogDialog::AddTaskErrorsL(CDesCArray* aList, 
       
   346                                    const CSyncMLHistoryJob* aHistoryJob, 
       
   347                                    CAspContentList* aTaskList)
       
   348 	{
       
   349 	_LIT(KTab, "\t");
       
   350 	
       
   351 	TInt taskCount = aHistoryJob->TaskCount();
       
   352 	for (TInt i=0; i<taskCount; i++)
       
   353 		{
       
   354 		const CSyncMLHistoryJob::TTaskInfo& taskInfo = aHistoryJob->TaskAt(i);
       
   355         	
       
   356         TInt index = aTaskList->FindProviderIndexForTask(taskInfo.iTaskId);
       
   357         if (index == KErrNotFound)
       
   358     	    {
       
   359        	    continue; // profile no longer has this task
       
   360     	    }
       
   361     
       
   362     	TAspProviderItem& provider = aTaskList->ProviderItem(index);
       
   363   	
       
   364 		if (taskInfo.iError != KErrNone && taskInfo.iError != SyncMLError::KErrSlowSync)
       
   365 		    {
       
   366 	    	iBuf = KNullDesC;
       
   367 	    	HBufC* hBuf = CAspResHandler::GetContentNameLC(provider.iDataProviderId,
       
   368 	    	                                               provider.iDisplayName);
       
   369 	        iBuf.Append(hBuf->Des());
       
   370 	        CleanupStack::PopAndDestroy(hBuf);
       
   371 
       
   372 		    CAspResHandler::ReadL(iBuf2, R_QTN_SML_LOG_ERR); // "Incomplete"
       
   373 		    iBuf.Append(KTab);
       
   374      	    iBuf.Append(iBuf2);
       
   375      	    
       
   376 #ifdef _DEBUG 
       
   377        	    TBuf<64> buf;
       
   378      	    buf.Format(_L(" (%d)"), taskInfo.iError);
       
   379      	    iBuf.Append(buf);
       
   380 #endif
       
   381      	    
       
   382      	    AddLineL(aList, iBuf);
       
   383     		}
       
   384 		}
       
   385 	}
       
   386 
       
   387 
       
   388 // -----------------------------------------------------------------------------
       
   389 // CAspLogDialog::PhoneModified
       
   390 // 
       
   391 // -----------------------------------------------------------------------------
       
   392 TBool CAspLogDialog::PhoneModified(const CSyncMLHistoryJob* aHistoryJob)
       
   393 	{
       
   394 	TInt taskCount = aHistoryJob->TaskCount();
       
   395 	for (TInt i=0; i<taskCount; i++)
       
   396 		{
       
   397 		const CSyncMLHistoryJob::TTaskInfo& task = aHistoryJob->TaskAt(i);
       
   398 	    
       
   399 	    TInt count = task.iServerItemsAdded + task.iServerItemsChanged +
       
   400 	                 task.iServerItemsDeleted + task.iServerItemsFailed +
       
   401 	                 task.iServerItemsMoved;
       
   402         
       
   403         if (count > 0)
       
   404         	{
       
   405         	return ETrue;
       
   406         	}
       
   407 		}
       
   408 		
       
   409 	return EFalse;
       
   410 	}
       
   411 
       
   412 
       
   413 // -----------------------------------------------------------------------------
       
   414 // CAspLogDialog::ServerModified
       
   415 // 
       
   416 // -----------------------------------------------------------------------------
       
   417 TBool CAspLogDialog::ServerModified(const CSyncMLHistoryJob* aHistoryJob)
       
   418 	{
       
   419 	TInt taskCount = aHistoryJob->TaskCount();
       
   420 	for (TInt i=0; i<taskCount; i++)
       
   421 		{
       
   422 		const CSyncMLHistoryJob::TTaskInfo& task = aHistoryJob->TaskAt(i);
       
   423 
       
   424 	    TInt count = task.iItemsAdded + task.iItemsChanged +
       
   425 	                 task.iItemsDeleted + task.iItemsFailed +
       
   426 	                 task.iItemsMoved;
       
   427         
       
   428         if (count > 0)
       
   429         	{
       
   430         	return ETrue;
       
   431         	}
       
   432 		}
       
   433 		
       
   434 	return EFalse;
       
   435 	}
       
   436 
       
   437 
       
   438 // -----------------------------------------------------------------------------
       
   439 // CAspLogDialog::HasTaskErrors
       
   440 // 
       
   441 // -----------------------------------------------------------------------------
       
   442 TBool CAspLogDialog::HasTaskErrors(const CSyncMLHistoryJob* aHistoryJob)
       
   443 	{
       
   444 	TInt taskCount = aHistoryJob->TaskCount();
       
   445 	for (TInt i=0; i<taskCount; i++)
       
   446 		{
       
   447 		const CSyncMLHistoryJob::TTaskInfo& taskInfo = aHistoryJob->TaskAt(i);
       
   448         
       
   449         if (taskInfo.iError != KErrNone && taskInfo.iError != SyncMLError::KErrSlowSync)
       
   450         	{
       
   451         	FLOG(_L("### CAspLogDialog::HasTaskErrors (%d) ###"), taskInfo.iError);
       
   452         	return ETrue;
       
   453         	}
       
   454 		}
       
   455 		
       
   456 	return EFalse;
       
   457 	}
       
   458 
       
   459 
       
   460 // -----------------------------------------------------------------------------
       
   461 // CAspLogDialog::AddLineL
       
   462 // 
       
   463 // -----------------------------------------------------------------------------
       
   464 void CAspLogDialog::AddLineL(CDesCArray* aList, TDes& aText)
       
   465 	{
       
   466 	AknTextUtils::DisplayTextLanguageSpecificNumberConversion(aText);
       
   467 	aList->AppendL(aText);
       
   468 	}
       
   469 
       
   470 
       
   471 // -----------------------------------------------------------------------------
       
   472 // CAspLogDialog::SyncedItemCount
       
   473 // 
       
   474 // -----------------------------------------------------------------------------
       
   475 TInt CAspLogDialog::SyncedItemCount(const CSyncMLHistoryJob::TTaskInfo& aTaskInfo, TInt aType)
       
   476 	{
       
   477 	TInt count = 0;
       
   478 
       
   479 	switch (aType)
       
   480 		{
       
   481 		case ELogAddedPhone:
       
   482 			count = aTaskInfo.iServerItemsAdded;
       
   483 			break;
       
   484 		case ELogUpdatedPhone:
       
   485 			count = aTaskInfo.iServerItemsChanged;
       
   486 			break;
       
   487 		case ELogDeletedPhone:
       
   488 			count = aTaskInfo.iServerItemsDeleted;
       
   489 			break;
       
   490 		case ELogDiscardedPhone:
       
   491 			count = aTaskInfo.iServerItemsFailed;
       
   492 			break;
       
   493 		case ELogMovedPhone:
       
   494 			count = aTaskInfo.iServerItemsMoved;
       
   495 			break;
       
   496 
       
   497 		case ELogAddedServer:
       
   498 			count = aTaskInfo.iItemsAdded;
       
   499 			break;
       
   500 		case ELogUpdatedServer:
       
   501 			count = aTaskInfo.iItemsChanged;
       
   502 			break;
       
   503 		case ELogDeletedServer:
       
   504 			count = aTaskInfo.iItemsDeleted;
       
   505 			break;
       
   506 		case ELogDiscardedServer:
       
   507 			count = aTaskInfo.iItemsFailed;
       
   508 			break;
       
   509 		case ELogMovedServer:
       
   510 			count = aTaskInfo.iItemsMoved;
       
   511 			break;
       
   512 
       
   513 		default:
       
   514 			break;
       
   515 		}
       
   516 
       
   517 	return count;
       
   518 	}
       
   519 
       
   520 
       
   521 // -----------------------------------------------------------------------------
       
   522 // CAspLogDialog::LogItemTextLC
       
   523 // 
       
   524 // -----------------------------------------------------------------------------
       
   525 HBufC* CAspLogDialog::LogItemTextLC(TInt aType, TInt aDataProviderId, const TDesC& aDisplayName)
       
   526 	{
       
   527 	TInt resourceId = KErrNotFound;
       
   528 	
       
   529 	if (aDataProviderId == KUidNSmlAdapterContact.iUid)
       
   530 		{
       
   531 		if (aType == ELogAddedPhone || aType == ELogAddedServer)
       
   532 			{
       
   533 			resourceId = R_QTN_SML_LOG_ADDED_CONTACTS;
       
   534 			}
       
   535 		if (aType == ELogUpdatedPhone || aType == ELogUpdatedServer)
       
   536 			{
       
   537 			resourceId = R_QTN_SML_LOG_UPDATED_CONTACTS;
       
   538 			}
       
   539 		if (aType == ELogDeletedPhone || aType == ELogDeletedServer)
       
   540 			{
       
   541 			resourceId = R_QTN_SML_LOG_DELETED_CONTACTS;
       
   542 			}
       
   543 		if (aType == ELogDiscardedPhone || aType == ELogDiscardedServer)
       
   544 			{
       
   545 			resourceId = R_QTN_SML_LOG_DISCARDED_CONTACTS;
       
   546 			}
       
   547 		if (aType == ELogMovedPhone || aType == ELogMovedServer)
       
   548 			{
       
   549 			resourceId = R_QTN_SML_LOG_MOVED_CONTACTS;
       
   550 			}
       
   551 		}
       
   552 	else if (aDataProviderId == KUidNSmlAdapterCalendar.iUid)
       
   553 		{
       
   554 		if (aType == ELogAddedPhone || aType == ELogAddedServer)
       
   555 			{
       
   556 			resourceId = R_QTN_SML_LOG_ADDED_CALENDAR;
       
   557 			}
       
   558 		if (aType == ELogUpdatedPhone || aType == ELogUpdatedServer)
       
   559 			{
       
   560 			resourceId = R_QTN_SML_LOG_UPDATED_CALENDAR;
       
   561 			}
       
   562 		if (aType == ELogDeletedPhone || aType == ELogDeletedServer)
       
   563 			{
       
   564 			resourceId = R_QTN_SML_LOG_DELETED_CALENDAR;
       
   565 			}
       
   566 		if (aType == ELogDiscardedPhone || aType == ELogDiscardedServer)
       
   567 			{
       
   568 			resourceId = R_QTN_SML_LOG_DISCARDED_CALENDAR;
       
   569 			}
       
   570 		if (aType == ELogMovedPhone || aType == ELogMovedServer)
       
   571 			{
       
   572 			resourceId = R_QTN_SML_LOG_MOVED_CALENDAR;
       
   573 			}
       
   574 		}
       
   575 	else if (aDataProviderId == KUidNSmlAdapterEMail.iUid)
       
   576 		{
       
   577 		if (aType == ELogAddedPhone || aType == ELogAddedServer)
       
   578 			{
       
   579 			resourceId = R_QTN_SML_LOG_ADDED_EMAIL;
       
   580 			}
       
   581 		if (aType == ELogUpdatedPhone || aType == ELogUpdatedServer)
       
   582 			{
       
   583 			resourceId = R_QTN_SML_LOG_UPDATED_EMAIL;
       
   584 			}
       
   585 		if (aType == ELogDeletedPhone || aType == ELogDeletedServer)
       
   586 			{
       
   587 			resourceId = R_QTN_SML_LOG_DELETED_EMAIL;
       
   588 			}
       
   589 		if (aType == ELogDiscardedPhone || aType == ELogDiscardedServer)
       
   590 			{
       
   591 			resourceId = R_QTN_SML_LOG_DISCARDED_EMAIL;
       
   592 			}
       
   593 		if (aType == ELogMovedPhone || aType == ELogMovedServer)
       
   594 			{
       
   595 			resourceId = R_QTN_SML_LOG_MOVED_EMAIL;
       
   596 			}
       
   597 		}
       
   598 	else if (aDataProviderId == KUidNSmlAdapterNote.iUid)
       
   599 		{
       
   600 		if (aType == ELogAddedPhone || aType == ELogAddedServer)
       
   601 			{
       
   602 			resourceId = R_QTN_SML_LOG_ADDED_NOTES;
       
   603 			}
       
   604 		if (aType == ELogUpdatedPhone || aType == ELogUpdatedServer)
       
   605 			{
       
   606 			resourceId = R_QTN_SML_LOG_UPDATED_NOTES;
       
   607 			}
       
   608 		if (aType == ELogDeletedPhone || aType == ELogDeletedServer)
       
   609 			{
       
   610 			resourceId = R_QTN_SML_LOG_DELETED_NOTES;
       
   611 			}
       
   612 		if (aType == ELogDiscardedPhone || aType == ELogDiscardedServer)
       
   613 			{
       
   614 			resourceId = R_QTN_SML_LOG_DISCARDED_NOTES;
       
   615 			}
       
   616 		if (aType == ELogMovedPhone || aType == ELogMovedServer)
       
   617 			{
       
   618 			resourceId = R_QTN_SML_LOG_MOVED_NOTES;
       
   619 			}
       
   620 		}
       
   621 	else if (aDataProviderId == KUidNSmlAdapterSms.iUid)
       
   622 		{
       
   623 		if (aType == ELogAddedPhone || aType == ELogAddedServer)
       
   624 			{
       
   625 			resourceId = R_QTN_SML_LOG_ADDED_SMS;
       
   626 			}
       
   627 		if (aType == ELogUpdatedPhone || aType == ELogUpdatedServer)
       
   628 			{
       
   629 			resourceId = R_QTN_SML_LOG_UPDATED_SMS;
       
   630 			}
       
   631 		if (aType == ELogDeletedPhone || aType == ELogDeletedServer)
       
   632 			{
       
   633 			resourceId = R_QTN_SML_LOG_DELETED_SMS;
       
   634 			}
       
   635 		if (aType == ELogDiscardedPhone || aType == ELogDiscardedServer)
       
   636 			{
       
   637 			resourceId = R_QTN_SML_LOG_DISCARDED_SMS;
       
   638 			}
       
   639 		if (aType == ELogMovedPhone || aType == ELogMovedServer)
       
   640 			{
       
   641 			resourceId = R_QTN_SML_LOG_MOVED_SMS;
       
   642 			}
       
   643 		}
       
   644 	else if (aDataProviderId == KUidNSmlAdapterMMS.iUid)
       
   645 		{
       
   646 		if (aType == ELogAddedPhone || aType == ELogAddedServer)
       
   647 			{
       
   648 			resourceId = R_QTN_SML_LOG_ADDED_MMS;
       
   649 			}
       
   650 		if (aType == ELogUpdatedPhone || aType == ELogUpdatedServer)
       
   651 			{
       
   652 			resourceId = R_QTN_SML_LOG_UPDATED_MMS;
       
   653 			}
       
   654 		if (aType == ELogDeletedPhone || aType == ELogDeletedServer)
       
   655 			{
       
   656 			resourceId = R_QTN_SML_LOG_DELETED_MMS;
       
   657 			}
       
   658 		if (aType == ELogDiscardedPhone || aType == ELogDiscardedServer)
       
   659 			{
       
   660 			resourceId = R_QTN_SML_LOG_DISCARDED_MMS;
       
   661 			}
       
   662 		if (aType == ELogMovedPhone || aType == ELogMovedServer)
       
   663 			{
       
   664 			resourceId = R_QTN_SML_LOG_MOVED_MMS;
       
   665 			}
       
   666 		}
       
   667 
       
   668 	else if (aDataProviderId == KUidNSmlAdapterBookmarks.iUid)
       
   669 		{
       
   670 		if (aType == ELogAddedPhone || aType == ELogAddedServer)
       
   671 			{
       
   672 			resourceId = R_QTN_SML_LOG_ADDED_BKM;
       
   673 			}
       
   674 		if (aType == ELogUpdatedPhone || aType == ELogUpdatedServer)
       
   675 			{
       
   676 			resourceId = R_QTN_SML_LOG_UPDATED_BKM;
       
   677 			}
       
   678 		if (aType == ELogDeletedPhone || aType == ELogDeletedServer)
       
   679 			{
       
   680 			resourceId = R_QTN_SML_LOG_DELETED_BKM;
       
   681 			}
       
   682 		if (aType == ELogDiscardedPhone || aType == ELogDiscardedServer)
       
   683 			{
       
   684 			resourceId = R_QTN_SML_LOG_DISCARDED_BKM;
       
   685 			}
       
   686 		if (aType == ELogMovedPhone || aType == ELogMovedServer)
       
   687 			{
       
   688 			resourceId = R_QTN_SML_LOG_MOVED_BKM;
       
   689 			}
       
   690 		}
       
   691 	
       
   692 	else  // unknown data provider
       
   693 		{
       
   694 		if (aType == ELogAddedPhone || aType == ELogAddedServer)
       
   695 			{
       
   696 			resourceId = R_QTN_SML_LOG_ADDED_CONTENT;
       
   697 			}
       
   698 		if (aType == ELogUpdatedPhone || aType == ELogUpdatedServer)
       
   699 			{
       
   700 			resourceId = R_QTN_SML_LOG_UPDATED_CONTENT;
       
   701 			}
       
   702 		if (aType == ELogDeletedPhone || aType == ELogDeletedServer)
       
   703 			{
       
   704 			resourceId = R_QTN_SML_LOG_DELETED_CONTENT;
       
   705 			}
       
   706 		if (aType == ELogDiscardedPhone || aType == ELogDiscardedServer)
       
   707 			{
       
   708 			resourceId = R_QTN_SML_LOG_DISCARDED_CONTENT;
       
   709 			}
       
   710 		if (aType == ELogMovedPhone || aType == ELogMovedServer)
       
   711 			{
       
   712 			resourceId = R_QTN_SML_LOG_MOVED_CONTENT;
       
   713 			}
       
   714 
       
   715         __ASSERT_DEBUG(resourceId != KErrNotFound, TUtil::Panic(KErrGeneral));
       
   716         
       
   717 		return CAspResHandler::ReadLC(resourceId, aDisplayName);
       
   718 		}
       
   719 	
       
   720 	__ASSERT_DEBUG(resourceId != KErrNotFound, TUtil::Panic(KErrGeneral));
       
   721 	
       
   722     return CAspResHandler::ReadLC(resourceId);
       
   723 	}
       
   724 
       
   725 
       
   726 
       
   727 
       
   728 
       
   729 
       
   730 //  End of File