172 |
172 |
173 // -------------------------------------------------------------------------- |
173 // -------------------------------------------------------------------------- |
174 // CPbk2MyCard::MyCardBitmap |
174 // CPbk2MyCard::MyCardBitmap |
175 // -------------------------------------------------------------------------- |
175 // -------------------------------------------------------------------------- |
176 // |
176 // |
177 CFbsBitmap* CPbk2MyCard::MyCardBitmap() const |
177 CFbsBitmap* CPbk2MyCard::MyCardBitmapL() const |
178 { |
178 { |
179 // if fetched |
179 // if fetched |
180 if( iThumbBitmap ) |
180 if( iThumbBitmap ) |
181 { |
181 { |
182 // create duplicate bitmap |
182 // create duplicate bitmap |
183 CFbsBitmap* dstbitmap = new (ELeave) CFbsBitmap; |
183 CFbsBitmap* dstbitmap = new (ELeave) CFbsBitmap; |
184 CleanupStack::PushL( dstbitmap ); |
184 CleanupStack::PushL( dstbitmap ); |
185 |
185 |
186 //Get the handle to source bitmap |
186 //Get the handle to source bitmap |
187 TInt srchandle = iThumbBitmap->Handle(); |
187 const TInt srchandle = iThumbBitmap->Handle(); |
188 |
188 |
189 //Duplicate the bitmap handle. Increases the RefCount of bitmap |
189 //Duplicate the bitmap handle. Increases the RefCount of bitmap |
190 //managed but Fbs Server |
190 //managed but Fbs Server |
191 User::LeaveIfError( dstbitmap->Duplicate( srchandle ) ); |
191 User::LeaveIfError( dstbitmap->Duplicate( srchandle ) ); |
192 CleanupStack::Pop( dstbitmap ); |
192 CleanupStack::Pop( dstbitmap ); |
233 iMyCardState = EExisting; |
233 iMyCardState = EExisting; |
234 |
234 |
235 NotifyObservers( MPbk2MyCardObserver::EStateStatusResolved ); |
235 NotifyObservers( MPbk2MyCardObserver::EStateStatusResolved ); |
236 |
236 |
237 // fetch store contact |
237 // fetch store contact |
238 iRetrieveOperation = iContactManager->RetrieveContactL( *iMyCardLink, *this ); |
238 TRAP_IGNORE( iRetrieveOperation = |
|
239 iContactManager->RetrieveContactL( *iMyCardLink, *this ) ); |
239 } |
240 } |
240 |
241 |
241 // -------------------------------------------------------------------------- |
242 // -------------------------------------------------------------------------- |
242 // CPbk2MyCard::VPbkSingleContactLinkOperationFailed |
243 // CPbk2MyCard::VPbkSingleContactLinkOperationFailed |
243 // -------------------------------------------------------------------------- |
244 // -------------------------------------------------------------------------- |
269 |
270 |
270 delete iMyCardStoreContact; |
271 delete iMyCardStoreContact; |
271 iMyCardStoreContact = aContact; |
272 iMyCardStoreContact = aContact; |
272 |
273 |
273 // load thumbnail |
274 // load thumbnail |
274 LoadThumbnailL( *iMyCardStoreContact ); |
275 TRAPD( error, LoadThumbnailL( *iMyCardStoreContact ) ); |
|
276 if( error ) |
|
277 { |
|
278 delete iThumbBitmap; |
|
279 iThumbBitmap = NULL; |
|
280 // inform observers |
|
281 NotifyObservers( MPbk2MyCardObserver::EStateThumbnailNotFound ); |
|
282 } |
275 } |
283 } |
276 |
284 |
277 // --------------------------------------------------------------------------- |
285 // --------------------------------------------------------------------------- |
278 // CPbk2MyCard::VPbkSingleContactOperationFailed |
286 // CPbk2MyCard::VPbkSingleContactOperationFailed |
279 // --------------------------------------------------------------------------- |
287 // --------------------------------------------------------------------------- |
339 { |
347 { |
340 TSize size( CalculateThumbnailSize() ); |
348 TSize size( CalculateThumbnailSize() ); |
341 |
349 |
342 // Define parameters for thumbnail |
350 // Define parameters for thumbnail |
343 TPbk2ImageManagerParams params; |
351 TPbk2ImageManagerParams params; |
344 TInt useCropping = 0x0008; |
|
345 // set params |
352 // set params |
346 params.iSize = size; |
353 params.iSize = size; |
347 params.iFlags = TPbk2ImageManagerParams::EScaleImage | |
354 params.iFlags = TPbk2ImageManagerParams::EScaleImage | |
348 TPbk2ImageManagerParams::EKeepAspectRatio | |
355 TPbk2ImageManagerParams::EUseSpeedOptimizedScaling | |
349 useCropping; //CROP IMAGE |
356 TPbk2ImageManagerParams::ECropImage ; |
|
357 params.iDisplayMode = EColor16MU; |
350 // contact has image. load it. |
358 // contact has image. load it. |
351 iImageOperation = iImageManager->GetImageAsyncL( |
359 iImageOperation = iImageManager->GetImageAsyncL( |
352 ¶ms, aContact, *thumbType, *this ); |
360 ¶ms, aContact, *thumbType, *this ); |
353 } |
361 } |
354 // no image |
362 // no image |
375 MVPbkContactStore2* phoneStoreExtension = |
383 MVPbkContactStore2* phoneStoreExtension = |
376 static_cast<MVPbkContactStore2*>(aContactStore.ContactStoreExtension( |
384 static_cast<MVPbkContactStore2*>(aContactStore.ContactStoreExtension( |
377 KMVPbkContactStoreExtension2Uid)); |
385 KMVPbkContactStoreExtension2Uid)); |
378 if ( phoneStoreExtension ) |
386 if ( phoneStoreExtension ) |
379 { |
387 { |
380 TRAPD( err, iOperation = phoneStoreExtension->OwnContactLinkL(*this) ); |
388 TRAP_IGNORE( iOperation = phoneStoreExtension->OwnContactLinkL(*this) ); |
381 if( err ) |
|
382 { |
|
383 // TODO: How is this handled? |
|
384 } |
|
385 } |
389 } |
386 } |
390 } |
387 |
391 |
388 // -------------------------------------------------------------------------- |
392 // -------------------------------------------------------------------------- |
389 // CPbk2MyCard::StoreUnavailable |
393 // CPbk2MyCard::StoreUnavailable |