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 ()
void CreateShareProtectedAttachmentL (const TDesC &, RFile &, CMsvAttachment *)
void HandleCommitComplete ()
CMsvAttachmentManager * NewL ( CMsvStore &, MMsvStoreManager &, const TMsvId , RFs &, TBool )
void RestoreL ()
void StoreL ()
Private Member Functions
CMsvAttachmentManager ( CMsvStore &, MMsvStoreManager &, const TMsvId , RFs &, TBool )
void AddAttachmentL (const TDesC &, CMsvAttachment *, TRequestStatus &)
void AddAttachmentL ( RFile &, CMsvAttachment *, TRequestStatus &)
void AddEntryAsAttachmentL ( TMsvId , CMsvAttachment *, TRequestStatus &)
void AddLinkedAttachmentL (const TDesC &, CMsvAttachment *, TRequestStatus &)
TInt AttachmentCount ()
void CancelRequest ()
void CompleteSelf ()
void ConstructL ()
void CreateAttachmentInStoreLC ( TDes &, RFile &, CMsvAttachment *, TBool )
void CreateAttachmentL (const TDesC &, RFile &, CMsvAttachment *, TRequestStatus &)
void CreateAttachmentL (const TDesC &, RFile &, CMsvAttachment *)
void DoAttachmentRenameL ( TInt , const TDesC &)
void DoCancel ()
void ExternaliseRenameLockL ()
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 ()
void ModifyAttachmentInfoL ( CMsvAttachment *, TRequestStatus &)
void ModifyAttachmentInfoL ( CMsvAttachment *)
void RemoveAttachmentL ( TInt , TRequestStatus &)
void RemoveAttachmentL ( TMsvAttachmentId , TRequestStatus &)
void RemoveAttachmentL ( TInt )
void RenameAttachmentL ( TInt , const TDesC &, TRequestStatus &)
void RenameAttachmentL ( TInt , const TDesC &)
TInt RunError ( TInt )
void RunL ()
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 TMsvId iEntryId
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 TMsvId aEntryId,
RFs & aFs,
TBool aReadOnly
) [private]

Parameters

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

~CMsvAttachmentManager()

~CMsvAttachmentManager ( )

Member Functions Documentation

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

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

Parameters

const TDesC & aFilePath
CMsvAttachment * aAttachmentInfo
TRequestStatus & aStatus

AddAttachmentL(RFile &, CMsvAttachment *, TRequestStatus &)

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

Parameters

RFile & aFileHandle
CMsvAttachment * aAttachmentInfo
TRequestStatus & aStatus

AddEntryAsAttachmentL(TMsvId, CMsvAttachment *, TRequestStatus &)

void AddEntryAsAttachmentL ( TMsvId aEntryId,
CMsvAttachment * aAttachmentInfo,
TRequestStatus & aStatus
) [private, virtual]

Parameters

TMsvId aEntryId
CMsvAttachment * aAttachmentInfo
TRequestStatus & aStatus

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

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

Parameters

const TDesC & aFilePath
CMsvAttachment * aAttachmentInfo
TRequestStatus & aStatus

AttachmentCount()

TInt AttachmentCount ( ) const [private, virtual]

CancelRequest()

void CancelRequest ( ) [private, virtual]

CompleteSelf()

void CompleteSelf ( ) [private]

ConstructL()

void ConstructL ( ) [private]

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

void CreateAttachmentInStoreLC ( TDes & aFileName,
RFile & aFile,
CMsvAttachment * aAttachmentInfo,
TBool aIsShareProtected
) [private]

Parameters

TDes & aFileName
RFile & aFile
CMsvAttachment * aAttachmentInfo
TBool aIsShareProtected

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

void CreateAttachmentL ( 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 *)

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

Parameters

const TDesC & aFileName
RFile & aAttachmentFile
CMsvAttachment * aAttachmentInfo

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

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

Parameters

const TDesC & aFileName
RFile & aAttachmentFile
CMsvAttachment * aAttachmentInfo

