|
1 /* |
|
2 * Copyright (c) 2007, 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: USB dialer activation watcher class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <w32std.h> |
|
20 #include <eikenv.h> |
|
21 #include <coeaui.h> |
|
22 #include <vwsdef.h> |
|
23 |
|
24 |
|
25 #include "usbuinotifdialerwatcher.h" |
|
26 #include "debug.h" |
|
27 #include "usbuinotifdebug.h" |
|
28 |
|
29 const TUid KDiallerUid = { 0x100058B3 }; |
|
30 const TUid KDiallerViewId = { 0x10282D81 }; |
|
31 const TUid KDiallerViewCommand = { 0x1 }; |
|
32 |
|
33 |
|
34 |
|
35 // ======== MEMBER FUNCTIONS ======== |
|
36 // --------------------------------------------------------------------------- |
|
37 // NewL |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 CUsbuinotifDialerWatcher* CUsbuinotifDialerWatcher::NewL( MDialerNotifier* aDialerNotifier ) |
|
41 { |
|
42 FLOG(_L("[USBUINOTIF]\t CUsbuinotifDialerWatcher::NewL")) |
|
43 CUsbuinotifDialerWatcher* self = CUsbuinotifDialerWatcher::NewLC( aDialerNotifier); |
|
44 CleanupStack::Pop( self ); |
|
45 return self; |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // NewLC |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 CUsbuinotifDialerWatcher* CUsbuinotifDialerWatcher::NewLC( MDialerNotifier* aDialerNotifier ) |
|
53 { |
|
54 FLOG(_L("[USBUINOTIF]\t CUsbuinotifDialerWatcher::NewLC")) |
|
55 CUsbuinotifDialerWatcher* self = new ( ELeave ) CUsbuinotifDialerWatcher( aDialerNotifier ); |
|
56 CleanupStack::PushL( self ); |
|
57 self->ConstructL( ); |
|
58 return self; |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // CUsbuinotifDialerWatcher() |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 CUsbuinotifDialerWatcher::CUsbuinotifDialerWatcher( MDialerNotifier* aDialerNotifier ) : |
|
66 iNotify( aDialerNotifier ) |
|
67 { |
|
68 FLOG(_L("[USBUINOTIF]\t CUsbuinotifDialerWatcher::CUsbuinotifDialerWatcher")) |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // Destructor |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 CUsbuinotifDialerWatcher::~CUsbuinotifDialerWatcher() |
|
76 { |
|
77 FLOG(_L("[USBUINOTIF]\t CUsbuinotifDialerWatcher Destructor")) |
|
78 CCoeAppUi* appui=CEikonEnv::Static()->AppUi(); |
|
79 appui->RemoveFromStack(this); |
|
80 delete iwsSession; |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // ConstructL() |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 void CUsbuinotifDialerWatcher::ConstructL() |
|
88 { |
|
89 FLOG(_L("[USBUINOTIF]\t CUsbuinotifDialerWatcher ConstructL")); |
|
90 CCoeAppUi* appui=CEikonEnv::Static()->AppUi(); |
|
91 appui->AddToStackL(this,ECoeStackPriorityCba); |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // HandleViewEventL() |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 void CUsbuinotifDialerWatcher::HandleViewEventL(const TVwsViewEvent& /*aEvent*/) |
|
99 { |
|
100 FLOG((_L("[USBUINOTIF]\t HandleViewEventL "))); |
|
101 |
|
102 if ( !iNotified ) |
|
103 { |
|
104 iNotify->ReActivateDialog(); |
|
105 iNotified=ETrue; |
|
106 } |
|
107 FLOG(_L("[USBUINOTIF]\t HandleViewEventL Done")); |
|
108 } |
|
109 |
|
110 // --------------------------------------------------------------------------- |
|
111 // OfferKeyEventL |
|
112 // --------------------------------------------------------------------------- |
|
113 // |
|
114 TKeyResponse CUsbuinotifDialerWatcher::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode /*aType*/) |
|
115 { |
|
116 if (aKeyEvent.iScanCode == EStdKeyApplication0) |
|
117 { |
|
118 if ( !iwsSession ) |
|
119 { |
|
120 iwsSession = CVwsSessionWrapper::NewL(*this); |
|
121 } |
|
122 iNotified=EFalse; |
|
123 const TVwsViewId viewId(KDiallerUid, KDiallerViewId ); |
|
124 TUid msgId = KDiallerViewCommand; |
|
125 iwsSession->CreateActivateViewEvent( viewId, msgId, KNullDesC8 ); |
|
126 CCoeAppUi* appui=CEikonEnv::Static()->AppUi(); |
|
127 iNotify->DialerActivated(); |
|
128 iwsSession->NotifyNextDeactivation(viewId); |
|
129 } |
|
130 |
|
131 return EKeyWasNotConsumed; |
|
132 } |
|
133 |