|
1 /* |
|
2 * Copyright (c) 2001-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 the License "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: Implementation of class CWiFiProtInitiateEasySetupDlg. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 //system includes |
|
21 #include <uikon/eiksrvui.h> |
|
22 #include <StringLoader.h> |
|
23 #include <wifiprotplugin.rsg> |
|
24 |
|
25 //user includes |
|
26 #include "wifiprotinitiateeasysetupdlg.h" |
|
27 #include "wifiprotdlgsplugin.h" |
|
28 #include "wifiprotplugin.hrh" |
|
29 #include "wifiprotlogger.h" |
|
30 |
|
31 // ========================= MEMBER FUNCTIONS =============================== |
|
32 // |
|
33 // -------------------------------------------------------------------------- |
|
34 // CWiFiProtInitiateEasySetupDlg::CWiFiProtInitiateEasySetupDlg |
|
35 // -------------------------------------------------------------------------- |
|
36 // |
|
37 CWiFiProtInitiateEasySetupDlg::CWiFiProtInitiateEasySetupDlg( |
|
38 TRequestStatus& aStatus ): |
|
39 iButtonGroupPreviouslyChanged( EFalse ), |
|
40 iRequestStatus( aStatus ) |
|
41 { |
|
42 CLOG_ENTERFN( |
|
43 "CWiFiProtInitiateEasySetupDlg::CWiFiProtInitiateEasySetupDlg" ); |
|
44 |
|
45 iRequestStatus = KRequestPending; |
|
46 |
|
47 CLOG_LEAVEFN( |
|
48 "CWiFiProtInitiateEasySetupDlg::CWiFiProtInitiateEasySetupDlg" ); |
|
49 |
|
50 } |
|
51 |
|
52 |
|
53 // -------------------------------------------------------------------------- |
|
54 // CWiFiProtInitiateEasySetupDlg::~CWiFiProtInitiateEasySetupDlg |
|
55 // -------------------------------------------------------------------------- |
|
56 // |
|
57 CWiFiProtInitiateEasySetupDlg::~CWiFiProtInitiateEasySetupDlg() |
|
58 { |
|
59 CLOG_ENTERFN( |
|
60 "CWiFiProtInitiateEasySetupDlg::~CWiFiProtInitiateEasySetupDlg" ); |
|
61 |
|
62 STATIC_CAST( CEikServAppUi*, |
|
63 CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse ); |
|
64 CLOG_LEAVEFN( |
|
65 "CWiFiProtInitiateEasySetupDlg::~CWiFiProtInitiateEasySetupDlg" ); |
|
66 |
|
67 } |
|
68 |
|
69 |
|
70 // -------------------------------------------------------------------------- |
|
71 // CWiFiProtInitiateEasySetupDlg::OkToExitL |
|
72 // -------------------------------------------------------------------------- |
|
73 // |
|
74 TBool CWiFiProtInitiateEasySetupDlg::OkToExitL( TInt aButtonId ) |
|
75 { |
|
76 CLOG_ENTERFN( "CWiFiProtInitiateEasySetupDlg::OkToExitL" ); |
|
77 |
|
78 TInt status = KErrCancel; |
|
79 if ( aButtonId == EAknSoftkeyOk |
|
80 || aButtonId == EAknSoftkeyYes |
|
81 || aButtonId == EAknSoftkeyDone |
|
82 || aButtonId == EWiFiSoftkeyContinue |
|
83 || aButtonId == EAknSoftkeySelect ) |
|
84 { |
|
85 status = KErrNone; |
|
86 } |
|
87 // if aButtonId == EAknSoftkeyView then we have to destroy the dialog |
|
88 // afterwards, not from the callback. In this case we do not complete |
|
89 // the client, it was completed before, just exit |
|
90 |
|
91 if ( !(aButtonId == EAknSoftkeyView )) |
|
92 { |
|
93 // this is called when we can destroy the dialog |
|
94 // and complete the client (activerunner) the same time |
|
95 TRequestStatus* pS = &iRequestStatus; |
|
96 User::RequestComplete( pS, status ); |
|
97 } |
|
98 CLOG_LEAVEFN( "CWiFiProtInitiateEasySetupDlg::OkToExitL" ); |
|
99 return ETrue; |
|
100 } |
|
101 |
|
102 |
|
103 // -------------------------------------------------------------------------- |
|
104 // CWiFiProtInitiateEasySetupDlg::TryExitL() |
|
105 // -------------------------------------------------------------------------- |
|
106 // |
|
107 void CWiFiProtInitiateEasySetupDlg::TryExitL( TInt aButtonId ) |
|
108 { |
|
109 CLOG_ENTERFN( "CWiFiProtInitiateEasySetupDlg::TryExitL" ); |
|
110 |
|
111 CAknMessageQueryDialog::TryExitL( aButtonId ); |
|
112 |
|
113 CLOG_LEAVEFN( "CWiFiProtInitiateEasySetupDlg::TryExitL" ); |
|
114 |
|
115 } |
|
116 |
|
117 // -------------------------------------------------------------------------- |
|
118 // CWiFiProtInitiateEasySetupDlg::PreLayoutDynInitL() |
|
119 // -------------------------------------------------------------------------- |
|
120 // |
|
121 void CWiFiProtInitiateEasySetupDlg::PreLayoutDynInitL() |
|
122 { |
|
123 CLOG_ENTERFN( "CWiFiProtInitiateEasySetupDlg::PreLayoutDynInitL" ); |
|
124 |
|
125 STATIC_CAST( CEikServAppUi*, |
|
126 CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue ); |
|
127 CAknMessageQueryDialog::PreLayoutDynInitL(); |
|
128 |
|
129 CLOG_LEAVEFN( "CWiFiProtInitiateEasySetupDlg::PreLayoutDynInitL" ); |
|
130 |
|
131 } |
|
132 |
|
133 // -------------------------------------------------------------------------- |
|
134 // CConfirmationQuery::OfferKeyEventL() |
|
135 // -------------------------------------------------------------------------- |
|
136 // |
|
137 TKeyResponse CWiFiProtInitiateEasySetupDlg::OfferKeyEventL( |
|
138 const TKeyEvent& aKeyEvent, |
|
139 TEventCode aModifiers ) |
|
140 { |
|
141 CLOG_ENTERFN( "CWiFiProtInitiateEasySetupDlg::OfferKeyEventL" ); |
|
142 TKeyResponse answer = EKeyWasNotConsumed; |
|
143 TInt code = aKeyEvent.iCode; |
|
144 switch ( code ) |
|
145 { |
|
146 // both keys are handled the same way |
|
147 // they mean 'movement in the list' |
|
148 case EKeyUpArrow: |
|
149 case EKeyDownArrow: |
|
150 { |
|
151 CAknMessageQueryControl* messageQueryControl = STATIC_CAST( |
|
152 CAknMessageQueryControl*, |
|
153 Control( EAknMessageQueryContentId ) ); |
|
154 if ( messageQueryControl ) |
|
155 { |
|
156 answer = messageQueryControl->OfferKeyEventL( |
|
157 aKeyEvent, aModifiers ); |
|
158 if ( answer == EKeyWasConsumed ) |
|
159 { |
|
160 if ( messageQueryControl->LinkHighLighted() ) |
|
161 { |
|
162 if ( !iButtonGroupPreviouslyChanged ) |
|
163 { |
|
164 CEikButtonGroupContainer& cba = |
|
165 ButtonGroupContainer(); |
|
166 |
|
167 ButtonGroupContainer().AddCommandSetToStackL( |
|
168 R_SOFTKEYS_SELECT_CANCEL__SELECT ); |
|
169 cba.UpdateCommandObserverL( |
|
170 CEikButtonGroupContainer::ELeftSoftkeyPosition, |
|
171 *this ); |
|
172 |
|
173 cba.UpdateCommandObserverL( |
|
174 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
|
175 *this ); |
|
176 |
|
177 cba.DrawNow(); |
|
178 |
|
179 iButtonGroupPreviouslyChanged = ETrue; |
|
180 } |
|
181 } |
|
182 else if ( iButtonGroupPreviouslyChanged ) |
|
183 { |
|
184 CEikButtonGroupContainer& cba = |
|
185 ButtonGroupContainer(); |
|
186 |
|
187 cba.RemoveCommandObserver( |
|
188 CEikButtonGroupContainer::ELeftSoftkeyPosition ); |
|
189 |
|
190 cba.RemoveCommandObserver( |
|
191 CEikButtonGroupContainer::EMiddleSoftkeyPosition ); |
|
192 |
|
193 cba.RemoveCommandFromStack( |
|
194 CEikButtonGroupContainer::ELeftSoftkeyPosition, |
|
195 EAknSoftkeyView ); |
|
196 |
|
197 cba.RemoveCommandFromStack( |
|
198 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
|
199 EAknSoftkeyView ); |
|
200 |
|
201 cba.RemoveCommandFromStack( |
|
202 CEikButtonGroupContainer::ERightSoftkeyPosition, |
|
203 EAknSoftkeyNo ); |
|
204 |
|
205 cba.DrawNow(); |
|
206 |
|
207 iButtonGroupPreviouslyChanged = EFalse; |
|
208 } |
|
209 } |
|
210 } |
|
211 break; |
|
212 } |
|
213 |
|
214 default: |
|
215 { |
|
216 answer = CAknMessageQueryDialog::OfferKeyEventL( aKeyEvent, |
|
217 aModifiers ); |
|
218 break; |
|
219 } |
|
220 } |
|
221 |
|
222 CLOG_LEAVEFN( "CWiFiProtInitiateEasySetupDlg::OfferKeyEventL" ); |
|
223 |
|
224 return answer; |
|
225 } |
|
226 |
|
227 // End of File |