CMsvAttachmentManager Class Reference

class CMsvAttachmentManager : public CActive

Provides the implementation of the Attachment API.

The attachment API interface class manages all the attachment management and uses MMsvStoreManager to provide access to the message store to manage the physical attachment files and manipulate the attachment stream in the message store.

MMsvAttachmentManager

Inherits from

Public Member Functions
~CMsvAttachmentManager()
voidCreateShareProtectedAttachmentL(const TDesC &, RFile &, CMsvAttachment *)
voidHandleCommitComplete()
CMsvAttachmentManager *NewL(CMsvStore &, MMsvStoreManager &, const TMsvId, RFs &, TBool)
voidRestoreL()
voidStoreL()
Private Member Functions
CMsvAttachmentManager(CMsvStore &, MMsvStoreManager &, const TMsvId, RFs &, TBool)
voidAddAttachmentL(const TDesC &, CMsvAttachment *, TRequestStatus &)
voidAddAttachmentL(RFile &, CMsvAttachment *, TRequestStatus &)
voidAddEntryAsAttachmentL(TMsvId, CMsvAttachment *, TRequestStatus &)
voidAddLinkedAttachmentL(const TDesC &, CMsvAttachment *, TRequestStatus &)
TInt AttachmentCount()
voidCancelRequest()
voidCompleteSelf()
voidConstructL()
voidCreateAttachmentInStoreLC(TDes &, RFile &, CMsvAttachment *, TBool)
voidCreateAttachmentL(const TDesC &, RFile &, CMsvAttachment *, TRequestStatus &)
voidCreateAttachmentL(const TDesC &, RFile &, CMsvAttachment *)
voidDoAttachmentRenameL(TInt, const TDesC &)
voidDoCancel()
voidExternaliseRenameLockL()
TMsvAttachmentId GenerateAttachmentId()
RFile GetAttachmentFileForWriteL(TInt)
RFile GetAttachmentFileForWriteL(TMsvAttachmentId)
RFile GetAttachmentFileL(TInt)
RFile GetAttachmentFileL(TMsvAttachmentId)
CMsvAttachment *GetAttachmentInfoL(TInt)
CMsvAttachment *GetAttachmentInfoL(TMsvAttachmentId)
TInt IndexPositionOfAttachmentL(TMsvAttachmentId)
TInt InternaliseRenameLockL()
voidModifyAttachmentInfoL(CMsvAttachment *, TRequestStatus &)
voidModifyAttachmentInfoL(CMsvAttachment *)
voidRemoveAttachmentL(TInt, TRequestStatus &)
voidRemoveAttachmentL(TMsvAttachmentId, TRequestStatus &)
voidRemoveAttachmentL(TInt)
voidRenameAttachmentL(TInt, const TDesC &, TRequestStatus &)
voidRenameAttachmentL(TInt, const TDesC &)
TInt RunError(TInt)
voidRunL()
Inherited Functions
CActive::CActive(TInt)
CActive::Cancel()
CActive::Deque()
CActive::Extension_(TUint,TAny *&,TAny *)
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
CActive::SetActive()
CActive::SetPriority(TInt)
CActive::~CActive()
CBase::CBase()
CBase::Delete(CBase *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Inherited Enumerations
CActive:TPriority
Private Attributes
RPointerArray< HBufC >iAddedAttachments
RPointerArray< CMsvAttachment >iAttachments
CCopyOneFile *iCopyOneFile
RPointerArray< HBufC >iDeletedAttachments
const TMsvIdiEntryId
RFs &iFs
TUint iIdGenerator
TBool iReadOnly
RPointerArray< CMsvAttachmentRename >iRenamed
TRequestStatus *iReportStatus
CMsvStore &iStore
MMsvStoreManager &iStoreManager
Inherited Attributes
CActive::iStatus

Constructor & Destructor Documentation

CMsvAttachmentManager(CMsvStore &, MMsvStoreManager &, const TMsvId, RFs &, TBool)

CMsvAttachmentManager(CMsvStore &aStore,
MMsvStoreManager &aStoreManager,
const TMsvIdaEntryId,
RFs &aFs,
TBoolaReadOnly
)[private]

Parameters

CMsvStore & aStore
MMsvStoreManager & aStoreManager
const TMsvId aEntryId
RFs & aFs
TBool aReadOnly

~CMsvAttachmentManager()

~CMsvAttachmentManager()

Member Functions Documentation

AddAttachmentL(const TDesC &, CMsvAttachment *, TRequestStatus &)

voidAddAttachmentL(const TDesC &aFilePath,
CMsvAttachment *aAttachmentInfo,
TRequestStatus &aStatus
)[private, virtual]

Parameters

const TDesC & aFilePath
CMsvAttachment * aAttachmentInfo
TRequestStatus & aStatus

AddAttachmentL(RFile &, CMsvAttachment *, TRequestStatus &)

voidAddAttachmentL(RFile &aFileHandle,
CMsvAttachment *aAttachmentInfo,
TRequestStatus &aStatus
)[private, virtual]

Parameters

RFile & aFileHandle
CMsvAttachment * aAttachmentInfo
TRequestStatus & aStatus

AddEntryAsAttachmentL(TMsvId, CMsvAttachment *, TRequestStatus &)

voidAddEntryAsAttachmentL(TMsvIdaEntryId,
CMsvAttachment *aAttachmentInfo,
TRequestStatus &aStatus
)[private, virtual]

Parameters

TMsvId aEntryId
CMsvAttachment * aAttachmentInfo
TRequestStatus & aStatus

AddLinkedAttachmentL(const TDesC &, CMsvAttachment *, TRequestStatus &)

voidAddLinkedAttachmentL(const TDesC &aFilePath,
CMsvAttachment *aAttachmentInfo,
TRequestStatus &aStatus
)[private, virtual]

Parameters

const TDesC & aFilePath
CMsvAttachment * aAttachmentInfo
TRequestStatus & aStatus

AttachmentCount()

TInt AttachmentCount()const [private, virtual]

CancelRequest()

voidCancelRequest()[private, virtual]

CompleteSelf()

voidCompleteSelf()[private]

ConstructL()

voidConstructL()[private]

CreateAttachmentInStoreLC(TDes &, RFile &, CMsvAttachment *, TBool)

voidCreateAttachmentInStoreLC(TDes &aFileName,
RFile &aFile,
CMsvAttachment *aAttachmentInfo,
TBoolaIsShareProtected
)[private]

Parameters

TDes & aFileName
RFile & aFile
CMsvAttachment * aAttachmentInfo
TBool aIsShareProtected

CreateAttachmentL(const TDesC &, RFile &, CMsvAttachment *, TRequestStatus &)

voidCreateAttachmentL(const TDesC &aFileName,
RFile &aAttachmentFile,
CMsvAttachment *aAttachmentInfo,
TRequestStatus &aStatus
)[private, virtual]

Parameters

const TDesC & aFileName
RFile & aAttachmentFile
CMsvAttachment * aAttachmentInfo
TRequestStatus & aStatus

CreateAttachmentL(const TDesC &, RFile &, CMsvAttachment *)

voidCreateAttachmentL(const TDesC &aFileName,
RFile &aAttachmentFile,
CMsvAttachment *aAttachmentInfo
)[private, virtual]

Parameters

const TDesC & aFileName
RFile & aAttachmentFile
CMsvAttachment * aAttachmentInfo

CreateShareProtectedAttachmentL(const TDesC &, RFile &, CMsvAttachment *)

voidCreateShareProtectedAttachmentL(const TDesC &aFileName,
RFile &aAttachmentFile,
CMsvAttachment *aAttachmentInfo
)

Parameters

const TDesC & aFileName
RFile & aAttachmentFile
CMsvAttachment * aAttachmentInfo

DoAttachmentRenameL(TInt, const TDesC &)

voidDoAttachmentRenameL(TIntaIndex,
const TDesC &aNewName
)[private]

Parameters

TInt aIndex
const TDesC & aNewName

DoCancel()

voidDoCancel()[private, virtual]

Implements cancellation of an outstanding request.

This function is called as part of the active object's Cancel().

It must call the appropriate cancel function offered by the active object's asynchronous service provider. The asynchronous service provider's cancel is expected to act immediately.

DoCancel() must not wait for event completion; this is handled by Cancel().

CActive::Cancel

ExternaliseRenameLockL()

voidExternaliseRenameLockL()[private]

GenerateAttachmentId()

TMsvAttachmentId GenerateAttachmentId()[private]

GetAttachmentFileForWriteL(TInt)

RFile GetAttachmentFileForWriteL(TIntaIndex)[private, virtual]

Parameters

TInt aIndex

GetAttachmentFileForWriteL(TMsvAttachmentId)

RFile GetAttachmentFileForWriteL(TMsvAttachmentIdaId)[private, virtual]

Parameters

TMsvAttachmentId aId

GetAttachmentFileL(TInt)

RFile GetAttachmentFileL(TIntaIndex)[private, virtual]

Parameters

TInt aIndex

GetAttachmentFileL(TMsvAttachmentId)

RFile GetAttachmentFileL(TMsvAttachmentIdaId)[private, virtual]

Parameters

TMsvAttachmentId aId

GetAttachmentInfoL(TInt)

CMsvAttachment *GetAttachmentInfoL(TIntaIndex)[private, virtual]

Parameters

TInt aIndex

GetAttachmentInfoL(TMsvAttachmentId)

CMsvAttachment *GetAttachmentInfoL(TMsvAttachmentIdaId)[private, virtual]

Parameters

TMsvAttachmentId aId

HandleCommitComplete()

voidHandleCommitComplete()

IndexPositionOfAttachmentL(TMsvAttachmentId)

TInt IndexPositionOfAttachmentL(TMsvAttachmentIdaId)const [private]

Parameters

TMsvAttachmentId aId

InternaliseRenameLockL()

TInt InternaliseRenameLockL()[private]

ModifyAttachmentInfoL(CMsvAttachment *, TRequestStatus &)

voidModifyAttachmentInfoL(CMsvAttachment *aAttachmentInfo,
TRequestStatus &aStatus
)[private, virtual]

Parameters

CMsvAttachment * aAttachmentInfo
TRequestStatus & aStatus

ModifyAttachmentInfoL(CMsvAttachment *)

voidModifyAttachmentInfoL(CMsvAttachment *aAttachmentInfo)[private, virtual]

Parameters

CMsvAttachment * aAttachmentInfo

NewL(CMsvStore &, MMsvStoreManager &, const TMsvId, RFs &, TBool)

CMsvAttachmentManager *NewL(CMsvStore &aStore,
MMsvStoreManager &aStoreManager,
const TMsvIdaEntryId,
RFs &aFs,
TBoolaReadOnly
)[static]

Parameters

CMsvStore & aStore
MMsvStoreManager & aStoreManager
const TMsvId aEntryId
RFs & aFs
TBool aReadOnly

RemoveAttachmentL(TInt, TRequestStatus &)

voidRemoveAttachmentL(TIntaIndex,
TRequestStatus &aStatus
)[private, virtual]

Parameters

TInt aIndex
TRequestStatus & aStatus

RemoveAttachmentL(TMsvAttachmentId, TRequestStatus &)

voidRemoveAttachmentL(TMsvAttachmentIdaId,
TRequestStatus &aStatus
)[private, virtual]

Parameters

TMsvAttachmentId aId
TRequestStatus & aStatus

RemoveAttachmentL(TInt)

voidRemoveAttachmentL(TIntaIndex)[private, virtual]

Parameters

TInt aIndex

RenameAttachmentL(TInt, const TDesC &, TRequestStatus &)

voidRenameAttachmentL(TIntaIndex,
const TDesC &aNewName,
TRequestStatus &aStatus
)[private, virtual]

Parameters

TInt aIndex
const TDesC & aNewName
TRequestStatus & aStatus

RenameAttachmentL(TInt, const TDesC &)

voidRenameAttachmentL(TIntaIndex,
const TDesC &aNewName
)[private, virtual]

Parameters

TInt aIndex
const TDesC & aNewName

RestoreL()

voidRestoreL()

RunError(TInt)

TInt RunError(TIntaError)[private, virtual]

Parameters

TInt aError

RunL()

voidRunL()[private, virtual]

Handles an active object's request completion event.

A derived class must provide an implementation to handle the completed request. If appropriate, it may issue another request.

The function is called by the active scheduler when a request completion event occurs, i.e. after the active scheduler's WaitForAnyRequest() function completes.

Before calling this active object's RunL() function, the active scheduler has:

1. decided that this is the highest priority active object with a completed request

2. marked this active object's request as complete (i.e. the request is no longer outstanding)

RunL() runs under a trap harness in the active scheduler. If it leaves, then the active scheduler calls RunError() to handle the leave.

Note that once the active scheduler's Start() function has been called, all user code is run under one of the program's active object's RunL() or RunError() functions.

CActiveScheduler::Start CActiveScheduler::Error CActiveScheduler::WaitForAnyRequest TRAPD

StoreL()

voidStoreL()

Member Data Documentation

RPointerArray< HBufC > iAddedAttachments

RPointerArray< HBufC >iAddedAttachments[private]

An array to list the attachment files that have been copied into the store but not yet commited.

RPointerArray< CMsvAttachment > iAttachments

RPointerArray< CMsvAttachment >iAttachments[private]

Array of attachments that are associated with the entry.

CCopyOneFile * iCopyOneFile

CCopyOneFile *iCopyOneFile[private]

Utility for copying a single file.

RPointerArray< HBufC > iDeletedAttachments

RPointerArray< HBufC >iDeletedAttachments[private]

An array to list the attachments that are due for deletion.

const TMsvId iEntryId

const TMsvIdiEntryId[private]

The current message entry that the attachment manages.

RFs & iFs

RFs &iFs[private]

A connected file server session.

TUint iIdGenerator

TUint iIdGenerator[private]

A persisted value used to generate attachment Ids to assign to new attachments.

TBool iReadOnly

TBool iReadOnly[private]

Flag indicating whether the store is Read-Only.

RPointerArray< CMsvAttachmentRename > iRenamed

RPointerArray< CMsvAttachmentRename >iRenamed[private]

An array to manage the renaming of attachments.

TRequestStatus * iReportStatus

TRequestStatus *iReportStatus[private]

Caller's request status to complete.

CMsvStore & iStore

CMsvStore &iStore[private]

The message store representing the current message entry.

MMsvStoreManager & iStoreManager

MMsvStoreManager &iStoreManager[private]

The store manager providing access to the message store.