128 void AfStorageSyncTask::SaveActivityL(CAfStorage& dataStorage, const RMessage2& msg) |
128 void AfStorageSyncTask::SaveActivityL(CAfStorage& dataStorage, const RMessage2& msg) |
129 { |
129 { |
130 TPckgBuf<TInt> bitmapHdl(0); |
130 TPckgBuf<TInt> bitmapHdl(0); |
131 CAfEntry *entry = CAfEntry::NewLC(msg); |
131 CAfEntry *entry = CAfEntry::NewLC(msg); |
132 msg.ReadL(1, bitmapHdl); |
132 msg.ReadL(1, bitmapHdl); |
133 |
133 |
134 RBuf thumbnailPath; |
134 TInt hdl = bitmapHdl(); |
135 CleanupClosePushL(thumbnailPath); |
135 if (0 >= hdl) { |
136 DeleteActivityScreenshotL(dataStorage, |
136 User::Leave(KErrCorrupt); |
137 entry->ApplicationId(), |
137 } |
138 entry->ActivityId()); |
138 CFbsBitmap *bitmap = new (ELeave) CFbsBitmap; |
|
139 CleanupStack::PushL(bitmap); |
|
140 User::LeaveIfError(bitmap->Duplicate(hdl)); |
139 |
141 |
140 dataStorage.ThumbnailPathL(thumbnailPath, |
|
141 dataStorage.Fs(), |
|
142 entry->ApplicationId(), |
|
143 entry->ActivityId(), |
|
144 entry->Flags() & CAfEntry::Persistent); |
|
145 CreateThumbnailL(thumbnailPath, bitmapHdl()); |
|
146 //all data is retrieved. compleate message to improve response time |
142 //all data is retrieved. compleate message to improve response time |
147 msg.Complete(KErrNone); |
143 msg.Complete(KErrNone); |
148 TRAP_IGNORE(entry->SetImageSrcL(thumbnailPath); |
144 |
149 dataStorage.SaveActivityL(*entry);) |
145 // trap all other leaving methods to prevent completing message in ServiceError |
150 CleanupStack::PopAndDestroy(&thumbnailPath); |
146 TRAP_IGNORE( |
|
147 RBuf thumbnailPath; |
|
148 CleanupClosePushL(thumbnailPath); |
|
149 DeleteActivityScreenshotL(dataStorage, |
|
150 entry->ApplicationId(), |
|
151 entry->ActivityId()); |
|
152 |
|
153 dataStorage.ThumbnailPathL(thumbnailPath, |
|
154 dataStorage.Fs(), |
|
155 entry->ApplicationId(), |
|
156 entry->ActivityId(), |
|
157 entry->Flags() & CAfEntry::Persistent); |
|
158 |
|
159 User::LeaveIfError(bitmap->Save(thumbnailPath)); |
|
160 |
|
161 entry->SetImageSrcL(thumbnailPath); |
|
162 dataStorage.SaveActivityL(*entry); |
|
163 CleanupStack::PopAndDestroy(&thumbnailPath); |
|
164 ) |
|
165 CleanupStack::PopAndDestroy(bitmap); |
151 CleanupStack::PopAndDestroy(entry); |
166 CleanupStack::PopAndDestroy(entry); |
152 } |
167 } |
153 |
168 |
154 // ----------------------------------------------------------------------------- |
169 // ----------------------------------------------------------------------------- |
155 /** |
170 /** |