1 /* |
|
2 * Copyright (c) 2006 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: Implementation of class CConfirmationQuery. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "ConfirmationQuery.h" |
|
21 #include "ConfirmationQueryNotif.h" |
|
22 #include "ConnectionUiUtilitiesCommon.h" |
|
23 #include "ConnectionDialogsLogger.h" |
|
24 #include "ExpiryTimer.h" |
|
25 |
|
26 #include <uikon/eiksrvui.h> |
|
27 #include <StringLoader.h> |
|
28 #include <ConnUiUtilsNotif.rsg> |
|
29 |
|
30 |
|
31 |
|
32 // CONSTANTS |
|
33 #if defined(_DEBUG) |
|
34 _LIT( KErrNullPointer, "NULL pointer" ); |
|
35 #endif |
|
36 |
|
37 |
|
38 // ================= MEMBER FUNCTIONS ======================= |
|
39 // |
|
40 // --------------------------------------------------------- |
|
41 // CConfirmationQuery::CConfirmationQuery |
|
42 // HOME NETWORK |
|
43 // --------------------------------------------------------- |
|
44 // |
|
45 CConfirmationQuery::CConfirmationQuery( CConfirmationQueryNotif* aNotif ) |
|
46 : CAknListQueryDialog( &iDummy ), |
|
47 iNotif( aNotif ), |
|
48 iButtonGroupPreviouslyChanged( EFalse ) |
|
49 { |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------- |
|
53 // CConfirmationQuery::~CConfirmationQuery |
|
54 // --------------------------------------------------------- |
|
55 // |
|
56 CConfirmationQuery::~CConfirmationQuery() |
|
57 { |
|
58 STATIC_CAST( CEikServAppUi*, |
|
59 CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse ); |
|
60 delete iExpiryTimer; |
|
61 iChoiceIds.Close(); |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------- |
|
65 // CConfirmationQuery::OkToExitL |
|
66 // --------------------------------------------------------- |
|
67 // |
|
68 TBool CConfirmationQuery::OkToExitL( TInt aButtonId ) |
|
69 { |
|
70 CLOG_ENTERFN( "CConfirmationQuery::OkToExitL" ); |
|
71 TBool result( EFalse ); |
|
72 TInt status = KErrCancel; |
|
73 if ( aButtonId == EAknSoftkeySelect || |
|
74 aButtonId == EAknSoftkeyDone || aButtonId == EAknSoftkeyOk ) |
|
75 { |
|
76 iNotif->SetSelectedChoiceL( iChoiceIds[ListBox()->CurrentItemIndex()] ); |
|
77 result = ETrue; |
|
78 status = KErrNone; |
|
79 } |
|
80 else if ( aButtonId == EAknSoftkeyCancel ) |
|
81 { |
|
82 status = KErrCancel; |
|
83 result = ETrue; |
|
84 } |
|
85 |
|
86 if ( result ) |
|
87 { |
|
88 CLOG_WRITEF( _L( "aButtonId = %d" ), aButtonId ); |
|
89 __ASSERT_DEBUG( iNotif, User::Panic( KErrNullPointer, KErrNone ) ); |
|
90 iNotif->CompleteL( status ); |
|
91 } |
|
92 |
|
93 CLOG_LEAVEFN( "CConfirmationQuery::OkToExitL" ); |
|
94 |
|
95 return result; |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------- |
|
99 // CConfirmationQuery::PreLayoutDynInitL() |
|
100 // --------------------------------------------------------- |
|
101 // |
|
102 void CConfirmationQuery::PreLayoutDynInitL() |
|
103 { |
|
104 CAknListQueryDialog::PreLayoutDynInitL(); |
|
105 |
|
106 STATIC_CAST( CEikServAppUi*, |
|
107 CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue ); |
|
108 |
|
109 iExpiryTimer = CExpiryTimer::NewL( *this ); |
|
110 iExpiryTimer->Start(); |
|
111 } |
|
112 |
|
113 // --------------------------------------------------------- |
|
114 // CConfirmationQuery::TryExitL() |
|
115 // --------------------------------------------------------- |
|
116 // |
|
117 void CConfirmationQuery::TryExitL( TInt aButtonId ) |
|
118 { |
|
119 CLOG_ENTERFN( "CConfirmationQuery::TryExitL" ); |
|
120 CAknListQueryDialog::TryExitL( aButtonId ); |
|
121 CLOG_LEAVEFN( "CConfirmationQuery::TryExitL" ); |
|
122 } |
|
123 |
|
124 // --------------------------------------------------------- |
|
125 // CConfirmationQuery::OfferKeyEventL |
|
126 // --------------------------------------------------------- |
|
127 // |
|
128 TKeyResponse CConfirmationQuery::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
129 TEventCode aType) |
|
130 { |
|
131 if( aType == EEventKey && aKeyEvent.iCode == EKeyPhoneSend ) |
|
132 { |
|
133 // Let's not obscure the Dialer in the background |
|
134 if ( iExpiryTimer ) |
|
135 { |
|
136 iExpiryTimer->Cancel(); |
|
137 iExpiryTimer->StartShort(); |
|
138 } |
|
139 } |
|
140 |
|
141 return CAknListQueryDialog::OfferKeyEventL( aKeyEvent,aType ); |
|
142 } |
|
143 |
|
144 // --------------------------------------------------------- |
|
145 // CConfirmationQuery::SetChoices |
|
146 // --------------------------------------------------------- |
|
147 // |
|
148 void CConfirmationQuery::SetChoices( RArray<TMsgQueryLinkedResults> aChoices ) |
|
149 { |
|
150 iChoiceIds = aChoices; |
|
151 } |
|
152 |
|
153 void CConfirmationQuery::HandleTimedOut() |
|
154 { |
|
155 TRAP_IGNORE( TryExitL(EAknSoftkeyCancel) ); |
|
156 } |
|
157 |
|
158 |
|
159 // ================= MEMBER FUNCTIONS ======================= |
|
160 // |
|
161 // --------------------------------------------------------- |
|
162 // CConfirmationQueryVisitor::CConfirmationQueryVisitor |
|
163 // VISITOR NETWORK |
|
164 // --------------------------------------------------------- |
|
165 // |
|
166 CConfirmationQueryVisitor::CConfirmationQueryVisitor( |
|
167 CConfirmationQueryNotif* aNotif ) |
|
168 : |
|
169 iNotif( aNotif ) |
|
170 { |
|
171 } |
|
172 |
|
173 // --------------------------------------------------------- |
|
174 // CConfirmationQueryVisitor::~CConfirmationQueryVisitor |
|
175 // --------------------------------------------------------- |
|
176 // |
|
177 CConfirmationQueryVisitor::~CConfirmationQueryVisitor() |
|
178 { |
|
179 STATIC_CAST( CEikServAppUi*, |
|
180 CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse ); |
|
181 delete iExpiryTimer; |
|
182 } |
|
183 |
|
184 // --------------------------------------------------------- |
|
185 // CConfirmationQueryVisitor::OkToExitL |
|
186 // --------------------------------------------------------- |
|
187 // |
|
188 TBool CConfirmationQueryVisitor::OkToExitL( TInt aButtonId ) |
|
189 { |
|
190 CLOG_ENTERFN( "CConfirmationQueryVisitor::OkToExitL" ); |
|
191 TBool result( EFalse ); |
|
192 TInt status = KErrCancel; |
|
193 |
|
194 if ( aButtonId == EAknSoftkeySelect || |
|
195 aButtonId == EAknSoftkeyDone || aButtonId == EAknSoftkeyOk ) |
|
196 { |
|
197 iNotif->SetSelectedChoiceL( EMsgQueryThisTime ); |
|
198 result = ETrue; |
|
199 status = KErrNone; |
|
200 } |
|
201 else if ( aButtonId == EAknSoftkeyCancel ) |
|
202 { |
|
203 status = KErrCancel; |
|
204 result = ETrue; |
|
205 } |
|
206 |
|
207 if ( result ) |
|
208 { |
|
209 CLOG_WRITEF( _L( "aButtonId = %d" ), aButtonId ); |
|
210 if ( iNotif ) |
|
211 { |
|
212 iNotif->CompleteL( status ); |
|
213 } |
|
214 } |
|
215 |
|
216 CLOG_LEAVEFN( "CConfirmationQueryVisitor::OkToExitL" ); |
|
217 |
|
218 return result; |
|
219 } |
|
220 |
|
221 // --------------------------------------------------------- |
|
222 // CConfirmationQueryVisitor::PreLayoutDynInitL() |
|
223 // --------------------------------------------------------- |
|
224 // |
|
225 void CConfirmationQueryVisitor::PreLayoutDynInitL() |
|
226 { |
|
227 CAknMessageQueryDialog::PreLayoutDynInitL(); |
|
228 |
|
229 STATIC_CAST( CEikServAppUi*, |
|
230 CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue ); |
|
231 |
|
232 iExpiryTimer = CExpiryTimer::NewL( *this ); |
|
233 iExpiryTimer->Start(); |
|
234 } |
|
235 |
|
236 // --------------------------------------------------------- |
|
237 // CConfirmationQueryVisitor::TryExitL() |
|
238 // --------------------------------------------------------- |
|
239 // |
|
240 void CConfirmationQueryVisitor::TryExitL( TInt aButtonId ) |
|
241 { |
|
242 CLOG_ENTERFN( "CConfirmationQueryVisitor::TryExitL" ); |
|
243 CAknMessageQueryDialog::TryExitL( aButtonId ); |
|
244 CLOG_LEAVEFN( "CConfirmationQueryVisitor::TryExitL" ); |
|
245 } |
|
246 |
|
247 // --------------------------------------------------------- |
|
248 // CConfirmationQueryVisitor::OfferKeyEventL |
|
249 // --------------------------------------------------------- |
|
250 // |
|
251 TKeyResponse CConfirmationQueryVisitor::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
252 TEventCode aType) |
|
253 { |
|
254 if( aType == EEventKey && aKeyEvent.iCode == EKeyPhoneSend ) |
|
255 { |
|
256 // Let's not obscure the Dialer in the background |
|
257 if ( iExpiryTimer ) |
|
258 { |
|
259 iExpiryTimer->Cancel(); |
|
260 iExpiryTimer->StartShort(); |
|
261 } |
|
262 } |
|
263 |
|
264 return CAknMessageQueryDialog::OfferKeyEventL( aKeyEvent,aType ); |
|
265 } |
|
266 |
|
267 void CConfirmationQueryVisitor::HandleTimedOut() |
|
268 { |
|
269 TRAP_IGNORE( TryExitL(EAknSoftkeyCancel) ); |
|
270 } |
|
271 |
|
272 // End of File |
|