DoAttachmentRenameL(TInt, const TDesC &)

void DoAttachmentRenameL ( TInt aIndex,
const TDesC & aNewName
) [private]

Parameters

TInt aIndex
const TDesC & aNewName

DoCancel()

void DoCancel ( ) [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()

void ExternaliseRenameLockL ( ) [private]

GenerateAttachmentId()

TMsvAttachmentId GenerateAttachmentId ( ) [private]

GetAttachmentFileForWriteL(TInt)

RFile GetAttachmentFileForWriteL ( TInt aIndex ) [private, virtual]

Parameters

TInt aIndex

GetAttachmentFileForWriteL(TMsvAttachmentId)

RFile GetAttachmentFileForWriteL ( TMsvAttachmentId aId ) [private, virtual]

Parameters

TMsvAttachmentId aId

GetAttachmentFileL(TInt)

RFile GetAttachmentFileL ( TInt aIndex ) [private, virtual]

Parameters

TInt aIndex

GetAttachmentFileL(TMsvAttachmentId)

RFile GetAttachmentFileL ( TMsvAttachmentId aId ) [private, virtual]

Parameters

TMsvAttachmentId aId

GetAttachmentInfoL(TInt)

CMsvAttachment * GetAttachmentInfoL ( TInt aIndex ) [private, virtual]

Parameters

TInt aIndex

GetAttachmentInfoL(TMsvAttachmentId)

CMsvAttachment * GetAttachmentInfoL ( TMsvAttachmentId aId ) [private, virtual]

Parameters

TMsvAttachmentId aId

HandleCommitComplete()

void HandleCommitComplete ( )

IndexPositionOfAttachmentL(TMsvAttachmentId)

TInt IndexPositionOfAttachmentL ( TMsvAttachmentId aId ) const [private]

Parameters

TMsvAttachmentId aId

InternaliseRenameLockL()

TInt InternaliseRenameLockL ( ) [private]

ModifyAttachmentInfoL(CMsvAttachment *, TRequestStatus &)

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

Parameters

CMsvAttachment * aAttachmentInfo
TRequestStatus & aStatus

ModifyAttachmentInfoL(CMsvAttachment *)

void ModifyAttachmentInfoL ( CMsvAttachment * aAttachmentInfo ) [private, virtual]

Parameters

CMsvAttachment * aAttachmentInfo

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

CMsvAttachmentManager * NewL ( CMsvStore & aStore,
MMsvStoreManager & aStoreManager,
const TMsvId aEntryId,
RFs & aFs,
TBool aReadOnly
) [static]

Parameters

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

RemoveAttachmentL(TInt, TRequestStatus &)

void RemoveAttachmentL ( TInt aIndex,
TRequestStatus & aStatus
) [private, virtual]

Parameters

TInt aIndex
TRequestStatus & aStatus

RemoveAttachmentL(TMsvAttachmentId, TRequestStatus &)

void RemoveAttachmentL ( TMsvAttachmentId aId,
TRequestStatus & aStatus
) [private, virtual]

Parameters

TMsvAttachmentId aId
TRequestStatus & aStatus

RemoveAttachmentL(TInt)

void RemoveAttachmentL ( TInt aIndex ) [private, virtual]

Parameters

TInt aIndex

RenameAttachmentL(TInt, const TDesC &, TRequestStatus &)

void RenameAttachmentL ( TInt aIndex,
const TDesC & aNewName,
TRequestStatus & aStatus
) [private, virtual]

Parameters

TInt aIndex
const TDesC & aNewName
TRequestStatus & aStatus

RenameAttachmentL(TInt, const TDesC &)

void RenameAttachmentL ( TInt aIndex,
const TDesC & aNewName
) [private, virtual]

Parameters

TInt aIndex
const TDesC & aNewName

RestoreL()

void RestoreL ( )

RunError(TInt)

TInt RunError ( TInt aError ) [private, virtual]

Parameters

TInt aError

RunL()

void RunL ( ) [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()

void StoreL ( )

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 TMsvId iEntryId [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.