CMenuItem Class Reference

class CMenuItem : public CBase
Menu item. This class holds client-side local copy of requested item attributes. CMenuItem and the underlying storage are very losely coupled:
  • Changes to this class are not automatically comitted to menu. Call SaveL() to commit changes.

  • Changes (made by others) to the underyling item are not reflected back in this CMenuItem object. ==> CMenuItem users are expected to open notifiers on the menu and watch for changes. If change is reported for the folder which contains any open CMenuItems, users should discard the objects and OpenL() them anew. mcsmenu.lib
    Since
    S60 v5.0

Inherits from

Constructor & Destructor Documentation

CMenuItem()

CMenuItem ( ) [private]

Constructor.

~CMenuItem()

IMPORT_C ~CMenuItem ( ) [virtual]
Destructor.
Since
S60 v5.0
capability
None.
Exceptions
None.

panic
None.

Member Functions Documentation

AddL(TRequestStatus &)

CMenuOperation * AddL ( TRequestStatus & aStatus ) [private]

Add new item.

Parameters

TRequestStatus & aStatus Observer request status. When the operation completes, this status will be completed with the resulting error code.

Changed()

TBool Changed ( ) const [private]

Check if there are unsaved changes.

ClearChanged()

void ClearChanged ( ) [private]

Mark the item as unchanged.

CreateL(RMenu &, const TDesC &, TInt, TInt)

IMPORT_C CMenuItem * CreateL ( RMenu & aMenu,
const TDesC & aType,
TInt aFolder,
TInt aInsertBefore
) [static]
Create new menu item. The item is not created until are committed with a call to SaveL() .
Since
S60 v5.0.
capability
None.
Exceptions
KErrArgument

if aType is KMenuTypeData. System-wide error codes if an error occurs.

panic
None.

Parameters

RMenu & aMenu Menu session.
const TDesC & aType Type. Maximum length is KMenuMaxTypeLen.
TInt aFolder Parent folder.
TInt aInsertBefore

Flags()

IMPORT_C TUint32 Flags ( ) const
Get flags.
Since
S60 v5.0
capability
None.
Exceptions
None.

panic
None.

GetAttributeL(const TDesC &, TBool &)

IMPORT_C TPtrC GetAttributeL ( const TDesC & aAttrName,
TBool & aAttrExists
)
Get attribute value.
Since
S60 v5.0
capability
ECapabilityReadDeviceData.
Exceptions
KErrArgument

in case of invalid attribute name. System-wide error codes if an error occurs.

panic
None.

Parameters

const TDesC & aAttrName Attribute name.
TBool & aAttrExists Will be set to indicate whether attribute exists or not.

GetAttributeListL(RArray< TAttributeName > &)

IMPORT_C void GetAttributeListL ( RArray < TAttributeName > & aList )
Get attribute name list.
Since
S60 v5.0
capability
ECapabilityReadDeviceData.
Exceptions
System-wide

error codes if an error occurs.

panic
None.

Parameters

RArray < TAttributeName > & aList Attribute name list.

HandleCommandL(const TDesC8 &, const TDesC8 &, TRequestStatus &)

IMPORT_C CMenuOperation * HandleCommandL ( const TDesC8 & aCommand,
const TDesC8 & aParams,
TRequestStatus & aStatus
)
Handle command.
Since
S60 v5.0
capability
None.
Exceptions
KErrNotSupported

if no handler was found for the given type of item. System-wide error codes if an error occurs.

panic
None.

Parameters

const TDesC8 & aCommand Command.
const TDesC8 & aParams
TRequestStatus & aStatus Observer request status. When the operation completes, this status will be completed with the resulting error code.

Id()

IMPORT_C TInt Id ( ) const
Get item ID.
Since
S60 v5.0
capability
None.
Exceptions
None.

panic
None.

NewLC(RMenu &)

CMenuItem * NewLC ( RMenu & aMenu ) [private, static]

Factory method.

Parameters

RMenu & aMenu Menu.

OpenL(RMenu &, TInt)

IMPORT_C CMenuItem * OpenL ( RMenu & aMenu,
TInt aId
) [static]
Open existing menu item.
Since
S60 v5.0
capability
ECapabilityReadDeviceData.
Exceptions
System-wide

error codes if an error occurs.

panic
None.

Parameters

RMenu & aMenu Menu session.
TInt aId Item ID.

OpenL(RMenu &, const TMenuItem &)

IMPORT_C CMenuItem * OpenL ( RMenu & aMenu,
const TMenuItem & aHdr
) [static]
Open existing menu item.
Since
S60 v5.0
capability
None.
Exceptions
System-wide

error codes if an error occurs.

panic
None.

Parameters

RMenu & aMenu Menu session.
const TMenuItem & aHdr Item header. Validity is not checked - it is assumed that it was retrieved by a call to RMenu::GetItemsL(). (It is no use in modifying an existing header, because the changes are not reflected back in the server side data).

Parent()

IMPORT_C TInt Parent ( ) const
Get parent folder ID.
Since
S60 v5.0
capability
None.
Exceptions
None.

panic
None.

RemoveAttributeL(const TDesC &)

IMPORT_C void RemoveAttributeL ( const TDesC & aAttrName )
Remove attribute.
Since
S60 v5.0
capability
ECapabilityWriteDeviceData.
Exceptions
KErrArgument

in case of invalid attribute name. System-wide error codes if an error occurs.

panic
None.

Parameters

const TDesC & aAttrName Attribute name.

RunningStatusL()

IMPORT_C TBool RunningStatusL ( )
Get running status folders and applications.
capability
None.
Exceptions
System-wide

error codes if an error occurs.

panic
None.

SaveL(TRequestStatus &)

IMPORT_C CMenuOperation * SaveL ( TRequestStatus & aStatus )
Save item (commit changes). If the item is a new item (created with CreateL() ), its ID is generated now. However, the item with that ID does not exist until the operation successfully completes!
Since
S60 v5.0
capability
ECapabilityWriteDeviceData.
Exceptions
System-wide

error codes if an error occurs.

panic
None.

Parameters

TRequestStatus & aStatus Observer request status. When the operation completes, this status will be completed with the resulting error code.

SetAttributeL(const TDesC &, const TDesC &)

IMPORT_C void SetAttributeL ( const TDesC & aAttrName,
const TDesC & aAttrValue
)
Set attribute value.
Since
S60 v5.0
capability
ECapabilityWriteDeviceData.
Exceptions
KErrArgument

in case of invalid attribute name or value. System-wide error codes if an error occurs.

panic
None.

Parameters

const TDesC & aAttrName Attribute name.
const TDesC & aAttrValue Attribute value.

SetFlags(TUint32, TBool)

IMPORT_C void SetFlags ( TUint32 aMask,
TBool aOn
)
Set or clear flags.
Since
S60 v5.0
capability
None.
Exceptions
None.

panic
None.

Parameters

TUint32 aMask Flags to set or clear.
TBool aOn ETrue to set, EFalse to clear flags.

Type()

IMPORT_C TPtrC Type ( ) const
Get type.
Since
S60 v5.0
capability
None.
Exceptions
None.

panic
None.

UpdateL(TRequestStatus &)

CMenuOperation * UpdateL ( TRequestStatus & aStatus ) [private]

Update item.

Parameters

TRequestStatus & aStatus Observer request status. When the operation completes, this status will be completed with the resulting error code.

Member Data Documentation

TData * iData

TData * iData [private]