|
1 // activeview.cpp |
|
2 // |
|
3 // Copyright (c) 2008 - 2010 Accenture. All rights reserved. |
|
4 // This component and the accompanying materials are made available |
|
5 // under the terms of the "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 // Accenture - Initial contribution |
|
11 // |
|
12 |
|
13 #undef SYMBIAN_ENABLE_SPLIT_HEADERS // Stopgap to handle CVwsSessionWrapper being compiled out of viewcli.h in latest TB92 |
|
14 #include <fshell/ioutils.h> |
|
15 #include <viewcli.h> |
|
16 #include <fshell/qr3dll.h> |
|
17 |
|
18 using namespace IoUtils; |
|
19 |
|
20 class CCmdActiveView : public CCommandBase, public MVwsSessionWrapperObserver |
|
21 { |
|
22 public: |
|
23 static CCommandBase* NewLC(); |
|
24 ~CCmdActiveView(); |
|
25 private: |
|
26 CCmdActiveView(); |
|
27 private: // From CCommandBase. |
|
28 virtual const TDesC& Name() const; |
|
29 virtual void DoRunL(); |
|
30 virtual void OptionsL(RCommandOptionList& aOptions); |
|
31 private: // From MVwsSessionWrapperObserver. |
|
32 virtual void HandleViewEventL(const TVwsViewEvent& aEvent); |
|
33 private: |
|
34 CVwsSessionWrapper* iVws; |
|
35 TBool iVerbose; |
|
36 }; |
|
37 |
|
38 |
|
39 CCommandBase* CCmdActiveView::NewLC() |
|
40 { |
|
41 CCmdActiveView* self = new(ELeave) CCmdActiveView(); |
|
42 CleanupStack::PushL(self); |
|
43 self->BaseConstructL(); |
|
44 return self; |
|
45 } |
|
46 |
|
47 CCmdActiveView::~CCmdActiveView() |
|
48 { |
|
49 delete iVws; |
|
50 } |
|
51 |
|
52 CCmdActiveView::CCmdActiveView() : CCommandBase(EManualComplete) |
|
53 { |
|
54 } |
|
55 |
|
56 const TDesC& CCmdActiveView::Name() const |
|
57 { |
|
58 _LIT(KName, "activeview"); |
|
59 return KName; |
|
60 } |
|
61 |
|
62 void CCmdActiveView::DoRunL() |
|
63 { |
|
64 iVws = CVwsSessionWrapper::NewL(*this); |
|
65 iVws->NotifyNextActivation(); |
|
66 } |
|
67 |
|
68 void CCmdActiveView::OptionsL(RCommandOptionList& aOptions) |
|
69 { |
|
70 aOptions.AppendBoolL(iVerbose, _L("verbose")); |
|
71 } |
|
72 |
|
73 void CCmdActiveView::HandleViewEventL(const TVwsViewEvent& aEvent) |
|
74 { |
|
75 if (aEvent.iEventType == TVwsViewEvent::EVwsActivationNotification) |
|
76 { |
|
77 if (iVerbose) |
|
78 { |
|
79 RBuf a, b, c, d; |
|
80 ExeNameForSid(aEvent.iViewTwoId.iAppUid.iUid, a); |
|
81 ExeNameForSid(aEvent.iViewTwoId.iViewUid.iUid, b); |
|
82 ExeNameForSid(aEvent.iViewOneId.iAppUid.iUid, c); |
|
83 ExeNameForSid(aEvent.iViewOneId.iViewUid.iUid, d); |
|
84 Printf(_L("View switch: 0x%08x %S 0x%08x %S -> 0x%08x %S 0x%08x %S\r\n"), aEvent.iViewTwoId.iAppUid, &a, aEvent.iViewTwoId.iViewUid, &b, aEvent.iViewOneId.iAppUid, &c, aEvent.iViewOneId.iViewUid, &d); |
|
85 a.Close(); |
|
86 b.Close(); |
|
87 c.Close(); |
|
88 d.Close(); |
|
89 } |
|
90 else |
|
91 { |
|
92 Printf(_L("View switch: 0x%08x 0x%08x -> 0x%08x 0x%08x\r\n"), aEvent.iViewTwoId.iAppUid, aEvent.iViewTwoId.iViewUid, aEvent.iViewOneId.iAppUid, aEvent.iViewOneId.iViewUid); |
|
93 } |
|
94 iVws->NotifyNextActivation(); |
|
95 } |
|
96 } |
|
97 |
|
98 |
|
99 EXE_BOILER_PLATE(CCmdActiveView) |
|
100 |