28
|
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 |
}
|
|
176 |
|
|
177 |
// ---------------------------------------------------------------------------
|
|
178 |
// CCchUIHandler::HandleVoipStateChanged
|
|
179 |
// (other items were commented in a header).
|
|
180 |
// ---------------------------------------------------------------------------
|
|
181 |
//
|
|
182 |
void CCchUIHandler::HandleVoipStateChanged( TBool aStatus )
|
|
183 |
{
|
|
184 |
CCHLOGSTRING( "CCchUIHandler::HandleVoipStateChanged" );
|
|
185 |
TRAP_IGNORE( HandleVoipStateChangedL(aStatus) );
|
|
186 |
}
|
|
187 |
|
|
188 |
// ---------------------------------------------------------------------------
|
|
189 |
// CCchUIHandler::HandleVoipStateChangedL
|
|
190 |
// (other items were commented in a header).
|
|
191 |
// ---------------------------------------------------------------------------
|
|
192 |
//
|
|
193 |
void CCchUIHandler::HandleVoipStateChangedL( TBool aStatus )
|
|
194 |
{
|
|
195 |
CCHLOGSTRING( "CCchUIHandler::HandleVoipStateChangedL" );
|
|
196 |
TInt err;
|
|
197 |
if ( aStatus && !iVoIPSmallIndicatorShown ) // Change VoIP indicator visibility
|
|
198 |
{
|
|
199 |
SetIndicatorStateL( EAknIndicatorVoIP,
|
|
200 |
EAknIndicatorStateOn ) ;
|
|
201 |
iVoIPSmallIndicatorShown = ETrue;
|
|
202 |
TInt emergencyWarningShown( 0 );
|
|
203 |
err = iCchRepository->Get(
|
|
204 |
KCCHVoIPEmergencyWarningShown, emergencyWarningShown );
|
|
205 |
if( err == KErrNone )
|
|
206 |
{
|
|
207 |
if( !emergencyWarningShown )
|
|
208 |
{
|
|
209 |
ShowEmergencyWarningNoteL( ETrue );
|
|
210 |
}
|
|
211 |
}
|
|
212 |
}
|
|
213 |
else if ( !aStatus && iVoIPSmallIndicatorShown )
|
|
214 |
{
|
|
215 |
iVoIPSmallIndicatorShown = EFalse;
|
|
216 |
iServer.SetVoIPEmergencyNoteShown( EFalse );
|
|
217 |
TRAP( err, SetIndicatorStateL( EAknIndicatorVoIP,
|
|
218 |
EAknIndicatorStateOff ) );
|
|
219 |
}
|
|
220 |
}
|
|
221 |
// ---------------------------------------------------------------------------
|
|
222 |
// CCchUIHandler::UpdateUI
|
|
223 |
// (other items were commented in a header).
|
|
224 |
// ---------------------------------------------------------------------------
|
|
225 |
//
|
|
226 |
void CCchUIHandler::UpdateUI( )
|
|
227 |
{
|
|
228 |
CCHLOGSTRING( "CCchUIHandler::UpdateUI" );
|
|
229 |
if( iCCchServiceHandler.Exists( ECCHVoIPSub, ECCHEnabled, KErrNone ) )
|
|
230 |
{
|
|
231 |
HandleVoipStateChanged( ETrue );
|
|
232 |
}
|
|
233 |
else
|
|
234 |
{
|
|
235 |
HandleVoipStateChanged( EFalse );
|
|
236 |
}
|
|
237 |
|
|
238 |
}
|
|
239 |
// ---------------------------------------------------------------------------
|
|
240 |
// CCchUIHandler::CheckGprsFirstUsageL
|
|
241 |
// (other items were commented in a header).
|
|
242 |
// ---------------------------------------------------------------------------
|
|
243 |
//
|
|
244 |
void CCchUIHandler::CheckGprsFirstUsageL( )
|
|
245 |
{
|
|
246 |
CCHLOGSTRING( "CCchUIHandler::CheckGprsFirstUsageL - IN" );
|
|
247 |
// Show gprs roaming cost warning note if not already shown
|
|
248 |
if( !IsCostWarningSeen() )
|
|
249 |
{
|
|
250 |
iNoteHandler->LaunchGlobalNoteL(
|
|
251 |
R_QTN_SERVTAB_ALLOW_GPRS_WHEN_ROAMING_QUERY,
|
|
252 |
R_AVKON_SOFTKEYS_OK_EMPTY,
|
|
253 |
SecondaryDisplay::ECmdNoNote );
|
|
254 |
}
|
|
255 |
|
|
256 |
CCHLOGSTRING( "CCchUIHandler::CheckGprsFirstUsageL - OUT" );
|
|
257 |
}
|
|
258 |
|
|
259 |
// ---------------------------------------------------------------------------
|
|
260 |
// CCchUIHandler::IsCostWarningSeen
|
|
261 |
// (other items were commented in a header).
|
|
262 |
// ---------------------------------------------------------------------------
|
|
263 |
//
|
|
264 |
TBool CCchUIHandler::IsCostWarningSeen() const
|
|
265 |
{
|
|
266 |
TBool response( EFalse );
|
|
267 |
TInt costWarning( KErrNone );
|
|
268 |
iCchRepository->Get( KCCHGprsRoamingCostWarningShown, costWarning );
|
|
269 |
|
|
270 |
response = 1 == costWarning;
|
|
271 |
CCHLOGSTRING2( "CCchUIHandler::IsCostWarningSeen : %d", response );
|
|
272 |
return response;
|
|
273 |
}
|
|
274 |
|
|
275 |
// ---------------------------------------------------------------------------
|
|
276 |
// CCchUIHandler::NetworkConnectionsAllowed
|
|
277 |
// (other items were commented in a header).
|
|
278 |
// ---------------------------------------------------------------------------
|
|
279 |
//
|
|
280 |
TBool CCchUIHandler::NetworkConnectionsAllowed() const
|
|
281 |
{
|
|
282 |
return iNetworkConnectionAllowed;
|
|
283 |
}
|
|
284 |
|
|
285 |
// ----------------------------------------------------------------------------
|
|
286 |
// CCchUIHandler::ShowEmergencyWarningNoteL()
|
|
287 |
// (other items were commented in a header).
|
|
288 |
// ----------------------------------------------------------------------------
|
|
289 |
|
|
290 |
void CCchUIHandler::ShowEmergencyWarningNoteL( TBool aVoIPEnabledFirstTime )
|
|
291 |
{
|
|
292 |
CCHLOGSTRING( "CCchUIHandler::ShowEmergencyWarningNoteL" );
|
|
293 |
if ( iServer.FeatureManager().VoIPSupported() )
|
|
294 |
{
|
|
295 |
if ( aVoIPEnabledFirstTime )
|
|
296 |
{
|
|
297 |
iNoteHandler->LaunchGlobalNoteL(
|
|
298 |
R_QTN_FIRST_EMERGENCY_WARNING_NOTE,
|
|
299 |
R_AVKON_SOFTKEYS_OK_EMPTY,
|
|
300 |
SecondaryDisplay::ECmdShowVoipEmergencyCallReadinessQuery );
|
|
301 |
iServer.SetVoIPEmergencyNoteShown( ETrue );
|
|
302 |
}
|
|
303 |
|
|
304 |
}
|
|
305 |
}
|
|
306 |
|
|
307 |
// ----------------------------------------------------------------------------
|
|
308 |
// CCchUIHandler::MonitorOfflineStatusL()
|
|
309 |
// ----------------------------------------------------------------------------
|
|
310 |
void CCchUIHandler::MonitorOfflineStatusL()
|
|
311 |
{
|
|
312 |
CCHLOGSTRING("CCchUIHandler::MonitorOfflineStatusL() IN");
|
|
313 |
|
|
314 |
iOfflineRepository->Get(
|
|
315 |
KCoreAppUIsNetworkConnectionAllowed,
|
|
316 |
iNetworkConnectionAllowed );
|
|
317 |
|
|
318 |
iOfflineRepository->NotifyRequest(
|
|
319 |
KCoreAppUIsNetworkConnectionAllowed, iStatus);
|
|
320 |
|
|
321 |
SetActive();
|
|
322 |
CCHLOGSTRING("CCchUIHandler::MonitorOfflineStatusL() OUT");
|
|
323 |
}
|
|
324 |
|
|
325 |
// ----------------------------------------------------------------------------
|
|
326 |
// CCchUIHandler::Cancel()
|
|
327 |
// ----------------------------------------------------------------------------
|
|
328 |
void CCchUIHandler::DoCancel()
|
|
329 |
{
|
|
330 |
CCHLOGSTRING("CCchUIHandler::DoCancel()");
|
|
331 |
iTimer.Cancel();
|
|
332 |
iOfflineRepository->NotifyCancel(
|
|
333 |
KCoreAppUIsNetworkConnectionAllowed );
|
|
334 |
}
|
|
335 |
|
|
336 |
// ----------------------------------------------------------------------------
|
|
337 |
// CCchUIHandler::RunL()
|
|
338 |
// ----------------------------------------------------------------------------
|
|
339 |
void CCchUIHandler::RunL()
|
|
340 |
{
|
|
341 |
CCHLOGSTRING("CCchUIHandler::RunL() IN");
|
|
342 |
|
|
343 |
if ( iDie )
|
|
344 |
{
|
|
345 |
delete this;
|
|
346 |
}
|
|
347 |
else
|
|
348 |
{
|
|
349 |
MonitorOfflineStatusL();
|
|
350 |
}
|
|
351 |
|
|
352 |
CCHLOGSTRING("CCchUIHandler::RunL() OUT");
|
|
353 |
}
|
|
354 |
|
|
355 |
// ----------------------------------------------------------------------------
|
|
356 |
// CCchUIHandler::RunError()
|
|
357 |
// ----------------------------------------------------------------------------
|
|
358 |
TInt CCchUIHandler::RunError( TInt /*aError*/ )
|
|
359 |
{
|
|
360 |
return KErrNone;
|
|
361 |
}
|
|
362 |
|
|
363 |
// ----------------------------------------------------------------------------
|
|
364 |
// CCchUIHandler::Destroy()
|
|
365 |
// ----------------------------------------------------------------------------
|
|
366 |
void CCchUIHandler::Destroy()
|
|
367 |
{
|
|
368 |
CCHLOGSTRING("CCchUIHandler::Destroy() IN");
|
|
369 |
iDie = ETrue;
|
|
370 |
|
|
371 |
// Soon we are down so remove VoIP icon
|
|
372 |
TRAP_IGNORE( SetIndicatorStateL(
|
|
373 |
EAknIndicatorVoIP, EAknIndicatorStateOff ) );
|
|
374 |
Cancel();
|
|
375 |
iTimer.After ( iStatus, KDelayTimeOneSec );
|
|
376 |
SetActive();
|
|
377 |
|
|
378 |
CCHLOGSTRING("CCchUIHandler::Destroy() OUT");
|
|
379 |
}
|
|
380 |
|
|
381 |
// ========================== OTHER EXPORTED FUNCTIONS =======================
|
|
382 |
|
|
383 |
// End of File
|