|
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: Dialog that implements WLAN Power Save Testing notification |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "wlanpowersavetest.h" |
|
21 #include "wlanpowersavetestnotif.h" |
|
22 #include "ConnectionUiUtilitiesCommon.h" |
|
23 #include "ConnectionDialogsLogger.h" |
|
24 |
|
25 #include <uikon/eiksrvui.h> |
|
26 #include <StringLoader.h> |
|
27 #include <ConnUiUtilsNotif.rsg> |
|
28 |
|
29 // ================= MEMBER FUNCTIONS ======================= |
|
30 // |
|
31 // --------------------------------------------------------- |
|
32 // CWlanPowerSaveQuery::CWlanPowerSaveQuery |
|
33 // --------------------------------------------------------- |
|
34 // |
|
35 CWlanPowerSaveQuery::CWlanPowerSaveQuery( CWlanPowerSaveQueryNotif* aNotif ) |
|
36 : iNotif( aNotif ), |
|
37 iButtonGroupPreviouslyChanged( EFalse ) |
|
38 { |
|
39 } |
|
40 |
|
41 |
|
42 // --------------------------------------------------------- |
|
43 // CWlanPowerSaveQuery::~CWlanPowerSaveQuery |
|
44 // --------------------------------------------------------- |
|
45 // |
|
46 CWlanPowerSaveQuery::~CWlanPowerSaveQuery() |
|
47 { |
|
48 STATIC_CAST( CEikServAppUi*, |
|
49 CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse ); |
|
50 } |
|
51 |
|
52 |
|
53 |
|
54 // --------------------------------------------------------- |
|
55 // CWlanPowerSaveQuery::OkToExitL |
|
56 // --------------------------------------------------------- |
|
57 // |
|
58 TBool CWlanPowerSaveQuery::OkToExitL( TInt aButtonId ) |
|
59 { |
|
60 CLOG_ENTERFN( "CWlanPowerSaveQuery::OkToExitL" ); |
|
61 TInt status = KErrCancel; |
|
62 if ( aButtonId == EAknSoftkeyYes || aButtonId == EAknSoftkeySelect || |
|
63 aButtonId == EAknSoftkeyDone || aButtonId == EAknSoftkeyOk ) |
|
64 { |
|
65 status = KErrNone; |
|
66 } |
|
67 |
|
68 CLOG_WRITEF( _L( "aButtonId = %d" ), aButtonId ); |
|
69 |
|
70 if ( iNotif ) |
|
71 { |
|
72 iNotif->CompleteL( status ); |
|
73 } |
|
74 |
|
75 CLOG_LEAVEFN( "CWlanPowerSaveQuery::OkToExitL" ); |
|
76 |
|
77 return ETrue; |
|
78 } |
|
79 |
|
80 |
|
81 // --------------------------------------------------------- |
|
82 // CWlanPowerSaveQuery::PreLayoutDynInitL() |
|
83 // --------------------------------------------------------- |
|
84 // |
|
85 void CWlanPowerSaveQuery::PreLayoutDynInitL() |
|
86 { |
|
87 CAknMessageQueryDialog::PreLayoutDynInitL(); |
|
88 |
|
89 STATIC_CAST( CEikServAppUi*, |
|
90 CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue ); |
|
91 } |
|
92 |
|
93 |
|
94 // --------------------------------------------------------- |
|
95 // CWlanPowerSaveQuery::OfferKeyEventL() |
|
96 // --------------------------------------------------------- |
|
97 // |
|
98 TKeyResponse CWlanPowerSaveQuery::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
99 TEventCode aModifiers ) |
|
100 { |
|
101 CLOG_ENTERFN( "CWlanPowerSaveQuery::OfferKeyEventL" ); |
|
102 TInt code = aKeyEvent.iCode; |
|
103 |
|
104 switch ( code ) |
|
105 { |
|
106 case EKeyUpArrow: |
|
107 case EKeyDownArrow: |
|
108 { |
|
109 CAknMessageQueryControl* messageQueryControl = STATIC_CAST( |
|
110 CAknMessageQueryControl*, |
|
111 Control( EAknMessageQueryContentId ) ); |
|
112 if ( messageQueryControl ) |
|
113 { |
|
114 TKeyResponse answer = messageQueryControl->OfferKeyEventL( |
|
115 aKeyEvent, aModifiers ); |
|
116 if ( answer == EKeyWasConsumed ) |
|
117 { |
|
118 if ( messageQueryControl->LinkHighLighted() ) |
|
119 { |
|
120 if ( !iButtonGroupPreviouslyChanged ) |
|
121 { |
|
122 CEikButtonGroupContainer& cba = |
|
123 ButtonGroupContainer(); |
|
124 |
|
125 ButtonGroupContainer().AddCommandSetToStackL( |
|
126 R_SOFTKEYS_VIEW_EMPTY__VIEW ); |
|
127 |
|
128 cba.UpdateCommandObserverL( |
|
129 CEikButtonGroupContainer::ELeftSoftkeyPosition, |
|
130 *this ); |
|
131 |
|
132 cba.UpdateCommandObserverL( |
|
133 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
|
134 *this ); |
|
135 |
|
136 cba.DrawDeferred(); |
|
137 |
|
138 iButtonGroupPreviouslyChanged = ETrue; |
|
139 } |
|
140 } |
|
141 else if ( iButtonGroupPreviouslyChanged ) |
|
142 { |
|
143 CEikButtonGroupContainer& cba = ButtonGroupContainer(); |
|
144 |
|
145 cba.RemoveCommandObserver( |
|
146 CEikButtonGroupContainer::ELeftSoftkeyPosition ); |
|
147 |
|
148 cba.RemoveCommandObserver( |
|
149 CEikButtonGroupContainer::EMiddleSoftkeyPosition ); |
|
150 |
|
151 cba.RemoveCommandFromStack( |
|
152 CEikButtonGroupContainer::ELeftSoftkeyPosition, |
|
153 EAknSoftkeyView ); |
|
154 |
|
155 cba.RemoveCommandFromStack( |
|
156 CEikButtonGroupContainer::ERightSoftkeyPosition, |
|
157 EAknSoftkeyNo ); |
|
158 |
|
159 cba.RemoveCommandFromStack( |
|
160 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
|
161 EAknSoftkeyView ); |
|
162 |
|
163 cba.DrawDeferred(); |
|
164 |
|
165 iButtonGroupPreviouslyChanged = EFalse; |
|
166 } |
|
167 } |
|
168 CLOG_WRITEF( _L( "answer = %d" ), answer ); |
|
169 CLOG_LEAVEFN( "CWlanPowerSaveQuery::OfferKeyEventL 1" ); |
|
170 return answer; |
|
171 } |
|
172 } |
|
173 break; |
|
174 |
|
175 default: |
|
176 break; |
|
177 } |
|
178 |
|
179 CLOG_LEAVEFN( "CWlanPowerSaveQuery::OfferKeyEventL 2" ); |
|
180 return CAknMessageQueryDialog::OfferKeyEventL( aKeyEvent, aModifiers ); |
|
181 } |
|
182 |
|
183 |
|
184 // --------------------------------------------------------- |
|
185 // CWlanPowerSaveQuery::TryExitL() |
|
186 // --------------------------------------------------------- |
|
187 // |
|
188 void CWlanPowerSaveQuery::TryExitL( TInt aButtonId ) |
|
189 { |
|
190 CLOG_ENTERFN( "CWlanPowerSaveQuery::TryExitL" ); |
|
191 CAknMessageQueryDialog::TryExitL( aButtonId ); |
|
192 CLOG_LEAVEFN( "CWlanPowerSaveQuery::TryExitL" ); |
|
193 } |
|
194 |
|
195 // --------------------------------------------------------- |
|
196 // CWlanPowerSaveQuery::NeedToDismissQueryL |
|
197 // --------------------------------------------------------- |
|
198 // |
|
199 TBool CWlanPowerSaveQuery::NeedToDismissQueryL(const TKeyEvent& aKeyEvent) |
|
200 { |
|
201 if (aKeyEvent.iCode == EKeyPhoneSend) |
|
202 { |
|
203 TryExitL(EEikBidCancel); |
|
204 return ETrue; |
|
205 } |
|
206 |
|
207 return EFalse; |
|
208 } |
|
209 |
|
210 // End of File |