williamr@2: // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #ifndef __MSVENTRY_H__ williamr@2: #define __MSVENTRY_H__ williamr@2: williamr@2: williamr@2: williamr@2: #if !defined(__E32BASE_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: #if !defined(__MSVSTORE_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: ////////////////////////////////////// williamr@2: // Forward declarations williamr@2: class CMsvStore; williamr@2: class CMsvCopyMoveEntriesBase; williamr@2: class CMsvServer; williamr@2: williamr@2: //********************************** williamr@2: // CMsvServerEntry williamr@2: //********************************** williamr@2: // williamr@2: // williamr@2: // williamr@2: williamr@2: class CMsvServerEntry : public CActive, public MMsvStoreObserver williamr@2: /** Accesses and acts upon a particular Message Server entry. williamr@2: williamr@2: It provides similar williamr@2: functionality to that which CMsvEntry gives to client-side programs. The current williamr@2: entry that a CMsvServerEntry object relates is similarly referred to as its williamr@2: context. williamr@2: williamr@2: A difference to note is that CMsvEntry functions, when used on a remote context, williamr@2: can result in requests to Server-side MTMs to change data on a remote server, williamr@2: as well as the local Message Server index. Naturally, as CMsvServerEntry is williamr@2: designed to be used by Server-side MTMs themselves, its comparable functions williamr@2: only alter the Message Server index. williamr@2: williamr@2: A CBaseServerMTM-derived object gets an initial CMsvServerEntry on construction. williamr@2: It can get further CMsvServerEntry objects by calling NewEntryL(). The context williamr@2: can be changed by SetEntry(). williamr@2: williamr@2: The context is locked, preventing it being accessed by other MTMs. The lock williamr@2: is released when the object is deleted, or the context changes. williamr@2: williamr@2: As with CMsvEntry, CBaseServerMTM functions can be divided into two broad williamr@2: groups. The first provides means to access the various types of storage associated williamr@2: with an entry. The second provides a means to discover and access other entries williamr@2: that the entry owns (its children). williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CMsvServerEntry* NewL(CMsvServer& aServer, TMsvId aId); williamr@2: ~CMsvServerEntry(); williamr@2: // williamr@2: // Set and get the current context williamr@2: IMPORT_C TInt SetEntry(TMsvId aId); williamr@2: inline const TMsvEntry& Entry() const; williamr@2: IMPORT_C TMsvId OwningService() const; williamr@2: // williamr@2: // current entry only functions williamr@2: IMPORT_C TInt ChangeEntry(const TMsvEntry& aEntry, TSecureId aOwnerId); williamr@2: IMPORT_C TInt ChangeEntry(const TMsvEntry& aEntry); williamr@2: williamr@2: williamr@2: // williamr@2: // child entry only functions williamr@2: IMPORT_C TInt CreateEntry(TMsvEntry& aEntry); williamr@2: IMPORT_C TInt CreateEntry(TMsvEntry& aEntry, TSecureId aOwnerId); williamr@2: IMPORT_C TInt CreateEntry(TMsvEntry& aEntry, TSecureId aOwnerId, TBool aBulk); williamr@2: IMPORT_C TInt DeleteEntry(TMsvId aId); williamr@2: IMPORT_C TInt DeleteEntries(CMsvEntrySelection& aSelection); williamr@2: IMPORT_C TInt MoveEntryWithinService(TMsvId aId, TMsvId aDestination); williamr@2: IMPORT_C TInt MoveEntriesWithinService(CMsvEntrySelection& aSelection, TMsvId aDestination); williamr@2: IMPORT_C TInt ChangeAttributes(const CMsvEntrySelection& aSelection, TUint aSetAttributes, TUint aClearAttributes); williamr@2: IMPORT_C void MoveEntryL(TMsvId aId, TMsvId aDestination, TRequestStatus& aObserverStatus); williamr@2: IMPORT_C void MoveEntriesL(const CMsvEntrySelection& aSelection, TMsvId aDestination, TRequestStatus& aObserverStatus); williamr@2: IMPORT_C void CopyEntryL(TMsvId aId, TMsvId aDestination, TRequestStatus& aObserverStatus); williamr@2: IMPORT_C void CopyEntryL(TMsvId aId, TMsvId aDestination, TMsvId& aCompletedEntry, TRequestStatus& aObserverStatus); williamr@2: IMPORT_C void CopyEntriesL(const CMsvEntrySelection& aSelection, TMsvId aDestination, TRequestStatus& aObserverStatus); williamr@2: IMPORT_C void CopyEntriesL(const CMsvEntrySelection& aSelection, TMsvId aDestination, CMsvEntrySelection& aCompletedSelection, TRequestStatus& aObserverStatus); williamr@2: IMPORT_C TInt GetEntryFromId(TMsvId aId,TMsvEntry*& aEntry); williamr@2: // williamr@2: // read and write the store associated with the context williamr@2: IMPORT_C CMsvStore* ReadStoreL(); williamr@2: IMPORT_C CMsvStore* EditStoreL(); williamr@2: // williamr@2: // List the children of the context williamr@2: inline const TMsvSelectionOrdering& Sort(); williamr@2: inline void SetSort(TMsvSelectionOrdering& aOrdering); williamr@2: inline void SetMtm(TUid aMtm); williamr@2: IMPORT_C TInt GetChildren(CMsvEntrySelection& aSelection); williamr@2: // williamr@2: IMPORT_C TInt GetChildrenWithService(TMsvId aServiceId, CMsvEntrySelection& aSelection); williamr@2: IMPORT_C TInt GetChildrenWithMtm(TUid aMtm, CMsvEntrySelection& aSelection); williamr@2: IMPORT_C TInt GetChildrenWithType(TUid aType, CMsvEntrySelection& aSelection); williamr@2: // williamr@2: // Spawns a new CMsvServerEntry object williamr@2: IMPORT_C CMsvServerEntry* NewEntryL(TMsvId aId); williamr@2: // williamr@2: // from MMsvStoreObserver williamr@2: void HandleStoreEvent(MMsvStoreObserver::TMsvStoreEvent aEvent, TMsvId aId); williamr@2: // williamr@2: // williamr@2: williamr@2: IMPORT_C TBool HasStoreL() const; williamr@2: // williamr@2: IMPORT_C RFs& FileSession(); williamr@2: // williamr@2: // Methods for creating and changing entries in bulk williamr@2: // (e.g. during email header downloading) williamr@2: IMPORT_C TInt CreateEntryBulk(TMsvEntry& aEntry, TSecureId aOwnerId); williamr@2: williamr@2: IMPORT_C TInt CreateEntryBulk(TMsvEntry& aEntry); williamr@2: williamr@2: IMPORT_C TInt ChangeEntryBulk(const TMsvEntry& aEntry, TSecureId aOwnerId); williamr@2: IMPORT_C TInt ChangeEntryBulk(const TMsvEntry& aEntry); williamr@2: williamr@2: IMPORT_C void CompleteBulk(); williamr@2: williamr@2: protected: williamr@2: CMsvServerEntry(CMsvServer& aIndex); williamr@2: void ConstructL(TMsvId aId); williamr@2: // williamr@2: void RunL(); williamr@2: void DoCancel(); williamr@2: // williamr@2: private: williamr@2: TInt IncreaseBufferSizes(TInt aNewDescriptionSize, TInt aNewDetailsSize); williamr@2: TBool AreChildren(const CMsvEntrySelection& aSelection) const; williamr@2: TBool IsAChild(TMsvId aId) const; williamr@2: void DoMoveEntryL(TMsvId aId, TMsvId aDestination); williamr@2: void DoDeleteEntryL(TMsvId aId, CMsvEntrySelection*& aDeleted, CMsvEntrySelection*& aMoved); williamr@2: void DoDeleteEntriesL(CMsvEntrySelection& aSelection, CMsvEntrySelection*& aDeleted, CMsvEntrySelection*& aMoved); williamr@2: void DoMoveEntriesL(CMsvEntrySelection& aSelection, TMsvId aDestination, CMsvEntrySelection*& aMoved); williamr@2: TInt DoGetChildren(TMsvId aServiceId, TUid aMtm, TUid aType, CMsvEntrySelection& aSelection); williamr@2: void DoGetChildrenL(TMsvId aServiceId, TUid aMtm, TUid aType, CMsvEntrySelection& aSelection); williamr@2: void DoCopyEntriesL(const CMsvEntrySelection& aSelection, TMsvId aDestination, TRequestStatus& aObserverStatus); williamr@2: TInt DoChangeEntry(const TMsvEntry& aEntry, TSecureId aOwnerId, TBool aForcedUpdate, TBool aBulk); williamr@2: williamr@2: // williamr@2: private: williamr@2: TBool iLockedStore; williamr@2: TMsvSelectionOrdering iOrdering; williamr@2: TMsvEntry iEntry; williamr@2: HBufC* iDescription; williamr@2: HBufC* iDetails; williamr@2: CMsvServer& iServer; williamr@2: CMsvStore* iStore; williamr@2: TUid iMtm; williamr@2: CMsvCopyMoveEntriesBase* iCopyMove; williamr@2: TMsvId iSource; williamr@2: enum { EMsvIdle, EMsvMoving, EMsvCopying } iEntryState; williamr@2: TRequestStatus* iObserverStatus; williamr@2: CMsvEntrySelection* iCompletedSelection; williamr@2: TMsvId* iCompletedEntryId; williamr@2: TSecureId iContextOwnerId; williamr@2: }; williamr@2: williamr@2: williamr@2: #include williamr@2: williamr@2: #endif // __MSVENTRY_H__