1 /* |
1 /* |
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
20 #include "cmrlabel.h" |
20 #include "cmrlabel.h" |
21 #include "cmrimage.h" |
21 #include "cmrimage.h" |
22 //<cmail> |
22 //<cmail> |
23 #include "esmrdef.h" |
23 #include "esmrdef.h" |
24 //</cmail> |
24 //</cmail> |
25 #include <AknIconUtils.h> |
25 #include <akniconutils.h> |
26 #include <gulcolor.h> |
26 #include <gulcolor.h> |
27 #include <AknUtils.h> |
27 #include <aknutils.h> |
28 #include <AknsConstants.h> |
28 #include <aknsconstants.h> |
29 #include <aknsconstants.hrh> |
29 #include <aknsconstants.hrh> |
30 #include <AknsUtils.h> |
30 #include <aknsutils.h> |
31 #include <data_caging_path_literals.hrh> |
31 #include <data_caging_path_literals.hrh> |
32 #include <AknLayout2ScalableDef.h> |
32 #include <aknlayout2scalabledef.h> |
33 |
33 |
34 #include "emailtrace.h" |
34 #include "emailtrace.h" |
35 |
35 |
36 /// Unnamed namespace for local definitions |
36 /// Unnamed namespace for local definitions |
37 namespace { // codescanner::namespace |
37 namespace { // codescanner::namespace |
48 * \x2028 line separator |
48 * \x2028 line separator |
49 * \x2029 paragraph separator |
49 * \x2029 paragraph separator |
50 */ |
50 */ |
51 _LIT( KReplaceWhitespaceChars, "\x0009\x000A\x000B\x000C\x000D\x2028\x2029" ); |
51 _LIT( KReplaceWhitespaceChars, "\x0009\x000A\x000B\x000C\x000D\x2028\x2029" ); |
52 |
52 |
53 #ifdef _DEBUG |
|
54 |
|
55 // Definition for panic text |
|
56 _LIT( KESMRPanicTxt, "CESMRTitlePane" ); |
|
57 |
|
58 /** |
|
59 * ES MR Entry panic codes |
|
60 */ |
|
61 enum TESMRPanicCodes |
|
62 { |
|
63 EESMREntryTypeNotSet = 1, // Entry does not exist |
|
64 }; |
|
65 |
|
66 /** |
|
67 * Raises panic. |
|
68 * @param aPanic Panic code |
|
69 */ |
|
70 void Panic(TESMRPanicCodes aPanic) |
|
71 { |
|
72 User::Panic( KESMRPanicTxt, aPanic); |
|
73 } |
|
74 |
|
75 #endif // _DEBUG |
|
76 |
|
77 } // namespace |
53 } // namespace |
78 |
54 |
79 // ======== MEMBER FUNCTIONS ======== |
55 // ======== MEMBER FUNCTIONS ======== |
80 |
56 |
81 // --------------------------------------------------------------------------- |
57 // --------------------------------------------------------------------------- |
145 void CESMRTitlePane::SizeChanged() |
120 void CESMRTitlePane::SizeChanged() |
146 { |
121 { |
147 FUNC_LOG; |
122 FUNC_LOG; |
148 TRect rect = Rect(); |
123 TRect rect = Rect(); |
149 |
124 |
150 TAknTextComponentLayout labelLayout = |
125 TAknTextComponentLayout labelLayout = |
151 NMRLayoutManager::GetTextComponentLayout( |
126 NMRLayoutManager::GetTextComponentLayout( |
152 NMRLayoutManager::EMRLayoutCtrlBarTitle ); |
127 NMRLayoutManager::EMRLayoutCtrlBarTitle ); |
153 AknLayoutUtils::LayoutLabel( iTitle, rect, labelLayout ); |
128 AknLayoutUtils::LayoutLabel( iTitle, rect, labelLayout ); |
154 |
129 |
155 iTitle->SetAlignment(EHCenterVCenter); |
|
156 |
|
157 TRgb color; |
130 TRgb color; |
158 AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), |
131 AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), |
159 color, |
132 color, |
160 KAknsIIDQsnTextColors, |
133 KAknsIIDQsnTextColors, |
161 EAknsCIQsnTextColorsCG2 ); |
134 EAknsCIQsnTextColorsCG2 ); |
162 // If this leaves we'll have to use the default color |
135 // If this leaves we'll have to use the default color |
163 TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( |
136 TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( |
164 *iTitle, |
137 *iTitle, |
165 EColorLabelText, |
138 EColorLabelText, |
166 color ) ); |
139 color ) ); |
167 |
|
168 if( iIcon ) |
|
169 { |
|
170 TAknWindowComponentLayout iconLayout = |
|
171 NMRLayoutManager::GetWindowComponentLayout( |
|
172 NMRLayoutManager::EMRLayoutCtrlBarGraphics ); |
|
173 AknLayoutUtils::LayoutImage( iIcon, rect, iconLayout ); |
|
174 } |
|
175 } |
140 } |
176 |
141 |
177 // --------------------------------------------------------------------------- |
142 // --------------------------------------------------------------------------- |
178 // CESMRTitlePane::CountComponentControls() |
143 // CESMRTitlePane::CountComponentControls() |
179 // --------------------------------------------------------------------------- |
144 // --------------------------------------------------------------------------- |
203 { |
165 { |
204 case 0: |
166 case 0: |
205 { |
167 { |
206 return iTitle; |
168 return iTitle; |
207 } |
169 } |
208 case 1: |
|
209 { |
|
210 return iIcon; |
|
211 } |
|
212 default: |
170 default: |
213 return NULL; |
171 return NULL; |
214 } |
172 } |
215 } |
|
216 |
|
217 // --------------------------------------------------------------------------- |
|
218 // CESMRTitlePane::HandleSetPriorityCmdL() |
|
219 // --------------------------------------------------------------------------- |
|
220 // |
|
221 void CESMRTitlePane::HandleSetPriorityCmdL( TInt aPriority ) |
|
222 { |
|
223 FUNC_LOG; |
|
224 |
|
225 __ASSERT_DEBUG( iEntryType != MESMRCalEntry::EESMRCalEntryNotSupported, |
|
226 Panic(EESMREntryTypeNotSet ) ); |
|
227 |
|
228 switch ( aPriority ) |
|
229 { |
|
230 case EESMRCmdPriorityHigh: |
|
231 { |
|
232 if ( iEntryType == MESMRCalEntry::EESMRCalEntryTodo ) |
|
233 { |
|
234 SetPriorityL(EFSCalenTodoPriorityHigh); |
|
235 } |
|
236 else |
|
237 { |
|
238 SetPriorityL(EFSCalenMRPriorityHigh); |
|
239 } |
|
240 break; |
|
241 } |
|
242 case EESMRCmdPriorityLow: |
|
243 { |
|
244 if ( iEntryType == MESMRCalEntry::EESMRCalEntryTodo ) |
|
245 { |
|
246 SetPriorityL(EFSCalenTodoPriorityLow); |
|
247 } |
|
248 else |
|
249 { |
|
250 SetPriorityL(EFSCalenMRPriorityLow); |
|
251 } |
|
252 break; |
|
253 } |
|
254 case EESMRCmdPriorityNormal: |
|
255 { |
|
256 if ( iEntryType == MESMRCalEntry::EESMRCalEntryTodo ) |
|
257 { |
|
258 SetPriorityL(EFSCalenTodoPriorityNormal); |
|
259 } |
|
260 else |
|
261 { |
|
262 SetPriorityL(EFSCalenMRPriorityNormal); |
|
263 } |
|
264 break; |
|
265 } |
|
266 default: |
|
267 break; |
|
268 } |
|
269 } |
|
270 |
|
271 // --------------------------------------------------------------------------- |
|
272 // CESMRTitlePane::SetPriorityL() |
|
273 // --------------------------------------------------------------------------- |
|
274 // |
|
275 void CESMRTitlePane::SetPriorityL(TUint aPriority ) |
|
276 { |
|
277 FUNC_LOG; |
|
278 __ASSERT_DEBUG( iEntryType != MESMRCalEntry::EESMRCalEntryNotSupported, |
|
279 Panic(EESMREntryTypeNotSet ) ); |
|
280 |
|
281 iPriority = aPriority; |
|
282 |
|
283 // icon added to MR-title only if the default icon is set and |
|
284 // the priority is neither high or low (the possible high/low |
|
285 // importance icons are currently only shown in navi pane). |
|
286 delete iIcon; |
|
287 iIcon = NULL; |
|
288 if ( iDefaultIcon && |
|
289 iEntryType != MESMRCalEntry::EESMRCalEntryTodo && |
|
290 aPriority != EFSCalenMRPriorityHigh && |
|
291 aPriority != EFSCalenMRPriorityLow ) |
|
292 { |
|
293 CreateIconL( KAknsIIDQgnFscalIndiSubject ); |
|
294 } |
|
295 |
|
296 SizeChanged(); |
|
297 DrawDeferred(); |
|
298 } |
|
299 |
|
300 // --------------------------------------------------------------------------- |
|
301 // CESMRTitlePane::CreateIconL() |
|
302 // --------------------------------------------------------------------------- |
|
303 // |
|
304 void CESMRTitlePane::CreateIconL( TAknsItemID aIconID ) |
|
305 { |
|
306 FUNC_LOG; |
|
307 delete iIcon; |
|
308 iIcon = NULL; |
|
309 |
|
310 iIcon = CMRImage::NewL( aIconID ); |
|
311 iIcon->SetParent( this ); |
|
312 } |
173 } |
313 |
174 |
314 // --------------------------------------------------------------------------- |
175 // --------------------------------------------------------------------------- |
315 // CESMRTitlePane::SetTextL() |
176 // CESMRTitlePane::SetTextL() |
316 // --------------------------------------------------------------------------- |
177 // --------------------------------------------------------------------------- |
342 // |
203 // |
343 void CESMRTitlePane::InternalizeL( MESMRCalEntry& aEntry ) |
204 void CESMRTitlePane::InternalizeL( MESMRCalEntry& aEntry ) |
344 { |
205 { |
345 FUNC_LOG; |
206 FUNC_LOG; |
346 iEntryType = aEntry.Type(); |
207 iEntryType = aEntry.Type(); |
347 SetPriorityL( aEntry.GetPriorityL() ); |
208 } |
348 } |
209 |
349 |
|
350 // --------------------------------------------------------------------------- |
|
351 // CESMRTitlePane::SetDefaultIcon() |
|
352 // --------------------------------------------------------------------------- |
|
353 // |
|
354 void CESMRTitlePane::SetDefaultIcon( TBool aDefault ) |
|
355 { |
|
356 FUNC_LOG; |
|
357 iDefaultIcon = aDefault; |
|
358 } |
|
359 |
|
360 // --------------------------------------------------------------------------- |
|
361 // CESMRTitlePane::ExternalizeL() |
|
362 // --------------------------------------------------------------------------- |
|
363 // |
|
364 void CESMRTitlePane::ExternalizeL( MESMRCalEntry& aEntry ) |
|
365 { |
|
366 FUNC_LOG; |
|
367 if ( aEntry.Type() == MESMRCalEntry::EESMRCalEntryMeetingRequest || |
|
368 aEntry.Type() == MESMRCalEntry::EESMRCalEntryMeeting ) |
|
369 { |
|
370 aEntry.SetPriorityL( iPriority ); |
|
371 } |
|
372 } |
|
373 |
210 |
374 // EOF |
211 // EOF |