idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsbkmlist.cpp
branchRCL_3
changeset 130 67f2ed48ad91
parent 122 6cadd6867c17
--- a/idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsbkmlist.cpp	Wed Sep 15 12:32:36 2010 +0300
+++ b/idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsbkmlist.cpp	Wed Oct 13 14:53:46 2010 +0300
@@ -28,7 +28,6 @@
 _LIT( KUrl, "url" );
 _LIT8( KUid, "uid" );
 _LIT( KMenuAttrParameter, "param" );
-_LIT8( KMenuAttrParameter8, "param" );
 
 // ======== MEMBER FUNCTIONS ========
 
@@ -86,13 +85,7 @@
 //
 TInt CMCSPluginSettingsBkmList::MdcaCount() const
     {
-    TInt listItemsCount( 0 );
-    for( TInt i = 0; i< iListItems.Count(); i++ )
-        {
-        if( !iListItems[i]->iHidden )
-            listItemsCount++;
-        }
-    return listItemsCount;
+    return iListItems.Count();
     }
 
 // ---------------------------------------------------------------------------
@@ -111,79 +104,38 @@
     }
 
 // ---------------------------------------------------------------------------
-// Checks with a given index if bookmark has been hidden from menulist.
-// ---------------------------------------------------------------------------
-//
-TBool CMCSPluginSettingsBkmList::ItemHidden( TInt aIndex )
-    {
-    if ( aIndex < 0 || aIndex >= iListItems.Count( ))
-        {
-        return EFalse;
-        }
-    return iListItems[aIndex]->iHidden;
-    }
-
-// ---------------------------------------------------------------------------
 // Iterates thru the bookmark list and tries to find a menuitem which 
 // matches given property map from HSPS
 // ---------------------------------------------------------------------------
 //
-TSettingItem CMCSPluginSettingsBkmList::FindItemL(
-    RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties )
+TSettingItem CMCSPluginSettingsBkmList::FindItemL( RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties )
     {
-    HBufC* uid( NULL );
-    HBufC* param( NULL );
     TInt index( KErrNotFound );
-    TSettingItem settingItem = { KErrNotFound, EBookmark, EFalse, EFalse };
-    
-    // read property values
+    TSettingItem settingItem = { KErrNotFound, EBookmark, EFalse };
     for( TInt i= 0; i < aProperties.Count(); i++ )
         {
         if( aProperties[i]->Name() == KUid )
             {
-            uid = AiUtility::CopyToBufferL(
-                  uid, aProperties[i]->Value() );
-            CleanupStack::PushL( uid );
-            }
-        else if( aProperties[i]->Name() == KMenuAttrParameter8 )
-            {
-            param = AiUtility::CopyToBufferL(
-                    param, aProperties[i]->Value() );
-            CleanupStack::PushL( param );
+            HBufC* value( NULL );
+            value = AiUtility::CopyToBufferL( value, aProperties[i]->Value());
+            for( TInt j = 0; j < iListItems.Count(); j++ )
+                {
+                TPtrC uid = *iListItems[j]->iUid;
+                if( uid.Compare( *value ) == 0 )
+                    {
+                    index = j;
+                    break;
+                    }
+                }
+            delete value;
             }
-        }
-    
-    // try to find a match
-    for( TInt j = 0; j < iListItems.Count(); j++ )
-        {
-        TPtrC value = *iListItems[j]->iUid;
-        if( value.Compare( *uid ) == 0 )
+        if( index != KErrNotFound )
             {
-            index = j;
+            settingItem.id = index;
+            settingItem.type = EBookmark;
             break;
             }
         }
-    
-    // menuitem not found, add a new one
-    if( index == KErrNotFound && uid && param )
-        {
-        CBkmListItem* listItem = CBkmListItem::NewLC( *uid, *param );
-        listItem->iType = EFavBookmark;
-        listItem->iUrl = KNullDesC().AllocL();
-        listItem->iHidden = ETrue;
-        iListItems.Append( listItem );
-        CleanupStack::Pop( listItem );
-        
-        TInt listItemsCount = iListItems.Count();
-        TPtrC value = *iListItems[--listItemsCount]->iUid;
-        if( value.Compare( *uid ) == 0 )
-            index = listItemsCount;
-        }
-    
-    if( param ) CleanupStack::PopAndDestroy( param );
-    if( uid ) CleanupStack::PopAndDestroy( uid );
-    
-    settingItem.id = index;
     return settingItem;
     }
 
@@ -367,7 +319,7 @@
 //Nested class to store individual bookmark list items
 // ---------------------------------------------------------------------------
 //
-CMCSPluginSettingsBkmList::CBkmListItem::CBkmListItem() : iHidden( EFalse )
+CMCSPluginSettingsBkmList::CBkmListItem::CBkmListItem()
     {
     }