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