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