109 iHandler = CMusSIPProfileModel::NewL(); |
109 iHandler = CMusSIPProfileModel::NewL(); |
110 MUS_LOG( "[MUSSET] CMusSettingsPlugin::ConstructL() 2" ) |
110 MUS_LOG( "[MUSSET] CMusSettingsPlugin::ConstructL() 2" ) |
111 iModel = CMusSettingsModel::NewL( *iHandler ); |
111 iModel = CMusSettingsModel::NewL( *iHandler ); |
112 iDiskNotifyHandler = CDiskNotifyHandler::NewL( *this, |
112 iDiskNotifyHandler = CDiskNotifyHandler::NewL( *this, |
113 iEikonEnv->FsSession() ); |
113 iEikonEnv->FsSession() ); |
114 User::LeaveIfError( iDiskNotifyHandler->NotifyDisk() ); // Subscribe disk notifications |
114 // Subscribe disk notifications |
|
115 User::LeaveIfError( iDiskNotifyHandler->NotifyDisk() ); |
115 |
116 |
116 iCaption = StringLoader::LoadL( R_GS_VS_PLUGIN_CAPTION ); |
117 iCaption = StringLoader::LoadL( R_GS_VS_PLUGIN_CAPTION ); |
117 CloseResourceFile(); |
118 CloseResourceFile(); |
118 |
119 |
119 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::ConstructL()" ) |
120 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::ConstructL()" ) |
241 // |
242 // |
242 void CMusSettingsPlugin::GetCaptionL( TDes& aCaption ) const |
243 void CMusSettingsPlugin::GetCaptionL( TDes& aCaption ) const |
243 { |
244 { |
244 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::GetCaptionL()" ) |
245 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::GetCaptionL()" ) |
245 if ( iCaption && iCaption->Length() <= aCaption.MaxLength() ) |
246 if ( iCaption && iCaption->Length() <= aCaption.MaxLength() ) |
246 { |
247 { |
247 aCaption.Copy( *iCaption ); |
248 aCaption.Copy( *iCaption ); |
248 } |
249 } |
249 |
250 |
250 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::GetCaptionL()" ) |
251 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::GetCaptionL()" ) |
251 } |
252 } |
252 |
253 |
253 // ----------------------------------------------------------------------------- |
254 // ----------------------------------------------------------------------------- |
329 switch ( currentItem ) |
330 switch ( currentItem ) |
330 { |
331 { |
331 case KGSSettIdVSActivation: |
332 case KGSSettIdVSActivation: |
332 { |
333 { |
333 SwitchOnOffValueL( KGSSettIdVSActivation ); |
334 SwitchOnOffValueL( KGSSettIdVSActivation ); |
334 break; |
335 break; |
335 } |
336 } |
336 case KGSSettIdSIPProfile: |
337 case KGSSettIdSIPProfile: |
337 { |
338 { |
338 ShowVSSettingsProfileSettingDialogL(); |
339 ShowVSSettingsProfileSettingDialogL(); |
339 break; |
340 break; |
340 } |
341 } |
341 case KGSSettIdAutoRecord: |
342 case KGSSettIdAutoRecord: |
342 { |
343 { |
343 SwitchOnOffValueL( KGSSettIdAutoRecord ); |
344 SwitchOnOffValueL( KGSSettIdAutoRecord ); |
344 break; |
345 break; |
345 } |
346 } |
346 case KGSSettIdRecordedVideoSaving: |
347 case KGSSettIdRecordedVideoSaving: |
347 { |
348 { |
348 ShowVSSettingsRecordedVideoSavingSettingDialogL(); |
349 ShowVSSettingsRecordedVideoSavingSettingDialogL(); |
349 break; |
350 break; |
350 } |
351 } |
351 case KGSSettIdNote: |
352 case KGSSettIdNote: |
352 { |
353 { |
353 SwitchOnOffValueL( KGSSettIdNote ); |
354 SwitchOnOffValueL( KGSSettIdNote ); |
354 break; |
355 break; |
355 } |
356 } |
356 default: |
357 default: |
357 { |
358 { |
358 break; |
359 break; |
359 } |
360 } |
402 items); |
403 items); |
403 |
404 |
404 if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) |
405 if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) |
405 { |
406 { |
406 if ( profileMode == CMusSettingsModel::KVsSipProfileDefault ) |
407 if ( profileMode == CMusSettingsModel::KVsSipProfileDefault ) |
407 { |
408 { |
408 if ( oldProfileMode != profileMode ) |
409 if ( oldProfileMode != profileMode ) |
409 { |
410 { |
410 MultimediaSharingSettings::SetSipProfileSettingL( |
411 MultimediaSharingSettings::SetSipProfileSettingL( |
411 CMusSettingsModel::KVsSipProfileDefault ); |
412 CMusSettingsModel::KVsSipProfileDefault ); |
412 Container()->ShowNewProfileActiveAfterCallL(); |
413 Container()->ShowNewProfileActiveAfterCallL(); |
413 Container()->UpdateListBoxL( KGSSettIdSIPProfile ); |
414 Container()->UpdateListBoxL( KGSSettIdSIPProfile ); |
414 } |
415 } |
415 } |
416 } |
416 else |
417 else |
417 { |
418 { |
418 ShowVSSettingsSelectSipProfileDialogL(); |
419 ShowVSSettingsSelectSipProfileDialogL(); |
419 } |
420 } |
420 } |
421 } |
421 CleanupStack::PopAndDestroy( items ); |
422 CleanupStack::PopAndDestroy( items ); |
422 MUS_LOG( |
423 MUS_LOG( |
423 "[MUSSET] <- CMusSettingsPlugin::ShowVSSettingsProfileSettingDialogL()" ) |
424 "[MUSSET] <- CMusSettingsPlugin::ShowVSSettingsProfileSettingDialogL()" ) |
424 } |
425 } |
433 // Get the array of the profile names, ownership changes |
434 // Get the array of the profile names, ownership changes |
434 CDesCArray* array = iModel->ListOfProfileNamesL(); |
435 CDesCArray* array = iModel->ListOfProfileNamesL(); |
435 CleanupStack::PushL( array ); |
436 CleanupStack::PushL( array ); |
436 |
437 |
437 if ( array->Count() < 1 ) |
438 if ( array->Count() < 1 ) |
438 { |
439 { |
439 ShowNoProfilesNotificationL(); |
440 ShowNoProfilesNotificationL(); |
440 } |
441 } |
441 else |
442 else |
442 { |
443 { |
443 TInt selectedIndex = iModel->ProfileIndexByIdL( |
444 TInt selectedIndex = iModel->ProfileIndexByIdL( |
444 MultimediaSharingSettings::SipProfileSettingL() ); |
445 MultimediaSharingSettings::SipProfileSettingL() ); |
445 TInt currentIndex ( selectedIndex ); |
446 TInt currentIndex ( selectedIndex ); |
446 |
447 |
447 if ( selectedIndex == KErrNotFound ) |
448 if ( selectedIndex == KErrNotFound ) |
448 { |
449 { |
449 // first profile in the list |
450 // first profile in the list |
450 selectedIndex = CMusSettingsModel::KVsSipProfileDefault; |
451 selectedIndex = CMusSettingsModel::KVsSipProfileDefault; |
451 } |
452 } |
452 |
453 |
453 // Create and display the pop-up list |
454 // Create and display the pop-up list |
454 CAknRadioButtonSettingPage* defaultPopUp = |
455 CAknRadioButtonSettingPage* defaultPopUp = |
455 new ( ELeave ) CAknRadioButtonSettingPage( |
456 new ( ELeave ) CAknRadioButtonSettingPage( |
456 R_VS_SIP_PROFILE_LIST_VIEW_SELECT_SETTING_PAGE, |
457 R_VS_SIP_PROFILE_LIST_VIEW_SELECT_SETTING_PAGE, |
457 selectedIndex, |
458 selectedIndex, |
458 array ); |
459 array ); |
459 if ( defaultPopUp->ExecuteLD( |
460 if ( defaultPopUp->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) |
460 CAknSettingPage::EUpdateWhenChanged ) ) |
461 { |
461 { |
462 if ( selectedIndex != currentIndex ) |
462 if ( selectedIndex != currentIndex ) |
463 { |
463 { |
464 // User has changed the selected profile, set new |
464 // User has changed the selected profile, set new |
465 // setting to persistent storage |
465 // setting to persistent storage |
466 TUint newValue = iModel->ProfileIdByIndex( selectedIndex ); |
466 TUint newValue = iModel->ProfileIdByIndex( selectedIndex ); |
467 MultimediaSharingSettings::SetSipProfileSettingL( newValue ); |
467 MultimediaSharingSettings::SetSipProfileSettingL( newValue ); |
468 Container()->ShowNewProfileActiveAfterCallL(); |
468 Container()->ShowNewProfileActiveAfterCallL(); |
469 Container()->UpdateListBoxL( KGSSettIdSIPProfile ); |
469 Container()->UpdateListBoxL( KGSSettIdSIPProfile ); |
470 } |
470 } |
471 } |
471 } |
472 } |
472 } |
|
473 |
473 |
474 CleanupStack::PopAndDestroy( array ); // array |
474 CleanupStack::PopAndDestroy( array ); // array |
475 } |
475 } |
476 |
476 |
477 // ----------------------------------------------------------------------------- |
477 // ----------------------------------------------------------------------------- |
585 void CMusSettingsPlugin::SwitchOnOffValueL( TInt aValue ) |
585 void CMusSettingsPlugin::SwitchOnOffValueL( TInt aValue ) |
586 { |
586 { |
587 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::SwitchOnOffValueL()" ) |
587 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::SwitchOnOffValueL()" ) |
588 |
588 |
589 switch( aValue ) |
589 switch( aValue ) |
590 { |
590 { |
591 case KGSSettIdVSActivation: |
591 case KGSSettIdVSActivation: |
592 { |
592 { |
593 MusSettingsKeys::TOperatorVariant operatorVarValue = |
593 MusSettingsKeys::TOperatorVariant operatorVarValue = |
594 MultimediaSharingSettings::OperatorVariantSettingL(); |
594 MultimediaSharingSettings::OperatorVariantSettingL(); |
595 |
595 |
596 if ( operatorVarValue == MusSettingsKeys::EOperatorSpecific ) |
596 if ( operatorVarValue == MusSettingsKeys::EOperatorSpecific ) |
597 { |
597 { |
598 |
598 |
599 TInt aCallCount = 0; |
599 TInt aCallCount = 0; |
600 RProperty::Get( NMusSessionInformationApi::KCategoryUid, |
600 RProperty::Get( NMusSessionInformationApi::KCategoryUid, |
601 NMusSessionInformationApi::KMusCallCount, |
601 NMusSessionInformationApi::KMusCallCount, |
602 aCallCount ); |
602 aCallCount ); |
603 MUS_LOG1( "CallCount ( %d )", aCallCount) |
603 MUS_LOG1( "[MUSSET] CallCount ( %d )", aCallCount) |
604 if ( aCallCount == 0 ) |
604 if ( aCallCount == 0 ) |
605 { |
605 { |
|
606 MUS_LOG( "[MUSSET] no calls. Set VS on/off" ) |
606 TBool enabled = EFalse; |
607 TBool enabled = EFalse; |
607 TRAPD( error, enabled = iHandler->ProfileEnabledL( )); |
608 TRAPD( error, enabled = iHandler->ProfileEnabledL( )); |
608 if ( error != KErrNone ) |
609 MUS_LOG2( "[MUSSET] VS now %d (err=%d)", enabled, error ) |
|
610 if ( !error ) |
609 { |
611 { |
610 // Problems with re-reading profiles; use existing array |
612 if( enabled ) //currently enabled => disable |
611 MUS_LOG1("Error returned( %d )", error ) |
613 { |
612 } |
614 TRAPD( error, iHandler->DisableProfileL() ); |
613 else |
615 MUS_LOG1( "[MUSSET] VS is off (err=%d)", error ) |
614 { |
616 //activation disabled = true |
615 if( enabled ) |
617 //to remove warning :) |
|
618 enabled = error != KErrNone ? ETrue : ETrue; |
|
619 iModel->SetActivationItem( enabled ); |
|
620 } |
|
621 else//currently disabled => enable |
616 { |
622 { |
617 TRAPD( error, iHandler->EnableProfileL() ); |
623 TRAPD( error, iHandler->EnableProfileL() ); |
618 if ( error != KErrNone ) |
624 MUS_LOG1( "[MUSSET] VS is on (err=%d)", error ) |
619 { |
625 //if failed activation disabled = true |
620 // Problems with re-reading profiles; use existing array |
626 enabled = error != KErrNone; |
621 iModel->SetActivationItem( ETrue ); |
627 //activation disabled = false/true(if failed) |
622 } |
628 iModel->SetActivationItem( enabled ); |
623 iModel->SetActivationItem( EFalse ); |
|
624 } |
|
625 else |
|
626 { |
|
627 TRAP_IGNORE( iHandler->DisableProfileL() ); |
|
628 iModel->SetActivationItem( ETrue ); |
|
629 } |
629 } |
630 } |
630 } |
631 } |
631 } |
632 } |
632 } |
633 else |
633 else |
647 MultimediaSharingSettings::SetActivationSettingL( |
647 MultimediaSharingSettings::SetActivationSettingL( |
648 MusSettingsKeys::EAlwaysActive ); |
648 MusSettingsKeys::EAlwaysActive ); |
649 } |
649 } |
650 } |
650 } |
651 break; |
651 break; |
652 } |
652 } |
653 case KGSSettIdAutoRecord: |
653 case KGSSettIdAutoRecord: |
654 { |
654 { |
655 if ( MusSettingsKeys::EAutoRecordOff == |
655 if ( MusSettingsKeys::EAutoRecordOff == |
656 MultimediaSharingSettings::AutoRecordSettingL() ) |
656 MultimediaSharingSettings::AutoRecordSettingL() ) |
657 { |
657 { |
658 MultimediaSharingSettings::SetAutoRecordSettingL( |
658 MultimediaSharingSettings::SetAutoRecordSettingL( |
659 MusSettingsKeys::EAutoRecordOn ); |
659 MusSettingsKeys::EAutoRecordOn ); |
660 } |
660 } |
661 else |
661 else |
662 { |
662 { |
663 MultimediaSharingSettings::SetAutoRecordSettingL( |
663 MultimediaSharingSettings::SetAutoRecordSettingL( |
664 MusSettingsKeys::EAutoRecordOff ); |
664 MusSettingsKeys::EAutoRecordOff ); |
665 } |
665 } |
666 break; |
666 break; |
667 } |
667 } |
668 case KGSSettIdNote: |
668 case KGSSettIdNote: |
669 { |
669 { |
670 if ( MusSettingsKeys::EAuditoryNotificationOn == |
670 if ( MusSettingsKeys::EAuditoryNotificationOn == |
671 MultimediaSharingSettings::AuditoryNotificationSettingL() ) |
671 MultimediaSharingSettings::AuditoryNotificationSettingL() ) |
672 { |
672 { |
673 MultimediaSharingSettings::SetAuditoryNotificationSettingL( |
|
674 MusSettingsKeys::EAuditoryNotificationOff ); |
|
675 } |
|
676 else |
|
677 { |
|
678 MultimediaSharingSettings::SetAuditoryNotificationSettingL( |
673 MultimediaSharingSettings::SetAuditoryNotificationSettingL( |
679 MusSettingsKeys::EAuditoryNotificationOn ); |
674 MusSettingsKeys::EAuditoryNotificationOff ); |
680 } |
675 } |
681 break; |
676 else |
682 } |
677 { |
683 |
678 MultimediaSharingSettings::SetAuditoryNotificationSettingL( |
684 default: |
679 MusSettingsKeys::EAuditoryNotificationOn ); |
685 { |
680 } |
686 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::SwitchOnOffValueL() - error unknown setting" ) |
681 break; |
687 User::Leave( KErrArgument ); |
682 } |
688 } |
683 default: |
689 } |
684 { |
|
685 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::SwitchOnOffValueL() - error unknown setting" ) |
|
686 User::Leave( KErrArgument ); |
|
687 } |
|
688 } |
690 |
689 |
691 Container()->UpdateListBoxL( aValue ); |
690 Container()->UpdateListBoxL( aValue ); |
692 |
691 |
693 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::SwitchOnOffValueL()" ) |
692 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::SwitchOnOffValueL()" ) |
694 } |
693 } |