--- a/idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsapplist.cpp Wed Sep 01 12:22:09 2010 +0100
+++ b/idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsapplist.cpp Tue Sep 14 21:55:16 2010 +0300
@@ -30,6 +30,7 @@
_LIT8( KItemLocked, "locked");
_LIT8( KProperValueFolder, "folder" );
_LIT( KMenuAttrUndefUid, "0x99999991" );
+_LIT( KMenuAttrInvokeSettingsUid, "0x99999990" );
_LIT( KMenuItemLongName, "long_name" );
#define KMCSCmailMtmUidValue 0x2001F406
@@ -54,44 +55,10 @@
iMenu.OpenL( KMyMenuData );
- // 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;
+ iUndefinedText = MenuItemTextL( KMenuAttrUndefUid );
+ iEmptyText = MenuItemTextL( KMenuAttrInvokeSettingsUid );
+ }
- 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
@@ -118,7 +85,7 @@
iMenu.Close();
delete iUndefinedText;
- delete iUndefinedItem;
+ delete iEmptyText;
}
// ---------------------------------------------------------------------------
@@ -188,7 +155,7 @@
RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties )
{
TBool attrExists( EFalse );
- TSettingItem settingItem = { KErrNotFound, EApplication, EFalse };
+ TSettingItem settingItem = { KErrNotFound, EApplication, EFalse, EFalse };
TBool isFolder = EFalse;
// check if the item is folder
@@ -414,4 +381,56 @@
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.