14 * Description: Holds the tracking status for MR attendee |
14 * Description: Holds the tracking status for MR attendee |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 // CLASS HEADER |
18 // CLASS HEADER |
|
19 |
19 #include "cesmrtrackstatus.h" |
20 #include "cesmrtrackstatus.h" |
|
21 |
20 #include "cesmrfield.h" |
22 #include "cesmrfield.h" |
21 #include "cesmriconfield.h" |
|
22 #include "cesmrborderlayer.h" |
|
23 #include "esmrdef.h" |
23 #include "esmrdef.h" |
24 #include "mesmrlistobserver.h" |
24 #include "mesmrlistobserver.h" |
25 #include "cesmrcontactmenuhandler.h" |
25 #include "cesmrcontactmenuhandler.h" |
26 #include "esmrhelper.h" |
26 #include "esmrhelper.h" |
27 #include "nmrbitmapmanager.h" |
27 #include "nmrbitmapmanager.h" |
|
28 #include "cmrimage.h" |
|
29 |
28 #include <eiklabel.h> |
30 #include <eiklabel.h> |
29 #include <eikimage.h> |
31 #include <eikimage.h> |
30 #include <calentry.h> |
32 #include <calentry.h> |
31 #include <caluser.h> |
33 #include <caluser.h> |
32 #include <eikenv.h> |
34 #include <eikenv.h> |
33 #include <StringLoader.h> |
35 #include <stringloader.h> |
34 #include <AknsUtils.h> |
36 #include <aknsutils.h> |
35 #include <AknUtils.h> |
37 #include <aknutils.h> |
36 #include <AknsConstants.h> |
38 #include <aknsconstants.h> |
37 #include <AknBidiTextUtils.h> |
39 #include <aknbiditextutils.h> |
38 #include <esmrgui.rsg> |
40 #include <esmrgui.rsg> |
39 #include <data_caging_path_literals.hrh> |
41 #include <data_caging_path_literals.hrh> |
|
42 #include <e32cmn.h> |
|
43 |
40 |
44 |
41 // DEBUG |
45 // DEBUG |
42 #include "emailtrace.h" |
46 #include "emailtrace.h" |
43 |
47 |
44 using namespace ESMRLayout; |
48 // TODO: THIS WHOLE CLASS NEEDS TO BE REIMPLEMENTED USING XML LAYOUT DATA |
|
49 // IF THIS IS TAKEN INTO USE |
|
50 |
45 |
51 |
46 // ======== MEMBER FUNCTIONS ======== |
52 // ======== MEMBER FUNCTIONS ======== |
47 |
53 |
48 // --------------------------------------------------------------------------- |
54 // --------------------------------------------------------------------------- |
49 // CESMRTrackStatus::NewL() |
55 // CESMRTrackStatus::NewL() |
84 // --------------------------------------------------------------------------- |
90 // --------------------------------------------------------------------------- |
85 // |
91 // |
86 CESMRTrackStatus::CESMRTrackStatus() |
92 CESMRTrackStatus::CESMRTrackStatus() |
87 { |
93 { |
88 FUNC_LOG; |
94 FUNC_LOG; |
89 //do nothing |
95 SetFieldId( EESMRTrackStatus ); |
90 } |
96 } |
91 |
97 |
92 // --------------------------------------------------------------------------- |
98 // --------------------------------------------------------------------------- |
93 // CESMRTrackStatus::ConstructL() |
99 // CESMRTrackStatus::ConstructL() |
94 // --------------------------------------------------------------------------- |
100 // --------------------------------------------------------------------------- |
95 // |
101 // |
96 void CESMRTrackStatus::ConstructL() |
102 void CESMRTrackStatus::ConstructL() |
97 { |
103 { |
98 FUNC_LOG; |
104 FUNC_LOG; |
99 // As a default set icon and text as it should be in status Needs action |
105 iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapTrackingNone ); |
100 SetFieldId( EESMRTrackStatus ); |
106 iIcon->SetParent( this ); |
101 CESMRViewerLabelField::ConstructL( KAknsIIDQgnFsIndiCaleTrackingNone ); |
107 |
102 iESMRStatic.ConnectL(); |
108 iESMRStatic.ConnectL(); |
103 iMenuHandler = &iESMRStatic.ContactMenuHandlerL(); |
109 iMenuHandler = &iESMRStatic.ContactMenuHandlerL(); |
104 |
|
105 iIcon = new (ELeave) CEikImage; |
|
106 } |
110 } |
107 |
111 |
108 // --------------------------------------------------------------------------- |
112 // --------------------------------------------------------------------------- |
109 // CESMRTrackStatus::InternalizeL() |
113 // CESMRTrackStatus::InternalizeL() |
110 // --------------------------------------------------------------------------- |
114 // --------------------------------------------------------------------------- |
111 // |
115 // |
112 void CESMRTrackStatus::InternalizeL( MESMRCalEntry& aEntry ) |
116 void CESMRTrackStatus::InternalizeL( MESMRCalEntry& aEntry ) |
113 { |
117 { |
114 FUNC_LOG; |
118 FUNC_LOG; |
115 TAknsItemID statusIconId = KAknsIIDQgnFsIndiCaleTrackingNone; |
119 |
116 RPointerArray<CCalAttendee> attendee = aEntry.Entry().AttendeesL(); |
120 RPointerArray<CCalAttendee> attendee = aEntry.Entry().AttendeesL(); |
117 // The array is already in sorted order with ReqAttendee coming first and |
121 // The array is already in sorted order with ReqAttendee coming first and |
118 // OptAttendee coming later. |
122 // OptAttendee coming later. |
119 TInt currentIndex = iESMRStatic.CurrentFieldIndex(); |
123 TInt currentIndex = iESMRStatic.CurrentFieldIndex(); |
120 |
124 |
137 text.Set( attendee[currentIndex]->Address() ); |
141 text.Set( attendee[currentIndex]->Address() ); |
138 } |
142 } |
139 iAddress = attendee[currentIndex]->Address().AllocL(); |
143 iAddress = attendee[currentIndex]->Address().AllocL(); |
140 } |
144 } |
141 |
145 |
142 const CFont* font = iLayout->Font (iCoeEnv, iFieldId ); |
146 // TODO: set font with XML data |
143 TInt maxLineWidth = iLabel->Size().iWidth; |
147 //const CFont* font = iLayout->Font (iCoeEnv, iFieldId ); |
144 maxLineWidth -= KIconSize.iWidth; |
148 //TInt maxLineWidth = iLabel->Size().iWidth; |
145 |
149 //maxLineWidth -= KIconSize.iWidth; |
146 HBufC* clippedTextHBufC = ClipTextLC( text, *font, maxLineWidth ); |
150 |
147 TPtr clippedText = clippedTextHBufC->Des(); |
151 //HBufC* clippedTextHBufC = ClipTextLC( text, *font, maxLineWidth ); |
148 clippedText.Trim(); |
152 //TPtr clippedText = clippedTextHBufC->Des(); |
149 iLabel->SetTextL( clippedText ); |
153 //clippedText.Trim(); |
150 CleanupStack::PopAndDestroy( clippedTextHBufC ); |
154 //iLabel->SetTextL( clippedText ); |
151 clippedTextHBufC = NULL; |
155 //CleanupStack::PopAndDestroy( clippedTextHBufC ); |
|
156 //clippedTextHBufC = NULL; |
|
157 |
|
158 NMRBitmapManager::TMRBitmapId bitmapId; |
152 |
159 |
153 switch( status ) |
160 switch( status ) |
154 { |
161 { |
155 case CCalAttendee::ENeedsAction: |
162 case CCalAttendee::ENeedsAction: |
156 { |
163 { |
157 statusIconId = KAknsIIDQgnFsIndiCaleTrackingNone; |
164 bitmapId = NMRBitmapManager::EMRBitmapTrackingNone; |
158 break; |
165 break; |
159 } |
166 } |
160 case CCalAttendee::ETentative: |
167 case CCalAttendee::ETentative: |
161 { |
168 { |
162 statusIconId = KAknsIIDQgnFsIndiCaleTrackingTentative; |
169 bitmapId = NMRBitmapManager::EMRBitmapTrackingTentative; |
163 break; |
170 break; |
164 } |
171 } |
165 case CCalAttendee::EAccepted: |
172 case CCalAttendee::EAccepted: |
166 case CCalAttendee::EConfirmed: |
173 case CCalAttendee::EConfirmed: |
167 { |
174 { |
168 statusIconId = KAknsIIDQgnFsIndiCaleTrackingAccept; |
175 bitmapId = NMRBitmapManager::EMRBitmapTrackingAccept; |
169 break; |
176 break; |
170 } |
177 } |
171 case CCalAttendee::EDeclined: |
178 case CCalAttendee::EDeclined: |
172 { |
179 { |
173 statusIconId = KAknsIIDQgnFsIndiCaleTrackingReject; |
180 bitmapId = NMRBitmapManager::EMRBitmapTrackingReject; |
174 break; |
181 break; |
175 } |
182 } |
176 default: |
183 default: |
177 { |
184 { |
178 statusIconId = KAknsIIDQgnFsIndiCaleTrackingNone; |
185 bitmapId = NMRBitmapManager::EMRBitmapTrackingNone; |
179 break; |
186 break; |
180 } |
187 } |
181 } |
188 } |
182 |
189 |
183 iESMRStatic.SetCurrentFieldIndex(++currentIndex); // Move to next index |
190 iESMRStatic.SetCurrentFieldIndex(++currentIndex); // Move to next index |
184 |
191 |
185 IconL( statusIconId ); |
192 delete iIcon; |
186 |
193 iIcon = NULL; |
187 //store default list selection to contactmenuhandler |
194 iIcon = CMRImage::NewL( bitmapId ); |
188 iDefaultAddress = attendee[0]->Address().AllocL(); |
195 iIcon->SetParent( this ); |
189 iMenuHandler->SetValueL(*iDefaultAddress, CESMRContactMenuHandler::EValueTypeEmail); |
196 |
190 |
197 //store default list selection to contactmenuhandler |
191 // This needs to be called so icon will be redrawn |
198 iDefaultAddress = attendee[0]->Address().AllocL(); |
192 SizeChanged(); |
199 iMenuHandler->SetValueL(*iDefaultAddress, CESMRContactMenuHandler::EValueTypeEmail); |
|
200 |
|
201 // This needs to be called so icon will be redrawn |
|
202 SizeChanged(); |
193 } |
203 } |
194 |
204 |
195 // --------------------------------------------------------------------------- |
205 // --------------------------------------------------------------------------- |
196 // CESMRTrackStatus::OfferKeyEventL |
206 // CESMRTrackStatus::OfferKeyEventL |
197 // --------------------------------------------------------------------------- |
207 // --------------------------------------------------------------------------- |
198 // |
208 // |
199 TKeyResponse CESMRTrackStatus::OfferKeyEventL( const TKeyEvent& aEvent, TEventCode aType ) |
209 TKeyResponse CESMRTrackStatus::OfferKeyEventL( |
200 { |
210 const TKeyEvent& aEvent, |
201 FUNC_LOG; |
211 TEventCode /*aType*/ ) |
|
212 { |
|
213 FUNC_LOG; |
|
214 TKeyResponse response( EKeyWasNotConsumed ); |
|
215 |
202 if ( aEvent.iScanCode == EStdKeyRightArrow ) |
216 if ( aEvent.iScanCode == EStdKeyRightArrow ) |
203 { |
217 { |
204 // Show right click menu (action menu) |
218 // Show right click menu (action menu) |
205 |
219 |
206 iMenuHandler->ShowActionMenuL(); |
220 iMenuHandler->ShowActionMenuL(); |
207 return EKeyWasConsumed; |
221 response = EKeyWasConsumed; |
208 } |
222 } |
209 |
223 |
210 return CESMRViewerLabelField::OfferKeyEventL(aEvent,aType); |
224 return response; |
211 } |
225 } |
212 |
226 |
213 // --------------------------------------------------------------------------- |
227 // --------------------------------------------------------------------------- |
214 // CESMRTrackStatus::SetOutlineFocusL |
228 // CESMRTrackStatus::SetOutlineFocusL |
215 // --------------------------------------------------------------------------- |
229 // --------------------------------------------------------------------------- |
216 // |
230 // |
217 void CESMRTrackStatus::SetOutlineFocusL(TBool aFocus ) |
231 void CESMRTrackStatus::SetOutlineFocusL(TBool aFocus ) |
218 { |
232 { |
219 FUNC_LOG; |
233 FUNC_LOG; |
220 CESMRViewerLabelField::SetOutlineFocusL (aFocus ); |
234 CESMRField::SetOutlineFocusL (aFocus ); |
|
235 |
221 SetActionMenuIconL(aFocus); |
236 SetActionMenuIconL(aFocus); |
222 TRgb fontColor( 0, 0, 0 ); |
237 TRgb fontColor( 0, 0, 0 ); |
223 if ( aFocus ) |
238 if ( aFocus ) |
224 { |
239 { |
225 if(iAddress) |
240 if( iAddress ) |
226 { |
241 { |
227 //no longer needed |
242 //no longer needed |
228 delete iDefaultAddress; |
243 delete iDefaultAddress; |
229 iDefaultAddress = NULL; |
244 iDefaultAddress = NULL; |
230 //give contact to actionmenuhandler |
245 //give contact to actionmenuhandler |
231 iMenuHandler->SetValueL(*iAddress, CESMRContactMenuHandler::EValueTypeEmail); |
246 iMenuHandler->SetValueL(*iAddress, CESMRContactMenuHandler::EValueTypeEmail); |
232 } |
247 } |
233 fontColor = iLayout->ViewerListAreaHighlightedTextColor(); |
|
234 } |
248 } |
235 else |
249 else |
236 { |
250 { |
237 iMenuHandler->Reset(); |
251 iMenuHandler->Reset(); |
238 fontColor = iLayout->ViewerListAreaTextColor(); |
252 } |
239 } |
|
240 |
|
241 TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( |
|
242 *iLabel, |
|
243 EColorLabelText, |
|
244 fontColor ) ); |
|
245 } |
253 } |
246 |
254 |
247 // --------------------------------------------------------------------------- |
255 // --------------------------------------------------------------------------- |
248 // CESMRCheckbox::CountComponentControls |
256 // CESMRCheckbox::CountComponentControls |
249 // --------------------------------------------------------------------------- |
257 // --------------------------------------------------------------------------- |
250 // |
258 // |
251 TInt CESMRTrackStatus::CountComponentControls( ) const |
259 TInt CESMRTrackStatus::CountComponentControls( ) const |
252 { |
260 { |
253 FUNC_LOG; |
261 FUNC_LOG; |
254 TInt count = CESMRViewerLabelField::CountComponentControls ( ); |
262 TInt count( 0 ); |
255 if ( iIcon ) |
263 if ( iIcon ) |
256 { |
264 { |
257 ++count; |
265 ++count; |
258 } |
266 } |
259 return count; |
267 return count; |
287 delete iActionMenuIconMask; |
301 delete iActionMenuIconMask; |
288 iActionMenuIconMask = NULL; |
302 iActionMenuIconMask = NULL; |
289 |
303 |
290 if( aFocused ) |
304 if( aFocused ) |
291 { |
305 { |
|
306 // TODO: correct this |
292 User::LeaveIfError( |
307 User::LeaveIfError( |
293 NMRBitmapManager::GetSkinBasedBitmap( |
308 NMRBitmapManager::GetSkinBasedBitmap( |
294 NMRBitmapManager::EMRBitmapRightClickArrow, |
309 NMRBitmapManager::EMRBitmapRightClickArrow, |
295 iActionMenuIcon, iActionMenuIconMask, KIconSize ) ); |
310 iActionMenuIcon, iActionMenuIconMask, TSize(20, 20) ) ); |
296 |
311 |
|
312 // TODO: USE XML LAYOUT DATA AND CMRIMAGE |
297 // Even if creating mask failed, bitmap can be used (background is just not displayed correctly) |
313 // Even if creating mask failed, bitmap can be used (background is just not displayed correctly) |
298 if( iActionMenuIcon ) |
314 /*if( iActionMenuIcon ) |
299 { |
315 { |
300 iIcon = new (ELeave) CEikImage; |
316 iIcon = new (ELeave) CEikImage; |
301 iIcon->SetPictureOwnedExternally(ETrue); |
317 iIcon->SetPictureOwnedExternally(ETrue); |
302 iIcon->SetPicture( iActionMenuIcon, iActionMenuIconMask ); |
318 iIcon->SetPicture( iActionMenuIcon, iActionMenuIconMask ); |
303 |
319 |
304 TRect rect = Rect ( ); |
320 TRect rect = Rect ( );*/ |
305 TInt iconTopMargin = ( rect.Height() - KIconSize.iHeight ) / 2; |
321 |
|
322 // TODO: use layout data |
|
323 /*TInt iconTopMargin = ( rect.Height() - KIconSize.iHeight ) / 2; |
306 TPoint iconPos( rect.iBr.iX - KIconSize.iWidth - KIconBorderMargin, |
324 TPoint iconPos( rect.iBr.iX - KIconSize.iWidth - KIconBorderMargin, |
307 rect.iBr.iY - iconTopMargin - KIconSize.iHeight); |
325 rect.iBr.iY - iconTopMargin - KIconSize.iHeight); |
308 iIcon->SetPosition ( iconPos ); |
326 iIcon->SetPosition ( iconPos ); |
309 iIcon->SetSize ( KIconSize ); |
327 iIcon->SetSize ( KIconSize );*/ |
310 } |
328 //} |
311 } |
329 } |
312 } |
330 } |
313 |
331 |
314 // --------------------------------------------------------------------------- |
332 // --------------------------------------------------------------------------- |
315 // CESMRTrackStatus::SizeChanged |
333 // CESMRTrackStatus::SizeChanged |
316 // --------------------------------------------------------------------------- |
334 // --------------------------------------------------------------------------- |
317 // |
335 // |
318 void CESMRTrackStatus::SizeChanged( ) |
336 void CESMRTrackStatus::SizeChanged( ) |
319 { |
337 { |
320 FUNC_LOG; |
338 FUNC_LOG; |
321 CESMRViewerLabelField::SizeChanged(); |
|
322 |
339 |
323 if ( iIcon ) |
340 if ( iIcon ) |
324 { |
341 { |
325 TRect rect = Rect ( ); |
342 TRect rect = Rect ( ); |
|
343 // TODO: use XML layout |
|
344 /* |
326 TInt iconTopMargin = ( rect.Height() - KIconSize.iHeight ) / 2; |
345 TInt iconTopMargin = ( rect.Height() - KIconSize.iHeight ) / 2; |
327 TPoint iconPos( rect.iBr.iX - KIconSize.iWidth - KIconBorderMargin, |
346 TPoint iconPos( rect.iBr.iX - KIconSize.iWidth - KIconBorderMargin, |
328 rect.iBr.iY - iconTopMargin - KIconSize.iHeight); |
347 rect.iBr.iY - iconTopMargin - KIconSize.iHeight); |
329 |
348 |
330 iIcon->SetPosition ( iconPos ); |
349 iIcon->SetPosition ( iconPos ); |
331 iIcon->SetSize ( KIconSize ); |
350 iIcon->SetSize ( KIconSize );*/ |
332 } |
351 } |
333 } |
352 } |
334 |
353 |
335 // ----------------------------------------------------------------------------- |
354 // ----------------------------------------------------------------------------- |
336 // CESMRTrackStatus::ClipTextLC |
355 // CESMRTrackStatus::ClipTextLC |