equal
deleted
inserted
replaced
17 */ |
17 */ |
18 |
18 |
19 #include "FeedInfo.h" |
19 #include "FeedInfo.h" |
20 #include <e32hashtab.h> |
20 #include <e32hashtab.h> |
21 #include <fbs.h> |
21 #include <fbs.h> |
|
22 #include <bautils.h> |
|
23 #include <eikenv.h> |
|
24 _LIT(KMbmExtension, ".mbm"); |
22 |
25 |
23 EXPORT_C CFeedInfo* CFeedInfo::NewL() |
26 EXPORT_C CFeedInfo* CFeedInfo::NewL() |
24 { |
27 { |
25 CFeedInfo* self = new (ELeave) CFeedInfo(); |
28 CFeedInfo* self = new (ELeave) CFeedInfo(); |
26 CleanupStack::PushL(self); |
29 CleanupStack::PushL(self); |
53 { |
56 { |
54 copy->SetCustomTitle(); |
57 copy->SetCustomTitle(); |
55 } |
58 } |
56 |
59 |
57 copy->SetLastError(LastError()); |
60 copy->SetLastError(LastError()); |
58 copy->SetFeedIconIndex(FeedIconIndex()); |
61 |
59 CleanupStack::Pop(copy); |
62 CleanupStack::Pop(copy); |
60 return copy; |
63 return copy; |
61 } |
64 } |
62 CFeedInfo::CFeedInfo() |
65 CFeedInfo::CFeedInfo() |
63 { |
66 { |
64 iCustomTitle = EFalse; |
67 iCustomTitle = EFalse; |
65 iFeedIconIndex = -1; |
|
66 } |
68 } |
67 |
69 |
68 EXPORT_C CFeedInfo::~CFeedInfo() |
70 EXPORT_C CFeedInfo::~CFeedInfo() |
69 { |
71 { |
70 delete iUrl; |
72 delete iUrl; |
189 return iImageFileName ? *iImageFileName : KNullDesC(); |
191 return iImageFileName ? *iImageFileName : KNullDesC(); |
190 } |
192 } |
191 |
193 |
192 EXPORT_C void CFeedInfo::SetImageFileNameL(const TDesC& aFileName) |
194 EXPORT_C void CFeedInfo::SetImageFileNameL(const TDesC& aFileName) |
193 { |
195 { |
|
196 TFileName cacheFileName; |
|
197 |
194 if (iImageFileName) |
198 if (iImageFileName) |
195 { |
199 { |
196 delete iImageFileName; |
200 delete iImageFileName; |
197 iImageFileName = NULL; |
201 iImageFileName = NULL; |
198 } |
202 } |
199 iImageFileName = aFileName.AllocL(); |
203 iImageFileName = aFileName.AllocL(); |
|
204 TParsePtrC parser(*iImageFileName); |
|
205 cacheFileName = parser.DriveAndPath(); |
|
206 cacheFileName.Append(parser.Name()); |
|
207 cacheFileName.Append(KMbmExtension()); |
|
208 if( BaflUtils::FileExists(CEikonEnv::Static()->FsSession(), cacheFileName) ) |
|
209 { |
|
210 iFeedIcon = CEikonEnv::Static()->CreateBitmapL(cacheFileName, 0); |
|
211 } |
200 } |
212 } |
201 |
213 |
202 EXPORT_C TBool CFeedInfo::CustomTitle() const |
214 EXPORT_C TBool CFeedInfo::CustomTitle() const |
203 { |
215 { |
204 return iCustomTitle; |
216 return iCustomTitle; |
227 EXPORT_C void CFeedInfo::SetFeedIcon(CFbsBitmap* aBitmapToClone) |
239 EXPORT_C void CFeedInfo::SetFeedIcon(CFbsBitmap* aBitmapToClone) |
228 { |
240 { |
229 iFeedIcon->Duplicate(aBitmapToClone->Handle()); |
241 iFeedIcon->Duplicate(aBitmapToClone->Handle()); |
230 } |
242 } |
231 |
243 |
232 void CFeedInfo::ImageOperationCompleteL(TInt /*aError*/, TUint /*aHandle*/) |
244 void CFeedInfo::ImageOperationCompleteL(TInt aError, TUint /*aHandle*/) |
233 { |
245 { |
234 |
246 |
235 } |
247 if (aError == KErrNone && iImageFileName && iFeedIcon) |
236 |
248 { |
237 EXPORT_C TInt CFeedInfo::FeedIconIndex() const |
249 TFileName cacheFileName; |
238 { |
250 |
239 return iFeedIconIndex; |
251 TParsePtrC parser(*iImageFileName); |
240 } |
252 cacheFileName = parser.DriveAndPath(); |
241 |
253 cacheFileName.Append(parser.Name()); |
242 EXPORT_C void CFeedInfo::SetFeedIconIndex(TInt aIndex) |
254 cacheFileName.Append(KMbmExtension()); |
243 { |
255 if( !BaflUtils::FileExists(CEikonEnv::Static()->FsSession(), cacheFileName) ) |
244 iFeedIconIndex = aIndex; |
256 { |
245 } |
257 iFeedIcon->Save(cacheFileName); |
|
258 } |
|
259 |
|
260 } |
|
261 } |