buildverification/autosmoketest/messaging/Src/TestMessBase.cpp
branchRCL_3
changeset 20 493058e57c8c
parent 0 9736f095102e
equal deleted inserted replaced
19:4ca382093dae 20:493058e57c8c
       
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // This contains CTestCase which is the base class for all the TestCase DLLs
       
    15 // 
       
    16 //
       
    17 
       
    18 #include "TestMessBase.h"
       
    19 #include "TestMessProcessor.h"
       
    20 #include "TestMessTimer.h"
       
    21 #include "TestMessPrintEntryUtil.h"
       
    22 
       
    23 // EPOC includes
       
    24 #include <smtpset.h>
       
    25 #include <pop3set.h>
       
    26 #include <imapset.h>
       
    27 #include <txtrich.h>
       
    28 #include <f32file.h>
       
    29 #include <msvids.h>
       
    30 #include <fbs.h>
       
    31 #include <emsuserpromptie.h>
       
    32 #ifdef __MESSAGING_API_V2__
       
    33 #include <smut.h>
       
    34 #include <miutset.h>
       
    35 #include <cemailaccounts.h>
       
    36 #include <csmsaccount.h>
       
    37 #endif
       
    38 /**
       
    39  * @name Constant Literals used.
       
    40  */
       
    41 /*@{*/
       
    42 _LIT(KDepth,					"depth");
       
    43 _LIT(KFolder,					"folder%d");
       
    44 
       
    45 // Default value for depth of the count
       
    46 #define KDefaultDepthCount		1
       
    47 
       
    48 // Default value for depth of the count
       
    49 #define KDefaultDepthCount		1
       
    50 
       
    51 _LIT(KDefault,					"default");
       
    52 
       
    53 _LIT(KScheduled,				"scheduled");
       
    54 _LIT(KProgress,					"progress");
       
    55 
       
    56 //_LIT(KIap,						"iap");
       
    57 //_LIT(KIapName,					"iapname");
       
    58 
       
    59 _LIT(KElements,					"elements");
       
    60 _LIT(KStartPosition,			"StartPosition%d");
       
    61 _LIT(KFile,						"File%d");
       
    62 _LIT(KType,						"Type%d");
       
    63 _LIT(KTypeFormat,				"Format");
       
    64 _LIT(KTypeSound,				"Sound");
       
    65 _LIT(KTypePreDefSound,			"PreDefSound");
       
    66 _LIT(KTypeAnimation,			"Animation");
       
    67 _LIT(KTypePreDefAnimation,		"PreDefAnimation");
       
    68 _LIT(KTypePicture,				"Picture");
       
    69 _LIT(KTypeUserPrompt,			"UserPrompt");
       
    70 _LIT(KFormatLength,				"FormatLength%d");
       
    71 _LIT(KBold,						"Bold%d");
       
    72 _LIT(KItalic,					"Italic%d");
       
    73 _LIT(KUnderline,				"Underline%d");
       
    74 _LIT(KStrikethrough,			"Strikethrough%d");
       
    75 _LIT(KAlignment,				"Alignment%d");
       
    76 _LIT(KFontSize,					"FontSize%d");
       
    77 
       
    78 _LIT(KLeftAlign,				"LeftAlign");
       
    79 _LIT(KRightAlign,				"RightAlign");
       
    80 _LIT(KCenterAlign,				"CenterAlign");
       
    81 _LIT(KLangDepend,				"LangDepend");
       
    82 
       
    83 _LIT(KNormal,					"Normal");
       
    84 _LIT(KLarge,					"Large");
       
    85 _LIT(KSmall,					"Small");
       
    86 _LIT(KVariable,					"Variable");
       
    87 _LIT(KReserved,					"Reserved");
       
    88 
       
    89 _LIT(KEmsPreDef,				"emspredef%d");
       
    90 
       
    91 _LIT(KEmsAnimTypeFlirty,		"a0");
       
    92 _LIT(KEmsAnimTypeGlad,			"a1");
       
    93 _LIT(KEmsAnimTypeSceptic,		"a2");
       
    94 _LIT(KEmsAnimTypeSad,			"a3");
       
    95 _LIT(KEmsAnimTypeWow,			"a4");
       
    96 _LIT(KEmsAnimTypeCrying,		"a5");
       
    97 _LIT(KEmsAnimTypeWinking,		"a6");
       
    98 _LIT(KEmsAnimTypeLaughing,		"a7");
       
    99 _LIT(KEmsAnimTypeIndifferent,	"a8");
       
   100 _LIT(KEmsAnimTypeKissing,		"a9");
       
   101 _LIT(KEmsAnimTypeConfused,		"a10");
       
   102 _LIT(KEmsAnimTypeTongueOut,		"a11");
       
   103 _LIT(KEmsAnimTypeAngry,			"a12");
       
   104 _LIT(KEmsAnimTypeGlasses,		"a13");
       
   105 _LIT(KEmsAnimTypeDevil,			"a14");
       
   106 
       
   107 _LIT(KEmsSoundTypeChimesHigh,	"s0");
       
   108 _LIT(KEmsSoundTypeChimesLow,	"s1");
       
   109 _LIT(KEmsSoundTypeDing,			"s2");
       
   110 _LIT(KEmsSoundTypeTaDa,			"s3");
       
   111 _LIT(KEmsSoundTypeNotify,		"s4");
       
   112 _LIT(KEmsSoundTypeDrum,			"s5");
       
   113 _LIT(KEmsSoundTypeClaps,		"s6");
       
   114 _LIT(KEmsSoundTypeFanFar,		"s7");
       
   115 _LIT(KEmsSoundTypeChordHigh,	"s8");
       
   116 _LIT(KEmsSoundTypeChordLow,		"s9");
       
   117 
       
   118 /*
       
   119 _LIT(KBioIAP,					"IAP");
       
   120 _LIT(KBioEmailNotification,		"EmailNotification");
       
   121 _LIT(KBioBusinessCard,			"BusinessCard");
       
   122 _LIT(KBioWAPAccessPoint,		"WAPAccessPoint");
       
   123 _LIT(KBioVCalendar,				"VCalendar");
       
   124 _LIT(KBioVCard,					"VCard");
       
   125 _LIT(KBioRingingTones,			"RingingTones");
       
   126 _LIT(KBioOperatorLogo,			"OperatorLogo");
       
   127 _LIT(KBioWPRV,					"WPRV");
       
   128 _LIT(KBioCLILogo,				"CLILogo");
       
   129 */
       
   130 _LIT(KObjectSize,				"ObjectSize%d");
       
   131 _LIT(KBody,						"body");
       
   132 /*@}*/
       
   133 
       
   134 const TInt KSmallObject		= 0;
       
   135 const TInt KLargeObject		= 1;
       
   136 const TInt KVariableObject	= 2;
       
   137 
       
   138 const TInt KDefaultStartPos	= 1;
       
   139 
       
   140 /**
       
   141  * Constructor.
       
   142  * @return - None
       
   143  * 
       
   144 */	
       
   145 CTestMessBase::CTestMessBase(TBool aSetDirectory)
       
   146 :	CTestStepSmokeTest()
       
   147 ,	iSession(NULL)
       
   148 ,	iMessageProcessor(NULL)
       
   149 ,   iParaFormatLayer(NULL)
       
   150 ,   iCharFormatLayer(NULL)
       
   151 ,   iBodyText(NULL)
       
   152 ,	iBodyAvailable(EFalse)
       
   153 ,	iSetDirectory(aSetDirectory)
       
   154 ,	iMessageTimer(NULL)
       
   155 ,	iSchedular(NULL)
       
   156 ,	iEntry(NULL)
       
   157 ,	iOrder(KMsvGroupByType|KMsvGroupByStandardFolders, EMsvSortById, ETrue)
       
   158 	{
       
   159 	}
       
   160 
       
   161 CTestMessBase::~CTestMessBase()
       
   162 	{
       
   163 	delete iEntry;
       
   164 	iEntry=NULL;
       
   165 	delete iMessageTimer;
       
   166 	iMessageTimer=NULL;
       
   167 	delete iMessageProcessor;
       
   168 	iMessageProcessor=NULL;
       
   169 	delete iSession;
       
   170 	iSession=NULL;
       
   171 	delete iSchedular;
       
   172 	iSchedular=NULL;
       
   173 	delete iBodyText;
       
   174 	iBodyText=NULL;
       
   175 	delete iCharFormatLayer;
       
   176 	iCharFormatLayer=NULL;
       
   177 	delete iParaFormatLayer;
       
   178 	iParaFormatLayer=NULL;
       
   179 	}
       
   180 
       
   181 enum TVerdict CTestMessBase::doTestStepPreambleL()
       
   182 	{
       
   183 	TVerdict	ret=CTestStepSmokeTest::doTestStepPreambleL();
       
   184 
       
   185 	// Printing to the console and log file
       
   186 	const TDesC&	stepName=TestStepName();
       
   187 	INFO_PRINTF2(_L("%S"), &stepName);
       
   188 
       
   189 	iSchedular=new (ELeave) CActiveScheduler();
       
   190 	CActiveScheduler::Install(iSchedular);
       
   191 	iSession=CMsvSession::OpenSyncL(*this);
       
   192 
       
   193 	//	Get progress
       
   194 	TInt	progress=0;
       
   195 	TBool	hasProgress=GetIntFromConfig(ConfigSection(), KProgress, progress);
       
   196 	if ( !hasProgress )
       
   197 		{
       
   198 		hasProgress=GetIntFromConfig(KDefault, KProgress, progress);
       
   199 		}
       
   200 
       
   201 	iMessageProcessor=CTestMessProcessor::NewL(*this, *iSession);
       
   202 	if ( hasProgress )
       
   203 		{
       
   204 		iMessageTimer=CTestMessTimer::NewL(progress*KOneSecond, *iMessageProcessor);
       
   205 		}
       
   206 
       
   207 	if ( iSetDirectory )
       
   208 		{
       
   209 		TInt	depth=KDefaultDepthCount;
       
   210 		TBool	returnValue=GetIntFromConfig(ConfigSection(), KDepth, depth);
       
   211 		if ( !returnValue )
       
   212 			{
       
   213 			depth=KDefaultDepthCount;
       
   214 			}
       
   215 		INFO_PRINTF2(_L("Depth = %d"), depth);
       
   216 
       
   217 		//	Searce for the entry
       
   218 		TRAPD(error,SetEntryL(KMsvRootIndexEntryId));
       
   219 		if( error != KErrNone)
       
   220 			{
       
   221 			INFO_PRINTF2(_L("Set Entry failed, Error %D"),error);
       
   222 			SetTestStepError(error);
       
   223 			ret=EFail;
       
   224 			}
       
   225 		else
       
   226 			{
       
   227 
       
   228 			TBuf<KMaxTestExecuteCommandLength>	tempStore;
       
   229 			TBool								found=ETrue;
       
   230 			for (TInt entry=0; entry<depth && found;)
       
   231 				{
       
   232 				TPtrC	subject;
       
   233 				tempStore.Format(KFolder(), ++entry);
       
   234 				returnValue =GetStringFromConfig(ConfigSection(), tempStore, subject);
       
   235 				if ( !returnValue )
       
   236 					{
       
   237 					INFO_PRINTF1(_L("Null Folder"));
       
   238 					}
       
   239 				INFO_PRINTF2(_L("Folder = %S"), &subject);
       
   240 
       
   241 				CMsvEntrySelection*	selection=EntryL().ChildrenL();
       
   242 				CleanupStack::PushL(selection);
       
   243 				TInt				count=selection->Count();
       
   244 		
       
   245 				found=EFalse;
       
   246 				for (TInt i=count; i>0 && !found; )
       
   247 					{
       
   248 					TMsvId	childId=selection->At(--i);
       
   249 
       
   250 					SetEntryL(childId);
       
   251 					INFO_PRINTF2(_L("Entry Detail : %S"), &(EntryL().Entry().iDetails));
       
   252 					INFO_PRINTF2(_L("Entry Description: %S"), &(EntryL().Entry().iDescription));
       
   253 					if ( subject.Compare(EntryL().Entry().iDetails) == 0 ||
       
   254 						 subject.Compare(EntryL().Entry().iDescription) == 0 )
       
   255 						{
       
   256 						found=ETrue;
       
   257 						}
       
   258 					}
       
   259 				CleanupStack::PopAndDestroy(selection);
       
   260 				}
       
   261 
       
   262 			if ( !found )
       
   263 				{
       
   264 				ERR_PRINTF1(_L("Folder not found"));
       
   265 				ret=EFail;
       
   266 				}
       
   267 			}
       
   268 		}
       
   269 	if (TestStepResult() == EPass)
       
   270 		{
       
   271 		//Get body(file path) from ini file and read respective file. Store it into CRichText format.
       
   272 		iParaFormatLayer=CParaFormatLayer::NewL();
       
   273 		iCharFormatLayer=CCharFormatLayer::NewL(); 
       
   274 		iBodyText=CRichText::NewL(iParaFormatLayer, iCharFormatLayer);
       
   275 		iBodyAvailable=EFalse;
       
   276 	
       
   277 		TPtrC	body;
       
   278 		if(GetStringFromConfig(ConfigSection(), KBody, body))
       
   279 			{
       
   280 			INFO_PRINTF2(_L("Body = %S"), &body);
       
   281 			iBodyAvailable=ETrue;
       
   282 			}
       
   283 		else
       
   284 			{
       
   285 			INFO_PRINTF1(_L("No Body"));
       
   286 			}
       
   287 
       
   288 		if ( iBodyAvailable )
       
   289 			{
       
   290 			// open the file
       
   291 			RFile	file;
       
   292 	
       
   293 			TInt anError = file.Open(iSession->FileSession(), body, EFileShareAny);
       
   294 			if(anError == KErrNone)
       
   295 				{
       
   296 				TBool		reading=ETrue;
       
   297 				TInt		pos=0;
       
   298 				TBuf8<1>	charIn;
       
   299 				while (reading)
       
   300 					{
       
   301 					file.Read(charIn, 1);
       
   302 					if(charIn.Length())
       
   303 						{
       
   304 						switch ( charIn[0] )
       
   305 							{
       
   306 						case '\r':
       
   307 							iBodyText->InsertL(pos++, CEditableText::ELineBreak);
       
   308 						case '\n':
       
   309 							break;
       
   310 						default:
       
   311 							iBodyText->InsertL(pos++, TChar(charIn[0]));
       
   312 							}
       
   313 						}
       
   314 					else
       
   315 						{
       
   316 						reading = EFalse;	// stop at the end of the file
       
   317 						}
       
   318 					}
       
   319 				iBodyAvailable=ETrue;
       
   320 				file.Close();
       
   321 				}
       
   322 			else
       
   323 			{
       
   324 			INFO_PRINTF2(_L("Cannot open file = %S"), &body);
       
   325 			iBodyAvailable=EFalse;
       
   326 			}
       
   327 		}//End of read file.
       
   328 	}
       
   329 
       
   330 	SetTestStepResult(ret);
       
   331 	return ret;
       
   332 	}
       
   333 
       
   334 enum TVerdict CTestMessBase::doTestStepPostambleL()
       
   335 	{
       
   336 	delete iEntry;
       
   337 	iEntry=NULL;
       
   338 	delete iMessageTimer;
       
   339 	iMessageTimer=NULL;
       
   340 	delete iMessageProcessor;
       
   341 	iMessageProcessor=NULL;
       
   342 	delete iSession;
       
   343 	iSession=NULL;
       
   344 	delete iSchedular;
       
   345 	iSchedular=NULL;
       
   346 	CActiveScheduler::Install(NULL);
       
   347 	return CTestStepSmokeTest::doTestStepPostambleL();
       
   348 	}
       
   349 
       
   350 void CTestMessBase::SetEntryL(TMsvId aId)
       
   351 	{
       
   352 	delete iEntry;
       
   353 	iEntry=NULL;
       
   354 	iEntry=iSession->GetEntryL(aId);
       
   355 	}
       
   356 
       
   357 CMsvEntry& CTestMessBase::EntryL()
       
   358 	{
       
   359 	if ( iEntry == NULL )
       
   360 		{
       
   361 		User::Leave(KErrGeneral);
       
   362 		}
       
   363 
       
   364 	return *iEntry;
       
   365 	}
       
   366 
       
   367 
       
   368 HBufC8* CTestMessBase::CopyToBuf8LC(const TDesC& aDesC)
       
   369 //
       
   370 // @return - HBufC8*
       
   371 // Converts TDesC to HBufC8*.
       
   372 //
       
   373 	{
       
   374 	HBufC8*	itemBuff8 = HBufC8::NewLC(aDesC.Length());
       
   375 	itemBuff8->Des().Copy(aDesC);
       
   376 
       
   377 	return itemBuff8;
       
   378 	}
       
   379 
       
   380 HBufC* CTestMessBase::CopyToBufLC(const TDesC8& aDesC)
       
   381 //
       
   382 // @return - HBufC8*
       
   383 // Converts TDesC to HBufC8*.
       
   384 //
       
   385 	{
       
   386 	HBufC*	itemBuff = HBufC::NewLC(aDesC.Length());
       
   387 	itemBuff->Des().Copy(aDesC);
       
   388 
       
   389 	return itemBuff;
       
   390 	}
       
   391 
       
   392 
       
   393 #ifndef __MESSAGING_API_V2__
       
   394 void CTestMessBase::SetDefaultServiceL(TUid aMtm, TMsvId aService) const
       
   395 	{
       
   396 	// --- Now restore the default services from the root store ---
       
   397 	CMsvEntry*				rootEntry=iSession->GetEntryL(KMsvRootIndexEntryIdValue);
       
   398 	CleanupStack::PushL(rootEntry);
       
   399 	CMsvStore*				store = rootEntry->EditStoreL();
       
   400 	CleanupStack::PushL(store);
       
   401 	CMsvDefaultServices*	services = new(ELeave)CMsvDefaultServices;
       
   402 	CleanupStack::PushL(services);
       
   403 	services->RestoreL(*store);
       
   404 
       
   405 	// --- And now re-set the default service for the MTM to the one given ---
       
   406 	TMsvDefaultService	defaultService;
       
   407 	defaultService.iMtm=aMtm;
       
   408 	defaultService.iService=aService;
       
   409 	services->ChangeDefaultServiceL(defaultService);
       
   410 	services->StoreL(*store);
       
   411 	store->CommitL();
       
   412 	CleanupStack::PopAndDestroy(3, rootEntry);
       
   413 	}
       
   414 
       
   415 TInt CTestMessBase::DefaultServiceL(TUid aMtm, TMsvId& aService) const
       
   416 	{
       
   417 	// --- Now restore the default services from the root store ---
       
   418 	CMsvEntry*				rootEntry=iSession->GetEntryL(KMsvRootIndexEntryIdValue);
       
   419 	CleanupStack::PushL(rootEntry);
       
   420 	CMsvStore*				store=rootEntry->ReadStoreL();
       
   421 	CleanupStack::PushL(store);
       
   422 	CMsvDefaultServices*	services=new(ELeave)CMsvDefaultServices;
       
   423 	CleanupStack::PushL(services);
       
   424 	services->RestoreL(*store);
       
   425 
       
   426 	TInt					ret=services->DefaultService(aMtm, aService);
       
   427 
       
   428 	CleanupStack::PopAndDestroy(3, rootEntry);
       
   429 
       
   430 	return ret;
       
   431 	}
       
   432 #endif
       
   433 
       
   434 void CTestMessBase::PrintTreeL(TMsvId aRoot)
       
   435 	{
       
   436 	INFO_PRINTF1(_L("PrintTreeL In"));
       
   437 	CMsvEntry*			entry=iSession->GetEntryL(aRoot);
       
   438 	CleanupStack::PushL(entry);
       
   439 	entry->SetSortTypeL(SelectionOrdering());
       
   440 	CMsvEntrySelection*	selection=entry->ChildrenL();
       
   441 	CleanupStack::PushL(selection);
       
   442 
       
   443 	PrintEntryL(*entry);
       
   444 	for (TInt i=0; i<selection->Count(); )
       
   445 		{
       
   446 		PrintTreeL(selection->At(i++));
       
   447 		}
       
   448 
       
   449 	CleanupStack::PopAndDestroy(2, entry);
       
   450 	INFO_PRINTF1(_L("PrintTreeL Out"));
       
   451 	}
       
   452 
       
   453 void CTestMessBase::PrintEntryL(CMsvEntry& aEntry)
       
   454 	{
       
   455 	TMsvEntry	entry=aEntry.Entry();
       
   456 
       
   457 	INFO_PRINTF2(_L("Entry Detail : %S"), &(entry.iDetails));
       
   458 	INFO_PRINTF2(_L("  Description: %S"), &(entry.iDescription));
       
   459 	INFO_PRINTF2(_L("  Id         : %x"), entry.Id());
       
   460 	INFO_PRINTF2(_L("  Parent Id  : %x"), entry.Parent());
       
   461 	INFO_PRINTF2(_L("  Service Id : %x"), entry.iServiceId);
       
   462 	if ( entry.iRelatedId != 0 )
       
   463 		{
       
   464 		INFO_PRINTF2(_L("  Related Id : %x"), entry.iRelatedId);
       
   465 		}
       
   466 	INFO_PRINTF2(_L("  Type       : %x"), entry.iType);
       
   467 	INFO_PRINTF2(_L("  Mtm        : %x"), entry.iMtm);
       
   468 
       
   469 
       
   470 	if ( entry.iSize != 0 )
       
   471 		{
       
   472 		INFO_PRINTF2(_L("  Size       : %x"), entry.iSize);
       
   473 		}
       
   474 	if ( entry.iError != 0 )
       
   475 		{
       
   476 		INFO_PRINTF2(_L("  Error      : %d"), entry.iError);
       
   477 		}
       
   478 	if ( entry.iBioType != 0 )
       
   479 		{
       
   480 		INFO_PRINTF2(_L("  BioType    : %x"), entry.iBioType);
       
   481 		}
       
   482 	if ( entry.MtmData1() != 0 )
       
   483 		{
       
   484 		INFO_PRINTF2(_L("  MtmData1   : %x"), entry.MtmData1());
       
   485 		}
       
   486 	if ( entry.MtmData2() != 0 )
       
   487 		{
       
   488 		INFO_PRINTF2(_L("  MtmData2   : %x"), entry.MtmData2());
       
   489 		}
       
   490 	if ( entry.MtmData3() != 0 )
       
   491 		{
       
   492 		INFO_PRINTF2(_L("  MtmData3   : %x"), entry.MtmData3());
       
   493 		}
       
   494 	if ( entry.Attachment() != 0 )
       
   495 		{
       
   496 		INFO_PRINTF2(_L("  Attachment : %x"), entry.Attachment());
       
   497 		}
       
   498 	if ( entry.Complete() != 0 )
       
   499 		{
       
   500 		INFO_PRINTF2(_L("  Complete   : %x"), entry.Complete());
       
   501 		}
       
   502 	if ( entry.Connected() != 0 )
       
   503 		{
       
   504 		INFO_PRINTF2(_L("  Connected  : %x"), entry.Connected());
       
   505 		}
       
   506 	if ( entry.Deleted() != 0 )
       
   507 		{
       
   508 		INFO_PRINTF2(_L("  Deleted    : %x"), entry.Deleted());
       
   509 		}
       
   510 	if ( entry.Failed() != 0 )
       
   511 		{
       
   512 		INFO_PRINTF2(_L("  Failed     : %x"), entry.Failed());
       
   513 		}
       
   514 	if ( entry.InPreparation() != 0 )
       
   515 		{
       
   516 		INFO_PRINTF2(_L("  InPrep     : %x"), entry.InPreparation());
       
   517 		}
       
   518 	if ( entry.MultipleRecipients() != 0 )
       
   519 		{
       
   520 		INFO_PRINTF2(_L("  MultiRecip : %x"), entry.MultipleRecipients());
       
   521 		}
       
   522 	if ( entry.OffPeak() != 0 )
       
   523 		{
       
   524 		INFO_PRINTF2(_L("  OffPeak    : %x"), entry.OffPeak());
       
   525 		}
       
   526 	if ( entry.Operation() != 0 )
       
   527 		{
       
   528 		INFO_PRINTF2(_L("  Operation  : %x"), entry.Operation());
       
   529 		}
       
   530 	if ( entry.Owner() != 0 )
       
   531 		{
       
   532 		INFO_PRINTF2(_L("  Owner      : %x"), entry.Owner());
       
   533 		}
       
   534 	if ( entry.PcSyncCount() != 0 )
       
   535 		{
       
   536 		INFO_PRINTF2(_L("  PcSyncCount: %x"), entry.PcSyncCount());
       
   537 		}
       
   538 	if ( entry.Priority() != 0 )
       
   539 		{
       
   540 		INFO_PRINTF2(_L("  Priority   : %x"), entry.Priority());
       
   541 		}
       
   542 	if ( entry.ReadOnly() != 0 )
       
   543 		{
       
   544 		INFO_PRINTF2(_L("  ReadOnly   : %x"), entry.ReadOnly());
       
   545 		}
       
   546 	if ( entry.Scheduled() != 0 )
       
   547 		{
       
   548 		INFO_PRINTF2(_L("  Scheduled  : %x"), entry.Scheduled());
       
   549 		}
       
   550 	if ( entry.SendingState() != 0 )
       
   551 		{
       
   552 		INFO_PRINTF2(_L("  Send State : %x"), entry.SendingState());
       
   553 		}
       
   554 	if ( entry.StandardFolder() != 0 )
       
   555 		{
       
   556 		INFO_PRINTF2(_L("  StdFolder  : %x"), entry.StandardFolder());
       
   557 		}
       
   558 	if ( entry.Unread() != 0 )
       
   559 		{
       
   560 		INFO_PRINTF2(_L("  Unread     : %x"), entry.Unread());
       
   561 		}
       
   562 	if ( entry.Visible() != 0 )
       
   563 		{
       
   564 		INFO_PRINTF2(_L("  Visible    : %x"), entry.Visible());
       
   565 		}
       
   566 
       
   567 #if (!defined CDMA_API_ENABLED)
       
   568 	if ( aEntry.HasStoreL() )
       
   569 		{
       
   570 		PrintStoreL(aEntry);
       
   571 		}
       
   572 #endif
       
   573 	}
       
   574 
       
   575 void CTestMessBase::PrintStoreL(CMsvEntry& aEntry)
       
   576 	{
       
   577 	TMsvEntry					entry=aEntry.Entry();
       
   578 	CTestMessPrintEntryUtil*	printUtil=new (ELeave) CTestMessPrintEntryUtil(*this);
       
   579 	CleanupStack::PushL(printUtil);
       
   580 
       
   581 	printUtil->ProcessEntryL(entry.Id());
       
   582 	CleanupStack::PopAndDestroy(printUtil);
       
   583 
       
   584 	if ( entry.iMtm==KUidMsgTypeSMTP )
       
   585 		{
       
   586 		PrintStoreSmtpL(aEntry);
       
   587 		}
       
   588 	else if ( entry.iMtm == KUidMsgTypePOP3 )
       
   589 		{
       
   590 		PrintStorePop3L(aEntry);
       
   591 		}
       
   592 	else if ( entry.iMtm == KUidMsgTypeIMAP4 )
       
   593 		{
       
   594 		PrintStoreImap4L(aEntry);
       
   595 		}
       
   596 	else if ( entry.iMtm == KUidMsgTypeSMS )
       
   597 		{
       
   598 		PrintStoreSmsL(aEntry);
       
   599 		}
       
   600 	}
       
   601 
       
   602 void CTestMessBase::PrintStoreSmtpL(CMsvEntry& aEntry)
       
   603 	{
       
   604 	TMsvEntry	entry=aEntry.Entry();
       
   605 	CMsvStore*	store=aEntry.ReadStoreL();
       
   606 	CleanupStack::PushL(store);
       
   607 
       
   608 	TPtrC	ptrTemp;
       
   609 	if ( entry.iType == KUidMsvServiceEntry )
       
   610 		{
       
   611 		CImSmtpSettings*	settings = new(ELeave) CImSmtpSettings();
       
   612 		CleanupStack::PushL(settings);
       
   613 #ifdef __MESSAGING_API_V2__
       
   614 		CEmailAccounts*		accounts = CEmailAccounts::NewLC();
       
   615 		TSmtpAccount smtpAccountId;
       
   616 		accounts->GetSmtpAccountL(aEntry.EntryId(), smtpAccountId);
       
   617 		TRAPD(err, accounts->LoadSmtpSettingsL(smtpAccountId, *settings));
       
   618 		CleanupStack::PopAndDestroy(accounts);
       
   619 #else
       
   620 		TRAPD(err, settings->RestoreL(*store));
       
   621 #endif
       
   622 		if ( err == KErrNone )
       
   623 			{
       
   624 			ptrTemp.Set(settings->ServerAddress());
       
   625 			INFO_PRINTF2(_L("  ServerAddress                : %S"), &ptrTemp);
       
   626 #ifndef __MESSAGING_API_V2__
       
   627 			ptrTemp.Set(settings->UserAddress());
       
   628 			INFO_PRINTF2(_L("  UserAddress                  : %S"), &ptrTemp);
       
   629 			INFO_PRINTF2(_L("  Version                      : %x"), (TUint)settings->Version());
       
   630 #endif
       
   631 			INFO_PRINTF2(_L("  Port                         : %x"), settings->Port());
       
   632 			INFO_PRINTF2(_L("  SecureSockets                : %x"), (TUint)settings->SecureSockets());
       
   633 			ptrTemp.Set(settings->EmailAlias());
       
   634 			INFO_PRINTF2(_L("  EmailAlias                   : %S"), &ptrTemp);
       
   635 			ptrTemp.Set(settings->EmailAddress());
       
   636 			INFO_PRINTF2(_L("  EmailAddress                 : %S"), &ptrTemp);
       
   637 			ptrTemp.Set(settings->ReplyToAddress());
       
   638 			INFO_PRINTF2(_L("  ReplyToAddress               : %S"), &ptrTemp);
       
   639 			ptrTemp.Set(settings->ReceiptAddress());
       
   640 			INFO_PRINTF2(_L("  ReceiptAddress               : %S"), &ptrTemp);
       
   641 			if ( settings->RequestReceipts() != 0 )
       
   642 				{
       
   643 				INFO_PRINTF2(_L("  RequestReceipts              : %x"), (TUint)settings->RequestReceipts());
       
   644 				}
       
   645 			if ( settings->SendCopyToSelf() != 0 )
       
   646 				{
       
   647 				INFO_PRINTF2(_L("  SendCopyToSelf               : %x"), (TUint)settings->SendCopyToSelf());
       
   648 				}
       
   649 			INFO_PRINTF2(_L("  SendMessageOption            : %x"), (TUint)settings->SendMessageOption());
       
   650 			}
       
   651 		CleanupStack::PopAndDestroy(settings);
       
   652 		}
       
   653 
       
   654 	CleanupStack::PopAndDestroy(store);
       
   655 	}
       
   656 
       
   657 void CTestMessBase::PrintStorePop3L(CMsvEntry& aEntry)
       
   658 	{
       
   659 	TMsvEntry	entry=aEntry.Entry();
       
   660 	CMsvStore*	store=aEntry.ReadStoreL();
       
   661 	CleanupStack::PushL(store);
       
   662 
       
   663 	TPtrC	ptrTemp;
       
   664 	if ( entry.iType == KUidMsvServiceEntry )
       
   665 		{
       
   666 		CImPop3Settings*	settings = new(ELeave) CImPop3Settings();
       
   667 		CleanupStack::PushL(settings);
       
   668 
       
   669 #ifdef __MESSAGING_API_V2__
       
   670 		CEmailAccounts*		accounts = CEmailAccounts::NewLC();
       
   671 		TPopAccount popAccountId;
       
   672 		accounts->GetPopAccountL(aEntry.EntryId(), popAccountId);
       
   673 		TRAPD(err, accounts->LoadPopSettingsL(popAccountId, *settings));
       
   674 		CleanupStack::PopAndDestroy(accounts);
       
   675 #else
       
   676 		TRAPD(err, settings->RestoreL(*store));
       
   677 #endif
       
   678 		if ( err == KErrNone )
       
   679 			{
       
   680 			ptrTemp.Set(settings->ServerAddress());
       
   681 			INFO_PRINTF2(_L("  ServerAddress                : %S"), &ptrTemp);
       
   682 #ifndef __MESSAGING_API_V2__
       
   683 			ptrTemp.Set(settings->UserAddress());
       
   684 			INFO_PRINTF2(_L("  UserAddress                  : %S"), &ptrTemp);
       
   685 			INFO_PRINTF2(_L("  Version                      : %x"), (TUint)settings->Version());
       
   686 #endif
       
   687 			INFO_PRINTF2(_L("  Port                         : %x"), settings->Port());
       
   688 			INFO_PRINTF2(_L("  SecureSockets                : %x"), (TUint)settings->SecureSockets());
       
   689 			HBufC*	loginName=CopyToBufLC(settings->LoginName());
       
   690 			INFO_PRINTF2(_L("  LoginName                    : %S"), loginName);
       
   691 			CleanupStack::PopAndDestroy(loginName);
       
   692 			if ( settings->AutoSendOnConnect() != 0 )
       
   693 				{
       
   694 				INFO_PRINTF2(_L("  AutoSendOnConnect            : %x"), (TUint)settings->AutoSendOnConnect());
       
   695 				}
       
   696 			if ( settings->Apop() != 0 )
       
   697 				{
       
   698 				INFO_PRINTF2(_L("  Apop                         : %x"), (TUint)settings->Apop());
       
   699 				}
       
   700 			if ( settings->DisconnectedUserMode() != 0 )
       
   701 				{
       
   702 				INFO_PRINTF2(_L("  DisconnectedUserMode         : %x"), (TUint)settings->DisconnectedUserMode());
       
   703 				}
       
   704 			if ( settings->DeleteEmailsWhenDisconnecting() != 0 )
       
   705 				{
       
   706 				INFO_PRINTF2(_L("  DeleteEmailsWhenDisconnecting: %x"), (TUint)settings->DeleteEmailsWhenDisconnecting());
       
   707 				}
       
   708 			if ( settings->AcknowledgeReceipts() != 0 )
       
   709 				{
       
   710 				INFO_PRINTF2(_L("  AcknowledgeReceipts          : %x"), (TUint)settings->AcknowledgeReceipts());
       
   711 				}
       
   712 			if ( settings->MaxEmailSize() != 0 )
       
   713 				{
       
   714 				INFO_PRINTF2(_L("  MaxEmailSize                 : %x"), (TUint)settings->MaxEmailSize());
       
   715 				}
       
   716 			if ( settings->GetMailOptions() != 0 )
       
   717 				{
       
   718 				INFO_PRINTF2(_L("  GetMailOptions               : %x"), (TUint)settings->GetMailOptions());
       
   719 				}
       
   720 			if ( settings->InboxSynchronisationLimit() != 0 )
       
   721 				{
       
   722 				INFO_PRINTF2(_L("  InboxSynchronisationLimit    : %x"), (TUint)settings->InboxSynchronisationLimit());
       
   723 				}
       
   724 			}
       
   725 		CleanupStack::PopAndDestroy(settings);
       
   726 		}
       
   727 
       
   728 	CleanupStack::PopAndDestroy(store);
       
   729 	}
       
   730 
       
   731 void CTestMessBase::PrintStoreImap4L(CMsvEntry& aEntry)
       
   732 	{
       
   733 	TMsvEntry	entry=aEntry.Entry();
       
   734 	CMsvStore*	store=aEntry.ReadStoreL();
       
   735 	CleanupStack::PushL(store);
       
   736 
       
   737 	TPtrC	ptrTemp;
       
   738 	if ( entry.iType == KUidMsvServiceEntry )
       
   739 		{
       
   740 		CImImap4Settings*	settings = new(ELeave) CImImap4Settings();
       
   741 		CleanupStack::PushL(settings);
       
   742 
       
   743 #ifdef __MESSAGING_API_V2__
       
   744 		CEmailAccounts*		accounts = CEmailAccounts::NewLC();
       
   745 		TImapAccount imapAccountId;
       
   746 		accounts->GetImapAccountL(aEntry.EntryId(), imapAccountId);
       
   747 		TRAPD(err, accounts->LoadImapSettingsL(imapAccountId, *settings));
       
   748 		CleanupStack::PopAndDestroy(accounts);
       
   749 #else
       
   750 		TRAPD(err, settings->RestoreL(*store));
       
   751 #endif
       
   752 		if ( err == KErrNone )
       
   753 			{
       
   754 			ptrTemp.Set(settings->ServerAddress());
       
   755 			INFO_PRINTF2(_L("  ServerAddress                : %S"), &ptrTemp);
       
   756 #ifndef __MESSAGING_API_V2__
       
   757 			ptrTemp.Set(settings->UserAddress());
       
   758 			INFO_PRINTF2(_L("  UserAddress                  : %S"), &ptrTemp);
       
   759 			INFO_PRINTF2(_L("  Version                      : %x"), (TUint)settings->Version());
       
   760 #endif
       
   761 			INFO_PRINTF2(_L("  Port                         : %x"), settings->Port());
       
   762 			INFO_PRINTF2(_L("  SecureSockets                : %x"), (TUint)settings->SecureSockets());
       
   763 
       
   764 			HBufC*	loginName=CopyToBufLC(settings->LoginName());
       
   765 			INFO_PRINTF2(_L("  LoginName                    : %S"), loginName);
       
   766 			HBufC*	folderPath=CopyToBufLC(settings->FolderPath());
       
   767 			INFO_PRINTF2(_L("  FolderPath                   : %S"), folderPath);
       
   768 			CleanupStack::PopAndDestroy(2, loginName);
       
   769 			if ( settings->PathSeparator() != 0 )
       
   770 				{
       
   771 				INFO_PRINTF2(_L("  PathSeparator                : %c"), (TText)settings->PathSeparator());
       
   772 				}
       
   773 			if ( settings->DisconnectedUserMode() != 0 )
       
   774 				{
       
   775 				INFO_PRINTF2(_L("  DisconnectedUserMode         : %x"), (TUint)settings->DisconnectedUserMode());
       
   776 				}
       
   777 			if ( settings->Synchronise() != 0 )
       
   778 				{
       
   779 				INFO_PRINTF2(_L("  Synchronise                  : %x"), (TUint)settings->Synchronise());
       
   780 				}
       
   781 			if ( settings->Subscribe() != 0 )
       
   782 				{
       
   783 				INFO_PRINTF2(_L("  Subscribe                    : %x"), (TUint)settings->Subscribe());
       
   784 				}
       
   785 			if ( settings->AutoSendOnConnect() != 0 )
       
   786 				{
       
   787 				INFO_PRINTF2(_L("  AutoSendOnConnect            : %x"), (TUint)settings->AutoSendOnConnect());
       
   788 				}
       
   789 			if ( settings->MaxEmailSize() != 0 )
       
   790 				{
       
   791 				INFO_PRINTF2(_L("  MaxEmailSize                 : %x"), (TUint)settings->MaxEmailSize());
       
   792 				}
       
   793 			if ( settings->DeleteEmailsWhenDisconnecting() != 0 )
       
   794 				{
       
   795 				INFO_PRINTF2(_L("  DeleteEmailsWhenDisconnecting: %x"), (TUint)settings->DeleteEmailsWhenDisconnecting());
       
   796 				}
       
   797 			if ( settings->AcknowledgeReceipts() != 0 )
       
   798 				{
       
   799 				INFO_PRINTF2(_L("  AcknowledgeReceipts          : %x"), (TUint)settings->AcknowledgeReceipts());
       
   800 				}
       
   801 			if ( settings->GetMailOptions() != 0 )
       
   802 				{
       
   803 				INFO_PRINTF2(_L("  GetMailOptions               : %x"), (TUint)settings->GetMailOptions());
       
   804 				}
       
   805 			if ( settings->InboxSynchronisationLimit() != 0 )
       
   806 				{
       
   807 				INFO_PRINTF2(_L("  InboxSynchronisationLimit    : %x"), (TUint)settings->InboxSynchronisationLimit());
       
   808 				}
       
   809 			if ( settings->MailboxSynchronisationLimit() != 0 )
       
   810 				{
       
   811 				INFO_PRINTF2(_L("  MailboxSynchronisationLimit  : %x"), (TUint)settings->MailboxSynchronisationLimit());
       
   812 				}
       
   813 			}
       
   814 		CleanupStack::PopAndDestroy(settings);
       
   815 		}
       
   816 
       
   817 	CleanupStack::PopAndDestroy(store);
       
   818 	}
       
   819 
       
   820 void CTestMessBase::PrintStoreSmsL(CMsvEntry& aEntry)
       
   821 	{
       
   822 	TMsvEntry	entry=aEntry.Entry();
       
   823 	CMsvStore*	store=aEntry.ReadStoreL();
       
   824 	CleanupStack::PushL(store);
       
   825 
       
   826 	TPtrC	ptrTemp;
       
   827 	if ( entry.iType == KUidMsvServiceEntry )
       
   828 		{
       
   829 		CSmsSettings*	settings = CSmsSettings::NewL();
       
   830 		CleanupStack::PushL(settings);
       
   831 
       
   832 #ifdef __MESSAGING_API_V2__
       
   833 		CSmsAccount*		smsAccount = CSmsAccount::NewLC();
       
   834 		TRAPD(err, smsAccount->LoadSettingsL(*settings));
       
   835 		CleanupStack::PopAndDestroy(smsAccount);
       
   836 #else
       
   837 		TRAPD(err, settings->RestoreL(*store));
       
   838 #endif
       
   839 		if ( err == KErrNone )
       
   840 			{
       
   841 			TSmsDelivery	delivery(settings->Delivery());
       
   842 			INFO_PRINTF2(_L("  Delivery                     : %d"), delivery);
       
   843 			CSmsSettings::TSmsReportHandling	reportHandling(settings->StatusReportHandling());
       
   844 			INFO_PRINTF2(_L("  StatusReportHandling         : %d"), reportHandling);
       
   845 			CSmsSettings::TSmsReportHandling	specialMsgHandling(settings->SpecialMessageHandling());
       
   846 			INFO_PRINTF2(_L("  SpecialMessageHandling       : %d"), specialMsgHandling);
       
   847 			INFO_PRINTF2(_L("  ReplyQuoted                  : %d"), settings->ReplyQuoted());
       
   848 #ifdef __MESSAGING_API_V2__
       
   849 			const TInt	numSCAddr = settings->ServiceCenterCount();
       
   850 #else
       
   851 			const TInt	numSCAddr = settings->NumSCAddresses();
       
   852 #endif
       
   853 			for( TInt index=0;index<numSCAddr;index++ )
       
   854 				{
       
   855 #ifdef __MESSAGING_API_V2__
       
   856 				CSmsServiceCenter&	scAddr = settings->GetServiceCenter(index);
       
   857 #else
       
   858 				CSmsNumber&			scAddr = settings->SCAddress(index);
       
   859 #endif
       
   860 				ptrTemp.Set(scAddr.Name());
       
   861 				INFO_PRINTF2(_L("  SC Name                      : %S"), &ptrTemp);
       
   862 				ptrTemp.Set(scAddr.Address());
       
   863 				INFO_PRINTF2(_L("  SC Address                   : %S"), &ptrTemp);
       
   864 				}
       
   865 			CSmsSettings::TSmsSettingsCommDbAction	commDbAction(settings->SmsBearerAction());
       
   866 			INFO_PRINTF2(_L("  SmsBearerAction              : %d"), commDbAction);
       
   867 
       
   868 			CSmsSettings::TMobileSmsBearer	smsBearer(settings->SmsBearer());
       
   869 			INFO_PRINTF2(_L("  SmsBearer                    : %d"), smsBearer);
       
   870 			}
       
   871 		CleanupStack::PopAndDestroy(settings);
       
   872 		}
       
   873 
       
   874 	CleanupStack::PopAndDestroy(store);
       
   875 	}
       
   876 
       
   877 void CTestMessBase::IssueTimerRequest()
       
   878 	{
       
   879 	if (iMessageTimer!= NULL)
       
   880 		{
       
   881 		iMessageTimer->IssueRequest();
       
   882 		}
       
   883 	}
       
   884 
       
   885 void CTestMessBase::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny*, TAny*)
       
   886 /**
       
   887  Handler for the Session Event
       
   888  @param aEvent - TMsvSessionEvent object
       
   889  @param aArg1 - TAny object pointer, used to store the argument for the event
       
   890  @leave - System wide error codes
       
   891 */
       
   892 	{
       
   893 	TBool	printSelection=EFalse;
       
   894 
       
   895 	switch (aEvent)
       
   896 		{
       
   897 	case EMsvEntriesCreated:
       
   898 		INFO_PRINTF1(_L("EMsvEntriesCreated"));
       
   899 		printSelection=ETrue;
       
   900 		break;
       
   901 	case EMsvEntriesChanged:
       
   902 		INFO_PRINTF1(_L("EMsvEntriesChanged"));
       
   903 		printSelection=ETrue;
       
   904 		break;
       
   905 	case EMsvEntriesDeleted:
       
   906 		INFO_PRINTF1(_L("EMsvEntriesDeleted"));
       
   907 		break;
       
   908 	case EMsvEntriesMoved:
       
   909 		INFO_PRINTF1(_L("EMsvEntriesMoved"));
       
   910 		printSelection=ETrue;
       
   911 		break;
       
   912 	case EMsvMtmGroupInstalled:
       
   913 		INFO_PRINTF1(_L("EMsvMtmGroupInstalled"));
       
   914 		break;
       
   915 	case EMsvMtmGroupDeInstalled:
       
   916 		INFO_PRINTF1(_L("EMsvMtmGroupDeInstalled"));
       
   917 		break;
       
   918 	case EMsvGeneralError:
       
   919 		INFO_PRINTF1(_L("EMsvGeneralError"));
       
   920 		break;
       
   921 	case EMsvCloseSession:
       
   922 		INFO_PRINTF1(_L("EMsvCloseSession"));
       
   923 		break;
       
   924 	case EMsvServerReady:
       
   925 		INFO_PRINTF1(_L("EMsvServerReady"));
       
   926 		break;
       
   927 	case EMsvServerFailedToStart:
       
   928 		INFO_PRINTF1(_L("EMsvServerFailedToStart"));
       
   929 		break;
       
   930 	case EMsvCorruptedIndexRebuilt:
       
   931 		INFO_PRINTF1(_L("EMsvCorruptedIndexRebuilt"));
       
   932 		break;
       
   933 	case EMsvServerTerminated:
       
   934 		INFO_PRINTF1(_L("EMsvServerTerminated"));
       
   935 		break;
       
   936 	case EMsvMediaChanged:
       
   937 		INFO_PRINTF1(_L("EMsvMediaChanged"));
       
   938 		break;
       
   939 	case EMsvMediaUnavailable:
       
   940 		INFO_PRINTF1(_L("EMsvMediaUnavailable"));
       
   941 		break;
       
   942 	case EMsvMediaAvailable:
       
   943 		INFO_PRINTF1(_L("EMsvMediaAvailable"));
       
   944 		break;
       
   945 	case EMsvMediaIncorrect:
       
   946 		INFO_PRINTF1(_L("EMsvMediaIncorrect"));
       
   947 		break;
       
   948 	case EMsvCorruptedIndexRebuilding:
       
   949 		INFO_PRINTF1(_L("EMsvCorruptedIndexRebuilding"));
       
   950 		break;
       
   951 	default:
       
   952 		INFO_PRINTF2(_L("EMsv Unknown event:%d"), aEvent);
       
   953 		break;
       
   954 	}
       
   955 
       
   956 	if ( printSelection )
       
   957 		{
       
   958 		CMsvEntrySelection*	selection=STATIC_CAST(CMsvEntrySelection*, aArg1);
       
   959 		CMsvEntry*			entry=NULL;
       
   960 		for ( int i=0; i<selection->Count(); )
       
   961 			{
       
   962 			entry=iSession->GetEntryL(selection->At(i++));
       
   963 			CleanupStack::PushL(entry);
       
   964 			PrintEntryL(*entry);
       
   965 			CleanupStack::PopAndDestroy(entry);
       
   966 			}
       
   967 		}
       
   968 	}
       
   969 
       
   970 
       
   971 void CTestMessBase::PrepareSmsHeaderFromIniFileL(CSmsHeader& aSmsHeader)
       
   972 	{
       
   973 	// Starts the Bitmap server
       
   974 	FbsStartup();
       
   975 	// start the server
       
   976 	RFbsSession::Connect();
       
   977 
       
   978 	// Add the Fromating required for EMS if required
       
   979 	TInt	emsElements=0;
       
   980 	if ( !GetIntFromConfig(ConfigSection(), KElements, emsElements) )
       
   981 		{
       
   982 		ERR_PRINTF1(_L("Elements not set"));
       
   983 		SetTestStepResult(EFail);
       
   984 		}
       
   985 
       
   986 // Macro usage for CDMA mtm
       
   987 #if (defined CDMA_API_ENABLED)
       
   988 	TMsvMessageSms&	message=aSmsHeader.SmsMessage();
       
   989 #else
       
   990 	CSmsMessage&	message=aSmsHeader.Message(); 
       
   991 #endif
       
   992 
       
   993 	TBuf<KMaxTestExecuteCommandLength>	tempStore;
       
   994 	for ( TInt element=0; element<emsElements && TestStepResult()==EPass;)
       
   995 		{
       
   996 		++element;
       
   997 		INFO_PRINTF2(_L("==== PROCESSING ELEMENT %d ===="), element);
       
   998 		//	Start position
       
   999 		tempStore.Format(KStartPosition, element);
       
  1000 		TInt	startPosition=KDefaultStartPos;
       
  1001 		if ( GetIntFromConfig(ConfigSection(), tempStore, startPosition) )
       
  1002 			{
       
  1003 			INFO_PRINTF2(_L("Start position %d"), startPosition);
       
  1004 			}
       
  1005 
       
  1006 		//	File
       
  1007 		tempStore.Format(KFile, element);
       
  1008 		TPtrC	file;
       
  1009 		TParse	fileName;
       
  1010 		TBool	hasFile=GetStringFromConfig(ConfigSection(), tempStore, file);
       
  1011 		if ( hasFile )
       
  1012 			{
       
  1013 			INFO_PRINTF2(_L("File %S"), &file);
       
  1014 			fileName.Set(file,NULL,NULL);
       
  1015 			}
       
  1016 
       
  1017 		tempStore.Format(KType, element);
       
  1018 		TPtrC	type;
       
  1019 		if ( GetStringFromConfig(ConfigSection(), tempStore, type) )
       
  1020 			{
       
  1021 			if ( type.Compare(KTypeFormat) == 0 )
       
  1022 				{
       
  1023 				//	=== Process text formating Information Element ===
       
  1024 				CEmsFormatIE*	newElement=CEmsFormatIE::NewL();
       
  1025 				CleanupStack::PushL(newElement);
       
  1026 				newElement->SetStartPosition(startPosition);
       
  1027 
       
  1028 				TInt			intTemp;
       
  1029 				TBool			boolTemp;
       
  1030 				TPtrC			alignment;
       
  1031 				TPtrC			fontSize;
       
  1032 
       
  1033 				// Set the Format length and other information
       
  1034 				tempStore.Format(KFormatLength, element);
       
  1035 				if ( GetIntFromConfig(ConfigSection(), tempStore, intTemp) )
       
  1036 					{
       
  1037 					INFO_PRINTF2(_L("Format Length %d"), intTemp);
       
  1038 					newElement->SetFormatLength(intTemp);
       
  1039 					}
       
  1040 				tempStore.Format(KBold, element);
       
  1041 				if ( GetBoolFromConfig(ConfigSection(), tempStore, boolTemp) )
       
  1042 					{
       
  1043 					INFO_PRINTF2(_L("Bold %d"), boolTemp);
       
  1044 					newElement->SetBold(boolTemp);
       
  1045 					}
       
  1046 				tempStore.Format(KItalic, element);
       
  1047 				if ( GetBoolFromConfig(ConfigSection(), tempStore, boolTemp) )
       
  1048 					{
       
  1049 					INFO_PRINTF2(_L("Italic %d"), boolTemp);
       
  1050 				    newElement->SetItalic(boolTemp);
       
  1051 					}
       
  1052 				tempStore.Format(KUnderline, element);
       
  1053 				if ( GetBoolFromConfig(ConfigSection(), tempStore, boolTemp) )
       
  1054 					{
       
  1055 					INFO_PRINTF2(_L("Underline %d"), boolTemp);
       
  1056 					newElement->SetUnderline(boolTemp);
       
  1057 					}
       
  1058 				tempStore.Format(KStrikethrough, element);
       
  1059 				if ( GetBoolFromConfig(ConfigSection(), tempStore, boolTemp) )
       
  1060 					{
       
  1061 					INFO_PRINTF2(_L("Strikethrough %d"), boolTemp);
       
  1062 					newElement->SetStrikethrough(boolTemp);
       
  1063 					}
       
  1064 				tempStore.Format(KAlignment,element);
       
  1065 				if(GetStringFromConfig(ConfigSection(),tempStore,alignment))
       
  1066 					{
       
  1067 					SetAlignmentFormat(*newElement, alignment);
       
  1068 					}
       
  1069 				
       
  1070 				tempStore.Format(KFontSize,element);
       
  1071 				if(GetStringFromConfig(ConfigSection(),tempStore,fontSize))
       
  1072 					{
       
  1073 					//
       
  1074 					SetFontSizeFormat(*newElement, fontSize);
       
  1075 					}
       
  1076 			    message.AddEMSInformationElementL(*newElement); 
       
  1077 				CleanupStack::PopAndDestroy(newElement);
       
  1078 				}
       
  1079 			else if ( type.Compare(KTypeSound) == 0 )
       
  1080 				{
       
  1081 				//	=== Process sound Information Element ===
       
  1082 				if ( hasFile )
       
  1083 					{
       
  1084 					HBufC8*			buffFile=CopyToBuf8LC(fileName.FullName());
       
  1085 					CEmsSoundIE*	newElement=CEmsSoundIE::NewL(buffFile->Des());
       
  1086 					CleanupStack::PushL(newElement);
       
  1087 					newElement->SetStartPosition(startPosition); 
       
  1088 				    message.AddEMSInformationElementL(*newElement); 
       
  1089 					CleanupStack::PopAndDestroy(2, buffFile);
       
  1090 					}
       
  1091 				else
       
  1092 					{
       
  1093 					ERR_PRINTF1(_L("No Sound file name"));
       
  1094 					SetTestStepResult(EFail);
       
  1095 					}
       
  1096 				}
       
  1097 			else if ( type.Compare(KTypePreDefSound) == 0 )
       
  1098 				{
       
  1099 				//	=== Process predefined sound Information Element ===
       
  1100 				TPtrC	preDefSound;
       
  1101 				tempStore.Format(KEmsPreDef, element);
       
  1102 				if ( !GetStringFromConfig(ConfigSection(),tempStore, preDefSound))
       
  1103 					{
       
  1104 					ERR_PRINTF1(_L("Predefined sound not present"));
       
  1105 					SetTestStepResult(EFail);
       
  1106 					}
       
  1107 				else
       
  1108 					{
       
  1109 					INFO_PRINTF2(_L("Predefined sound %S"), &preDefSound);
       
  1110 					CEmsPreDefSoundIE*	newElement=NewPreDefSoundL(preDefSound);
       
  1111 
       
  1112 					if ( newElement != NULL )
       
  1113 						{
       
  1114 						//Assign the predef animation element to newElement
       
  1115 						CleanupStack::PushL(newElement);
       
  1116 						newElement->SetStartPosition(startPosition);
       
  1117 					    message.AddEMSInformationElementL(*newElement); 
       
  1118 						CleanupStack::PopAndDestroy(newElement);
       
  1119 						}
       
  1120 					else
       
  1121 						{
       
  1122 						ERR_PRINTF1(_L("Unable to create predefined sound"));
       
  1123 						SetTestStepResult(EFail);
       
  1124 						}
       
  1125 					}
       
  1126 				}
       
  1127 			else if ( type.Compare(KTypeAnimation) == 0 )
       
  1128 				{
       
  1129 				//	=== Process animation Information Element ===
       
  1130 				if ( hasFile )
       
  1131 					{
       
  1132 					TPtrC	objectSize;
       
  1133 
       
  1134 					tempStore.Format(KObjectSize, element);
       
  1135 					if ( !GetStringFromConfig(ConfigSection(),tempStore,objectSize) )
       
  1136 						{
       
  1137 						ERR_PRINTF1(_L("No size provided"));
       
  1138 						SetTestStepResult(EFail);
       
  1139 						}
       
  1140 					else
       
  1141 						{
       
  1142 						CFbsBitmap*	bmp=NewBitmapL(fileName, objectSize);
       
  1143 						if ( bmp == NULL )
       
  1144 							{
       
  1145 							ERR_PRINTF1(_L("Failed to Load Animation File. Error %d"));
       
  1146 							SetTestStepResult(EFail);
       
  1147 							}
       
  1148 						else
       
  1149 							{
       
  1150 							CleanupStack::PushL(bmp);
       
  1151 							CEmsAnimationIE*	newElement=CEmsAnimationIE::NewL(*bmp);
       
  1152 							CleanupStack::PushL(newElement);
       
  1153 							newElement->SetStartPosition(startPosition);
       
  1154 						    message.AddEMSInformationElementL(*newElement); 
       
  1155 							CleanupStack::PopAndDestroy(2, bmp);
       
  1156 							}
       
  1157 						}
       
  1158 					}
       
  1159 				else
       
  1160 					{
       
  1161 					ERR_PRINTF1(_L("No Animation file name"));
       
  1162 					SetTestStepResult(EFail);
       
  1163 					}
       
  1164 				}
       
  1165 			else if ( type.Compare(KTypePreDefAnimation) == 0 )
       
  1166 				{
       
  1167 				//	=== Process predefined animation Information Element ===
       
  1168 				TPtrC	preDefAnim;
       
  1169 				tempStore.Format(KEmsPreDef, element);
       
  1170 				if ( !GetStringFromConfig(ConfigSection(),tempStore, preDefAnim) )
       
  1171 					{
       
  1172 					ERR_PRINTF1(_L("Predefined animations not present"));
       
  1173 					SetTestStepResult(EFail);
       
  1174 					}
       
  1175 				else
       
  1176 					{
       
  1177 					INFO_PRINTF2(_L("Predefined animation %S"), &preDefAnim);
       
  1178 					CEmsPreDefAnimationIE*	newElement=NewPreDefAnimationL(preDefAnim);
       
  1179 
       
  1180 					if ( newElement != NULL )
       
  1181 						{
       
  1182 						//Assign the predef animation element to newElement
       
  1183 						CleanupStack::PushL(newElement);
       
  1184 						newElement->SetStartPosition(startPosition);
       
  1185 					    message.AddEMSInformationElementL(*newElement); 
       
  1186 						CleanupStack::PopAndDestroy(newElement);
       
  1187 						}
       
  1188 					else
       
  1189 						{
       
  1190 						ERR_PRINTF1(_L("Unable to create predefined animation"));
       
  1191 						SetTestStepResult(EFail);
       
  1192 						}
       
  1193 					}
       
  1194 				}
       
  1195 			else if ( type.Compare(KTypePicture) == 0 )
       
  1196 				{
       
  1197 				//	=== Process picture Information Element ===
       
  1198 				if ( hasFile )
       
  1199 					{
       
  1200 					TPtrC	objectSize;
       
  1201 
       
  1202 					tempStore.Format(KObjectSize, element);
       
  1203 					if ( !GetStringFromConfig(ConfigSection(),tempStore,objectSize) )
       
  1204 						{
       
  1205 						ERR_PRINTF1(_L("No size provided"));
       
  1206 						SetTestStepResult(EFail);
       
  1207 						}
       
  1208 					else
       
  1209 						{
       
  1210 						CFbsBitmap*	bmp=NewBitmapL(fileName, objectSize);
       
  1211 						if ( bmp == NULL )
       
  1212 							{
       
  1213 							ERR_PRINTF1(_L("Failed to Load Animation File. Error %d"));
       
  1214 							SetTestStepResult(EFail);
       
  1215 							}
       
  1216 						else
       
  1217 							{
       
  1218 							CleanupStack::PushL(bmp);
       
  1219 							CEmsPictureIE*	newElement=CEmsPictureIE::NewL(*bmp);
       
  1220 							CleanupStack::PushL(newElement);
       
  1221 							newElement->SetStartPosition(startPosition);
       
  1222 						    message.AddEMSInformationElementL(*newElement); 
       
  1223 							CleanupStack::PopAndDestroy(2, bmp);
       
  1224 							}
       
  1225 						}
       
  1226 					}
       
  1227 				else
       
  1228 					{
       
  1229 					ERR_PRINTF1(_L("No Picture file name"));
       
  1230 					SetTestStepResult(EFail);
       
  1231 					}
       
  1232 				}
       
  1233 			else if ( type.Compare(KTypeUserPrompt) == 0 )
       
  1234 				{
       
  1235 				//	=== Process user prompt Information Element ===
       
  1236 				CEmsUserPrompt*	newElement=CEmsUserPrompt::NewL(2);
       
  1237 				CleanupStack::PushL(newElement);
       
  1238 				newElement->SetStartPosition(startPosition);
       
  1239 			    message.AddEMSInformationElementL(*newElement); 
       
  1240 				CleanupStack::PopAndDestroy(newElement);
       
  1241 				}
       
  1242 			else
       
  1243 				{
       
  1244 				ERR_PRINTF2(_L("Unknown element type %S"), &type);
       
  1245 				SetTestStepResult(EFail);
       
  1246 				}
       
  1247 			}
       
  1248 		else
       
  1249 			{
       
  1250 			ERR_PRINTF1(_L("No type given"));
       
  1251 			SetTestStepResult(EFail);
       
  1252 			}
       
  1253 		}
       
  1254 
       
  1255 	RFbsSession::Disconnect(); 
       
  1256 	}
       
  1257 
       
  1258 /**
       
  1259  This function reads the schedule time from ini file
       
  1260  @return - returns the schedule time read from the ini file
       
  1261 */
       
  1262 TTimeIntervalMinutes CTestMessBase::ReadScheduleTime()
       
  1263 	{
       
  1264 	// Read  the schedule time from ini file. Add this schedule time to current time.
       
  1265 	// This time will be set as the scheduled time for sending the SMS message from task scheduler
       
  1266 	// By default schedule time will be 1 min
       
  1267 	TInt	scheduled=0;
       
  1268 	GetIntFromConfig(ConfigSection(), KScheduled, scheduled);
       
  1269 	INFO_PRINTF2(_L("Scheduled Time in minutes is %d"), scheduled);
       
  1270 	return TTimeIntervalMinutes(scheduled);
       
  1271 	}
       
  1272 
       
  1273 void CTestMessBase::SetAlignmentFormat(CEmsFormatIE& aEmsFormatIE, const TDesC& aAlignment)
       
  1274 	{
       
  1275 	//Sets the alignment to the text
       
  1276 	INFO_PRINTF2(_L("Alignment %S"), &aAlignment);
       
  1277 	if( aAlignment.Compare(KLeftAlign)== 0 )
       
  1278 		{
       
  1279 		aEmsFormatIE.SetAlignment(CEmsFormatIE::ELeft);
       
  1280 		}
       
  1281 	else if( aAlignment.Compare(KRightAlign)== 0 )
       
  1282 		{
       
  1283 		aEmsFormatIE.SetAlignment(CEmsFormatIE::ERight);
       
  1284 		}
       
  1285 	else if( aAlignment.Compare(KCenterAlign)== 0 )
       
  1286 		{
       
  1287 		aEmsFormatIE.SetAlignment(CEmsFormatIE::ECenter);
       
  1288 		}
       
  1289 	else if( aAlignment.Compare(KLangDepend)== 0 )
       
  1290 		{
       
  1291 		aEmsFormatIE.SetAlignment(CEmsFormatIE::ELangDepend);
       
  1292 		}
       
  1293 	else
       
  1294 		{
       
  1295 		ERR_PRINTF1(_L("Illegal alignment value"));
       
  1296 		SetTestStepResult(EFail);
       
  1297 		}
       
  1298 	}
       
  1299 
       
  1300 void CTestMessBase::SetFontSizeFormat(CEmsFormatIE& aEmsFormatIE, const TDesC& aFontSize)
       
  1301 	{
       
  1302 	//Sets the specified font to the text 
       
  1303 	INFO_PRINTF2(_L("FontSize %S"), &aFontSize);
       
  1304 	if( aFontSize.Compare(KNormal)== 0 )
       
  1305 		{
       
  1306 		aEmsFormatIE.SetFontSize(CEmsFormatIE::ENormal);
       
  1307 		}
       
  1308 	else if( aFontSize.Compare(KLarge)== 0 )
       
  1309 		{
       
  1310 		aEmsFormatIE.SetFontSize(CEmsFormatIE::ELarge);
       
  1311 		}
       
  1312 	else if( aFontSize.Compare(KSmall)== 0 )
       
  1313 		{
       
  1314 		aEmsFormatIE.SetFontSize(CEmsFormatIE::ESmall);
       
  1315 		}
       
  1316 	else if( aFontSize.Compare(KReserved)== 0 )
       
  1317 		{
       
  1318 		aEmsFormatIE.SetFontSize(CEmsFormatIE::EReserved);
       
  1319 		}
       
  1320 	else
       
  1321 		{
       
  1322 		ERR_PRINTF1(_L("Illegal fonst size value"));
       
  1323 		SetTestStepResult(EFail);
       
  1324 		}
       
  1325 	}
       
  1326 
       
  1327 CEmsPreDefAnimationIE* CTestMessBase::NewPreDefAnimationL(const TDesC& aPreDefType) 
       
  1328 //
       
  1329 // Attaches the required predef animation. 
       
  1330 // Arguments - aString - holds the TAnim type to be attached 
       
  1331 // Return Value - Returns a Pointer of CEmsPreDefAnimationIE 
       
  1332 //
       
  1333 	{
       
  1334 	//Initialize emsPreDef to NULL
       
  1335 	CEmsPreDefAnimationIE::TAnimType	animType=CEmsPreDefAnimationIE::EFlirty;
       
  1336 	TBool								validType=ETrue;
       
  1337 
       
  1338 	//Set a value for emsPreDef 
       
  1339 	if ( aPreDefType.Compare(KEmsAnimTypeFlirty) == 0 )
       
  1340 		{
       
  1341 		animType = CEmsPreDefAnimationIE::EFlirty;
       
  1342 		}
       
  1343 	else if ( aPreDefType.Compare(KEmsAnimTypeGlad) == 0 )
       
  1344 		{
       
  1345 		animType = CEmsPreDefAnimationIE::EGlad;
       
  1346 		}
       
  1347 	else if ( aPreDefType.Compare(KEmsAnimTypeSceptic) == 0 )
       
  1348 		{
       
  1349 		animType = CEmsPreDefAnimationIE::ESceptic;
       
  1350 		}
       
  1351 	else if ( aPreDefType.Compare(KEmsAnimTypeSad) == 0 )
       
  1352 		{
       
  1353 		animType = CEmsPreDefAnimationIE::ESad;
       
  1354 		}
       
  1355 	else if ( aPreDefType.Compare(KEmsAnimTypeWow) == 0 )
       
  1356 		{
       
  1357 		animType = CEmsPreDefAnimationIE::EWow;
       
  1358 		}
       
  1359 	else if ( aPreDefType.Compare(KEmsAnimTypeCrying) == 0 )
       
  1360 		{
       
  1361 		animType = CEmsPreDefAnimationIE::ECrying;
       
  1362 		}
       
  1363 	else if ( aPreDefType.Compare(KEmsAnimTypeWinking) == 0 )
       
  1364 		{
       
  1365 		animType = CEmsPreDefAnimationIE::EWinking;
       
  1366 		}
       
  1367 	else if ( aPreDefType.Compare(KEmsAnimTypeLaughing) == 0 )
       
  1368 		{
       
  1369 		animType = CEmsPreDefAnimationIE::ELaughing;
       
  1370 		}
       
  1371 	else if ( aPreDefType.Compare(KEmsAnimTypeIndifferent) == 0 )
       
  1372 		{
       
  1373 		animType = CEmsPreDefAnimationIE::EIndifferent;
       
  1374 		}
       
  1375 	else if ( aPreDefType.Compare(KEmsAnimTypeKissing) == 0 )
       
  1376 		{
       
  1377 		animType = CEmsPreDefAnimationIE::EKissing;
       
  1378 		}
       
  1379 	else if ( aPreDefType.Compare(KEmsAnimTypeConfused) == 0 )
       
  1380 		{
       
  1381 		animType = CEmsPreDefAnimationIE::EConfused;
       
  1382 		}
       
  1383 	else if ( aPreDefType.Compare(KEmsAnimTypeTongueOut) == 0 )
       
  1384 		{
       
  1385 		animType = CEmsPreDefAnimationIE::ETongueOut;
       
  1386 		}
       
  1387 	else if ( aPreDefType.Compare(KEmsAnimTypeAngry) == 0 )
       
  1388 		{
       
  1389 		animType = CEmsPreDefAnimationIE::EAngry;
       
  1390 		}
       
  1391 	else if ( aPreDefType.Compare(KEmsAnimTypeGlasses) == 0 )
       
  1392 		{
       
  1393 		animType = CEmsPreDefAnimationIE::EGlasses;
       
  1394 		}
       
  1395 	else if ( aPreDefType.Compare(KEmsAnimTypeDevil) == 0 )
       
  1396 		{
       
  1397 		animType = CEmsPreDefAnimationIE::EDevil;
       
  1398 		}
       
  1399 	else
       
  1400 		{
       
  1401 		validType=EFalse;
       
  1402 		}
       
  1403 
       
  1404 	CEmsPreDefAnimationIE*	emsPreDef=NULL;
       
  1405 	if ( validType )
       
  1406 		{
       
  1407 		emsPreDef=CEmsPreDefAnimationIE::NewL(animType);
       
  1408 		}
       
  1409 
       
  1410 	return emsPreDef;
       
  1411 	}
       
  1412 
       
  1413 CEmsPreDefSoundIE* CTestMessBase::NewPreDefSoundL(const TDesC& aPreDefType) 
       
  1414 //
       
  1415 // Attaches the required predef animation. 
       
  1416 // Arguments - aString - holds the TAnim type to be attached 
       
  1417 // Return Value - Returns a Pointer of CEmsPreDefAnimationIE 
       
  1418 //
       
  1419 	{
       
  1420 	//Initialize emsPreDef to NULL
       
  1421 	CEmsPreDefSoundIE::TPredefinedSound	soundType=CEmsPreDefSoundIE::EChimesHigh;
       
  1422 	TBool								validType=ETrue;
       
  1423 
       
  1424 	//Set a value for emsPreDef 
       
  1425 	if ( aPreDefType.Compare(KEmsSoundTypeChimesHigh) == 0 )
       
  1426 		{
       
  1427 		soundType = CEmsPreDefSoundIE::EChimesHigh;
       
  1428 		}
       
  1429 	else if ( aPreDefType.Compare(KEmsSoundTypeChimesLow) == 0 )
       
  1430 		{
       
  1431 		soundType = CEmsPreDefSoundIE::EChimesLow;
       
  1432 		}
       
  1433 	else if ( aPreDefType.Compare(KEmsSoundTypeDing) == 0 )
       
  1434 		{
       
  1435 		soundType = CEmsPreDefSoundIE::EDing;
       
  1436 		}
       
  1437 	else if ( aPreDefType.Compare(KEmsSoundTypeTaDa) == 0 )
       
  1438 		{
       
  1439 		soundType = CEmsPreDefSoundIE::ETaDa;
       
  1440 		}
       
  1441 	else if ( aPreDefType.Compare(KEmsSoundTypeNotify) == 0 )
       
  1442 		{
       
  1443 		soundType = CEmsPreDefSoundIE::ENotify;
       
  1444 		}
       
  1445 	else if ( aPreDefType.Compare(KEmsSoundTypeDrum) == 0 )
       
  1446 		{
       
  1447 		soundType = CEmsPreDefSoundIE::EDrum;
       
  1448 		}
       
  1449 	else if ( aPreDefType.Compare(KEmsSoundTypeClaps) == 0 )
       
  1450 		{
       
  1451 		soundType = CEmsPreDefSoundIE::EClaps;
       
  1452 		}
       
  1453 	else if ( aPreDefType.Compare(KEmsSoundTypeFanFar) == 0 )
       
  1454 		{
       
  1455 		soundType = CEmsPreDefSoundIE::EFanFar;
       
  1456 		}
       
  1457 	else if ( aPreDefType.Compare(KEmsSoundTypeChordHigh) == 0 )
       
  1458 		{
       
  1459 		soundType = CEmsPreDefSoundIE::EChordHigh;
       
  1460 		}
       
  1461 	else if ( aPreDefType.Compare(KEmsSoundTypeChordLow) == 0 )
       
  1462 		{
       
  1463 		soundType = CEmsPreDefSoundIE::EChordLow;
       
  1464 		}
       
  1465 	else
       
  1466 		{
       
  1467 		validType=EFalse;
       
  1468 		}
       
  1469 
       
  1470 	CEmsPreDefSoundIE*	emsPreDef=NULL;
       
  1471 	if ( validType )
       
  1472 		{
       
  1473 		emsPreDef=CEmsPreDefSoundIE::NewL(soundType);
       
  1474 		}
       
  1475 
       
  1476 	return emsPreDef;
       
  1477 	}
       
  1478 
       
  1479 CFbsBitmap* CTestMessBase::NewBitmapL(const TParse& aFileName, const TDesC& aObjectSize)
       
  1480 	{
       
  1481 	TInt	bitmapType=KSmallObject;
       
  1482 	TBool	validType=ETrue;
       
  1483 	if( aObjectSize.Compare(KSmall) == 0 )
       
  1484 		{
       
  1485 		bitmapType=KSmallObject;
       
  1486 		}
       
  1487 	else if ( aObjectSize.Compare(KLarge) == 0 )
       
  1488 		{
       
  1489 		bitmapType=KLargeObject;
       
  1490 		}
       
  1491 	else if ( aObjectSize.Compare(KVariable) == 0 )
       
  1492 		{
       
  1493 		bitmapType=KVariableObject;
       
  1494 		}
       
  1495 	else
       
  1496 		{
       
  1497 		ERR_PRINTF2(_L("Invalid bitmap type %S"), &aObjectSize);
       
  1498 		validType=EFalse;
       
  1499 		}
       
  1500 
       
  1501 	CFbsBitmap*	bmp = NULL;
       
  1502 	if ( validType )
       
  1503 		{
       
  1504 		bmp = new (ELeave) CFbsBitmap();
       
  1505 
       
  1506 		TInt	error = bmp->Load(aFileName.FullName(), bitmapType, EFalse);
       
  1507 		INFO_PRINTF2(_L("Bimap load %d"), error);
       
  1508 		if ( error != KErrNone)
       
  1509 			{
       
  1510 			delete bmp;
       
  1511 			bmp=NULL;
       
  1512 			}
       
  1513 		}
       
  1514 
       
  1515 	return bmp;
       
  1516 	}
       
  1517