57 void CCCAppCommLauncherHeaderControl::ConstructL() |
57 void CCCAppCommLauncherHeaderControl::ConstructL() |
58 { |
58 { |
59 // Create the header image |
59 // Create the header image |
60 iImage = new (ELeave) CEikImage(); |
60 iImage = new (ELeave) CEikImage(); |
61 iImage->SetPictureOwnedExternally(ETrue); |
61 iImage->SetPictureOwnedExternally(ETrue); |
|
62 iImage->SetBrushStyle( CGraphicsContext::ENullBrush ); // transparent |
62 iImage->SetAlignment(EHCenterVCenter); |
63 iImage->SetAlignment(EHCenterVCenter); |
63 |
64 |
64 // Create the header labels |
65 // Create the header labels |
65 for (TInt i=0; i < KLabelLineCount; i++) |
66 for (TInt i=0; i < KLabelLineCount; i++) |
66 { |
67 { |
162 // From CCoeControl, called when the control's size changes, handles portrait-landscape switch |
155 // From CCoeControl, called when the control's size changes, handles portrait-landscape switch |
163 // --------------------------------------------------------------------------- |
156 // --------------------------------------------------------------------------- |
164 // |
157 // |
165 void CCCAppCommLauncherHeaderControl::SizeChanged() |
158 void CCCAppCommLauncherHeaderControl::SizeChanged() |
166 { |
159 { |
167 TInt isLandscape = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
160 const TInt isLandscape = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
|
161 const TRect rect(Rect()); |
|
162 |
|
163 /** |
|
164 * Option0 (w button, lsc) |
|
165 * Option2 (w/o button, lsc) |
|
166 * Option0 (w button, prt) |
|
167 * Option1 (w/o button, prt) |
|
168 */ |
|
169 |
|
170 // (w/o button) |
|
171 TInt option( isLandscape ? 2 : 1 ); |
|
172 if( iStatusButtonVisibility ) |
|
173 { |
|
174 // (w button) |
|
175 if( isLandscape ) |
|
176 { |
|
177 option = 0; |
|
178 } |
|
179 else |
|
180 { |
|
181 option = 0; |
|
182 } |
|
183 } |
168 |
184 |
169 AknLayoutUtils::LayoutImage( |
185 AknLayoutUtils::LayoutImage( |
170 iImage, Rect(), AknLayoutScalable_Apps::cl_header_pane_g1(isLandscape)); |
186 iImage, rect, AknLayoutScalable_Apps::phob2_cc_data_pane_g1(option)); |
171 |
187 |
172 TPoint position = iImage->Position(); |
188 iContactImageSize = iImage->Size(); |
173 TSize size = iImage->Size(); |
|
174 |
|
175 const TPoint newImagePosition = TPoint( position.iX/2, position.iY/2 ); |
|
176 iImage->SetPosition( newImagePosition ); |
|
177 |
|
178 const TSize newImageSize = TSize( size.iWidth + 2*( position.iX - newImagePosition.iX ) , |
|
179 size.iHeight + 2*( position.iY - newImagePosition.iY ) ); |
|
180 |
|
181 iImage->SetSize( newImageSize ); |
|
182 |
|
183 iContactImageSize = newImageSize; |
|
184 |
189 |
185 if ( iImageDecoding ) |
190 if ( iImageDecoding ) |
186 { |
191 { |
187 // if bitmap was set resize it |
|
188 if (iImageDecoding->IsActive()) |
|
189 { |
|
190 iImageDecoding->Cancel(); |
|
191 } |
|
192 TRAP_IGNORE( iImageDecoding->StartL( iContactImageSize ) ); |
192 TRAP_IGNORE( iImageDecoding->StartL( iContactImageSize ) ); |
193 } |
193 } |
194 |
194 |
195 TAknLayoutRect labelsRect; |
195 AknLayoutUtils::LayoutLabel(iLabels[0], rect, AknLayoutScalable_Apps::phob2_cc_data_pane_t1(option)); |
196 labelsRect.LayoutRect(Rect(), AknLayoutScalable_Apps::cl_header_name_pane(isLandscape)); |
196 AknLayoutUtils::LayoutLabel(iLabels[1], rect, AknLayoutScalable_Apps::phob2_cc_data_pane_t2(option)); |
197 |
197 AknLayoutUtils::LayoutLabel(iLabels[2], rect, AknLayoutScalable_Apps::phob2_cc_data_pane_t3(option)); |
198 AknLayoutUtils::LayoutLabel(iLabels[0], labelsRect.Rect(), AknLayoutScalable_Apps::cl_header_name_pane_t1(2)); |
|
199 AknLayoutUtils::LayoutLabel(iLabels[1], labelsRect.Rect(), AknLayoutScalable_Apps::cl_header_name_pane_t2(2)); |
|
200 AknLayoutUtils::LayoutLabel(iLabels[2], labelsRect.Rect(), AknLayoutScalable_Apps::cl_header_name_pane_t3(2)); |
|
201 |
198 |
202 if( iImageSelectionPopup ) |
199 if( iImageSelectionPopup ) |
203 { |
200 { |
204 delete iImageSelectionPopup; |
201 delete iImageSelectionPopup; |
205 iImageSelectionPopup = NULL; |
202 iImageSelectionPopup = NULL; |
249 // MCCAppContactHandlerNotifier) is called. Info about the contact is received |
246 // MCCAppContactHandlerNotifier) is called. Info about the contact is received |
250 // here. |
247 // here. |
251 // --------------------------------------------------------------------------- |
248 // --------------------------------------------------------------------------- |
252 // |
249 // |
253 void CCCAppCommLauncherHeaderControl::ContactInfoFetchedNotifyL( |
250 void CCCAppCommLauncherHeaderControl::ContactInfoFetchedNotifyL( |
254 const CCmsContactFieldInfo& aContactFieldInfo ) |
251 const CCmsContactFieldInfo& /*aContactFieldInfo*/ ) |
255 { |
252 { |
256 } |
253 } |
257 |
254 |
258 // --------------------------------------------------------------------------- |
255 // --------------------------------------------------------------------------- |
259 // The container calls this when its ContactFieldFetchedNotifyL (from |
256 // The container calls this when its ContactFieldFetchedNotifyL (from |
589 CleanupStack::PopAndDestroy( contactRelocator ); |
591 CleanupStack::PopAndDestroy( contactRelocator ); |
590 return ret; |
592 return ret; |
591 } |
593 } |
592 |
594 |
593 TKeyResponse CCCAppCommLauncherHeaderControl::OfferKeyEventL( |
595 TKeyResponse CCCAppCommLauncherHeaderControl::OfferKeyEventL( |
594 const TKeyEvent& aKeyEvent, TEventCode aType) |
596 const TKeyEvent& aKeyEvent, TEventCode /*aType*/) |
595 { |
597 { |
596 TKeyResponse ret( EKeyWasNotConsumed ); |
598 TKeyResponse ret( EKeyWasNotConsumed ); |
597 |
599 |
598 // If there is a command running in the background |
600 // If there is a command running in the background |
599 // the send key is automatically consumed. This |
601 // the send key is automatically consumed. This |
610 |
612 |
611 void CCCAppCommLauncherHeaderControl::ProcessContactImageDisplayL() |
613 void CCCAppCommLauncherHeaderControl::ProcessContactImageDisplayL() |
612 { |
614 { |
613 iHasContactImage = EFalse; |
615 iHasContactImage = EFalse; |
614 |
616 |
615 if (iImageDecoding) |
617 delete iImageDecoding; |
616 { |
618 iImageDecoding = NULL; |
617 if (iImageDecoding->IsActive()) |
|
618 { |
|
619 iImageDecoding->Cancel(); |
|
620 } |
|
621 delete iImageDecoding; |
|
622 iImageDecoding = NULL; |
|
623 } |
|
624 |
619 |
625 if ( iContactThumbnailData ) |
620 if ( iContactThumbnailData ) |
626 { |
621 { |
627 iImageDecoding = CCCAppCommLauncherImageDecoding::NewL(this, iContactThumbnailData, iContactImageFullName ); |
622 RFs& fs = CEikonEnv::Static()->FsSession(); |
|
623 iImageDecoding = CCCAppImageDecoding::NewL( |
|
624 *this, |
|
625 fs, |
|
626 iContactThumbnailData, |
|
627 iContactImageFullName ); |
|
628 iContactImageFullName = NULL; // ownership is moved to CCCAppImageDecoding |
|
629 iContactThumbnailData = NULL; // ownership is moved to CCCAppImageDecoding |
628 iImageDecoding->StartL( iContactImageSize ); |
630 iImageDecoding->StartL( iContactImageSize ); |
629 iHasContactImage = ETrue; |
631 iHasContactImage = ETrue; |
630 } |
632 } |
631 |
633 |
632 delete iContactImageFullName; |
634 delete iContactImageFullName; |