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