mmshplugins/mmshsettingsuiplugin/src/mussettingsplugin.cpp
branchRCL_3
changeset 22 73a1feb507fb
parent 16 ce86b6d44a6d
child 23 bc78a40cd63c
--- a/mmshplugins/mmshsettingsuiplugin/src/mussettingsplugin.cpp	Thu Aug 19 09:51:39 2010 +0300
+++ b/mmshplugins/mmshsettingsuiplugin/src/mussettingsplugin.cpp	Tue Aug 31 15:12:07 2010 +0300
@@ -12,7 +12,6 @@
 * Contributors:
 *
 * Description:  MUSSettingsPlugin implementation.
-*  Version     : %version: be1sipx1#38 % << Don't touch! Updated by Synergy at check-out.
 *
 */
 
@@ -55,20 +54,13 @@
 // ======== MEMBER FUNCTIONS ========
 
 
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
 CMusSettingsPlugin::CMusSettingsPlugin()
     : iResources( *iCoeEnv )
     {
     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::CMusSettingsPlugin()" )
     }
 
-// -----------------------------------------------------------------------------
-// 
-// -----------------------------------------------------------------------------
-//
+
 CMusSettingsPlugin::~CMusSettingsPlugin()
     {
     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::~CMusSettingsPlugin()" )
@@ -79,31 +71,29 @@
         delete iContainer;
         iContainer = NULL;
         }
-        
-    CloseResourceFile();
+
+    iResources.Close();
 
     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();
@@ -111,20 +101,11 @@
     iModel = CMusSettingsModel::NewL( *iHandler );
     iDiskNotifyHandler = CDiskNotifyHandler::NewL( *this, 
                                             iEikonEnv->FsSession() );
-    // Subscribe disk notifications
-    User::LeaveIfError( iDiskNotifyHandler->NotifyDisk() ); 
-
-    iCaption = StringLoader::LoadL( R_GS_VS_PLUGIN_CAPTION );
-    CloseResourceFile();
-
+    User::LeaveIfError( iDiskNotifyHandler->NotifyDisk() ); // Subscribe disk notifications
     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::ConstructL()" )
     }
 
-// -----------------------------------------------------------------------------
-// 
-//
-// -----------------------------------------------------------------------------
-//
+
 CMusSettingsPlugin* CMusSettingsPlugin::NewL( TAny* /*aInitParams*/ )
     {
     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::NewL()" )
@@ -136,10 +117,11 @@
     return self;
     }
 
-// -----------------------------------------------------------------------------
+
+// ----------------------------------------------------------------------------
 // From class CAknView.
 // Returns UID of *this* settings plugin.
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 //
 TUid CMusSettingsPlugin::Id() const
     {
@@ -148,10 +130,11 @@
     return KGSVSSettingsPluginUID;
     }
 
-// -----------------------------------------------------------------------------
+
+// ----------------------------------------------------------------------------
 // Hides non-virtual member from base class CGSBaseView.
 // Handles a change in client rectangle size.
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 //
 void CMusSettingsPlugin::HandleClientRectChange()
     {
@@ -163,10 +146,11 @@
     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,
@@ -174,39 +158,69 @@
     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<CMusSettingsContainer*>( iContainer );
+    const TInt currentItem = container.CurrentFeatureId();
+
     switch ( aCommand )
         {
         case EGSMSKCmdAppChange:
-//        case EGSCmdAppChange:
+        case EGSCmdAppChange:
             {
-            HandleListBoxSelectionL();
+        	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();
+        		}
             break;
             }
 
@@ -235,26 +249,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()" )
-    if ( iCaption && iCaption->Length() <= aCaption.MaxLength() )
-        {
-    	aCaption.Copy( *iCaption );
-        }
-    
+    HBufC* result = StringLoader::LoadL( R_GS_VS_PLUGIN_CAPTION );
+    aCaption.Copy( *result );
+    delete result;
     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::GetCaptionL()" )
     }
 
-// -----------------------------------------------------------------------------
+
+// ----------------------------------------------------------------------------
 // From class CGSPluginInterface.
 // Returns provider category of *this* plugin.
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 //
 TInt CMusSettingsPlugin::PluginProviderCategory() const
     {
@@ -262,10 +276,11 @@
     return KGSPluginProviderInternal;
     }
 
