idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsapplist.cpp
branchRCL_3
changeset 130 67f2ed48ad91
parent 122 6cadd6867c17
--- a/idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsapplist.cpp	Wed Sep 15 12:32:36 2010 +0300
+++ b/idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsapplist.cpp	Wed Oct 13 14:53:46 2010 +0300
@@ -30,7 +30,6 @@
 _LIT8( KItemLocked, "locked");
 _LIT8( KProperValueFolder, "folder" );
 _LIT( KMenuAttrUndefUid, "0x99999991" );
-_LIT( KMenuAttrInvokeSettingsUid, "0x99999990" );
 _LIT( KMenuItemLongName, "long_name" );
 
 #define KMCSCmailMtmUidValue 0x2001F406
@@ -55,11 +54,45 @@
 
     iMenu.OpenL( KMyMenuData );
     
-    iUndefinedText = MenuItemTextL( KMenuAttrUndefUid );
-    iEmptyText = MenuItemTextL( KMenuAttrInvokeSettingsUid );
+    // Get "Undefined" icon and text
+    CMenuFilter* filter = CMenuFilter::NewL();
+    CleanupStack::PushL( filter );
+
+    // 'Undefined' item
+    filter->HaveAttributeL( KMenuAttrUid, KMenuAttrUndefUid );
+
+    TMenuItem item;
+    const TInt root = iMenu.RootFolderL();
+    RArray<TMenuItem> items;
+    CleanupClosePushL( items );
+    iMenu.GetItemsL( items, root, filter, ETrue );
+
+    if ( items.Count() > 0 )
+        {
+        iUndefinedItem = CMenuItem::OpenL( iMenu, items[ 0 ] );
+        iUndefinedText = NULL;
+
+        if ( iUndefinedItem )
+            {
+            TBool exists( KErrNotFound );//CleanupStack::PushL( undefinedItem );
+            TPtrC undefined = iUndefinedItem->GetAttributeL( KMenuItemLongName, exists );
+
+            if ( exists )
+                {
+                iUndefinedText = HBufC::NewMaxL( undefined.Length() );
+                iUndefinedText->Des().Copy( undefined );
+                }
+            else
+                {
+                iUndefinedText = KNullDesC().Alloc();
+                }
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &items );
+    CleanupStack::PopAndDestroy( filter );
     }
 
-
 // ---------------------------------------------------------------------------
 // Two-phased constructor
 // ---------------------------------------------------------------------------
@@ -85,7 +118,7 @@
     iMenu.Close();
     
     delete iUndefinedText;
-    delete iEmptyText;
+    delete iUndefinedItem;
     }
 
 // ---------------------------------------------------------------------------
@@ -155,7 +188,7 @@
         RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties )
     {
     TBool attrExists( EFalse );
-    TSettingItem settingItem = { KErrNotFound, EApplication, EFalse, EFalse };
+    TSettingItem settingItem = { KErrNotFound, EApplication, EFalse };
     TBool isFolder = EFalse;
 
     // check if the item is folder
@@ -215,7 +248,7 @@
 
                 // otherwise, compare attributes from HSPS and from menuitem
                 // if there is no match, move to the next item in the list
-                if ( attr.CompareF( *attrValue ) != 0 )
+                if ( attr != *attrValue )
                     {
                     match = EFalse;
                     }
@@ -381,56 +414,4 @@
     CleanupStack::Pop( newItem );
     }
 
-// ---------------------------------------------------------------------------
-// Gets specified menu item text
-// ---------------------------------------------------------------------------
-//
-HBufC* CMCSPluginSettingsAppList::MenuItemTextL( const TDesC& aUid )
-    {
-    HBufC* text = NULL;
-
-    // Get specified icon and text
-    CMenuFilter* filter = CMenuFilter::NewL();
-    CleanupStack::PushL( filter );
-    
-    // Filter specified item
-    filter->HaveAttributeL( KMenuAttrUid, aUid );
-    
-    const TInt root = iMenu.RootFolderL();
-    RArray<TMenuItem> items;
-    CleanupClosePushL( items );
-    iMenu.GetItemsL( items, root, filter, ETrue );
-    
-    CMenuItem* item = NULL;
-    
-    if ( items.Count() > 0 )
-        {
-        item = CMenuItem::OpenL( iMenu, items[ 0 ] );
-        
-        if ( item )
-            {
-            TBool exists( KErrNotFound );
-            TPtrC itemName = item->GetAttributeL( KMenuItemLongName, exists );
-    
-            if ( exists )
-                {
-                text = HBufC::NewMaxL( itemName.Length() );
-                text->Des().Copy( itemName );
-                }
-            delete item;
-            }
-        }
-
-    if( !text )
-        {
-        text = KNullDesC().Alloc();
-        }    
-
-    CleanupStack::PopAndDestroy( &items );
-    CleanupStack::PopAndDestroy( filter );
-    
-    return text;
-    }
-
-
 // End of File.