equal
deleted
inserted
replaced
172 iCurrentTexture(0), |
172 iCurrentTexture(0), |
173 iAnimationState(EInitializing), |
173 iAnimationState(EInitializing), |
174 iFrameInterval(-1), |
174 iFrameInterval(-1), |
175 iFrameCount(0), |
175 iFrameCount(0), |
176 iFlags(aFlags), |
176 iFlags(aFlags), |
177 iId(aId) |
177 iId(aId), |
|
178 iOriginalFileInUse(EFalse) |
178 { |
179 { |
179 } |
180 } |
180 |
181 |
181 void CHuiGifAnimationTexture::ConstructL(const TDesC& aFilename) |
182 void CHuiGifAnimationTexture::ConstructL(const TDesC& aFilename) |
182 { |
183 { |
201 parse.NameAndExt(); |
202 parse.NameAndExt(); |
202 |
203 |
203 TChar drive; |
204 TChar drive; |
204 User::LeaveIfError( DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRam, drive ) ); |
205 User::LeaveIfError( DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRam, drive ) ); |
205 |
206 |
206 iFilename = HBufC::NewL(parse.NameAndExt().Size() + 4); |
207 // 32 extra for textureid and 4 for "temp" |
|
208 iFilename = HBufC::NewL(parse.NameAndExt().Size() + 4 + 32+ 4); |
207 TPtr ptr = iFilename->Des(); |
209 TPtr ptr = iFilename->Des(); |
208 |
210 |
209 ptr.Append(drive); |
211 ptr.Append(drive); |
210 ptr.Append(_L(":\\")); |
212 ptr.Append(_L(":\\temp")); |
|
213 // with the texture id:s the |
|
214 // name should be "unique" |
|
215 ptr.AppendNum(iTextureId1); |
|
216 ptr.AppendNum(iTextureId2); |
211 ptr.Append(parse.NameAndExt()); |
217 ptr.Append(parse.NameAndExt()); |
212 |
218 |
213 RFs fs; |
219 RFs fs; |
214 User::LeaveIfError(fs.Connect()); |
220 User::LeaveIfError(fs.Connect()); |
215 |
221 |
218 TInt err = fileman->Copy(aFilename, iFilename->Des()); |
224 TInt err = fileman->Copy(aFilename, iFilename->Des()); |
219 |
225 |
220 CleanupStack::PopAndDestroy(); |
226 CleanupStack::PopAndDestroy(); |
221 |
227 |
222 if(err != KErrNone) |
228 if(err != KErrNone) |
223 { |
229 { |
224 delete iFilename; |
230 iOriginalFileInUse = ETrue; |
225 iFilename = aFilename.AllocL(); |
231 delete iFilename; |
226 } |
232 iFilename = aFilename.AllocL(); |
|
233 } |
227 |
234 |
228 |
235 |
229 iTexture1 = &iManager.LoadTextureL( |
236 iTexture1 = &iManager.LoadTextureL( |
230 *iFilename,EHuiTextureUploadFlagDefault, iTextureId1, 0); |
237 *iFilename,EHuiTextureUploadFlagDefault, iTextureId1, 0); |
231 iManager.iLoadObservers.AppendL(*this); |
238 iManager.iLoadObservers.AppendL(*this); |
244 delete iTexture1; |
251 delete iTexture1; |
245 delete iTexture2; |
252 delete iTexture2; |
246 |
253 |
247 iTexture = 0; |
254 iTexture = 0; |
248 |
255 |
249 RFs fs; |
256 // Don't delete the file if the original |
250 TInt err = fs.Connect(); |
257 // file was in use instead of the RAM copy |
251 if(err == KErrNone) |
258 if (!iOriginalFileInUse) |
252 { |
259 { |
253 CFileMan* fileman = 0; |
260 RFs fs; |
254 TRAP(err, fileman = CFileMan::NewL(fs)); |
261 TInt err = fs.Connect(); |
255 if(err == KErrNone) |
262 if(err == KErrNone) |
256 { |
263 { |
257 fileman->Delete(iFilename->Des()); |
264 CFileMan* fileman = 0; |
258 } |
265 TRAP(err, fileman = CFileMan::NewL(fs)); |
259 } |
266 if(err == KErrNone) |
260 |
267 { |
|
268 fileman->Delete(iFilename->Des()); |
|
269 } |
|
270 } |
|
271 } |
261 |
272 |
262 delete iFilename; |
273 delete iFilename; |
263 } |
274 } |
264 |
275 |
265 |
276 |