idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsmodel.cpp
branchRCL_3
changeset 19 502e5d91ad42
parent 18 bd874ee5e5e2
child 51 15e4dd19031c
equal deleted inserted replaced
18:bd874ee5e5e2 19:502e5d91ad42
   555                                              TInt aId,
   555                                              TInt aId,
   556                                              TSettingType aType )
   556                                              TSettingType aType )
   557     {
   557     {
   558     if (aSettingIndex >= 0 && aSettingIndex < iSettings.Count())
   558     if (aSettingIndex >= 0 && aSettingIndex < iSettings.Count())
   559         {
   559         {
       
   560         TSettingItem oldItem = iSettings[ aSettingIndex ];
       
   561         iSettings[ aSettingIndex ].id = aId;
       
   562         iSettings[ aSettingIndex ].type = aType;
       
   563 
       
   564         if ( aType == EApplication )
       
   565             {
       
   566             CMenuItem& item = iAppList->ItemL( aId );
       
   567             SaveSettingsL( aSettingIndex, item );
       
   568             }
       
   569          else
       
   570             {
       
   571             CMenuItem& item = iBkmList->ItemL( aId );
       
   572             SaveSettingsL( aSettingIndex, item );
       
   573             }
       
   574         
   560         // Old setting type is bookmark. Remove bookmark item from MCS 
   575         // Old setting type is bookmark. Remove bookmark item from MCS 
   561         // if it was created in runtime.
   576         // if it was created in runtime.
   562         if( iSettings[aSettingIndex].type == EBookmark )
   577         if ( oldItem.type == EBookmark )
   563             {
   578             {
   564                 iBkmList->RemoveMenuItemL( iSettings[aSettingIndex].id );
   579                 iBkmList->RemoveMenuItemL( oldItem.id );
   565             }
   580             }
   566 
   581 
   567         // Old setting type is application.
   582         // Old setting type is application.
   568         // Remove app item from MCS if it was created in runtime (mailbox).
   583         // Remove app item from MCS if it was created in runtime (mailbox).
   569         if ( iSettings[ aSettingIndex ].type == EApplication )
   584         if ( oldItem.type == EApplication )
   570             {
   585             {
   571                 iAppList->RemoveMenuItemL( iSettings[ aSettingIndex ].id );
   586                 iAppList->RemoveMenuItemL( oldItem.id );
   572             }
       
   573 
       
   574         iSettings[aSettingIndex].id = aId;
       
   575         iSettings[aSettingIndex].type = aType;
       
   576 
       
   577         if ( aType == EApplication )
       
   578             {
       
   579             CMenuItem& item = iAppList->ItemL( aId );
       
   580             SaveSettingsL( aSettingIndex, item );
       
   581             }
       
   582         else
       
   583             {
       
   584             CMenuItem& item = iBkmList->ItemL( aId );
       
   585             SaveSettingsL( aSettingIndex, item );
       
   586             }
   587             }
   587 
   588 
   588         return ETrue;
   589         return ETrue;
   589         }
   590         }
   590     return EFalse;
   591     return EFalse;