65 { |
65 { |
66 TPckgBuf<TInt> bitmapHdl(0); |
66 TPckgBuf<TInt> bitmapHdl(0); |
67 CAfEntry *entry = CAfEntry::NewLC(msg); |
67 CAfEntry *entry = CAfEntry::NewLC(msg); |
68 msg.ReadL(1, bitmapHdl); |
68 msg.ReadL(1, bitmapHdl); |
69 |
69 |
70 TInt hdl = bitmapHdl(); |
70 const TBool isValidBitmapHdl( 0 < bitmapHdl() ); |
71 if (0 >= hdl) { |
|
72 User::Leave(KErrCorrupt); |
|
73 } |
|
74 CFbsBitmap *bitmap = new (ELeave) CFbsBitmap; |
71 CFbsBitmap *bitmap = new (ELeave) CFbsBitmap; |
75 CleanupStack::PushL(bitmap); |
72 CleanupStack::PushL(bitmap); |
76 User::LeaveIfError(bitmap->Duplicate(hdl)); |
73 if( !isValidBitmapHdl ) |
|
74 { |
|
75 if( !(entry->Flags() & CAfEntry::Invisible) ) |
|
76 { |
|
77 User::Leave(KErrCorrupt); |
|
78 } |
|
79 } |
|
80 else |
|
81 { |
|
82 User::LeaveIfError( bitmap->Duplicate( bitmapHdl() ) ); |
|
83 } |
77 |
84 |
78 //all data is retrieved. compleate message to improve response time |
85 //all data is retrieved. compleate message to improve response time |
79 msg.Complete(KErrNone); |
86 msg.Complete(KErrNone); |
80 |
87 |
81 // trap all other leaving methods to prevent completing message in ServiceError |
88 // trap all other leaving methods to prevent completing message in ServiceError |
82 TRAP_IGNORE( |
89 TRAP_IGNORE( |
83 RBuf thumbnailPath; |
|
84 CleanupClosePushL(thumbnailPath); |
|
85 DeleteActivityScreenshotL(dataStorage, |
90 DeleteActivityScreenshotL(dataStorage, |
86 entry->ApplicationId(), |
91 entry->ApplicationId(), |
87 entry->ActivityId()); |
92 entry->ActivityId()); |
88 |
93 |
89 dataStorage.ThumbnailPathL(thumbnailPath, |
94 if( isValidBitmapHdl ) |
90 dataStorage.Fs(), |
95 { |
91 entry->ApplicationId(), |
96 RBuf thumbnailPath; |
92 entry->ActivityId(), |
97 CleanupClosePushL(thumbnailPath); |
93 entry->Flags() & CAfEntry::Persistent); |
98 |
94 |
99 dataStorage.ThumbnailPathL(thumbnailPath, |
95 User::LeaveIfError(bitmap->Save(thumbnailPath)); |
100 dataStorage.Fs(), |
96 |
101 entry->ApplicationId(), |
97 entry->SetImageSrcL(thumbnailPath); |
102 entry->ActivityId(), |
|
103 entry->Flags() & CAfEntry::Persistent); |
|
104 |
|
105 User::LeaveIfError(bitmap->Save(thumbnailPath)); |
|
106 entry->SetImageSrcL(thumbnailPath); |
|
107 CleanupStack::PopAndDestroy(&thumbnailPath); |
|
108 } |
|
109 |
98 dataStorage.SaveActivityL(*entry); |
110 dataStorage.SaveActivityL(*entry); |
99 CleanupStack::PopAndDestroy(&thumbnailPath); |
|
100 ) |
111 ) |
101 CleanupStack::PopAndDestroy(bitmap); |
112 CleanupStack::PopAndDestroy(bitmap); |
102 CleanupStack::PopAndDestroy(entry); |
113 CleanupStack::PopAndDestroy(entry); |
103 } |
114 } |
104 |
115 |