-// -----------------------------------------------------------------------------
+
+// ----------------------------------------------------------------------------
 // From class MEikMenuObserver.
 // Called by framework before creating menus
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 //
 void CMusSettingsPlugin::DynInitMenuPaneL( TInt aResourceId,
                                               CEikMenuPane* aMenuPane )
@@ -279,11 +294,12 @@
             }
         }
     }
+
     
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 // From MDiskNotifyHandlerCallback
 // Called by framework When disk status changed
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 //
 void CMusSettingsPlugin::HandleNotifyDisk( TInt /*aError*/, 
                                            const TDiskEvent& /*aEvent*/ )
@@ -303,10 +319,11 @@
     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleNotifyDisk()" )
     }
 
-// -----------------------------------------------------------------------------
+
+// ----------------------------------------------------------------------------
 // From class CGSBaseView.
 // Called by GS framework to create a GS container for *this* plugin.
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 //
 void CMusSettingsPlugin::NewContainerL()
     {
@@ -314,10 +331,11 @@
     iContainer = new( ELeave ) CMusSettingsContainer( *iModel );
     }
 
-// -----------------------------------------------------------------------------
+
+// ----------------------------------------------------------------------------
 // From class CGSBaseView.
 // Handles users "middle click" aka MSK on selected feature.
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 //
 void CMusSettingsPlugin::HandleListBoxSelectionL()
     {
@@ -325,35 +343,61 @@
     CMusSettingsContainer& container =
         *static_cast<CMusSettingsContainer*>( iContainer );
     const TInt currentItem = container.CurrentFeatureId();
-    MUS_LOG1( "[MUSSET]    Item selected: ", currentItem )
+
+    RDebug::Print( _L(
+        "[CMusSettingsPlugin] Item selected: %d" ),
+        currentItem );
+
+	MusSettingsKeys::TOperatorVariant operatorVarValue =
+		iModel->VSSettingsOperatorVariantL();
 
     switch ( currentItem )
         {
         case KGSSettIdVSActivation:
             {
-            SwitchOnOffValueL( KGSSettIdVSActivation );
-            break;
+        	if ( operatorVarValue == MusSettingsKeys::EOperatorSpecific )
+    			{
+    			SwitchOnOffValueL( KGSSettIdVSActivation );
+    			container.UpdateListBoxL( KGSSettIdVSActivation );
+				}
+			else
+				{
+				ShowVSSettingsActivationSettingDialogL();
+    			}
+    		break;
     	    }
+
         case KGSSettIdSIPProfile:
             {
             ShowVSSettingsProfileSettingDialogL();
             break;
             }
+
         case KGSSettIdAutoRecord:
             {
             SwitchOnOffValueL( KGSSettIdAutoRecord );
-            break;
+            container.UpdateListBoxL( KGSSettIdAutoRecord );
+        	break;
             }
+
         case KGSSettIdRecordedVideoSaving:
             {
-            ShowVSSettingsRecordedVideoSavingSettingDialogL();
-            break;
+
+        	ShowVSSettingsRecordedVideoSavingSettingDialogL();
+
+//        	SwitchOnOffValueL( KGSSettIdRecordedVideoSaving );
+//        	container.UpdateListBoxL( KGSSettIdRecordedVideoSaving );
+
+        	break;
             }
+
         case KGSSettIdNote:
             {
-            SwitchOnOffValueL( KGSSettIdNote );
-            break;
+        	SwitchOnOffValueL( KGSSettIdNote );
+        	container.UpdateListBoxL( KGSSettIdNote );
+        	break;
             }
+
         default:
             {
             break;
@@ -362,11 +406,12 @@
     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()
     {
@@ -374,17 +419,115 @@
     return static_cast<CMusSettingsContainer*>( 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<TInt>( currentValue );
+
+    CAknRadioButtonSettingPage* dlg =
+    	new ( ELeave ) CAknRadioButtonSettingPage(
+        	R_ACTIVATION_SETTING_PAGE,
+        	intCurrentValue,
+        	items);
+
+    if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
+        {
+        currentValue =
+        	static_cast<MusSettingsKeys::TActivation>( 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<TInt>(currentValue);
+
+    CAknRadioButtonSettingPage* dlg =
+    	new ( ELeave ) CAknRadioButtonSettingPage(
+        	R_ACTIVATION_SETTING_PAGE,
+        	intCurrentValue,
+        	items );
+
+    if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
+        {
+        currentValue =
+        	static_cast<MusSettingsKeys::TActivation>( 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 = MultimediaSharingSettings::SipProfileSettingL();
+    TInt cenRepValue = iModel->VSSettingsProfileL();
     TInt profileMode = CMusSettingsModel::KVsSipProfileDefault;
     if ( cenRepValue != CMusSettingsModel::KVsSipProfileDefault )
     	{
@@ -405,29 +548,29 @@
     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
         {
         if ( profileMode == CMusSettingsModel::KVsSipProfileDefault )
-            {
-            if ( oldProfileMode != profileMode )
-                {
-                MultimediaSharingSettings::SetSipProfileSettingL( 
-                            CMusSettingsModel::KVsSipProfileDefault );
-                Container()->ShowNewProfileActiveAfterCallL();
-                Container()->UpdateListBoxL( KGSSettIdSIPProfile );
-                }
-            }
+        	{
+        	if ( oldProfileMode != profileMode )
+        		{
+        		iModel->SetVSSettingsProfileL( 
+        		            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()
     {
@@ -436,48 +579,50 @@
 	CleanupStack::PushL( array );
 
 	if ( array->Count() < 1 )
-            {
-            ShowNoProfilesNotificationL();
-            }
+		{
+		ShowNoProfilesNotificationL();
+		}
 	else
-            {
-            TInt selectedIndex = iModel->ProfileIndexByIdL(
-                                MultimediaSharingSettings::SipProfileSettingL() );
-            TInt currentIndex ( selectedIndex );
+		{
+    	TInt selectedIndex = iModel->ProfileIndexByIdL(
+    	    iModel->VSSettingsProfileL() );
+        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 );
-                        MultimediaSharingSettings::SetSipProfileSettingL( 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 );
+	    	    iModel->SetVSSettingsProfileL( 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()
     {
@@ -487,9 +632,20 @@
                     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);    
@@ -498,37 +654,67 @@
     if ( result != CAknCommonDialogsBase::TReturnKey(
                                         CAknCommonDialogsBase::ERightSoftkey) )
         {
-        if ( /*( TInt )*/ driveNumber != currentValue )
+        if ( ( TInt ) driveNumber != currentValue )
             {
-            MultimediaSharingSettings::SetVideoLocationSettingL( ( TInt ) driveNumber );
+            iModel->SetVSSettingsRecordedVideoSavingL( ( 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 =
-                    MultimediaSharingSettings::AuditoryNotificationSettingL();
+    	iModel->VSSettingsNoteL();
     TInt intCurrentValue = static_cast<TInt>( currentValue );
 
     CAknRadioButtonSettingPage* dlg;
     CDesCArrayFlat* items;
 
-    if ( MultimediaSharingSettings::OperatorVariantSettingL() == 
-         MusSettingsKeys::EStandard )
+    if ( iModel->VSSettingsOperatorVariantL() == MusSettingsKeys::EStandard )
         {
         items = iCoeEnv->ReadDesC16ArrayResourceL(
             R_VS_AUDIO_SETTING_PAGE_LBX );
@@ -552,9 +738,9 @@
     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
         {
         currentValue =
-                static_cast<MusSettingsKeys::TAuditoryNotification>( intCurrentValue );
-        MultimediaSharingSettings::SetAuditoryNotificationSettingL(
-                                                                currentValue );
+        	static_cast<MusSettingsKeys::TAuditoryNotification>
+        	    ( intCurrentValue );
+        iModel->SetVSSettingsNoteL( currentValue );
         Container()->UpdateListBoxL( KGSSettIdNote );
         }
 
@@ -563,9 +749,10 @@
     "[MUSSET] <- CMusSettingsPlugin::ShowVSSettingsNoteSettingDialogL()" )
     }
 
-// -----------------------------------------------------------------------------
+
+// ----------------------------------------------------------------------------
 // Shows a notifications that no SIP profiles exists.
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 //
 void CMusSettingsPlugin::ShowNoProfilesNotificationL()
     {
@@ -577,133 +764,84 @@
     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:
-            {
-            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()" )
+	    {
+	    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 );
+	    	}
+	    }
     }
 
 // -----------------------------------------------------------------------------
@@ -721,18 +859,16 @@
     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 )
@@ -766,37 +902,3 @@
     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()" )
-    }
-