mmshplugins/mmshsettingsuiplugin/src/mussettingsplugin.cpp
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  MUSSettingsPlugin implementation.
    14 * Description:  MUSSettingsPlugin implementation.
       
    15 *  Version     : %version: be1sipx1#38 % << Don't touch! Updated by Synergy at check-out.
    15 *
    16 *
    16 */
    17 */
    17 
    18 
    18 
    19 
    19 
    20 
    52 
    53 
    53 
    54 
    54 // ======== MEMBER FUNCTIONS ========
    55 // ======== MEMBER FUNCTIONS ========
    55 
    56 
    56 
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 // -----------------------------------------------------------------------------
       
    61 //
    57 CMusSettingsPlugin::CMusSettingsPlugin()
    62 CMusSettingsPlugin::CMusSettingsPlugin()
    58     : iResources( *iCoeEnv )
    63     : iResources( *iCoeEnv )
    59     {
    64     {
    60     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::CMusSettingsPlugin()" )
    65     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::CMusSettingsPlugin()" )
    61     }
    66     }
    62 
    67 
    63 
    68 // -----------------------------------------------------------------------------
       
    69 // 
       
    70 // -----------------------------------------------------------------------------
       
    71 //
    64 CMusSettingsPlugin::~CMusSettingsPlugin()
    72 CMusSettingsPlugin::~CMusSettingsPlugin()
    65     {
    73     {
    66     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::~CMusSettingsPlugin()" )
    74     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::~CMusSettingsPlugin()" )
    67     FeatureManager::UnInitializeLib();	
    75     FeatureManager::UnInitializeLib();	
    68     if( iContainer )
    76     if( iContainer )
    69         {
    77         {
    70         AppUi()->RemoveFromViewStack( *this, iContainer );
    78         AppUi()->RemoveFromViewStack( *this, iContainer );
    71         delete iContainer;
    79         delete iContainer;
    72         iContainer = NULL;
    80         iContainer = NULL;
    73         }
    81         }
    74 
    82         
    75     iResources.Close();
    83     CloseResourceFile();
    76 
    84 
    77     delete iModel;
    85     delete iModel;
    78     iModel = NULL;
    86     iModel = NULL;
    79 	delete iHandler;
    87 	delete iHandler;
    80 	iHandler = NULL;
    88 	iHandler = NULL;
    81     delete iDiskNotifyHandler;
    89     delete iDiskNotifyHandler;
       
    90     delete iCaption;
    82     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::~CMusSettingsPlugin()" )
    91     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::~CMusSettingsPlugin()" )
    83     }
    92     }
    84 
    93 
    85 
    94 // -----------------------------------------------------------------------------
       
    95 // 
       
    96 //
       
    97 // -----------------------------------------------------------------------------
       
    98 //
    86 void CMusSettingsPlugin::ConstructL()
    99 void CMusSettingsPlugin::ConstructL()
    87     {
   100     {
    88     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::ConstructL()" )
   101     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::ConstructL()" )
    89     FeatureManager::InitializeLibL();
   102     FeatureManager::InitializeLibL();
    90 
   103   
    91     HBufC* fileName = MusResourceFinderUtil::ResourcePathL(
   104     iResourceFileOpen = false;
    92         KVSSettingsResourceFileName );    
   105     OpenResourceFileL();
    93     TFileName fName(*fileName);
   106 
    94     delete fileName;
       
    95     MUS_LOG_TDESC( "[MUSSET] Resource FileName ",fName )
       
    96     iResources.OpenL(fName);        
       
    97     MUS_LOG( "[MUSSET] Constructing the Base " )
   107     MUS_LOG( "[MUSSET] Constructing the Base " )
    98     BaseConstructL( R_GS_VS_VIEW );
   108     BaseConstructL( R_GS_VS_VIEW );
    99     iHandler = CMusSIPProfileModel::NewL();
   109     iHandler = CMusSIPProfileModel::NewL();
   100     MUS_LOG( "[MUSSET]    CMusSettingsPlugin::ConstructL() 2" )
   110     MUS_LOG( "[MUSSET]    CMusSettingsPlugin::ConstructL() 2" )
   101     iModel = CMusSettingsModel::NewL( *iHandler );
   111     iModel = CMusSettingsModel::NewL( *iHandler );
   102     iDiskNotifyHandler = CDiskNotifyHandler::NewL( *this, 
   112     iDiskNotifyHandler = CDiskNotifyHandler::NewL( *this, 
   103                                             iEikonEnv->FsSession() );
   113                                             iEikonEnv->FsSession() );
   104     User::LeaveIfError( iDiskNotifyHandler->NotifyDisk() ); // Subscribe disk notifications
   114     // Subscribe disk notifications
       
   115     User::LeaveIfError( iDiskNotifyHandler->NotifyDisk() ); 
       
   116 
       
   117     iCaption = StringLoader::LoadL( R_GS_VS_PLUGIN_CAPTION );
       
   118     CloseResourceFile();
       
   119 
   105     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::ConstructL()" )
   120     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::ConstructL()" )
   106     }
   121     }
   107 
   122 
   108 
   123 // -----------------------------------------------------------------------------
       
   124 // 
       
   125 //
       
   126 // -----------------------------------------------------------------------------
       
   127 //
   109 CMusSettingsPlugin* CMusSettingsPlugin::NewL( TAny* /*aInitParams*/ )
   128 CMusSettingsPlugin* CMusSettingsPlugin::NewL( TAny* /*aInitParams*/ )
   110     {
   129     {
   111     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::NewL()" )
   130     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::NewL()" )
   112     CMusSettingsPlugin* self = new( ELeave ) CMusSettingsPlugin();
   131     CMusSettingsPlugin* self = new( ELeave ) CMusSettingsPlugin();
   113     CleanupStack::PushL(self);
   132     CleanupStack::PushL(self);
   115     CleanupStack::Pop(self);
   134     CleanupStack::Pop(self);
   116     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::NewL()" )
   135     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::NewL()" )
   117     return self;
   136     return self;
   118     }
   137     }
   119 
   138 
   120 
   139 // -----------------------------------------------------------------------------
   121 // ----------------------------------------------------------------------------
       
   122 // From class CAknView.
   140 // From class CAknView.
   123 // Returns UID of *this* settings plugin.
   141 // Returns UID of *this* settings plugin.
   124 // ----------------------------------------------------------------------------
   142 // -----------------------------------------------------------------------------
   125 //
   143 //
   126 TUid CMusSettingsPlugin::Id() const
   144 TUid CMusSettingsPlugin::Id() const
   127     {
   145     {
   128     MUS_LOG1( "[MUSSET] <- CMusSettingsPlugin::Id()( %d )",
   146     MUS_LOG1( "[MUSSET] <- CMusSettingsPlugin::Id()( %d )",
   129               KGSVSSettingsPluginUID.iUid )
   147               KGSVSSettingsPluginUID.iUid )
   130     return KGSVSSettingsPluginUID;
   148     return KGSVSSettingsPluginUID;
   131     }
   149     }
   132 
   150 
   133 
   151 // -----------------------------------------------------------------------------
   134 // ----------------------------------------------------------------------------
       
   135 // Hides non-virtual member from base class CGSBaseView.
   152 // Hides non-virtual member from base class CGSBaseView.
   136 // Handles a change in client rectangle size.
   153 // Handles a change in client rectangle size.
   137 // ----------------------------------------------------------------------------
   154 // -----------------------------------------------------------------------------
   138 //
   155 //
   139 void CMusSettingsPlugin::HandleClientRectChange()
   156 void CMusSettingsPlugin::HandleClientRectChange()
   140     {
   157     {
   141     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::HandleClientRectChange()" )
   158     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::HandleClientRectChange()" )
   142     if ( iContainer && iContainer->iListBox )
   159     if ( iContainer && iContainer->iListBox )
   144         iContainer->SetRect( ClientRect() );
   161         iContainer->SetRect( ClientRect() );
   145         }
   162         }
   146     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleClientRectChange()" )
   163     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleClientRectChange()" )
   147     }
   164     }
   148 
   165 
   149 
   166 // -----------------------------------------------------------------------------
   150 // ----------------------------------------------------------------------------
       
   151 // From class CAknView.
   167 // From class CAknView.
   152 // Called by framework when *this* control is to be activated/focused.
   168 // Called by framework when *this* control is to be activated/focused.
   153 // ----------------------------------------------------------------------------
   169 // -----------------------------------------------------------------------------
   154 //
   170 //
   155 void CMusSettingsPlugin::DoActivateL(
   171 void CMusSettingsPlugin::DoActivateL(
   156     const TVwsViewId& aPrevViewId,
   172     const TVwsViewId& aPrevViewId,
   157     TUid aCustomMessageId,
   173     TUid aCustomMessageId,
   158     const TDesC8& aCustomMessage )
   174     const TDesC8& aCustomMessage )
   159     {
   175     {
   160     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::DoActivateL()" )
   176     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::DoActivateL()" )
       
   177     OpenResourceFileL();
   161     CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );
   178     CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );
   162     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::DoActivateL()" )
   179     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::DoActivateL()" )
   163     }
   180     }
   164 
   181 
   165 
   182 // -----------------------------------------------------------------------------
   166 // ----------------------------------------------------------------------------
       
   167 // From class CAknView.
   183 // From class CAknView.
   168 // Called by framework when *this* control is to be deactivated.
   184 // Called by framework when *this* control is to be deactivated.
   169 // ----------------------------------------------------------------------------
   185 // -----------------------------------------------------------------------------
   170 //
   186 //
   171 void CMusSettingsPlugin::DoDeactivate()
   187 void CMusSettingsPlugin::DoDeactivate()
   172     {
   188     {
   173     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::DoDeactivate()" )
   189     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::DoDeactivate()" )
   174     CGSBaseView::DoDeactivate();
   190     CGSBaseView::DoDeactivate();
       
   191     CloseResourceFile();
   175     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::DoDeactivate()" )
   192     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::DoDeactivate()" )
   176     }
   193     }
   177 
   194 
   178 
   195 // -----------------------------------------------------------------------------
   179 // ----------------------------------------------------------------------------
       
   180 // From class CAknView.
   196 // From class CAknView.
   181 // Handles a user selected menu command.
   197 // Handles a user selected menu command.
   182 // ----------------------------------------------------------------------------
   198 // -----------------------------------------------------------------------------
   183 //
   199 //
   184 void CMusSettingsPlugin::HandleCommandL( TInt aCommand )
   200 void CMusSettingsPlugin::HandleCommandL( TInt aCommand )
   185     {
   201     {
   186     MUS_LOG1( "[MUSSET] -> CMusSettingsPlugin::HandleCommandL()( %d )",
   202     MUS_LOG1( "[MUSSET] -> CMusSettingsPlugin::HandleCommandL()( %d )",
   187               aCommand )
   203               aCommand )
   188     CMusSettingsContainer& container =
       
   189         *static_cast<CMusSettingsContainer*>( iContainer );
       
   190     const TInt currentItem = container.CurrentFeatureId();
       
   191 
       
   192     switch ( aCommand )
   204     switch ( aCommand )
   193         {
   205         {
   194         case EGSMSKCmdAppChange:
   206         case EGSMSKCmdAppChange:
   195         case EGSCmdAppChange:
   207 //        case EGSCmdAppChange:
   196             {
   208             {
   197         	if ( currentItem == KGSSettIdVSActivation
   209             HandleListBoxSelectionL();
   198         		&& aCommand == EGSCmdAppChange )
       
   199         		{
       
   200         		if ( iModel->VSSettingsOperatorVariantL() ==
       
   201         			MusSettingsKeys::EOperatorSpecific )
       
   202         			{
       
   203         			ShowOperatorSpecificActivationSettingDialogL();
       
   204         			}
       
   205         		else
       
   206         			{
       
   207         			ShowVSSettingsActivationSettingDialogL();
       
   208         			}
       
   209         		}
       
   210         	else if ( currentItem == KGSSettIdRecordedVideoSaving
       
   211         		&& aCommand == EGSCmdAppChange )
       
   212         		{
       
   213         		ShowVSSettingsRecordedVideoSavingSettingDialogL();
       
   214         		}
       
   215         	else if ( KGSSettIdNote == currentItem
       
   216         		&& EGSCmdAppChange == aCommand )
       
   217         		{
       
   218         		ShowVSSettingsNoteSettingDialogL();
       
   219         		}
       
   220         	else
       
   221         		{
       
   222         		HandleListBoxSelectionL();
       
   223         		}
       
   224             break;
   210             break;
   225             }
   211             }
   226 
   212 
   227         case EAknSoftkeyBack:
   213         case EAknSoftkeyBack:
   228             {
   214             {
   247             }
   233             }
   248         }
   234         }
   249     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleCommandL()" )
   235     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleCommandL()" )
   250     }
   236     }
   251 
   237 
   252 
   238 // -----------------------------------------------------------------------------
   253 // ----------------------------------------------------------------------------
       
   254 // From class CGSPluginInterface.
   239 // From class CGSPluginInterface.
   255 // Gets caption text of *this* plugin.
   240 // Gets caption text of *this* plugin.
   256 // ----------------------------------------------------------------------------
   241 // -----------------------------------------------------------------------------
   257 //
   242 //
   258 void CMusSettingsPlugin::GetCaptionL( TDes& aCaption ) const
   243 void CMusSettingsPlugin::GetCaptionL( TDes& aCaption ) const
   259     {
   244     {
   260     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::GetCaptionL()" )
   245     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::GetCaptionL()" )
   261     HBufC* result = StringLoader::LoadL( R_GS_VS_PLUGIN_CAPTION );
   246     if ( iCaption && iCaption->Length() <= aCaption.MaxLength() )
   262     aCaption.Copy( *result );
   247         {
   263     delete result;
   248     	aCaption.Copy( *iCaption );
       
   249         }
       
   250     
   264     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::GetCaptionL()" )
   251     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::GetCaptionL()" )
   265     }
   252     }
   266 
   253 
   267 
   254 // -----------------------------------------------------------------------------
   268 // ----------------------------------------------------------------------------
       
   269 // From class CGSPluginInterface.
   255 // From class CGSPluginInterface.
   270 // Returns provider category of *this* plugin.
   256 // Returns provider category of *this* plugin.
   271 // ----------------------------------------------------------------------------
   257 // -----------------------------------------------------------------------------
   272 //
   258 //
   273 TInt CMusSettingsPlugin::PluginProviderCategory() const
   259 TInt CMusSettingsPlugin::PluginProviderCategory() const
   274     {
   260     {
   275     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::PluginProviderCategory()" )
   261     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::PluginProviderCategory()" )
   276     return KGSPluginProviderInternal;
   262     return KGSPluginProviderInternal;
   277     }
   263     }
   278 
   264 
   279 
   265 // -----------------------------------------------------------------------------
   280 // ----------------------------------------------------------------------------
       
   281 // From class MEikMenuObserver.
   266 // From class MEikMenuObserver.
   282 // Called by framework before creating menus
   267 // Called by framework before creating menus
   283 // ----------------------------------------------------------------------------
   268 // -----------------------------------------------------------------------------
   284 //
   269 //
   285 void CMusSettingsPlugin::DynInitMenuPaneL( TInt aResourceId,
   270 void CMusSettingsPlugin::DynInitMenuPaneL( TInt aResourceId,
   286                                               CEikMenuPane* aMenuPane )
   271                                               CEikMenuPane* aMenuPane )
   287     {
   272     {
   288     // Delete Help item if feature is not supported
   273     // Delete Help item if feature is not supported
   292             {
   277             {
   293             aMenuPane->DeleteMenuItem( EAknCmdHelp );
   278             aMenuPane->DeleteMenuItem( EAknCmdHelp );
   294             }
   279             }
   295         }
   280         }
   296     }
   281     }
   297 
       
   298     
   282     
   299 // ----------------------------------------------------------------------------
   283 // -----------------------------------------------------------------------------
   300 // From MDiskNotifyHandlerCallback
   284 // From MDiskNotifyHandlerCallback
   301 // Called by framework When disk status changed
   285 // Called by framework When disk status changed
   302 // ----------------------------------------------------------------------------
   286 // -----------------------------------------------------------------------------
   303 //
   287 //
   304 void CMusSettingsPlugin::HandleNotifyDisk( TInt /*aError*/, 
   288 void CMusSettingsPlugin::HandleNotifyDisk( TInt /*aError*/, 
   305                                            const TDiskEvent& /*aEvent*/ )
   289                                            const TDiskEvent& /*aEvent*/ )
   306     {
   290     {
   307     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::HandleNotifyDisk()" )
   291     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::HandleNotifyDisk()" )
   317         }
   301         }
   318         
   302         
   319     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleNotifyDisk()" )
   303     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleNotifyDisk()" )
   320     }
   304     }
   321 
   305 
   322 
   306 // -----------------------------------------------------------------------------
   323 // ----------------------------------------------------------------------------
       
   324 // From class CGSBaseView.
   307 // From class CGSBaseView.
   325 // Called by GS framework to create a GS container for *this* plugin.
   308 // Called by GS framework to create a GS container for *this* plugin.
   326 // ----------------------------------------------------------------------------
   309 // -----------------------------------------------------------------------------
   327 //
   310 //
   328 void CMusSettingsPlugin::NewContainerL()
   311 void CMusSettingsPlugin::NewContainerL()
   329     {
   312     {
   330     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::NewContainerL()" )
   313     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::NewContainerL()" )
   331     iContainer = new( ELeave ) CMusSettingsContainer( *iModel );
   314     iContainer = new( ELeave ) CMusSettingsContainer( *iModel );
   332     }
   315     }
   333 
   316 
   334 
   317 // -----------------------------------------------------------------------------
   335 // ----------------------------------------------------------------------------
       
   336 // From class CGSBaseView.
   318 // From class CGSBaseView.
   337 // Handles users "middle click" aka MSK on selected feature.
   319 // Handles users "middle click" aka MSK on selected feature.
   338 // ----------------------------------------------------------------------------
   320 // -----------------------------------------------------------------------------
   339 //
   321 //
   340 void CMusSettingsPlugin::HandleListBoxSelectionL()
   322 void CMusSettingsPlugin::HandleListBoxSelectionL()
   341     {
   323     {
   342     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::HandleListBoxSelectionL()" )
   324     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::HandleListBoxSelectionL()" )
   343     CMusSettingsContainer& container =
   325     CMusSettingsContainer& container =
   344         *static_cast<CMusSettingsContainer*>( iContainer );
   326         *static_cast<CMusSettingsContainer*>( iContainer );
   345     const TInt currentItem = container.CurrentFeatureId();
   327     const TInt currentItem = container.CurrentFeatureId();
   346 
   328     MUS_LOG1( "[MUSSET]    Item selected: ", currentItem )
   347     RDebug::Print( _L(
       
   348         "[CMusSettingsPlugin] Item selected: %d" ),
       
   349         currentItem );
       
   350 
       
   351 	MusSettingsKeys::TOperatorVariant operatorVarValue =
       
   352 		iModel->VSSettingsOperatorVariantL();
       
   353 
   329 
   354     switch ( currentItem )
   330     switch ( currentItem )
   355         {
   331         {
   356         case KGSSettIdVSActivation:
   332         case KGSSettIdVSActivation:
   357             {
   333             {
   358         	if ( operatorVarValue == MusSettingsKeys::EOperatorSpecific )
   334             SwitchOnOffValueL( KGSSettIdVSActivation );
   359     			{
   335             break;
   360     			SwitchOnOffValueL( KGSSettIdVSActivation );
       
   361     			container.UpdateListBoxL( KGSSettIdVSActivation );
       
   362 				}
       
   363 			else
       
   364 				{
       
   365 				ShowVSSettingsActivationSettingDialogL();
       
   366     			}
       
   367     		break;
       
   368     	    }
   336     	    }
   369 
       
   370         case KGSSettIdSIPProfile:
   337         case KGSSettIdSIPProfile:
   371             {
   338             {
   372             ShowVSSettingsProfileSettingDialogL();
   339             ShowVSSettingsProfileSettingDialogL();
   373             break;
   340             break;
   374             }
   341             }
   375 
       
   376         case KGSSettIdAutoRecord:
   342         case KGSSettIdAutoRecord:
   377             {
   343             {
   378             SwitchOnOffValueL( KGSSettIdAutoRecord );
   344             SwitchOnOffValueL( KGSSettIdAutoRecord );
   379             container.UpdateListBoxL( KGSSettIdAutoRecord );
   345             break;
   380         	break;
   346             }
   381             }
       
   382 
       
   383         case KGSSettIdRecordedVideoSaving:
   347         case KGSSettIdRecordedVideoSaving:
   384             {
   348             {
   385 
   349             ShowVSSettingsRecordedVideoSavingSettingDialogL();
   386         	ShowVSSettingsRecordedVideoSavingSettingDialogL();
   350             break;
   387 
   351             }
   388 //        	SwitchOnOffValueL( KGSSettIdRecordedVideoSaving );
       
   389 //        	container.UpdateListBoxL( KGSSettIdRecordedVideoSaving );
       
   390 
       
   391         	break;
       
   392             }
       
   393 
       
   394         case KGSSettIdNote:
   352         case KGSSettIdNote:
   395             {
   353             {
   396         	SwitchOnOffValueL( KGSSettIdNote );
   354             SwitchOnOffValueL( KGSSettIdNote );
   397         	container.UpdateListBoxL( KGSSettIdNote );
   355             break;
   398         	break;
   356             }
   399             }
       
   400 
       
   401         default:
   357         default:
   402             {
   358             {
   403             break;
   359             break;
   404             }
   360             }
   405         }
   361         }
   406     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleListBoxSelectionL()" )
   362     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleListBoxSelectionL()" )
   407     }
   363     }
   408 
   364 
   409 
   365 // -----------------------------------------------------------------------------
   410 // ----------------------------------------------------------------------------
       
   411 // From class CGSBaseView.
   366 // From class CGSBaseView.
   412 // Returns container class of *this* plugin. iContainer is always garanteed to
   367 // Returns container class of *this* plugin. iContainer is always garanteed to
   413 // be of type CMusSettingsContainer*.
   368 // be of type CMusSettingsContainer*.
   414 // ----------------------------------------------------------------------------
   369 // -----------------------------------------------------------------------------
   415 //
   370 //
   416 CMusSettingsContainer* CMusSettingsPlugin::Container()
   371 CMusSettingsContainer* CMusSettingsPlugin::Container()
   417     {
   372     {
   418     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::Container()" )
   373     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::Container()" )
   419     return static_cast<CMusSettingsContainer*>( iContainer );
   374     return static_cast<CMusSettingsContainer*>( iContainer );
   420     }
   375     }
   421 
   376 
   422 
   377 // -----------------------------------------------------------------------------
   423 // ----------------------------------------------------------------------------
       
   424 // Shows a dialog for user to modify VS activation setting. Note that this
       
   425 // method has an alternative method for operator specific variant.
       
   426 // ----------------------------------------------------------------------------
       
   427 //
       
   428 void CMusSettingsPlugin::ShowVSSettingsActivationSettingDialogL()
       
   429     {
       
   430     MUS_LOG(
       
   431     "[MUSSET] -> CMusSettingsPlugin::ShowVSSettingsActivationSettingDialogL()"
       
   432      )
       
   433 
       
   434     MusSettingsKeys::TActivation currentValue =
       
   435     	iModel->VSSettingsActivationL();
       
   436 
       
   437     CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL(
       
   438         R_ACTIVATION_SETTING_PAGE_LBX );
       
   439 
       
   440     CleanupStack::PushL( items );
       
   441     TInt intCurrentValue = static_cast<TInt>( currentValue );
       
   442 
       
   443     CAknRadioButtonSettingPage* dlg =
       
   444     	new ( ELeave ) CAknRadioButtonSettingPage(
       
   445         	R_ACTIVATION_SETTING_PAGE,
       
   446         	intCurrentValue,
       
   447         	items);
       
   448 
       
   449     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
       
   450         {
       
   451         currentValue =
       
   452         	static_cast<MusSettingsKeys::TActivation>( intCurrentValue );
       
   453 
       
   454         iModel->SetVSSettingsActivationL( currentValue );
       
   455         Container()->UpdateListBoxL( KGSSettIdVSActivation );
       
   456         }
       
   457 
       
   458     CleanupStack::PopAndDestroy( items );
       
   459     MUS_LOG(
       
   460     "[MUSSET] <- CMusSettingsPlugin::ShowVSSettingsActivationSettingDialogL()" )
       
   461     }
       
   462 
       
   463 
       
   464 // ----------------------------------------------------------------------------
       
   465 // Shows a dialog for user to modify VS activation setting. Note that this
       
   466 // method is used only for operator specific variant. Alternative method for
       
   467 // "standard" variant exists. Note that because standard variant contains 3
       
   468 // different values and operator variant contains only 2 values (0,2) the value
       
   469 // 2 (MusSettingsKeys::ENever) is converted to value 1
       
   470 // (MusSettingsKeys::EActiveInHomeNetworks) in operator variant just before
       
   471 // showing the dialog. After showing the dialog the conversion mentioned above
       
   472 // is reversed. This temporarily conversion is done solely to use values 0 and
       
   473 // 1 for direct mapping to items array.
       
   474 // ----------------------------------------------------------------------------
       
   475 //
       
   476 void CMusSettingsPlugin::ShowOperatorSpecificActivationSettingDialogL()
       
   477     {
       
   478     MUS_LOG(
       
   479     "[MUSSET] -> CMusSettingsPlugin::ShowOperatorSpecificActivationSettingDialogL()"
       
   480      )
       
   481 
       
   482     MusSettingsKeys::TActivation currentValue =
       
   483     	iModel->VSSettingsActivationL();
       
   484 
       
   485     if ( currentValue == MusSettingsKeys::ENever )
       
   486     	{
       
   487     	currentValue = MusSettingsKeys::EActiveInHomeNetworks;
       
   488     	}
       
   489 
       
   490     CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL(
       
   491         R_OPERATOR_ACTIVATION_SETTING_PAGE_LBX);
       
   492 
       
   493     CleanupStack::PushL( items );
       
   494     TInt intCurrentValue = static_cast<TInt>(currentValue);
       
   495 
       
   496     CAknRadioButtonSettingPage* dlg =
       
   497     	new ( ELeave ) CAknRadioButtonSettingPage(
       
   498         	R_ACTIVATION_SETTING_PAGE,
       
   499         	intCurrentValue,
       
   500         	items );
       
   501 
       
   502     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
       
   503         {
       
   504         currentValue =
       
   505         	static_cast<MusSettingsKeys::TActivation>( intCurrentValue );
       
   506         if ( currentValue == MusSettingsKeys::EActiveInHomeNetworks )
       
   507         	{
       
   508         	currentValue = MusSettingsKeys::ENever;
       
   509         	}
       
   510         iModel->SetVSSettingsActivationL( currentValue );
       
   511         Container()->UpdateListBoxL( KGSSettIdVSActivation );
       
   512         }
       
   513 
       
   514     CleanupStack::PopAndDestroy( items );
       
   515     MUS_LOG(
       
   516     "[MUSSET] <- CMusSettingsPlugin::ShowOperatorSpecificActivationSettingDialogL()" )
       
   517     }
       
   518 
       
   519 
       
   520 // ----------------------------------------------------------------------------
       
   521 // Shows SIP profile setting dialog (i.e. "use default profile" or "select
   378 // Shows SIP profile setting dialog (i.e. "use default profile" or "select
   522 // profile from list"). If select profile from list is selected, a list of
   379 // profile from list"). If select profile from list is selected, a list of
   523 // SIP profiles is provided for user to choose wanted SIP profile.
   380 // SIP profiles is provided for user to choose wanted SIP profile.
   524 // ----------------------------------------------------------------------------
   381 // -----------------------------------------------------------------------------
   525 //
   382 //
   526 void CMusSettingsPlugin::ShowVSSettingsProfileSettingDialogL()
   383 void CMusSettingsPlugin::ShowVSSettingsProfileSettingDialogL()
   527     {
   384     {
   528     MUS_LOG(
   385     MUS_LOG(
   529     "[MUSSET] -> CMusSettingsPlugin::ShowVSSettingsProfileSettingDialogL()" )
   386     "[MUSSET] -> CMusSettingsPlugin::ShowVSSettingsProfileSettingDialogL()" )
   530     TInt cenRepValue = iModel->VSSettingsProfileL();
   387     TInt cenRepValue = MultimediaSharingSettings::SipProfileSettingL();
   531     TInt profileMode = CMusSettingsModel::KVsSipProfileDefault;
   388     TInt profileMode = CMusSettingsModel::KVsSipProfileDefault;
   532     if ( cenRepValue != CMusSettingsModel::KVsSipProfileDefault )
   389     if ( cenRepValue != CMusSettingsModel::KVsSipProfileDefault )
   533     	{
   390     	{
   534     	profileMode = CMusSettingsModel::KVsSipProfileSelect;
   391     	profileMode = CMusSettingsModel::KVsSipProfileSelect;
   535     	}
   392     	}
   546                                     items);
   403                                     items);
   547 
   404 
   548     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
   405     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
   549         {
   406         {
   550         if ( profileMode == CMusSettingsModel::KVsSipProfileDefault )
   407         if ( profileMode == CMusSettingsModel::KVsSipProfileDefault )
   551         	{
   408             {
   552         	if ( oldProfileMode != profileMode )
   409             if ( oldProfileMode != profileMode )
   553         		{
   410                 {
   554         		iModel->SetVSSettingsProfileL( 
   411                 MultimediaSharingSettings::SetSipProfileSettingL( 
   555         		            CMusSettingsModel::KVsSipProfileDefault );
   412                             CMusSettingsModel::KVsSipProfileDefault );
   556         		Container()->ShowNewProfileActiveAfterCallL();
   413                 Container()->ShowNewProfileActiveAfterCallL();
   557         		Container()->UpdateListBoxL( KGSSettIdSIPProfile );
   414                 Container()->UpdateListBoxL( KGSSettIdSIPProfile );
   558         		}
   415                 }
   559         	}
   416             }
   560         else
   417         else
   561         	{
   418             {
   562             ShowVSSettingsSelectSipProfileDialogL();
   419             ShowVSSettingsSelectSipProfileDialogL();
   563 			}
   420             }
   564         }
   421         }
   565     CleanupStack::PopAndDestroy( items );
   422     CleanupStack::PopAndDestroy( items );
   566     MUS_LOG(
   423     MUS_LOG(
   567     "[MUSSET] <- CMusSettingsPlugin::ShowVSSettingsProfileSettingDialogL()" )
   424     "[MUSSET] <- CMusSettingsPlugin::ShowVSSettingsProfileSettingDialogL()" )
   568     }
   425     }
   569 
   426 
   570 // ----------------------------------------------------------------------------
   427 // -----------------------------------------------------------------------------
   571 // Provides user a list of SIP profiles to select from. If no SIP profiles
   428 // Provides user a list of SIP profiles to select from. If no SIP profiles
   572 // exist an error note is displayed.
   429 // exist an error note is displayed.
   573 // ----------------------------------------------------------------------------
   430 // -----------------------------------------------------------------------------
   574 //
   431 //
   575 void CMusSettingsPlugin::ShowVSSettingsSelectSipProfileDialogL()
   432 void CMusSettingsPlugin::ShowVSSettingsSelectSipProfileDialogL()
   576     {
   433     {
   577 	// Get the array of the profile names, ownership changes
   434 	// Get the array of the profile names, ownership changes
   578     CDesCArray* array = iModel->ListOfProfileNamesL();
   435     CDesCArray* array = iModel->ListOfProfileNamesL();
   579 	CleanupStack::PushL( array );
   436 	CleanupStack::PushL( array );
   580 
   437 
   581 	if ( array->Count() < 1 )
   438 	if ( array->Count() < 1 )
   582 		{
   439             {
   583 		ShowNoProfilesNotificationL();
   440             ShowNoProfilesNotificationL();
   584 		}
   441             }
   585 	else
   442 	else
   586 		{
   443             {
   587     	TInt selectedIndex = iModel->ProfileIndexByIdL(
   444             TInt selectedIndex = iModel->ProfileIndexByIdL(
   588     	    iModel->VSSettingsProfileL() );
   445                                 MultimediaSharingSettings::SipProfileSettingL() );
   589         TInt currentIndex ( selectedIndex );
   446             TInt currentIndex ( selectedIndex );
   590 
   447 
   591 		if ( selectedIndex == KErrNotFound )
   448             if ( selectedIndex == KErrNotFound )
   592 			{
   449                 {
   593 			// first profile in the list
   450                 // first profile in the list
   594 			selectedIndex = CMusSettingsModel::KVsSipProfileDefault;
   451                 selectedIndex = CMusSettingsModel::KVsSipProfileDefault;
   595 			}
   452                 }
   596 
   453 
   597 		// Create and display the pop-up list
   454             // Create and display the pop-up list
   598 		CAknRadioButtonSettingPage* defaultPopUp =
   455             CAknRadioButtonSettingPage* defaultPopUp =
   599 			new ( ELeave ) CAknRadioButtonSettingPage(
   456                     new ( ELeave ) CAknRadioButtonSettingPage(
   600     			R_VS_SIP_PROFILE_LIST_VIEW_SELECT_SETTING_PAGE,
   457                     R_VS_SIP_PROFILE_LIST_VIEW_SELECT_SETTING_PAGE,
   601     			selectedIndex,
   458                     selectedIndex,
   602     			array );
   459                     array );
   603 		if ( defaultPopUp->ExecuteLD(
   460             if ( defaultPopUp->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
   604 			CAknSettingPage::EUpdateWhenChanged ) )
   461                 {
   605 			{
   462                 if ( selectedIndex != currentIndex )
   606 			if ( selectedIndex != currentIndex )
   463                     {
   607         		{
   464                     // User has changed the selected profile, set new
   608 	        	// User has changed the selected profile, set new
   465                     // setting to persistent storage
   609     	    	// setting to persistent storage
   466                     TUint newValue = iModel->ProfileIdByIndex( selectedIndex );
   610     	    	TUint newValue = iModel->ProfileIdByIndex( selectedIndex );
   467                         MultimediaSharingSettings::SetSipProfileSettingL( newValue );
   611 	    	    iModel->SetVSSettingsProfileL( newValue );
   468                         Container()->ShowNewProfileActiveAfterCallL();
   612 	    	    Container()->ShowNewProfileActiveAfterCallL();
   469                                     Container()->UpdateListBoxL( KGSSettIdSIPProfile );
   613 				Container()->UpdateListBoxL( KGSSettIdSIPProfile );
   470                     }
   614     			}
   471                 }
   615 			}
   472             }
   616 		}
       
   617 
   473 
   618 	CleanupStack::PopAndDestroy( array );  // array
   474 	CleanupStack::PopAndDestroy( array );  // array
   619     }
   475     }
   620 
   476 
   621 
   477 // -----------------------------------------------------------------------------
   622 // ----------------------------------------------------------------------------
       
   623 // Provides a dialog for user to choose saving location for recorderded video.
   478 // Provides a dialog for user to choose saving location for recorderded video.
   624 // (locations are naturally phone memory or memory card).
   479 // (locations are naturally phone memory or memory card).
   625 // ----------------------------------------------------------------------------
   480 // -----------------------------------------------------------------------------
   626 //
   481 //
   627 void CMusSettingsPlugin::ShowVSSettingsRecordedVideoSavingSettingDialogL()
   482 void CMusSettingsPlugin::ShowVSSettingsRecordedVideoSavingSettingDialogL()
   628     {
   483     {
   629     MUS_LOG(
   484     MUS_LOG(
   630     "[MUSSET] -> CMusSettingsPlugin::ShowVSSettingsRecordedVideoSavingSettingDialogL()" )
   485     "[MUSSET] -> CMusSettingsPlugin::ShowVSSettingsRecordedVideoSavingSettingDialogL()" )
   631     TDriveUnit phoneMemUnit( 
   486     TDriveUnit phoneMemUnit( 
   632                     TParsePtrC( PathInfo::PhoneMemoryRootPath() ).Drive() );
   487                     TParsePtrC( PathInfo::PhoneMemoryRootPath() ).Drive() );
   633     TDriveUnit mmcUnit( TParsePtrC( PathInfo::MemoryCardRootPath() ).Drive() );
   488     TDriveUnit mmcUnit( TParsePtrC( PathInfo::MemoryCardRootPath() ).Drive() );
   634     TInt currentValue =	iModel->VSSettingsRecordedVideoSavingL();
   489     TInt currentValue =	iModel->VSSettingsRecordedVideoSavingL();
   635 
       
   636 
       
   637      CAknMemorySelectionDialogMultiDrive* dlg = 
       
   638                                     iModel->MemorySelectionDialogLC();
       
   639 
       
   640     // Use ECFDDialogTypeSave to have double list box in the query
       
   641 /*	CAknMemorySelectionDialog* dlg = CAknMemorySelectionDialog::NewL(
       
   642                                     ECFDDialogTypeSave,
       
   643                                     R_VS_RECORDED_VIDEO_SAVING_SETTING_PAGE,
       
   644                                     EFalse );
       
   645     CleanupStack::PushL( dlg );    
       
   646 */
       
   647 
       
   648     
   490     
       
   491     CAknMemorySelectionDialogMultiDrive* dlg = 
       
   492                                     iModel->MemorySelectionDialogLC();   
   649 
   493 
   650     TBool result( EFalse );
   494     TBool result( EFalse );
   651     TDriveNumber driveNumber((TDriveNumber)currentValue);    
   495     TDriveNumber driveNumber((TDriveNumber)currentValue);    
   652     result = dlg->ExecuteL( driveNumber, NULL, NULL );
   496     result = dlg->ExecuteL( driveNumber, NULL, NULL );
   653 
   497 
   654     if ( result != CAknCommonDialogsBase::TReturnKey(
   498     if ( result != CAknCommonDialogsBase::TReturnKey(
   655                                         CAknCommonDialogsBase::ERightSoftkey) )
   499                                         CAknCommonDialogsBase::ERightSoftkey) )
   656         {
   500         {
   657         if ( ( TInt ) driveNumber != currentValue )
   501         if ( /*( TInt )*/ driveNumber != currentValue )
   658             {
   502             {
   659             iModel->SetVSSettingsRecordedVideoSavingL( ( TInt ) driveNumber );
   503             MultimediaSharingSettings::SetVideoLocationSettingL( ( TInt ) driveNumber );
   660             }
   504             }
   661         Container()->UpdateListBoxL( KGSSettIdRecordedVideoSaving );
   505         Container()->UpdateListBoxL( KGSSettIdRecordedVideoSaving );
   662         }
   506         }
   663 
       
   664 /*  CAknMemorySelectionDialog::TMemory mem;
       
   665     if ( currentValue == ( TInt )mmcUnit )
       
   666         {
       
   667         mem = CAknMemorySelectionDialog::EMemoryCard;
       
   668         }
       
   669     else
       
   670         {
       
   671         mem = CAknMemorySelectionDialog::EPhoneMemory;
       
   672         }
       
   673                     
       
   674     TFileName ignore;
       
   675     TFileName path;
       
   676 
       
   677     if ( dlg->ExecuteL( mem, &path, &ignore ) )
       
   678         {
       
   679         if ( mem == CAknMemorySelectionDialog::EPhoneMemory 
       
   680         	&& currentValue != ( TInt ) phoneMemUnit )
       
   681         	{
       
   682         	iModel->SetVSSettingsRecordedVideoSavingL( ( TInt )phoneMemUnit );
       
   683         	Container()->UpdateListBoxL( KGSSettIdRecordedVideoSaving );
       
   684         	}	
       
   685         else if ( mem == CAknMemorySelectionDialog::EMemoryCard
       
   686         	&& currentValue != ( TInt )mmcUnit )
       
   687         	{
       
   688         	iModel->SetVSSettingsRecordedVideoSavingL( ( TInt )mmcUnit );
       
   689         	Container()->UpdateListBoxL( KGSSettIdRecordedVideoSaving );
       
   690         	}	
       
   691         }
       
   692 */
       
   693 
   507 
   694     CleanupStack::PopAndDestroy(dlg); 
   508     CleanupStack::PopAndDestroy(dlg); 
   695     MUS_LOG(
   509     MUS_LOG(
   696     "[MUSSET] <- CMusSettingsPlugin::ShowVSSettingsRecordedVideoSavingSettingDialogL()" )
   510     "[MUSSET] <- CMusSettingsPlugin::ShowVSSettingsRecordedVideoSavingSettingDialogL()" )
   697     }
   511     }
   698 
   512 
   699 
   513 // -----------------------------------------------------------------------------
   700 // ----------------------------------------------------------------------------
       
   701 // In standard variant provides user a "Capability auditory note" setting
   514 // In standard variant provides user a "Capability auditory note" setting
   702 // dialog, and in operator variant provides user an "Alerts" setting dialog.
   515 // dialog, and in operator variant provides user an "Alerts" setting dialog.
   703 // Note that in both variants the different dialogs toggle the same setting.
   516 // Note that in both variants the different dialogs toggle the same setting.
   704 // ----------------------------------------------------------------------------
   517 // -----------------------------------------------------------------------------
   705 //
   518 //
   706 void CMusSettingsPlugin::ShowVSSettingsNoteSettingDialogL()
   519 void CMusSettingsPlugin::ShowVSSettingsNoteSettingDialogL()
   707     {
   520     {
   708     MUS_LOG(
   521     MUS_LOG(
   709     "[MUSSET] -> CMusSettingsPlugin::ShowVSSettingsNoteSettingDialogL()" )
   522     "[MUSSET] -> CMusSettingsPlugin::ShowVSSettingsNoteSettingDialogL()" )
   710     MusSettingsKeys::TAuditoryNotification currentValue =
   523     MusSettingsKeys::TAuditoryNotification currentValue =
   711     	iModel->VSSettingsNoteL();
   524                     MultimediaSharingSettings::AuditoryNotificationSettingL();
   712     TInt intCurrentValue = static_cast<TInt>( currentValue );
   525     TInt intCurrentValue = static_cast<TInt>( currentValue );
   713 
   526 
   714     CAknRadioButtonSettingPage* dlg;
   527     CAknRadioButtonSettingPage* dlg;
   715     CDesCArrayFlat* items;
   528     CDesCArrayFlat* items;
   716 
   529 
   717     if ( iModel->VSSettingsOperatorVariantL() == MusSettingsKeys::EStandard )
   530     if ( MultimediaSharingSettings::OperatorVariantSettingL() == 
       
   531          MusSettingsKeys::EStandard )
   718         {
   532         {
   719         items = iCoeEnv->ReadDesC16ArrayResourceL(
   533         items = iCoeEnv->ReadDesC16ArrayResourceL(
   720             R_VS_AUDIO_SETTING_PAGE_LBX );
   534             R_VS_AUDIO_SETTING_PAGE_LBX );
   721         CleanupStack::PushL( items );
   535         CleanupStack::PushL( items );
   722         dlg = new ( ELeave ) CAknRadioButtonSettingPage(
   536         dlg = new ( ELeave ) CAknRadioButtonSettingPage(
   736         }
   550         }
   737 
   551 
   738     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
   552     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
   739         {
   553         {
   740         currentValue =
   554         currentValue =
   741         	static_cast<MusSettingsKeys::TAuditoryNotification>
   555                 static_cast<MusSettingsKeys::TAuditoryNotification>( intCurrentValue );
   742         	    ( intCurrentValue );
   556         MultimediaSharingSettings::SetAuditoryNotificationSettingL(
   743         iModel->SetVSSettingsNoteL( currentValue );
   557                                                                 currentValue );
   744         Container()->UpdateListBoxL( KGSSettIdNote );
   558         Container()->UpdateListBoxL( KGSSettIdNote );
   745         }
   559         }
   746 
   560 
   747     CleanupStack::PopAndDestroy( items );
   561     CleanupStack::PopAndDestroy( items );
   748     MUS_LOG(
   562     MUS_LOG(
   749     "[MUSSET] <- CMusSettingsPlugin::ShowVSSettingsNoteSettingDialogL()" )
   563     "[MUSSET] <- CMusSettingsPlugin::ShowVSSettingsNoteSettingDialogL()" )
   750     }
   564     }
   751 
   565 
   752 
   566 // -----------------------------------------------------------------------------
   753 // ----------------------------------------------------------------------------
       
   754 // Shows a notifications that no SIP profiles exists.
   567 // Shows a notifications that no SIP profiles exists.
   755 // ----------------------------------------------------------------------------
   568 // -----------------------------------------------------------------------------
   756 //
   569 //
   757 void CMusSettingsPlugin::ShowNoProfilesNotificationL()
   570 void CMusSettingsPlugin::ShowNoProfilesNotificationL()
   758     {
   571     {
   759     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::ShowNoProfilesNotificationL()" )
   572     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::ShowNoProfilesNotificationL()" )
   760     HBufC* infoTxt = StringLoader::LoadLC( R_QTN_MSH_SET_PROFILE_EMPTY );
   573     HBufC* infoTxt = StringLoader::LoadLC( R_QTN_MSH_SET_PROFILE_EMPTY );
   762     note->ExecuteLD( infoTxt->Des() );
   575     note->ExecuteLD( infoTxt->Des() );
   763     CleanupStack::PopAndDestroy( infoTxt );
   576     CleanupStack::PopAndDestroy( infoTxt );
   764     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::ShowNoProfilesNotificationL()" )
   577     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::ShowNoProfilesNotificationL()" )
   765     }
   578     }
   766 
   579 
   767 
   580 // -----------------------------------------------------------------------------
   768 // ---------------------------------------------------------------------------
       
   769 // Switches between two possible values from one to another (i.e. toggles a
   581 // Switches between two possible values from one to another (i.e. toggles a
   770 // setting on/off). Toggled setting is passed in aValue parameter.
   582 // setting on/off). Toggled setting is passed in aValue parameter.
   771 // ---------------------------------------------------------------------------
   583 // -----------------------------------------------------------------------------
   772 //
   584 //
   773 void CMusSettingsPlugin::SwitchOnOffValueL( TInt aValue )
   585 void CMusSettingsPlugin::SwitchOnOffValueL( TInt aValue )
   774     {
   586     {
       
   587     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::SwitchOnOffValueL()" )
       
   588             
   775     switch( aValue )
   589     switch( aValue )
   776 	    {
   590         {
   777 	    case KGSSettIdVSActivation:
   591         case KGSSettIdVSActivation:
   778 	    	{
   592             {
   779 	    	if ( MusSettingsKeys::EAlwaysActive
   593             MusSettingsKeys::TOperatorVariant operatorVarValue =
   780 	    		== iModel->VSSettingsActivationL() )
   594                     MultimediaSharingSettings::OperatorVariantSettingL();
   781 	    		{
   595                 
   782 	    		iModel->SetVSSettingsActivationL( MusSettingsKeys::ENever );
   596             if ( operatorVarValue == MusSettingsKeys::EOperatorSpecific )
   783 	    		}
   597                 {
   784 	    	else
   598                 
   785 	    		{
   599                 TInt aCallCount = 0;
   786 	    		iModel->SetVSSettingsActivationL(
   600                 RProperty::Get( NMusSessionInformationApi::KCategoryUid,
   787 	    			MusSettingsKeys::EAlwaysActive );
   601                               NMusSessionInformationApi::KMusCallCount,
   788 	    		}
   602                               aCallCount );
   789 	    	break;
   603                 MUS_LOG1( "[MUSSET] CallCount ( %d )", aCallCount)
   790 	    	}
   604                 if ( aCallCount == 0 )
   791 	    case KGSSettIdAutoRecord:
   605                     {
   792 	        {
   606                     MUS_LOG( "[MUSSET] no calls. Set VS on/off" )
   793 	        if ( MusSettingsKeys::EAutoRecordOff ==
   607                     TBool enabled = EFalse;
   794 	                                iModel->VSSettingsAutoRecordL() )
   608                     TRAPD( error, enabled = iHandler->ProfileEnabledL( ));
   795 		    	{
   609                     MUS_LOG2( "[MUSSET]   VS now %d (err=%d)", enabled, error )
   796 		    	iModel->SetVSSettingsAutoRecordL( 
   610                     if ( !error ) 
   797 		    	                    MusSettingsKeys::EAutoRecordOn );
   611                         {
   798 		    	}
   612                         if( enabled ) //currently enabled => disable
   799 			else
   613                             {
   800 				{
   614                             TRAPD( error, iHandler->DisableProfileL() );
   801 				iModel->SetVSSettingsAutoRecordL(
   615                             MUS_LOG1( "[MUSSET]   VS is off (err=%d)", error )
   802 					                MusSettingsKeys::EAutoRecordOff );
   616                             //activation disabled = true
   803 				}
   617                             iModel->SetActivationItem( enabled );
   804 	        break;
   618                             
   805 	        }
   619                             if ( error == KErrNone )
   806 	    case KGSSettIdRecordedVideoSaving:
   620                             	{
   807 	    	{
   621 								MUS_LOG( "[MUSSET]    Activation setting set off" )
   808 		    TDriveUnit phoneMemUnit( 
   622 								//MusSettingsKeys::ENever = 2 can not be used anymore
   809 		            TParsePtrC( PathInfo::PhoneMemoryRootPath() ).Drive() );
   623 								//EActiveInHomeNetworks = 1 is used instead -> off
   810             TDriveUnit mmcUnit( 
   624 								MultimediaSharingSettings::SetActivationSettingL(
   811                     TParsePtrC( PathInfo::MemoryCardRootPath() ).Drive() );    
   625 												MusSettingsKeys::EActiveInHomeNetworks );
   812     
   626 								}
   813 		    if ( ( TInt )phoneMemUnit 
   627                             }
   814 		        == iModel->VSSettingsRecordedVideoSavingL() )
   628                         else//currently disabled => enable
   815 		    	{
   629                             {
   816 		    	iModel->SetVSSettingsRecordedVideoSavingL( ( TInt )mmcUnit );
   630                             TRAPD( error, iHandler->EnableProfileL() );
   817 		    	}
   631                             MUS_LOG1( "[MUSSET]   VS is on (err=%d)", error )
   818 			else
   632                             //if failed activation disabled = true
   819 				{
   633                             enabled = error != KErrNone;
   820 				iModel->SetVSSettingsRecordedVideoSavingL( ( TInt )phoneMemUnit );
   634                             //activation disabled = false/true(if failed)
   821 				}
   635                             iModel->SetActivationItem( enabled );
   822 			break;
   636 
   823 	    	}
   637                             if ( error == KErrNone )
   824 		case KGSSettIdNote:
   638                             	{
   825 			{
   639 								MUS_LOG( "[MUSSET]    Activation setting set on" )
   826 		    if ( MusSettingsKeys::EAuditoryNotificationOn
   640 								MultimediaSharingSettings::SetActivationSettingL(
   827 		    	== iModel->VSSettingsNoteL() )
   641 													MusSettingsKeys::EAlwaysActive );
   828 		    	{
   642 								}                            
   829 		    	iModel->SetVSSettingsNoteL(
   643                             }             
   830 		    		MusSettingsKeys::EAuditoryNotificationOff );
   644                         }
   831 		    	}
   645                     }
   832 			else
   646                 }
   833 				{
   647             else
   834 				iModel->SetVSSettingsNoteL(
   648                 {
   835 					MusSettingsKeys::EAuditoryNotificationOn );
   649                 if ( MusSettingsKeys::EAlwaysActive ==
   836 				}
   650                      MultimediaSharingSettings::ActivationSettingL() )
   837 			break;
   651                     {
   838 			}
   652                     MUS_LOG( "[MUSSET]    Activation setting set off" )
   839 	    default:
   653                     //MusSettingsKeys::ENever = 2 can not be used anymore
   840 	    	{
   654                     //EActiveInHomeNetworks = 1 is used instead -> off
   841 	    	MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::SwitchOnOffValueL() - error unknown setting" )
   655                     MultimediaSharingSettings::SetActivationSettingL(
   842 	    	User::Leave( KErrArgument );
   656                                     MusSettingsKeys::EActiveInHomeNetworks );
   843 	    	}
   657                     }
   844 	    }
   658                 else
       
   659                     {
       
   660                     MUS_LOG( "[MUSSET]    Activation setting set on" )
       
   661                     MultimediaSharingSettings::SetActivationSettingL(
       
   662                                         MusSettingsKeys::EAlwaysActive );
       
   663                     }
       
   664                 }
       
   665             break;
       
   666         }
       
   667         case KGSSettIdAutoRecord:
       
   668             {
       
   669             if ( MusSettingsKeys::EAutoRecordOff ==
       
   670                         MultimediaSharingSettings::AutoRecordSettingL() )
       
   671                 {
       
   672                 MultimediaSharingSettings::SetAutoRecordSettingL( 
       
   673                                             MusSettingsKeys::EAutoRecordOn );
       
   674                 }
       
   675             else
       
   676                 {
       
   677                 MultimediaSharingSettings::SetAutoRecordSettingL(
       
   678                                             MusSettingsKeys::EAutoRecordOff );
       
   679                 }
       
   680             break;
       
   681             }
       
   682         case KGSSettIdNote:
       
   683             {
       
   684             if ( MusSettingsKeys::EAuditoryNotificationOn == 
       
   685                         MultimediaSharingSettings::AuditoryNotificationSettingL() )
       
   686                 {
       
   687                 MultimediaSharingSettings::SetAuditoryNotificationSettingL(
       
   688                         MusSettingsKeys::EAuditoryNotificationOff );
       
   689                 }
       
   690             else
       
   691                 {
       
   692                 MultimediaSharingSettings::SetAuditoryNotificationSettingL(
       
   693                                         MusSettingsKeys::EAuditoryNotificationOn );
       
   694                 }
       
   695             break;
       
   696             }
       
   697         default:
       
   698             {
       
   699             MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::SwitchOnOffValueL() - error unknown setting" )
       
   700             User::Leave( KErrArgument );
       
   701             }
       
   702         }
       
   703 	        
       
   704 	Container()->UpdateListBoxL( aValue );
       
   705 	        
       
   706     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::SwitchOnOffValueL()" )
   845     }
   707     }
   846 
   708 
   847 // -----------------------------------------------------------------------------
   709 // -----------------------------------------------------------------------------
   848 //
   710 //
   849 // -----------------------------------------------------------------------------
   711 // -----------------------------------------------------------------------------
   857     User::WaitForRequest( status );
   719     User::WaitForRequest( status );
   858     CleanupStack::PopAndDestroy( dlgPrompt );
   720     CleanupStack::PopAndDestroy( dlgPrompt );
   859     CleanupStack::PopAndDestroy( dlg );
   721     CleanupStack::PopAndDestroy( dlg );
   860     }
   722     }
   861 
   723 
   862 // ----------------------------------------------------------------------------
   724 // -----------------------------------------------------------------------------
   863 // From class CGSPluginInterface.
   725 // From class CGSPluginInterface.
   864 // Creates a new icon of desired type. Overrided to provide custom icons.
   726 // Creates a new icon of desired type. Overrided to provide custom icons.
   865 // Ownership of the created icon is transferred to the caller.
   727 // Ownership of the created icon is transferred to the caller.
   866 // ----------------------------------------------------------------------------
   728 // -----------------------------------------------------------------------------
   867 //
   729 //
   868 CGulIcon* CMusSettingsPlugin::CreateIconL( const TUid aIconType )
   730 CGulIcon* CMusSettingsPlugin::CreateIconL( const TUid aIconType )
   869     {
   731     {
   870     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::CreateIconL()" )
   732     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::CreateIconL()" )
       
   733 
       
   734     OpenResourceFileL();
   871 
   735 
   872 	CGulIcon* icon;
   736 	CGulIcon* icon;
   873 
   737 
   874     if( aIconType == KGSIconTypeLbxItem )
   738     if( aIconType == KGSIconTypeLbxItem )
   875         {
   739         {
   900     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::CreateIconL()" )
   764     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::CreateIconL()" )
   901 
   765 
   902     return icon;
   766     return icon;
   903     }
   767     }
   904 
   768 
       
   769 // -----------------------------------------------------------------------------
       
   770 //
       
   771 // -----------------------------------------------------------------------------
       
   772 //
       
   773 void CMusSettingsPlugin::OpenResourceFileL()
       
   774 	{
       
   775     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::OpenResourceFileL()" )
       
   776         
       
   777     if (!iResourceFileOpen) 
       
   778         {
       
   779         HBufC* fileName = MusResourceFinderUtil::ResourcePathL(
       
   780         KVSSettingsResourceFileName );    
       
   781         TFileName fName(*fileName);
       
   782         delete fileName;
       
   783         MUS_LOG_TDESC( "[MUSSET] Resource FileName ",fName )
       
   784         iResources.OpenL(fName);  
       
   785         iResourceFileOpen = true;
       
   786         } 
       
   787     
       
   788     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::OpenResourceFileL()" )
       
   789 	}
       
   790 
       
   791 // -----------------------------------------------------------------------------
       
   792 //
       
   793 // -----------------------------------------------------------------------------
       
   794 //
       
   795 void CMusSettingsPlugin::CloseResourceFile()
       
   796     {
       
   797     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::CloseResourceFile()" )
       
   798     iResources.Close();
       
   799     iResourceFileOpen = false;
       
   800     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::CloseResourceFile()" )
       
   801     }
       
   802