|
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 #include <f32file.h> |
|
17 |
|
18 #include "CFakeStoreManager.h" |
|
19 |
|
20 _LIT(KDriveLetter, "c:\\"); |
|
21 |
|
22 CFakeStoreManager* CFakeStoreManager::NewL(RFs& aFs) |
|
23 { |
|
24 CFakeStoreManager* self = new(ELeave) CFakeStoreManager(aFs); |
|
25 CleanupStack::PushL(self); |
|
26 self->ConstructL(); |
|
27 CleanupStack::Pop(self); |
|
28 return self; |
|
29 } |
|
30 |
|
31 CFakeStoreManager::~CFakeStoreManager() |
|
32 { |
|
33 } |
|
34 |
|
35 CFakeStoreManager::CFakeStoreManager(RFs& aFs) |
|
36 : iFs(aFs) |
|
37 { |
|
38 } |
|
39 |
|
40 void CFakeStoreManager::ConstructL() |
|
41 { |
|
42 } |
|
43 |
|
44 TBool CFakeStoreManager::CreateAttachmentForWriteL(TMsvId /*aEntryId*/, TDes& /*aFilename*/, RFile& /*aFile*/) |
|
45 { |
|
46 User::Invariant(); |
|
47 return EFalse; |
|
48 } |
|
49 |
|
50 void CFakeStoreManager::OpenAttachmentL(TMsvId /*aEntryId*/, const TDesC& /*aFilename*/, RFile& /*aFile*/) |
|
51 { |
|
52 User::Invariant(); |
|
53 } |
|
54 |
|
55 TInt CFakeStoreManager::DeleteAttachment(TMsvId /*aEntryId*/, const TDesC& /*aFilename*/) |
|
56 { |
|
57 return KErrNotSupported; |
|
58 } |
|
59 |
|
60 TBool CFakeStoreManager::FileExistsL(const TDesC& /*aFilePath*/) |
|
61 { |
|
62 return KErrNotSupported; |
|
63 } |
|
64 |
|
65 TInt CFakeStoreManager::RenameAttachment(TMsvId /*aEntryId*/, const TDesC& /*aOldFilePath*/, const TDesC& /*aNewName*/) |
|
66 { |
|
67 return KErrNotSupported; |
|
68 } |
|
69 |
|
70 void CFakeStoreManager::ReplaceAttachmentForWriteL(TMsvId /*aEntryId*/, TDes& /*aFilename*/, RFile& /*aFile*/) |
|
71 { |
|
72 User::Invariant(); |
|
73 } |
|
74 |
|
75 void CFakeStoreManager::AttachmentFilePathL(TMsvId /*aEntryId*/, TDes& /*aFilePath*/) |
|
76 { |
|
77 User::Invariant(); |
|
78 } |
|
79 |
|
80 TInt CFakeStoreManager::OpenFileStoreForRead(TMsvId aEntryId, RFile& aFile) |
|
81 { |
|
82 return aFile.Open(iFs, StoreFilename(aEntryId), EFileRead | EFileShareReadersOnly); |
|
83 } |
|
84 |
|
85 void CFakeStoreManager::OpenTempStoreFileL(TMsvId aEntryId, RFile& aFile) |
|
86 { |
|
87 TBuf<KMaxStoreFilenameLength> tempFilename; |
|
88 tempFilename.Append(StoreFilename(aEntryId)); |
|
89 _LIT(KTxtTempExt, ".new"); |
|
90 tempFilename.Append(KTxtTempExt()); |
|
91 User::LeaveIfError(aFile.Replace(iFs, tempFilename, EFileWrite)); |
|
92 } |
|
93 |
|
94 void CFakeStoreManager::ReplaceFileStoreL(TMsvId aEntryId) |
|
95 { |
|
96 TBuf<KMaxStoreFilenameLength> tempFilename; |
|
97 tempFilename.Append(StoreFilename(aEntryId)); |
|
98 _LIT(KTxtTempExt, ".new"); |
|
99 tempFilename.Append(KTxtTempExt()); |
|
100 |
|
101 User::LeaveIfError(iFs.Replace(tempFilename, StoreFilename(aEntryId))); |
|
102 } |
|
103 |
|
104 void CFakeStoreManager::DeleteFileStoreL(TMsvId aEntryId) |
|
105 { |
|
106 TInt err = iFs.Delete(StoreFilename(aEntryId)); |
|
107 |
|
108 if( (err!=KErrNotFound) && (err!=KErrPathNotFound) ) |
|
109 { |
|
110 User::LeaveIfError(err); |
|
111 } |
|
112 } |
|
113 |
|
114 TBool CFakeStoreManager::FileStoreExistsL(TMsvId aEntryId) const |
|
115 { |
|
116 TBool isOpen = EFalse; |
|
117 TInt err = iFs.IsFileOpen(StoreFilename(aEntryId), isOpen); |
|
118 if( (err==KErrNotFound) || (err==KErrPathNotFound) ) |
|
119 { |
|
120 return EFalse; |
|
121 } |
|
122 |
|
123 User::LeaveIfError(err); |
|
124 |
|
125 return ETrue; |
|
126 } |
|
127 |
|
128 void CFakeStoreManager::OpenAttachmentForWriteL(TMsvId /*aEntryId*/, const TDesC& /*aFileName*/, RFile& /*aFile*/) |
|
129 { |
|
130 User::Invariant(); |
|
131 } |
|
132 |
|
133 const TDesC& CFakeStoreManager::StoreFilename(TMsvId aEntryId) const |
|
134 { |
|
135 iFilename.Zero(); |
|
136 iFilename.Append(KDriveLetter); |
|
137 iFilename.AppendNum(static_cast<TInt>(aEntryId)); |
|
138 |
|
139 return iFilename; |
|
140 } |
|
141 |
|
142 TBool CFakeStoreManager::CreateShareProtectedAttachmentForWriteL(TMsvId /*aEntryId*/, TDes& /*aFilename*/, RFile& /*aFile*/) |
|
143 { |
|
144 User::Leave(KErrNotSupported); |
|
145 //Avoid complier errors and warnings... |
|
146 return EFalse; |
|
147 } |
|
148 |
|
149 void CFakeStoreManager::BodyTextFilePathL(TMsvId /*aMessageId*/, TDes& /*aFilename*/) |
|
150 { |
|
151 User::Leave(KErrNotSupported); |
|
152 } |
|
153 |
|
154 |
|
155 void CFakeStoreManager::OpenBodyTextFileForReadL(RFile& /*aFile*/, TMsvId /*aBodyTextId*/, const TDesC& /*aFilePath*/) |
|
156 { |
|
157 |
|
158 User::Leave(KErrNotSupported); |
|
159 } |
|
160 |
|
161 void CFakeStoreManager::CreatePlainTextFileL(RFile& /*aFile*/, TMsvId /*aBodyTextId*/) |
|
162 { |
|
163 User::Leave(KErrNotSupported); |
|
164 } |
|
165 |
|
166 void CFakeStoreManager::DeletePlainTextFileL(TMsvId /*aBodyTextId*/) |
|
167 { |
|
168 User::Leave(KErrNotSupported); |
|
169 } |
|
170 |
|
171 void CFakeStoreManager::ReplacePlainTextFileL(TMsvId /*aBodyTextId*/) |
|
172 { |
|
173 User::Leave(KErrNotSupported); |
|
174 } |
|
175 |
|
176 |
|
177 // New APIs from PREQ2073 |
|
178 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB) |
|
179 |
|
180 void CFakeStoreManager::CreateBodyL(TMsvId /*aEntryId*/, const TUid& /*aUid*/, HBufC* /*aBodyContent*/) |
|
181 { |
|
182 |
|
183 } |
|
184 |
|
185 void CFakeStoreManager::LoadBodyL(TMsvId /*aEntryId*/, TUid& /*aUid*/, HBufC*& /*aBodyContent*/) |
|
186 { |
|
187 |
|
188 } |
|
189 |
|
190 void CFakeStoreManager::UpdateBodyL(TMsvId /*aEntryId*/, const TUid& /*aUid*/, HBufC* /*aBodyContent*/) |
|
191 { |
|
192 |
|
193 } |
|
194 |
|
195 void CFakeStoreManager::DeleteBodyL(TMsvId /*aEntryId*/) |
|
196 { |
|
197 |
|
198 } |
|
199 |
|
200 void CFakeStoreManager::CreateHeaderEntryL(const TUid& /*aMtmId*/, TMsvId /*aEntryId*/, const RPointerArray<CHeaderFields>& /*aFieldPairList*/) |
|
201 { |
|
202 |
|
203 } |
|
204 |
|
205 void CFakeStoreManager::LoadHeaderEntryL(const TUid& /*aMtmId*/, TMsvId /*aEntryId*/, RPointerArray<CHeaderFields>& /*aFieldPairList*/) |
|
206 { |
|
207 |
|
208 } |
|
209 |
|
210 void CFakeStoreManager::DeleteHeaderEntryL(const TUid& /*aMtmId*/, TMsvId /*aEntryId*/) |
|
211 { |
|
212 |
|
213 } |
|
214 |
|
215 void CFakeStoreManager::UpdateHeaderEntryL(const TUid& /*aMtmId*/, TMsvId /*aEntryId*/, const RPointerArray<CHeaderFields>& /*aFieldPairList*/) |
|
216 { |
|
217 |
|
218 } |
|
219 TBool CFakeStoreManager::DoesAnyStoreExists(TMsvId /*aId*/ , TUid /*aMtmId*/) |
|
220 { |
|
221 return ETrue; |
|
222 } |
|
223 |
|
224 TBool CFakeStoreManager::DoesHeaderTableExist(const TUid& /*aMtmId*/) |
|
225 { |
|
226 return ETrue; |
|
227 } |
|
228 |
|
229 #endif |