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 & aStatusObserver 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()

voidClearChanged()[private]

Mark the item as unchanged.

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

IMPORT_C CMenuItem *CreateL(RMenu &aMenu,
const TDesC &aType,
TIntaFolder,
TIntaInsertBefore
)[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 & aMenuMenu session.
const TDesC & aTypeType. Maximum length is KMenuMaxTypeLen.
TInt aFolderParent folder.
TInt aInsertBefore

Flags()

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

panic
None.

GetAttributeL(const TDesC &, TBool &)

IMPORT_C TPtrCGetAttributeL(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 & aAttrNameAttribute name.
TBool & aAttrExistsWill be set to indicate whether attribute exists or not.

GetAttributeListL(RArray< TAttributeName > &)

IMPORT_C voidGetAttributeListL(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 > & aListAttribute 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 & aCommandCommand.
const TDesC8 & aParams
TRequestStatus & aStatusObserver request status. When the operation completes, this status will be completed with the resulting error code.

Id()

IMPORT_C TIntId()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 & aMenuMenu.

OpenL(RMenu &, TInt)

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

error codes if an error occurs.

panic
None.

Parameters

RMenu & aMenuMenu session.
TInt aIdItem 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 & aMenuMenu session.
const TMenuItem & aHdrItem 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 TIntParent()const
Get parent folder ID.
Since
S60 v5.0
capability
None.
Exceptions
None.

panic
None.

RemoveAttributeL(const TDesC &)

IMPORT_C voidRemoveAttributeL(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 & aAttrNameAttribute name.

RunningStatusL()

IMPORT_C TBoolRunningStatusL()
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 & aStatusObserver request status. When the operation completes, this status will be completed with the resulting error code.

SetAttributeL(const TDesC &, const TDesC &)

IMPORT_C voidSetAttributeL(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 & aAttrNameAttribute name.
const TDesC & aAttrValueAttribute value.

SetFlags(TUint32, TBool)

IMPORT_C voidSetFlags(TUint32aMask,
TBoolaOn
)
Set or clear flags.
Since
S60 v5.0
capability
None.
Exceptions
None.

panic
None.

Parameters

TUint32 aMaskFlags to set or clear.
TBool aOnETrue to set, EFalse to clear flags.

Type()

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

panic
None.

UpdateL(TRequestStatus &)

CMenuOperation *UpdateL(TRequestStatus &aStatus)[private]

Update item.

Parameters

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

Member Data Documentation

TData * iData

TData *iData[private]