|
1 // Copyright (c) 2005-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 test aims to test embedding feature of the application. |
|
15 // It work together with uiktestserver framework as part of the chain: |
|
16 // Testexecute.exe -> tpackagestarter.dll -> tpackage.app -> tembed.app |
|
17 // Tpackage communicates with tpackagestarter.dll via client-server architecture. |
|
18 // Client passes to server 3 parameters, packed in structure: |
|
19 // first is message to log, second is filename, third - the number of line. |
|
20 // To test embedding technology tpackage embeds application, tembed, |
|
21 // inside its instance and provide consequences of acts as follow: inserting object, |
|
22 // editing object, closing, deleting object. |
|
23 // To provide logging test information tpackage client send log buffer to the |
|
24 // server using the message EMessageServSetFromString for an Info message and |
|
25 // EMessageServSetErrorFromString for an error message. |
|
26 // Those two messages can be sent via funcions SetFromString and SetErrorFromString. |
|
27 // After a consequence is completed, the EmessageServStop message will be sent, |
|
28 // that causes closing client-server session and the tpackagestarter test step itself. |
|
29 // |
|
30 // |
|
31 |
|
32 /** |
|
33 @file |
|
34 @internalComponent - Internal Symbian test code |
|
35 */ |
|
36 |
|
37 |
|
38 #include <eikenv.h> |
|
39 #include <coecntrl.h> |
|
40 #include <basched.h> |
|
41 #include <coeccntx.h> |
|
42 #include <eikappui.h> |
|
43 #include <e32keys.h> |
|
44 #include <eikembal.h> |
|
45 #include <bamdesca.h> |
|
46 #include <techview/eikon.hrh> |
|
47 #include <techview/eikdialg.h> |
|
48 #include <techview/eikchlst.h> |
|
49 #include <eikdoc.h> |
|
50 #include <eikapp.h> |
|
51 #include <s32file.h> |
|
52 #include <techview/eikprtpv.h> |
|
53 #include <eikproc.h> |
|
54 #include <techview/eikon.rsg> |
|
55 #include <techview/eikmisdg.h> |
|
56 #include "messageservclient.h" |
|
57 |
|
58 #include <eikstart.h> |
|
59 |
|
60 #include "tpackage.rsg" |
|
61 #include "TPACKAGE.HRH" |
|
62 |
|
63 |
|
64 #include "appfwk_test_AppUi.h" |
|
65 |
|
66 #include "TEMBED.h" |
|
67 |
|
68 #include "messageservserver.h" |
|
69 |
|
70 |
|
71 #define FORCE_AUTO |
|
72 |
|
73 _LIT(KTestText, "ABCDEF"); |
|
74 |
|
75 const TUid KUidPackagerApp={0x10207F6E}; |
|
76 |
|
77 struct SPackage |
|
78 { |
|
79 public: |
|
80 TBuf<20> iPrompt; |
|
81 CApaDocument* iDocument; |
|
82 }; |
|
83 |
|
84 // |
|
85 // CPackagerModel |
|
86 // |
|
87 class CPackagerModel : public CArrayFixFlat<SPackage> |
|
88 { |
|
89 public: |
|
90 CPackagerModel(CApaProcess* aProcess); |
|
91 ~CPackagerModel(); |
|
92 void AppendDocL(CApaDocument* aDoc); |
|
93 void DeleteDoc(TInt aPos); |
|
94 private: |
|
95 CApaProcess* iProcess; |
|
96 }; |
|
97 |
|
98 CPackagerModel::CPackagerModel(CApaProcess* aProcess) |
|
99 : CArrayFixFlat<SPackage> (2) |
|
100 { |
|
101 iProcess=aProcess; |
|
102 } |
|
103 |
|
104 CPackagerModel::~CPackagerModel() |
|
105 { |
|
106 const TInt count=Count(); |
|
107 for (TInt pos=0; pos<count; pos++) |
|
108 iProcess->DestroyDocument((*this)[pos].iDocument); |
|
109 } |
|
110 |
|
111 void CPackagerModel::AppendDocL(CApaDocument* aDoc) |
|
112 { |
|
113 SPackage package; |
|
114 package.iDocument=aDoc; |
|
115 TRAPD(err,AppendL(package)); |
|
116 if (err) |
|
117 { |
|
118 iProcess->DestroyDocument(aDoc); |
|
119 User::Leave(err); |
|
120 } |
|
121 } |
|
122 |
|
123 void CPackagerModel::DeleteDoc(TInt aPos) |
|
124 { |
|
125 CApaDocument* doc=(*this)[aPos].iDocument; |
|
126 iProcess->DestroyDocument(doc); |
|
127 Delete(aPos); |
|
128 } |
|
129 |
|
130 // |
|
131 // CPackagerContainer |
|
132 // |
|
133 |
|
134 class CPackagerContainer : public CCoeControl, public MCoeControlBrushContext |
|
135 { |
|
136 public: |
|
137 void ConstructL(const TRect& aRect); |
|
138 ~CPackagerContainer(); |
|
139 private: // framework |
|
140 void Draw(const TRect& aRect) const; |
|
141 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
142 void SizeChanged(); |
|
143 void FocusChanged(TDrawNow aDrawNow); |
|
144 private: |
|
145 }; |
|
146 |
|
147 void CPackagerContainer::FocusChanged(TDrawNow /*aDrawNow*/) |
|
148 { |
|
149 } |
|
150 |
|
151 void CPackagerContainer::ConstructL(const TRect& aRect) |
|
152 { |
|
153 CreateWindowL(); |
|
154 Window().SetShadowDisabled(ETrue); |
|
155 EnableDragEvents(); |
|
156 iBrushStyle=CGraphicsContext::ESolidBrush; |
|
157 iBrushColor=KRgb1in4DitheredGray; |
|
158 iContext=this; |
|
159 Window().SetBackgroundColor(KRgb1in4DitheredGray); |
|
160 SetRect(aRect); |
|
161 ActivateL(); |
|
162 } |
|
163 |
|
164 CPackagerContainer::~CPackagerContainer() |
|
165 { |
|
166 } |
|
167 |
|
168 void CPackagerContainer::Draw(const TRect& aRect) const |
|
169 { |
|
170 CGraphicsContext& gc=SystemGc(); |
|
171 gc.SetPenStyle(CGraphicsContext::ENullPen); |
|
172 gc.DrawRect(aRect); |
|
173 } |
|
174 |
|
175 void CPackagerContainer::SizeChanged() |
|
176 { |
|
177 } |
|
178 |
|
179 TKeyResponse CPackagerContainer::OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/) |
|
180 { |
|
181 return(EKeyWasConsumed); |
|
182 } |
|
183 |
|
184 // |
|
185 // CPackagerDocument - definition |
|
186 // |
|
187 |
|
188 class CPackagerDocument : public CEikDocument |
|
189 { |
|
190 public: |
|
191 CPackagerDocument(CEikApplication& aApp): CEikDocument(aApp), iModel(Process()) { } |
|
192 CPackagerModel* Model() { return(&iModel); } |
|
193 private: // from CEikDocument |
|
194 CEikAppUi* CreateAppUiL(); |
|
195 private: // from CApaDocument |
|
196 void StoreL(CStreamStore& aStore,CStreamDictionary& aStreamDic) const; |
|
197 void RestoreL(const CStreamStore& aStore,const CStreamDictionary& aStreamDic); |
|
198 private: |
|
199 CPackagerModel iModel; |
|
200 }; |
|
201 |
|
202 |
|
203 |
|
204 // |
|
205 // CPackagerAppUi |
|
206 // |
|
207 |
|
208 class CPackagerAppUi : public CTestAppUi |
|
209 { |
|
210 public: |
|
211 CPackagerAppUi() : |
|
212 CTestAppUi(NULL, KNullDesC) |
|
213 { |
|
214 iTestText.Set(KTestText); |
|
215 } |
|
216 void ConstructL(); |
|
217 ~CPackagerAppUi(); |
|
218 RMessageServ* iServ; |
|
219 void SetFromString(const TDesC& aString, const TText8* aString1, TInt aLineNumber); |
|
220 void SetErrorFromString(const TDesC& aString, const TText8* aString1, TInt aLineNumber, TInt aErr); |
|
221 |
|
222 private: // from CEikAppUi |
|
223 void HandleCommandL(TInt aCommand); |
|
224 private: // internal functions |
|
225 void CmdInsertObjectL(); |
|
226 void CmdEditObjectL(); |
|
227 void CmdDeleteObjectL(); |
|
228 TInt SelectDocumentL(TInt aHelpRid,TInt aTitleRid); |
|
229 void RunTestStepL(TInt aNumStep); |
|
230 void SendKeyEventToApplicationL(TKeyEvent theKeyEvent); |
|
231 TInt FindIndex(CEikEmbeddableAppList* aList, TInt* aDestIndex); |
|
232 void TestEmbeddableAppListL(); |
|
233 private: |
|
234 CPackagerContainer* iContainer; |
|
235 CPackagerModel* iModel; |
|
236 TPtrC iTestText; |
|
237 |
|
238 }; |
|
239 |
|
240 |
|
241 void CPackagerAppUi::ConstructL() |
|
242 { |
|
243 iModel=((CPackagerDocument*)iDocument)->Model(); |
|
244 //BaseConstructL(); |
|
245 CTestAppUi::ConstructL(); |
|
246 |
|
247 iContainer=new(ELeave) CPackagerContainer; |
|
248 iContainer->ConstructL(ClientRect()); |
|
249 AddToStackL(iContainer); |
|
250 |
|
251 iServ = new RMessageServ; |
|
252 TInt theRes = iServ->Connect(); |
|
253 if(theRes != KErrNone) |
|
254 { |
|
255 delete iServ; |
|
256 iServ = NULL; |
|
257 } |
|
258 |
|
259 AutoTestManager().StartAutoTest(); |
|
260 } |
|
261 |
|
262 CPackagerAppUi::~CPackagerAppUi() |
|
263 { |
|
264 RemoveFromStack(iContainer); |
|
265 delete iContainer; |
|
266 |
|
267 if(iServ) |
|
268 { |
|
269 iServ->Stop(); |
|
270 iServ->Close(); |
|
271 } |
|
272 delete iServ; |
|
273 } |
|
274 |
|
275 void CPackagerAppUi::HandleCommandL(TInt aCommand) |
|
276 { |
|
277 switch (aCommand) |
|
278 { |
|
279 case EEikCmdExit: |
|
280 SaveAnyChangesL(); |
|
281 Exit(); |
|
282 break; |
|
283 case ETPackagerCmdInsertObject: |
|
284 CmdInsertObjectL(); |
|
285 break; |
|
286 case ETPackagerCmdEditObject: |
|
287 CmdEditObjectL(); |
|
288 break; |
|
289 case ETPackagerCmdDeleteObject: |
|
290 CmdDeleteObjectL(); |
|
291 break; |
|
292 } |
|
293 } |
|
294 |
|
295 TInt CPackagerAppUi::SelectDocumentL(TInt aHelpRid,TInt /*aTitleRid*/) |
|
296 { |
|
297 const TInt max=iModel->Count(); |
|
298 if (!max) |
|
299 { |
|
300 TBuf<20> tmp; |
|
301 iCoeEnv->ReadResource(tmp,aHelpRid); |
|
302 iEikonEnv->LeaveWithInfoMsg(R_TPCK_TBUF_NO_OBJECTS_TO_XXX,&tmp); |
|
303 } |
|
304 TInt pos=1; |
|
305 //if (max>1) |
|
306 // { |
|
307 // if (CEikNumDialog::RunDlgLD(pos,1,max,aTitleRid,R_TPCK_TBUF_DLG_PROMPT)) |
|
308 // CBaActiveScheduler::LeaveNoAlert(); |
|
309 // } |
|
310 return(pos-1); |
|
311 } |
|
312 |
|
313 void CPackagerAppUi::CmdEditObjectL() |
|
314 { |
|
315 TInt pos=SelectDocumentL(R_TPCK_TBUF_EDIT,R_TPCK_TBUF_EDIT_DLG_TITLE); |
|
316 CDocument* doc=(CDocument*) ((*iModel)[pos].iDocument); |
|
317 |
|
318 if(doc->iBuf.Compare(iTestText) == 0) |
|
319 { |
|
320 ((CEikDocument*)doc)->EditL(NULL); |
|
321 } |
|
322 else |
|
323 {//this is the error |
|
324 |
|
325 } |
|
326 |
|
327 |
|
328 |
|
329 } |
|
330 |
|
331 void CPackagerAppUi::CmdDeleteObjectL() |
|
332 { |
|
333 TInt pos=SelectDocumentL(R_TPCK_TBUF_DELETE,R_TPCK_TBUF_DELETE_DLG_TITLE); |
|
334 iModel->DeleteDoc(pos); |
|
335 } |
|
336 |
|
337 |
|
338 TInt CPackagerAppUi::FindIndex(CEikEmbeddableAppList* aList, TInt* aDestIndex) |
|
339 { |
|
340 TInt theNumElem = aList->Count(); |
|
341 |
|
342 RDebug::Print(_L("Number elements in embeded list : %d\n"), theNumElem); |
|
343 |
|
344 for(TInt theIndex = 0; theIndex < theNumElem; theIndex++) |
|
345 { |
|
346 TApaAppInfo& appInfo = (*aList)[theIndex]; |
|
347 RDebug::Print(_L("Element number %d : %S\n"), theIndex, &appInfo.iFullName); |
|
348 if(appInfo.iFullName.FindF(_L("embed")) >= 0) |
|
349 { |
|
350 |
|
351 TBuf<128> buf; |
|
352 buf.Format(_L("Element embed has been found with index : %d\n"), theIndex); |
|
353 SetFromString(buf, ((TText8*)__FILE__), __LINE__); |
|
354 |
|
355 //RDebug::Print(_L("Element embed has been found with index : %d\n"), theIndex); |
|
356 *aDestIndex = theIndex; |
|
357 return KErrNone; |
|
358 } |
|
359 } |
|
360 |
|
361 return KErrNotFound; |
|
362 } |
|
363 |
|
364 void CPackagerAppUi::CmdInsertObjectL() |
|
365 { |
|
366 CEikEmbeddableAppList* list=new(ELeave) CEikEmbeddableAppList; |
|
367 CleanupStack::PushL(list); |
|
368 |
|
369 // sleep for 5 sec to give apparc time to initialise properly |
|
370 User::After(5000000); |
|
371 |
|
372 list->ConstructL(); |
|
373 TInt count=list->Count(); |
|
374 if (!count) |
|
375 iEikonEnv->InfoMsg(R_TPCK_TBUF_NO_EMBEDDABLE_APPS_FOUND); |
|
376 else |
|
377 { |
|
378 TInt choice=0; |
|
379 RDebug::Print(_L("Find index in list\n")); |
|
380 TInt theErr = FindIndex(list, &choice); |
|
381 if(theErr == KErrNone) |
|
382 { |
|
383 RDebug::Print(_L("Creating the embeded document\n")); |
|
384 CEikDocument* newDoc=list->CreateEmbeddedDocumentL(choice,iEikonEnv->Process()); |
|
385 iModel->AppendDocL(newDoc); |
|
386 newDoc->EditL(NULL); |
|
387 } |
|
388 } |
|
389 CleanupStack::PopAndDestroy(); // list |
|
390 } |
|
391 |
|
392 |
|
393 void CPackagerAppUi::SetFromString(const TDesC& aString, const TText8* aString1, TInt aLineNumber) |
|
394 { |
|
395 if(iServ) |
|
396 { |
|
397 iServ->SetFromString(aString, aString1, aLineNumber); |
|
398 } |
|
399 } |
|
400 |
|
401 void CPackagerAppUi::SetErrorFromString(const TDesC& aString, const TText8* aString1, |
|
402 TInt aLineNumber, TInt aErr) |
|
403 { |
|
404 if(iServ) |
|
405 { |
|
406 iServ->SetErrorFromString(aString, aString1, aLineNumber, aErr); |
|
407 } |
|
408 } |
|
409 |
|
410 void CPackagerAppUi::RunTestStepL(TInt aNumStep) |
|
411 { |
|
412 TKeyEvent theKeyEvent; |
|
413 Mem::FillZ(&theKeyEvent, sizeof(TKeyEvent)); |
|
414 TBuf<128> buf; |
|
415 |
|
416 //only for debug |
|
417 #ifdef FORCE_AUTO |
|
418 User::After(TTimeIntervalMicroSeconds32(1000000)); |
|
419 #endif |
|
420 switch(aNumStep) |
|
421 { |
|
422 case 1: |
|
423 { |
|
424 RDebug::Print(_L("Insert the object\n")); |
|
425 buf.Copy(_L("Insert the holy object\n")); |
|
426 SetFromString(buf, ((TText8*)__FILE__), __LINE__); |
|
427 TRAPD(res, CmdInsertObjectL()); |
|
428 if(res == KErrGeneral) |
|
429 { |
|
430 //RDebug::Print(_L("Error during inserting object : %d\n"), res); |
|
431 buf.Format(_L("Error during inserting object : %d\n"), res); |
|
432 SetFromString(buf, ((TText8*)__FILE__), __LINE__); |
|
433 |
|
434 |
|
435 RDebug::Print(_L("Try insert object again\n")); |
|
436 TRAP(res, CmdInsertObjectL()); |
|
437 } |
|
438 if(res != KErrNone) |
|
439 { |
|
440 buf.Format(_L("Error during inserting object : %d\n"), res); |
|
441 SetErrorFromString(buf, ((TText8*)__FILE__), __LINE__, res); |
|
442 AutoTestManager().FinishAllTestCases(CAutoTestManager::EFailed); |
|
443 } |
|
444 break; |
|
445 } |
|
446 case 2: |
|
447 { |
|
448 //test.Next(_L("Type chars")); |
|
449 SetFromString(_L("Type chars\n"), ((TText8*)__FILE__), __LINE__); |
|
450 theKeyEvent.iCode = iTestText[0]; |
|
451 SendKeyEventToApplicationL(theKeyEvent); |
|
452 theKeyEvent.iCode = iTestText[1]; |
|
453 SendKeyEventToApplicationL(theKeyEvent); |
|
454 theKeyEvent.iCode = iTestText[2]; |
|
455 SendKeyEventToApplicationL(theKeyEvent); |
|
456 break; |
|
457 } |
|
458 case 3: |
|
459 { |
|
460 theKeyEvent.iCode = EKeyEnter; |
|
461 //RDebug::Print(_L("Type Key Enter\n")); |
|
462 SetFromString(_L("Type Key Enter\n"), ((TText8*)__FILE__), __LINE__); |
|
463 //SendKeyEventToApplicationL(theKeyEvent); |
|
464 break; |
|
465 } |
|
466 case 4: |
|
467 { |
|
468 theKeyEvent.iCode = iTestText[3]; |
|
469 SendKeyEventToApplicationL(theKeyEvent); |
|
470 theKeyEvent.iCode = iTestText[4]; |
|
471 SendKeyEventToApplicationL(theKeyEvent); |
|
472 theKeyEvent.iCode = iTestText[5]; |
|
473 SendKeyEventToApplicationL(theKeyEvent); |
|
474 SetFromString(_L("Type chars\n"), ((TText8*)__FILE__), __LINE__); |
|
475 break; |
|
476 } |
|
477 case 5: case 8: |
|
478 { |
|
479 //test.Next(_L("Close the embeded document")); |
|
480 //RDebug::Print(_L("Close the embeded document\n")); |
|
481 SetFromString(_L("Close the embeded document\n"), ((TText8*)__FILE__), __LINE__); |
|
482 theKeyEvent.iCode = CTRL('e'); |
|
483 theKeyEvent.iModifiers=EModifierCtrl; |
|
484 |
|
485 SendKeyEventToApplicationL(theKeyEvent); |
|
486 break; |
|
487 } |
|
488 case 6: |
|
489 { |
|
490 //test.Next(_L("Edit the embeded document")); |
|
491 //RDebug::Print(_L("Edit the embeded document\n")); |
|
492 SetFromString(_L("Edit the embeded document\n"), ((TText8*)__FILE__), __LINE__); |
|
493 TRAPD(err, CmdEditObjectL()); |
|
494 if(err != KErrNone) |
|
495 { |
|
496 buf.Format(_L("Error during editting embeded document : %d\n"), err); |
|
497 SetErrorFromString(buf, ((TText8*)__FILE__), __LINE__, err); |
|
498 AutoTestManager().FinishAllTestCases(CAutoTestManager::EFailed); |
|
499 } |
|
500 break; |
|
501 } |
|
502 case 7: |
|
503 { |
|
504 theKeyEvent.iCode = EKeyBackspace; |
|
505 //RDebug::Print(_L("Type Key BackSpace\n")); |
|
506 SetFromString(_L("Type Key BackSpace\n"), ((TText8*)__FILE__), __LINE__); |
|
507 SendKeyEventToApplicationL(theKeyEvent); |
|
508 SendKeyEventToApplicationL(theKeyEvent); |
|
509 break; |
|
510 } |
|
511 case 9: |
|
512 { |
|
513 //RDebug::Print(_L("Delete the embeded document\n")); |
|
514 SetFromString(_L("Delete the embeded document\n"), ((TText8*)__FILE__), __LINE__); |
|
515 TRAPD(err, CmdDeleteObjectL()); |
|
516 if(err != KErrNone) |
|
517 { |
|
518 //RDebug::Print(_L("Error during deleting embeded document : %d\n"), err); |
|
519 TBuf<128> buf; |
|
520 buf.Format(_L("Error during deleting embeded document : %d\n"), err); |
|
521 SetErrorFromString(buf, ((TText8*)__FILE__), __LINE__, err); |
|
522 |
|
523 AutoTestManager().FinishAllTestCases(CAutoTestManager::EFailed); |
|
524 } |
|
525 break; |
|
526 } |
|
527 case 10: |
|
528 { |
|
529 TRAPD(err, SaveAnyChangesL()); |
|
530 if(err != KErrNone) |
|
531 { |
|
532 //RDebug::Print(_L("Error during saving embeded document : %d\n"), err); |
|
533 buf.Format(_L("Error during saving embeded document : %d\n"), err); |
|
534 SetErrorFromString(buf, ((TText8*)__FILE__), __LINE__, err); |
|
535 AutoTestManager().FinishAllTestCases(CAutoTestManager::EFailed); |
|
536 } |
|
537 break; |
|
538 } |
|
539 case 11: |
|
540 { |
|
541 TRAPD(err, TestEmbeddableAppListL()); |
|
542 if(err != KErrNone) |
|
543 { |
|
544 buf.Format(_L("Leave from TestEmbeddableAppListL with err : %d\n"), err); |
|
545 SetErrorFromString(buf, ((TText8*)__FILE__), __LINE__, err); |
|
546 AutoTestManager().FinishAllTestCases(CAutoTestManager::EFailed); |
|
547 } |
|
548 else |
|
549 { |
|
550 AutoTestManager().FinishAllTestCases(CAutoTestManager::EPass); |
|
551 } |
|
552 break; |
|
553 } |
|
554 } |
|
555 } |
|
556 |
|
557 void CPackagerAppUi::TestEmbeddableAppListL() |
|
558 { |
|
559 TBuf<128> buf; |
|
560 buf = _L("CPackagerAppUi::TestEmbeddableAppList"); |
|
561 SetFromString(buf, ((TText8*)__FILE__), __LINE__); |
|
562 |
|
563 CEikEmbeddableAppList* appList = new (ELeave) CEikEmbeddableAppList(); |
|
564 CleanupStack::PushL(appList); |
|
565 |
|
566 TApaEmbeddabilityFilter filter; |
|
567 filter.AddEmbeddability(TApaAppCapability::EEmbeddable); |
|
568 filter.AddEmbeddability(TApaAppCapability::EEmbeddableOnly); |
|
569 appList->ConstructL(filter); |
|
570 const TInt numberOfApps = appList->Count(); |
|
571 if (numberOfApps == 0) |
|
572 { |
|
573 User::Leave(KErrGeneral); |
|
574 } |
|
575 |
|
576 CleanupStack::PopAndDestroy(appList); |
|
577 } |
|
578 |
|
579 void CPackagerAppUi::SendKeyEventToApplicationL(TKeyEvent theKeyEvent) |
|
580 { |
|
581 TEventCode theType; |
|
582 theType = EEventKeyDown; |
|
583 iCoeEnv->SimulateKeyEventL(theKeyEvent,theType); |
|
584 theType = EEventKey; |
|
585 iCoeEnv->SimulateKeyEventL(theKeyEvent,theType); |
|
586 theType = EEventKeyUp; |
|
587 iCoeEnv->SimulateKeyEventL(theKeyEvent,theType); |
|
588 } |
|
589 |
|
590 |
|
591 // |
|
592 // CPackagerDocument - implementation |
|
593 // |
|
594 |
|
595 CEikAppUi* CPackagerDocument::CreateAppUiL() |
|
596 { |
|
597 return(new(ELeave) CPackagerAppUi); |
|
598 } |
|
599 |
|
600 void CPackagerDocument::StoreL(CStreamStore& aStore,CStreamDictionary& aStreamDic) const |
|
601 { |
|
602 RStoreWriteStream stream; |
|
603 TStreamId streamId=stream.CreateLC(aStore); |
|
604 // stream<<iModel; |
|
605 stream.CommitL(); |
|
606 CleanupStack::PopAndDestroy(); // stream |
|
607 aStreamDic.AssignL(KUidPackagerApp,streamId); |
|
608 } |
|
609 |
|
610 void CPackagerDocument::RestoreL(const CStreamStore& aStore,const CStreamDictionary& aStreamDic) |
|
611 { |
|
612 TStreamId headStreamId=aStreamDic.At(KUidPackagerApp); |
|
613 RStoreReadStream stream; |
|
614 stream.OpenLC(aStore,headStreamId); |
|
615 // stream>>iModel; |
|
616 CleanupStack::PopAndDestroy(); // stream |
|
617 } |
|
618 |
|
619 // |
|
620 // CPackagerApplication |
|
621 // |
|
622 |
|
623 class CPackagerApplication : public CEikApplication |
|
624 { |
|
625 private: // from CApaApplication |
|
626 CApaDocument* CreateDocumentL(); |
|
627 TUid AppDllUid() const; |
|
628 private: |
|
629 CApaDocument* CreateDocumentL(CApaProcess* a) { return CEikApplication::CreateDocumentL(a); } |
|
630 }; |
|
631 |
|
632 TUid CPackagerApplication::AppDllUid() const |
|
633 { |
|
634 return(KUidPackagerApp); |
|
635 } |
|
636 |
|
637 CApaDocument* CPackagerApplication::CreateDocumentL() |
|
638 { |
|
639 return new(ELeave) CPackagerDocument(*this); |
|
640 } |
|
641 |
|
642 // |
|
643 // EXPORTed functions |
|
644 // |
|
645 |
|
646 |
|
647 |
|
648 LOCAL_C CApaApplication* NewApplication() |
|
649 { |
|
650 return new CPackagerApplication; |
|
651 } |
|
652 |
|
653 GLDEF_C TInt E32Main() |
|
654 { |
|
655 return EikStart::RunApplication(NewApplication); |
|
656 } |
|
657 |
|
658 |
|
659 |