|
1 // Copyright (c) 2000-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 // msvtestutils.cpp |
|
15 // |
|
16 |
|
17 #include "msvtestutils.h" |
|
18 #include "MSVSERV.H" |
|
19 #include <e32uid.h> |
|
20 #include <mtsr.h> |
|
21 #include <msvruids.h> |
|
22 #include <txtfmlyr.h> |
|
23 #include <txtetext.h> |
|
24 #include <txtrich.h> |
|
25 #include <miuthdr.h> |
|
26 #include <mtclbase.h> |
|
27 #include <flogger.h> |
|
28 #include <msventryscheduledata.h> |
|
29 #include <csch_cli.h> |
|
30 #include <sqldb.h> |
|
31 |
|
32 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
33 #include "msvconsts.h" |
|
34 #include "timrfc822datefield.h" |
|
35 #endif |
|
36 |
|
37 _LIT(KStoreInitFileName, "\\private\\1000484b\\StoreInit.tmp"); |
|
38 #ifdef SYMBIAN_MESSAGESTORE_UNIT_TESTCODE |
|
39 _LIT(KDbFileName, "\\messaging.db"); |
|
40 #else |
|
41 _LIT(KDbFileName, "[1000484B]messaging.db"); |
|
42 #endif |
|
43 |
|
44 |
|
45 // |
|
46 // |
|
47 // TestMsvOperationTimer |
|
48 // |
|
49 // |
|
50 |
|
51 EXPORT_C TestMsvOperationTimer* TestMsvOperationTimer::NewLC(CConsoleBase* aConsole, CMsvOperation* aMsvOperation, RTest& aRTest) |
|
52 { |
|
53 TestMsvOperationTimer* self = new(ELeave) TestMsvOperationTimer(aConsole, aMsvOperation, aRTest); |
|
54 CleanupStack::PushL(self); |
|
55 self->ConstructL(); |
|
56 return self; |
|
57 } |
|
58 |
|
59 EXPORT_C TestMsvOperationTimer::TestMsvOperationTimer(CConsoleBase* aConsole, CMsvOperation* aMsvOperation, RTest& aRTest) |
|
60 : CTimer(EPriorityStandard+3), iMsvOperation(aMsvOperation), iRTest(aRTest) |
|
61 { |
|
62 iConsole = aConsole; |
|
63 iPeriod = KPeriod; |
|
64 iClosing = EFalse; |
|
65 iCount = 0; |
|
66 } |
|
67 |
|
68 EXPORT_C void TestMsvOperationTimer::ConstructL() |
|
69 { |
|
70 CTimer::ConstructL(); |
|
71 CActiveScheduler::Add(this); |
|
72 } |
|
73 |
|
74 EXPORT_C void TestMsvOperationTimer::IssueRequest() |
|
75 { |
|
76 After(iPeriod); |
|
77 } |
|
78 |
|
79 EXPORT_C void TestMsvOperationTimer::DoCancel() |
|
80 { |
|
81 CTimer::DoCancel(); |
|
82 } |
|
83 |
|
84 EXPORT_C void TestMsvOperationTimer::RunL() |
|
85 { |
|
86 // display the current progress |
|
87 TMsvId temp; |
|
88 TPckgC<TMsvId> paramPack(temp); |
|
89 |
|
90 const TDesC8& progBuf = iMsvOperation->ProgressL(); |
|
91 paramPack.Set(progBuf); |
|
92 TMsvId progress=paramPack(); |
|
93 |
|
94 iRTest.Console()->SetPos(0, 10); |
|
95 iRTest.Printf(_L(" MessageId %d \n"),progress); |
|
96 |
|
97 IssueRequest(); |
|
98 }; |
|
99 |
|
100 |
|
101 // |
|
102 // |
|
103 // CMsvTestUtils |
|
104 // |
|
105 // |
|
106 |
|
107 EXPORT_C CMsvTestUtils::CMsvTestUtils(RTest& aRTest) |
|
108 : CTestUtils(aRTest) |
|
109 { |
|
110 } |
|
111 |
|
112 EXPORT_C CMsvTestUtils::~CMsvTestUtils() |
|
113 { |
|
114 Reset(); |
|
115 |
|
116 delete iServerMtmDllRegistry; |
|
117 delete iMtmRegistryControl; |
|
118 } |
|
119 |
|
120 EXPORT_C void CMsvTestUtils::Reset() |
|
121 { |
|
122 delete iMsvEntry; |
|
123 iMsvEntry = NULL; |
|
124 |
|
125 delete iServerEntry; |
|
126 iServerEntry = NULL; |
|
127 |
|
128 delete iMsvServer; |
|
129 iMsvServer = NULL; |
|
130 |
|
131 delete iClientMtmRegistry; |
|
132 iClientMtmRegistry = NULL; |
|
133 |
|
134 if(iMsvSession!=NULL) |
|
135 { |
|
136 iMsvSession->CloseMessageServer(); |
|
137 } |
|
138 |
|
139 delete iMsvSession; |
|
140 iMsvSession = NULL; |
|
141 |
|
142 delete iDummyObserver; |
|
143 iDummyObserver = NULL; |
|
144 |
|
145 iClientServer = ENeither; |
|
146 SpecifyRfc822Dir(KRfc822Files); |
|
147 } |
|
148 |
|
149 EXPORT_C CBaseMtm* CMsvTestUtils::InstantiateClientMtmL(TUid aMtmType, TMsvId aServiceId) |
|
150 { |
|
151 // client side |
|
152 __ASSERT_ALWAYS(iClientServer == EClientSide, Panic(KErrGeneral)); |
|
153 |
|
154 if (!iClientMtmRegistry) |
|
155 { |
|
156 iClientMtmRegistry = CClientMtmRegistry::NewL(*iMsvSession); |
|
157 } |
|
158 |
|
159 CBaseMtm* newMtm = iClientMtmRegistry->NewMtmL(aMtmType); |
|
160 |
|
161 CMsvEntry* entry = iMsvSession->GetEntryL(aServiceId); |
|
162 CleanupStack::PushL(entry); |
|
163 newMtm->SetCurrentEntryL(entry); |
|
164 CleanupStack::Pop(); //entry |
|
165 return newMtm; |
|
166 } |
|
167 |
|
168 EXPORT_C CBaseServerMtm* CMsvTestUtils::InstantiateServerMtmL(TUid aMtmType, TMsvId aServiceId) |
|
169 { |
|
170 // server side |
|
171 __ASSERT_ALWAYS(iServerMtmDllRegistry, Panic(KErrGeneral)); |
|
172 __ASSERT_ALWAYS(iClientServer == EServerSide, Panic(KErrNotSupported)); |
|
173 User::LeaveIfError(iServerEntry->SetEntry(aServiceId)); |
|
174 CBaseServerMtm* newMtm = iServerMtmDllRegistry->NewServerMtmL(aMtmType, iServerEntry); |
|
175 return newMtm; |
|
176 } |
|
177 |
|
178 |
|
179 EXPORT_C void CMsvTestUtils::GoClientSideL() |
|
180 { |
|
181 Reset(); |
|
182 iFs.SetSessionPath(iDriveName); |
|
183 iDummyObserver = new (ELeave) TMsvDummyObserver; |
|
184 iMsvSession = CMsvSession::OpenSyncL(*iDummyObserver); |
|
185 iMsvEntry = CMsvEntry::NewL(*iMsvSession, KMsvRootIndexEntryId, TMsvSelectionOrdering()); |
|
186 iClientServer = EClientSide; |
|
187 } |
|
188 |
|
189 EXPORT_C void CMsvTestUtils::GoServerSideL() |
|
190 { |
|
191 Reset(); |
|
192 |
|
193 _LIT(KMsvServerPattern, "!MsvServer*"); |
|
194 TFindProcess findprocess(KMsvServerPattern); |
|
195 TFullName name; |
|
196 |
|
197 // wait for the server to close before trying to start |
|
198 // one within this process. |
|
199 for(;;) |
|
200 { |
|
201 TFindServer find(KMsvServerPattern); |
|
202 if (find.Next(name) != KErrNone) |
|
203 break; |
|
204 User::After(100000); |
|
205 } |
|
206 |
|
207 iMsvServer = CMsvServer::NewL(); |
|
208 |
|
209 // wait a couple of seconds |
|
210 CTestTimer* timer = CTestTimer::NewL(); |
|
211 timer->After(5000000); |
|
212 CActiveScheduler::Start(); |
|
213 delete timer; |
|
214 |
|
215 iServerEntry = CMsvServerEntry::NewL(*iMsvServer, KMsvRootIndexEntryId); |
|
216 iClientServer = EServerSide; |
|
217 } |
|
218 |
|
219 EXPORT_C void CMsvTestUtils::CreateServerMtmRegL(const TUid aMsgType, const TDesC& aHumanReadableName, const TMsvTestDllInfo& aServerMtm, const TMsvTestDllInfo& aClientMtm, const TMsvTestDllInfo& aUiMtm, const TMsvTestDllInfo& aUiDataMtm, const TUid aGroup, const TDesC& aDatFile) |
|
220 { |
|
221 CMtmDllInfoArray* mtmdllinfoarray=new(ELeave) CMtmDllInfoArray(); |
|
222 CleanupStack::PushL(mtmdllinfoarray); |
|
223 |
|
224 CMtmDllInfo* mtmdllinfo1=CMtmDllInfo::NewL(aHumanReadableName,TUidType(KDynamicLibraryUid,KUidMtmServerComponent,TUid::Uid(KUidMtmDefaultSpecificVal)),aServerMtm.iFileName,aServerMtm.iOrdinal,aServerMtm.iVersion); |
|
225 mtmdllinfoarray->AddMtmDllInfoL(mtmdllinfo1); |
|
226 |
|
227 CMtmDllInfo* mtmdllinfo2=CMtmDllInfo::NewL(aHumanReadableName,TUidType(KDynamicLibraryUid,KUidMtmClientComponent,TUid::Uid(KUidMtmDefaultSpecificVal)),aClientMtm.iFileName,aClientMtm.iOrdinal,aClientMtm.iVersion); |
|
228 mtmdllinfoarray->AddMtmDllInfoL(mtmdllinfo2); |
|
229 |
|
230 CMtmDllInfo* mtmdllinfo3=CMtmDllInfo::NewL(aHumanReadableName,TUidType(KDynamicLibraryUid,KUidMtmUiComponent,TUid::Uid(KUidMtmDefaultSpecificVal)),aUiMtm.iFileName,aUiMtm.iOrdinal,aUiMtm.iVersion); |
|
231 mtmdllinfoarray->AddMtmDllInfoL(mtmdllinfo3); |
|
232 |
|
233 CMtmDllInfo* mtmdllinfo4=CMtmDllInfo::NewL(aHumanReadableName,TUidType(KDynamicLibraryUid,KUidMtmUiDataComponent,TUid::Uid(KUidMtmDefaultSpecificVal)),aUiDataMtm.iFileName,aUiDataMtm.iOrdinal,aUiDataMtm.iVersion); |
|
234 mtmdllinfoarray->AddMtmDllInfoL(mtmdllinfo4); |
|
235 |
|
236 // Create an empty capability set for creating a new group data object |
|
237 TCapabilitySet capSet; |
|
238 capSet.SetEmpty(); |
|
239 CleanupStack::Pop(mtmdllinfoarray); // next line takes ownership |
|
240 CMtmGroupData* mtmgroupdata=CMtmGroupData::NewL(aMsgType, aGroup, mtmdllinfoarray, capSet); |
|
241 CleanupStack::PushL(mtmgroupdata); |
|
242 |
|
243 CFileStore* filestore = CPermanentFileStore::ReplaceLC(FileSession(), aDatFile, EFileShareExclusive|EFileStream|EFileWrite); |
|
244 TUidType uidtype(KPermanentFileStoreLayoutUid, KUidMsvDataComponent, aMsgType); |
|
245 |
|
246 filestore->SetTypeL(uidtype); |
|
247 RStoreWriteStream out; |
|
248 TStreamId streamid=out.CreateLC(*filestore); // Push to stack |
|
249 mtmgroupdata->ExternalizeL(out); |
|
250 out.CommitL(); |
|
251 CleanupStack::PopAndDestroy(); // out |
|
252 filestore->SetRootL(streamid); |
|
253 filestore->CommitL(); |
|
254 CleanupStack::PopAndDestroy(2, mtmgroupdata); // filestore, mtmgroupdata |
|
255 } |
|
256 |
|
257 EXPORT_C TMsvId CMsvTestUtils::CreateServiceL(const TUid aMtm, TBool aReadOnly, TBool aVisible) |
|
258 { |
|
259 TMsvId id = 0; |
|
260 TMsvEntry entry; |
|
261 entry.iMtm = aMtm; |
|
262 entry.iType = KUidMsvServiceEntry; |
|
263 entry.SetReadOnly(aReadOnly); |
|
264 entry.SetVisible(aVisible); |
|
265 |
|
266 SetEntryL(KMsvRootIndexEntryId); |
|
267 CreateEntryL(entry); |
|
268 id = entry.Id(); |
|
269 SetEntryL(id); |
|
270 return id; |
|
271 } |
|
272 |
|
273 |
|
274 EXPORT_C void CMsvTestUtils::CreateRegistryObjectAndControlL() |
|
275 { |
|
276 // Create the registry object |
|
277 if (!iServerMtmDllRegistry) |
|
278 iServerMtmDllRegistry = CServerMtmDllRegistry::NewL(iFs); |
|
279 |
|
280 // Create the registry control.. |
|
281 if (!iMtmRegistryControl) |
|
282 iMtmRegistryControl = CMtmRegistryControl::NewL(iFs, *iServerMtmDllRegistry); |
|
283 |
|
284 iRegistryObjectAndControlCreated = ETrue; |
|
285 } |
|
286 |
|
287 EXPORT_C void CMsvTestUtils::InstallMtmGroupL(const TDesC& aDatFile) |
|
288 { |
|
289 TInt err = KErrNone; |
|
290 |
|
291 if (iClientServer == EClientSide) |
|
292 { |
|
293 err = iMsvSession->InstallMtmGroup(aDatFile); |
|
294 } |
|
295 else |
|
296 { |
|
297 User::LeaveIfNull(iServerMtmDllRegistry); |
|
298 User::LeaveIfNull(iMtmRegistryControl); |
|
299 |
|
300 // Actually load the group data... |
|
301 TUid aUid; |
|
302 err = iMtmRegistryControl->InstallMtmGroup(aDatFile, aUid); |
|
303 } |
|
304 |
|
305 if (err != KErrAlreadyExists) |
|
306 User::LeaveIfError(err); |
|
307 } |
|
308 |
|
309 EXPORT_C void CMsvTestUtils::CleanMessageFolderL() |
|
310 { |
|
311 |
|
312 //Kill the message server if its running |
|
313 _LIT(KMsvServerPattern, "!MsvServer*"); |
|
314 TFindProcess findprocess(KMsvServerPattern); |
|
315 TFullName name; |
|
316 if(findprocess.Next(name)==KErrNone) |
|
317 { |
|
318 RProcess process; |
|
319 User::LeaveIfError(process.Open(findprocess)); |
|
320 process.Kill(KErrCancel) ; |
|
321 process.Close() ; |
|
322 } |
|
323 |
|
324 // Wait for the server to close before trying to remove |
|
325 // the message folder |
|
326 |
|
327 TInt loopCount = 0; |
|
328 FOREVER |
|
329 { |
|
330 TFindServer find(KMsvServerPattern); |
|
331 if (find.Next(name) != KErrNone) |
|
332 break; |
|
333 User::After(1000000); |
|
334 ++loopCount; |
|
335 if(loopCount > 5) |
|
336 { |
|
337 User::Invariant(); |
|
338 } |
|
339 } |
|
340 |
|
341 // remove the drive from the system ini |
|
342 CDictionaryFileStore* store = CDictionaryFileStore::SystemLC(iFs); |
|
343 if (store->IsPresentL(KUidMsvMessageDriveStream)) |
|
344 { |
|
345 store->RemoveL(KUidMsvMessageDriveStream); |
|
346 store->CommitL(); |
|
347 } |
|
348 CleanupStack::PopAndDestroy(); // store |
|
349 |
|
350 CFileMan* fileMan = CFileMan::NewL(iFs); |
|
351 CleanupStack::PushL(fileMan); |
|
352 TParse parse; |
|
353 TInt error; |
|
354 TFileName fileName(KMsvDefaultFolder2); |
|
355 |
|
356 TChar driveChar=FileSession().GetSystemDriveChar(); |
|
357 TBuf<2> systemDrive = iDriveName; |
|
358 |
|
359 parse.Set(fileName, &systemDrive, NULL); |
|
360 error = fileMan->RmDir(parse.DriveAndPath()); |
|
361 error = iFs.RmDir(parse.DriveAndPath()); |
|
362 if (!(error==KErrNotFound||error==KErrNone || error == KErrPathNotFound)) |
|
363 { |
|
364 TPtrC driveAndPath = parse.DriveAndPath(); |
|
365 Printf(_L("Directory %S cannot be removed. "), &driveAndPath); |
|
366 Printf(_L("Please ensure directory is not in use.\n")); |
|
367 User::Leave(KErrAccessDenied); |
|
368 } |
|
369 |
|
370 //delete DBs in C:, D: and E:. |
|
371 TPath pathNameTemp(iDriveName); |
|
372 pathNameTemp.Append(KDbFileName); |
|
373 RSqlDatabase::Delete(pathNameTemp); |
|
374 pathNameTemp = _L("D:"); |
|
375 pathNameTemp.Append(KDbFileName); |
|
376 RSqlDatabase::Delete(pathNameTemp); |
|
377 pathNameTemp = _L("E:"); |
|
378 pathNameTemp.Append(KDbFileName); |
|
379 RSqlDatabase::Delete(pathNameTemp); |
|
380 |
|
381 // delete "StoreInit.tmp" |
|
382 TPath pathName(iDriveName); |
|
383 pathName.Append(KStoreInitFileName); |
|
384 iFs.Delete(pathName); |
|
385 CleanupStack::PopAndDestroy(fileMan); |
|
386 } |
|
387 |
|
388 EXPORT_C void CMsvTestUtils::FindChildrenL(TMsvId aFolderToTraverse, const TFileName& aFilepath, TBool aReplace, TBool aOtherFiles) |
|
389 { |
|
390 SpecifyLogsDir(aFilepath); |
|
391 FindChildrenL(aFolderToTraverse, aReplace, aOtherFiles); |
|
392 } |
|
393 |
|
394 EXPORT_C void CMsvTestUtils::FindChildrenL(TMsvId aFolderToTraverse, TBool aReplace, TBool aOtherFiles) |
|
395 { |
|
396 iFileCount=0; |
|
397 |
|
398 CDir* rfcFileList; |
|
399 // Loads the any test files into an EntryList |
|
400 iFs.GetDir(iRfc822Dir, KEntryAttNormal, ESortByName, rfcFileList); |
|
401 |
|
402 TMsvSelectionOrdering ordering; |
|
403 ordering.SetShowInvisibleEntries(ETrue); |
|
404 |
|
405 TMsvId entryId; |
|
406 if (iClientServer==EClientSide) |
|
407 { |
|
408 entryId=iMsvEntry->Entry().Id(); |
|
409 iMsvEntry->SetEntryL(aFolderToTraverse); |
|
410 iMsvEntry->SetSortTypeL(ordering); |
|
411 } |
|
412 else |
|
413 { |
|
414 entryId=iServerEntry->Entry().Id(); |
|
415 iServerEntry->SetEntry(aFolderToTraverse); |
|
416 iServerEntry->SetSort(ordering); |
|
417 } |
|
418 |
|
419 |
|
420 RFile file; |
|
421 TFileName filename(iLogsDir); |
|
422 filename.Append(KFileNameEntryStructure); |
|
423 |
|
424 // Print out Hierarchy - Save to file |
|
425 |
|
426 if (aReplace) |
|
427 { |
|
428 // replace both Entry_Structure.txt and Entry_RichTextBodies.txt |
|
429 TInt err1 = file.Replace(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite); |
|
430 if (err1==KErrNotFound) // file does not exist - create it |
|
431 err1=file.Create(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite); |
|
432 if (err1 == KErrNone) |
|
433 ListChildrenL(aReplace, aOtherFiles, file, *rfcFileList); |
|
434 } |
|
435 else |
|
436 { |
|
437 TInt err1 = file.Open(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite); |
|
438 if (err1==KErrNotFound) |
|
439 file.Create(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite); |
|
440 else if (err1 != KErrNone) |
|
441 User::Leave(err1); |
|
442 TInt position=1; |
|
443 User::LeaveIfError(file.Seek(ESeekEnd, position)); |
|
444 ListChildrenL(aReplace, aOtherFiles, file, *rfcFileList); |
|
445 } |
|
446 |
|
447 file.Close(); |
|
448 |
|
449 if (iClientServer==EClientSide) |
|
450 iMsvEntry->SetEntryL(entryId); |
|
451 else |
|
452 iServerEntry->SetEntry(entryId); |
|
453 delete rfcFileList; |
|
454 } |
|
455 |
|
456 EXPORT_C void CMsvTestUtils::WriteBodyDataL(TMsvId aId, const TFileName& aFilepath, CMsvStore& fileStore, TBool aReplace) |
|
457 { |
|
458 CParaFormatLayer* paraLayer = CParaFormatLayer::NewL(); |
|
459 CCharFormatLayer* charLayer = CCharFormatLayer::NewL(); |
|
460 CRichText* body = CRichText::NewL(paraLayer,charLayer); |
|
461 |
|
462 fileStore.RestoreBodyTextL(*body); |
|
463 |
|
464 HBufC* pBodyText = HBufC::NewLC(body->DocumentLength()+(body->DocumentLength()/70)+1); |
|
465 TPtr pBody = pBodyText->Des(); |
|
466 body->Extract(pBody, 0); |
|
467 |
|
468 RFile file; |
|
469 TFileName filename(aFilepath); |
|
470 filename.Append(KFileNameBodies); |
|
471 |
|
472 TInt err = KErrNone; |
|
473 if (aReplace) |
|
474 err = file.Replace(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite); |
|
475 else |
|
476 err = file.Open(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite); |
|
477 if(err==KErrNotFound) // file does not exist - create it |
|
478 err=file.Create(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite); |
|
479 |
|
480 TInt offset=0; |
|
481 iRTest(file.Seek(ESeekEnd, offset)==KErrNone); |
|
482 |
|
483 TBuf<100> buf; |
|
484 buf.Zero(); |
|
485 buf.AppendFormat(_L("*** %d *************** RichText Data ***************\n"), aId); |
|
486 buf.AppendFormat(_L("Size >>> %d\n"), body->DocumentLength()); |
|
487 WriteToFileL(file, buf); |
|
488 |
|
489 RemoveRichtextFormating(pBody); |
|
490 WriteToFileL(file, pBody); |
|
491 |
|
492 buf.Zero(); |
|
493 buf.AppendFormat(_L("\n********************* end of Body ***********************\n")); |
|
494 WriteToFileL(file, buf); |
|
495 |
|
496 CleanupStack::PopAndDestroy(); // pBodyText |
|
497 file.Close(); |
|
498 delete paraLayer; |
|
499 delete charLayer; |
|
500 delete body; |
|
501 } |
|
502 |
|
503 EXPORT_C void CMsvTestUtils::WriteFileDataL(TMsvId aId, const TFileName& aFileName, const TFileName& aLogFilepath, TBool aReplace) |
|
504 { |
|
505 TParse dirPath; |
|
506 RFile attach; |
|
507 |
|
508 dirPath.Set(aFileName, NULL, NULL); |
|
509 TInt err = KErrNone; |
|
510 if (attach.Open(iFs, dirPath.FullName(), KEntryAttNormal) != KErrNone) |
|
511 return; // failed to find attachment |
|
512 |
|
513 |
|
514 TFileName filename(aLogFilepath); |
|
515 filename.Append(KFileNameFiles); |
|
516 RFile file; |
|
517 if (aReplace) |
|
518 err = file.Replace(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite); |
|
519 else |
|
520 err = file.Open(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite); |
|
521 if(err==KErrNotFound) // file does not exist - create it |
|
522 err=file.Create(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite); |
|
523 |
|
524 TInt offset=0; |
|
525 __ASSERT_ALWAYS(file.Seek(ESeekEnd, offset)==KErrNone, Panic(KErrGeneral)); |
|
526 |
|
527 TBuf<100> buf; |
|
528 buf.Zero(); |
|
529 buf.AppendFormat(_L("\n*** %d *************** File Data ***************\n"), aId); |
|
530 |
|
531 buf.AppendFormat(_L("Filename >>> ")); |
|
532 WriteToFileL(file, buf); |
|
533 WriteToFileL(file, dirPath.NameAndExt()); |
|
534 WriteToFileL(file,_L("\n")); |
|
535 |
|
536 HBufC8* buffer8 = HBufC8::NewLC(1024); |
|
537 TPtr8 buf8 = buffer8->Des(); |
|
538 do { |
|
539 attach.Read(buf8); |
|
540 WriteToFileL(file, buf8); |
|
541 } while (buf8.Length()); |
|
542 |
|
543 buf.Zero(); |
|
544 buf.AppendFormat(_L("\n********************* end of File ***********************\n")); |
|
545 WriteToFileL(file, buf); |
|
546 |
|
547 |
|
548 CleanupStack::PopAndDestroy(); // buffer8 |
|
549 attach.Close(); |
|
550 file.Close(); |
|
551 } |
|
552 |
|
553 |
|
554 void CMsvTestUtils::ListChildrenL(TBool aReplace, TBool aOtherFiles, RFile& file, CDir& rfcFileList) |
|
555 { |
|
556 TInt count = 0; |
|
557 TInt entryCount = 0; |
|
558 |
|
559 ListChildrenL(file, rfcFileList, count, entryCount, aReplace, aOtherFiles); |
|
560 } |
|
561 |
|
562 EXPORT_C void CMsvTestUtils::SetFolderType(TMsvEntry& entry, TPtrC& type) |
|
563 { |
|
564 |
|
565 if(entry.iType == KUidMsvRootEntry) |
|
566 type.Set(_L("ROOT")); |
|
567 else if(entry.iType == KUidMsvServiceEntry) |
|
568 type.Set(_L("SERVICE")); |
|
569 else if(entry.iType == KUidMsvFolderEntry) |
|
570 type.Set(_L("FOLDER")); |
|
571 else if(entry.iType == KUidMsvMessageEntry) |
|
572 type.Set(_L("MESSAGE")); |
|
573 else if(entry.iType == KUidMsvEmailTextEntry) |
|
574 type.Set(_L("TEXT")); |
|
575 else if(entry.iType == KUidMsvEmailHtmlEntry) |
|
576 type.Set(_L("HTML")); |
|
577 else if(entry.iType == KUidMsvAttachmentEntry) |
|
578 type.Set(_L("ATTACHMENT")); |
|
579 else |
|
580 type.Set(_L("UNKNOWN")); |
|
581 } |
|
582 |
|
583 EXPORT_C void CMsvTestUtils::ListChildrenL(RFile& aFile, CDir& rfcFileList, TInt& aCount, TInt& aEntryCount, TBool aReplace, TBool aOtherFiles) |
|
584 { |
|
585 // Check details of attachments on current context entry |
|
586 |
|
587 // Get list of children IDs |
|
588 CMsvEntrySelection* msvSelection = NULL; |
|
589 |
|
590 TMsvEntry entry; |
|
591 if (iClientServer==EClientSide) |
|
592 { |
|
593 entry = iMsvEntry->Entry(); |
|
594 msvSelection = iMsvEntry->ChildrenL(); |
|
595 } |
|
596 else |
|
597 { |
|
598 entry = iServerEntry->Entry(); |
|
599 msvSelection = new (ELeave) CMsvEntrySelection; |
|
600 iServerEntry->GetChildren(*msvSelection); |
|
601 } |
|
602 CleanupStack::PushL(msvSelection); |
|
603 |
|
604 TInt attachCount = msvSelection->Count(); // For each child .. |
|
605 TPtrC type; |
|
606 SetFolderType(entry, type); |
|
607 |
|
608 TPtrC priority; |
|
609 TMsvPriority temp=entry.Priority(); |
|
610 if(temp==EMsvHighPriority) |
|
611 priority.Set(_L("High ")); |
|
612 else if(temp==EMsvMediumPriority) |
|
613 priority.Set(_L("Medium")); |
|
614 else if(temp==EMsvLowPriority) |
|
615 priority.Set(_L("Low ")); |
|
616 else |
|
617 priority.Set(_L("None ")); |
|
618 |
|
619 TBuf<11> other=_L("------- "); |
|
620 |
|
621 TBuf<6> streams=_L("------"); |
|
622 |
|
623 if ((iClientServer==EClientSide && iMsvEntry->HasStoreL()) || |
|
624 (iClientServer==EServerSide && iServerEntry->HasStoreL())) |
|
625 { |
|
626 CMsvStore* fileStore; |
|
627 fileStore = (iClientServer==EClientSide) ? iMsvEntry->ReadStoreL() : iServerEntry->ReadStoreL(); |
|
628 |
|
629 if(aOtherFiles && fileStore->IsPresentL(KMsvEntryRichTextBody)) |
|
630 { |
|
631 WriteBodyDataL(entry.Id(), iLogsDir, *fileStore, aReplace); |
|
632 streams.Replace(2, 1, _L("B")); |
|
633 } |
|
634 delete fileStore; |
|
635 } |
|
636 |
|
637 if(entry.Attachment()) |
|
638 streams.Replace(3, 1, _L("A")); |
|
639 |
|
640 if (entry.New()) |
|
641 other.Replace(1, 1, _L("N")); |
|
642 if (entry.Unread()) |
|
643 other.Replace(2, 1, _L("U")); |
|
644 if (entry.Complete()) |
|
645 other.Replace(3, 1, _L("C")); |
|
646 |
|
647 TBuf<600> outputLine; |
|
648 |
|
649 // Put details into output string buffer |
|
650 TMsvId current=entry.Id(); |
|
651 if (iClientServer==EClientSide) |
|
652 iMsvEntry->SetEntryL(current); |
|
653 else |
|
654 iServerEntry->SetEntry(current); |
|
655 |
|
656 for(TInt i=0; i<aCount; i++) |
|
657 outputLine.AppendFormat(_L(" ")); |
|
658 |
|
659 outputLine.AppendFormat(TRefByValue<const TDesC>_L("%S, 00%x, Children=%d, Size=%d, Store=%S, P=%S, Other=%S, Det:%S\r\n"), |
|
660 &type, |
|
661 entry.Id(), |
|
662 attachCount, |
|
663 entry.iSize, |
|
664 &streams, |
|
665 &priority, |
|
666 &other, |
|
667 &entry.iDetails); |
|
668 |
|
669 HBufC8* pOutputLine8 = HBufC8::NewLC(outputLine.Length()); |
|
670 pOutputLine8->Des().Copy(outputLine); |
|
671 aFile.Write(pOutputLine8->Des()); |
|
672 CleanupStack::PopAndDestroy(); // pBuf16 |
|
673 |
|
674 for(TInt j=0; j<attachCount; j++) |
|
675 { |
|
676 // Get Context of current message |
|
677 if (iClientServer==EClientSide) |
|
678 iMsvEntry->SetEntryL((*msvSelection)[j]); |
|
679 else |
|
680 iServerEntry->SetEntry((*msvSelection)[j]); |
|
681 |
|
682 aEntryCount++; |
|
683 aCount++; |
|
684 ListChildrenL(aFile, rfcFileList, aCount, aEntryCount, aReplace); |
|
685 aCount--; |
|
686 } |
|
687 |
|
688 CleanupStack::PopAndDestroy(); // msvSelection |
|
689 } |
|
690 |
|
691 |
|
692 EXPORT_C void CMsvTestUtils::CreateAllTestDirectories() |
|
693 { |
|
694 CTestUtils::CreateAllTestDirectories(); |
|
695 |
|
696 iFs.SetSessionPath(iDriveName); |
|
697 |
|
698 if (!iFs.MkDir(KMsvDefaultFolder2)) |
|
699 { |
|
700 Printf(_L("Created mail directory\n")); |
|
701 } |
|
702 |
|
703 if (!iFs.MkDir(KMtmDir)) |
|
704 { |
|
705 Printf(_L("Created mtm directory\n")); |
|
706 } |
|
707 } |
|
708 |
|
709 EXPORT_C void CMsvTestUtils::ConstructL(TUint aFlags) |
|
710 { |
|
711 if (aFlags & ETuKeepLogFile) |
|
712 CTestUtils::ConstructKeepLogFileL(); |
|
713 else |
|
714 CTestUtils::ConstructL(); |
|
715 |
|
716 FileSession().SetSessionPath(iDriveName); |
|
717 |
|
718 if (aFlags & ETuCleanMessageFolder) |
|
719 { |
|
720 Printf(_L("Clean Message Folder\n")); |
|
721 CleanMessageFolderL(); |
|
722 } |
|
723 |
|
724 if (aFlags & ETuCreateTestDirectories) |
|
725 { |
|
726 Printf(_L("Create All Test Directories\n")); |
|
727 CreateAllTestDirectories(); |
|
728 } |
|
729 |
|
730 if (aFlags & ETuDeleteMtmRegistry) |
|
731 { |
|
732 Printf(_L("Delete Mtm Registry\n")); |
|
733 _LIT(KSystemMTMRegister, "\\system\\mtm\\MTM Registry"); |
|
734 TPath pathNameTemp(iDriveName) ; |
|
735 pathNameTemp.Append(KSystemMTMRegister); |
|
736 FileSession().Delete(pathNameTemp); |
|
737 } |
|
738 |
|
739 CreateRegistryObjectAndControlL(); |
|
740 |
|
741 if (aFlags & ETuCreateServerMtmReg) |
|
742 { |
|
743 Printf(_L("Create Server Mtm Regs\n")); |
|
744 CreateServerMtmRegsL(); |
|
745 } |
|
746 |
|
747 if (aFlags & ETuGoClientSide) |
|
748 { |
|
749 Printf(_L("Go Client Side\n")); |
|
750 __ASSERT_ALWAYS(!(aFlags & ETuGoServerSide), Panic(KErrGeneral)); |
|
751 GoClientSideL(); |
|
752 } |
|
753 |
|
754 if (aFlags & ETuGoServerSide) |
|
755 { |
|
756 Printf(_L("Go Server Side\n")); |
|
757 __ASSERT_ALWAYS(!(aFlags & ETuGoClientSide), Panic(KErrGeneral)); |
|
758 GoServerSideL(); |
|
759 } |
|
760 |
|
761 if (aFlags & ETuInstallMtmGroup) |
|
762 { |
|
763 Printf(_L("Install Mtm Groups\n")); |
|
764 InstallMtmGroupsL(); |
|
765 } |
|
766 |
|
767 if (aFlags & ETuDeleteService) |
|
768 { |
|
769 Printf(_L("Delete Existing Services\n")); |
|
770 __ASSERT_ALWAYS(iClientServer, Panic(KErrGeneral)); |
|
771 DeleteServicesL(); |
|
772 } |
|
773 else if (iClientServer) |
|
774 { |
|
775 Printf(_L("Find Existing Services\n")); |
|
776 FindExistingServicesL(); |
|
777 } |
|
778 |
|
779 if (aFlags & ETuCreateService) |
|
780 { |
|
781 Printf(_L("Create Services\n")); |
|
782 __ASSERT_ALWAYS(iClientServer, Panic(KErrGeneral)); |
|
783 CreateServicesL(); |
|
784 } |
|
785 TChar driveChar=RFs::GetSystemDriveChar(); |
|
786 iDriveName.Append(driveChar); |
|
787 iDriveName.Append(KDriveDelimiter); |
|
788 |
|
789 SpecifyLogsDir(KLogsDir); |
|
790 FileSession().SetSessionPath(iDriveName); |
|
791 } |
|
792 |
|
793 EXPORT_C void CMsvTestUtils::ServiceIdL(TUid aMtm, TMsvId& rFirstId, CMsvEntrySelection* rServiceIds) |
|
794 { |
|
795 //Returns the Service IDs of MTM aMtm |
|
796 |
|
797 rFirstId = KMsvNullIndexEntryId; |
|
798 |
|
799 SetEntryL(KMsvRootIndexEntryId); |
|
800 |
|
801 // TMsvSelectionOrdering oldOrder = aEntry.SortType(); |
|
802 TMsvSelectionOrdering order; |
|
803 order.SetShowInvisibleEntries(ETrue); |
|
804 SetSortTypeL(order); |
|
805 |
|
806 //Get the children on the Root Index Entry |
|
807 CMsvEntrySelection* selection = ChildrenWithTypeLC(KUidMsvServiceEntry); |
|
808 |
|
809 TInt count = selection->Count(); |
|
810 |
|
811 //Find an entry for MTM aMtm |
|
812 for (TInt curChild = 0; curChild < count && (rFirstId == KMsvNullIndexEntryId || rServiceIds); curChild++) |
|
813 { |
|
814 SetEntryL(selection->At(curChild)); |
|
815 |
|
816 if (Entry().iMtm == aMtm) |
|
817 { |
|
818 TMsvId id = Entry().Id(); |
|
819 |
|
820 if (rFirstId == KMsvNullIndexEntryId) |
|
821 rFirstId = id; |
|
822 |
|
823 if (rServiceIds) |
|
824 rServiceIds->AppendL(id); |
|
825 } |
|
826 } |
|
827 |
|
828 //Leave if no Service Entry found for MTM aMtm |
|
829 if (rFirstId == KMsvNullIndexEntryId) |
|
830 { |
|
831 CleanupStack::PopAndDestroy(); //selection |
|
832 User::Leave(KErrNotFound); |
|
833 } |
|
834 |
|
835 CleanupStack::PopAndDestroy(); //selection |
|
836 } |
|
837 |
|
838 EXPORT_C void CMsvTestUtils::DeleteServiceL(TUid aMtm) |
|
839 { |
|
840 CMsvEntrySelection* sel = new (ELeave) CMsvEntrySelection(); |
|
841 CleanupStack::PushL(sel); |
|
842 TMsvId firstId = 0; |
|
843 TRAPD(err, ServiceIdL(aMtm, firstId, sel)); |
|
844 |
|
845 if (!err) |
|
846 { |
|
847 TInt count = sel->Count(); |
|
848 |
|
849 while (count--) |
|
850 { |
|
851 TMsvId del = sel->At(count); |
|
852 TRAP(err, SetEntryL(del)); |
|
853 |
|
854 if (!err) |
|
855 { |
|
856 TRAP(err, SetEntryL(Entry().Parent())); |
|
857 |
|
858 if (!err) |
|
859 { |
|
860 TRAP(err, DeleteEntryL(del)); |
|
861 } |
|
862 } |
|
863 |
|
864 if (err) |
|
865 { |
|
866 Printf(_L("Error deleting service entry\n")); |
|
867 } |
|
868 } |
|
869 } |
|
870 |
|
871 CleanupStack::PopAndDestroy(); //sel |
|
872 } |
|
873 |
|
874 EXPORT_C void CMsvTestUtils::SpecifyLogsDir(const TFileName& aFilePath) |
|
875 { |
|
876 iLogsDir.Copy(aFilePath); |
|
877 } |
|
878 |
|
879 EXPORT_C void CMsvTestUtils::SpecifyRfc822Dir(const TFileName& aFilePath) |
|
880 { |
|
881 iRfc822Dir.Copy(aFilePath); |
|
882 } |
|
883 |
|
884 //Returns TMsvEntry.iDate for aEntryId, and the time it is scheduled for on the task scheduler |
|
885 EXPORT_C TInt CMsvTestUtils::ScheduleTime(TMsvId aEntryId, TTime& rEntryTime, TTime& rTaskSchedulerTime, TTaskInfo& rTaskInfo) |
|
886 { |
|
887 TRAPD(err, DoScheduleTimeL(aEntryId, rEntryTime, rTaskSchedulerTime, rTaskInfo)); |
|
888 return err; |
|
889 } |
|
890 |
|
891 void CMsvTestUtils::DoScheduleTimeL(TMsvId aEntryId, TTime& rEntryTime, TTime& rTaskSchedulerTime, TTaskInfo& rTaskInfo) |
|
892 { |
|
893 SetEntryL(aEntryId); |
|
894 rEntryTime = Entry().iDate; |
|
895 |
|
896 CMsvStore* store = ReadStoreL(); |
|
897 CleanupStack::PushL(store); |
|
898 |
|
899 TMsvEntryScheduleData data; |
|
900 data.RestoreL(*store); |
|
901 |
|
902 CleanupStack::PopAndDestroy(); //store |
|
903 |
|
904 if (data.iTaskId == KErrNotFound) |
|
905 User::Leave(KErrNotFound); |
|
906 |
|
907 RScheduler scheduler; |
|
908 User::LeaveIfError(scheduler.Connect()); |
|
909 // Make sure that scheduler connection |
|
910 // is closed if anything fails (and we leave) in this method. |
|
911 CleanupClosePushL(scheduler); |
|
912 |
|
913 TSchedulerItemRef ref; |
|
914 TInt size = 0; |
|
915 |
|
916 User::LeaveIfError(scheduler.GetTaskDataSize(data.iTaskId, size)); |
|
917 |
|
918 HBufC* buf = HBufC::NewLC(size); |
|
919 TPtr ptr = buf->Des(); |
|
920 |
|
921 User::LeaveIfError(scheduler.GetTaskInfoL(data.iTaskId, rTaskInfo, ptr, ref, rTaskSchedulerTime)); |
|
922 |
|
923 CleanupStack::PopAndDestroy(2,&scheduler); //buf,scheduler. |
|
924 } |
|
925 |
|
926 EXPORT_C TInt CMsvTestUtils::AppendScheduleTimeL(TMsvId aEntryId, TDes& rOutput) |
|
927 { |
|
928 TTime entryTime, schTime; |
|
929 TTaskInfo info; |
|
930 TInt err = ScheduleTime(aEntryId, entryTime, schTime, info); |
|
931 |
|
932 if (!err) |
|
933 { |
|
934 TBuf<128> dateString; |
|
935 |
|
936 entryTime.FormatL(dateString, _L("\tEntry: %D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%.%*C4%:3%+B")); |
|
937 rOutput.Append(dateString); |
|
938 |
|
939 schTime.FormatL(dateString, _L("\n\tSched: %D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%.%*C4%:3%+B")); |
|
940 rOutput.Append(dateString); |
|
941 |
|
942 rOutput.AppendFormat(_L(" (taskId %d)\n"), info.iTaskId); |
|
943 } |
|
944 else |
|
945 { |
|
946 rOutput.AppendFormat(_L("\tError %d: Cannot read schedule time for msg %d\n"), err, aEntryId); |
|
947 } |
|
948 |
|
949 return err; |
|
950 } |
|
951 |
|
952 EXPORT_C void CMsvTestUtils::NavigateMessageStoreL(TMsvId aParent) |
|
953 { |
|
954 //Allows the user to navigate through the message store |
|
955 |
|
956 if (iClientServer != EClientSide) |
|
957 return; |
|
958 |
|
959 TInt count = 0; |
|
960 TInt start = 0; |
|
961 |
|
962 while (count < 3) |
|
963 { |
|
964 TInt err = DoNavigateMessageStoreL(aParent, start); |
|
965 |
|
966 if (err == KErrDied) |
|
967 break; |
|
968 else if (err) |
|
969 count++; |
|
970 else |
|
971 count = 0; |
|
972 } |
|
973 } |
|
974 |
|
975 TInt CMsvTestUtils::DoNavigateMessageStoreL(TMsvId& aParent, TInt& aStart) |
|
976 { |
|
977 TMsvSelectionOrdering order; |
|
978 order.SetShowInvisibleEntries(ETrue); |
|
979 CMsvEntry* parent = CMsvEntry::NewL(*iMsvSession, aParent, order); |
|
980 CleanupStack::PushL(parent); |
|
981 |
|
982 iRTest.Printf(KMsvTestUtilsNewLine); |
|
983 TInt more = 0; |
|
984 const TInt KMax = 10; |
|
985 ShowChildrenL(*parent, aStart, more, KMax); |
|
986 iRTest.Printf(KMsvTestUtilsNewLine); |
|
987 |
|
988 iRTest.Printf(_L("Select a message or '.' (for parent) or 'N'ext or 'P'revious or e'X'it\n")); |
|
989 |
|
990 const TInt count = Min(KMax, parent->Count() - aStart); |
|
991 const TChar startChar = '0'; |
|
992 const TChar endChar = startChar + count - 1; |
|
993 const TChar key = iRTest.Getch(); |
|
994 |
|
995 TInt ret = KErrNotFound; |
|
996 |
|
997 if (key >= '0' && key <= endChar) |
|
998 { |
|
999 iRTest.Printf(KMsvTestUtilsNewLine); |
|
1000 |
|
1001 TMsvEntry entry((*parent)[key - startChar + aStart]); |
|
1002 |
|
1003 if (entry.Owner()) |
|
1004 { |
|
1005 aStart = 0; |
|
1006 aParent = entry.Id(); |
|
1007 } |
|
1008 else |
|
1009 { |
|
1010 DisplayChildDetailsL(entry); |
|
1011 } |
|
1012 |
|
1013 ret = KErrNone; |
|
1014 } |
|
1015 else if (key == '.') |
|
1016 { |
|
1017 aStart = 0; |
|
1018 if (aParent != KMsvRootIndexEntryId) |
|
1019 aParent = parent->Entry().Parent(); |
|
1020 |
|
1021 ret = KErrNone; |
|
1022 } |
|
1023 else if (key == 'n' || key == 'N') |
|
1024 { |
|
1025 if (more > 0) |
|
1026 { |
|
1027 aStart += KMax; |
|
1028 } |
|
1029 |
|
1030 ret = KErrNone; |
|
1031 } |
|
1032 else if (key == 'p' || key == 'P') |
|
1033 { |
|
1034 if (aStart > 0) |
|
1035 { |
|
1036 aStart -= KMax; |
|
1037 } |
|
1038 |
|
1039 ret = KErrNone; |
|
1040 } |
|
1041 else if (key == 'x' || key == 'X') |
|
1042 { |
|
1043 ret = KErrDied; |
|
1044 } |
|
1045 |
|
1046 CleanupStack::PopAndDestroy(parent); |
|
1047 return ret; |
|
1048 } |
|
1049 |
|
1050 void CMsvTestUtils::ShowChildrenL(const CMsvEntry& aEntry, TInt aStart, TInt& aMore, TInt aMaxCount) |
|
1051 { |
|
1052 iRTest.Printf(_L("Parent: ")); |
|
1053 |
|
1054 DisplayChildL(aEntry.Entry()); |
|
1055 |
|
1056 iRTest.Printf(KMsvTestUtilsNewLine); |
|
1057 iRTest.Printf(KMsvTestUtilsNewLine); |
|
1058 |
|
1059 if (!aEntry.Entry().Owner()) |
|
1060 return; |
|
1061 |
|
1062 TInt count = aEntry.Count() - aStart; |
|
1063 |
|
1064 if (aMaxCount > 0) |
|
1065 count = Min(count, aMaxCount); |
|
1066 |
|
1067 for (TInt i = aStart; i < count + aStart; i++) |
|
1068 { |
|
1069 TBuf<16> prefix; |
|
1070 prefix.Zero(); |
|
1071 prefix.AppendNum(i - aStart); |
|
1072 prefix.Append(_L(". (")); |
|
1073 prefix.AppendFormat(_L("%2d"), i + 1), |
|
1074 prefix.Append(_L("/")); |
|
1075 prefix.AppendFormat(_L("%2d"), aEntry.Count()), |
|
1076 prefix.Append(_L(")")); |
|
1077 iRTest.Printf(prefix); |
|
1078 DisplayChildL(aEntry[i]); |
|
1079 iRTest.Printf(KMsvTestUtilsNewLine); |
|
1080 } |
|
1081 |
|
1082 aMore = aEntry.Count() - aStart - aMaxCount; |
|
1083 |
|
1084 if (aMore > 0) |
|
1085 iRTest.Printf(_L("...%d more...\n"), aMore); |
|
1086 } |
|
1087 |
|
1088 EXPORT_C void CMsvTestUtils::DisplayChildL(const TMsvEntry& entry) |
|
1089 { |
|
1090 _LIT(KSpace, " "); |
|
1091 _LIT(KQuote, "\""); |
|
1092 HBufC* buf = HBufC::NewLC(entry.iDetails.Length() + entry.iDescription.Length() + 100); |
|
1093 TPtr temp(buf->Des()); |
|
1094 temp.AppendFormat(_L("%7.7d"), entry.Id()); |
|
1095 temp.Append(KSpace); |
|
1096 |
|
1097 switch (entry.iType.iUid) |
|
1098 { |
|
1099 case KUidMsvServiceEntryValue: |
|
1100 temp.Append(_L("Serv")); |
|
1101 break; |
|
1102 case KUidMsvRootEntryValue: |
|
1103 temp.Append(_L("Root")); |
|
1104 break; |
|
1105 case KUidMsvFolderEntryValue: |
|
1106 temp.Append(_L("Fold")); |
|
1107 break; |
|
1108 case KUidMsvMessageEntryValue: |
|
1109 temp.Append(_L("Mesg")); |
|
1110 break; |
|
1111 case KUidMsvAttachmentEntryValue: |
|
1112 temp.Append(_L("Atch")); |
|
1113 break; |
|
1114 default: |
|
1115 temp.Append(_L("Othr")); |
|
1116 break; |
|
1117 } |
|
1118 |
|
1119 temp.Append(KSpace); |
|
1120 temp.Append(KQuote); |
|
1121 temp.Append(entry.iDetails); |
|
1122 temp.Append(KQuote); |
|
1123 temp.Append(_L(" Mtm: ")); |
|
1124 temp.AppendNum((TInt) entry.iMtm.iUid); |
|
1125 temp.Append(_L(" Des: ")); |
|
1126 temp.Append(entry.iDescription.Left(10)); |
|
1127 |
|
1128 iRTest.Printf(temp); |
|
1129 CleanupStack::PopAndDestroy(buf); |
|
1130 } |