114
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2007 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: The engine class of profile plugin.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// System includes
|
|
20 |
#include <w32std.h>
|
|
21 |
#include <ProEngFactory.h>
|
|
22 |
#include <MProfileEngine.h>
|
|
23 |
#include <MProfile.h>
|
|
24 |
#include <MProEngEngine.h>
|
|
25 |
#include <MProEngProfile.h>
|
|
26 |
#include <MProEngProfileName.h>
|
|
27 |
#include <MProEngProfileNameArray.h>
|
|
28 |
#include <MProEngNotifyHandler.h>
|
|
29 |
#include <Profile.hrh>
|
|
30 |
#include <CProfileChangeNotifyHandler.h>
|
|
31 |
#include <PUAcodes.hrh>
|
|
32 |
#include <AknUtils.h>
|
|
33 |
#include <data_caging_path_literals.hrh>
|
|
34 |
#include <bautils.h>
|
|
35 |
#include <StringLoader.h>
|
|
36 |
#include <AknQueryDialog.h>
|
|
37 |
#include <aknnotewrappers.h>
|
|
38 |
#include <RSSSettings.h>
|
|
39 |
#include <startupdomainpskeys.h>
|
|
40 |
|
|
41 |
// User includes
|
|
42 |
#include <aiprofilepluginres.rsg>
|
|
43 |
#include "caiprofileengine.h"
|
|
44 |
#include "maiprofilepluginnotifier.h"
|
|
45 |
#include "aiprofileplugincontentmodel.h"
|
|
46 |
|
|
47 |
// Constants
|
|
48 |
const TInt KMaxProfileNameLength( 64 );
|
|
49 |
const TInt KGeneralProfileId( 0 );
|
|
50 |
const TInt KSilentProfileId( 1 );
|
|
51 |
const TInt KOfflineProfileId( 5 );
|
|
52 |
|
|
53 |
const TInt KMaxActiveProfileLength( 64 );
|
|
54 |
const TUid KUidProfileApp = { 0x100058F8 };
|
|
55 |
const TUid KProfileAppSettingViewId = { 2 };
|
|
56 |
|
|
57 |
_LIT( KAiProfilePluginResourceFileName, "z:aiprofilepluginres.rsc");
|
|
58 |
|
|
59 |
// ============================ MEMBER FUNCTIONS ==============================
|
|
60 |
// ----------------------------------------------------------------------------
|
|
61 |
// CAiProfileEngine::CAiProfileEngine
|
|
62 |
//
|
|
63 |
// ----------------------------------------------------------------------------
|
|
64 |
//
|
|
65 |
CAiProfileEngine::CAiProfileEngine(
|
|
66 |
MAiProfilePluginNotifier* aProfilePluginNotifier )
|
|
67 |
: iProfilePluginNotifier ( aProfilePluginNotifier ),
|
|
68 |
iResourceLoader( *CCoeEnv::Static() )
|
|
69 |
{
|
|
70 |
}
|
|
71 |
|
|
72 |
// ----------------------------------------------------------------------------
|
|
73 |
// CAiProfileEngine::NewL
|
|
74 |
//
|
|
75 |
// ----------------------------------------------------------------------------
|
|
76 |
//
|
|
77 |
CAiProfileEngine* CAiProfileEngine::NewL(
|
|
78 |
MAiProfilePluginNotifier* aProfilePluginNotifier )
|
|
79 |
{
|
|
80 |
CAiProfileEngine* self =
|
|
81 |
new( ELeave ) CAiProfileEngine( aProfilePluginNotifier );
|
|
82 |
CleanupStack::PushL( self );
|
|
83 |
|
|
84 |
self->ConstructL();
|
|
85 |
CleanupStack::Pop( self );
|
|
86 |
|
|
87 |
return self;
|
|
88 |
}
|
|
89 |
|
|
90 |
// ----------------------------------------------------------------------------
|
|
91 |
// CAiProfileEngine::ConstructL
|
|
92 |
//
|
|
93 |
// ----------------------------------------------------------------------------
|
|
94 |
//
|
|
95 |
void CAiProfileEngine::ConstructL()
|
|
96 |
{
|
|
97 |
TParse parse;
|
|
98 |
parse.Set( KAiProfilePluginResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL );
|
|
99 |
TFileName fileName( parse.FullName() );
|
|
100 |
|
|
101 |
// Get language of resource file.
|
|
102 |
BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), fileName );
|
|
103 |
|
|
104 |
// Open resource file.
|
|
105 |
TRAP_IGNORE( iResourceLoader.OpenL( fileName ) );
|
|
106 |
|
|
107 |
User::LeaveIfError( iSSSettings.Open() );
|
|
108 |
|
|
109 |
// Register to listen ALS activation, if ALS status changes,
|
|
110 |
// profile must be republished.
|
|
111 |
TInt err( iSSSettings.Register( ESSSettingsAls, *this ) );
|
|
112 |
|
|
113 |
if( err == KErrNotSupported || err == KErrAlreadyExists )
|
|
114 |
{
|
|
115 |
// ALS not supported or already registered, that's fine
|
|
116 |
err = KErrNone;
|
|
117 |
}
|
|
118 |
|
|
119 |
User::LeaveIfError( err );
|
|
120 |
|
|
121 |
iProfileEngine = ProEngFactory::NewEngineL();
|
|
122 |
|
|
123 |
// Start to listen profile changes.
|
|
124 |
iProfileNotifier = ProEngFactory::NewNotifyHandlerL();
|
|
125 |
|
|
126 |
iProfileNotifier->RequestActiveProfileNotificationsL( *this );
|
|
127 |
iProfileNotifier->RequestProfileNameArrayNotificationsL( *this );
|
|
128 |
iProfileNotifier->RequestProfileActivationNotificationsL( *this );
|
|
129 |
|
|
130 |
DetermineTimedAndSilentStatesL();
|
|
131 |
}
|
|
132 |
|
|
133 |
// ----------------------------------------------------------------------------
|
|
134 |
// CAiProfileEngine::~CAiProfileEngine
|
|
135 |
//
|
|
136 |
// ----------------------------------------------------------------------------
|
|
137 |
//
|
|
138 |
CAiProfileEngine::~CAiProfileEngine()
|
|
139 |
{
|
|
140 |
delete iOfflineQueryDialog;
|
|
141 |
iOfflineQueryDialog = NULL;
|
|
142 |
|
|
143 |
iSSSettings.CancelAll( *this );
|
|
144 |
iSSSettings.Close();
|
|
145 |
|
|
146 |
delete iActiveProfileName;
|
|
147 |
delete iSwapProfileName;
|
|
148 |
|
|
149 |
iProfileNamePointerArray.ResetAndDestroy();
|
|
150 |
|
|
151 |
if ( iProfileNotifier )
|
|
152 |
{
|
|
153 |
iProfileNotifier->CancelAll();
|
|
154 |
}
|
|
155 |
|
|
156 |
delete iProfileNotifier;
|
|
157 |
|
|
158 |
if( iProfileEngine )
|
|
159 |
{
|
|
160 |
iProfileEngine->Release();
|
|
161 |
}
|
|
162 |
|
|
163 |
iResourceLoader.Close();
|
|
164 |
}
|
|
165 |
|
|
166 |
// ----------------------------------------------------------------------------
|
|
167 |
// CAiProfileEngine::DetermineTimedAndSilentStatesL()
|
|
168 |
//
|
|
169 |
// ----------------------------------------------------------------------------
|
|
170 |
//
|
|
171 |
void CAiProfileEngine::DetermineTimedAndSilentStatesL()
|
|
172 |
{
|
|
173 |
iTimed = EFalse;
|
|
174 |
iSilent = EFalse;
|
|
175 |
|
|
176 |
MProfileEngine* engine = CreateProfileEngineL();
|
|
177 |
|
|
178 |
iTimed = engine->IsActiveProfileTimedL();
|
|
179 |
|
|
180 |
MProfile* profile = engine->ActiveProfileLC();
|
|
181 |
|
|
182 |
iSilent = profile->IsSilent();
|
|
183 |
|
|
184 |
CleanupStack::PopAndDestroy(); // profile
|
|
185 |
|
|
186 |
engine->Release();
|
|
187 |
}
|
|
188 |
|
|
189 |
// ----------------------------------------------------------------------------
|
|
190 |
// CAiProfileEngine::UpdateProfileNamesL()
|
|
191 |
//
|
|
192 |
// ----------------------------------------------------------------------------
|
|
193 |
//
|
|
194 |
void CAiProfileEngine::UpdateProfileNamesL()
|
|
195 |
{
|
|
196 |
// Update active profile name
|
|
197 |
MProEngProfile* profile( iProfileEngine->ActiveProfileLC() );
|
|
198 |
|
|
199 |
const MProEngProfileName& name( profile->ProfileName() );
|
|
200 |
|
|
201 |
HBufC* activeProfileName( name.Name().AllocLC() );
|
|
202 |
|
|
203 |
SetActiveProfileNameL( *activeProfileName );
|
|
204 |
|
|
205 |
// Update profile name list
|
|
206 |
MProEngProfileNameArray* profileNamesArray(
|
|
207 |
iProfileEngine->ProfileNameArrayLC() );
|
|
208 |
|
|
209 |
SetProfileNameListL( *profileNamesArray );
|
|
210 |
|
|
211 |
// Update swap profile name
|
|
212 |
HBufC* swapProfileName( NULL );
|
|
213 |
|
|
214 |
TInt activeProfileId( iProfileEngine->ActiveProfileId() );
|
|
215 |
|
|
216 |
if( activeProfileId == KSilentProfileId )
|
|
217 |
{
|
|
218 |
TInt generalProfileIndex(
|
|
219 |
profileNamesArray->FindById( KGeneralProfileId ) );
|
|
220 |
|
|
221 |
if( generalProfileIndex > KErrNotFound )
|
|
222 |
{
|
|
223 |
swapProfileName =
|
|
224 |
profileNamesArray->MdcaPoint( generalProfileIndex ).AllocLC() ;
|
|
225 |
}
|
|
226 |
}
|
|
227 |
else
|
|
228 |
{
|
|
229 |
TInt silentProfileIndex(
|
|
230 |
profileNamesArray->FindById( KSilentProfileId ) );
|
|
231 |
|
|
232 |
if( silentProfileIndex > KErrNotFound )
|
|
233 |
{
|
|
234 |
swapProfileName =
|
|
235 |
profileNamesArray->MdcaPoint( silentProfileIndex ).AllocLC() ;
|
|
236 |
}
|
|
237 |
}
|
|
238 |
|
|
239 |
if( swapProfileName )
|
|
240 |
{
|
|
241 |
HBufC* activateProfileString( StringLoader::LoadLC(
|
|
242 |
R_AI_PERS_PROF_TOGGLE, swapProfileName->Des() ) );
|
|
243 |
|
|
244 |
SetSwapProfileNameL( *activateProfileString );
|
|
245 |
|
|
246 |
CleanupStack::PopAndDestroy( 2 ); // swapProfileName, activateProfileString
|
|
247 |
}
|
|
248 |
|
|
249 |
CleanupStack::PopAndDestroy( 3 ); //profile, profileName, profileNamesArray,
|
|
250 |
}
|
|
251 |
|
|
252 |
// ----------------------------------------------------------------------------
|
|
253 |
// CAiProfileEngine::ShowOfflineMessageL
|
|
254 |
//
|
|
255 |
// ----------------------------------------------------------------------------
|
|
256 |
//
|
|
257 |
TBool CAiProfileEngine::ShowOfflineMessageL()
|
|
258 |
{
|
|
259 |
TInt result( ETrue );
|
|
260 |
|
|
261 |
TInt simCardStatus( ESimNotPresent );
|
|
262 |
|
|
263 |
RProperty simStatus;
|
|
264 |
User::LeaveIfError( simStatus.Attach( KPSUidStartup, KPSSimStatus ) );
|
|
265 |
User::LeaveIfError( simStatus.Get( simCardStatus ) );
|
|
266 |
simStatus.Close();
|
|
267 |
|
|
268 |
if ( simCardStatus == ESimNotPresent )
|
|
269 |
{
|
|
270 |
// SIM card does not exist.
|
|
271 |
HBufC* infoNoteText = StringLoader::LoadLC( R_SU_NOTE_INSERT_SIM_AND_RESTART );
|
|
272 |
|
|
273 |
CAknInformationNote* note = new( ELeave ) CAknInformationNote( ETrue );
|
|
274 |
note->ExecuteLD( *infoNoteText );
|
|
275 |
|
|
276 |
CleanupStack::PopAndDestroy( infoNoteText );
|
|
277 |
|
|
278 |
result = EFalse;
|
|
279 |
}
|
|
280 |
else
|
|
281 |
{
|
|
282 |
if ( iOfflineQueryDialog == NULL )
|
|
283 |
{
|
|
284 |
iOfflineQueryDialog = CAknQueryDialog::NewL();
|
|
285 |
result = iOfflineQueryDialog->ExecuteLD( R_AI_LEAVE_OFFLINE_MODE_QUERY );
|
|
286 |
iOfflineQueryDialog = NULL;
|
|
287 |
}
|
|
288 |
}
|
|
289 |
|
|
290 |
return result;
|
|
291 |
}
|
|
292 |
|
|
293 |
// ----------------------------------------------------------------------------
|
|
294 |
// CAiProfileEngine::SetActiveProfileNameL
|
|
295 |
//
|
|
296 |
// ----------------------------------------------------------------------------
|
|
297 |
//
|
|
298 |
void CAiProfileEngine::SetActiveProfileNameL( const TDesC& aName )
|
|
299 |
{
|
|
300 |
HBufC* temp( aName.AllocL() );
|
|
301 |
|
|
302 |
TPtr profileNamePtr( temp->Des() );
|
|
303 |
|
|
304 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion( profileNamePtr );
|
|
305 |
|
|
306 |
delete iActiveProfileName;
|
|
307 |
iActiveProfileName = NULL;
|
|
308 |
|
|
309 |
iActiveProfileName = temp;
|
|
310 |
}
|
|
311 |
|
|
312 |
// ----------------------------------------------------------------------------
|
|
313 |
// CAiProfileEngine::ActiveProfileName
|
|
314 |
//
|
|
315 |
// ----------------------------------------------------------------------------
|
|
316 |
//
|
|
317 |
const TDesC& CAiProfileEngine::ActiveProfileName() const
|
|
318 |
{
|
|
319 |
if( iActiveProfileName )
|
|
320 |
{
|
|
321 |
return *iActiveProfileName;
|
|
322 |
}
|
|
323 |
|
|
324 |
return KNullDesC();
|
|
325 |
}
|
|
326 |
|
|
327 |
// ----------------------------------------------------------------------------
|
|
328 |
// CAiProfileEngine::SetSwapProfileNameL
|
|
329 |
//
|
|
330 |
// ----------------------------------------------------------------------------
|
|
331 |
//
|
|
332 |
void CAiProfileEngine::SetSwapProfileNameL( const TDesC& aName )
|
|
333 |
{
|
|
334 |
HBufC* temp( aName.AllocL() );
|
|
335 |
|
|
336 |
TPtr profileNamePtr( temp->Des() );
|
|
337 |
|
|
338 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion( profileNamePtr );
|
|
339 |
|
|
340 |
delete iSwapProfileName;
|
|
341 |
iSwapProfileName = NULL;
|
|
342 |
|
|
343 |
iSwapProfileName = temp;
|
|
344 |
}
|
|
345 |
|
|
346 |
// ----------------------------------------------------------------------------
|
|
347 |
// CAiProfileEngine::SwapProfileName
|
|
348 |
//
|
|
349 |
// ----------------------------------------------------------------------------
|
|
350 |
//
|
|
351 |
const TDesC& CAiProfileEngine::SwapProfileName() const
|
|
352 |
{
|
|
353 |
if( iSwapProfileName )
|
|
354 |
{
|
|
355 |
return *iSwapProfileName;
|
|
356 |
}
|
|
357 |
|
|
358 |
return KNullDesC();
|
|
359 |
}
|
|
360 |
|
|
361 |
// ----------------------------------------------------------------------------
|
|
362 |
// CAiProfileEngine::SetProfileNameListL
|
|
363 |
//
|
|
364 |
// ----------------------------------------------------------------------------
|
|
365 |
//
|
|
366 |
void CAiProfileEngine::SetProfileNameListL(
|
|
367 |
const MProEngProfileNameArray& aArray )
|
|
368 |
{
|
|
369 |
iProfileNamePointerArray.ResetAndDestroy();
|
|
370 |
|
|
371 |
const TInt count( aArray.MdcaCount() );
|
|
372 |
|
|
373 |
TBufC<KMaxProfileNameLength> profileName;
|
|
374 |
|
|
375 |
for ( TInt i = 0; i < count; i++ )
|
|
376 |
{
|
|
377 |
profileName = aArray.MdcaPoint( i );
|
|
378 |
|
|
379 |
TPtr profileNamePtr( profileName.Des() );
|
|
380 |
|
|
381 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(
|
|
382 |
profileNamePtr );
|
|
383 |
|
|
384 |
HBufC* profile( profileNamePtr.AllocLC() );
|
|
385 |
|
|
386 |
iProfileNamePointerArray.AppendL( profile );
|
|
387 |
CleanupStack::Pop( profile );
|
|
388 |
}
|
|
389 |
}
|
|
390 |
|
|
391 |
// ----------------------------------------------------------------------------
|
|
392 |
// CAiProfileEngine::ProfileNameByIndex
|
|
393 |
//
|
|
394 |
// ----------------------------------------------------------------------------
|
|
395 |
//
|
|
396 |
const TDesC& CAiProfileEngine::ProfileNameByIndex( TInt aIndex ) const
|
|
397 |
{
|
|
398 |
TInt count( iProfileNamePointerArray.Count() );
|
|
399 |
|
|
400 |
if( aIndex < count && aIndex >= 0 )
|
|
401 |
{
|
|
402 |
return *iProfileNamePointerArray[ aIndex ];
|
|
403 |
}
|
|
404 |
|
|
405 |
return KNullDesC();
|
|
406 |
}
|
|
407 |
|
|
408 |
// ----------------------------------------------------------------------------
|
|
409 |
// CAiProfileEngine::IsActiveProfileSilentL
|
|
410 |
//
|
|
411 |
// ----------------------------------------------------------------------------
|
|
412 |
//
|
|
413 |
TBool CAiProfileEngine::IsActiveProfileSilentL() const
|
|
414 |
{
|
|
415 |
return iSilent;
|
|
416 |
}
|
|
417 |
|
|
418 |
// ----------------------------------------------------------------------------
|
|
419 |
// CAiProfileEngine::IsActiveProfileTimedL
|
|
420 |
//
|
|
421 |
// ----------------------------------------------------------------------------
|
|
422 |
//
|
|
423 |
TBool CAiProfileEngine::IsActiveProfileTimedL() const
|
|
424 |
{
|
|
425 |
return iTimed;
|
|
426 |
}
|
|
427 |
|
|
428 |
// ----------------------------------------------------------------------------
|
|
429 |
// CAiProfileEngine::NumberOfProfiles
|
|
430 |
//
|
|
431 |
// ----------------------------------------------------------------------------
|
|
432 |
//
|
|
433 |
TInt CAiProfileEngine::NumberOfProfiles() const
|
|
434 |
{
|
|
435 |
return iProfileNamePointerArray.Count();
|
|
436 |
}
|
|
437 |
|
|
438 |
// ----------------------------------------------------------------------------
|
|
439 |
// CAiProfileEngine::HandleAiEventL
|
|
440 |
//
|
|
441 |
// ----------------------------------------------------------------------------
|
|
442 |
//
|
|
443 |
void CAiProfileEngine::HandleAiEventL( TInt aEvent, const TDesC& aParam )
|
|
444 |
{
|
|
445 |
switch ( aEvent )
|
|
446 |
{
|
|
447 |
case EAiProfileEventSwitchByIndex:
|
|
448 |
HandleSwitchByIndexL( aParam );
|
|
449 |
break;
|
|
450 |
|
|
451 |
case EAiProfileEventSwitchByName:
|
|
452 |
HandleSwitchByNameL( aParam );
|
|
453 |
break;
|
|
454 |
|
|
455 |
case EAiProfileEventSwap:
|
|
456 |
HandleSwapL( aParam );
|
|
457 |
break;
|
|
458 |
|
|
459 |
case EAiProfileEditActive:
|
|
460 |
HandleEditActiveProfileL();
|
|
461 |
break;
|
|
462 |
|
|
463 |
default:
|
|
464 |
break;
|
|
465 |
}
|
|
466 |
}
|
|
467 |
|
|
468 |
// ----------------------------------------------------------------------------
|
|
469 |
// CAiProfileEngine::HandleSwitchByIndexL
|
|
470 |
//
|
|
471 |
// ----------------------------------------------------------------------------
|
|
472 |
//
|
|
473 |
void CAiProfileEngine::HandleSwitchByIndexL( const TDesC& aParam )
|
|
474 |
{
|
|
475 |
if ( aParam.Length() > 0 )
|
|
476 |
{
|
|
477 |
TInt index( KErrNotFound );
|
|
478 |
TPtrC ptr( aParam );
|
|
479 |
TLex lexer( ptr );
|
|
480 |
|
|
481 |
TInt err( lexer.Val( index ) );
|
|
482 |
|
|
483 |
if ( err == KErrNone )
|
|
484 |
{
|
|
485 |
MProEngProfileNameArray* profileNamesArray(
|
|
486 |
iProfileEngine->ProfileNameArrayLC() );
|
|
487 |
|
|
488 |
TInt profileId( profileNamesArray->ProfileId( index ) );
|
|
489 |
|
|
490 |
if ( profileId != KErrNotFound )
|
|
491 |
{
|
|
492 |
SetActiveProfileL( profileId );
|
|
493 |
}
|
|
494 |
|
|
495 |
CleanupStack::PopAndDestroy();
|
|
496 |
}
|
|
497 |
}
|
|
498 |
}
|
|
499 |
|
|
500 |
// ----------------------------------------------------------------------------
|
|
501 |
// CAiProfileEngine::HandleSwitchByNameL
|
|
502 |
//
|
|
503 |
// ----------------------------------------------------------------------------
|
|
504 |
//
|
|
505 |
void CAiProfileEngine::HandleSwitchByNameL( const TDesC& aParam )
|
|
506 |
{
|
|
507 |
if ( aParam.Length() > 0 )
|
|
508 |
{
|
|
509 |
MProEngProfileNameArray* profileNamesArray(
|
|
510 |
iProfileEngine->ProfileNameArrayLC() );
|
|
511 |
|
|
512 |
TInt index( profileNamesArray->FindByName( aParam ) );
|
|
513 |
|
|
514 |
if( index != KErrNotFound )
|
|
515 |
{
|
|
516 |
SetActiveProfileL( profileNamesArray->ProfileId( index ) );
|
|
517 |
}
|
|
518 |
|
|
519 |
CleanupStack::PopAndDestroy();
|
|
520 |
}
|
|
521 |
}
|
|
522 |
|
|
523 |
// ----------------------------------------------------------------------------
|
|
524 |
// CAiProfileEngine::HandleSwapL
|
|
525 |
//
|
|
526 |
// ----------------------------------------------------------------------------
|
|
527 |
//
|
|
528 |
void CAiProfileEngine::HandleSwapL( const TDesC& aParam )
|
|
529 |
{
|
|
530 |
if ( aParam.Length() > 0 )
|
|
531 |
{
|
|
532 |
TInt profileId( KErrNotFound );
|
|
533 |
TPtrC ptr( aParam );
|
|
534 |
TLex lexer( ptr );
|
|
535 |
|
|
536 |
TInt err( lexer.Val( profileId ) );
|
|
537 |
|
|
538 |
if ( err == KErrNone )
|
|
539 |
{
|
|
540 |
TInt activeProfile( iProfileEngine->ActiveProfileId() );
|
|
541 |
|
|
542 |
if( activeProfile != profileId )
|
|
543 |
{
|
|
544 |
MProEngProfileNameArray* profileNamesArray(
|
|
545 |
iProfileEngine->ProfileNameArrayLC() );
|
|
546 |
|
|
547 |
profileId = profileNamesArray->FindById( profileId );
|
|
548 |
|
|
549 |
if( profileId != KErrNotFound )
|
|
550 |
{
|
|
551 |
SetActiveProfileL( profileId );
|
|
552 |
}
|
|
553 |
|
|
554 |
CleanupStack::PopAndDestroy();
|
|
555 |
}
|
|
556 |
else
|
|
557 |
{
|
|
558 |
SetActiveProfileL( KGeneralProfileId );
|
|
559 |
}
|
|
560 |
}
|
|
561 |
}
|
|
562 |
}
|
|
563 |
|
|
564 |
// ----------------------------------------------------------------------------
|
|
565 |
// CAiProfileEngine::HandleEditActiveProfileL
|
|
566 |
//
|
|
567 |
// ----------------------------------------------------------------------------
|
|
568 |
//
|
|
569 |
void CAiProfileEngine::HandleEditActiveProfileL()
|
|
570 |
{
|
|
571 |
RWsSession ws;
|
|
572 |
User::LeaveIfError( ws.Connect() );
|
|
573 |
CleanupClosePushL( ws );
|
|
574 |
|
|
575 |
// Find the task with uid
|
|
576 |
TApaTaskList taskList( ws );
|
|
577 |
TApaTask task( taskList.FindApp( KUidProfileApp ) );
|
|
578 |
|
|
579 |
if ( task.Exists() )
|
|
580 |
{
|
|
581 |
task.EndTask();
|
|
582 |
User::After( 500000 );
|
|
583 |
}
|
|
584 |
|
|
585 |
CleanupStack::PopAndDestroy( &ws );
|
|
586 |
|
|
587 |
TVwsViewId viewid( KUidProfileApp, KProfileAppSettingViewId );
|
|
588 |
|
|
589 |
TInt profileId( iProfileEngine->ActiveProfileId() );
|
|
590 |
|
|
591 |
TBuf8<KMaxActiveProfileLength> buf;
|
|
592 |
buf.AppendNum( profileId );
|
|
593 |
|
|
594 |
CEikonEnv::Static()->AppUi()->ActivateViewL(
|
|
595 |
viewid, KProfileAppSettingViewId, buf );
|
|
596 |
}
|
|
597 |
|
|
598 |
// ----------------------------------------------------------------------------
|
|
599 |
// CAiProfileEngine::SetActiveProfileL
|
|
600 |
//
|
|
601 |
// ----------------------------------------------------------------------------
|
|
602 |
//
|
|
603 |
void CAiProfileEngine::SetActiveProfileL( const TInt aProfileId )
|
|
604 |
{
|
|
605 |
TInt activeProfileId( iProfileEngine->ActiveProfileId() );
|
|
606 |
|
|
607 |
if ( activeProfileId == KOfflineProfileId &&
|
|
608 |
aProfileId != KOfflineProfileId )
|
|
609 |
{
|
|
610 |
if( !ShowOfflineMessageL() )
|
|
611 |
{
|
|
612 |
// User doesn't want to activate RF or
|
|
613 |
// SIM card does not exist.
|
|
614 |
return;
|
|
615 |
}
|
|
616 |
}
|
|
617 |
|
|
618 |
iProfileEngine->SetActiveProfileL( aProfileId );
|
|
619 |
}
|
|
620 |
|
|
621 |
// ----------------------------------------------------------------------------
|
|
622 |
// CAiProfileEngine::IsOffline
|
|
623 |
//
|
|
624 |
// ----------------------------------------------------------------------------
|
|
625 |
//
|
|
626 |
TBool CAiProfileEngine::IsOffline() const
|
|
627 |
{
|
|
628 |
return iProfileEngine->ActiveProfileId() == KOfflineProfileId;
|
|
629 |
}
|
|
630 |
|
|
631 |
// ----------------------------------------------------------------------------
|
|
632 |
// CAiProfileEngine::PhoneSettingChanged
|
|
633 |
//
|
|
634 |
// ----------------------------------------------------------------------------
|
|
635 |
//
|
|
636 |
void CAiProfileEngine::PhoneSettingChanged( TSSSettingsSetting aSetting,
|
|
637 |
TInt /*aNewValue*/ )
|
|
638 |
{
|
|
639 |
if( aSetting == ESSSettingsAls )
|
|
640 |
{
|
|
641 |
NotifyContentUpdate();
|
|
642 |
}
|
|
643 |
}
|
|
644 |
|
|
645 |
// ----------------------------------------------------------------------------
|
|
646 |
// CAiProfileEngine::HandleActiveProfileModifiedL
|
|
647 |
//
|
|
648 |
// ----------------------------------------------------------------------------
|
|
649 |
//
|
|
650 |
void CAiProfileEngine::HandleActiveProfileModifiedL()
|
|
651 |
{
|
|
652 |
DetermineTimedAndSilentStatesL();
|
|
653 |
|
|
654 |
NotifyContentUpdate();
|
|
655 |
}
|
|
656 |
|
|
657 |
// ----------------------------------------------------------------------------
|
|
658 |
// CAiProfileEngine::HandleProfileNameArrayModificationL
|
|
659 |
//
|
|
660 |
// ----------------------------------------------------------------------------
|
|
661 |
//
|
|
662 |
void CAiProfileEngine::HandleProfileNameArrayModificationL()
|
|
663 |
{
|
|
664 |
NotifyContentUpdate();
|
|
665 |
}
|
|
666 |
|
|
667 |
// ----------------------------------------------------------------------------
|
|
668 |
// CAiProfileEngine::HandleProfileActivatedL
|
|
669 |
//
|
|
670 |
// ----------------------------------------------------------------------------
|
|
671 |
//
|
|
672 |
void CAiProfileEngine::HandleProfileActivatedL( TInt /*aProfileId*/ )
|
|
673 |
{
|
|
674 |
// prevents duplicate offline notes on the screen.
|
|
675 |
if ( iOfflineQueryDialog )
|
|
676 |
{
|
|
677 |
delete iOfflineQueryDialog;
|
|
678 |
iOfflineQueryDialog = NULL;
|
|
679 |
}
|
|
680 |
|
|
681 |
DetermineTimedAndSilentStatesL();
|
|
682 |
|
|
683 |
NotifyContentUpdate();
|
|
684 |
}
|
|
685 |
|
|
686 |
// ----------------------------------------------------------------------------
|
|
687 |
// CAiProfileEngine::NotifyContentUpdate
|
|
688 |
//
|
|
689 |
// ----------------------------------------------------------------------------
|
|
690 |
//
|
|
691 |
void CAiProfileEngine::NotifyContentUpdate()
|
|
692 |
{
|
|
693 |
TRAP_IGNORE( UpdateProfileNamesL() );
|
|
694 |
|
|
695 |
iProfilePluginNotifier->NotifyContentUpdate();
|
|
696 |
}
|
|
697 |
|
|
698 |
// End of file
|