mmshplugins/mmshsettingsuiplugin/src/mussettingsplugin.cpp
changeset 22 496ad160a278
equal deleted inserted replaced
15:ccd8e69b5392 22:496ad160a278
       
     1 /*
       
     2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  MUSSettingsPlugin implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include    "mussettingsplugin.h"
       
    21 #include    "mussettingscontainer.h"
       
    22 #include    "mussettingsmodel.h"
       
    23 #include    "mussettingsplugin.hrh"
       
    24 #include    "mussipprofilemodel.h"
       
    25 #include    "muslogger.h"
       
    26 #include    "musresourcefinderutil.h"
       
    27 #include    "mussesseioninformationapi.h"
       
    28 #include    <gscommon.hrh>
       
    29 #include    <mussettingsplugin.mbg> // Icons
       
    30 #include    <mussettingsuirsc.rsg> // GUI Resource
       
    31 #include    <gsprivatepluginproviderids.h>
       
    32 #include    <aknnotewrappers.h>
       
    33 #include    <aknradiobuttonsettingpage.h>
       
    34 #include    <aknpopupsettingpage.h>
       
    35 #include    <akntextsettingpage.h>
       
    36 #include    <aknViewAppUi.h>
       
    37 #include    <AknGlobalNote.h>
       
    38 #include    <featmgr.h>
       
    39 #include    <StringLoader.h>
       
    40 #include    <hlplch.h> // HlpLauncher
       
    41 #include    <pathinfo.h>
       
    42 
       
    43 #include    <e32property.h>
       
    44 
       
    45 #include    <CAknMemorySelectionDialogMultiDrive.h>
       
    46 #include    <AknCommonDialogsDynMem.h>
       
    47 
       
    48 #include    <CAknMemorySelectionDialog.h>
       
    49 
       
    50 // #include    <CAknMemorySelectionDialog.h>
       
    51 
       
    52 
       
    53 
       
    54 // ======== MEMBER FUNCTIONS ========
       
    55 
       
    56 
       
    57 CMusSettingsPlugin::CMusSettingsPlugin()
       
    58     : iResources( *iCoeEnv )
       
    59     {
       
    60     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::CMusSettingsPlugin()" )
       
    61     }
       
    62 
       
    63 
       
    64 CMusSettingsPlugin::~CMusSettingsPlugin()
       
    65     {
       
    66     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::~CMusSettingsPlugin()" )
       
    67     FeatureManager::UnInitializeLib();	
       
    68     if( iContainer )
       
    69         {
       
    70         AppUi()->RemoveFromViewStack( *this, iContainer );
       
    71         delete iContainer;
       
    72         iContainer = NULL;
       
    73         }
       
    74 
       
    75     iResources.Close();
       
    76 
       
    77     delete iModel;
       
    78     iModel = NULL;
       
    79 	delete iHandler;
       
    80 	iHandler = NULL;
       
    81     delete iDiskNotifyHandler;
       
    82     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::~CMusSettingsPlugin()" )
       
    83     }
       
    84 
       
    85 
       
    86 void CMusSettingsPlugin::ConstructL()
       
    87     {
       
    88     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::ConstructL()" )
       
    89     FeatureManager::InitializeLibL();
       
    90 
       
    91     HBufC* fileName = MusResourceFinderUtil::ResourcePathL(
       
    92         KVSSettingsResourceFileName );    
       
    93     TFileName fName(*fileName);
       
    94     delete fileName;
       
    95     MUS_LOG_TDESC( "[MUSSET] Resource FileName ",fName )
       
    96     iResources.OpenL(fName);        
       
    97     MUS_LOG( "[MUSSET] Constructing the Base " )
       
    98     BaseConstructL( R_GS_VS_VIEW );
       
    99     iHandler = CMusSIPProfileModel::NewL();
       
   100     MUS_LOG( "[MUSSET]    CMusSettingsPlugin::ConstructL() 2" )
       
   101     iModel = CMusSettingsModel::NewL( *iHandler );
       
   102     iDiskNotifyHandler = CDiskNotifyHandler::NewL( *this, 
       
   103                                             iEikonEnv->FsSession() );
       
   104     User::LeaveIfError( iDiskNotifyHandler->NotifyDisk() ); // Subscribe disk notifications
       
   105     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::ConstructL()" )
       
   106     }
       
   107 
       
   108 
       
   109 CMusSettingsPlugin* CMusSettingsPlugin::NewL( TAny* /*aInitParams*/ )
       
   110     {
       
   111     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::NewL()" )
       
   112     CMusSettingsPlugin* self = new( ELeave ) CMusSettingsPlugin();
       
   113     CleanupStack::PushL(self);
       
   114     self->ConstructL();
       
   115     CleanupStack::Pop(self);
       
   116     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::NewL()" )
       
   117     return self;
       
   118     }
       
   119 
       
   120 
       
   121 // ----------------------------------------------------------------------------
       
   122 // From class CAknView.
       
   123 // Returns UID of *this* settings plugin.
       
   124 // ----------------------------------------------------------------------------
       
   125 //
       
   126 TUid CMusSettingsPlugin::Id() const
       
   127     {
       
   128     MUS_LOG1( "[MUSSET] <- CMusSettingsPlugin::Id()( %d )",
       
   129               KGSVSSettingsPluginUID.iUid )
       
   130     return KGSVSSettingsPluginUID;
       
   131     }
       
   132 
       
   133 
       
   134 // ----------------------------------------------------------------------------
       
   135 // Hides non-virtual member from base class CGSBaseView.
       
   136 // Handles a change in client rectangle size.
       
   137 // ----------------------------------------------------------------------------
       
   138 //
       
   139 void CMusSettingsPlugin::HandleClientRectChange()
       
   140     {
       
   141     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::HandleClientRectChange()" )
       
   142     if ( iContainer && iContainer->iListBox )
       
   143         {
       
   144         iContainer->SetRect( ClientRect() );
       
   145         }
       
   146     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleClientRectChange()" )
       
   147     }
       
   148 
       
   149 
       
   150 // ----------------------------------------------------------------------------
       
   151 // From class CAknView.
       
   152 // Called by framework when *this* control is to be activated/focused.
       
   153 // ----------------------------------------------------------------------------
       
   154 //
       
   155 void CMusSettingsPlugin::DoActivateL(
       
   156     const TVwsViewId& aPrevViewId,
       
   157     TUid aCustomMessageId,
       
   158     const TDesC8& aCustomMessage )
       
   159     {
       
   160     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::DoActivateL()" )
       
   161     CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );
       
   162     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::DoActivateL()" )
       
   163     }
       
   164 
       
   165 
       
   166 // ----------------------------------------------------------------------------
       
   167 // From class CAknView.
       
   168 // Called by framework when *this* control is to be deactivated.
       
   169 // ----------------------------------------------------------------------------
       
   170 //
       
   171 void CMusSettingsPlugin::DoDeactivate()
       
   172     {
       
   173     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::DoDeactivate()" )
       
   174     CGSBaseView::DoDeactivate();
       
   175     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::DoDeactivate()" )
       
   176     }
       
   177 
       
   178 
       
   179 // ----------------------------------------------------------------------------
       
   180 // From class CAknView.
       
   181 // Handles a user selected menu command.
       
   182 // ----------------------------------------------------------------------------
       
   183 //
       
   184 void CMusSettingsPlugin::HandleCommandL( TInt aCommand )
       
   185     {
       
   186     MUS_LOG1( "[MUSSET] -> CMusSettingsPlugin::HandleCommandL()( %d )",
       
   187               aCommand )
       
   188     CMusSettingsContainer& container =
       
   189         *static_cast<CMusSettingsContainer*>( iContainer );
       
   190     const TInt currentItem = container.CurrentFeatureId();
       
   191 
       
   192     switch ( aCommand )
       
   193         {
       
   194         case EGSMSKCmdAppChange:
       
   195         case EGSCmdAppChange:
       
   196             {
       
   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         		}
       
   224             break;
       
   225             }
       
   226 
       
   227         case EAknSoftkeyBack:
       
   228             {
       
   229             AppUi()->ActivateLocalViewL( iPrevViewId.iViewUid );
       
   230             break;
       
   231             }
       
   232 
       
   233         case EAknCmdHelp:
       
   234             {
       
   235             if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   236                 {
       
   237                 HlpLauncher::LaunchHelpApplicationL(
       
   238                     iEikonEnv->WsSession(), AppUi()->AppHelpContextL());
       
   239                 }
       
   240             break;
       
   241             }
       
   242 
       
   243         default:
       
   244             {
       
   245             AppUi()->HandleCommandL( aCommand );
       
   246             break;
       
   247             }
       
   248         }
       
   249     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleCommandL()" )
       
   250     }
       
   251 
       
   252 
       
   253 // ----------------------------------------------------------------------------
       
   254 // From class CGSPluginInterface.
       
   255 // Gets caption text of *this* plugin.
       
   256 // ----------------------------------------------------------------------------
       
   257 //
       
   258 void CMusSettingsPlugin::GetCaptionL( TDes& aCaption ) const
       
   259     {
       
   260     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::GetCaptionL()" )
       
   261     HBufC* result = StringLoader::LoadL( R_GS_VS_PLUGIN_CAPTION );
       
   262     aCaption.Copy( *result );
       
   263     delete result;
       
   264     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::GetCaptionL()" )
       
   265     }
       
   266 
       
   267 
       
   268 // ----------------------------------------------------------------------------
       
   269 // From class CGSPluginInterface.
       
   270 // Returns provider category of *this* plugin.
       
   271 // ----------------------------------------------------------------------------
       
   272 //
       
   273 TInt CMusSettingsPlugin::PluginProviderCategory() const
       
   274     {
       
   275     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::PluginProviderCategory()" )
       
   276     return KGSPluginProviderInternal;
       
   277     }
       
   278 
       
   279 
       
   280 // ----------------------------------------------------------------------------
       
   281 // From class MEikMenuObserver.
       
   282 // Called by framework before creating menus
       
   283 // ----------------------------------------------------------------------------
       
   284 //
       
   285 void CMusSettingsPlugin::DynInitMenuPaneL( TInt aResourceId,
       
   286                                               CEikMenuPane* aMenuPane )
       
   287     {
       
   288     // Delete Help item if feature is not supported
       
   289     if( aResourceId == R_VS_MENU_ITEM_EXIT ) 
       
   290         {
       
   291         if( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   292             {
       
   293             aMenuPane->DeleteMenuItem( EAknCmdHelp );
       
   294             }
       
   295         }
       
   296     }
       
   297 
       
   298     
       
   299 // ----------------------------------------------------------------------------
       
   300 // From MDiskNotifyHandlerCallback
       
   301 // Called by framework When disk status changed
       
   302 // ----------------------------------------------------------------------------
       
   303 //
       
   304 void CMusSettingsPlugin::HandleNotifyDisk( TInt /*aError*/, 
       
   305                                            const TDiskEvent& /*aEvent*/ )
       
   306     {
       
   307     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::HandleNotifyDisk()" )
       
   308     
       
   309     // Since the plugin is created immediately after opening GS but container
       
   310     // will be created only after opening the VS view, this function may be
       
   311     // called before the creation of container. In such a case we simply ignore
       
   312     // the notification.
       
   313     if ( Container() ) 
       
   314         {
       
   315         TRAP_IGNORE( 
       
   316                 Container()->UpdateListBoxL( KGSSettIdRecordedVideoSaving ) )
       
   317         }
       
   318         
       
   319     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleNotifyDisk()" )
       
   320     }
       
   321 
       
   322 
       
   323 // ----------------------------------------------------------------------------
       
   324 // From class CGSBaseView.
       
   325 // Called by GS framework to create a GS container for *this* plugin.
       
   326 // ----------------------------------------------------------------------------
       
   327 //
       
   328 void CMusSettingsPlugin::NewContainerL()
       
   329     {
       
   330     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::NewContainerL()" )
       
   331     iContainer = new( ELeave ) CMusSettingsContainer( *iModel );
       
   332     }
       
   333 
       
   334 
       
   335 // ----------------------------------------------------------------------------
       
   336 // From class CGSBaseView.
       
   337 // Handles users "middle click" aka MSK on selected feature.
       
   338 // ----------------------------------------------------------------------------
       
   339 //
       
   340 void CMusSettingsPlugin::HandleListBoxSelectionL()
       
   341     {
       
   342     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::HandleListBoxSelectionL()" )
       
   343     CMusSettingsContainer& container =
       
   344         *static_cast<CMusSettingsContainer*>( iContainer );
       
   345     const TInt currentItem = container.CurrentFeatureId();
       
   346 
       
   347     RDebug::Print( _L(
       
   348         "[CMusSettingsPlugin] Item selected: %d" ),
       
   349         currentItem );
       
   350 
       
   351 	MusSettingsKeys::TOperatorVariant operatorVarValue =
       
   352 		iModel->VSSettingsOperatorVariantL();
       
   353 
       
   354     switch ( currentItem )
       
   355         {
       
   356         case KGSSettIdVSActivation:
       
   357             {
       
   358         	if ( operatorVarValue == MusSettingsKeys::EOperatorSpecific )
       
   359     			{
       
   360     			SwitchOnOffValueL( KGSSettIdVSActivation );
       
   361     			container.UpdateListBoxL( KGSSettIdVSActivation );
       
   362 				}
       
   363 			else
       
   364 				{
       
   365 				ShowVSSettingsActivationSettingDialogL();
       
   366     			}
       
   367     		break;
       
   368     	    }
       
   369 
       
   370         case KGSSettIdSIPProfile:
       
   371             {
       
   372             ShowVSSettingsProfileSettingDialogL();
       
   373             break;
       
   374             }
       
   375 
       
   376         case KGSSettIdAutoRecord:
       
   377             {
       
   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             {
       
   403             break;
       
   404             }
       
   405         }
       
   406     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleListBoxSelectionL()" )
       
   407     }
       
   408 
       
   409 
       
   410 // ----------------------------------------------------------------------------
       
   411 // From class CGSBaseView.
       
   412 // Returns container class of *this* plugin. iContainer is always garanteed to
       
   413 // be of type CMusSettingsContainer*.
       
   414 // ----------------------------------------------------------------------------
       
   415 //
       
   416 CMusSettingsContainer* CMusSettingsPlugin::Container()
       
   417     {
       
   418     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::Container()" )
       
   419     return static_cast<CMusSettingsContainer*>( iContainer );
       
   420     }
       
   421 
       
   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 // ----------------------------------------------------------------------------
       
   521 // 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
       
   523 // SIP profiles is provided for user to choose wanted SIP profile.
       
   524 // ----------------------------------------------------------------------------
       
   525 //
       
   526 void CMusSettingsPlugin::ShowVSSettingsProfileSettingDialogL()
       
   527     {
       
   528     MUS_LOG(
       
   529     "[MUSSET] -> CMusSettingsPlugin::ShowVSSettingsProfileSettingDialogL()" )
       
   530     TInt cenRepValue = iModel->VSSettingsProfileL();
       
   531     TInt profileMode = CMusSettingsModel::KVsSipProfileDefault;
       
   532     if ( cenRepValue != CMusSettingsModel::KVsSipProfileDefault )
       
   533     	{
       
   534     	profileMode = CMusSettingsModel::KVsSipProfileSelect;
       
   535     	}
       
   536     TInt oldProfileMode( profileMode );
       
   537 
       
   538     CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL(
       
   539         R_SIP_PROFILE_SETTING_PAGE_LBX);
       
   540     CleanupStack::PushL( items );
       
   541     items->Delete( CMusSettingsModel::KVsSipProfileSelectNone );
       
   542 
       
   543     CAknRadioButtonSettingPage* dlg = new ( ELeave ) 
       
   544         CAknRadioButtonSettingPage( R_VS_PROFILE_SETTING_PAGE,
       
   545                                     profileMode,
       
   546                                     items);
       
   547 
       
   548     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
       
   549         {
       
   550         if ( profileMode == CMusSettingsModel::KVsSipProfileDefault )
       
   551         	{
       
   552         	if ( oldProfileMode != profileMode )
       
   553         		{
       
   554         		iModel->SetVSSettingsProfileL( 
       
   555         		            CMusSettingsModel::KVsSipProfileDefault );
       
   556         		Container()->ShowNewProfileActiveAfterCallL();
       
   557         		Container()->UpdateListBoxL( KGSSettIdSIPProfile );
       
   558         		}
       
   559         	}
       
   560         else
       
   561         	{
       
   562             ShowVSSettingsSelectSipProfileDialogL();
       
   563 			}
       
   564         }
       
   565     CleanupStack::PopAndDestroy( items );
       
   566     MUS_LOG(
       
   567     "[MUSSET] <- CMusSettingsPlugin::ShowVSSettingsProfileSettingDialogL()" )
       
   568     }
       
   569 
       
   570 // ----------------------------------------------------------------------------
       
   571 // Provides user a list of SIP profiles to select from. If no SIP profiles
       
   572 // exist an error note is displayed.
       
   573 // ----------------------------------------------------------------------------
       
   574 //
       
   575 void CMusSettingsPlugin::ShowVSSettingsSelectSipProfileDialogL()
       
   576     {
       
   577 	// Get the array of the profile names, ownership changes
       
   578     CDesCArray* array = iModel->ListOfProfileNamesL();
       
   579 	CleanupStack::PushL( array );
       
   580 
       
   581 	if ( array->Count() < 1 )
       
   582 		{
       
   583 		ShowNoProfilesNotificationL();
       
   584 		}
       
   585 	else
       
   586 		{
       
   587     	TInt selectedIndex = iModel->ProfileIndexByIdL(
       
   588     	    iModel->VSSettingsProfileL() );
       
   589         TInt currentIndex ( selectedIndex );
       
   590 
       
   591 		if ( selectedIndex == KErrNotFound )
       
   592 			{
       
   593 			// first profile in the list
       
   594 			selectedIndex = CMusSettingsModel::KVsSipProfileDefault;
       
   595 			}
       
   596 
       
   597 		// Create and display the pop-up list
       
   598 		CAknRadioButtonSettingPage* defaultPopUp =
       
   599 			new ( ELeave ) CAknRadioButtonSettingPage(
       
   600     			R_VS_SIP_PROFILE_LIST_VIEW_SELECT_SETTING_PAGE,
       
   601     			selectedIndex,
       
   602     			array );
       
   603 		if ( defaultPopUp->ExecuteLD(
       
   604 			CAknSettingPage::EUpdateWhenChanged ) )
       
   605 			{
       
   606 			if ( selectedIndex != currentIndex )
       
   607         		{
       
   608 	        	// User has changed the selected profile, set new
       
   609     	    	// setting to persistent storage
       
   610     	    	TUint newValue = iModel->ProfileIdByIndex( selectedIndex );
       
   611 	    	    iModel->SetVSSettingsProfileL( newValue );
       
   612 	    	    Container()->ShowNewProfileActiveAfterCallL();
       
   613 				Container()->UpdateListBoxL( KGSSettIdSIPProfile );
       
   614     			}
       
   615 			}
       
   616 		}
       
   617 
       
   618 	CleanupStack::PopAndDestroy( array );  // array
       
   619     }
       
   620 
       
   621 
       
   622 // ----------------------------------------------------------------------------
       
   623 // Provides a dialog for user to choose saving location for recorderded video.
       
   624 // (locations are naturally phone memory or memory card).
       
   625 // ----------------------------------------------------------------------------
       
   626 //
       
   627 void CMusSettingsPlugin::ShowVSSettingsRecordedVideoSavingSettingDialogL()
       
   628     {
       
   629     MUS_LOG(
       
   630     "[MUSSET] -> CMusSettingsPlugin::ShowVSSettingsRecordedVideoSavingSettingDialogL()" )
       
   631     TDriveUnit phoneMemUnit( 
       
   632                     TParsePtrC( PathInfo::PhoneMemoryRootPath() ).Drive() );
       
   633     TDriveUnit mmcUnit( TParsePtrC( PathInfo::MemoryCardRootPath() ).Drive() );
       
   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 
       
   648     
       
   649 
       
   650     TBool result( EFalse );
       
   651     TDriveNumber driveNumber((TDriveNumber)currentValue);    
       
   652     result = dlg->ExecuteL( driveNumber, NULL, NULL );
       
   653 
       
   654     if ( result != CAknCommonDialogsBase::TReturnKey(
       
   655                                         CAknCommonDialogsBase::ERightSoftkey) )
       
   656         {
       
   657         if ( ( TInt ) driveNumber != currentValue )
       
   658             {
       
   659             iModel->SetVSSettingsRecordedVideoSavingL( ( TInt ) driveNumber );
       
   660             }
       
   661         Container()->UpdateListBoxL( KGSSettIdRecordedVideoSaving );
       
   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 */
       
   693 
       
   694     CleanupStack::PopAndDestroy(dlg); 
       
   695     MUS_LOG(
       
   696     "[MUSSET] <- CMusSettingsPlugin::ShowVSSettingsRecordedVideoSavingSettingDialogL()" )
       
   697     }
       
   698 
       
   699 
       
   700 // ----------------------------------------------------------------------------
       
   701 // In standard variant provides user a "Capability auditory note" setting
       
   702 // dialog, and in operator variant provides user an "Alerts" setting dialog.
       
   703 // Note that in both variants the different dialogs toggle the same setting.
       
   704 // ----------------------------------------------------------------------------
       
   705 //
       
   706 void CMusSettingsPlugin::ShowVSSettingsNoteSettingDialogL()
       
   707     {
       
   708     MUS_LOG(
       
   709     "[MUSSET] -> CMusSettingsPlugin::ShowVSSettingsNoteSettingDialogL()" )
       
   710     MusSettingsKeys::TAuditoryNotification currentValue =
       
   711     	iModel->VSSettingsNoteL();
       
   712     TInt intCurrentValue = static_cast<TInt>( currentValue );
       
   713 
       
   714     CAknRadioButtonSettingPage* dlg;
       
   715     CDesCArrayFlat* items;
       
   716 
       
   717     if ( iModel->VSSettingsOperatorVariantL() == MusSettingsKeys::EStandard )
       
   718         {
       
   719         items = iCoeEnv->ReadDesC16ArrayResourceL(
       
   720             R_VS_AUDIO_SETTING_PAGE_LBX );
       
   721         CleanupStack::PushL( items );
       
   722         dlg = new ( ELeave ) CAknRadioButtonSettingPage(
       
   723             R_VS_AUDIO_SETTING_PAGE,
       
   724             intCurrentValue,
       
   725             items );
       
   726         }
       
   727     else
       
   728         {
       
   729         items = iCoeEnv->ReadDesC16ArrayResourceL(
       
   730             R_VS_NOTE_SETTING_PAGE_LBX );
       
   731         CleanupStack::PushL( items );
       
   732         dlg = new ( ELeave ) CAknRadioButtonSettingPage(
       
   733             R_VS_NOTE_SETTING_PAGE,
       
   734             intCurrentValue,
       
   735             items );
       
   736         }
       
   737 
       
   738     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
       
   739         {
       
   740         currentValue =
       
   741         	static_cast<MusSettingsKeys::TAuditoryNotification>
       
   742         	    ( intCurrentValue );
       
   743         iModel->SetVSSettingsNoteL( currentValue );
       
   744         Container()->UpdateListBoxL( KGSSettIdNote );
       
   745         }
       
   746 
       
   747     CleanupStack::PopAndDestroy( items );
       
   748     MUS_LOG(
       
   749     "[MUSSET] <- CMusSettingsPlugin::ShowVSSettingsNoteSettingDialogL()" )
       
   750     }
       
   751 
       
   752 
       
   753 // ----------------------------------------------------------------------------
       
   754 // Shows a notifications that no SIP profiles exists.
       
   755 // ----------------------------------------------------------------------------
       
   756 //
       
   757 void CMusSettingsPlugin::ShowNoProfilesNotificationL()
       
   758     {
       
   759     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::ShowNoProfilesNotificationL()" )
       
   760     HBufC* infoTxt = StringLoader::LoadLC( R_QTN_MSH_SET_PROFILE_EMPTY );
       
   761     CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue );
       
   762     note->ExecuteLD( infoTxt->Des() );
       
   763     CleanupStack::PopAndDestroy( infoTxt );
       
   764     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::ShowNoProfilesNotificationL()" )
       
   765     }
       
   766 
       
   767 
       
   768 // ---------------------------------------------------------------------------
       
   769 // Switches between two possible values from one to another (i.e. toggles a
       
   770 // setting on/off). Toggled setting is passed in aValue parameter.
       
   771 // ---------------------------------------------------------------------------
       
   772 //
       
   773 void CMusSettingsPlugin::SwitchOnOffValueL( TInt aValue )
       
   774     {
       
   775     switch( aValue )
       
   776 	    {
       
   777 	    case KGSSettIdVSActivation:
       
   778 	    	{
       
   779 	    	if ( MusSettingsKeys::EAlwaysActive
       
   780 	    		== iModel->VSSettingsActivationL() )
       
   781 	    		{
       
   782 	    		iModel->SetVSSettingsActivationL( MusSettingsKeys::ENever );
       
   783 	    		}
       
   784 	    	else
       
   785 	    		{
       
   786 	    		iModel->SetVSSettingsActivationL(
       
   787 	    			MusSettingsKeys::EAlwaysActive );
       
   788 	    		}
       
   789 	    	break;
       
   790 	    	}
       
   791 	    case KGSSettIdAutoRecord:
       
   792 	        {
       
   793 	        if ( MusSettingsKeys::EAutoRecordOff ==
       
   794 	                                iModel->VSSettingsAutoRecordL() )
       
   795 		    	{
       
   796 		    	iModel->SetVSSettingsAutoRecordL( 
       
   797 		    	                    MusSettingsKeys::EAutoRecordOn );
       
   798 		    	}
       
   799 			else
       
   800 				{
       
   801 				iModel->SetVSSettingsAutoRecordL(
       
   802 					                MusSettingsKeys::EAutoRecordOff );
       
   803 				}
       
   804 	        break;
       
   805 	        }
       
   806 	    case KGSSettIdRecordedVideoSaving:
       
   807 	    	{
       
   808 		    TDriveUnit phoneMemUnit( 
       
   809 		            TParsePtrC( PathInfo::PhoneMemoryRootPath() ).Drive() );
       
   810             TDriveUnit mmcUnit( 
       
   811                     TParsePtrC( PathInfo::MemoryCardRootPath() ).Drive() );    
       
   812     
       
   813 		    if ( ( TInt )phoneMemUnit 
       
   814 		        == iModel->VSSettingsRecordedVideoSavingL() )
       
   815 		    	{
       
   816 		    	iModel->SetVSSettingsRecordedVideoSavingL( ( TInt )mmcUnit );
       
   817 		    	}
       
   818 			else
       
   819 				{
       
   820 				iModel->SetVSSettingsRecordedVideoSavingL( ( TInt )phoneMemUnit );
       
   821 				}
       
   822 			break;
       
   823 	    	}
       
   824 		case KGSSettIdNote:
       
   825 			{
       
   826 		    if ( MusSettingsKeys::EAuditoryNotificationOn
       
   827 		    	== iModel->VSSettingsNoteL() )
       
   828 		    	{
       
   829 		    	iModel->SetVSSettingsNoteL(
       
   830 		    		MusSettingsKeys::EAuditoryNotificationOff );
       
   831 		    	}
       
   832 			else
       
   833 				{
       
   834 				iModel->SetVSSettingsNoteL(
       
   835 					MusSettingsKeys::EAuditoryNotificationOn );
       
   836 				}
       
   837 			break;
       
   838 			}
       
   839 	    default:
       
   840 	    	{
       
   841 	    	MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::SwitchOnOffValueL() - error unknown setting" )
       
   842 	    	User::Leave( KErrArgument );
       
   843 	    	}
       
   844 	    }
       
   845     }
       
   846 
       
   847 // -----------------------------------------------------------------------------
       
   848 //
       
   849 // -----------------------------------------------------------------------------
       
   850 //
       
   851 void CMusSettingsPlugin::ShowGlobalInformationDialogL( TInt aResourceId )
       
   852     {
       
   853     CAknGlobalNote* dlg = CAknGlobalNote::NewLC();
       
   854     HBufC* dlgPrompt = StringLoader::LoadLC( aResourceId );
       
   855     TRequestStatus status;
       
   856     dlg->ShowNoteL( status, EAknGlobalInformationNote, *dlgPrompt  );
       
   857     User::WaitForRequest( status );
       
   858     CleanupStack::PopAndDestroy( dlgPrompt );
       
   859     CleanupStack::PopAndDestroy( dlg );
       
   860     }
       
   861 
       
   862 // ----------------------------------------------------------------------------
       
   863 // From class CGSPluginInterface.
       
   864 // Creates a new icon of desired type. Overrided to provide custom icons.
       
   865 // Ownership of the created icon is transferred to the caller.
       
   866 // ----------------------------------------------------------------------------
       
   867 //
       
   868 CGulIcon* CMusSettingsPlugin::CreateIconL( const TUid aIconType )
       
   869     {
       
   870     MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::CreateIconL()" )
       
   871 
       
   872 	CGulIcon* icon;
       
   873 
       
   874     if( aIconType == KGSIconTypeLbxItem )
       
   875         {
       
   876         // Create a custom icon
       
   877 	    TParse* fp = new( ELeave ) TParse();
       
   878 	    CleanupStack::PushL( fp );
       
   879 	    HBufC* fileName = MusResourceFinderUtil::AppResourcePathL(
       
   880 	    		                        KGSVSSettingsPluginIconDirAndName );
       
   881 	    CleanupStack::PushL(fileName);
       
   882 	    fp->Set( *fileName , &KDC_BITMAP_DIR, NULL );
       
   883 	    CleanupStack::PopAndDestroy( fileName );
       
   884 
       
   885         icon = AknsUtils::CreateGulIconL(
       
   886         AknsUtils::SkinInstance(),
       
   887         KAknsIIDQgnPropSetVideoSharing,
       
   888         fp->FullName(),
       
   889         EMbmMussettingspluginQgn_prop_set_video_sharing,
       
   890         EMbmMussettingspluginQgn_prop_set_video_sharing_mask );
       
   891 
       
   892         CleanupStack::PopAndDestroy( fp );
       
   893         }
       
   894     else
       
   895         {
       
   896         // Use default icon from base class CGSPluginInterface.
       
   897         icon = CGSPluginInterface::CreateIconL( aIconType );
       
   898         }
       
   899 
       
   900     MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::CreateIconL()" )
       
   901 
       
   902     return icon;
       
   903     }
       
   904