37 #include <csxhelp/wpush.hlp.hrh> |
37 #include <csxhelp/wpush.hlp.hrh> |
38 #endif // __SERIES60_HELP |
38 #endif // __SERIES60_HELP |
39 #include <msvapi.h> |
39 #include <msvapi.h> |
40 #include <data_caging_path_literals.hrh> |
40 #include <data_caging_path_literals.hrh> |
41 #include <f32file.h> |
41 #include <f32file.h> |
42 |
42 #include "PushMtmPrivateCRKeys.h" |
|
43 #include <centralrepository.h> |
43 // ================= MEMBER FUNCTIONS ======================= |
44 // ================= MEMBER FUNCTIONS ======================= |
44 |
45 |
45 // --------------------------------------------------------- |
46 // --------------------------------------------------------- |
46 // CPushSettingsDialog::CPushSettingsDialog |
47 // CPushSettingsDialog::CPushSettingsDialog |
47 // --------------------------------------------------------- |
48 // --------------------------------------------------------- |
73 // --------------------------------------------------------- |
74 // --------------------------------------------------------- |
74 // |
75 // |
75 void CPushSettingsDialog::ConstructL() |
76 void CPushSettingsDialog::ConstructL() |
76 { |
77 { |
77 // Add resource file. |
78 // Add resource file. |
|
79 CRepository* PushSL = CRepository::NewL( KCRUidPushMtm ); |
|
80 CleanupStack::PushL( PushSL ); |
|
81 User::LeaveIfError( PushSL->Get( KPushMtmServiceEnabled , iPushSLEnabled ) ); |
|
82 CleanupStack::PopAndDestroy( PushSL ); |
|
83 |
78 TParse* fileParser = new (ELeave) TParse; |
84 TParse* fileParser = new (ELeave) TParse; |
79 // Unnecessary to call CleanupStack::PushL( fileParser ); |
85 // Unnecessary to call CleanupStack::PushL( fileParser ); |
80 fileParser->Set( KPushMtmUiResourceFileAndDrive, &KDC_MTM_RESOURCE_DIR, NULL ); |
86 fileParser->Set( KPushMtmUiResourceFileAndDrive, &KDC_MTM_RESOURCE_DIR, NULL ); |
81 iResourceFile = fileParser->FullName(); |
87 iResourceFile = fileParser->FullName(); |
82 delete fileParser; |
88 delete fileParser; |
190 // Service reception. |
196 // Service reception. |
191 ConstructAndAppendItemTextL |
197 ConstructAndAppendItemTextL |
192 ( EServiceReception, R_PUSHSD_RECEPT, |
198 ( EServiceReception, R_PUSHSD_RECEPT, |
193 iModel->ServiceReception() ? R_PUSHSD_RECEP_ON : R_PUSHSD_RECEP_OFF ); |
199 iModel->ServiceReception() ? R_PUSHSD_RECEP_ON : R_PUSHSD_RECEP_OFF ); |
194 |
200 |
195 #ifdef __SERIES60_PUSH_SL |
201 |
196 |
202 if(iPushSLEnabled) |
|
203 { |
197 // Service loading (SL specific). |
204 // Service loading (SL specific). |
198 ConstructAndAppendItemTextL |
205 ConstructAndAppendItemTextL |
199 ( EServiceLoadingType, R_PUSHSD_LOADING, |
206 ( EServiceLoadingType, R_PUSHSD_LOADING, |
200 ( iModel->ServiceLoadingType() == CPushMtmSettings::EAutomatic ) ? |
207 ( iModel->ServiceLoadingType() == CPushMtmSettings::EAutomatic ) ? |
201 R_PUSHSD_LOAD_AUTOM : R_PUSHSD_LOAD_MAN ); |
208 R_PUSHSD_LOAD_AUTOM : R_PUSHSD_LOAD_MAN ); |
202 |
209 } |
203 #endif //__SERIES60_PUSH_SL |
|
204 } |
210 } |
205 |
211 |
206 // --------------------------------------------------------- |
212 // --------------------------------------------------------- |
207 // CPushSettingsDialog::UpdateSettingListBoxViewL |
213 // CPushSettingsDialog::UpdateSettingListBoxViewL |
208 // --------------------------------------------------------- |
214 // --------------------------------------------------------- |
286 { |
292 { |
287 iModel->SetServiceReception( !iModel->ServiceReception() ); |
293 iModel->SetServiceReception( !iModel->ServiceReception() ); |
288 break; |
294 break; |
289 } |
295 } |
290 |
296 |
291 #ifdef __SERIES60_PUSH_SL |
|
292 |
|
293 case EServiceLoadingType: |
297 case EServiceLoadingType: |
294 { |
298 { |
|
299 if(iPushSLEnabled){ |
295 if ( iModel->ServiceLoadingType() == CPushMtmSettings::EManual ) |
300 if ( iModel->ServiceLoadingType() == CPushMtmSettings::EManual ) |
296 { |
301 { |
297 // Display a confirmation dialog first. |
302 // Display a confirmation dialog first. |
298 if ( ShowServiceLoadingTypeConfirmationL() ) |
303 if ( ShowServiceLoadingTypeConfirmationL() ) |
299 { |
304 { |
304 else |
309 else |
305 { |
310 { |
306 // Do not show confirmation dialog. |
311 // Do not show confirmation dialog. |
307 iModel->SetServiceLoadingType( CPushMtmSettings::EManual ); |
312 iModel->SetServiceLoadingType( CPushMtmSettings::EManual ); |
308 } |
313 } |
309 break; |
314 }//End iPushSLEnabled |
310 } |
315 break; |
311 |
316 } |
312 #endif //__SERIES60_PUSH_SL |
317 |
313 |
318 |
314 default: |
319 default: |
315 { |
320 { |
316 __ASSERT_DEBUG( EFalse, |
321 __ASSERT_DEBUG( EFalse, |
317 UiPanic( EPushMtmUiPanCommandNotSupported ) ); |
322 UiPanic( EPushMtmUiPanCommandNotSupported ) ); |
381 // --------------------------------------------------------- |
386 // --------------------------------------------------------- |
382 // |
387 // |
383 HBufC* CPushSettingsDialog::ConstructSettingTitleL |
388 HBufC* CPushSettingsDialog::ConstructSettingTitleL |
384 ( const TSettingType aSettingType ) const |
389 ( const TSettingType aSettingType ) const |
385 { |
390 { |
386 const TInt titleResId = |
391 TInt titleResId = 0; |
387 aSettingType == EServiceReception ? R_PUSHSD_RECEPT : |
392 |
388 #ifdef __SERIES60_PUSH_SL |
393 if(aSettingType == EServiceReception ) |
389 aSettingType == EServiceLoadingType ? R_PUSHSD_LOADING : |
394 titleResId = R_PUSHSD_RECEPT; |
390 #endif //__SERIES60_PUSH_SL |
395 |
391 KErrNotFound; |
396 else if (aSettingType == EServiceLoadingType) |
392 |
397 { |
|
398 if(iPushSLEnabled ) |
|
399 titleResId = R_PUSHSD_LOADING; |
|
400 } |
|
401 |
|
402 else |
|
403 titleResId = KErrNotFound; |
|
404 |
|
405 |
393 __ASSERT_DEBUG( titleResId != KErrNotFound, |
406 __ASSERT_DEBUG( titleResId != KErrNotFound, |
394 UiPanic( EPushMtmUiPanNotInitialized ) ); |
407 UiPanic( EPushMtmUiPanNotInitialized ) ); |
395 |
408 |
396 return iEikonEnv->AllocReadResourceL( titleResId ); |
409 return iEikonEnv->AllocReadResourceL( titleResId ); |
397 } |
410 } |
405 const TSettingType aSettingType, |
418 const TSettingType aSettingType, |
406 TInt& aVal1ResId, |
419 TInt& aVal1ResId, |
407 TInt& aVal2ResId |
420 TInt& aVal2ResId |
408 ) const |
421 ) const |
409 { |
422 { |
410 aVal1ResId = |
423 if( aSettingType == EServiceReception) |
411 aSettingType == EServiceReception ? R_PUSHSD_RECEP_ON : |
424 aVal1ResId = R_PUSHSD_RECEP_ON; |
412 #ifdef __SERIES60_PUSH_SL |
425 |
413 aSettingType == EServiceLoadingType ? R_PUSHSD_LOAD_AUTOM : |
426 else if((aSettingType == EServiceLoadingType) && iPushSLEnabled ) |
414 #endif //__SERIES60_PUSH_SL |
427 { |
415 KErrNotFound; |
428 aVal1ResId = R_PUSHSD_LOAD_AUTOM; |
416 |
429 } |
417 aVal2ResId = |
430 else |
418 aSettingType == EServiceReception ? R_PUSHSD_RECEP_OFF : |
431 aVal1ResId = KErrNotFound; |
419 #ifdef __SERIES60_PUSH_SL |
432 |
420 aSettingType == EServiceLoadingType ? R_PUSHSD_LOAD_MAN : |
433 |
421 #endif //__SERIES60_PUSH_SL |
434 if( aSettingType == EServiceReception ) |
422 KErrNotFound; |
435 aVal2ResId = R_PUSHSD_RECEP_OFF; |
423 |
436 else if( aSettingType == EServiceLoadingType && iPushSLEnabled) |
|
437 aVal2ResId = R_PUSHSD_LOAD_MAN; |
|
438 else |
|
439 aVal2ResId = KErrNotFound; |
|
440 |
|
441 |
424 __ASSERT_DEBUG( aVal1ResId != KErrNotFound && |
442 __ASSERT_DEBUG( aVal1ResId != KErrNotFound && |
425 aVal2ResId != KErrNotFound, |
443 aVal2ResId != KErrNotFound, |
426 UiPanic( EPushMtmUiPanNotInitialized ) ); |
444 UiPanic( EPushMtmUiPanNotInitialized ) ); |
427 } |
445 } |
428 |
446 |
435 { |
453 { |
436 TInt val1ResId( KErrNotFound ); |
454 TInt val1ResId( KErrNotFound ); |
437 TInt val2ResId( KErrNotFound ); |
455 TInt val2ResId( KErrNotFound ); |
438 ConstructSettingValueArray( aSettingType, val1ResId, val2ResId ); |
456 ConstructSettingValueArray( aSettingType, val1ResId, val2ResId ); |
439 |
457 |
440 const TBool firstSelected = |
458 TBool firstSelected; |
441 aSettingType == EServiceReception ? iModel->ServiceReception() : |
459 |
442 #ifdef __SERIES60_PUSH_SL |
460 if(aSettingType == EServiceReception ) |
443 aSettingType == EServiceLoadingType ? iModel->ServiceLoadingType() == |
461 firstSelected = iModel->ServiceReception(); |
444 CPushMtmSettings::EAutomatic : |
462 |
445 #endif //__SERIES60_PUSH_SL |
463 else if( aSettingType == EServiceLoadingType && iPushSLEnabled ) |
446 EFalse; |
464 { |
447 |
465 firstSelected = (iModel->ServiceLoadingType() == CPushMtmSettings::EAutomatic); |
|
466 } |
|
467 else |
|
468 firstSelected = EFalse; |
|
469 |
|
470 |
|
471 |
448 aIndex = firstSelected ? 0 : 1; |
472 aIndex = firstSelected ? 0 : 1; |
449 return firstSelected ? val1ResId : val2ResId; |
473 return firstSelected ? val1ResId : val2ResId; |
450 } |
474 } |
451 |
475 |
452 // --------------------------------------------------------- |
476 // --------------------------------------------------------- |
488 { |
512 { |
489 iModel->SetServiceReception( aIndex == 0 ? ETrue : EFalse ); |
513 iModel->SetServiceReception( aIndex == 0 ? ETrue : EFalse ); |
490 break; |
514 break; |
491 } |
515 } |
492 |
516 |
493 #ifdef __SERIES60_PUSH_SL |
|
494 |
|
495 case EServiceLoadingType: |
517 case EServiceLoadingType: |
496 { |
518 { |
497 if ( aIndex == 0 ) |
519 if(iPushSLEnabled) |
498 // iModel->ServiceLoadingType() == CPushMtmSettings::EManual |
|
499 { |
520 { |
500 // Display a confirmation dialog first. |
521 if ( aIndex == 0 ) |
501 if ( ShowServiceLoadingTypeConfirmationL() ) |
522 // iModel->ServiceLoadingType() == CPushMtmSettings::EManual |
502 { |
523 { |
503 iModel->SetServiceLoadingType |
524 // Display a confirmation dialog first. |
504 ( CPushMtmSettings::EAutomatic ); |
525 if ( ShowServiceLoadingTypeConfirmationL() ) |
|
526 { |
|
527 iModel->SetServiceLoadingType |
|
528 ( CPushMtmSettings::EAutomatic ); |
|
529 } |
505 } |
530 } |
|
531 else |
|
532 { |
|
533 // Do not show confirmation dialog. |
|
534 iModel->SetServiceLoadingType( CPushMtmSettings::EManual ); |
|
535 } |
506 } |
536 } |
507 else |
537 break; |
508 { |
538 } |
509 // Do not show confirmation dialog. |
|
510 iModel->SetServiceLoadingType( CPushMtmSettings::EManual ); |
|
511 } |
|
512 break; |
|
513 } |
|
514 |
|
515 #endif //__SERIES60_PUSH_SL |
|
516 |
539 |
517 default: |
540 default: |
518 { |
541 { |
519 __ASSERT_DEBUG( EFalse, |
542 __ASSERT_DEBUG( EFalse, |
520 UiPanic( EPushMtmUiPanCommandNotSupported ) ); |
543 UiPanic( EPushMtmUiPanCommandNotSupported ) ); |