1.1 --- a/epoc32/include/offop.h Wed Mar 31 12:27:01 2010 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,272 +0,0 @@
1.4 -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 -// All rights reserved.
1.6 -// This component and the accompanying materials are made available
1.7 -// 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
1.8 -// which accompanies this distribution, and is available
1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 -//
1.11 -// Initial Contributors:
1.12 -// Nokia Corporation - initial contribution.
1.13 -//
1.14 -// Contributors:
1.15 -//
1.16 -// Description:
1.17 -//
1.18 -
1.19 -#if !defined(__OFFOP_H__)
1.20 -#define __OFFOP_H__
1.21 -
1.22 -#if !defined (__MSVIDS_H__)
1.23 -#include <msvids.h>
1.24 -#endif
1.25 -
1.26 -#if !defined (__MSVUIDS_H__)
1.27 -#include <msvuids.h>
1.28 -#endif
1.29 -
1.30 -#if !defined(__MSVSTORE_H__)
1.31 -#include <msvstore.h>
1.32 -#endif
1.33 -
1.34 -#include <miut_err.h>
1.35 -
1.36 -const TInt KCurrentOfflineOperationArrayVersion = 2;
1.37 -_LIT(KImcmPanic, "IMCM");
1.38 -
1.39 -class CMsvEntry;
1.40 -
1.41 -///////////////////////////////////////////////////////////////////////////////
1.42 -// CImOffLineOperation container for cached off line operation, to be performed
1.43 -// on next connection to remote server.
1.44 -class CImOffLineOperation : public CBase
1.45 -/**
1.46 -@internalTechnology
1.47 -@released
1.48 -*/
1.49 - {
1.50 - public:
1.51 - enum TOffLineOpType
1.52 - {
1.53 - EOffLineOpNone = 0x0000,
1.54 -//
1.55 - EOffLineOpCopyToLocal = 0x0001,
1.56 - EOffLineOpCopyFromLocal,
1.57 - EOffLineOpCopyWithinService,
1.58 -//
1.59 - EOffLineOpMoveToLocal = 0x0010,
1.60 - EOffLineOpMoveFromLocal,
1.61 - EOffLineOpMoveWithinService,
1.62 -//
1.63 - EOffLineOpDelete = 0x0020,
1.64 -//
1.65 - EOffLineOpChange = 0x0030,
1.66 - EOffLineOpCreate,
1.67 -//
1.68 - EOffLineOpMtmSpecific = 0x0100,
1.69 - };
1.70 -
1.71 - public: // Constructor of a null operation
1.72 - IMPORT_C CImOffLineOperation();
1.73 - IMPORT_C ~CImOffLineOperation();
1.74 - public: // Set this operation to a specific type.
1.75 - inline void SetCopyToLocal(TMsvId aMessageId, TMsvId aTargetFolderId);
1.76 - inline void SetCopyFromLocal(TMsvId aMessageId, TMsvId aTargetFolderId);
1.77 - inline void SetCopyWithinService(TMsvId aMessageId, TMsvId aTargetFolderId);
1.78 -//
1.79 - inline void SetMoveToLocal(TMsvId aMessageId, TMsvId aTargetFolderId);
1.80 - inline void SetMoveFromLocal(TMsvId aMessageId, TMsvId aTargetFolderId);
1.81 - inline void SetMoveWithinService(TMsvId aMessageId, TMsvId aTargetFolderId);
1.82 -
1.83 - inline void SetDelete(TMsvId aMessageId);
1.84 - inline void SetChange(TMsvId aMessageId);
1.85 - inline void SetCreate(TMsvId aMessageId);
1.86 - IMPORT_C void SetMtmSpecificCommandL(TMsvId aMessageId, TMsvId aTargetFolderId, TInt aMtmFunctionId, const TDesC8& aParameters);
1.87 - public: // Access to parameters of operation
1.88 - inline TOffLineOpType OpType()const ;
1.89 - inline TMsvId MessageId()const ;
1.90 - inline TMsvId TargetMessageId()const ;
1.91 - inline TInt MtmFunctionId() const ;
1.92 - inline TPtrC8 MtmParameters() const ;
1.93 -
1.94 - public:
1.95 - IMPORT_C void DetachMtmParameters() ;
1.96 - // Need this detach because the copy constructor will not be called when appending this class to an array!
1.97 - IMPORT_C void DeleteBuffer();
1.98 - // Need this because destructor will not be called when item is removed from an array
1.99 - public:
1.100 - IMPORT_C TBool Equals(const CImOffLineOperation& aOperation) const;
1.101 - IMPORT_C void CopyL(const CImOffLineOperation& aOperation);
1.102 - // Copy-constructor that can leave
1.103 - public:
1.104 - IMPORT_C void ExternalizeL( RMsvWriteStream& aWriteStream ) const;
1.105 - IMPORT_C void InternalizeL( RMsvReadStream& aReadStream );
1.106 - public:
1.107 - IMPORT_C int operator ==(const CImOffLineOperation& otherOperation) const;
1.108 - private:
1.109 - IMPORT_C void SetOperation(TOffLineOpType aOpType, TMsvId aMessageId, TMsvId aTargetFolderId, TInt aMtmFunctionId, HBufC8* aParameters);
1.110 - IMPORT_C void SetOperation(TOffLineOpType aOpType, TMsvId aMessageId, TMsvId aTargetFolderId);
1.111 - private:
1.112 - TOffLineOpType iOpType;
1.113 - TMsvId iMessageId;
1.114 - TMsvId iTargetMessageId;
1.115 - TInt iMtmFunctionId;
1.116 - HBufC8* iMtmParameters; // Mtm-specifics
1.117 - };
1.118 -
1.119 -///////////////////////////////////////////////////////////////////////////////
1.120 -// MOffLineOperationArray : generic mixin for accessing arrays of Off line operations.
1.121 -class MImOffLineOperationArray
1.122 -/**
1.123 -@internalTechnology
1.124 -@released
1.125 -*/
1.126 - {
1.127 - public:
1.128 - virtual TInt CountOperations() const = 0;
1.129 - virtual const CImOffLineOperation& Operation(TInt aIndex) const = 0;
1.130 - virtual void AppendOperationL(const CImOffLineOperation& aOperation) = 0;
1.131 - virtual void Delete(TInt aIndex) = 0;
1.132 - };
1.133 -
1.134 -///////////////////////////////////////////////////////////////////////////////
1.135 -// CImOffLineArrayStore : storing and restoring MImOffLineOperationArray
1.136 -// derived classes
1.137 -class CImOffLineArrayStore : public CBase
1.138 -/**
1.139 -@internalTechnology
1.140 -@released
1.141 -*/
1.142 - {
1.143 - public:
1.144 - inline CImOffLineArrayStore(MImOffLineOperationArray& aArray);
1.145 - inline void SetVersion(TUint16 aVersion);
1.146 - inline TUint16 Version();
1.147 - IMPORT_C void StoreL(CMsvStore& aMsvStore) const;
1.148 - IMPORT_C void RestoreL(const CMsvStore& aMessageStore );
1.149 - IMPORT_C void ExternalizeL(RMsvWriteStream& aWriteStream) const;
1.150 - IMPORT_C void InternalizeL(RMsvReadStream& aReadStream);
1.151 - private:
1.152 - TUint16 iVersion;
1.153 - MImOffLineOperationArray* iArray;
1.154 - };
1.155 -
1.156 -///////////////////////////////////////////////////////////////////////////////
1.157 -// CImOffLineOperationArray : implementation of MImOffLineOperationArray
1.158 -class CImOffLineOperationArray : public CBase, public MImOffLineOperationArray
1.159 -/**
1.160 -@internalTechnology
1.161 -@released
1.162 -*/
1.163 - {
1.164 - public:
1.165 - IMPORT_C static CImOffLineOperationArray* NewL();
1.166 - IMPORT_C virtual ~CImOffLineOperationArray();
1.167 - public: // derived from MImOffLineOperationArray
1.168 - TInt CountOperations() const;
1.169 - const CImOffLineOperation& Operation(TInt aIndex) const;
1.170 - void AppendOperationL(const CImOffLineOperation& aOperation);
1.171 - void Delete(TInt aIndex);
1.172 - public: // Not derived from MImOffLineOperationArray
1.173 - IMPORT_C void InsertOperationL(CImOffLineOperation& aOperation, TInt aPosition);
1.174 - protected:
1.175 - CImOffLineOperationArray();
1.176 - IMPORT_C void ConstructL();
1.177 - protected:
1.178 - CArrayFixFlat<CImOffLineOperation> *iArray;
1.179 - };
1.180 -
1.181 -
1.182 -class TQueuedOperation
1.183 -/**
1.184 -@internalComponent
1.185 -@released
1.186 -*/
1.187 - {
1.188 - public:
1.189 - IMPORT_C static TQueuedOperation* NewL(TMsvId aFolderId,TInt aOperationIndex, const CImOffLineOperation& aStoredOperation);
1.190 - IMPORT_C TQueuedOperation();
1.191 - IMPORT_C TBool operator!=(const TQueuedOperation& aOp);
1.192 - inline TMsvId FolderId() const;
1.193 - inline TInt OperationIndex() const;
1.194 - inline CImOffLineOperation& Operation() ;
1.195 - IMPORT_C void CopyL(const TQueuedOperation& aOperation);
1.196 - private:
1.197 - TQueuedOperation(TMsvId aFolderId,TInt aOperationIndex);
1.198 - private:
1.199 - TMsvId iFolderId;
1.200 - TInt iOperationIndex;
1.201 - CImOffLineOperation iStoredOperation;
1.202 - };
1.203 -
1.204 -class CImQueuedList : public CBase, public MImOffLineOperationArray
1.205 -/**
1.206 -@internalComponent
1.207 -@released
1.208 -*/
1.209 - {
1.210 - public:
1.211 - IMPORT_C static CImQueuedList* NewL();
1.212 - IMPORT_C virtual ~CImQueuedList() ;
1.213 - IMPORT_C void SetFolder(TMsvId aFolderId);
1.214 - IMPORT_C void ResetLineCounter();
1.215 - IMPORT_C TQueuedOperation& operator[](TInt anIndex);
1.216 - IMPORT_C void Delete(TInt aIndex);
1.217 - IMPORT_C void Reset();
1.218 - IMPORT_C void AppendL(TQueuedOperation& aOperation);
1.219 - public: // From MOffLineOperationArrayStore
1.220 - IMPORT_C virtual TInt CountOperations() const;
1.221 - IMPORT_C virtual const CImOffLineOperation& Operation(TInt aIndex) const;
1.222 - IMPORT_C virtual void AppendOperationL(const CImOffLineOperation& aOperation);
1.223 - private:
1.224 - CImQueuedList() ;
1.225 - private:
1.226 - TMsvId iFolderId;
1.227 - TInt iLine;
1.228 - CArrayFixFlat<TQueuedOperation> *iArray;
1.229 - };
1.230 -
1.231 -class MImUndoOffLineOperation
1.232 -/**
1.233 -@internalTechnology
1.234 -@released
1.235 -*/
1.236 - {
1.237 - public:
1.238 - virtual void UndoOffLineChangesL(const CImOffLineOperation& aDeleted, TMsvId aFolderId) = 0;
1.239 - };
1.240 -
1.241 -class CImOperationQueueList : public CBase
1.242 -/**
1.243 -@internalComponent
1.244 -@released
1.245 -*/
1.246 - {
1.247 - public:
1.248 - IMPORT_C static CImOperationQueueList* NewL(CMsvEntry& aServiceEntry, MImUndoOffLineOperation *aImUndoOffLineOperation);
1.249 - // Create new list of queued operations for service entry aServiceEntry is set to.
1.250 - IMPORT_C ~CImOperationQueueList();
1.251 - inline const TInt Count() const;
1.252 - // Current number of queued operations in list
1.253 - inline TQueuedOperation& operator[](TInt anIndex);
1.254 - // Access to array of queued operations.
1.255 - IMPORT_C void DeleteL(TInt aLine);
1.256 - // Remove operation from list of queued operations locally.
1.257 - IMPORT_C void ExpungeDeletedOperationsL();
1.258 - // Enforce removal of queued operations from the stores of the folders.
1.259 - protected:
1.260 - void ConstructL();
1.261 - CImOperationQueueList(CMsvEntry& aServiceEntry,MImUndoOffLineOperation *aImUndoOffLineOperation);
1.262 - void RestoreQueuedListL(CImQueuedList &/*aList*/);
1.263 - void StoreQueuedListL(CImQueuedList &/*aList*/);
1.264 - void ProcessFoldersL();
1.265 - private:
1.266 - CImQueuedList *iQueuedList;
1.267 - CImQueuedList *iDeletedList;
1.268 - CMsvEntry* iServiceEntry;
1.269 - TMsvId iServiceId;
1.270 - MImUndoOffLineOperation *iUndoOffline;
1.271 - };
1.272 -
1.273 -#include <offop.inl>
1.274 -
1.275 -#endif