|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __CFAKESTOREMANAGER_H__ |
|
17 #define __CFAKESTOREMANAGER_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <mmsvstoremanager.h> |
|
21 |
|
22 class RFs; |
|
23 |
|
24 const TInt KMaxStoreFilenameLength = 10+4+4; // maximum length for TInt32 represented as a descriptor + "c:\\" + ".new" for temp store files |
|
25 |
|
26 class CFakeStoreManager : public CBase, |
|
27 public MMsvStoreManager |
|
28 { |
|
29 public: |
|
30 static CFakeStoreManager* NewL(RFs& aFs); |
|
31 ~CFakeStoreManager(); |
|
32 |
|
33 const TDesC& StoreFilename(TMsvId aEntryId) const; |
|
34 |
|
35 // from MMsvStoreManager |
|
36 virtual TBool CreateAttachmentForWriteL(TMsvId aEntryId, TDes& aFilename, RFile& aFile); |
|
37 virtual void OpenAttachmentL(TMsvId aEntryId, const TDesC& aFilename, RFile& aFile); |
|
38 virtual void OpenAttachmentForWriteL(TMsvId aEntryId, const TDesC& aFileName, RFile& aFile); |
|
39 virtual TInt DeleteAttachment(TMsvId aEntryId, const TDesC& aFilename); |
|
40 virtual TInt OpenFileStoreForRead(TMsvId aEntryId, RFile& aFile); |
|
41 virtual void OpenTempStoreFileL(TMsvId aEntryId, RFile& aFile); |
|
42 virtual void ReplaceFileStoreL(TMsvId aEntryId); |
|
43 virtual void DeleteFileStoreL(TMsvId aEntryId); |
|
44 virtual TBool FileStoreExistsL(TMsvId aEntryId) const; |
|
45 virtual TBool FileExistsL(const TDesC& aFilePath); |
|
46 virtual TInt RenameAttachment(TMsvId aEntryId, const TDesC& aOldFilePath, const TDesC& aNewName); |
|
47 virtual void ReplaceAttachmentForWriteL(TMsvId aEntryId, TDes& aFilename, RFile& aFile); |
|
48 virtual void AttachmentFilePathL(TMsvId aEntryId, TDes& aFilePath); |
|
49 TBool CreateShareProtectedAttachmentForWriteL(TMsvId aEntryId, TDes& aFilename, RFile& aFile); |
|
50 |
|
51 void BodyTextFilePathL(TMsvId aBodyTextId, TDes& aFilepath); |
|
52 void OpenBodyTextFileForReadL(RFile& aFile, TMsvId aBodyTextId, const TDesC& aFilePath); |
|
53 void CreatePlainTextFileL(RFile& aFile, TMsvId aBodyTextId); |
|
54 void DeletePlainTextFileL(TMsvId aBodyTextId); |
|
55 void ReplacePlainTextFileL(TMsvId aBodyTextId); |
|
56 |
|
57 // New APIs from PREQ2073 |
|
58 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB) |
|
59 // from MMsvStoreManager |
|
60 virtual void CreateBodyL(TMsvId aEntryId, const TUid& aUid, HBufC* aBodyContent); |
|
61 virtual void LoadBodyL(TMsvId aEntryId, TUid& aUid, HBufC*& aBodyContent); |
|
62 virtual void UpdateBodyL(TMsvId aEntryId, const TUid& aUid, HBufC* aBodyContent); |
|
63 virtual void DeleteBodyL(TMsvId aEntryId); |
|
64 virtual void CreateHeaderEntryL(const TUid& aMtmId, TMsvId aEntryId, const RPointerArray<CHeaderFields>& aFieldPairList); |
|
65 virtual void LoadHeaderEntryL(const TUid& aMtmId, TMsvId aEntryId, RPointerArray<CHeaderFields>& aFieldPairList); |
|
66 virtual void DeleteHeaderEntryL(const TUid& aMtmId, TMsvId aEntryId); |
|
67 virtual void UpdateHeaderEntryL(const TUid& aMtmId, TMsvId aEntryId, const RPointerArray<CHeaderFields>& aFieldPairList); |
|
68 virtual TBool DoesAnyStoreExists(TMsvId aId, TUid aMtmId); |
|
69 virtual TBool DoesHeaderTableExist(const TUid& aMtmId); |
|
70 |
|
71 #endif |
|
72 |
|
73 private: |
|
74 CFakeStoreManager(RFs& aFs); |
|
75 void ConstructL(); |
|
76 |
|
77 private: |
|
78 RFs& iFs; |
|
79 mutable TBuf<KMaxStoreFilenameLength> iFilename; |
|
80 }; |
|
81 |
|
82 #endif // __CFAKESTOREMANAGER_H__ |