|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 */ |
|
16 #include <QtTest/QtTest> |
|
17 #include <QtDebug> |
|
18 #include <QTimer> |
|
19 #include <QSignalSpy> |
|
20 #include <xqconversions.h> |
|
21 #include <bsp.h> |
|
22 #include <biodb.h> |
|
23 #include <biouids.h> |
|
24 #include <biocmtm.h> |
|
25 #include "convergedmessageaddress.h" |
|
26 |
|
27 #include "testunidatamodelvcalplugin.h" |
|
28 #include <unidatamodelloader.h> |
|
29 #include "testunidatamodelvcalplugin.ini" |
|
30 #include "unidatamodelplugininterface.h" |
|
31 #include <convergedmessage.h> |
|
32 |
|
33 const TInt KTelephoneNumberMaxLength = 32; |
|
34 _LIT(KBIOTxtFilePath, "C:\\test\\"); |
|
35 _LIT(KBIOvCalenderPrefix, "vcal*"); |
|
36 // vCalender |
|
37 _LIT(KUnixEpoch, "19700000:000000.000000"); |
|
38 #define KBioUidValue 0x10001262 |
|
39 |
|
40 const TUid KBioUidValueUid = |
|
41 {KBioUidValue}; |
|
42 |
|
43 |
|
44 //factory method to create objects. |
|
45 QObject* getObject(QString className) |
|
46 { |
|
47 if(className == "TestUniDataModelVCalPlugin" ) |
|
48 { |
|
49 return new TestUniDataModelVCalPlugin; |
|
50 } |
|
51 else |
|
52 { |
|
53 return 0; |
|
54 } |
|
55 } |
|
56 |
|
57 //main entry point |
|
58 int main(int argc, char *argv[]) |
|
59 { |
|
60 int ret = -1; |
|
61 QCoreApplication app(argc, argv); |
|
62 |
|
63 //the configuration file. |
|
64 QFile data("c:/TestUniDataModelVCalPlugin.cfg"); |
|
65 if (data.open(QFile::ReadOnly)) |
|
66 { |
|
67 QTextStream in(&data); |
|
68 while(!in.atEnd()) |
|
69 { |
|
70 QString name = in.readLine(); |
|
71 QObject* tc = getObject(name); |
|
72 |
|
73 if(tc) |
|
74 { |
|
75 ret = QTest::qExec(tc, argc, argv); |
|
76 delete tc; |
|
77 } |
|
78 } |
|
79 } |
|
80 return ret; |
|
81 |
|
82 } |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 //--------------------------------------------------------------- |
|
89 // TestUniDataModelVCalPlugin::init |
|
90 //--------------------------------------------------------------- |
|
91 |
|
92 |
|
93 void TestUniDataModelVCalPlugin::initTestCase() |
|
94 { |
|
95 iObserver = new (ELeave) MsgObserver(); |
|
96 |
|
97 // Create a new messaging server session.. |
|
98 iMSession = CMsvSession::OpenSyncL(*iObserver); |
|
99 |
|
100 iMsvEntry = iMSession->GetEntryL(KMsvRootIndexEntryId); |
|
101 newEntryId = 0; |
|
102 pluginLoader = new UniDataModelLoader(); |
|
103 |
|
104 retTimeStamp = QDateTime::currentDateTime(); |
|
105 int err = iFs.Connect(); |
|
106 QVERIFY(err == 0); |
|
107 iBioDb = CBIODatabase::NewL(iFs); |
|
108 iFs.SetSessionPath(_L("c:\\")); |
|
109 inbox = EFalse; |
|
110 drafts = EFalse; |
|
111 } |
|
112 void TestUniDataModelVCalPlugin::cleanupTestCase() |
|
113 { |
|
114 delete iMsvEntry; |
|
115 iMsvEntry = NULL; |
|
116 delete iObserver; |
|
117 iObserver = NULL; |
|
118 delete iMSession; |
|
119 iMSession = NULL; |
|
120 delete pluginLoader; |
|
121 } |
|
122 |
|
123 void TestUniDataModelVCalPlugin::init() |
|
124 { |
|
125 |
|
126 } |
|
127 |
|
128 //--------------------------------------------------------------- |
|
129 // TestUniDataModelVCalPlugin::cleanup |
|
130 //--------------------------------------------------------------- |
|
131 void TestUniDataModelVCalPlugin::cleanup() |
|
132 { |
|
133 |
|
134 |
|
135 } |
|
136 |
|
137 void TestUniDataModelVCalPlugin::testInBoxVCalMessage() |
|
138 { |
|
139 inbox = ETrue; |
|
140 GenerateMessagesL(); |
|
141 |
|
142 pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg); |
|
143 pluginInterface->setMessageId(newEntryId); |
|
144 |
|
145 int count = pluginInterface->attachmentCount(); |
|
146 QVERIFY(count == 1); |
|
147 |
|
148 UniMessageInfoList attachmentlist = pluginInterface->attachmentList(); |
|
149 QVERIFY(!attachmentlist.isEmpty()); |
|
150 |
|
151 UniMessageInfo* att = attachmentlist.at(0); |
|
152 QString path = att->path(); |
|
153 |
|
154 QString recepient(TEST_MSG_FROM1); |
|
155 QString fromaddress; |
|
156 pluginInterface->fromAddress(fromaddress); |
|
157 QVERIFY(recepient == fromaddress); |
|
158 |
|
159 QString body; |
|
160 pluginInterface->body(body); |
|
161 QVERIFY(!body.isEmpty()); |
|
162 |
|
163 // Compare input message , with the read message |
|
164 RFile origFile; |
|
165 int op = origFile.Open(iFs, currentFile, EFileRead); |
|
166 QVERIFY(op == 0); |
|
167 |
|
168 TBuf8<1000> readBuf; |
|
169 HBufC* readBuf16 = HBufC::NewL(2000); |
|
170 |
|
171 origFile.Read(readBuf); |
|
172 readBuf16->Des().Copy(readBuf); |
|
173 |
|
174 QString orig = XQConversions::s60DescToQString(*readBuf16); |
|
175 origFile.Close(); |
|
176 |
|
177 HBufC* filepath = XQConversions::qStringToS60Desc(path); |
|
178 |
|
179 int size = pluginInterface->messageSize(); |
|
180 |
|
181 MsgPriority priority = pluginInterface->messagePriority(); |
|
182 // Normal priority |
|
183 qDebug() << "prority" << priority; |
|
184 QVERIFY(priority == 1); |
|
185 |
|
186 QVERIFY(pluginInterface->timeStamp() == retTimeStamp); |
|
187 |
|
188 ConvergedMessageAddressList recipientList; |
|
189 pluginInterface->toRecipientList(recipientList); |
|
190 QVERIFY(recipientList.count() == 0); |
|
191 qDebug() << "recipientList.count" << recipientList.count(); |
|
192 |
|
193 if (inbox) |
|
194 { |
|
195 iMsvEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId); |
|
196 qDebug() << "SetEntry" ; |
|
197 } |
|
198 |
|
199 |
|
200 } |
|
201 |
|
202 void TestUniDataModelVCalPlugin::testDraftsVCalMessage() |
|
203 { |
|
204 drafts = ETrue; |
|
205 GenerateMessagesL(); |
|
206 |
|
207 pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg); |
|
208 pluginInterface->setMessageId(newEntryId); |
|
209 |
|
210 int count = pluginInterface->attachmentCount(); |
|
211 QVERIFY(count == 1); |
|
212 |
|
213 UniMessageInfoList attachmentlist = pluginInterface->attachmentList(); |
|
214 QVERIFY(!attachmentlist.isEmpty()); |
|
215 |
|
216 UniMessageInfo* att = attachmentlist.at(0); |
|
217 QString path = att->path(); |
|
218 |
|
219 QString fromaddress; |
|
220 pluginInterface->fromAddress(fromaddress); |
|
221 QVERIFY(!fromaddress.isEmpty()); //added ! shweta |
|
222 |
|
223 QString body; |
|
224 pluginInterface->body(body); |
|
225 QVERIFY(!body.isEmpty()); |
|
226 |
|
227 // Compare input message , with the read message |
|
228 RFile origFile; |
|
229 int op = origFile.Open(iFs, currentFile, EFileRead); |
|
230 QVERIFY(op == 0); |
|
231 |
|
232 TBuf8<1000> readBuf; |
|
233 HBufC* readBuf16 = HBufC::NewL(2000); |
|
234 |
|
235 origFile.Read(readBuf); |
|
236 readBuf16->Des().Copy(readBuf); |
|
237 |
|
238 QString orig = XQConversions::s60DescToQString(*readBuf16); |
|
239 origFile.Close(); |
|
240 |
|
241 int size = pluginInterface->messageSize(); |
|
242 |
|
243 MsgPriority priority = pluginInterface->messagePriority(); |
|
244 // Normal priority |
|
245 qDebug() << "prority" << priority; |
|
246 QVERIFY(priority == 1); |
|
247 |
|
248 QVERIFY(pluginInterface->timeStamp() == retTimeStamp); |
|
249 |
|
250 QString recepient(TEST_MSG_FROM1); |
|
251 ConvergedMessageAddressList recipientList; |
|
252 ConvergedMessageAddress alias(recepient); |
|
253 |
|
254 recipientList.append(&alias); |
|
255 pluginInterface->toRecipientList(recipientList); |
|
256 |
|
257 QVERIFY( recipientList.count() != 0 ); |
|
258 qDebug() << "recipientList.count()"<<recipientList.count() ; |
|
259 |
|
260 const QString& copy = recipientList[0]->address(); |
|
261 qDebug() << "copy = "<<recipientList[0]->address(); |
|
262 QVERIFY(recepient == copy); |
|
263 qDebug() << "Receipient Verified"; |
|
264 |
|
265 if (drafts) |
|
266 { |
|
267 iMsvEntry->SetEntryL(KMsvDraftEntryId); |
|
268 qDebug() << "SetEntry" ; |
|
269 } |
|
270 } |
|
271 |
|
272 |
|
273 |
|
274 void TestUniDataModelVCalPlugin::testUnusedAPIs() |
|
275 { |
|
276 pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg); |
|
277 |
|
278 QVERIFY(pluginInterface->objectCount() == 0); |
|
279 |
|
280 UniMessageInfoList objectlist = pluginInterface->objectList(); |
|
281 QVERIFY(objectlist.isEmpty()); |
|
282 |
|
283 QVERIFY(pluginInterface->slideCount() == 0); |
|
284 |
|
285 UniMessageInfoList slidelist = pluginInterface->slideContent(0); |
|
286 QVERIFY(slidelist.isEmpty()); |
|
287 |
|
288 QVERIFY(pluginInterface->hasAttachment() == true ); |
|
289 |
|
290 ConvergedMessageAddressList recipientList; |
|
291 |
|
292 pluginInterface->ccRecipientList(recipientList); |
|
293 QVERIFY(recipientList.count() == 0); |
|
294 |
|
295 pluginInterface->bccRecipientList(recipientList); |
|
296 QVERIFY(recipientList.count() == 0); |
|
297 } |
|
298 |
|
299 CMsvEntrySelection* TestUniDataModelVCalPlugin::GenerateMessagesL() |
|
300 { |
|
301 HBufC* aFileDirectory = KBIOTxtFilePath().AllocL(); |
|
302 TMsvId messageId; |
|
303 TBIOMessageType currentMsgType; |
|
304 |
|
305 CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection(); |
|
306 CleanupStack::PushL(selection); |
|
307 |
|
308 TInt err = iFs.GetDir(aFileDirectory->Des(), |
|
309 KEntryAttMatchMask, |
|
310 ESortByName, |
|
311 iDir); |
|
312 if (err == KErrPathNotFound) |
|
313 { |
|
314 TInt makeDirErr = iFs.MkDirAll(aFileDirectory->Des()); |
|
315 makeDirErr == KErrNone ? User::Leave(KErrNotFound) |
|
316 : User::Leave(makeDirErr); |
|
317 } |
|
318 else if (err != KErrNone) |
|
319 { |
|
320 User::Leave(err); |
|
321 } |
|
322 |
|
323 // Set the session path for the RFs |
|
324 SetSessionPath(aFileDirectory->Des()); |
|
325 if (iDir) |
|
326 { |
|
327 delete iDir; |
|
328 iDir = NULL; |
|
329 } |
|
330 |
|
331 User::LeaveIfError(iFs.GetDir(_L("*.txt"), KEntryAttNormal, ESortByName, iDir)); |
|
332 TInt count = iDir->Count(); |
|
333 if (count == 0) |
|
334 { |
|
335 User::Leave(KErrNotFound); // No files to process |
|
336 } |
|
337 |
|
338 TBuf<60> outputBuf; |
|
339 |
|
340 for (TInt loop = 0; loop < count; loop++) |
|
341 { |
|
342 TEntry as = (*iDir)[0]; |
|
343 currentFile = (as.iName); |
|
344 // Not processed all the messages - so keep the current state |
|
345 iFilesProcessed++; // Here because need to update the counter promptly |
|
346 currentMsgType = SetMessageType(currentFile); |
|
347 if (currentMsgType != ENoMessage) // skip any dodgy filenames |
|
348 { |
|
349 messageId = CreateBIOEntryFromFileL(currentFile, currentMsgType); |
|
350 selection->AppendL(messageId); |
|
351 TPtrC tempPtr = (currentFile.Des()); |
|
352 |
|
353 } |
|
354 } |
|
355 CleanupStack::Pop(); // selection |
|
356 |
|
357 return selection; |
|
358 } |
|
359 |
|
360 TBIOMessageType TestUniDataModelVCalPlugin::SetMessageType( |
|
361 const TDesC& aFileName) |
|
362 { |
|
363 |
|
364 if (aFileName.MatchF(KBIOvCalenderPrefix) == 0) |
|
365 { |
|
366 return EBiovCalenderMessage; |
|
367 } |
|
368 |
|
369 return ENoMessage; |
|
370 } |
|
371 |
|
372 TMsvId TestUniDataModelVCalPlugin::CreateBIOEntryFromFileL( |
|
373 const TDesC& aFilename, |
|
374 TBIOMessageType aMessageType) |
|
375 { |
|
376 //First use the filename to get the message body, |
|
377 // then convert '\n' to the paragraph delimiters used in proper SMS |
|
378 HBufC* tempBuffer; |
|
379 |
|
380 tempBuffer = ReadFromFileL(aFilename); |
|
381 CleanupStack::PushL(tempBuffer); |
|
382 |
|
383 newEntryId = CreateBIOEntryL(*tempBuffer, aMessageType); |
|
384 |
|
385 // Finished with our local descriptors - free up some memory |
|
386 CleanupStack::PopAndDestroy(); |
|
387 |
|
388 return newEntryId; |
|
389 } |
|
390 |
|
391 void TestUniDataModelVCalPlugin::SetSessionPath(const TDesC& aSessionPath) |
|
392 { |
|
393 iFs.SetSessionPath(aSessionPath); |
|
394 } |
|
395 |
|
396 HBufC* TestUniDataModelVCalPlugin::ReadFromFileL(const TDesC& aFile) |
|
397 { |
|
398 RFile file; |
|
399 TBuf8<1024> lineBuffer; |
|
400 TInt err = KErrNone; |
|
401 |
|
402 err = file.Open(iFs, aFile, EFileStreamText | EFileRead | EFileShareAny); |
|
403 |
|
404 if (err != KErrNone) // Didn't find the file, so leave - should only get valid filenames! |
|
405 { |
|
406 User::Leave(KErrNotFound); |
|
407 } |
|
408 |
|
409 HBufC* bioBuf = HBufC::NewLC(65535); // Create a new descriptor on the heap. |
|
410 HBufC* copyBuffer = HBufC::NewLC(1024); |
|
411 |
|
412 do // Read in the text from file, and also check if there is a name field: |
|
413 { |
|
414 err = file.Read(lineBuffer);// Read upto 256 chars, '\n' and all... |
|
415 //err = ReadLineL(file,lineBuffer); |
|
416 if (err == KErrNone) // Made a valid read, |
|
417 if (lineBuffer.Length() == 0) // but read 0 chars |
|
418 err = KErrEof; // so set err value to end processing |
|
419 |
|
420 if (err == KErrNone) |
|
421 { |
|
422 copyBuffer->Des().Copy(lineBuffer);// Copy, and overwrite existing text |
|
423 if ( (bioBuf->Length() + copyBuffer->Length()) |
|
424 > bioBuf->Des().MaxLength()) |
|
425 { |
|
426 bioBuf = bioBuf->ReAllocL(bioBuf->Length() |
|
427 + copyBuffer->Length()); |
|
428 } |
|
429 bioBuf->Des().Append(*copyBuffer); |
|
430 //bioBuf->Des().Append(_L("\n")); |
|
431 } |
|
432 }while (err != KErrEof); |
|
433 |
|
434 CleanupStack::PopAndDestroy(); // Destroy the copyBuffer. |
|
435 CleanupStack::Pop();// Remove the bioBuf. |
|
436 |
|
437 file.Close(); |
|
438 return bioBuf; |
|
439 } |
|
440 |
|
441 TMsvId TestUniDataModelVCalPlugin::CreateBIOEntryL(TDesC& aText, |
|
442 TBIOMessageType aMessageType) |
|
443 { |
|
444 // Ensure that we have a valid service ID to work with: |
|
445 TMsvId iBioServiceId; |
|
446 |
|
447 iBioServiceId = SetBIOServiceIdL(); |
|
448 |
|
449 HBufC* localBuffer = aText.AllocL(); |
|
450 CleanupStack::PushL(localBuffer); |
|
451 |
|
452 TPtr messDes = localBuffer->Des(); |
|
453 |
|
454 if (aMessageType != EBiovCardMessage && aMessageType |
|
455 != EBiovCalenderMessage) |
|
456 { |
|
457 // convert \r\n to \n since this is what is expected from SMS when not vCard data |
|
458 for (TInt i = 0; i < messDes.Length(); i++) |
|
459 { |
|
460 if (messDes[i] == (TText) '\r' && i < messDes.Length() - 1 |
|
461 && messDes[i + 1] == (TText) '\n') |
|
462 messDes.Delete(i, 1); |
|
463 } |
|
464 } |
|
465 |
|
466 // Create and fill a CRichText object for the jobbie: |
|
467 CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL(); |
|
468 CleanupStack::PushL(paraFormatLayer); |
|
469 CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL(); |
|
470 CleanupStack::PushL(charFormatLayer); |
|
471 CRichText* richText = CRichText::NewL(paraFormatLayer, charFormatLayer); |
|
472 CleanupStack::PushL(richText); |
|
473 |
|
474 TInt pos = richText->DocumentLength(); |
|
475 richText->InsertL(pos, messDes); |
|
476 |
|
477 TMsvEntry newBioEntry; |
|
478 newBioEntry.SetNew(ETrue); |
|
479 newBioEntry.SetComplete(EFalse); |
|
480 newBioEntry.SetUnread(ETrue); |
|
481 newBioEntry.SetVisible(ETrue); |
|
482 newBioEntry.SetReadOnly(EFalse); |
|
483 newBioEntry.SetFailed(EFalse); |
|
484 newBioEntry.SetOperation(EFalse); |
|
485 newBioEntry.SetMultipleRecipients(EFalse); |
|
486 newBioEntry.SetAttachment(EFalse); |
|
487 newBioEntry.iMtm = KUidBIOMessageTypeMtm; |
|
488 newBioEntry.iType = KUidMsvMessageEntry; |
|
489 newBioEntry.iServiceId = iBioServiceId; |
|
490 TTime now; |
|
491 now.UniversalTime(); |
|
492 newBioEntry.iDate = now; |
|
493 |
|
494 TTime unixEpoch(KUnixEpoch); |
|
495 TTimeIntervalSeconds seconds; |
|
496 TTime timeStamp = newBioEntry.iDate; |
|
497 timeStamp.SecondsFrom(unixEpoch, seconds); |
|
498 retTimeStamp.setTime_t(seconds.Int()); |
|
499 |
|
500 newBioEntry.iDescription.Set(richText->Read(0, richText->DocumentLength())); |
|
501 TBufC<KTelephoneNumberMaxLength> telNumber; |
|
502 |
|
503 QString recepient(TEST_MSG_FROM1); |
|
504 tempNumber = XQConversions::qStringToS60Desc(recepient); |
|
505 |
|
506 telNumber = tempNumber->Des(); |
|
507 newBioEntry.iDetails.Set(telNumber); |
|
508 |
|
509 SetForMtmTypeL(newBioEntry, aMessageType); |
|
510 |
|
511 newBioEntry.iSize = richText->DocumentLength();// msgSize; |
|
512 CreateBioEntryClientSideL(newBioEntry, *richText); |
|
513 |
|
514 CleanupStack::PopAndDestroy(4); // richText, charFormatLayer, paraFormatLayer, localBuffer |
|
515 return newBioEntry.Id(); |
|
516 } |
|
517 |
|
518 void TestUniDataModelVCalPlugin::CreateBioEntryClientSideL(TMsvEntry& aEntry, |
|
519 CRichText& aBody) |
|
520 { |
|
521 if (inbox) |
|
522 { |
|
523 iMsvEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId); |
|
524 } |
|
525 else if (drafts) |
|
526 { |
|
527 iMsvEntry->SetEntryL(KMsvDraftEntryId); |
|
528 } |
|
529 // Get the global inbox. |
|
530 |
|
531 iMsvEntry->CreateL(aEntry); |
|
532 iMsvEntry->SetEntryL(aEntry.Id()); |
|
533 |
|
534 // Save all the changes |
|
535 CMsvStore* store = iMsvEntry->EditStoreL(); |
|
536 CleanupStack::PushL(store); |
|
537 |
|
538 if (store->HasBodyTextL()) |
|
539 { |
|
540 store->DeleteBodyTextL(); |
|
541 } |
|
542 |
|
543 CPlainText* pText = CPlainText::NewL(); |
|
544 CleanupStack::PushL(pText); |
|
545 |
|
546 if (inbox) |
|
547 { |
|
548 CSmsHeader* smsHeader = CSmsHeader::NewL(CSmsPDU::ESmsDeliver, *pText); |
|
549 CleanupStack::PushL(smsHeader); |
|
550 smsHeader->SetFromAddressL(*tempNumber); |
|
551 smsHeader->StoreL(*store); |
|
552 |
|
553 } |
|
554 else if (drafts) |
|
555 { |
|
556 |
|
557 QString recepient(TEST_MSG_FROM1); |
|
558 QString recepient2(TEST_MSG_FROM2); |
|
559 QString alias(TEST_MSG_ALIAS1); |
|
560 |
|
561 HBufC* addr = XQConversions::qStringToS60Desc(recepient); |
|
562 HBufC* addr2 = XQConversions::qStringToS60Desc(recepient2); |
|
563 HBufC* alias1 = XQConversions::qStringToS60Desc(alias); |
|
564 |
|
565 CSmsHeader* smsHeader = CSmsHeader::NewL(CSmsPDU::ESmsSubmit, *pText); |
|
566 CleanupStack::PushL(smsHeader); |
|
567 |
|
568 CSmsNumber* number1 = CSmsNumber::NewL(); // create the instance |
|
569 CleanupStack::PushL(number1); |
|
570 |
|
571 number1->SetNameL(TPtrC()); |
|
572 number1->SetAddressL(*addr); |
|
573 smsHeader->Recipients().AppendL(number1); |
|
574 CleanupStack::Pop(number1); |
|
575 |
|
576 CSmsNumber* number2 = CSmsNumber::NewL(); |
|
577 CleanupStack::PushL(number2); |
|
578 |
|
579 number2->SetNameL(*alias1); |
|
580 number2->SetAddressL(*addr2); |
|
581 |
|
582 smsHeader->Recipients().AppendL(number2); |
|
583 CleanupStack::Pop(number2); |
|
584 smsHeader->StoreL(*store); |
|
585 |
|
586 } |
|
587 |
|
588 store->StoreBodyTextL(aBody); |
|
589 store->CommitL(); |
|
590 |
|
591 CleanupStack::PopAndDestroy(3); //store - close the store |
|
592 |
|
593 aEntry.SetComplete(ETrue); |
|
594 // Update the entry |
|
595 iMsvEntry->ChangeL(aEntry); |
|
596 iMsvEntry->SetEntryL(KMsvRootIndexEntryId); |
|
597 } |
|
598 |
|
599 TMsvId TestUniDataModelVCalPlugin::SetBIOServiceIdL() |
|
600 { |
|
601 // Haven't found an entry so create a BIO Message service: |
|
602 TMsvEntry bioServiceEntry; |
|
603 bioServiceEntry.iMtm = KUidBIOMessageTypeMtm; |
|
604 bioServiceEntry.iType = KUidMsvServiceEntry; |
|
605 bioServiceEntry.SetVisible(EFalse); |
|
606 bioServiceEntry.iDate.UniversalTime(); |
|
607 bioServiceEntry.iDescription.Set(_L("BIO Message Service ")); // Is there such a thing? |
|
608 bioServiceEntry.iDetails.Set(_L("BIO Message Service")); |
|
609 |
|
610 TMsvId newBIOServiceId; |
|
611 |
|
612 iMsvEntry->SetEntryL(KMsvRootIndexEntryId); |
|
613 iMsvEntry->CreateL(bioServiceEntry); // Needs to be a child of the root! |
|
614 newBIOServiceId = bioServiceEntry.Id(); |
|
615 |
|
616 return newBIOServiceId; |
|
617 } |
|
618 |
|
619 void TestUniDataModelVCalPlugin::SetForMtmTypeL(TMsvEntry& aEntry, |
|
620 TBIOMessageType aType) |
|
621 { |
|
622 TInt index; |
|
623 |
|
624 aEntry.iBioType = KUidBIOVCalenderMsg; |
|
625 |
|
626 // Set other TMsvEntry fields if we have a BIO message type |
|
627 if (aType != ENoMessage) |
|
628 { |
|
629 aEntry.SetMtmData2(0); |
|
630 aEntry.SetMtmData3(0); |
|
631 } |
|
632 |
|
633 // set description from BIF file |
|
634 iBioDb->GetBioIndexWithMsgIDL(TUid::Uid(aEntry.iBioType), index); |
|
635 if (index == KErrNotFound) |
|
636 User::Leave(KErrNotFound); |
|
637 aEntry.iDescription.Set(iBioDb->BifReader(index).Description()); |
|
638 } |
|
639 |
|
640 void MsgObserver::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, |
|
641 TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) |
|
642 { |
|
643 } |