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