diff -r 73a1feb507fb -r bc78a40cd63c mmshplugins/mmshsettingsuiplugin/src/mussettingsplugin.cpp --- a/mmshplugins/mmshsettingsuiplugin/src/mussettingsplugin.cpp Tue Aug 31 15:12:07 2010 +0300 +++ b/mmshplugins/mmshsettingsuiplugin/src/mussettingsplugin.cpp Wed Sep 01 12:31:01 2010 +0100 @@ -12,6 +12,7 @@ * Contributors: * * Description: MUSSettingsPlugin implementation. +* Version : %version: be1sipx1#38 % << Don't touch! Updated by Synergy at check-out. * */ @@ -54,13 +55,20 @@ // ======== MEMBER FUNCTIONS ======== +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// CMusSettingsPlugin::CMusSettingsPlugin() : iResources( *iCoeEnv ) { MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::CMusSettingsPlugin()" ) } - +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// CMusSettingsPlugin::~CMusSettingsPlugin() { MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::~CMusSettingsPlugin()" ) @@ -71,29 +79,31 @@ delete iContainer; iContainer = NULL; } - - iResources.Close(); + + CloseResourceFile(); delete iModel; iModel = NULL; delete iHandler; iHandler = NULL; delete iDiskNotifyHandler; + delete iCaption; MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::~CMusSettingsPlugin()" ) } - +// ----------------------------------------------------------------------------- +// +// +// ----------------------------------------------------------------------------- +// void CMusSettingsPlugin::ConstructL() { MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::ConstructL()" ) FeatureManager::InitializeLibL(); + + iResourceFileOpen = false; + OpenResourceFileL(); - HBufC* fileName = MusResourceFinderUtil::ResourcePathL( - KVSSettingsResourceFileName ); - TFileName fName(*fileName); - delete fileName; - MUS_LOG_TDESC( "[MUSSET] Resource FileName ",fName ) - iResources.OpenL(fName); MUS_LOG( "[MUSSET] Constructing the Base " ) BaseConstructL( R_GS_VS_VIEW ); iHandler = CMusSIPProfileModel::NewL(); @@ -101,11 +111,20 @@ iModel = CMusSettingsModel::NewL( *iHandler ); iDiskNotifyHandler = CDiskNotifyHandler::NewL( *this, iEikonEnv->FsSession() ); - User::LeaveIfError( iDiskNotifyHandler->NotifyDisk() ); // Subscribe disk notifications + // Subscribe disk notifications + User::LeaveIfError( iDiskNotifyHandler->NotifyDisk() ); + + iCaption = StringLoader::LoadL( R_GS_VS_PLUGIN_CAPTION ); + CloseResourceFile(); + MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::ConstructL()" ) } - +// ----------------------------------------------------------------------------- +// +// +// ----------------------------------------------------------------------------- +// CMusSettingsPlugin* CMusSettingsPlugin::NewL( TAny* /*aInitParams*/ ) { MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::NewL()" ) @@ -117,11 +136,10 @@ return self; } - -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // From class CAknView. // Returns UID of *this* settings plugin. -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // TUid CMusSettingsPlugin::Id() const { @@ -130,11 +148,10 @@ return KGSVSSettingsPluginUID; } - -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // Hides non-virtual member from base class CGSBaseView. // Handles a change in client rectangle size. -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // void CMusSettingsPlugin::HandleClientRectChange() { @@ -146,11 +163,10 @@ MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleClientRectChange()" ) } - -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // From class CAknView. // Called by framework when *this* control is to be activated/focused. -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // void CMusSettingsPlugin::DoActivateL( const TVwsViewId& aPrevViewId, @@ -158,69 +174,39 @@ const TDesC8& aCustomMessage ) { MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::DoActivateL()" ) + OpenResourceFileL(); CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage ); MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::DoActivateL()" ) } - -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // From class CAknView. // Called by framework when *this* control is to be deactivated. -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // void CMusSettingsPlugin::DoDeactivate() { MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::DoDeactivate()" ) CGSBaseView::DoDeactivate(); + CloseResourceFile(); MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::DoDeactivate()" ) } - -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // From class CAknView. // Handles a user selected menu command. -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // void CMusSettingsPlugin::HandleCommandL( TInt aCommand ) { MUS_LOG1( "[MUSSET] -> CMusSettingsPlugin::HandleCommandL()( %d )", aCommand ) - CMusSettingsContainer& container = - *static_cast( iContainer ); - const TInt currentItem = container.CurrentFeatureId(); - switch ( aCommand ) { case EGSMSKCmdAppChange: - case EGSCmdAppChange: +// case EGSCmdAppChange: { - if ( currentItem == KGSSettIdVSActivation - && aCommand == EGSCmdAppChange ) - { - if ( iModel->VSSettingsOperatorVariantL() == - MusSettingsKeys::EOperatorSpecific ) - { - ShowOperatorSpecificActivationSettingDialogL(); - } - else - { - ShowVSSettingsActivationSettingDialogL(); - } - } - else if ( currentItem == KGSSettIdRecordedVideoSaving - && aCommand == EGSCmdAppChange ) - { - ShowVSSettingsRecordedVideoSavingSettingDialogL(); - } - else if ( KGSSettIdNote == currentItem - && EGSCmdAppChange == aCommand ) - { - ShowVSSettingsNoteSettingDialogL(); - } - else - { - HandleListBoxSelectionL(); - } + HandleListBoxSelectionL(); break; } @@ -249,26 +235,26 @@ MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleCommandL()" ) } - -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // From class CGSPluginInterface. // Gets caption text of *this* plugin. -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // void CMusSettingsPlugin::GetCaptionL( TDes& aCaption ) const { MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::GetCaptionL()" ) - HBufC* result = StringLoader::LoadL( R_GS_VS_PLUGIN_CAPTION ); - aCaption.Copy( *result ); - delete result; + if ( iCaption && iCaption->Length() <= aCaption.MaxLength() ) + { + aCaption.Copy( *iCaption ); + } + MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::GetCaptionL()" ) } - -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // From class CGSPluginInterface. // Returns provider category of *this* plugin. -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // TInt CMusSettingsPlugin::PluginProviderCategory() const { @@ -276,11 +262,10 @@ return KGSPluginProviderInternal; } - -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // From class MEikMenuObserver. // Called by framework before creating menus -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // void CMusSettingsPlugin::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) @@ -294,12 +279,11 @@ } } } - -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // From MDiskNotifyHandlerCallback // Called by framework When disk status changed -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // void CMusSettingsPlugin::HandleNotifyDisk( TInt /*aError*/, const TDiskEvent& /*aEvent*/ ) @@ -319,11 +303,10 @@ MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleNotifyDisk()" ) } - -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // From class CGSBaseView. // Called by GS framework to create a GS container for *this* plugin. -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // void CMusSettingsPlugin::NewContainerL() { @@ -331,11 +314,10 @@ iContainer = new( ELeave ) CMusSettingsContainer( *iModel ); } - -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // From class CGSBaseView. // Handles users "middle click" aka MSK on selected feature. -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // void CMusSettingsPlugin::HandleListBoxSelectionL() { @@ -343,61 +325,35 @@ CMusSettingsContainer& container = *static_cast( iContainer ); const TInt currentItem = container.CurrentFeatureId(); - - RDebug::Print( _L( - "[CMusSettingsPlugin] Item selected: %d" ), - currentItem ); - - MusSettingsKeys::TOperatorVariant operatorVarValue = - iModel->VSSettingsOperatorVariantL(); + MUS_LOG1( "[MUSSET] Item selected: ", currentItem ) switch ( currentItem ) { case KGSSettIdVSActivation: { - if ( operatorVarValue == MusSettingsKeys::EOperatorSpecific ) - { - SwitchOnOffValueL( KGSSettIdVSActivation ); - container.UpdateListBoxL( KGSSettIdVSActivation ); - } - else - { - ShowVSSettingsActivationSettingDialogL(); - } - break; + SwitchOnOffValueL( KGSSettIdVSActivation ); + break; } - case KGSSettIdSIPProfile: { ShowVSSettingsProfileSettingDialogL(); break; } - case KGSSettIdAutoRecord: { SwitchOnOffValueL( KGSSettIdAutoRecord ); - container.UpdateListBoxL( KGSSettIdAutoRecord ); - break; + break; } - case KGSSettIdRecordedVideoSaving: { - - ShowVSSettingsRecordedVideoSavingSettingDialogL(); - -// SwitchOnOffValueL( KGSSettIdRecordedVideoSaving ); -// container.UpdateListBoxL( KGSSettIdRecordedVideoSaving ); - - break; + ShowVSSettingsRecordedVideoSavingSettingDialogL(); + break; } - case KGSSettIdNote: { - SwitchOnOffValueL( KGSSettIdNote ); - container.UpdateListBoxL( KGSSettIdNote ); - break; + SwitchOnOffValueL( KGSSettIdNote ); + break; } - default: { break; @@ -406,12 +362,11 @@ MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleListBoxSelectionL()" ) } - -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // From class CGSBaseView. // Returns container class of *this* plugin. iContainer is always garanteed to // be of type CMusSettingsContainer*. -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // CMusSettingsContainer* CMusSettingsPlugin::Container() { @@ -419,115 +374,17 @@ return static_cast( iContainer ); } - -// ---------------------------------------------------------------------------- -// Shows a dialog for user to modify VS activation setting. Note that this -// method has an alternative method for operator specific variant. -// ---------------------------------------------------------------------------- -// -void CMusSettingsPlugin::ShowVSSettingsActivationSettingDialogL() - { - MUS_LOG( - "[MUSSET] -> CMusSettingsPlugin::ShowVSSettingsActivationSettingDialogL()" - ) - - MusSettingsKeys::TActivation currentValue = - iModel->VSSettingsActivationL(); - - CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL( - R_ACTIVATION_SETTING_PAGE_LBX ); - - CleanupStack::PushL( items ); - TInt intCurrentValue = static_cast( currentValue ); - - CAknRadioButtonSettingPage* dlg = - new ( ELeave ) CAknRadioButtonSettingPage( - R_ACTIVATION_SETTING_PAGE, - intCurrentValue, - items); - - if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) - { - currentValue = - static_cast( intCurrentValue ); - - iModel->SetVSSettingsActivationL( currentValue ); - Container()->UpdateListBoxL( KGSSettIdVSActivation ); - } - - CleanupStack::PopAndDestroy( items ); - MUS_LOG( - "[MUSSET] <- CMusSettingsPlugin::ShowVSSettingsActivationSettingDialogL()" ) - } - - -// ---------------------------------------------------------------------------- -// Shows a dialog for user to modify VS activation setting. Note that this -// method is used only for operator specific variant. Alternative method for -// "standard" variant exists. Note that because standard variant contains 3 -// different values and operator variant contains only 2 values (0,2) the value -// 2 (MusSettingsKeys::ENever) is converted to value 1 -// (MusSettingsKeys::EActiveInHomeNetworks) in operator variant just before -// showing the dialog. After showing the dialog the conversion mentioned above -// is reversed. This temporarily conversion is done solely to use values 0 and -// 1 for direct mapping to items array. -// ---------------------------------------------------------------------------- -// -void CMusSettingsPlugin::ShowOperatorSpecificActivationSettingDialogL() - { - MUS_LOG( - "[MUSSET] -> CMusSettingsPlugin::ShowOperatorSpecificActivationSettingDialogL()" - ) - - MusSettingsKeys::TActivation currentValue = - iModel->VSSettingsActivationL(); - - if ( currentValue == MusSettingsKeys::ENever ) - { - currentValue = MusSettingsKeys::EActiveInHomeNetworks; - } - - CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL( - R_OPERATOR_ACTIVATION_SETTING_PAGE_LBX); - - CleanupStack::PushL( items ); - TInt intCurrentValue = static_cast(currentValue); - - CAknRadioButtonSettingPage* dlg = - new ( ELeave ) CAknRadioButtonSettingPage( - R_ACTIVATION_SETTING_PAGE, - intCurrentValue, - items ); - - if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) - { - currentValue = - static_cast( intCurrentValue ); - if ( currentValue == MusSettingsKeys::EActiveInHomeNetworks ) - { - currentValue = MusSettingsKeys::ENever; - } - iModel->SetVSSettingsActivationL( currentValue ); - Container()->UpdateListBoxL( KGSSettIdVSActivation ); - } - - CleanupStack::PopAndDestroy( items ); - MUS_LOG( - "[MUSSET] <- CMusSettingsPlugin::ShowOperatorSpecificActivationSettingDialogL()" ) - } - - -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // Shows SIP profile setting dialog (i.e. "use default profile" or "select // profile from list"). If select profile from list is selected, a list of // SIP profiles is provided for user to choose wanted SIP profile. -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // void CMusSettingsPlugin::ShowVSSettingsProfileSettingDialogL() { MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::ShowVSSettingsProfileSettingDialogL()" ) - TInt cenRepValue = iModel->VSSettingsProfileL(); + TInt cenRepValue = MultimediaSharingSettings::SipProfileSettingL(); TInt profileMode = CMusSettingsModel::KVsSipProfileDefault; if ( cenRepValue != CMusSettingsModel::KVsSipProfileDefault ) { @@ -548,29 +405,29 @@ if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) { if ( profileMode == CMusSettingsModel::KVsSipProfileDefault ) - { - if ( oldProfileMode != profileMode ) - { - iModel->SetVSSettingsProfileL( - CMusSettingsModel::KVsSipProfileDefault ); - Container()->ShowNewProfileActiveAfterCallL(); - Container()->UpdateListBoxL( KGSSettIdSIPProfile ); - } - } + { + if ( oldProfileMode != profileMode ) + { + MultimediaSharingSettings::SetSipProfileSettingL( + CMusSettingsModel::KVsSipProfileDefault ); + Container()->ShowNewProfileActiveAfterCallL(); + Container()->UpdateListBoxL( KGSSettIdSIPProfile ); + } + } else - { + { ShowVSSettingsSelectSipProfileDialogL(); - } + } } CleanupStack::PopAndDestroy( items ); MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::ShowVSSettingsProfileSettingDialogL()" ) } -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // Provides user a list of SIP profiles to select from. If no SIP profiles // exist an error note is displayed. -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // void CMusSettingsPlugin::ShowVSSettingsSelectSipProfileDialogL() { @@ -579,50 +436,48 @@ CleanupStack::PushL( array ); if ( array->Count() < 1 ) - { - ShowNoProfilesNotificationL(); - } + { + ShowNoProfilesNotificationL(); + } else - { - TInt selectedIndex = iModel->ProfileIndexByIdL( - iModel->VSSettingsProfileL() ); - TInt currentIndex ( selectedIndex ); + { + TInt selectedIndex = iModel->ProfileIndexByIdL( + MultimediaSharingSettings::SipProfileSettingL() ); + TInt currentIndex ( selectedIndex ); - if ( selectedIndex == KErrNotFound ) - { - // first profile in the list - selectedIndex = CMusSettingsModel::KVsSipProfileDefault; - } + if ( selectedIndex == KErrNotFound ) + { + // first profile in the list + selectedIndex = CMusSettingsModel::KVsSipProfileDefault; + } - // Create and display the pop-up list - CAknRadioButtonSettingPage* defaultPopUp = - new ( ELeave ) CAknRadioButtonSettingPage( - R_VS_SIP_PROFILE_LIST_VIEW_SELECT_SETTING_PAGE, - selectedIndex, - array ); - if ( defaultPopUp->ExecuteLD( - CAknSettingPage::EUpdateWhenChanged ) ) - { - if ( selectedIndex != currentIndex ) - { - // User has changed the selected profile, set new - // setting to persistent storage - TUint newValue = iModel->ProfileIdByIndex( selectedIndex ); - iModel->SetVSSettingsProfileL( newValue ); - Container()->ShowNewProfileActiveAfterCallL(); - Container()->UpdateListBoxL( KGSSettIdSIPProfile ); - } - } - } + // Create and display the pop-up list + CAknRadioButtonSettingPage* defaultPopUp = + new ( ELeave ) CAknRadioButtonSettingPage( + R_VS_SIP_PROFILE_LIST_VIEW_SELECT_SETTING_PAGE, + selectedIndex, + array ); + if ( defaultPopUp->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) + { + if ( selectedIndex != currentIndex ) + { + // User has changed the selected profile, set new + // setting to persistent storage + TUint newValue = iModel->ProfileIdByIndex( selectedIndex ); + MultimediaSharingSettings::SetSipProfileSettingL( newValue ); + Container()->ShowNewProfileActiveAfterCallL(); + Container()->UpdateListBoxL( KGSSettIdSIPProfile ); + } + } + } CleanupStack::PopAndDestroy( array ); // array } - -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // Provides a dialog for user to choose saving location for recorderded video. // (locations are naturally phone memory or memory card). -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // void CMusSettingsPlugin::ShowVSSettingsRecordedVideoSavingSettingDialogL() { @@ -632,20 +487,9 @@ TParsePtrC( PathInfo::PhoneMemoryRootPath() ).Drive() ); TDriveUnit mmcUnit( TParsePtrC( PathInfo::MemoryCardRootPath() ).Drive() ); TInt currentValue = iModel->VSSettingsRecordedVideoSavingL(); - - - CAknMemorySelectionDialogMultiDrive* dlg = - iModel->MemorySelectionDialogLC(); - - // Use ECFDDialogTypeSave to have double list box in the query -/* CAknMemorySelectionDialog* dlg = CAknMemorySelectionDialog::NewL( - ECFDDialogTypeSave, - R_VS_RECORDED_VIDEO_SAVING_SETTING_PAGE, - EFalse ); - CleanupStack::PushL( dlg ); -*/ - + CAknMemorySelectionDialogMultiDrive* dlg = + iModel->MemorySelectionDialogLC(); TBool result( EFalse ); TDriveNumber driveNumber((TDriveNumber)currentValue); @@ -654,67 +498,37 @@ if ( result != CAknCommonDialogsBase::TReturnKey( CAknCommonDialogsBase::ERightSoftkey) ) { - if ( ( TInt ) driveNumber != currentValue ) + if ( /*( TInt )*/ driveNumber != currentValue ) { - iModel->SetVSSettingsRecordedVideoSavingL( ( TInt ) driveNumber ); + MultimediaSharingSettings::SetVideoLocationSettingL( ( TInt ) driveNumber ); } Container()->UpdateListBoxL( KGSSettIdRecordedVideoSaving ); } -/* CAknMemorySelectionDialog::TMemory mem; - if ( currentValue == ( TInt )mmcUnit ) - { - mem = CAknMemorySelectionDialog::EMemoryCard; - } - else - { - mem = CAknMemorySelectionDialog::EPhoneMemory; - } - - TFileName ignore; - TFileName path; - - if ( dlg->ExecuteL( mem, &path, &ignore ) ) - { - if ( mem == CAknMemorySelectionDialog::EPhoneMemory - && currentValue != ( TInt ) phoneMemUnit ) - { - iModel->SetVSSettingsRecordedVideoSavingL( ( TInt )phoneMemUnit ); - Container()->UpdateListBoxL( KGSSettIdRecordedVideoSaving ); - } - else if ( mem == CAknMemorySelectionDialog::EMemoryCard - && currentValue != ( TInt )mmcUnit ) - { - iModel->SetVSSettingsRecordedVideoSavingL( ( TInt )mmcUnit ); - Container()->UpdateListBoxL( KGSSettIdRecordedVideoSaving ); - } - } -*/ - CleanupStack::PopAndDestroy(dlg); MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::ShowVSSettingsRecordedVideoSavingSettingDialogL()" ) } - -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // In standard variant provides user a "Capability auditory note" setting // dialog, and in operator variant provides user an "Alerts" setting dialog. // Note that in both variants the different dialogs toggle the same setting. -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // void CMusSettingsPlugin::ShowVSSettingsNoteSettingDialogL() { MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::ShowVSSettingsNoteSettingDialogL()" ) MusSettingsKeys::TAuditoryNotification currentValue = - iModel->VSSettingsNoteL(); + MultimediaSharingSettings::AuditoryNotificationSettingL(); TInt intCurrentValue = static_cast( currentValue ); CAknRadioButtonSettingPage* dlg; CDesCArrayFlat* items; - if ( iModel->VSSettingsOperatorVariantL() == MusSettingsKeys::EStandard ) + if ( MultimediaSharingSettings::OperatorVariantSettingL() == + MusSettingsKeys::EStandard ) { items = iCoeEnv->ReadDesC16ArrayResourceL( R_VS_AUDIO_SETTING_PAGE_LBX ); @@ -738,9 +552,9 @@ if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) { currentValue = - static_cast - ( intCurrentValue ); - iModel->SetVSSettingsNoteL( currentValue ); + static_cast( intCurrentValue ); + MultimediaSharingSettings::SetAuditoryNotificationSettingL( + currentValue ); Container()->UpdateListBoxL( KGSSettIdNote ); } @@ -749,10 +563,9 @@ "[MUSSET] <- CMusSettingsPlugin::ShowVSSettingsNoteSettingDialogL()" ) } - -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // Shows a notifications that no SIP profiles exists. -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // void CMusSettingsPlugin::ShowNoProfilesNotificationL() { @@ -764,84 +577,133 @@ MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::ShowNoProfilesNotificationL()" ) } - -// --------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // Switches between two possible values from one to another (i.e. toggles a // setting on/off). Toggled setting is passed in aValue parameter. -// --------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // void CMusSettingsPlugin::SwitchOnOffValueL( TInt aValue ) { + MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::SwitchOnOffValueL()" ) + switch( aValue ) - { - case KGSSettIdVSActivation: - { - if ( MusSettingsKeys::EAlwaysActive - == iModel->VSSettingsActivationL() ) - { - iModel->SetVSSettingsActivationL( MusSettingsKeys::ENever ); - } - else - { - iModel->SetVSSettingsActivationL( - MusSettingsKeys::EAlwaysActive ); - } - break; - } - case KGSSettIdAutoRecord: - { - if ( MusSettingsKeys::EAutoRecordOff == - iModel->VSSettingsAutoRecordL() ) - { - iModel->SetVSSettingsAutoRecordL( - MusSettingsKeys::EAutoRecordOn ); - } - else - { - iModel->SetVSSettingsAutoRecordL( - MusSettingsKeys::EAutoRecordOff ); - } - break; - } - case KGSSettIdRecordedVideoSaving: - { - TDriveUnit phoneMemUnit( - TParsePtrC( PathInfo::PhoneMemoryRootPath() ).Drive() ); - TDriveUnit mmcUnit( - TParsePtrC( PathInfo::MemoryCardRootPath() ).Drive() ); - - if ( ( TInt )phoneMemUnit - == iModel->VSSettingsRecordedVideoSavingL() ) - { - iModel->SetVSSettingsRecordedVideoSavingL( ( TInt )mmcUnit ); - } - else - { - iModel->SetVSSettingsRecordedVideoSavingL( ( TInt )phoneMemUnit ); - } - break; - } - case KGSSettIdNote: - { - if ( MusSettingsKeys::EAuditoryNotificationOn - == iModel->VSSettingsNoteL() ) - { - iModel->SetVSSettingsNoteL( - MusSettingsKeys::EAuditoryNotificationOff ); - } - else - { - iModel->SetVSSettingsNoteL( - MusSettingsKeys::EAuditoryNotificationOn ); - } - break; - } - default: - { - MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::SwitchOnOffValueL() - error unknown setting" ) - User::Leave( KErrArgument ); - } - } + { + case KGSSettIdVSActivation: + { + MusSettingsKeys::TOperatorVariant operatorVarValue = + MultimediaSharingSettings::OperatorVariantSettingL(); + + if ( operatorVarValue == MusSettingsKeys::EOperatorSpecific ) + { + + TInt aCallCount = 0; + RProperty::Get( NMusSessionInformationApi::KCategoryUid, + NMusSessionInformationApi::KMusCallCount, + aCallCount ); + MUS_LOG1( "[MUSSET] CallCount ( %d )", aCallCount) + if ( aCallCount == 0 ) + { + MUS_LOG( "[MUSSET] no calls. Set VS on/off" ) + TBool enabled = EFalse; + TRAPD( error, enabled = iHandler->ProfileEnabledL( )); + MUS_LOG2( "[MUSSET] VS now %d (err=%d)", enabled, error ) + if ( !error ) + { + if( enabled ) //currently enabled => disable + { + TRAPD( error, iHandler->DisableProfileL() ); + MUS_LOG1( "[MUSSET] VS is off (err=%d)", error ) + //activation disabled = true + iModel->SetActivationItem( enabled ); + + if ( error == KErrNone ) + { + MUS_LOG( "[MUSSET] Activation setting set off" ) + //MusSettingsKeys::ENever = 2 can not be used anymore + //EActiveInHomeNetworks = 1 is used instead -> off + MultimediaSharingSettings::SetActivationSettingL( + MusSettingsKeys::EActiveInHomeNetworks ); + } + } + else//currently disabled => enable + { + TRAPD( error, iHandler->EnableProfileL() ); + MUS_LOG1( "[MUSSET] VS is on (err=%d)", error ) + //if failed activation disabled = true + enabled = error != KErrNone; + //activation disabled = false/true(if failed) + iModel->SetActivationItem( enabled ); + + if ( error == KErrNone ) + { + MUS_LOG( "[MUSSET] Activation setting set on" ) + MultimediaSharingSettings::SetActivationSettingL( + MusSettingsKeys::EAlwaysActive ); + } + } + } + } + } + else + { + if ( MusSettingsKeys::EAlwaysActive == + MultimediaSharingSettings::ActivationSettingL() ) + { + MUS_LOG( "[MUSSET] Activation setting set off" ) + //MusSettingsKeys::ENever = 2 can not be used anymore + //EActiveInHomeNetworks = 1 is used instead -> off + MultimediaSharingSettings::SetActivationSettingL( + MusSettingsKeys::EActiveInHomeNetworks ); + } + else + { + MUS_LOG( "[MUSSET] Activation setting set on" ) + MultimediaSharingSettings::SetActivationSettingL( + MusSettingsKeys::EAlwaysActive ); + } + } + break; + } + case KGSSettIdAutoRecord: + { + if ( MusSettingsKeys::EAutoRecordOff == + MultimediaSharingSettings::AutoRecordSettingL() ) + { + MultimediaSharingSettings::SetAutoRecordSettingL( + MusSettingsKeys::EAutoRecordOn ); + } + else + { + MultimediaSharingSettings::SetAutoRecordSettingL( + MusSettingsKeys::EAutoRecordOff ); + } + break; + } + case KGSSettIdNote: + { + if ( MusSettingsKeys::EAuditoryNotificationOn == + MultimediaSharingSettings::AuditoryNotificationSettingL() ) + { + MultimediaSharingSettings::SetAuditoryNotificationSettingL( + MusSettingsKeys::EAuditoryNotificationOff ); + } + else + { + MultimediaSharingSettings::SetAuditoryNotificationSettingL( + MusSettingsKeys::EAuditoryNotificationOn ); + } + break; + } + default: + { + MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::SwitchOnOffValueL() - error unknown setting" ) + User::Leave( KErrArgument ); + } + } + + Container()->UpdateListBoxL( aValue ); + + MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::SwitchOnOffValueL()" ) } // ----------------------------------------------------------------------------- @@ -859,16 +721,18 @@ CleanupStack::PopAndDestroy( dlg ); } -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // From class CGSPluginInterface. // Creates a new icon of desired type. Overrided to provide custom icons. // Ownership of the created icon is transferred to the caller. -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // CGulIcon* CMusSettingsPlugin::CreateIconL( const TUid aIconType ) { MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::CreateIconL()" ) + OpenResourceFileL(); + CGulIcon* icon; if( aIconType == KGSIconTypeLbxItem ) @@ -902,3 +766,37 @@ return icon; } +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMusSettingsPlugin::OpenResourceFileL() + { + MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::OpenResourceFileL()" ) + + if (!iResourceFileOpen) + { + HBufC* fileName = MusResourceFinderUtil::ResourcePathL( + KVSSettingsResourceFileName ); + TFileName fName(*fileName); + delete fileName; + MUS_LOG_TDESC( "[MUSSET] Resource FileName ",fName ) + iResources.OpenL(fName); + iResourceFileOpen = true; + } + + MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::OpenResourceFileL()" ) + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMusSettingsPlugin::CloseResourceFile() + { + MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::CloseResourceFile()" ) + iResources.Close(); + iResourceFileOpen = false; + MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::CloseResourceFile()" ) + } +