mmshplugins/mmshsettingsuiplugin/src/mussettingscontainer.cpp
changeset 2 b31261fd4e04
parent 0 f0cf47e981f9
child 13 a184f3d659e6
equal deleted inserted replaced
1:065f1826587f 2:b31261fd4e04
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  Container for MUSSettingsPlugin.
    14 * Description:  Container for MUSSettingsPlugin.
    15 *  Version     : %version: 15.2.4.1.7 % << Don't touch! Updated by Synergy at check-out.
    15 *  Version     : %version: 20 % << Don't touch! Updated by Synergy at check-out.
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 
    19 
    20 
    20 
    63 
    63 
    64 void CMusSettingsContainer::ConstructL( const TRect& aRect )
    64 void CMusSettingsContainer::ConstructL( const TRect& aRect )
    65     {
    65     {
    66     MUS_LOG( "[MUSSET] -> CMusSettingsContainer::ConstructL()" )
    66     MUS_LOG( "[MUSSET] -> CMusSettingsContainer::ConstructL()" )
    67 
    67 
    68     iOperatorVariant = iModel.VSSettingsOperatorVariantL();
    68     iOperatorVariant = MultimediaSharingSettings::OperatorVariantSettingL();
    69 
    69 
    70     iListBox = new( ELeave ) CAknSettingStyleListBox;
    70     iListBox = new( ELeave ) CAknSettingStyleListBox;
    71 
    71 
    72     if ( iOperatorVariant == MusSettingsKeys::EStandard )
    72     if ( iOperatorVariant == MusSettingsKeys::EStandard )
    73     	{
    73     	{
    91    	delete iListboxItemArray;
    91    	delete iListboxItemArray;
    92     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::~CMusSettingsContainer()" )
    92     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::~CMusSettingsContainer()" )
    93     }
    93     }
    94 
    94 
    95 
    95 
    96 // ---------------------------------------------------------------------------
    96 // -----------------------------------------------------------------------------
    97 // Constructs a listbox from a specified resource id.
    97 // Constructs a listbox from a specified resource id.
    98 // ---------------------------------------------------------------------------
    98 // -----------------------------------------------------------------------------
    99 //
    99 //
   100 void CMusSettingsContainer::ConstructListBoxL( TInt aResLbxId )
   100 void CMusSettingsContainer::ConstructListBoxL( TInt aResLbxId )
   101     {
   101     {
   102     MUS_LOG( "[MUSSET] -> CMusSettingsContainer::ConstructListBoxL()" )
   102     MUS_LOG( "[MUSSET] -> CMusSettingsContainer::ConstructListBoxL()" )
   103     iListBox->ConstructL( this, EAknListBoxSelectionList );
   103     iListBox->ConstructL( this, EAknListBoxSelectionList );
   133         }    
   133         }    
   134     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::ConstructListBoxL()" )
   134     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::ConstructListBoxL()" )
   135     }
   135     }
   136 
   136 
   137 
   137 
   138 // ---------------------------------------------------------------------------
   138 // -----------------------------------------------------------------------------
   139 // Populates listbox items.
   139 // Populates listbox items.
   140 // ---------------------------------------------------------------------------
   140 // -----------------------------------------------------------------------------
   141 //
   141 //
   142 void CMusSettingsContainer::CreateListBoxItemsL()
   142 void CMusSettingsContainer::CreateListBoxItemsL()
   143     {
   143     {
   144     MUS_LOG( "[MUSSET] -> CMusSettingsContainer::CreateListBoxItemsL()" )
   144     MUS_LOG( "[MUSSET] -> CMusSettingsContainer::CreateListBoxItemsL()" )
   145     if ( iOperatorVariant == MusSettingsKeys::EStandard )
   145     if ( iOperatorVariant == MusSettingsKeys::EStandard )
   156     MakeNoteItemL();
   156     MakeNoteItemL();
   157     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::CreateListBoxItemsL()" )
   157     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::CreateListBoxItemsL()" )
   158     }
   158     }
   159 
   159 
   160 
   160 
   161 // ---------------------------------------------------------------------------
   161 // -----------------------------------------------------------------------------
   162 // Updates a specified feature (item in listbox).
   162 // Updates a specified feature (item in listbox).
   163 // ---------------------------------------------------------------------------
   163 // -----------------------------------------------------------------------------
   164 //
   164 //
   165 void CMusSettingsContainer::UpdateListBoxL( TInt aFeatureId )
   165 void CMusSettingsContainer::UpdateListBoxL( TInt aFeatureId )
   166     {
   166     {
   167     MUS_LOG1( "[MUSSET] <- CMusSettingsContainer::UpdateListBoxL()( %d )",
   167     MUS_LOG1( "[MUSSET] <- CMusSettingsContainer::UpdateListBoxL()( %d )",
   168               aFeatureId )
   168               aFeatureId )
   197     iListBox->HandleItemAdditionL();
   197     iListBox->HandleItemAdditionL();
   198     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::UpdateListBoxL()" )
   198     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::UpdateListBoxL()" )
   199     }
   199     }
   200 
   200 
   201 
   201 
   202 // ---------------------------------------------------------------------------
   202 // -----------------------------------------------------------------------------
   203 // Generic method to add an item to listbox and make it visible.
   203 // Generic method to add an item to listbox and make it visible.
   204 // ---------------------------------------------------------------------------
   204 // -----------------------------------------------------------------------------
   205 //
   205 //
   206 void CMusSettingsContainer::AddItemL( TInt aId, const TPtrC aText )
   206 void CMusSettingsContainer::AddItemL( TInt aId, const TPtrC aText )
   207 	{
   207 	{
   208 	MUS_LOG( "[MUSSET] -> CMusSettingsContainer::AddItemL()" )
   208 	MUS_LOG( "[MUSSET] -> CMusSettingsContainer::AddItemL()" )
   209     iListboxItemArray->SetDynamicTextL( aId, aText );
   209     iListboxItemArray->SetDynamicTextL( aId, aText );
   211     	CGSListBoxItemTextArray::EVisible );
   211     	CGSListBoxItemTextArray::EVisible );
   212 	MUS_LOG( "[MUSSET] <- CMusSettingsContainer::AddItemL()" )
   212 	MUS_LOG( "[MUSSET] <- CMusSettingsContainer::AddItemL()" )
   213 	}
   213 	}
   214 
   214 
   215 
   215 
   216 // ---------------------------------------------------------------------------
   216 // -----------------------------------------------------------------------------
   217 // Adds activation setting item to listbox.
   217 // Adds activation setting item to listbox.
   218 // ---------------------------------------------------------------------------
   218 // -----------------------------------------------------------------------------
   219 //
   219 //
   220 void CMusSettingsContainer::MakeActivationItemL()
   220 void CMusSettingsContainer::MakeActivationItemL()
   221     {
   221     {
   222     MUS_LOG( "[MUSSET] -> CMusSettingsContainer::MakeActivationItemL()" )
   222     MUS_LOG( "[MUSSET] -> CMusSettingsContainer::MakeActivationItemL()" )
   223 
   223 
   224    	iVSActication = iModel.VSSettingsActivationL();
   224     MusSettingsKeys::TActivation activation = 
   225    	AddItemL( KGSSettIdVSActivation, ( *iActivationItems )[ iVSActication ] );
   225                                 MultimediaSharingSettings::ActivationSettingL();
       
   226  
       
   227     if ( activation != MusSettingsKeys::EAlwaysActive )
       
   228         {
       
   229         // We make sure that if someone has written to CenRep value bigger
       
   230         // than 1 (which after OCC changes means 'Off') we treat it as 'Off'.
       
   231         activation = MusSettingsKeys::EActiveInHomeNetworks;
       
   232         }
       
   233     
       
   234    	AddItemL( KGSSettIdVSActivation, ( *iActivationItems )[ activation ] );
   226 
   235 
   227     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::MakeActivationItemL()" )
   236     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::MakeActivationItemL()" )
   228     }
   237     }
   229 
   238 
   230 
   239 
   231 // ---------------------------------------------------------------------------
   240 // -----------------------------------------------------------------------------
   232 // Adds operator specific activation setting item to listbox.
   241 // Adds operator specific activation setting item to listbox.
   233 // ---------------------------------------------------------------------------
   242 // -----------------------------------------------------------------------------
   234 //
   243 //
   235 void CMusSettingsContainer::MakeOperatorActivationItemL()
   244 void CMusSettingsContainer::MakeOperatorActivationItemL()
   236     {
   245     {
   237     MUS_LOG( "[MUSSET] -> CMusSettingsContainer::MakeOperatorActivationItemL()" )
   246     MUS_LOG( "[MUSSET] -> CMusSettingsContainer::MakeOperatorActivationItemL()" )
   238     MUS_LOG1( "Activation item( %d )",
   247     MUS_LOG1( "Activation item( %d )",
   241 
   250 
   242     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::MakeOperatorActivationItemL()" )
   251     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::MakeOperatorActivationItemL()" )
   243     }
   252     }
   244 
   253 
   245 
   254 
   246 // ---------------------------------------------------------------------------
   255 // -----------------------------------------------------------------------------
   247 // Adds SIP profile setting item to settings listbox. Item will contain
   256 // Adds SIP profile setting item to settings listbox. Item will contain
   248 // indication of [no SIP profile selected], [using default SIP profile] or
   257 // indication of [no SIP profile selected], [using default SIP profile] or
   249 // [name of SIP profile specified to be used]
   258 // [name of SIP profile specified to be used]
   250 // ---------------------------------------------------------------------------
   259 // -----------------------------------------------------------------------------
   251 //
   260 //
   252 void CMusSettingsContainer::MakeSIPProfileItemL()
   261 void CMusSettingsContainer::MakeSIPProfileItemL()
   253     {
   262     {
   254     MUS_LOG( "[MUSSET] -> CMusSettingsContainer::MakeSIPProfileItemL()" )
   263     MUS_LOG( "[MUSSET] -> CMusSettingsContainer::MakeSIPProfileItemL()" )
   255 
   264 
   256     TInt profile = iModel.VSSettingsProfileL();
   265     TInt profile = MultimediaSharingSettings::SipProfileSettingL();
   257 
   266 
   258     if ( profile != KDefaultSipProfile && profile != KNoSipProfileSelected )
   267     if ( profile != KDefaultSipProfile && profile != KNoSipProfileSelected )
   259     	{
   268     	{
   260     	// profile id defined, get profile name
   269     	// profile id defined, get profile name
   261 		HBufC* name = iModel.ProfileNameL( profile );
   270 		HBufC* name = iModel.ProfileNameL( profile );
   287 
   296 
   288     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::MakeSIPProfileItemL()" )
   297     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::MakeSIPProfileItemL()" )
   289     }
   298     }
   290 
   299 
   291 
   300 
   292 // ---------------------------------------------------------------------------
   301 // -----------------------------------------------------------------------------
   293 // Adds autorecord item to listbox.
   302 // Adds autorecord item to listbox.
   294 // ---------------------------------------------------------------------------
   303 // -----------------------------------------------------------------------------
   295 //
   304 //
   296 void CMusSettingsContainer::MakeAutoRecordItemL()
   305 void CMusSettingsContainer::MakeAutoRecordItemL()
   297     {
   306     {
   298     MUS_LOG( "[MUSSET] -> CMusSettingsContainer::MakeAutoRecordItemL()" )
   307     MUS_LOG( "[MUSSET] -> CMusSettingsContainer::MakeAutoRecordItemL()" )
   299     TInt autoRecordMode = iModel.VSSettingsAutoRecordL();
   308     TInt autoRecordMode = MultimediaSharingSettings::AutoRecordSettingL();
   300     
   309     
   301     MUS_LOG1( "[MUSSET]    autoRecordMode: %d", autoRecordMode  )
   310     MUS_LOG1( "[MUSSET]    autoRecordMode: %d", autoRecordMode  )
   302     MUS_LOG1( "[MUSSET]    iAutoRecordItems.Count: %d", iAutoRecordItems->Count() )
   311     MUS_LOG1( "[MUSSET]    iAutoRecordItems.Count: %d", iAutoRecordItems->Count() )
   303 
   312 
   304     if ( autoRecordMode > iAutoRecordItems->Count() - 1 )
   313     if ( autoRecordMode > iAutoRecordItems->Count() - 1 )
   312     
   321     
   313     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::MakeAutoRecordItemL()" )
   322     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::MakeAutoRecordItemL()" )
   314     }
   323     }
   315 
   324 
   316 
   325 
   317 // ---------------------------------------------------------------------------
   326 // -----------------------------------------------------------------------------
   318 // Adds recorded video saving item to listbox.
   327 // Adds recorded video saving item to listbox.
   319 // ---------------------------------------------------------------------------
   328 // -----------------------------------------------------------------------------
   320 //
   329 //
   321 void CMusSettingsContainer::MakeRecordedVideoSavingItemL()
   330 void CMusSettingsContainer::MakeRecordedVideoSavingItemL()
   322     {
   331     {
   323     MUS_LOG(
   332     MUS_LOG(
   324     	"[MUSSET] -> CMusSettingsContainer::MakeRecordedVideoSavingItemL()" )
   333     	"[MUSSET] -> CMusSettingsContainer::MakeRecordedVideoSavingItemL()" )
   330     TDriveNumber driveNumber = ( TDriveNumber )savingMode;
   339     TDriveNumber driveNumber = ( TDriveNumber )savingMode;
   331     TInt index = dlg->FindIndexByDrive( driveNumber );
   340     TInt index = dlg->FindIndexByDrive( driveNumber );
   332     
   341     
   333     if ( index == KErrNotFound )
   342     if ( index == KErrNotFound )
   334         {
   343         {
   335         MUS_LOG( "[MUSSET] -> preferred drive doesn't exist anymore \
   344         MUS_LOG( "[MUSSET]    Preferred drive doesn't exist anymore, " )
   336 (e.g. remote drive deleted), taking system drive..." )
   345         MUS_LOG( "[MUSSET]    e.g. remote drive deleted, using system drive" )
   337 
   346 
   338         driveNumber = RFs::GetSystemDrive();
   347         driveNumber = RFs::GetSystemDrive();
   339         index = dlg->FindIndexByDrive( driveNumber );
   348         index = dlg->FindIndexByDrive( driveNumber );
   340         iModel.SetVSSettingsRecordedVideoSavingL( driveNumber );
   349         MultimediaSharingSettings::SetVideoLocationSettingL( driveNumber );
   341         }
   350         }
   342 
   351 
   343     TFileName item( KNullDesC );  
   352     TFileName item( KNullDesC );  
   344     dlg->GetItem( index, item );
   353     dlg->GetItem( index, item );
   345     MUS_LOG1( "[MUSSET]     Current drive:%d", driveNumber )
   354     MUS_LOG1( "[MUSSET]     Current drive:%d", driveNumber )
   351     MUS_LOG(
   360     MUS_LOG(
   352     	"[MUSSET] <- CMusSettingsContainer::MakeRecordedVideoSavingItemL()" )
   361     	"[MUSSET] <- CMusSettingsContainer::MakeRecordedVideoSavingItemL()" )
   353     }
   362     }
   354 
   363 
   355 
   364 
   356 // ---------------------------------------------------------------------------
   365 // -----------------------------------------------------------------------------
   357 // Adds note item to listbox. (Alerts setting). Present only with operator
   366 // Adds note item to listbox. (Alerts setting). Present only with operator
   358 // variant set.
   367 // variant set.
   359 // ---------------------------------------------------------------------------
   368 // -----------------------------------------------------------------------------
   360 //
   369 //
   361 void CMusSettingsContainer::MakeNoteItemL()
   370 void CMusSettingsContainer::MakeNoteItemL()
   362     {
   371     {
   363     MUS_LOG(
   372     MUS_LOG( "[MUSSET] -> CMusSettingsContainer::MakeNoteItemL()" )
   364     	"[MUSSET] -> CMusSettingsContainer::MakeNoteItemL()" )
   373 
   365 
   374     MusSettingsKeys::TAuditoryNotification auditoryNotification = 
   366     TInt savingMode = iModel.VSSettingsNoteL();
   375                     MultimediaSharingSettings::AuditoryNotificationSettingL();
   367 
   376 
   368     MUS_LOG1( "[MUSSET] -> CMusSettingsContainer::Mode:%d()", savingMode );
   377     MUS_LOG1( "[MUSSET] -> CMusSettingsContainer::Mode:%d()", 
       
   378               auditoryNotification )
   369 
   379 
   370     // If unset, use and set default value
   380     // If unset, use and set default value
   371     if ( savingMode < 0 || savingMode > 1 )
   381     if ( auditoryNotification < 0 || auditoryNotification > 1 )
   372 	    {
   382 	    {
   373 	    MUS_LOG( "[MUSSET] -> SetVSSettingsNoteL" );
   383         auditoryNotification = MusSettingsKeys::EAuditoryNotificationOff;
   374 	    savingMode = 0;
   384         MultimediaSharingSettings::SetAuditoryNotificationSettingL(
   375 	    iModel.SetVSSettingsNoteL(
   385                                     MusSettingsKeys::EAuditoryNotificationOff );
   376 	        MusSettingsKeys::EAuditoryNotificationOff );
       
   377 	    MUS_LOG( "[MUSSET] <- SetVSSettingsNoteL" );
       
   378 	    }
   386 	    }
   379     MUS_LOG( "[MUSSET] -> AddItemL" );
   387 
   380 	AddItemL( KGSSettIdNote, ( *iActivationItems )[ savingMode ] );
   388 	AddItemL( KGSSettIdNote, ( *iActivationItems )[ auditoryNotification ] );
   381 	MUS_LOG( "[MUSSET] <- SetVSSettingsNoteL" );
   389 	
   382     MUS_LOG(
   390     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::MakeNoteItemL()" )
   383     	"[MUSSET] <- CMusSettingsContainer::MakeNoteItemL()" )
   391     }
   384     }
   392 
   385 
   393 
   386 
   394 // -----------------------------------------------------------------------------
   387 // ---------------------------------------------------------------------------
       
   388 // Gets help context.
   395 // Gets help context.
   389 // ---------------------------------------------------------------------------
   396 // -----------------------------------------------------------------------------
   390 //
   397 //
   391 void CMusSettingsContainer::GetHelpContext( TCoeHelpContext& aContext ) const
   398 void CMusSettingsContainer::GetHelpContext( TCoeHelpContext& aContext ) const
   392     {
   399     {
   393     MUS_LOG( "[MUSSET] -> CMusSettingsContainer::GetHelpContext()" )
   400     MUS_LOG( "[MUSSET] -> CMusSettingsContainer::GetHelpContext()" )
   394     aContext.iMajor = KUidMUSH;
   401     aContext.iMajor = KUidMUSH;
   395     aContext.iContext = KMSH_HLP_SETTINGS;
   402     aContext.iContext = KMSH_HLP_SETTINGS;
   396     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::GetHelpContext()" )
   403     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::GetHelpContext()" )
   397     }
   404     }
   398 
   405 
   399 
   406 
   400 // ---------------------------------------------------------------------------
   407 // -----------------------------------------------------------------------------
   401 // Returns currently selected feature (listbox item).
   408 // Returns currently selected feature (listbox item).
   402 // ---------------------------------------------------------------------------
   409 // -----------------------------------------------------------------------------
   403 //
   410 //
   404 TInt CMusSettingsContainer::CurrentFeatureId() const
   411 TInt CMusSettingsContainer::CurrentFeatureId() const
   405     {
   412     {
   406     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::CurrentFeatureId()" )
   413     MUS_LOG( "[MUSSET] <- CMusSettingsContainer::CurrentFeatureId()" )
   407     return iListboxItemArray->CurrentFeature( );
   414     return iListboxItemArray->CurrentFeature( );
   408     }
   415     }
   409 
   416 
   410 
   417 
   411 // ----------------------------------------------------------------------------
   418 // -----------------------------------------------------------------------------
   412 // If call is on, informs user with note that new profile is going to be active
   419 // If call is on, informs user with note that new profile is going to be active
   413 // after current call.
   420 // after current call.
   414 // ----------------------------------------------------------------------------
   421 // -----------------------------------------------------------------------------
   415 //
   422 //
   416 void CMusSettingsContainer::ShowNewProfileActiveAfterCallL()
   423 void CMusSettingsContainer::ShowNewProfileActiveAfterCallL()
   417     {
   424     {
   418     MUS_LOG(
   425     MUS_LOG(
   419     	"[MUSSET] -> CMusSettingsContainer::ShowNewProfileActiveAfterCallL()" )
   426     	"[MUSSET] -> CMusSettingsContainer::ShowNewProfileActiveAfterCallL()" )
   436 	    MUS_LOG(
   443 	    MUS_LOG(
   437 	    	"[MUSSET] <- CMusSettingsContainer::ShowNewProfileActiveAfterCallL()" )
   444 	    	"[MUSSET] <- CMusSettingsContainer::ShowNewProfileActiveAfterCallL()" )
   438 		}
   445 		}
   439     }
   446     }
   440 
   447 
   441 // ----------------------------------------------------------------------------
   448 // -----------------------------------------------------------------------------
   442 // void CMusSettingsContainer::HideItemsL(TInt aItemIndex)
   449 // void CMusSettingsContainer::HideItemsL(TInt aItemIndex)
   443 // Some items are unwanted by operators.Hide those items from listbox item
   450 // Some items are unwanted by operators.Hide those items from listbox item
   444 // ----------------------------------------------------------------------------
   451 // -----------------------------------------------------------------------------
   445 //
   452 //
   446 void CMusSettingsContainer::HideItemsL(TInt aItemIndex)
   453 void CMusSettingsContainer::HideItemsL(TInt aItemIndex)
   447     {
   454     {
   448     MUS_LOG1("[MUSSET] -> CMusSettingsContainer::HideItemsL() %d",aItemIndex )    
   455     MUS_LOG1("[MUSSET] -> CMusSettingsContainer::HideItemsL() %d",aItemIndex )    
   449     iListboxItemArray->SetItemVisibilityL( aItemIndex,
   456     iListboxItemArray->SetItemVisibilityL( aItemIndex,