1 /* |
|
2 * Copyright (c) 2006-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: CCchUIHandler implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "cchlogger.h" |
|
21 #include "cchserverbase.h" |
|
22 #include "cchservicehandler.h" |
|
23 #include "cchclientserverinternal.h" |
|
24 #include <centralrepository.h> |
|
25 #include "cchetelnetworkstatusnotifier.h" |
|
26 #include "cchfeaturemanager.h" |
|
27 #include "cchnotehandler.h" |
|
28 #include "cchprivatecrkeys.h" |
|
29 #include <cch.rsg> |
|
30 #include "cchuihandler.h" |
|
31 #include "cchsecondarydisplayapi.h" |
|
32 #include <CoreApplicationUIsSDKCRKeys.h> |
|
33 |
|
34 // From AVKON |
|
35 #include <AknSmallIndicator.h> |
|
36 #include <avkon.hrh> |
|
37 |
|
38 // EXTERNAL DATA STRUCTURES |
|
39 // None |
|
40 |
|
41 // EXTERNAL FUNCTION PROTOTYPES |
|
42 // None |
|
43 |
|
44 // CONSTANTS |
|
45 // None |
|
46 |
|
47 // MACROS |
|
48 // None |
|
49 |
|
50 // LOCAL CONSTANTS AND MACROS |
|
51 const TInt KDelayTimeOneSec(1000000); |
|
52 |
|
53 // MODULE DATA STRUCTURES |
|
54 // None |
|
55 |
|
56 // LOCAL FUNCTION PROTOTYPES |
|
57 // None |
|
58 |
|
59 // FORWARD DECLARATIONS |
|
60 // None |
|
61 |
|
62 // ============================= LOCAL FUNCTIONS ============================= |
|
63 |
|
64 // ============================ MEMBER FUNCTIONS ============================= |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // CCchUIHandler::CCchUIHandler |
|
68 // C++ default constructor can NOT contain any code, that might leave. |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 CCchUIHandler::CCchUIHandler( |
|
72 CCCHServerBase& aServer, |
|
73 CCCHServiceHandler& aCCchServiceHandler ) : |
|
74 CActive( CActive::EPriorityStandard ), |
|
75 iServer( aServer ), |
|
76 iCCchServiceHandler( aCCchServiceHandler ) |
|
77 { |
|
78 CCHLOGSTRING( "CCchUIHandler::CCchUIHandler" ); |
|
79 CActiveScheduler::Add( this ); |
|
80 } |
|
81 |
|
82 // --------------------------------------------------------------------------- |
|
83 // CCchUIHandler::ConstructL |
|
84 // Symbian 2nd phase constructor can leave. |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 void CCchUIHandler::ConstructL() |
|
88 { |
|
89 CCHLOGSTRING( "CCchUIHandler::ConstructL" ); |
|
90 User::LeaveIfError( iTimer.CreateLocal() ); |
|
91 |
|
92 iCchEtelNetworkStatusNotifier = CCchEtelNetworkStatusNotifier::NewL( *this ); |
|
93 iNoteHandler = CCchNoteHandler::NewL( iServer ); |
|
94 iOfflineRepository = CRepository::NewL( KCRUidCoreApplicationUIs ); |
|
95 iCchRepository = iNoteHandler->CchCenRep(); |
|
96 |
|
97 MonitorOfflineStatusL(); |
|
98 } |
|
99 |
|
100 // --------------------------------------------------------------------------- |
|
101 // CCchUIHandler::NewL |
|
102 // Two-phased constructor. |
|
103 // --------------------------------------------------------------------------- |
|
104 // |
|
105 CCchUIHandler* CCchUIHandler::NewL( |
|
106 CCCHServerBase& aServer, |
|
107 CCCHServiceHandler& aCCchServiceHandler ) |
|
108 { |
|
109 CCHLOGSTRING( "CCchUIHandler::NewL" ); |
|
110 CCchUIHandler* self = |
|
111 CCchUIHandler::NewLC( aServer, aCCchServiceHandler ); |
|
112 CleanupStack::Pop( self ); |
|
113 return self; |
|
114 } |
|
115 |
|
116 // --------------------------------------------------------------------------- |
|
117 // CCchUIHandler::NewLC |
|
118 // Two-phased constructor. |
|
119 // --------------------------------------------------------------------------- |
|
120 // |
|
121 CCchUIHandler* CCchUIHandler::NewLC( |
|
122 CCCHServerBase& aServer, |
|
123 CCCHServiceHandler& aCCchServiceHandler ) |
|
124 { |
|
125 CCHLOGSTRING( "CCchUIHandler::NewLC" ); |
|
126 CCchUIHandler* self = |
|
127 new (ELeave) CCchUIHandler( aServer, aCCchServiceHandler ); |
|
128 CleanupStack::PushL( self ); |
|
129 self->ConstructL(); |
|
130 return self; |
|
131 } |
|
132 |
|
133 // --------------------------------------------------------------------------- |
|
134 // CCchUIHandler::NewLC |
|
135 // Destructor. |
|
136 // --------------------------------------------------------------------------- |
|
137 // |
|
138 CCchUIHandler::~CCchUIHandler() |
|
139 { |
|
140 CCHLOGSTRING( "CCchUIHandler::~CCchUIHandler" ); |
|
141 Cancel(); |
|
142 iTimer.Close(); |
|
143 |
|
144 delete iCchEtelNetworkStatusNotifier; |
|
145 delete iOfflineRepository; |
|
146 |
|
147 if ( iNoteHandler && iNoteHandler->CanBeDestroyed() ) |
|
148 { |
|
149 delete iNoteHandler; |
|
150 } |
|
151 } |
|
152 // --------------------------------------------------------------------------- |
|
153 // CCchUIHandler::SetIndicatorStateL |
|
154 // (other items were commented in a header). |
|
155 // --------------------------------------------------------------------------- |
|
156 // |
|
157 void CCchUIHandler::SetIndicatorStateL( TInt aIndicator, |
|
158 TInt aState ) const |
|
159 { |
|
160 CCHLOGSTRING( "CCchUIHandler::SetIndicatorStateL" ); |
|
161 CAknSmallIndicator* theIndicator = |
|
162 CAknSmallIndicator::NewLC( TUid::Uid( aIndicator ) ); |
|
163 theIndicator->SetIndicatorStateL( aState ); |
|
164 CleanupStack::PopAndDestroy( theIndicator ); |
|
165 } |
|
166 |
|
167 // --------------------------------------------------------------------------- |
|
168 // CCchUIHandler::MobileNetworkNoService |
|
169 // (other items were commented in a header). |
|
170 // --------------------------------------------------------------------------- |
|
171 // |
|
172 void CCchUIHandler::MobileNetworkNoService( ) |
|
173 { |
|
174 CCHLOGSTRING( "CCchUIHandler::MobileNetworkNoService" ); |
|
175 TRAP_IGNORE( ShowEmergencyWarningNoteL( EFalse ) ); |
|
176 } |
|
177 |
|
178 // --------------------------------------------------------------------------- |
|
179 // CCchUIHandler::HandleVoipStateChanged |
|
180 // (other items were commented in a header). |
|
181 // --------------------------------------------------------------------------- |
|
182 // |
|
183 void CCchUIHandler::HandleVoipStateChanged( TBool aStatus ) |
|
184 { |
|
185 CCHLOGSTRING( "CCchUIHandler::HandleVoipStateChanged" ); |
|
186 TRAP_IGNORE( HandleVoipStateChangedL(aStatus) ); |
|
187 } |
|
188 |
|
189 // --------------------------------------------------------------------------- |
|
190 // CCchUIHandler::HandleVoipStateChangedL |
|
191 // (other items were commented in a header). |
|
192 // --------------------------------------------------------------------------- |
|
193 // |
|
194 void CCchUIHandler::HandleVoipStateChangedL( TBool aStatus ) |
|
195 { |
|
196 CCHLOGSTRING( "CCchUIHandler::HandleVoipStateChangedL" ); |
|
197 TInt err; |
|
198 if ( aStatus && !iVoIPSmallIndicatorShown ) // Change VoIP indicator visibility |
|
199 { |
|
200 SetIndicatorStateL( EAknIndicatorVoIP, |
|
201 EAknIndicatorStateOn ) ; |
|
202 iVoIPSmallIndicatorShown = ETrue; |
|
203 TInt emergencyWarningShown( 0 ); |
|
204 err = iCchRepository->Get( |
|
205 KCCHVoIPEmergencyWarningShown, emergencyWarningShown ); |
|
206 if( err == KErrNone ) |
|
207 { |
|
208 if ( !iVoIPEmergencyNoteState ) |
|
209 { |
|
210 iVoIPEmergencyNoteState = |
|
211 iCchEtelNetworkStatusNotifier->IsNetworkStatusNoService(); |
|
212 } |
|
213 if( !emergencyWarningShown ) |
|
214 { |
|
215 ShowEmergencyWarningNoteL( ETrue ); |
|
216 } |
|
217 else if( iVoIPEmergencyNoteState ) |
|
218 { |
|
219 ShowEmergencyWarningNoteL( EFalse ); |
|
220 } |
|
221 } |
|
222 } |
|
223 else if ( !aStatus && iVoIPSmallIndicatorShown ) |
|
224 { |
|
225 iVoIPSmallIndicatorShown = EFalse; |
|
226 iServer.SetVoIPEmergencyNoteShown( EFalse ); |
|
227 TRAP( err, SetIndicatorStateL( EAknIndicatorVoIP, |
|
228 EAknIndicatorStateOff ) ); |
|
229 } |
|
230 } |
|
231 // --------------------------------------------------------------------------- |
|
232 // CCchUIHandler::UpdateUI |
|
233 // (other items were commented in a header). |
|
234 // --------------------------------------------------------------------------- |
|
235 // |
|
236 void CCchUIHandler::UpdateUI( ) |
|
237 { |
|
238 CCHLOGSTRING( "CCchUIHandler::UpdateUI" ); |
|
239 if( iCCchServiceHandler.Exists( ECCHVoIPSub, ECCHEnabled, KErrNone ) ) |
|
240 { |
|
241 HandleVoipStateChanged( ETrue ); |
|
242 } |
|
243 else |
|
244 { |
|
245 HandleVoipStateChanged( EFalse ); |
|
246 } |
|
247 |
|
248 } |
|
249 // --------------------------------------------------------------------------- |
|
250 // CCchUIHandler::CheckGprsFirstUsageL |
|
251 // (other items were commented in a header). |
|
252 // --------------------------------------------------------------------------- |
|
253 // |
|
254 void CCchUIHandler::CheckGprsFirstUsageL( ) |
|
255 { |
|
256 CCHLOGSTRING( "CCchUIHandler::CheckGprsFirstUsageL - IN" ); |
|
257 |
|
258 // Check value from cenrep |
|
259 TInt gprsRoamingCostWarningShown( 0 ); |
|
260 |
|
261 User::LeaveIfError( iCchRepository->Get( |
|
262 KCCHGprsRoamingCostWarningShown, |
|
263 gprsRoamingCostWarningShown ) ); |
|
264 |
|
265 // Show gprs roaming cost warning note if not already shown |
|
266 if( !gprsRoamingCostWarningShown ) |
|
267 { |
|
268 iNoteHandler->LaunchGlobalNoteL( |
|
269 R_QTN_SERVTAB_ALLOW_GPRS_WHEN_ROAMING_QUERY, |
|
270 R_AVKON_SOFTKEYS_OK_EMPTY, |
|
271 SecondaryDisplay::ECmdNoNote ); |
|
272 } |
|
273 |
|
274 CCHLOGSTRING( "CCchUIHandler::CheckGprsFirstUsageL - OUT" ); |
|
275 } |
|
276 |
|
277 // --------------------------------------------------------------------------- |
|
278 // CCchUIHandler::NetworkConnectionsAllowed |
|
279 // (other items were commented in a header). |
|
280 // --------------------------------------------------------------------------- |
|
281 // |
|
282 TBool CCchUIHandler::NetworkConnectionsAllowed() const |
|
283 { |
|
284 return iNetworkConnectionAllowed; |
|
285 } |
|
286 |
|
287 // ---------------------------------------------------------------------------- |
|
288 // CCchUIHandler::ShowEmergencyWarningNoteL() |
|
289 // (other items were commented in a header). |
|
290 // ---------------------------------------------------------------------------- |
|
291 |
|
292 void CCchUIHandler::ShowEmergencyWarningNoteL( TBool aVoIPEnabledFirstTime ) |
|
293 { |
|
294 CCHLOGSTRING( "CCchUIHandler::ShowEmergencyWarningNoteL" ); |
|
295 if ( iServer.FeatureManager().VoIPSupported() ) |
|
296 { |
|
297 if ( aVoIPEnabledFirstTime ) |
|
298 { |
|
299 iNoteHandler->LaunchGlobalNoteL( |
|
300 R_QTN_FIRST_EMERGENCY_WARNING_NOTE, |
|
301 R_AVKON_SOFTKEYS_OK_EMPTY, |
|
302 SecondaryDisplay::ECmdShowVoipEmergencyCallReadinessQuery ); |
|
303 iServer.SetVoIPEmergencyNoteShown( ETrue ); |
|
304 } |
|
305 else |
|
306 { |
|
307 TInt voIPEmergencyNoteDoNotShow( 0 ); |
|
308 iCchRepository->Get( |
|
309 KCCHVoIPShowEmergencyWarningOnOff, voIPEmergencyNoteDoNotShow ); |
|
310 if ( voIPEmergencyNoteDoNotShow && !iServer.VoIPEmergencyNoteShown() ) |
|
311 { |
|
312 iServer.SetVoIPEmergencyNoteShown( ETrue ); |
|
313 iNoteHandler->LaunchGlobalNoteL( |
|
314 R_QTN_VOIP_EM_CALL_ERROR_NOTE_NO_CS, |
|
315 R_AVKON_SOFTKEYS_OK_EMPTY, |
|
316 SecondaryDisplay::ECmdShowVoipEmergencyCallErrorNoteNoCsQuery ); |
|
317 } |
|
318 } |
|
319 } |
|
320 } |
|
321 |
|
322 // ---------------------------------------------------------------------------- |
|
323 // CCchUIHandler::MonitorOfflineStatusL() |
|
324 // ---------------------------------------------------------------------------- |
|
325 void CCchUIHandler::MonitorOfflineStatusL() |
|
326 { |
|
327 CCHLOGSTRING("CCchUIHandler::MonitorOfflineStatusL() IN"); |
|
328 |
|
329 iOfflineRepository->Get( |
|
330 KCoreAppUIsNetworkConnectionAllowed, |
|
331 iNetworkConnectionAllowed ); |
|
332 |
|
333 iOfflineRepository->NotifyRequest( |
|
334 KCoreAppUIsNetworkConnectionAllowed, iStatus); |
|
335 |
|
336 SetActive(); |
|
337 CCHLOGSTRING("CCchUIHandler::MonitorOfflineStatusL() OUT"); |
|
338 } |
|
339 |
|
340 // ---------------------------------------------------------------------------- |
|
341 // CCchUIHandler::Cancel() |
|
342 // ---------------------------------------------------------------------------- |
|
343 void CCchUIHandler::DoCancel() |
|
344 { |
|
345 CCHLOGSTRING("CCchUIHandler::DoCancel()"); |
|
346 iTimer.Cancel(); |
|
347 iOfflineRepository->NotifyCancel( |
|
348 KCoreAppUIsNetworkConnectionAllowed ); |
|
349 } |
|
350 |
|
351 // ---------------------------------------------------------------------------- |
|
352 // CCchUIHandler::RunL() |
|
353 // ---------------------------------------------------------------------------- |
|
354 void CCchUIHandler::RunL() |
|
355 { |
|
356 CCHLOGSTRING("CCchUIHandler::RunL() IN"); |
|
357 |
|
358 if ( iDie ) |
|
359 { |
|
360 delete this; |
|
361 } |
|
362 else |
|
363 { |
|
364 MonitorOfflineStatusL(); |
|
365 } |
|
366 |
|
367 CCHLOGSTRING("CCchUIHandler::RunL() OUT"); |
|
368 } |
|
369 |
|
370 // ---------------------------------------------------------------------------- |
|
371 // CCchUIHandler::RunError() |
|
372 // ---------------------------------------------------------------------------- |
|
373 TInt CCchUIHandler::RunError( TInt /*aError*/ ) |
|
374 { |
|
375 return KErrNone; |
|
376 } |
|
377 |
|
378 // ---------------------------------------------------------------------------- |
|
379 // CCchUIHandler::Destroy() |
|
380 // ---------------------------------------------------------------------------- |
|
381 void CCchUIHandler::Destroy() |
|
382 { |
|
383 CCHLOGSTRING("CCchUIHandler::Destroy() IN"); |
|
384 iDie = ETrue; |
|
385 |
|
386 // Soon we are down so remove VoIP icon |
|
387 TRAP_IGNORE( SetIndicatorStateL( |
|
388 EAknIndicatorVoIP, EAknIndicatorStateOff ) ); |
|
389 Cancel(); |
|
390 iTimer.After ( iStatus, KDelayTimeOneSec ); |
|
391 SetActive(); |
|
392 |
|
393 CCHLOGSTRING("CCchUIHandler::Destroy() OUT"); |
|
394 } |
|
395 |
|
396 // ========================== OTHER EXPORTED FUNCTIONS ======================= |
|
397 |
|
398 // End of File |
|