1 /* |
|
2 * Copyright (c) 2002 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: Container class of settings view. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // CLASS HEADER |
|
21 #include "CProfileSettingsContainer.h" |
|
22 |
|
23 // INTERNAL INCLUDES |
|
24 #include "CProfileEngineHandler.h" |
|
25 #include "CProfileIndexHandler.h" |
|
26 #include "CProfileTabHandler.h" |
|
27 #include "ProfileSettingsView.hrh" |
|
28 #include "CProfile3dSettingItem.h" |
|
29 #include "CProfileFeedbackSettingItem.h" |
|
30 #include "CProfileVibraSettingItem.h" |
|
31 #include "CProfilePlayingVolumeSettingItem.h" |
|
32 #include "CProfileNameSettingItem.h" |
|
33 #include "CProfileKeypadVolumeSettingItem.h" |
|
34 #include "CProfileFileListSettingItem.h" |
|
35 #include "CProfileAlertForSettingItem.h" |
|
36 #include "CProfileStruct.h" |
|
37 #include "MProfilesLocalFeatures.h" |
|
38 #include "ProfilesVariant.hrh" // KProEngFeatureIdVTRingingTone |
|
39 #include "CProfileSettingsView.h" |
|
40 #include "MProfileViewHandler.h" |
|
41 #include "ProfilesDebug.h" |
|
42 |
|
43 // EXTERNAL INCLUDES |
|
44 #include <AknDef.h> |
|
45 #include <aknview.h> |
|
46 #include <akntitle.h> |
|
47 #include <akntextsettingpage.h> |
|
48 #include <aknsoundsystem.h> |
|
49 #include <eikapp.h> |
|
50 #include <csxhelp/mode.hlp.hrh> |
|
51 #include <featmgr.h> |
|
52 #include <MProfileExtended.h> |
|
53 |
|
54 #include <MProfileTones.h> |
|
55 #include <MProfile3DToneSettings.h> |
|
56 #include <MProfileFeedbackSettings.h> |
|
57 #include <MProfileExtraSettings.h> |
|
58 |
|
59 #include <MProfileEngineExtended.h> |
|
60 #include <MProfilesNamesArray.h> |
|
61 #include <MProfileName.h> |
|
62 #include <CProfileChangeNotifyHandler.h> |
|
63 #include <profilesettingsview.rsg> |
|
64 #include <data_caging_path_literals.hrh> |
|
65 #include <centralrepository.h> |
|
66 #include <settingsinternalcrkeys.h> |
|
67 #include <bautils.h> // For BaflUtils |
|
68 #include <StringLoader.h> // For StringLoader |
|
69 #include <ProfileEngineSDKCRKeys.h> // For KCRUidProfileEngine |
|
70 #include <ProfileEngineInternalCRKeys.h> // For KProEngDefaultRingingTone |
|
71 #include <AknQueryDialog.h> // For CAknQueryDialog |
|
72 #include "CProfileNaviPaneContainer.h" // For CProfileNaviPaneContainer |
|
73 #include <aknnotewrappers.h> // For CAknInformationNote |
|
74 |
|
75 // for power save mode handling |
|
76 #include <psmsettings.h> |
|
77 #include <psmsrvdomaincrkeys.h> |
|
78 #include <e32property.h> |
|
79 #include <ProfileEnginePrivatePSKeys.h> |
|
80 #include <TProfileToneSettings.h> |
|
81 |
|
82 namespace |
|
83 { |
|
84 // CONSTANTS |
|
85 const TUid KUidProfileApp = { 0x100058F8 }; // UID of the application |
|
86 const TInt KVoIPOFF = 0; |
|
87 |
|
88 const TInt KFileCheckDelay = 100000; // microseconds |
|
89 const TInt KFileCheckInterval = 5000000; |
|
90 |
|
91 _LIT( KSettingsViewResourceFileName, "z:PROFILESETTINGSVIEW.RSC" ); |
|
92 |
|
93 } |
|
94 |
|
95 // ============================ MEMBER FUNCTIONS =============================== |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // CProfileSettingsContainer::CProfileSettingsContainer |
|
99 // C++ constructor can NOT contain any code, that might leave. |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 CProfileSettingsContainer::CProfileSettingsContainer( |
|
103 MProfileViewHandler& aProfileViewHandler, |
|
104 CProfileEngineHandler& aEngineHandler, |
|
105 MProfileExternalSettingsHandler& aExternalSettingsHandler, |
|
106 CProfileIndexHandler* aIndexHandler, |
|
107 CProfileTabHandler* aTabHandler, |
|
108 CAknTitlePane* aTitlePane ) |
|
109 : |
|
110 iResourceLoader( *iCoeEnv ), |
|
111 iProfileViewHandler( aProfileViewHandler ), |
|
112 iEngineHandler( aEngineHandler ), |
|
113 iExternalSettingsHandler( aExternalSettingsHandler ), |
|
114 iIndexHandler( aIndexHandler ), |
|
115 iTabHandler( aTabHandler ), |
|
116 iTitlePane( aTitlePane ), |
|
117 iAlternateLineService( EFalse ) |
|
118 { |
|
119 SetMopParent( &( iProfileViewHandler.View() ) ); |
|
120 } |
|
121 |
|
122 // ----------------------------------------------------------------------------- |
|
123 // CProfileSettingsContainer::ConstructL |
|
124 // Symbian 2nd phase constructor can leave. |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 void CProfileSettingsContainer::ConstructL( const TRect& aRect, |
|
128 TInt aResourceId ) |
|
129 { |
|
130 iFs = new ( ELeave ) RFs; |
|
131 User::LeaveIfError( iFs->Connect() ); |
|
132 |
|
133 PRODEBUG1( "CProfileSettingsContainer ConstructL(%d)",aResourceId ); |
|
134 if( iIndexHandler ) |
|
135 { |
|
136 iIndexHandler->CreateIndexArrayL(); |
|
137 } |
|
138 |
|
139 iCopyProfile = CProfileStruct::NewL(); |
|
140 |
|
141 iLocalFeatures = &( iEngineHandler.Engine()->LocalFeatures() ); |
|
142 |
|
143 // Read settings of currently selected profile |
|
144 ReadProfileL(); |
|
145 |
|
146 // Read alternate line service setting and register as observer |
|
147 if( iSSSettings.Open() == KErrNone ) |
|
148 { |
|
149 iSSSettings.Register( ESSSettingsAls, *this ); // ignore return value |
|
150 TInt als( ESSSettingsAlsNotSupported ); |
|
151 iSSSettings.Get( ESSSettingsAls, als ); // ignore return value |
|
152 if( als != ESSSettingsAlsNotSupported ) |
|
153 { |
|
154 iAlternateLineService = ETrue; |
|
155 } |
|
156 } |
|
157 |
|
158 // CRepository session for TTS ringingtone |
|
159 iTTSSession = CRepository::NewL( KCRUidProfilesLV ); |
|
160 |
|
161 iDefaultTone = new( ELeave ) TFileName(); |
|
162 |
|
163 iSession = CRepository::NewL(KCRUidProfileEngine); |
|
164 User::LeaveIfError( iSession->Get( KProEngDefaultRingingTone, *iDefaultTone ) ); |
|
165 |
|
166 TInt VoIPSupported( 0 ); |
|
167 iVoIPVariation = CRepository::NewL( KCRUidTelephonySettings ); |
|
168 iVoIPVariation->Get( KDynamicVoIP, VoIPSupported ); |
|
169 iVoIPVariationNotifier = CCenRepNotifyHandler::NewL( *this, *iVoIPVariation, |
|
170 CCenRepNotifyHandler::EIntKey, KDynamicVoIP ); |
|
171 iVoIPVariationNotifier->StartListeningL(); |
|
172 |
|
173 iVoIPStatus = KVoIPOFF != VoIPSupported; |
|
174 |
|
175 iKeySounds = static_cast< CAknAppUi* > ( iEikonEnv->AppUi() )->KeySounds(); |
|
176 |
|
177 TParse* fp = new(ELeave) TParse(); |
|
178 fp->Set(KSettingsViewResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL); |
|
179 TFileName resourceFileName( fp->FullName() ); |
|
180 delete fp; |
|
181 |
|
182 iResourceLoader.OpenL( resourceFileName ); |
|
183 |
|
184 // Construct the setting items |
|
185 CAknSettingItemList::ConstructFromResourceL( aResourceId ); |
|
186 // Hide all items that must be hidden |
|
187 SetHiddenFlagsL(); |
|
188 |
|
189 if( iIndexHandler ) |
|
190 { |
|
191 iIndexHandler->SetListBox( ListBox() ); |
|
192 } |
|
193 if( iTabHandler ) |
|
194 { |
|
195 iTabHandler->SetTabObserver( this ); |
|
196 } |
|
197 else |
|
198 { |
|
199 // If the iTabHandler is NULL, set the navi label text to |
|
200 // the name of current profile. |
|
201 iNaviPaneContainer = CProfileNaviPaneContainer::NewL( |
|
202 *( iAvkonAppUi->StatusPane() ), iEngineHandler ); |
|
203 |
|
204 MProfilesNamesArray* nameArray = iEngineHandler.IdArray(); |
|
205 if( iIndexHandler ) |
|
206 { |
|
207 iNaviPaneContainer->SetNaviPaneTextL( |
|
208 nameArray->MdcaPoint( iIndexHandler->CurrentProfileIndex() ) ); |
|
209 } |
|
210 } |
|
211 |
|
212 iNotifier = CProfileChangeNotifyHandler::NewL( this ); |
|
213 |
|
214 iExternalSettingsHandler.SetObserver( *this ); |
|
215 SetRect( aRect ); |
|
216 ActivateL(); |
|
217 PRODEBUG1( "CProfileSettingsContainer ConstructL(%d) return",aResourceId ); |
|
218 |
|
219 //CheckFileExistenceL(); |
|
220 // If CheckFileExistenceL is called directly from |
|
221 // ConstructL, DoActivateL in ProfileApp::CProfileSettingsView will be |
|
222 // blocked while the notes are displayed, causing problems. |
|
223 // This timer will trigger only once (after 100 ms). After |
|
224 // that it will be destroyed. |
|
225 iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
226 iPeriodic->Start(KFileCheckDelay, |
|
227 KFileCheckInterval, |
|
228 TCallBack( CProfileSettingsContainer::StartFileCheckL, this ) |
|
229 ); |
|
230 |
|
231 } |
|
232 |
|
233 // ----------------------------------------------------------------------------- |
|
234 // CProfileSettingsContainer::NewL |
|
235 // Two-phased constructor. Note, this constructor is DEPRECATED and will return |
|
236 // only NULL if called. |
|
237 // ----------------------------------------------------------------------------- |
|
238 // |
|
239 EXPORT_C CProfileSettingsContainer* CProfileSettingsContainer::NewL( |
|
240 CAknView& /* aAknView */, |
|
241 CProfileEngineHandler& /* aEngineHandler */, |
|
242 CProfileIndexHandler* /* aIndexHandler */, |
|
243 CProfileTabHandler* /* aTabHandler */, |
|
244 CAknTitlePane* /* aTitlePane */ ) |
|
245 { |
|
246 return NULL; |
|
247 } |
|
248 |
|
249 // ----------------------------------------------------------------------------- |
|
250 // CProfileSettingsContainer::NewL |
|
251 // Two-phased constructor. |
|
252 // ----------------------------------------------------------------------------- |
|
253 // |
|
254 EXPORT_C CProfileSettingsContainer* CProfileSettingsContainer::NewL( |
|
255 MProfileViewHandler& aProfileViewHandler, |
|
256 CProfileEngineHandler& aEngineHandler, |
|
257 MProfileExternalSettingsHandler& aExternalSettingsHandler, |
|
258 CProfileIndexHandler* aIndexHandler, |
|
259 CProfileTabHandler* aTabHandler, |
|
260 CAknTitlePane* aTitlePane ) |
|
261 { |
|
262 return CProfileSettingsContainer::NewL( aProfileViewHandler, aEngineHandler, |
|
263 aExternalSettingsHandler, aIndexHandler, aTabHandler, aTitlePane, |
|
264 R_PROFILE_SETTING_ITEM_LIST ); |
|
265 } |
|
266 |
|
267 // ----------------------------------------------------------------------------- |
|
268 // CProfileSettingsContainer::NewL |
|
269 // Two-phased constructor. |
|
270 // ----------------------------------------------------------------------------- |
|
271 // |
|
272 EXPORT_C CProfileSettingsContainer* CProfileSettingsContainer::NewL( |
|
273 MProfileViewHandler& aProfileViewHandler, |
|
274 CProfileEngineHandler& aEngineHandler, |
|
275 MProfileExternalSettingsHandler& aExternalSettingsHandler, |
|
276 CProfileIndexHandler* aIndexHandler, |
|
277 CProfileTabHandler* aTabHandler, |
|
278 CAknTitlePane* aTitlePane, |
|
279 TInt aResourceId ) |
|
280 { |
|
281 CProfileSettingsContainer* self = new( ELeave ) CProfileSettingsContainer( |
|
282 aProfileViewHandler, aEngineHandler, aExternalSettingsHandler, |
|
283 aIndexHandler, aTabHandler, aTitlePane ); |
|
284 CleanupStack::PushL( self ); |
|
285 self->ConstructL( aProfileViewHandler.View().ClientRect(), aResourceId ); |
|
286 CleanupStack::Pop( self ); |
|
287 return self; |
|
288 } |
|
289 |
|
290 // Destructor. |
|
291 CProfileSettingsContainer::~CProfileSettingsContainer() |
|
292 { |
|
293 if( iPeriodic ) |
|
294 { |
|
295 iPeriodic->Cancel(); |
|
296 delete iPeriodic; |
|
297 } |
|
298 |
|
299 if( iFs ) |
|
300 { |
|
301 iFs->Close(); |
|
302 } |
|
303 delete iFs; |
|
304 |
|
305 PRODEBUG( "~CProfileSettingsContainer begin" ); |
|
306 delete iNotifier; |
|
307 PRODEBUG( "~CProfileSettingsContainer 2" ); |
|
308 if( iTabHandler ) |
|
309 { |
|
310 iTabHandler->SetTabObserver( NULL ); |
|
311 } |
|
312 PRODEBUG( "~CProfileSettingsContainer 3" ); |
|
313 if( iIndexHandler ) |
|
314 { |
|
315 iIndexHandler->SetListBox( NULL ); |
|
316 } |
|
317 PRODEBUG( "~CProfileSettingsContainer 4" ); |
|
318 iResourceLoader.Close(); |
|
319 PRODEBUG( "~CProfileSettingsContainer 5" ); |
|
320 ReleaseProfile(); |
|
321 PRODEBUG( "~CProfileSettingsContainer 6" ); |
|
322 delete iCopyProfile; |
|
323 PRODEBUG( "~CProfileSettingsContainer 7" ); |
|
324 |
|
325 if ( iVoIPVariationNotifier ) |
|
326 { |
|
327 iVoIPVariationNotifier->StopListening(); |
|
328 delete iVoIPVariationNotifier; |
|
329 } |
|
330 if ( iVoIPVariation ) |
|
331 { |
|
332 delete iVoIPVariation; |
|
333 } |
|
334 |
|
335 delete iTTSSession; |
|
336 delete iSession; |
|
337 |
|
338 delete iDefaultTone; |
|
339 PRODEBUG( "~CProfileSettingsContainer 8" ); |
|
340 |
|
341 iSSSettings.Close(); |
|
342 PRODEBUG( "~CProfileSettingsContainer end" ); |
|
343 delete iNaviPaneContainer; |
|
344 } |
|
345 |
|
346 // ------------------------------------------------------------------------------ |
|
347 // CProfileSettingsContainer::StartFileCheckL |
|
348 // ------------------------------------------------------------------------------ |
|
349 // |
|
350 TInt CProfileSettingsContainer::StartFileCheckL( TAny* aObj ) |
|
351 { |
|
352 static_cast<CProfileSettingsContainer*>(aObj)->DoFileCheckL(); |
|
353 return 1; |
|
354 } |
|
355 |
|
356 // ------------------------------------------------------------------------------ |
|
357 // CProfileSettingsContainer::DoFileCheckL |
|
358 // ------------------------------------------------------------------------------ |
|
359 // |
|
360 void CProfileSettingsContainer::DoFileCheckL() |
|
361 { |
|
362 if( iPeriodic ) |
|
363 { |
|
364 iPeriodic->Cancel(); |
|
365 delete iPeriodic; |
|
366 iPeriodic = NULL; |
|
367 } |
|
368 |
|
369 CheckFileExistenceL(); |
|
370 } |
|
371 |
|
372 // ----------------------------------------------------------------------------- |
|
373 // CProfileSettingsContainer::AllowedToChange |
|
374 // ----------------------------------------------------------------------------- |
|
375 // |
|
376 EXPORT_C TBool CProfileSettingsContainer::AllowedToChange( |
|
377 TInt aSettingItemId ) const |
|
378 { |
|
379 TUint32 flags( iProfile->ModifiableFlags() ); |
|
380 switch( aSettingItemId ) |
|
381 { |
|
382 // Fall through: If ringing tone is not allowed to change, then none of |
|
383 // these setting items are allowed to change. |
|
384 case EProfileSettingRingingToneId: |
|
385 case EProfileSettingRingingToneLine1Id: |
|
386 case EProfileSettingRingingToneLine2Id: |
|
387 { |
|
388 TInt profileId( 0 ); |
|
389 // Get id of the edited profile |
|
390 profileId=iProfile->ProfileName().Id(); |
|
391 if( profileId == EProfileOffLineId ) |
|
392 { |
|
393 // VOIP Changes: WLAN can be enabled also in off-line profile |
|
394 TBool featuresSupported( |
|
395 FeatureManager::FeatureSupported(KFeatureIdCommonVoip) |
|
396 && |
|
397 FeatureManager::FeatureSupported(KFeatureIdProtocolWlan) |
|
398 ); |
|
399 return ( ( flags & EProfileFlagRingingTone ) && |
|
400 featuresSupported && iVoIPStatus ); |
|
401 } |
|
402 else |
|
403 { |
|
404 return flags & EProfileFlagRingingTone; |
|
405 } |
|
406 } |
|
407 |
|
408 |
|
409 case EProfileSettingVideoCallToneId: |
|
410 { |
|
411 return flags & EProfileFlagVideoCallRingingTone; |
|
412 } |
|
413 case EProfileSettingRingingTypeId: |
|
414 { |
|
415 return flags & EProfileFlagRingingType; |
|
416 } |
|
417 case EProfileSettingRingingVolumeId: |
|
418 { |
|
419 return flags & EProfileFlagRingingVolume; |
|
420 } |
|
421 case EProfileSettingMediaVolumeId: |
|
422 { |
|
423 return flags & EProfileFlagMediaVolume; |
|
424 } |
|
425 case EProfileSettingMessageAlertToneId: |
|
426 { |
|
427 return flags & EProfileFlagMessageAlertTone; |
|
428 } |
|
429 case EProfileSettingEmailAlertToneId: |
|
430 { |
|
431 return flags & EProfileFlagEmailAlertTone; |
|
432 } |
|
433 case EProfileSettingVibratingAlertId: |
|
434 { |
|
435 return flags & EProfileFlagVibratingAlert; |
|
436 } |
|
437 case EProfileSettingEmailVibratingAlertId: |
|
438 { |
|
439 return flags & EProfileFlagVibratingAlert; |
|
440 } |
|
441 case EProfileSettingKeypadVolumeId: |
|
442 { |
|
443 return flags & EProfileFlagKeypadVolume; |
|
444 } |
|
445 case EProfileSettingWarningAndGameTonesId: |
|
446 { |
|
447 return flags & EProfileFlagWarningTones; |
|
448 } |
|
449 case EProfileSettingTTSRingingToneId: |
|
450 { |
|
451 return flags & EProfileFlagTextToSpeechTone; |
|
452 } |
|
453 case EProfileSettingAlertForId: |
|
454 { |
|
455 return flags & EProfileFlagAlertFor; |
|
456 } |
|
457 case EProfileSettingProfileNameId: |
|
458 { |
|
459 return flags & EProfileFlagProfileName; |
|
460 } |
|
461 case EProfileSettingPTTRingingToneId: |
|
462 { |
|
463 return flags & EProfileFlagPttTone; |
|
464 } |
|
465 case EProfileSettingPTTStatusId: |
|
466 { |
|
467 return flags & EProfileFlagPttStatus; |
|
468 } |
|
469 case EProfileSettingTactileFeedbackId: |
|
470 { |
|
471 return flags & EProfileFlagTactileFeedback; |
|
472 } |
|
473 case EProfileSettingAudioFeedbackId: |
|
474 { |
|
475 return flags & EProfileFlagAudioFeedback; |
|
476 } |
|
477 case EProfileSetting3dEffectId: |
|
478 { |
|
479 return flags & EProfileFlag3DEffect; |
|
480 } |
|
481 case EProfileSetting3dEchoId: |
|
482 { |
|
483 return flags & EProfileFlag3DEcho; |
|
484 } |
|
485 |
|
486 default: |
|
487 { |
|
488 return iExternalSettingsHandler.AllowedToChange( aSettingItemId ); |
|
489 } |
|
490 } |
|
491 } |
|
492 |
|
493 // ----------------------------------------------------------------------------- |
|
494 // CProfileSettingsContainer::ReleaseProfile |
|
495 // ----------------------------------------------------------------------------- |
|
496 // |
|
497 void CProfileSettingsContainer::ReleaseProfile() |
|
498 { |
|
499 if( iProfile ) |
|
500 { |
|
501 iProfile->Release(); |
|
502 iProfile = NULL; |
|
503 } |
|
504 } |
|
505 |
|
506 // ----------------------------------------------------------------------------- |
|
507 // CProfileSettingsContainer::ReadProfileL |
|
508 // ----------------------------------------------------------------------------- |
|
509 // |
|
510 void CProfileSettingsContainer::ReadProfileL() |
|
511 { |
|
512 TInt profileId( KErrNotFound ); |
|
513 if( iIndexHandler ) |
|
514 { |
|
515 // Index handler is set, get id of the edited profile |
|
516 profileId = iEngineHandler.IdForIndex( |
|
517 iIndexHandler->CurrentProfileIndex() ); |
|
518 } |
|
519 else |
|
520 { |
|
521 // Index handler is not set. |
|
522 profileId = User::LeaveIfError( |
|
523 iEngineHandler.Engine()->ActiveProfileId() ); |
|
524 } |
|
525 MProfileExtended* profile = iEngineHandler.Engine()->ProfileLC( profileId ); |
|
526 iCopyProfile->LoadL( profile ); |
|
527 CleanupStack::Pop(); // profile |
|
528 ReleaseProfile(); // delete old iProfile |
|
529 iProfile = profile; |
|
530 } |
|
531 |
|
532 // ----------------------------------------------------------------------------- |
|
533 // CProfileSettingsContainer::SetHiddenFlagsL |
|
534 // ----------------------------------------------------------------------------- |
|
535 // |
|
536 void CProfileSettingsContainer::SetHiddenFlagsL() |
|
537 { |
|
538 CAknSettingItemArray* array = SettingItemArray(); |
|
539 TUint32 flags( iProfile->VisibleFlags() ); |
|
540 TInt profileId( 0 ); |
|
541 const MProfileTones& tones = iProfile->ProfileTones(); |
|
542 const TProfileToneSettings& toneSettings = tones.ToneSettings(); |
|
543 |
|
544 TBool hide3DEcho = EFalse; |
|
545 TInt effect = iProfile->ProfileExtraSettings().Profile3DToneSettings().Effect(); |
|
546 if ( effect == EProfile3DEffectOff || effect == EProfile3DEffectStereoWidening ) |
|
547 { |
|
548 hide3DEcho = ETrue; |
|
549 } |
|
550 |
|
551 // Get id of the edited profile |
|
552 profileId=iProfile->ProfileName().Id(); |
|
553 |
|
554 if( profileId == EProfileOffLineId ) |
|
555 { |
|
556 TBool featuresSupported( |
|
557 FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) && |
|
558 FeatureManager::FeatureSupported( KFeatureIdProtocolWlan) ); |
|
559 SetItemHidden( EProfileSettingRingingToneId, array, |
|
560 ( iAlternateLineService ) || ( ( ~flags & EProfileFlagRingingTone ) |
|
561 || !featuresSupported || !iVoIPStatus ) ); |
|
562 SetItemHidden( EProfileSettingRingingToneLine1Id, array, |
|
563 ( !iAlternateLineService ) || ( ( ~flags & EProfileFlagRingingTone ) |
|
564 || !featuresSupported || !iVoIPStatus ) ); |
|
565 SetItemHidden( EProfileSettingRingingToneLine2Id, array, |
|
566 ( !iAlternateLineService ) || ( ( ~flags & EProfileFlagRingingTone ) |
|
567 || !featuresSupported || !iVoIPStatus ) ); |
|
568 SetItemHidden( EProfileSetting3dEffectId, array, |
|
569 !( ( FeatureManager::FeatureSupported( KFeatureId3DRingingTones ) ) && |
|
570 ( flags & EProfileFlag3DEffect ) && featuresSupported ) ); |
|
571 SetItemHidden( EProfileSetting3dEchoId, array, |
|
572 !( ( FeatureManager::FeatureSupported( KFeatureId3DRingingTones ) ) && |
|
573 ( flags & EProfileFlag3DEcho ) && featuresSupported ) ); |
|
574 } |
|
575 else |
|
576 { |
|
577 SetItemHidden( EProfileSettingRingingToneId, array, |
|
578 ( iAlternateLineService ) || ( ~flags & EProfileFlagRingingTone ) ); |
|
579 SetItemHidden( EProfileSettingRingingToneLine1Id, array, |
|
580 ( !iAlternateLineService ) || ( ~flags & EProfileFlagRingingTone ) ); |
|
581 SetItemHidden( EProfileSettingRingingToneLine2Id, array, |
|
582 ( !iAlternateLineService ) || ( ~flags & EProfileFlagRingingTone ) ); |
|
583 SetItemHidden( EProfileSetting3dEffectId, array, |
|
584 !( ( FeatureManager::FeatureSupported( KFeatureId3DRingingTones ) ) && |
|
585 ( flags & EProfileFlag3DEffect ) ) ); |
|
586 SetItemHidden( EProfileSetting3dEchoId, array, |
|
587 !( ( FeatureManager::FeatureSupported( KFeatureId3DRingingTones ) ) && |
|
588 ( flags & EProfileFlag3DEcho ) ) ); |
|
589 } |
|
590 |
|
591 if ( hide3DEcho ) |
|
592 { |
|
593 SetItemHidden( EProfileSetting3dEchoId, array, ETrue ); |
|
594 } |
|
595 |
|
596 SetItemHidden( EProfileSettingVideoCallToneId, array, |
|
597 !( ( iLocalFeatures->IsFeatureSupported( |
|
598 KProEngFeatureIdVTRingingTone ) ) && |
|
599 ( flags & EProfileFlagVideoCallRingingTone ) && |
|
600 FeatureManager::FeatureSupported( KFeatureIdCsVideoTelephony ) ) ); |
|
601 |
|
602 SetItemHidden( EProfileSettingMessageAlertToneId, array, |
|
603 ~flags & EProfileFlagMessageAlertTone ); |
|
604 |
|
605 SetItemHidden( EProfileSettingEmailAlertToneId, array, |
|
606 !( ( FeatureManager::FeatureSupported( KFeatureIdAlwaysOnLineEmail ) ) && |
|
607 ( flags & EProfileFlagEmailAlertTone ) ) ); |
|
608 |
|
609 SetItemHidden( EProfileSettingRingingTypeId, array, |
|
610 ~flags & EProfileFlagRingingType ); |
|
611 |
|
612 SetItemHidden( EProfileSettingRingingVolumeId, array, |
|
613 ~flags & EProfileFlagRingingVolume ); |
|
614 |
|
615 SetItemHidden( EProfileSettingMediaVolumeId, array, |
|
616 !( ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) ) && |
|
617 ( flags & EProfileFlagMediaVolume ) ) ); |
|
618 |
|
619 SetItemHidden( EProfileSettingVibratingAlertId, array, |
|
620 ~flags & EProfileFlagVibratingAlert ); |
|
621 |
|
622 if(!iCopyProfile->iVibratingAlert) |
|
623 { |
|
624 SetItemHidden( EProfileSettingEmailVibratingAlertId, array,ETrue ); |
|
625 } |
|
626 else |
|
627 { |
|
628 SetItemHidden( EProfileSettingEmailVibratingAlertId, array,EFalse ); |
|
629 } |
|
630 |
|
631 SetItemHidden( EProfileSettingKeypadVolumeId, array, |
|
632 ~flags & EProfileFlagKeypadVolume ); |
|
633 |
|
634 SetItemHidden( EProfileSettingWarningAndGameTonesId, array, |
|
635 ~flags & EProfileFlagWarningTones ); |
|
636 |
|
637 // Check if TTS ringingtone is supported |
|
638 TBool textToSpeech( EFalse ); |
|
639 User::LeaveIfError( iTTSSession->Get( KProfilesLVFlags, textToSpeech ) ); |
|
640 textToSpeech &= KProEngFeatureIdTTSRingingTone; |
|
641 |
|
642 SetItemHidden( EProfileSettingTTSRingingToneId, array, |
|
643 !( textToSpeech && ( flags & EProfileFlagTextToSpeechTone ) ) ); |
|
644 |
|
645 SetItemHidden( EProfileSettingAlertForId, array, |
|
646 ~flags & EProfileFlagAlertFor ); |
|
647 |
|
648 SetItemHidden( EProfileSettingProfileNameId, array, |
|
649 ~flags & EProfileFlagProfileName ); |
|
650 |
|
651 SetItemHidden( EProfileSettingPTTRingingToneId, array, |
|
652 !( ( FeatureManager::FeatureSupported( KFeatureIdOmaPoc ) ) && |
|
653 ( flags & EProfileFlagPttTone ) ) ); |
|
654 |
|
655 SetItemHidden( EProfileSettingPTTStatusId, array, |
|
656 !( ( FeatureManager::FeatureSupported( KFeatureIdOmaPoc ) ) && |
|
657 ( flags & EProfileFlagPttStatus ) ) ); |
|
658 |
|
659 SetItemHidden( EProfileSettingTactileFeedbackId, array, |
|
660 !( ( FeatureManager::FeatureSupported( KFeatureIdTactileFeedback ) ) && |
|
661 ( flags & EProfileFlagTactileFeedback ) ) ); |
|
662 SetItemHidden( EProfileSettingAudioFeedbackId, array, |
|
663 !( ( FeatureManager::FeatureSupported( KFeatureIdTactileFeedback ) ) && |
|
664 ( flags & EProfileFlagAudioFeedback ) ) ); |
|
665 |
|
666 |
|
667 // Check if SilentMode is supported |
|
668 TBool silentMode( |
|
669 iLocalFeatures->IsFeatureSupported( KProEngFeatureIdForceSilentMode ) ); |
|
670 |
|
671 if( ( silentMode ) && ( profileId == EProfileSilentId ) ) |
|
672 { |
|
673 SetItemHidden( EProfileSettingRingingToneId, array, ETrue ); |
|
674 SetItemHidden( EProfileSettingRingingToneLine1Id, array, ETrue ); |
|
675 SetItemHidden( EProfileSettingRingingToneLine2Id, array, ETrue ); |
|
676 SetItemHidden( EProfileSettingVideoCallToneId, array, ETrue ); |
|
677 SetItemHidden( EProfileSettingTTSRingingToneId, array, ETrue ); |
|
678 SetItemHidden( EProfileSettingRingingTypeId, array, ETrue ); |
|
679 SetItemHidden( EProfileSettingRingingVolumeId, array, ETrue ); |
|
680 SetItemHidden( EProfileSettingMessageAlertToneId, array, ETrue ); |
|
681 SetItemHidden( EProfileSettingEmailAlertToneId, array, ETrue ); |
|
682 SetItemHidden( EProfileSettingKeypadVolumeId, array, ETrue ); |
|
683 SetItemHidden( EProfileSettingWarningAndGameTonesId, array, ETrue ); |
|
684 SetItemHidden( EProfileSettingPTTRingingToneId, array, ETrue ); |
|
685 SetItemHidden( EProfileSettingProfileNameId, array, ETrue ); |
|
686 SetItemHidden( EProfileSettingAudioFeedbackId, array, ETrue ); |
|
687 SetItemHidden( EProfileSetting3dEffectId, array, ETrue ); |
|
688 SetItemHidden( EProfileSetting3dEchoId, array, ETrue ); |
|
689 } |
|
690 |
|
691 iExternalSettingsHandler.SetHiddenItems( *array ); |
|
692 |
|
693 if( iIndexHandler ) |
|
694 { |
|
695 iIndexHandler->LoadIndices(); |
|
696 } |
|
697 |
|
698 HandleChangeInItemArrayOrVisibilityL(); |
|
699 } |
|
700 |
|
701 // ----------------------------------------------------------------------------- |
|
702 // CProfileSettingsContainer::UpdateSettingsL |
|
703 // ----------------------------------------------------------------------------- |
|
704 // |
|
705 void CProfileSettingsContainer::UpdateSettingsL( TBool aReadProfileSettings ) |
|
706 { |
|
707 // Set listbox invicible to avoid flicker |
|
708 CEikListBox* listBox = ListBox(); |
|
709 listBox->MakeVisible( EFalse ); |
|
710 |
|
711 // Leavable function calls must be trapped in order to set listbox |
|
712 // back to visible again if a leave occurs |
|
713 TRAPD( error, |
|
714 if( aReadProfileSettings ) |
|
715 { |
|
716 ReadProfileL(); |
|
717 } |
|
718 LoadSettingsL(); // from CAknSettingItemList |
|
719 SetHiddenFlagsL(); |
|
720 ); |
|
721 |
|
722 if( aReadProfileSettings && iIndexHandler ) |
|
723 { |
|
724 // Set focus back on correct index |
|
725 iIndexHandler->LoadIndices(); |
|
726 } |
|
727 |
|
728 // Set listbox back to visible |
|
729 listBox->MakeVisible( ETrue ); |
|
730 |
|
731 // Now proceed with the leave if one occured |
|
732 User::LeaveIfError( error ); |
|
733 } |
|
734 |
|
735 // ----------------------------------------------------------------------------- |
|
736 // CProfileSettingsContainer::EditItemL |
|
737 // ----------------------------------------------------------------------------- |
|
738 // |
|
739 EXPORT_C void CProfileSettingsContainer::EditItemL( TInt aIndex, TBool aCalledFromMenu ) |
|
740 { |
|
741 PRODEBUG1( "CProfileSettingsContainer EditItemL(%d) begin",aIndex ); |
|
742 |
|
743 // Prevent opening of several setting items |
|
744 if( iItemEdited ) |
|
745 { |
|
746 return; |
|
747 } |
|
748 |
|
749 CAknSettingItem* item = SettingItemArray()->At( aIndex ); |
|
750 TInt identifier( item->Identifier() ); |
|
751 |
|
752 if ( PowerSaveMode( identifier ) ) |
|
753 { |
|
754 HBufC* buf = StringLoader::LoadLC( R_PROFILE_TEXT_PSM_INFONOTE ); |
|
755 CAknInformationNote* queryDialog = new (ELeave) CAknInformationNote( ETrue ); |
|
756 queryDialog->ExecuteLD( *buf ); |
|
757 CleanupStack::PopAndDestroy( buf ); |
|
758 return; |
|
759 } |
|
760 |
|
761 if( !AllowedToChange( identifier ) ) |
|
762 { |
|
763 // If a setting is not allowed to change, "swallow" list box event. |
|
764 return; |
|
765 } |
|
766 |
|
767 HBufC* titleText = NULL; |
|
768 |
|
769 if( ( identifier != EProfileSettingRingingToneId ) && |
|
770 ( identifier != EProfileSettingRingingToneLine1Id ) && |
|
771 ( identifier != EProfileSettingRingingToneLine2Id ) && |
|
772 ( identifier != EProfileSettingVideoCallToneId ) && |
|
773 ( identifier != EProfileSettingMessageAlertToneId ) && |
|
774 ( identifier != EProfileSettingEmailAlertToneId ) && |
|
775 ( identifier != EProfileSettingPTTRingingToneId ) ) |
|
776 { |
|
777 if( aCalledFromMenu || |
|
778 !( identifier == EProfileSettingVibratingAlertId || |
|
779 identifier == EProfileSettingEmailVibratingAlertId || |
|
780 identifier == EProfileSettingWarningAndGameTonesId || |
|
781 identifier == EProfileSettingTTSRingingToneId ) ) |
|
782 { |
|
783 // Set profile name as title pane text. |
|
784 // Tone selections launch a pop-up, so title pane is not changed. |
|
785 // Binary pop-up setting item with two available values does not |
|
786 // launch a setting page when not called from menu so title pane |
|
787 // is not changed. |
|
788 if( iTitlePane ) |
|
789 { |
|
790 titleText = iTitlePane->Text()->AllocLC(); |
|
791 SetTitlePaneTextL( iCopyProfile->iTitleName ); |
|
792 } |
|
793 } |
|
794 } |
|
795 |
|
796 |
|
797 TInt threeDEffect = iCopyProfile->i3DEffect; |
|
798 if( identifier == EProfileSetting3dEffectId && iIndexHandler ) |
|
799 { |
|
800 iIndexHandler->StoreIndices(); |
|
801 } |
|
802 |
|
803 TInt vibratingAlert = iCopyProfile->iVibratingAlert; |
|
804 if( identifier == EProfileSettingVibratingAlertId && iIndexHandler ) |
|
805 { |
|
806 iIndexHandler->StoreIndices(); |
|
807 } |
|
808 |
|
809 // Set boolean value to ETrue that we know that the settings container |
|
810 // is in editing mode. |
|
811 iItemEdited = ETrue; |
|
812 // Store currently active profile id |
|
813 TInt activeProfileId( iEngineHandler.Engine()->ActiveProfileId() ); |
|
814 |
|
815 // Trap to set boolean value back to EFalse after EditItemL finalized. |
|
816 PRODEBUG1( "CProfileSettingsContainer EditItemL before list::EditItemL(%d)",aIndex ); |
|
817 TRAPD( error, CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu ) ); |
|
818 PRODEBUG1( "CProfileSettingsContainer EditItemL after list::EditItemL(),error=%d",error ); |
|
819 iItemEdited = EFalse; |
|
820 User::LeaveIfError( error ); |
|
821 |
|
822 // We don't know whether user cancelled or oked the setting so we must |
|
823 // store the data from setting item to the modified profile (iCopyProfile). |
|
824 item->StoreL(); |
|
825 // Compare the settings of the modified profile |
|
826 // to the settings currently in Profile Engine. |
|
827 if( !iCopyProfile->CompareL( iProfile ) ) |
|
828 { |
|
829 // Handle removing of DRM automated content |
|
830 iCopyProfile->RemoveAutomatedContentL( iProfile ); |
|
831 // Something has changed. Store settings of modified profile. |
|
832 iCopyProfile->StoreL( iProfile ); |
|
833 // Trap saving of the profile. If for example flash memory runs out |
|
834 // we can still revert the UI to its previous state. |
|
835 TRAP( error, iEngineHandler.Engine()->CommitChangeL( *iProfile ) ); |
|
836 if( error != KErrNone || PowerSaveMode() ) |
|
837 { |
|
838 // An User::Leave occurred. Try to read old settings to memory. |
|
839 ReadProfileL(); |
|
840 // Update setting item so UI is left to correct state. |
|
841 item->LoadL(); |
|
842 item->UpdateListBoxTextL(); |
|
843 } |
|
844 else if( identifier == EProfileSettingProfileNameId ) |
|
845 { |
|
846 // Profile name was changed. |
|
847 UpdateProfileNamesL(); |
|
848 } |
|
849 |
|
850 if ( threeDEffect != iCopyProfile->i3DEffect ) |
|
851 { |
|
852 UpdateSettingsL( EFalse ); // hide 3DEcho if 3DEffect is off |
|
853 } |
|
854 |
|
855 if ( vibratingAlert != iCopyProfile->iVibratingAlert ) |
|
856 { |
|
857 UpdateSettingsL( EFalse ); //hide emailVibrating alert if vibrating alert is off |
|
858 } |
|
859 } |
|
860 // If the setting is an external (= only in Tones View): |
|
861 iExternalSettingsHandler.StoreIfChangedL( identifier ); |
|
862 |
|
863 if( titleText ) |
|
864 { |
|
865 // Set title pane text back |
|
866 SetTitlePaneTextL( *titleText ); |
|
867 CleanupStack::PopAndDestroy( titleText ); |
|
868 } |
|
869 // Compare active profile to previously active profile |
|
870 TInt newActiveProfileId( iEngineHandler.Engine()->ActiveProfileId() ); |
|
871 if( activeProfileId != newActiveProfileId ) |
|
872 { |
|
873 // Active profile has changed while editing. Update UI. |
|
874 HandleActiveProfileEventL( EProfileNewActiveProfile, newActiveProfileId ); |
|
875 } |
|
876 User::LeaveIfError( error ); |
|
877 } |
|
878 |
|
879 // ----------------------------------------------------------------------------- |
|
880 // CProfileSettingsContainer::CreateSettingItemL |
|
881 // ----------------------------------------------------------------------------- |
|
882 // |
|
883 CAknSettingItem* CProfileSettingsContainer::CreateSettingItemL( |
|
884 TInt aIdentifier ) |
|
885 { |
|
886 PRODEBUG1( "CProfileSettingsContainer CreateSettingsItemL(%d)",aIdentifier ); |
|
887 CAknSettingItem* settingItem = NULL; |
|
888 |
|
889 switch( aIdentifier ) |
|
890 { |
|
891 // Flow through: Ringing tone and RT line 1 are stored to the same |
|
892 // variable because they can not exist at the same time. |
|
893 case EProfileSettingRingingToneId: |
|
894 case EProfileSettingRingingToneLine1Id: |
|
895 { |
|
896 settingItem = CreateFileListSettingItemL( |
|
897 *iCopyProfile->iRingingTone, aIdentifier ); |
|
898 break; |
|
899 } |
|
900 case EProfileSettingRingingToneLine2Id: |
|
901 { |
|
902 settingItem = CreateFileListSettingItemL( |
|
903 *iCopyProfile->iRingingToneLine2, aIdentifier ); |
|
904 break; |
|
905 } |
|
906 case EProfileSettingVideoCallToneId: |
|
907 { |
|
908 settingItem = CreateFileListSettingItemL( |
|
909 *iCopyProfile->iVideoCallTone, aIdentifier ); |
|
910 break; |
|
911 } |
|
912 case EProfileSettingMessageAlertToneId: |
|
913 { |
|
914 settingItem = CreateFileListSettingItemL( |
|
915 *iCopyProfile->iMessageAlertTone, aIdentifier ); |
|
916 break; |
|
917 } |
|
918 case EProfileSettingEmailAlertToneId: |
|
919 { |
|
920 settingItem = CreateFileListSettingItemL( |
|
921 *iCopyProfile->iEmailAlertTone, aIdentifier ); |
|
922 break; |
|
923 } |
|
924 case EProfileSettingRingingTypeId: |
|
925 { |
|
926 settingItem = new( ELeave ) CAknEnumeratedTextPopupSettingItem( |
|
927 aIdentifier, iCopyProfile->iRingingType ); |
|
928 break; |
|
929 } |
|
930 case EProfileSettingRingingVolumeId: |
|
931 { |
|
932 settingItem = new( ELeave ) CProfilePlayingVolumeSettingItem( |
|
933 aIdentifier, iCopyProfile->iRingingVolume, |
|
934 *iCopyProfile->iRingingTone, |
|
935 iCopyProfile->iRingingType, |
|
936 iCopyProfile->iVibratingAlert, |
|
937 EFalse ); //Display confirmation note for maximum volume |
|
938 break; |
|
939 } |
|
940 case EProfileSettingMediaVolumeId: |
|
941 { |
|
942 settingItem = new( ELeave ) CProfilePlayingVolumeSettingItem( |
|
943 aIdentifier, iCopyProfile->iMediaVolume, |
|
944 *iCopyProfile->iRingingTone, |
|
945 iCopyProfile->iRingingType, |
|
946 iCopyProfile->iVibratingAlert, |
|
947 EFalse ); //Do not display confirmation note for maximum volume |
|
948 break; |
|
949 } |
|
950 case EProfileSettingVibratingAlertId: |
|
951 { |
|
952 settingItem = new( ELeave ) CAknBinaryPopupSettingItem( |
|
953 aIdentifier, iCopyProfile->iVibratingAlert ); |
|
954 break; |
|
955 } |
|
956 case EProfileSettingEmailVibratingAlertId: |
|
957 { |
|
958 settingItem = new( ELeave ) CAknBinaryPopupSettingItem( |
|
959 aIdentifier, iCopyProfile->iEmailVibratingAlert ); |
|
960 break; |
|
961 } |
|
962 case EProfileSettingKeypadVolumeId: |
|
963 { |
|
964 settingItem = new( ELeave ) CProfileKeypadVolumeSettingItem( |
|
965 aIdentifier, iCopyProfile->iKeypadVolume, iKeySounds ); |
|
966 break; |
|
967 } |
|
968 case EProfileSettingWarningAndGameTonesId: |
|
969 { |
|
970 settingItem = new( ELeave ) CAknBinaryPopupSettingItem( |
|
971 aIdentifier, iCopyProfile->iWarningAndGameTones ); |
|
972 break; |
|
973 } |
|
974 case EProfileSettingAlertForId: |
|
975 { |
|
976 settingItem = new( ELeave ) CProfileAlertForSettingItem( |
|
977 aIdentifier, iCopyProfile->iContactList, iCoeEnv ); |
|
978 break; |
|
979 } |
|
980 case EProfileSettingProfileNameId: |
|
981 { |
|
982 settingItem = new( ELeave ) CProfileNameSettingItem( |
|
983 aIdentifier, iCopyProfile->iProfileName, iEngineHandler ); |
|
984 break; |
|
985 } |
|
986 case EProfileSettingTTSRingingToneId: |
|
987 { |
|
988 settingItem = new( ELeave ) CAknBinaryPopupSettingItem( |
|
989 aIdentifier, iCopyProfile->iTextToSpeech ); |
|
990 break; |
|
991 } |
|
992 case EProfileSettingPTTRingingToneId: |
|
993 { |
|
994 settingItem = CreateFileListSettingItemL( |
|
995 *iCopyProfile->iPTTRingingTone, aIdentifier ); |
|
996 break; |
|
997 } |
|
998 case EProfileSettingPTTStatusId: |
|
999 { |
|
1000 settingItem = new( ELeave ) CAknEnumeratedTextPopupSettingItem( |
|
1001 aIdentifier, iCopyProfile->iPTTStatus ); |
|
1002 break; |
|
1003 } |
|
1004 case EProfileSettingTactileFeedbackId: |
|
1005 { |
|
1006 /* |
|
1007 settingItem = new( ELeave ) CAknEnumeratedTextPopupSettingItem( |
|
1008 aIdentifier, iCopyProfile->iTactileFeedback ); |
|
1009 */ |
|
1010 settingItem = new( ELeave ) CProfileFeedbackSettingItem( |
|
1011 aIdentifier, iCopyProfile->iTactileFeedback ); |
|
1012 break; |
|
1013 } |
|
1014 case EProfileSettingAudioFeedbackId: |
|
1015 { |
|
1016 /* |
|
1017 settingItem = new( ELeave ) CAknEnumeratedTextPopupSettingItem( |
|
1018 aIdentifier, iCopyProfile->iAudioFeedback ); |
|
1019 */ |
|
1020 settingItem = new( ELeave ) CProfileFeedbackSettingItem( |
|
1021 aIdentifier, iCopyProfile->iAudioFeedback ); |
|
1022 break; |
|
1023 } |
|
1024 case EProfileSetting3dEffectId: |
|
1025 { |
|
1026 /* |
|
1027 settingItem = new( ELeave ) CAknEnumeratedTextPopupSettingItem( |
|
1028 aIdentifier, iCopyProfile->i3DEffect ); |
|
1029 */ |
|
1030 settingItem = new( ELeave ) CProfile3dSettingItem( |
|
1031 aIdentifier, |
|
1032 iCopyProfile->i3DEffect, |
|
1033 *iCopyProfile->iRingingTone, |
|
1034 iCopyProfile->iRingingType, |
|
1035 iCopyProfile->iVibratingAlert, |
|
1036 iCopyProfile->iRingingVolume, |
|
1037 iCopyProfile->i3DEcho ); |
|
1038 break; |
|
1039 } |
|
1040 case EProfileSetting3dEchoId: |
|
1041 { |
|
1042 /* |
|
1043 settingItem = new( ELeave ) CAknEnumeratedTextPopupSettingItem( |
|
1044 aIdentifier, iCopyProfile->i3DEcho ); |
|
1045 */ |
|
1046 settingItem = new( ELeave ) CProfile3dSettingItem( |
|
1047 aIdentifier, |
|
1048 iCopyProfile->i3DEcho, |
|
1049 *iCopyProfile->iRingingTone, |
|
1050 iCopyProfile->iRingingType, |
|
1051 iCopyProfile->iVibratingAlert, |
|
1052 iCopyProfile->iRingingVolume, |
|
1053 iCopyProfile->i3DEffect ); |
|
1054 break; |
|
1055 } |
|
1056 |
|
1057 default: |
|
1058 { |
|
1059 PRODEBUG1( "CProfileSettingsContainer before extShandler::CreateSI(%d)",aIdentifier ); |
|
1060 settingItem = iExternalSettingsHandler.CreateSettingItemL( aIdentifier ); |
|
1061 PRODEBUG( "CProfileSettingsContainer after extShandler::CreateSI" ); |
|
1062 break; |
|
1063 } |
|
1064 } |
|
1065 PRODEBUG1( "CProfileSettingsContainer CreateSettingsItemL(%d) before return",aIdentifier ); |
|
1066 return settingItem; |
|
1067 } |
|
1068 |
|
1069 // ----------------------------------------------------------------------------- |
|
1070 // CProfileSettingsContainer::CheckFileExistenceL |
|
1071 // ----------------------------------------------------------------------------- |
|
1072 // |
|
1073 void CProfileSettingsContainer::CheckFileExistenceL() |
|
1074 { |
|
1075 CAknSettingItemArray* array = SettingItemArray(); |
|
1076 |
|
1077 if( !IsItemHidden( EProfileSettingRingingToneId, array ) ) |
|
1078 { |
|
1079 if( !BaflUtils::FileExists( *iFs, *iCopyProfile->iRingingTone ) ) |
|
1080 { |
|
1081 TParsePtrC tone( *iCopyProfile->iRingingTone ); |
|
1082 HBufC* ringtoneNotFoundText = |
|
1083 StringLoader::LoadLC( |
|
1084 R_PROFILE_CONFIRM_RINGTONE_FOUND, tone.NameAndExt() ); |
|
1085 |
|
1086 CProfileSettingsContainer::LaunchDialogL( *ringtoneNotFoundText ); |
|
1087 CleanupStack::PopAndDestroy( ringtoneNotFoundText ); |
|
1088 } |
|
1089 } |
|
1090 |
|
1091 if( !IsItemHidden( EProfileSettingRingingToneLine1Id, array ) ) |
|
1092 { |
|
1093 if( !BaflUtils::FileExists( *iFs, *iCopyProfile->iRingingTone ) ) |
|
1094 { |
|
1095 TParsePtrC tone( *iCopyProfile->iRingingTone ); |
|
1096 HBufC* ringtoneNotFoundText = |
|
1097 StringLoader::LoadLC( |
|
1098 R_PROFILE_CONFIRM_RINGTONE_FOUND, tone.NameAndExt() ); |
|
1099 |
|
1100 CProfileSettingsContainer::LaunchDialogL( *ringtoneNotFoundText ); |
|
1101 CleanupStack::PopAndDestroy( ringtoneNotFoundText ); |
|
1102 } |
|
1103 } |
|
1104 |
|
1105 if( !IsItemHidden( EProfileSettingRingingToneLine2Id, array ) ) |
|
1106 { |
|
1107 if( !BaflUtils::FileExists( *iFs, *iCopyProfile->iRingingToneLine2 ) ) |
|
1108 { |
|
1109 TParsePtrC tone( *iCopyProfile->iRingingToneLine2 ); |
|
1110 HBufC* ringtoneNotFoundText = |
|
1111 StringLoader::LoadLC( |
|
1112 R_PROFILE_CONFIRM_RINGTONE_FOUND, tone.NameAndExt() ); |
|
1113 |
|
1114 CProfileSettingsContainer::LaunchDialogL( *ringtoneNotFoundText ); |
|
1115 CleanupStack::PopAndDestroy( ringtoneNotFoundText ); |
|
1116 } |
|
1117 } |
|
1118 |
|
1119 if( !IsItemHidden( EProfileSettingVideoCallToneId, array ) ) |
|
1120 { |
|
1121 if( !BaflUtils::FileExists( *iFs, *iCopyProfile->iVideoCallTone ) ) |
|
1122 { |
|
1123 TParsePtrC tone( *iCopyProfile->iVideoCallTone ); |
|
1124 HBufC* ringtoneNotFoundText = |
|
1125 StringLoader::LoadLC( |
|
1126 R_PROFILE_CONFIRM_RINGTONE_FOUND, tone.NameAndExt() ); |
|
1127 |
|
1128 CProfileSettingsContainer::LaunchDialogL( *ringtoneNotFoundText ); |
|
1129 CleanupStack::PopAndDestroy( ringtoneNotFoundText ); |
|
1130 } |
|
1131 } |
|
1132 |
|
1133 if( !IsItemHidden( EProfileSettingMessageAlertToneId, array ) ) |
|
1134 { |
|
1135 if( !BaflUtils::FileExists( *iFs, *iCopyProfile->iMessageAlertTone ) ) |
|
1136 { |
|
1137 TParsePtrC tone( *iCopyProfile->iMessageAlertTone ); |
|
1138 HBufC* ringtoneNotFoundText = |
|
1139 StringLoader::LoadLC( |
|
1140 R_PROFILE_CONFIRM_RINGTONE_FOUND, tone.NameAndExt() ); |
|
1141 |
|
1142 CProfileSettingsContainer::LaunchDialogL( *ringtoneNotFoundText ); |
|
1143 CleanupStack::PopAndDestroy( ringtoneNotFoundText ); |
|
1144 } |
|
1145 } |
|
1146 |
|
1147 if( !IsItemHidden( EProfileSettingEmailAlertToneId, array ) ) |
|
1148 { |
|
1149 if( !BaflUtils::FileExists( *iFs, *iCopyProfile->iEmailAlertTone ) ) |
|
1150 { |
|
1151 TParsePtrC tone( *iCopyProfile->iEmailAlertTone ); |
|
1152 HBufC* ringtoneNotFoundText = |
|
1153 StringLoader::LoadLC( |
|
1154 R_PROFILE_CONFIRM_RINGTONE_FOUND, tone.NameAndExt() ); |
|
1155 |
|
1156 CProfileSettingsContainer::LaunchDialogL( *ringtoneNotFoundText ); |
|
1157 CleanupStack::PopAndDestroy( ringtoneNotFoundText ); |
|
1158 } |
|
1159 } |
|
1160 |
|
1161 if( !IsItemHidden( EProfileSettingPTTRingingToneId, array ) ) |
|
1162 { |
|
1163 if( !BaflUtils::FileExists( *iFs, *iCopyProfile->iPTTRingingTone ) ) |
|
1164 { |
|
1165 TParsePtrC tone( *iCopyProfile->iPTTRingingTone ); |
|
1166 HBufC* ringtoneNotFoundText = |
|
1167 StringLoader::LoadLC( |
|
1168 R_PROFILE_CONFIRM_RINGTONE_FOUND, tone.NameAndExt() ); |
|
1169 |
|
1170 CProfileSettingsContainer::LaunchDialogL( *ringtoneNotFoundText ); |
|
1171 CleanupStack::PopAndDestroy( ringtoneNotFoundText ); |
|
1172 } |
|
1173 } |
|
1174 } |
|
1175 |
|
1176 // ----------------------------------------------------------------------------- |
|
1177 // CProfileSettingsContainer::LaunchDialogL |
|
1178 // ----------------------------------------------------------------------------- |
|
1179 // |
|
1180 void CProfileSettingsContainer::LaunchDialogL( const TDesC& aTitleText ) |
|
1181 { |
|
1182 CAknQueryDialog* query = CAknQueryDialog::NewL(); |
|
1183 const TInt ret( query->ExecuteLD( |
|
1184 R_PROFILE_CONFIRM_RINGTONE_FOUND_QUERY, aTitleText) ); |
|
1185 } |
|
1186 |
|
1187 // ----------------------------------------------------------------------------- |
|
1188 // CProfileSettingsContainer::CreateFileListSettingItemL |
|
1189 // ----------------------------------------------------------------------------- |
|
1190 // |
|
1191 CAknSettingItem* CProfileSettingsContainer::CreateFileListSettingItemL( |
|
1192 TDes& aFileName, TInt aIdentifier ) |
|
1193 { |
|
1194 CAknSettingItem* settingItem = new( ELeave ) CProfileFileListSettingItem( |
|
1195 aIdentifier, |
|
1196 aFileName, |
|
1197 iCopyProfile->iRingingType, |
|
1198 iCopyProfile->iRingingVolume, |
|
1199 iCopyProfile->iVibratingAlert, |
|
1200 iCopyProfile->i3DEffect, |
|
1201 iCopyProfile->i3DEcho, |
|
1202 iCoeEnv ); |
|
1203 |
|
1204 return settingItem; |
|
1205 } |
|
1206 |
|
1207 // ----------------------------------------------------------------------------- |
|
1208 // CProfileSettingsContainer::IndexForId |
|
1209 // ----------------------------------------------------------------------------- |
|
1210 // |
|
1211 TInt CProfileSettingsContainer::IndexForId( TInt aId ) const |
|
1212 { |
|
1213 CAknSettingItemArray* array = SettingItemArray(); |
|
1214 TInt count( array->Count() ); |
|
1215 for( TInt index( 0 ); index < count; index++ ) |
|
1216 { |
|
1217 if( array->At( index )->Identifier() == aId ) |
|
1218 { |
|
1219 // Searched ID was found, return index |
|
1220 return index; |
|
1221 } |
|
1222 } |
|
1223 return KErrNotFound; |
|
1224 } |
|
1225 |
|
1226 // ----------------------------------------------------------------------------- |
|
1227 // CProfileSettingsContainer::SetItemHidden |
|
1228 // Sets an item hidden if an index for the id is found. |
|
1229 // In other words does nothing if feature is not supported. |
|
1230 // ----------------------------------------------------------------------------- |
|
1231 // |
|
1232 void CProfileSettingsContainer::SetItemHidden( TInt aId, |
|
1233 CAknSettingItemArray* aArray, TBool aHidden ) |
|
1234 { |
|
1235 TInt index( IndexForId( aId ) ); |
|
1236 if( index == KErrNotFound ) |
|
1237 { |
|
1238 return; |
|
1239 } |
|
1240 aArray->At( index )->SetHidden( aHidden ); |
|
1241 } |
|
1242 |
|
1243 // ----------------------------------------------------------------------------- |
|
1244 // CProfileSettingsContainer::IsItemHidden |
|
1245 // |
|
1246 // ----------------------------------------------------------------------------- |
|
1247 // |
|
1248 TBool CProfileSettingsContainer::IsItemHidden( TInt aId, |
|
1249 CAknSettingItemArray* aArray ) const |
|
1250 { |
|
1251 TInt index( IndexForId( aId ) ); |
|
1252 if( index == KErrNotFound ) |
|
1253 { |
|
1254 return ETrue; |
|
1255 } |
|
1256 |
|
1257 return aArray->At( index )->IsHidden(); |
|
1258 } |
|
1259 |
|
1260 // ----------------------------------------------------------------------------- |
|
1261 // CProfileSettingsContainer::SetTitlePaneTextL |
|
1262 // ----------------------------------------------------------------------------- |
|
1263 // |
|
1264 void CProfileSettingsContainer::SetTitlePaneTextL( const TDesC& aTitle ) |
|
1265 { |
|
1266 if( !iTitlePane ) |
|
1267 { |
|
1268 return; |
|
1269 } |
|
1270 |
|
1271 if( aTitle.Length() > 0 ) |
|
1272 { |
|
1273 iTitlePane->SetTextL( aTitle ); |
|
1274 } |
|
1275 else |
|
1276 { |
|
1277 iTitlePane->SetTextToDefaultL(); // Application name |
|
1278 } |
|
1279 } |
|
1280 |
|
1281 // ----------------------------------------------------------------------------- |
|
1282 // CProfileSettingsContainer::UpdateProfileNamesL |
|
1283 // ----------------------------------------------------------------------------- |
|
1284 // |
|
1285 void CProfileSettingsContainer::UpdateProfileNamesL() |
|
1286 { |
|
1287 if( iIndexHandler ) |
|
1288 { |
|
1289 TInt newProfileIndex( iIndexHandler->ReadIdArrayAndUpdateL() ); |
|
1290 if( iTabHandler ) |
|
1291 { |
|
1292 // Refresh tabs with changed profile names |
|
1293 iTabHandler->RefreshTabsL(); |
|
1294 iTabHandler->SetActiveTab( newProfileIndex ); |
|
1295 } |
|
1296 else |
|
1297 { |
|
1298 // If the iTabHandler is NULL and the iNaviPaneContainer is not NULL |
|
1299 // Set the text of navi pane to currently personlize profile's name. |
|
1300 if ( iNaviPaneContainer ) |
|
1301 { |
|
1302 MProfilesNamesArray* nameArray = iEngineHandler.IdArray(); |
|
1303 iNaviPaneContainer->SetNaviPaneTextL( |
|
1304 nameArray->MdcaPoint( newProfileIndex ) ); |
|
1305 } |
|
1306 } |
|
1307 } |
|
1308 else |
|
1309 { |
|
1310 // No index handler. Just refresh profile name array. |
|
1311 iEngineHandler.ReadIdArrayL(); |
|
1312 } |
|
1313 } |
|
1314 |
|
1315 // ----------------------------------------------------------------------------- |
|
1316 // CProfileSettingsContainer::SizeChanged |
|
1317 // ----------------------------------------------------------------------------- |
|
1318 // |
|
1319 void CProfileSettingsContainer::SizeChanged() |
|
1320 { |
|
1321 CEikListBox* lb = ListBox(); |
|
1322 if( lb ) |
|
1323 { |
|
1324 lb->SetRect( Rect() ); // Set container's rect to listbox |
|
1325 } |
|
1326 } |
|
1327 |
|
1328 // ----------------------------------------------------------------------------- |
|
1329 // CProfileSettingsContainer::HandleListBoxEventL |
|
1330 // ----------------------------------------------------------------------------- |
|
1331 // |
|
1332 void CProfileSettingsContainer::HandleListBoxEventL( |
|
1333 CEikListBox* aListBox, TListBoxEvent aEventType ) |
|
1334 { |
|
1335 if( aEventType == EEventEnterKeyPressed || |
|
1336 aEventType == EEventItemDoubleClicked ) |
|
1337 { |
|
1338 CAknSettingItemArray* array = SettingItemArray(); |
|
1339 if( !AllowedToChange( array->At( array->ItemIndexFromVisibleIndex( |
|
1340 ListBox()->CurrentItemIndex() ) )->Identifier() ) ) |
|
1341 { |
|
1342 // If a setting is not allowed to change, "swallow" list box event. |
|
1343 return; |
|
1344 } |
|
1345 } |
|
1346 CAknSettingItemList::HandleListBoxEventL( aListBox, aEventType ); |
|
1347 } |
|
1348 |
|
1349 // ----------------------------------------------------------------------------- |
|
1350 // CProfileSettingsContainer::GetHelpContext |
|
1351 // ----------------------------------------------------------------------------- |
|
1352 // |
|
1353 void CProfileSettingsContainer::GetHelpContext( TCoeHelpContext& aContext ) const |
|
1354 { |
|
1355 aContext.iMajor = KUidProfileApp; |
|
1356 if( !iExternalSettingsHandler.GetHelpContext( aContext ) ) |
|
1357 { |
|
1358 aContext.iContext = KMODE_HLP_PERSONALISE; |
|
1359 } |
|
1360 } |
|
1361 |
|
1362 // ----------------------------------------------------------------------------- |
|
1363 // CProfileSettingsContainer::PhoneSettingChanged |
|
1364 // ----------------------------------------------------------------------------- |
|
1365 // |
|
1366 void CProfileSettingsContainer::PhoneSettingChanged( |
|
1367 TSSSettingsSetting aSetting, TInt aNewValue ) |
|
1368 { |
|
1369 if( aSetting == ESSSettingsAls ) |
|
1370 { |
|
1371 iAlternateLineService = ( aNewValue != ESSSettingsAlsNotSupported ); |
|
1372 if( iIndexHandler ) |
|
1373 { |
|
1374 iIndexHandler->StoreIndices(); |
|
1375 } |
|
1376 // error ignored. If not enough memory to refresh the UI, |
|
1377 // don't bother launching an error note. |
|
1378 TRAP_IGNORE( SetHiddenFlagsL() ); |
|
1379 if( iIndexHandler ) |
|
1380 { |
|
1381 iIndexHandler->LoadIndices(); |
|
1382 } |
|
1383 } |
|
1384 } |
|
1385 |
|
1386 // ----------------------------------------------------------------------------- |
|
1387 // CProfileSettingsContainer::TabChangedL |
|
1388 // When a tab changes, this method gets called. |
|
1389 // ----------------------------------------------------------------------------- |
|
1390 // |
|
1391 void CProfileSettingsContainer::TabChangedL( TInt /* aIndex */ ) |
|
1392 { |
|
1393 UpdateSettingsL(); |
|
1394 |
|
1395 CEikListBox* listBox = ListBox(); |
|
1396 if( listBox ) |
|
1397 { |
|
1398 listBox->UpdateScrollBarsL(); |
|
1399 } |
|
1400 } |
|
1401 |
|
1402 // ----------------------------------------------------------------------------- |
|
1403 // CProfileSettingsContainer::HandleActiveProfileEventL |
|
1404 // When active profile changes, this method gets called. |
|
1405 // ----------------------------------------------------------------------------- |
|
1406 // |
|
1407 void CProfileSettingsContainer::HandleActiveProfileEventL( |
|
1408 TProfileEvent /* aProfileEvent */, TInt /* aProfileId */ ) |
|
1409 { |
|
1410 /* |
|
1411 if( iItemEdited ) |
|
1412 { |
|
1413 // Do not update UI if an item is being edited. |
|
1414 return; |
|
1415 } |
|
1416 */ |
|
1417 UpdateProfileNamesL(); |
|
1418 UpdateSettingsL(); |
|
1419 } |
|
1420 |
|
1421 // ----------------------------------------------------------------------------- |
|
1422 // CProfileSettingsContainer::HandleExternalSettingsChangedL |
|
1423 // When external settings change, this method gets called. |
|
1424 // ----------------------------------------------------------------------------- |
|
1425 // |
|
1426 void CProfileSettingsContainer::HandleExternalSettingsChangedL() |
|
1427 { |
|
1428 UpdateSettingsL( EFalse ); |
|
1429 } |
|
1430 |
|
1431 // ----------------------------------------------------------------------------- |
|
1432 // CProfileSettingsContainer::HandleResourceChange |
|
1433 // ----------------------------------------------------------------------------- |
|
1434 // |
|
1435 void CProfileSettingsContainer::HandleResourceChange( TInt aType ) |
|
1436 { |
|
1437 if ( aType == KEikDynamicLayoutVariantSwitch || |
|
1438 aType == KAknsMessageSkinChange ) |
|
1439 { |
|
1440 iProfileViewHandler.UpdateClientRect(); |
|
1441 } |
|
1442 CAknSettingItemList::HandleResourceChange( aType ); |
|
1443 } |
|
1444 |
|
1445 // ---------------------------------------------------- |
|
1446 // CProfileSettingsContainer::HandleNotifyInt |
|
1447 // ---------------------------------------------------- |
|
1448 // |
|
1449 void CProfileSettingsContainer::HandleNotifyInt( |
|
1450 const TUint32 aID, |
|
1451 const TInt aNewValue ) |
|
1452 { |
|
1453 if ( KDynamicVoIP == aID) |
|
1454 { |
|
1455 iVoIPStatus = KVoIPOFF != aNewValue; |
|
1456 } |
|
1457 } |
|
1458 |
|
1459 // ----------------------------------------------------------------------------- |
|
1460 // CProfileSettingsContainer::ItemEdited |
|
1461 // ----------------------------------------------------------------------------- |
|
1462 // |
|
1463 EXPORT_C TBool CProfileSettingsContainer::ItemEdited() const |
|
1464 { |
|
1465 return iItemEdited; |
|
1466 } |
|
1467 |
|
1468 // ----------------------------------------------------------------------------- |
|
1469 // CProfileSettingsContainer::PowerSaveMode |
|
1470 // |
|
1471 // ----------------------------------------------------------------------------- |
|
1472 // |
|
1473 TBool CProfileSettingsContainer::PowerSaveMode( TInt aSettingId ) |
|
1474 { |
|
1475 TInt ret = EFalse; |
|
1476 |
|
1477 if ( aSettingId == EProfileSettingVibratingAlertId || |
|
1478 aSettingId == EProfileSettingKeypadVolumeId || |
|
1479 aSettingId == EProfileSettingTactileFeedbackId || |
|
1480 aSettingId == EProfileSettingAudioFeedbackId ||aSettingId == EProfileSettingEmailVibratingAlertId) |
|
1481 { |
|
1482 ret = PowerSaveMode(); |
|
1483 } |
|
1484 |
|
1485 return ret; |
|
1486 } |
|
1487 |
|
1488 |
|
1489 // ----------------------------------------------------------------------------- |
|
1490 // CProfileSettingsContainer::PowerSaveModeL |
|
1491 // |
|
1492 // ----------------------------------------------------------------------------- |
|
1493 // |
|
1494 TBool CProfileSettingsContainer::PowerSaveModeL() |
|
1495 { |
|
1496 if( !FeatureManager::FeatureSupported( KFeatureIdPowerSave ) ) |
|
1497 { |
|
1498 return EFalse; |
|
1499 } |
|
1500 |
|
1501 TInt psm = EPsmsrvModeNormal; |
|
1502 |
|
1503 // KProEngPsmChanged PubSub key is set by GSProfilesPlugin when power save |
|
1504 // mode changes. If the key cannot be read (doesn't exist), PSM hasn't |
|
1505 // changed since the last boot and the mode is read from PSM CenRep. |
|
1506 if( RProperty::Get( KPSUidProfileEngine, KProEngPsmChanged, psm ) != KErrNone ) |
|
1507 { |
|
1508 CRepository* cenrep = CRepository::NewLC( KCRUidPowerSaveMode ); |
|
1509 User::LeaveIfError( cenrep->Get( KPsmCurrentMode, psm ) ); |
|
1510 CleanupStack::PopAndDestroy( cenrep ); |
|
1511 } |
|
1512 |
|
1513 if ( psm == EPsmsrvModePowerSave ) |
|
1514 { |
|
1515 return ETrue; |
|
1516 } |
|
1517 |
|
1518 return EFalse; |
|
1519 } |
|
1520 |
|
1521 |
|
1522 // ----------------------------------------------------------------------------- |
|
1523 // CProfileSettingsContainer::PowerSaveMode |
|
1524 // |
|
1525 // ----------------------------------------------------------------------------- |
|
1526 // |
|
1527 TBool CProfileSettingsContainer::PowerSaveMode() |
|
1528 { |
|
1529 TBool psm = EFalse; |
|
1530 |
|
1531 TRAPD( err, psm = PowerSaveModeL() ); |
|
1532 |
|
1533 if ( err != KErrNone ) |
|
1534 { |
|
1535 return EFalse; |
|
1536 } |
|
1537 |
|
1538 return psm; |
|
1539 } |
|
1540 |
|
1541 |
|
1542 |
|
1543 // End of File |
|