|
1 /* |
|
2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: For MonthView of the Calendar application. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 //debug |
|
20 #include "calendarui_debug.h" |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include "calenmonthcontainer.h" |
|
24 #include "calencontroller.h" |
|
25 #include "calencontainerlayoutmanager.h" |
|
26 |
|
27 #include <calenconstants.h> |
|
28 #include <calendateutils.h> |
|
29 #include "calendrawutils.h" |
|
30 #include "calenmonthconst.h" |
|
31 #include "calenmonthgrid.h" |
|
32 #include "calenmonthview.h" |
|
33 #include "calenpreview.h" |
|
34 #include <calenagendautils.h> |
|
35 #include "CalenUid.h" |
|
36 #include "CleanupResetAndDestroy.h" |
|
37 #include "CalenUid.h" |
|
38 #include "calendar.hrh" |
|
39 #include <calendar.mbg> |
|
40 #include <Calendar.rsg> |
|
41 #include <csxhelp/cale.hlp.hrh> |
|
42 #include <calencontext.h> |
|
43 #include <aknlists.h> |
|
44 #include <akntoolbar.h> |
|
45 #include <gulicon.h> |
|
46 #include <AknIconArray.h> |
|
47 #include <AknsFrameBackgroundControlContext.h> |
|
48 #include <calinstance.h> |
|
49 #include <calinstanceview.h> |
|
50 #include <calenservices.h> |
|
51 #include <calenviewutils.h> |
|
52 |
|
53 |
|
54 // Layouts |
|
55 #include <aknlayoutscalable_apps.cdl.h> |
|
56 |
|
57 |
|
58 // LOCAL CONSTANTS AND MACROS |
|
59 _LIT(KMonthCellFormat, "%F%*D\t"); |
|
60 |
|
61 |
|
62 |
|
63 // New line color groups in enhanced skinning |
|
64 static void DrawLAFLine(CWindowGc& aGc, const TAknLayoutRect& aArea, |
|
65 const TAknsItemID& aSkinComponent, TInt aColorGroup) |
|
66 { |
|
67 TRACE_ENTRY_POINT; |
|
68 |
|
69 TRgb lineColor = aArea.Color(); |
|
70 AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), lineColor, |
|
71 aSkinComponent, aColorGroup); |
|
72 aGc.SetBrushColor( lineColor ); |
|
73 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
74 aGc.Clear( aArea.Rect() ); |
|
75 |
|
76 TRACE_EXIT_POINT; |
|
77 } |
|
78 |
|
79 // New line color groups in enhanced skinning |
|
80 static void DrawPrimaryLine(CWindowGc& aGc, const TAknLayoutRect& aArea) |
|
81 { |
|
82 TRACE_ENTRY_POINT; |
|
83 |
|
84 DrawLAFLine(aGc, aArea, KAknsIIDQsnLineColors, EAknsCIQsnLineColorsCG1); |
|
85 |
|
86 TRACE_EXIT_POINT; |
|
87 } |
|
88 |
|
89 // ================= MEMBER FUNCTIONS ======================= |
|
90 |
|
91 // ---------------------------------------------------------------------------- |
|
92 // CCalenMonthContainer::CCalenMonthContainer |
|
93 // C++ default constructor can NOT contain any code, that might leave. |
|
94 // (other items were commented in a header). |
|
95 // ---------------------------------------------------------------------------- |
|
96 // |
|
97 CCalenMonthContainer::CCalenMonthContainer( CCalenNativeView* aView, |
|
98 TTime& aDate, |
|
99 MCalenServices& aServices ) |
|
100 : CCalenContainer( aView, aServices ), |
|
101 iDate( aDate ) |
|
102 { |
|
103 TRACE_ENTRY_POINT; |
|
104 TRACE_EXIT_POINT; |
|
105 } |
|
106 |
|
107 // ---------------------------------------------------------------------------- |
|
108 // CCalenMonthContainer::~CCalenMonthContainer |
|
109 // Destructor |
|
110 // (other items were commented in a header). |
|
111 // ---------------------------------------------------------------------------- |
|
112 // |
|
113 CCalenMonthContainer::~CCalenMonthContainer() |
|
114 { |
|
115 TRACE_ENTRY_POINT; |
|
116 |
|
117 delete iGrid; |
|
118 delete iMonthDataArray; |
|
119 delete iBackgroundSkinContext; |
|
120 if( iNativePreview && iPreview ) |
|
121 { |
|
122 delete iPreview; |
|
123 iPreview = NULL; |
|
124 } |
|
125 |
|
126 TRACE_EXIT_POINT; |
|
127 } |
|
128 |
|
129 // ---------------------------------------------------------------------------- |
|
130 // CCalenMonthContainer::ChangesMidnightCrossover |
|
131 // Called when Midnight cross over |
|
132 // (other items were commented in a header). |
|
133 // ---------------------------------------------------------------------------- |
|
134 // |
|
135 void CCalenMonthContainer::ChangesMidnightCrossover() |
|
136 { |
|
137 TRACE_ENTRY_POINT; |
|
138 |
|
139 TTime baseTime( TInt64(0) ); |
|
140 TTime today = CalenDateUtils::Today(); |
|
141 TTimeIntervalDays daysToToday( today.DaysFrom( baseTime ) ); |
|
142 TTimeIntervalDays daysToGridStart( iFirstDayOfGrid.DaysFrom( baseTime ) ); |
|
143 TInt dataIndex( daysToToday.Int() -daysToGridStart.Int() ); |
|
144 TInt listBoxIndex( 0 ); |
|
145 |
|
146 if( dataIndex >= 0 && dataIndex < KNumberOfRows * KCalenDaysInWeek ) |
|
147 { |
|
148 listBoxIndex = static_cast<CAknGridView*>( iGrid->View() )->ListBoxIndex( dataIndex ); |
|
149 iGrid->View()->DrawItem( listBoxIndex ); |
|
150 } |
|
151 |
|
152 dataIndex--; |
|
153 |
|
154 if( dataIndex >= 0 && dataIndex < KNumberOfRows * KCalenDaysInWeek ) |
|
155 { |
|
156 listBoxIndex = static_cast<CAknGridView*>( iGrid->View() )->ListBoxIndex( dataIndex ); |
|
157 iGrid->View()->DrawItem( listBoxIndex ); |
|
158 } |
|
159 |
|
160 TRACE_EXIT_POINT; |
|
161 } |
|
162 |
|
163 // ---------------------------------------------------------------------------- |
|
164 // CCalenMonthContainer::SetDataL |
|
165 // Set data from beginning. |
|
166 // ---------------------------------------------------------------------------- |
|
167 // |
|
168 void CCalenMonthContainer::InitDataForMonthL() |
|
169 { |
|
170 TRACE_ENTRY_POINT; |
|
171 |
|
172 SetActiveDayL( CCalenContainer::DateFromContextL( iServices.Context() ) ); |
|
173 iView->BeginRepopulationL(); |
|
174 TRACE_EXIT_POINT; |
|
175 } |
|
176 |
|
177 // ---------------------------------------------------------------------------- |
|
178 // CCalenMonthContainer::SetActiveDayL |
|
179 // Set iDate to argument's aDay, |
|
180 // (other items were commented in a header). |
|
181 // ---------------------------------------------------------------------------- |
|
182 // |
|
183 void CCalenMonthContainer::SetActiveDayL(TTime aDay) |
|
184 { |
|
185 TRACE_ENTRY_POINT; |
|
186 |
|
187 // test |
|
188 TDateTime aDayTime = aDay.DateTime(); |
|
189 iDate = aDay; |
|
190 TLocale locale; |
|
191 |
|
192 // day number of iDate in month |
|
193 TInt dayNumberOfCurrentDay( iDate.DayNoInMonth() ); |
|
194 // 1th of month of iDate |
|
195 TTime firstDay( iDate - TTimeIntervalDays(dayNumberOfCurrentDay) ); |
|
196 TInt firstDayNoInWeek(firstDay.DayNoInWeek() - locale.StartOfWeek()); |
|
197 if (firstDayNoInWeek < 0) |
|
198 { |
|
199 firstDayNoInWeek += KCalenDaysInWeek; |
|
200 } |
|
201 |
|
202 iFirstDayOfGrid = firstDay - TTimeIntervalDays(firstDayNoInWeek); |
|
203 |
|
204 //test |
|
205 TDateTime firstDayOfGrid = iFirstDayOfGrid.DateTime(); |
|
206 |
|
207 iGrid->SetFirstDayOfGrid(iFirstDayOfGrid); |
|
208 |
|
209 TRACE_EXIT_POINT; |
|
210 } |
|
211 |
|
212 // ---------------------------------------------------------------------------- |
|
213 // CCalenMonthContainer::DayOfIndex |
|
214 // Return a day from Grid index |
|
215 // (other items were commented in a header). |
|
216 // ---------------------------------------------------------------------------- |
|
217 // |
|
218 TTime CCalenMonthContainer::DayOfIndex(TInt aIndex) |
|
219 { |
|
220 TRACE_ENTRY_POINT; |
|
221 |
|
222 TRACE_EXIT_POINT; |
|
223 return iFirstDayOfGrid + TTimeIntervalDays(aIndex); |
|
224 } |
|
225 |
|
226 // ---------------------------------------------------------------------------- |
|
227 // CCalenMonthContainer::SetCursorToActiveDay |
|
228 // Sets cursor to Active day |
|
229 // (other items were commented in a header). |
|
230 // ---------------------------------------------------------------------------- |
|
231 // |
|
232 void CCalenMonthContainer::SetCursorToActiveDay() |
|
233 { |
|
234 TRACE_ENTRY_POINT; |
|
235 |
|
236 TTimeIntervalDays intervalDays( iDate.DaysFrom( iFirstDayOfGrid ) ); |
|
237 TInt index = static_cast<CAknGridView*>( iGrid->View() )->ListBoxIndex( intervalDays.Int() ); |
|
238 iGrid->SetCurrentItemIndex(index); |
|
239 |
|
240 TRACE_EXIT_POINT; |
|
241 } |
|
242 |
|
243 // ---------------------------------------------------------------------------- |
|
244 // CCalenMonthContainer::ApplySelGridGraphicStyleL |
|
245 // Month grid cells setup method |
|
246 // (other items were commented in a header). |
|
247 // ---------------------------------------------------------------------------- |
|
248 // FIXME: this should be renamed |
|
249 void CCalenMonthContainer::ApplySelGridGraphicStyleL(CAknGrid& aListBox) |
|
250 { |
|
251 TRACE_ENTRY_POINT; |
|
252 |
|
253 // Setup subcells of grid. |
|
254 // |
|
255 // Subcell index | type | purpose |
|
256 // 0 | text cell | day number |
|
257 // 1 | graphics | triangle icon |
|
258 const TInt KDayNumberSubcell = 0; |
|
259 const TInt KTriangleIconSubcell = 1; |
|
260 |
|
261 TRect main_pane( ReducePreview( Rect() ) ); |
|
262 |
|
263 TAknLayoutRect main_cale_month_pane; |
|
264 TInt layoutVariant = LayoutVariantIndex( EMainCaleMonthPane ); |
|
265 main_cale_month_pane.LayoutRect( main_pane, AknLayoutScalable_Apps::main_cale_month_pane(layoutVariant).LayoutLine() ); |
|
266 |
|
267 // Layout variant index to Table 4.38 Main cale month pane contents. |
|
268 TAknLayoutRect grid_cale_month_pane, cell_cale_month_pane; |
|
269 layoutVariant = LayoutVariantIndex( EGridCaleMonthPane ); |
|
270 grid_cale_month_pane.LayoutRect( main_cale_month_pane.Rect(), AknLayoutScalable_Apps::grid_cale_month_pane( layoutVariant ).LayoutLine() ); |
|
271 |
|
272 TRect tmpRect = grid_cale_month_pane.Rect(); |
|
273 //tmpRect.iTl.iY -= 10; |
|
274 layoutVariant = LayoutVariantIndex( ECellCaleMonthPane ); |
|
275 cell_cale_month_pane.LayoutRect( tmpRect /*grid_cale_month_pane.Rect()*/, AknLayoutScalable_Apps::cell_cale_month_pane( layoutVariant, 0, 0 ).LayoutLine() ); |
|
276 |
|
277 // cellRect for AknListBoxLayouts functions has to be _inside_ cell rect, |
|
278 // so we take only size to make origin to be (0,0) |
|
279 TRect cellRect(cell_cale_month_pane.Rect().Size()); |
|
280 layoutVariant = LayoutVariantIndex( ECellCaleMonthPaneT1 ); |
|
281 |
|
282 // Setup day number text cell |
|
283 AknListBoxLayouts::SetupFormTextCell( aListBox, |
|
284 aListBox.ItemDrawer(), |
|
285 KDayNumberSubcell, |
|
286 AknLayoutScalable_Apps::cell_cale_month_pane_t1( layoutVariant ).LayoutLine(), |
|
287 cellRect.iTl, |
|
288 cellRect.iBr ); |
|
289 |
|
290 // Setup triangle icons |
|
291 TAknLayoutRect cell_cale_month_pane_g1; |
|
292 layoutVariant = LayoutVariantIndex( ECellCaleMonthPaneG1 ); |
|
293 // Note: we pass cellRect as parent, not cell_cale_month_pane.Rect(), because AknListbox subcell layouting expect cell origin to be 0,0 |
|
294 cell_cale_month_pane_g1.LayoutRect( cellRect, AknLayoutScalable_Apps::cell_cale_month_pane_g1(layoutVariant).LayoutLine() ); // <CDL LAYOUT> |
|
295 TRect triangleRect = cell_cale_month_pane_g1.Rect(); |
|
296 |
|
297 SetupSelgridFormBitmapCellL( aListBox, KTriangleIconSubcell, triangleRect.iTl, triangleRect.Size() ); |
|
298 CalenDrawUtils::SetIconSizes( cell_cale_month_pane_g1, iGrid->ItemDrawer()->FormattedCellData()->IconArray() ); |
|
299 |
|
300 TRACE_EXIT_POINT; |
|
301 } |
|
302 |
|
303 // ---------------------------------------------------------------------------- |
|
304 // CCalenMonthContainer::ChangeMonthL |
|
305 // Change Active Day and Data. |
|
306 // (other items were commented in a header). |
|
307 // ---------------------------------------------------------------------------- |
|
308 // |
|
309 void CCalenMonthContainer::ChangeMonthL() |
|
310 { |
|
311 TRACE_ENTRY_POINT; |
|
312 |
|
313 // Call diable redraw right before view repopulation starts to |
|
314 // prevent flashing focus on cell |
|
315 iGrid->View()->SetDisableRedraw( ETrue ); |
|
316 iView->BeginRepopulationL(); |
|
317 // FIXME: Examine if SetCursorToActiveDay is needed for all cases, where |
|
318 // InitDataForMonthL or SetActiveDayL is called |
|
319 // Hide/unhide "today" toolbar item based on the focused day |
|
320 UpdateTodayToolbarItemL(); |
|
321 |
|
322 TRACE_EXIT_POINT; |
|
323 } |
|
324 |
|
325 // ---------------------------------------------------------------------------- |
|
326 // CCalenMonthContainer::SetupSelgridFormBitmapCellL |
|
327 // Icon column setting for CAknGrid |
|
328 // (other items were commented in a header). |
|
329 // ---------------------------------------------------------------------------- |
|
330 // |
|
331 void CCalenMonthContainer::SetupSelgridFormBitmapCellL( CAknGrid& aListBox, |
|
332 TInt aIndex, |
|
333 TPoint aP1, |
|
334 TSize aSize ) |
|
335 { |
|
336 TRACE_ENTRY_POINT; |
|
337 |
|
338 CFormattedCellListBoxData* cellData = |
|
339 aListBox.ItemDrawer()->FormattedCellData(); |
|
340 |
|
341 cellData->SetGraphicsSubCellL(aIndex,ETrue); |
|
342 cellData->SetSubCellPositionL(aIndex, aP1); |
|
343 cellData->SetSubCellSizeL(aIndex, aSize); |
|
344 cellData->SetSubCellAlignmentL(aIndex, CGraphicsContext::ECenter); |
|
345 |
|
346 TRACE_EXIT_POINT; |
|
347 } |
|
348 |
|
349 // ---------------------------------------------------------------------------- |
|
350 // CCalenMonthContainer::DrawColLabel |
|
351 // Drawing days of the week. |
|
352 // (other items were commented in a header). |
|
353 // ---------------------------------------------------------------------------- |
|
354 // |
|
355 void CCalenMonthContainer::DrawColLabel( CWindowGc& aGc, TBool /*aUseWeeks*/ ) const |
|
356 { |
|
357 TRACE_ENTRY_POINT; |
|
358 |
|
359 TRect main_pane( ReducePreview( Rect() ) ); |
|
360 |
|
361 TAknLayoutRect cale_month_day_heading_pane; |
|
362 TAknLayoutRect main_cale_month_pane; |
|
363 TInt layoutVariant = LayoutVariantIndex( EMainCaleMonthPane ); |
|
364 main_cale_month_pane.LayoutRect( main_pane, AknLayoutScalable_Apps::main_cale_month_pane(layoutVariant).LayoutLine() ); |
|
365 |
|
366 layoutVariant = LayoutVariantIndex( ECaleMonthDayHeadingPane ); |
|
367 cale_month_day_heading_pane.LayoutRect( main_cale_month_pane.Rect(), AknLayoutScalable_Apps::cale_month_day_heading_pane( layoutVariant ).LayoutLine() ); |
|
368 TRect tmpRect = cale_month_day_heading_pane.Rect(); |
|
369 |
|
370 // Draw weekday names |
|
371 TLocale locale; |
|
372 aGc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
373 TAknLayoutText layoutText; |
|
374 TRgb textColor; |
|
375 MAknsSkinInstance* skinInst = AknsUtils::SkinInstance(); |
|
376 TRect parent( main_pane ); |
|
377 |
|
378 TAknLayoutScalableTableLimits limits = AknLayoutScalable_Apps::cale_month_day_heading_pane_t_Limits(); |
|
379 TInt index = limits.FirstIndex(); |
|
380 TInt end = limits.LastIndex() +1; |
|
381 TRect parentRect = tmpRect /*cale_month_day_heading_pane.Rect()*/; |
|
382 |
|
383 for( ; index < end; ++index ) |
|
384 { |
|
385 // Calculate day number of week |
|
386 TInt dayNoInWeek( index + locale.StartOfWeek() ); |
|
387 if (dayNoInWeek >= KCalenDaysInWeek) |
|
388 { |
|
389 dayNoInWeek -= KCalenDaysInWeek; |
|
390 } |
|
391 |
|
392 // Layout |
|
393 layoutVariant = LayoutVariantIndex( ECaleMonthDayHeadingPaneT ); |
|
394 layoutText.LayoutText( parentRect, AknLayoutScalable_Apps::cale_month_day_heading_pane_t( index, layoutVariant ).LayoutLine() ); |
|
395 |
|
396 // Get colors |
|
397 textColor = layoutText.Color(); |
|
398 AknsUtils::GetCachedColor( skinInst, textColor, |
|
399 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG23); |
|
400 |
|
401 TRAPD(error, |
|
402 const CDesCArrayFlat& abbArray = MonthView().AbbreviatedDayArrayL(); |
|
403 // Draw correct week day name |
|
404 layoutText.DrawText( aGc, |
|
405 abbArray[dayNoInWeek], |
|
406 ETrue, |
|
407 textColor ); |
|
408 ); |
|
409 if(error!=KErrNone) |
|
410 { |
|
411 // Do nothing to avoid warning |
|
412 } |
|
413 } |
|
414 |
|
415 TRACE_EXIT_POINT; |
|
416 } |
|
417 |
|
418 // ---------------------------------------------------------------------------- |
|
419 // CCalenMonthContainer::DrawRowLabel |
|
420 // Drawing week numbers. |
|
421 // (other items were commented in a header). |
|
422 // ---------------------------------------------------------------------------- |
|
423 // |
|
424 void CCalenMonthContainer::DrawRowLabel( CWindowGc& aGc ) const |
|
425 { |
|
426 TRACE_ENTRY_POINT; |
|
427 |
|
428 TRect main_pane( ReducePreview( Rect() ) ); |
|
429 |
|
430 TAknLayoutRect main_cale_month_pane; |
|
431 TInt layoutVariant = LayoutVariantIndex( EMainCaleMonthPane ); |
|
432 main_cale_month_pane.LayoutRect( main_pane, AknLayoutScalable_Apps::main_cale_month_pane(layoutVariant).LayoutLine() ); |
|
433 |
|
434 MAknsSkinInstance* skinInst = AknsUtils::SkinInstance(); |
|
435 |
|
436 // clear week number area |
|
437 TRect weekArea; |
|
438 |
|
439 // Side (week) pane layout |
|
440 TAknLayoutRect cale_month_week_pane; |
|
441 layoutVariant = LayoutVariantIndex( ECaleMonthWeekPane ); |
|
442 cale_month_week_pane.LayoutRect( main_cale_month_pane.Rect(), AknLayoutScalable_Apps::cale_month_week_pane( layoutVariant ).LayoutLine() ); |
|
443 |
|
444 AknsDrawUtils::Background( skinInst, AknsDrawUtils::ControlContext( this ), NULL, aGc, |
|
445 cale_month_week_pane.Rect(), KAknsDrawParamNoClearUnderImage ); |
|
446 |
|
447 TAknLayoutText weekNumberLayout; |
|
448 |
|
449 TAknLayoutScalableTableLimits cale_month_week_pane_t_Limits = AknLayoutScalable_Apps::cale_month_week_pane_t_Limits(); |
|
450 TInt first = cale_month_week_pane_t_Limits.FirstIndex(); |
|
451 TInt last = cale_month_week_pane_t_Limits.LastIndex(); |
|
452 |
|
453 for ( TInt i = first; i <= last; ++i ) |
|
454 { |
|
455 // Calculate week number |
|
456 TTime currentWeek( iFirstDayOfGrid + TTimeIntervalDays( KCalenDaysInWeek * i) ); |
|
457 TInt64 weekNumber( currentWeek.WeekNoInYear() ); |
|
458 |
|
459 // Visual stirng |
|
460 TBuf<3> weekNumberBuffer; |
|
461 weekNumberBuffer.Num( weekNumber ); |
|
462 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( weekNumberBuffer ); |
|
463 |
|
464 // Layout |
|
465 layoutVariant = LayoutVariantIndex( ECaleMonthWeekPaneT); |
|
466 weekNumberLayout.LayoutText( cale_month_week_pane.Rect(), AknLayoutScalable_Apps::cale_month_week_pane_t( i, layoutVariant ).LayoutLine() ); |
|
467 |
|
468 |
|
469 // Decide color |
|
470 TRgb textColor = weekNumberLayout.Color(); |
|
471 AknsUtils::GetCachedColor( skinInst, textColor, |
|
472 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG23); |
|
473 |
|
474 weekNumberLayout.DrawText( aGc, weekNumberBuffer, ETrue, textColor ); |
|
475 } |
|
476 |
|
477 TRACE_EXIT_POINT; |
|
478 } |
|
479 |
|
480 // ---------------------------------------------------------------------------- |
|
481 // CCalenMonthContainer::SetDateL |
|
482 // Set Date(1-28,29,30,31) to iMonthDataArray. |
|
483 // (other items were commented in a header). |
|
484 // ---------------------------------------------------------------------------- |
|
485 // |
|
486 void CCalenMonthContainer::SetDateL() |
|
487 { |
|
488 TRACE_ENTRY_POINT; |
|
489 |
|
490 iMonthDataArray->Reset(); |
|
491 for (TInt i(0); i < KNumberOfRows * KCalenDaysInWeek; ++i) |
|
492 { |
|
493 TTime currentDay(iFirstDayOfGrid + TTimeIntervalDays(i)); |
|
494 TCalenMonthData element(currentDay); |
|
495 iMonthDataArray->InsertL(i, element); |
|
496 } |
|
497 |
|
498 TRACE_EXIT_POINT; |
|
499 } |
|
500 |
|
501 // ---------------------------------------------------------------------------- |
|
502 // CCalenMonthContainer::HandleDayChangeL |
|
503 // (other items were commented in a header). |
|
504 // ---------------------------------------------------------------------------- |
|
505 // |
|
506 void CCalenMonthContainer::HandleDayChangeL( TTime aNewActiveDay ) |
|
507 { |
|
508 TRACE_ENTRY_POINT; |
|
509 |
|
510 SetActiveDayL( aNewActiveDay ); |
|
511 |
|
512 // dont focus the preview popup/previewpane if any dialog or faster app is active |
|
513 if( !iView->IsEditorActiveOrFasterAppExit()) |
|
514 { |
|
515 iPreview->FocusChangedL( aNewActiveDay ); |
|
516 } |
|
517 |
|
518 UpdateStatusPaneAndExtensionsL(); |
|
519 // Hide/unhide "today" toolbar item based on the focused day |
|
520 UpdateTodayToolbarItemL(); |
|
521 |
|
522 TRACE_EXIT_POINT; |
|
523 } |
|
524 |
|
525 // ---------------------------------------------------------------------------- |
|
526 // CCalenMonthContainer::NotifyChangeDateL |
|
527 // Date change operation notification handler. |
|
528 // (other items were commented in a header). |
|
529 // ---------------------------------------------------------------------------- |
|
530 // |
|
531 void CCalenMonthContainer::NotifyChangeDateL() |
|
532 { |
|
533 TRACE_ENTRY_POINT; |
|
534 |
|
535 TTime newActiveDay = iServices.Context().FocusDateAndTimeL().TimeLocalL(); |
|
536 |
|
537 //test |
|
538 TDateTime newActiveDayTime = newActiveDay.DateTime(); |
|
539 if ( CalenDateUtils::OnSameMonth( iDate, newActiveDay ) ) |
|
540 { |
|
541 HandleDayChangeL(newActiveDay); |
|
542 SetCursorToActiveDay(); |
|
543 // Changed DrawDeferred to Invalidate |
|
544 Window().Invalidate(); |
|
545 } |
|
546 else |
|
547 { |
|
548 iGrid->View()->SetDisableRedraw( ETrue ); |
|
549 iView->BeginRepopulationL(); |
|
550 } |
|
551 |
|
552 // Hide/unhide "today" toolbar item based on the focused day |
|
553 UpdateTodayToolbarItemL(); |
|
554 TRACE_EXIT_POINT; |
|
555 } |
|
556 |
|
557 // ---------------------------------------------------------------------------- |
|
558 // CCalenMonthContainer::CountComponentControls |
|
559 // return number of components |
|
560 // ---------------------------------------------------------------------------- |
|
561 TInt CCalenMonthContainer::CountComponentControls() const |
|
562 { |
|
563 TRACE_ENTRY_POINT; |
|
564 |
|
565 TInt controlCount; |
|
566 |
|
567 if ( iLayoutManager->ControlOrNull() ) |
|
568 { |
|
569 controlCount = 2; |
|
570 } |
|
571 else |
|
572 { |
|
573 controlCount = 1; |
|
574 } |
|
575 |
|
576 TRACE_EXIT_POINT; |
|
577 return controlCount; |
|
578 } |
|
579 |
|
580 // ---------------------------------------------------------------------------- |
|
581 // CCalenMonthContainer::ComponentControl |
|
582 // retrun the component specified by aIndex |
|
583 // (other items were commented in a header). |
|
584 // ---------------------------------------------------------------------------- |
|
585 // |
|
586 CCoeControl* CCalenMonthContainer::ComponentControl(TInt aIndex) const |
|
587 { |
|
588 TRACE_ENTRY_POINT; |
|
589 |
|
590 CCoeControl* control( NULL ); |
|
591 |
|
592 switch (aIndex) |
|
593 { |
|
594 case 0: |
|
595 control = iGrid; |
|
596 break; |
|
597 |
|
598 case 1: |
|
599 control = iLayoutManager->ControlOrNull(); |
|
600 break; |
|
601 |
|
602 default: |
|
603 __ASSERT_DEBUG( 0, User::Invariant() ); |
|
604 break; |
|
605 } |
|
606 |
|
607 TRACE_EXIT_POINT; |
|
608 return control; |
|
609 } |
|
610 |
|
611 // ---------------------------------------------------------------------------- |
|
612 // CCalenMonthContainer::OfferKeyEventL |
|
613 // processing of a key event |
|
614 // (other items were commented in a header). |
|
615 // ---------------------------------------------------------------------------- |
|
616 // |
|
617 TKeyResponse CCalenMonthContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
618 TEventCode aType ) |
|
619 { |
|
620 TRACE_ENTRY_POINT; |
|
621 |
|
622 if (aType == EEventKeyDown) |
|
623 { |
|
624 iPreview->Hide(); |
|
625 } |
|
626 |
|
627 // Common view key handling - view switching etc. |
|
628 TKeyResponse exitCode( EKeyWasNotConsumed ); |
|
629 |
|
630 exitCode = CCalenContainer::OfferKeyEventL( aKeyEvent, aType ); |
|
631 |
|
632 |
|
633 if ( exitCode == EKeyWasNotConsumed && aType == EEventKey ) |
|
634 { |
|
635 switch (aKeyEvent.iCode) |
|
636 { |
|
637 case EKeyOK: |
|
638 { |
|
639 iServices.IssueCommandL( ECalenForwardsToDayView ); |
|
640 exitCode = EKeyWasConsumed; |
|
641 } |
|
642 break; |
|
643 case EKeyEnter: |
|
644 { |
|
645 iView->HandleCommandL(EAknSoftkeyOpen); |
|
646 exitCode = EKeyWasConsumed; |
|
647 } |
|
648 break; |
|
649 case EKeyUpArrow: /* fall through... */ |
|
650 case EKeyDownArrow: /* fall through... */ |
|
651 case EKeyRightArrow: /* fall through... */ |
|
652 case EKeyLeftArrow: |
|
653 #ifdef SUPPORT_NAVISCROLL_EVENTS |
|
654 case EKeyNext: |
|
655 case EKeyPrevious: |
|
656 #endif |
|
657 { |
|
658 // Update the view's data. |
|
659 exitCode = HandleAttemptToMoveL( aKeyEvent.iCode ); |
|
660 } |
|
661 break; |
|
662 default: |
|
663 break; |
|
664 } |
|
665 } |
|
666 |
|
667 |
|
668 // grid key handling |
|
669 if (exitCode == EKeyWasConsumed || !iGrid) |
|
670 { |
|
671 // do nothing |
|
672 } |
|
673 else |
|
674 { |
|
675 // Attempt to move the highlight of the AknGrid. |
|
676 TInt oldIndex( iGrid->CurrentItemIndex() ); |
|
677 CAknGridM* gridModel = static_cast<CAknGridM*>( iGrid->Model() ); |
|
678 if ( gridModel->NumberOfData() != 0 ) |
|
679 { |
|
680 exitCode = iGrid->OfferKeyEventL(aKeyEvent, aType); |
|
681 } |
|
682 |
|
683 |
|
684 if (exitCode == EKeyWasConsumed) |
|
685 { |
|
686 TInt newIndex(iGrid->CurrentItemIndex()); |
|
687 if (oldIndex != newIndex) |
|
688 { |
|
689 TInt gridIndex = GridIndex(); |
|
690 TTime newActiveDay(iFirstDayOfGrid + |
|
691 TTimeIntervalDays(gridIndex)); |
|
692 HandleDayChangeL(newActiveDay); |
|
693 } |
|
694 } |
|
695 } |
|
696 |
|
697 |
|
698 TRACE_EXIT_POINT; |
|
699 return exitCode; |
|
700 } |
|
701 |
|
702 // ---------------------------------------------------------------------------- |
|
703 // CCalenMonthContainer::HandleAttemptToMoveL |
|
704 // Try to move by the given amount of days. |
|
705 // (other items were commented in a header). |
|
706 // ---------------------------------------------------------------------------- |
|
707 // |
|
708 TKeyResponse CCalenMonthContainer::HandleAttemptToMoveL( TUint aKeyCode ) |
|
709 { |
|
710 TRACE_ENTRY_POINT; |
|
711 |
|
712 const TBool mirrored( AknLayoutUtils::LayoutMirrored() ); |
|
713 TInt intervalDays( 0 ); |
|
714 switch( aKeyCode ) |
|
715 { |
|
716 case EKeyUpArrow: |
|
717 intervalDays = -KCalenDaysInWeek; |
|
718 break; |
|
719 case EKeyDownArrow: |
|
720 intervalDays = KCalenDaysInWeek; |
|
721 break; |
|
722 case EKeyRightArrow: |
|
723 intervalDays = mirrored ? -1 : 1; |
|
724 break; |
|
725 case EKeyLeftArrow: |
|
726 intervalDays = mirrored ? 1 : -1; |
|
727 break; |
|
728 default: |
|
729 ASSERT( EFalse ); |
|
730 break; |
|
731 } |
|
732 |
|
733 TTime newDay( iDate + TTimeIntervalDays( intervalDays ) ); |
|
734 |
|
735 if ( !CalenDateUtils::IsValidDay( newDay ) ) |
|
736 { |
|
737 CalenViewUtils::ShowDateOutOfRangeErrorNoteL(); |
|
738 |
|
739 TRACE_EXIT_POINT; |
|
740 return EKeyWasConsumed; |
|
741 } |
|
742 // test |
|
743 TDateTime newDayTime = newDay.DateTime(); |
|
744 TCalTime time; |
|
745 time.SetTimeLocalL( newDay ); |
|
746 iServices.Context().SetFocusDateL( time, |
|
747 TVwsViewId( KUidCalendar, KUidCalenMonthView ) ); |
|
748 |
|
749 // Check to see if we go over a month boundary. |
|
750 TMonth activeMonth( iDate.DateTime().Month() ); |
|
751 TMonth newMonth( newDay.DateTime().Month() ); |
|
752 if ( activeMonth != newMonth ) |
|
753 { |
|
754 ChangeMonthL(); |
|
755 TRACE_EXIT_POINT; |
|
756 return EKeyWasConsumed; |
|
757 } |
|
758 |
|
759 TRACE_EXIT_POINT; |
|
760 return EKeyWasNotConsumed; |
|
761 } |
|
762 |
|
763 // ---------------------------------------------------------------------------- |
|
764 // CCalenMonthContainer::Draw |
|
765 // drawing month view |
|
766 // (other items were commented in a header). |
|
767 // ---------------------------------------------------------------------------- |
|
768 // |
|
769 void CCalenMonthContainer::Draw(const TRect& /*aRect*/) const |
|
770 { |
|
771 TRACE_ENTRY_POINT; |
|
772 |
|
773 const TBool useWeeks( UseWeeks() ); |
|
774 |
|
775 CWindowGc& gc = SystemGc(); |
|
776 TAknLayoutRect area; |
|
777 MAknsSkinInstance* skinInst = AknsUtils::SkinInstance(); |
|
778 |
|
779 TRect main_pane( ReducePreview( Rect() ) ); |
|
780 |
|
781 |
|
782 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
|
783 AknsDrawUtils::Background( skinInst, |
|
784 cc, |
|
785 NULL, |
|
786 gc, |
|
787 Rect() |
|
788 ); |
|
789 |
|
790 gc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
791 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
792 |
|
793 |
|
794 // Draw week & day name separator lines |
|
795 |
|
796 |
|
797 TAknLayoutRect main_cale_month_pane; |
|
798 TInt layoutVariant = LayoutVariantIndex( EMainCaleMonthPane ); |
|
799 main_cale_month_pane.LayoutRect( main_pane, AknLayoutScalable_Apps::main_cale_month_pane(layoutVariant).LayoutLine() ); |
|
800 |
|
801 // draw vertical line between week numbers and grid elements |
|
802 if( useWeeks ) |
|
803 { |
|
804 TAknLayoutRect cale_month_pane_g2; |
|
805 layoutVariant = LayoutVariantIndex( ECaleMonthPaneG2 ); |
|
806 cale_month_pane_g2.LayoutRect( main_cale_month_pane.Rect(), AknLayoutScalable_Apps::cale_month_pane_g2( layoutVariant).LayoutLine() ); |
|
807 |
|
808 DrawPrimaryLine(gc, cale_month_pane_g2); |
|
809 } |
|
810 |
|
811 // draw horizontal line between week days and grid elements |
|
812 TAknLayoutRect cale_month_pane_g1; |
|
813 layoutVariant = LayoutVariantIndex(ECaleMonthPaneG1); |
|
814 cale_month_pane_g1.LayoutRect( main_cale_month_pane.Rect(), AknLayoutScalable_Apps::cale_month_pane_g1( layoutVariant ).LayoutLine() ); |
|
815 DrawPrimaryLine(gc, cale_month_pane_g1); |
|
816 |
|
817 // write week days. |
|
818 DrawColLabel( gc, useWeeks ); |
|
819 |
|
820 // write week numbers |
|
821 if( useWeeks ) |
|
822 { |
|
823 DrawRowLabel( gc ); |
|
824 } |
|
825 |
|
826 TRACE_EXIT_POINT; |
|
827 } |
|
828 |
|
829 |
|
830 // ---------------------------------------------------------------------------- |
|
831 // CCalenMonthContainer::GetHelpContext |
|
832 // Gets help context |
|
833 // (other items were commented in a header). |
|
834 // ---------------------------------------------------------------------------- |
|
835 // |
|
836 void CCalenMonthContainer::GetHelpContext( TCoeHelpContext& aContext ) const |
|
837 { |
|
838 TRACE_ENTRY_POINT; |
|
839 |
|
840 aContext.iMajor = KUidCalendar; |
|
841 // This is specified in HRH file. |
|
842 aContext.iContext = KCALE_HLP_MONTH_VIEW; |
|
843 |
|
844 TRACE_EXIT_POINT; |
|
845 } |
|
846 |
|
847 void CCalenMonthContainer::SizeChanged() |
|
848 { |
|
849 TRACE_ENTRY_POINT; |
|
850 |
|
851 PIM_TRAPD_HANDLE( DoSizeChangedL() ); |
|
852 |
|
853 TRACE_EXIT_POINT; |
|
854 } |
|
855 // ---------------------------------------------------------------------------- |
|
856 // CCalenMonthContainer::DoSizeChanged |
|
857 // Resizes child controls |
|
858 // (other items were commented in a header). |
|
859 // ---------------------------------------------------------------------------- |
|
860 // |
|
861 void CCalenMonthContainer::DoSizeChangedL() |
|
862 { |
|
863 TRACE_ENTRY_POINT; |
|
864 |
|
865 // Setup grid layout |
|
866 CCalenContainer::SizeChanged( Rect() ); |
|
867 |
|
868 iLayoutManager->GetLayoutAndExtensionL(); |
|
869 |
|
870 TRect main_pane( ReducePreview( Rect() ) ); |
|
871 |
|
872 TAknLayoutRect grid_cale_month_pane, cell, vLine, hLine; |
|
873 |
|
874 TAknLayoutRect main_cale_month_pane; |
|
875 TInt layoutVariant = LayoutVariantIndex( EMainCaleMonthPane ); |
|
876 |
|
877 |
|
878 main_cale_month_pane.LayoutRect( main_pane, AknLayoutScalable_Apps::main_cale_month_pane( layoutVariant ).LayoutLine() ); |
|
879 |
|
880 |
|
881 layoutVariant = LayoutVariantIndex( EGridCaleMonthPane ); |
|
882 grid_cale_month_pane.LayoutRect( main_cale_month_pane.Rect(), AknLayoutScalable_Apps::grid_cale_month_pane(layoutVariant).LayoutLine() ); |
|
883 |
|
884 TRect gridRect = grid_cale_month_pane.Rect(); |
|
885 |
|
886 iGrid->SetRect( gridRect ); |
|
887 |
|
888 layoutVariant = LayoutVariantIndex( ECellCaleMonthPane ); |
|
889 cell.LayoutRect( gridRect, AknLayoutScalable_Apps::cell_cale_month_pane( layoutVariant, 0, 0 ).LayoutLine() ); |
|
890 layoutVariant = LayoutVariantIndex( ECaleMonthPaneG3 ); |
|
891 vLine.LayoutRect( main_cale_month_pane.Rect(), AknLayoutScalable_Apps::cale_month_pane_g3( layoutVariant ).LayoutLine() ); |
|
892 layoutVariant = LayoutVariantIndex( ECaleMonthPaneG9 ); |
|
893 hLine.LayoutRect( main_cale_month_pane.Rect(), AknLayoutScalable_Apps::cale_month_pane_g9( layoutVariant ).LayoutLine() ); |
|
894 |
|
895 // This could be done somewhere else, e.g. in construction |
|
896 // and HandleResourceChange (for dynamic layout changes) |
|
897 iGrid->SetLayoutL( EFalse, // aVerticalOrientation |
|
898 !AknLayoutUtils::LayoutMirrored(), // aLeftToRight |
|
899 ETrue, // aTopToBottom |
|
900 KCalenDaysInWeek, // aNumOfItemsInPrimaryOrient |
|
901 KNumberOfRows, // aNumOfItemsInSecondaryOrient |
|
902 cell.Rect().Size(), // aSizeOfItems |
|
903 vLine.Rect().Width(), // aWidthOfSpaceBetweenItems=0 |
|
904 hLine.Rect().Height() ); // aHeightOfSpaceBetweenItems=0 |
|
905 |
|
906 |
|
907 |
|
908 // Setup grid cell texts and graphics properties |
|
909 ApplySelGridGraphicStyleL( *iGrid ); |
|
910 |
|
911 // Remove scrollbar |
|
912 CEikScrollBarFrame* frame = iGrid->ScrollBarFrame(); |
|
913 if( frame ) |
|
914 { |
|
915 frame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff ); |
|
916 } |
|
917 |
|
918 // Set size for skin backgrounds |
|
919 if( iBackgroundSkinContext && iHeadingBgContext && iSideBgContext ) |
|
920 { |
|
921 // Calendar background skin |
|
922 TAknLayoutRect bg_cale_pane_cp02; |
|
923 layoutVariant = LayoutVariantIndex( EBgCalePaneCp02); |
|
924 bg_cale_pane_cp02.LayoutRect( main_cale_month_pane.Rect(), AknLayoutScalable_Apps::bg_cale_pane_cp02( layoutVariant ).LayoutLine() ); |
|
925 |
|
926 TRect tempRect = bg_cale_pane_cp02.Rect(); |
|
927 |
|
928 TAknLayoutRect cale_bg_pane_g1; // skin-center |
|
929 cale_bg_pane_g1.LayoutRect( tempRect /*bg_cale_pane_cp02.Rect()*/, AknLayoutScalable_Apps::cale_bg_pane_g1().LayoutLine() ); |
|
930 |
|
931 iBackgroundSkinContext->SetFrameRects( bg_cale_pane_cp02.Rect(), cale_bg_pane_g1.Rect() ); |
|
932 |
|
933 |
|
934 // Heading pane skin |
|
935 TAknLayoutRect bg_cale_heading_pane_cp01; |
|
936 layoutVariant = LayoutVariantIndex( EBgCaleHeadingPaneCp01); |
|
937 bg_cale_heading_pane_cp01.LayoutRect( main_cale_month_pane.Rect(), AknLayoutScalable_Apps::bg_cale_heading_pane_cp01( layoutVariant ).LayoutLine() ); |
|
938 |
|
939 tempRect = bg_cale_heading_pane_cp01.Rect(); |
|
940 |
|
941 TAknLayoutRect bg_cale_heading_pane_g1; |
|
942 bg_cale_heading_pane_g1.LayoutRect( tempRect /*bg_cale_heading_pane_cp01.Rect() */ , AknLayoutScalable_Apps::bg_cale_heading_pane_g1().LayoutLine() ); |
|
943 |
|
944 iHeadingBgContext->SetFrameRects( bg_cale_heading_pane_cp01.Rect(), bg_cale_heading_pane_g1.Rect() ); |
|
945 |
|
946 // Side pane skin |
|
947 if(UseWeeks()) |
|
948 { |
|
949 TAknLayoutRect cale_month_week_pane; |
|
950 layoutVariant = LayoutVariantIndex( ECaleMonthWeekPane ); |
|
951 cale_month_week_pane.LayoutRect( main_cale_month_pane.Rect(), AknLayoutScalable_Apps::cale_month_week_pane( layoutVariant ).LayoutLine() ); |
|
952 |
|
953 tempRect = cale_month_week_pane.Rect(); |
|
954 TAknLayoutRect bg_cale_side_pane_cp01; |
|
955 layoutVariant = LayoutVariantIndex( EBgCaleSidePaneCp01 ); |
|
956 bg_cale_side_pane_cp01.LayoutRect( tempRect /*cale_month_week_pane.Rect()*/, AknLayoutScalable_Apps::bg_cale_side_pane_cp01(layoutVariant).LayoutLine() ); |
|
957 |
|
958 TAknLayoutRect bg_cale_side_pane_g1; |
|
959 bg_cale_side_pane_g1.LayoutRect( bg_cale_side_pane_cp01.Rect(), AknLayoutScalable_Apps::bg_cale_side_pane_g1().LayoutLine() ); |
|
960 |
|
961 iSideBgContext->SetFrameRects( bg_cale_side_pane_cp01.Rect(), bg_cale_side_pane_g1.Rect() ); |
|
962 } |
|
963 |
|
964 iBackgroundSkinContext->SetParentContext( iBgContext ); |
|
965 iHeadingBgContext->SetParentContext( iBackgroundSkinContext ); |
|
966 iSideBgContext->SetParentContext( iHeadingBgContext ); |
|
967 } |
|
968 |
|
969 TRACE_EXIT_POINT; |
|
970 } |
|
971 |
|
972 // ---------------------------------------------------------------------------- |
|
973 // CCalenMonthContainer::FocusChanged |
|
974 // (other items were commented in a header). |
|
975 // ---------------------------------------------------------------------------- |
|
976 // |
|
977 void CCalenMonthContainer::FocusChanged( TDrawNow aDrawNow ) |
|
978 { |
|
979 TRACE_ENTRY_POINT; |
|
980 |
|
981 CCalenContainer::FocusChanged( aDrawNow ); |
|
982 if( iGrid ) |
|
983 { |
|
984 iGrid->SetFocus( IsFocused() ); |
|
985 } |
|
986 |
|
987 TRACE_EXIT_POINT; |
|
988 } |
|
989 |
|
990 // ---------------------------------------------------------------------------- |
|
991 // CCalenMonthContainer::HandleResourceChange |
|
992 // Handles a resource change relative events |
|
993 // (other items were commented in a header). |
|
994 // ---------------------------------------------------------------------------- |
|
995 // |
|
996 void CCalenMonthContainer::HandleResourceChange(TInt aType) |
|
997 { |
|
998 TRACE_ENTRY_POINT; |
|
999 |
|
1000 CCalenContainer::HandleResourceChange( aType ); |
|
1001 |
|
1002 if ( aType == KAknsMessageSkinChange || aType == KEikDynamicLayoutVariantSwitch ) |
|
1003 { |
|
1004 CArrayPtr<CGulIcon>* iconArray = iGrid->ItemDrawer()->FormattedCellData()->IconArray(); |
|
1005 if(iconArray) |
|
1006 { |
|
1007 iconArray->ResetAndDestroy(); |
|
1008 delete iconArray; // owned by CFormattedCellListBoxData |
|
1009 iconArray = NULL; // to suppress codescanner error |
|
1010 iGrid->ItemDrawer()->FormattedCellData()->SetIconArray(NULL); |
|
1011 } |
|
1012 |
|
1013 TRAPD(leave, iconArray = CreateIconsL( iIconIndices )); |
|
1014 if(!leave && iconArray) |
|
1015 { |
|
1016 iGrid->ItemDrawer()->FormattedCellData()->SetIconArray(iconArray); |
|
1017 } |
|
1018 |
|
1019 SizeChanged(); |
|
1020 |
|
1021 // Update date formats to status pane |
|
1022 TRAP_IGNORE(UpdateStatusPaneAndExtensionsL()); |
|
1023 |
|
1024 // if we have layout change and resource change is allowed do the refresh |
|
1025 if (aType == KEikDynamicLayoutVariantSwitch) |
|
1026 { |
|
1027 iLayoutManager->HandleResourceChange( aType ); |
|
1028 TRAP_IGNORE(iView->BeginRepopulationL()); |
|
1029 } |
|
1030 } |
|
1031 |
|
1032 CCoeControl::HandleResourceChange( aType ); |
|
1033 |
|
1034 TRACE_EXIT_POINT; |
|
1035 } |
|
1036 |
|
1037 // ---------------------------------------------------------------------------- |
|
1038 // CCalenMonthContainer::ConstructImplL |
|
1039 // Third phase constructor. |
|
1040 // This function was called CCalenNativeView::ConstructL(). |
|
1041 // (other items were commented in a header). |
|
1042 // ---------------------------------------------------------------------------- |
|
1043 // |
|
1044 void CCalenMonthContainer::ConstructImplL() |
|
1045 { |
|
1046 TRACE_ENTRY_POINT; |
|
1047 |
|
1048 iChangeMonth = EFalse; |
|
1049 iDayFormat = KMonthCellFormat; |
|
1050 |
|
1051 iMonthDataArray = new(ELeave) CMonthDataArray(KCalenDaysInWeek * KNumberOfRows); |
|
1052 |
|
1053 TLocale locale; |
|
1054 |
|
1055 // Create preview pane |
|
1056 TRect aRect = PreviewRectL(); |
|
1057 iPreview = iServices.CustomPreviewPaneL(aRect); |
|
1058 if (iPreview == NULL) |
|
1059 { |
|
1060 iPreview = CCalenPreview::NewL( iView, locale, iServices ); |
|
1061 iNativePreview = ETrue; |
|
1062 } |
|
1063 |
|
1064 // grid |
|
1065 iGrid = new(ELeave) CCalenMonthGrid(iFirstDayOfGrid,this); |
|
1066 iGrid->SetContainerWindowL(*this); |
|
1067 iGrid->ConstructL(this, CEikListBox::EMultipleSelection); |
|
1068 |
|
1069 iGrid->SetListBoxObserver(this ); |
|
1070 iGrid->DisableScrolling( ETrue ); |
|
1071 iGrid->DisableSingleClick( ETrue ); |
|
1072 |
|
1073 |
|
1074 CDesCArray* itemArray = |
|
1075 static_cast<CDesCArray*>( iGrid->Model()->ItemTextArray() ); |
|
1076 _LIT(KDesAny, "a"); // Evasion of CAknGrid's bug |
|
1077 itemArray->AppendL(KDesAny); |
|
1078 |
|
1079 iGrid->SetPrimaryScrollingType( |
|
1080 CAknGridView::EScrollFollowsItemsAndLoops ); |
|
1081 iGrid->SetSecondaryScrollingType( |
|
1082 CAknGridView::EScrollFollowsItemsAndLoops ); |
|
1083 |
|
1084 |
|
1085 CArrayPtr<CGulIcon>* iconArray = iGrid->ItemDrawer()->FormattedCellData()->IconArray(); |
|
1086 if(iconArray) |
|
1087 { |
|
1088 iconArray->ResetAndDestroy(); |
|
1089 delete iconArray; // owned by CFormattedCellListBoxData |
|
1090 iconArray = NULL; // to suppress codescanner error |
|
1091 iGrid->ItemDrawer()->FormattedCellData()->SetIconArray(NULL); |
|
1092 } |
|
1093 |
|
1094 iGrid->ItemDrawer()->FormattedCellData()->SetIconArray( CreateIconsL( iIconIndices )); |
|
1095 iGrid->View()->SetDisableRedraw(ETrue); |
|
1096 |
|
1097 PIM_TRAPD_HANDLE( ConstructBackgroundContextL() ); |
|
1098 |
|
1099 TRACE_EXIT_POINT; |
|
1100 } |
|
1101 |
|
1102 // ---------------------------------------------------------------------------- |
|
1103 // CCalenMonthContainer::ConstructBackgroundContextL |
|
1104 // Constructs the background context |
|
1105 // (other items were commented in a header). |
|
1106 // ---------------------------------------------------------------------------- |
|
1107 // |
|
1108 void CCalenMonthContainer::ConstructBackgroundContextL() |
|
1109 { |
|
1110 TRACE_ENTRY_POINT; |
|
1111 |
|
1112 TRect dummy(0,0,0,0); |
|
1113 if( AknLayoutUtils::ScalableLayoutInterfaceAvailable() ) |
|
1114 { |
|
1115 iHeadingBgContext = CAknsFrameBackgroundControlContext::NewL( KAknsIIDQsnFrCaleHeading, dummy, dummy, EFalse ); |
|
1116 iSideBgContext = CAknsFrameBackgroundControlContext::NewL( KAknsIIDQsnFrCaleSide, dummy, dummy, EFalse ); |
|
1117 iBackgroundSkinContext = CAknsFrameBackgroundControlContext::NewL( |
|
1118 KAknsIIDQsnFrCale, dummy, dummy, EFalse ); |
|
1119 } |
|
1120 |
|
1121 TRACE_EXIT_POINT; |
|
1122 } |
|
1123 |
|
1124 // ---------------------------------------------------------------------------- |
|
1125 // CCalenMonthContainer::UpdateSize |
|
1126 // Do layout changes after calendar settings are |
|
1127 // changed. |
|
1128 // Implementation for month view without week numbers. |
|
1129 // ---------------------------------------------------------------------------- |
|
1130 // |
|
1131 void CCalenMonthContainer::UpdateSize() |
|
1132 { |
|
1133 TRACE_ENTRY_POINT; |
|
1134 |
|
1135 SizeChanged(); |
|
1136 // Update date formats to status pane |
|
1137 TRAPD(error,UpdateStatusPaneAndExtensionsL()); |
|
1138 if(error!=KErrNone) |
|
1139 { |
|
1140 // do avoid warning |
|
1141 } |
|
1142 |
|
1143 TRACE_EXIT_POINT; |
|
1144 } |
|
1145 |
|
1146 // ---------------------------------------------------------------------------- |
|
1147 // CCalenMonthContainer::MopSupplyObject() |
|
1148 // Pass skin information if needed. |
|
1149 // ---------------------------------------------------------------------------- |
|
1150 // |
|
1151 TTypeUid::Ptr CCalenMonthContainer::MopSupplyObject(TTypeUid aId) |
|
1152 { |
|
1153 TRACE_ENTRY_POINT; |
|
1154 TBool useWeeksBool = EFalse; |
|
1155 useWeeksBool = UseWeeks(); |
|
1156 |
|
1157 MAknsControlContext* cc = useWeeksBool ? iSideBgContext : iHeadingBgContext; |
|
1158 |
|
1159 if( !cc ) |
|
1160 { |
|
1161 cc = iBgContext; |
|
1162 } |
|
1163 |
|
1164 if( aId.iUid == MAknsControlContext::ETypeId && cc ) |
|
1165 { |
|
1166 TRACE_EXIT_POINT; |
|
1167 return MAknsControlContext::SupplyMopObject( aId, cc ); |
|
1168 } |
|
1169 |
|
1170 TRACE_EXIT_POINT; |
|
1171 return CCoeControl::MopSupplyObject( aId ); |
|
1172 } |
|
1173 |
|
1174 // ---------------------------------------------------------------------------- |
|
1175 // CCalenMonthContainer::GridIndex |
|
1176 // ---------------------------------------------------------------------------- |
|
1177 // |
|
1178 TInt CCalenMonthContainer::GridIndex() const |
|
1179 { |
|
1180 TRACE_ENTRY_POINT; |
|
1181 |
|
1182 TRACE_EXIT_POINT; |
|
1183 return reinterpret_cast<CAknGridView*>( iGrid->View() ) |
|
1184 ->ActualDataIndex(iGrid->CurrentItemIndex()); |
|
1185 } |
|
1186 |
|
1187 // ---------------------------------------------------------------------------- |
|
1188 // CCalenMonthContainer::UseWeeks |
|
1189 // ---------------------------------------------------------------------------- |
|
1190 TBool CCalenMonthContainer::UseWeeks() const |
|
1191 { |
|
1192 TRACE_ENTRY_POINT; |
|
1193 |
|
1194 TBool useWeeks( EFalse ); |
|
1195 |
|
1196 TRAPD(err,useWeeks = UseWeeksL()); |
|
1197 if(err==KErrNone) |
|
1198 { |
|
1199 // to avoid warning |
|
1200 } |
|
1201 |
|
1202 TRACE_EXIT_POINT; |
|
1203 return useWeeks; |
|
1204 } |
|
1205 |
|
1206 // ---------------------------------------------------------------------------- |
|
1207 // CCalenMonthContainer::UseWeeks |
|
1208 // ---------------------------------------------------------------------------- |
|
1209 TBool CCalenMonthContainer::UseWeeksL() const |
|
1210 { |
|
1211 TRACE_ENTRY_POINT; |
|
1212 |
|
1213 TBool useWeeks( EFalse ); |
|
1214 |
|
1215 // Week numbers are not shown if layout is mirrored |
|
1216 // or monday isn't the default week start day |
|
1217 if( !AknLayoutUtils::LayoutMirrored() ) |
|
1218 { |
|
1219 CCalenSetting* setting(NULL); |
|
1220 setting = CCalenSetting::InstanceL(); |
|
1221 |
|
1222 CleanupReleasePushL( *setting ) ; |
|
1223 |
|
1224 if( setting->WeekFormat() == EMonday ) |
|
1225 { |
|
1226 useWeeks = ETrue; |
|
1227 } |
|
1228 CleanupStack::PopAndDestroy( setting ); |
|
1229 } |
|
1230 |
|
1231 TRACE_EXIT_POINT; |
|
1232 return useWeeks; |
|
1233 } |
|
1234 |
|
1235 // ---------------------------------------------------------------------------- |
|
1236 // CCalenMonthContainer::LayoutVariantIndex |
|
1237 // ---------------------------------------------------------------------------- |
|
1238 // |
|
1239 TInt CCalenMonthContainer::LayoutVariantIndex(TMonthLayoutVariant aLayout) const |
|
1240 { |
|
1241 TRACE_ENTRY_POINT; |
|
1242 |
|
1243 TBitFlags layoutFlags = iLayoutManager->LayoutFlags(); |
|
1244 |
|
1245 TInt layoutVariant (ENoLayoutVariantSet); |
|
1246 switch (aLayout) |
|
1247 { |
|
1248 case ENoLayoutVariantSet: |
|
1249 { |
|
1250 ASSERT(EFalse); |
|
1251 } |
|
1252 case EMainCaleMonthPane: |
|
1253 { |
|
1254 if( layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerToolbar ) ) |
|
1255 layoutVariant = 1; |
|
1256 else |
|
1257 layoutVariant = 0; |
|
1258 break; |
|
1259 } |
|
1260 case ECaleMonthPaneT1: |
|
1261 { |
|
1262 if( layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerToolbar ) ) |
|
1263 { |
|
1264 if(UseWeeks() && layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerInfobar )) |
|
1265 layoutVariant = 2; |
|
1266 else if( layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerInfobar )) |
|
1267 layoutVariant = 3; |
|
1268 else |
|
1269 __ASSERT_DEBUG(0, User::Invariant()); |
|
1270 } |
|
1271 else |
|
1272 { |
|
1273 if(UseWeeks() && layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerInfobar )) |
|
1274 layoutVariant = 0; |
|
1275 else if( layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerInfobar )) |
|
1276 layoutVariant = 1; |
|
1277 else |
|
1278 __ASSERT_DEBUG(0, User::Invariant()); |
|
1279 } |
|
1280 break; |
|
1281 } |
|
1282 case ECaleMonthWeekPane: |
|
1283 case ECaleMonthPaneG2: |
|
1284 { |
|
1285 if( layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerToolbar ) ) |
|
1286 { |
|
1287 if(UseWeeks() && layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerInfobar )) |
|
1288 layoutVariant = 3; |
|
1289 else if(UseWeeks()) |
|
1290 layoutVariant = 2; |
|
1291 else |
|
1292 __ASSERT_DEBUG(0, User::Invariant()); |
|
1293 } |
|
1294 else |
|
1295 { |
|
1296 if(UseWeeks() && layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerInfobar )) |
|
1297 layoutVariant = 1; |
|
1298 else if(UseWeeks()) |
|
1299 layoutVariant = 0; |
|
1300 else |
|
1301 __ASSERT_DEBUG(0, User::Invariant()); |
|
1302 } |
|
1303 break; |
|
1304 } |
|
1305 case EBgCalePaneCp02: |
|
1306 case ECaleMonthDayHeadingPane: |
|
1307 case EGridCaleMonthPane: |
|
1308 case ECaleMonthPaneG: |
|
1309 case ECaleMonthPaneG1: |
|
1310 case ECaleMonthPaneG3: |
|
1311 case ECaleMonthPaneG9: |
|
1312 case EBgCaleHeadingPaneCp01: |
|
1313 case ECaleMonthDayHeadingPaneT: |
|
1314 case ECellCaleMonthPane: |
|
1315 { |
|
1316 if( layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerToolbar ) ) |
|
1317 { |
|
1318 if(UseWeeks() && layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerInfobar )) |
|
1319 layoutVariant = 6; |
|
1320 else if ( layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerInfobar )) |
|
1321 layoutVariant = 7; |
|
1322 else if(UseWeeks()) |
|
1323 layoutVariant = 4; |
|
1324 else |
|
1325 layoutVariant = 5; |
|
1326 } |
|
1327 else |
|
1328 { |
|
1329 if(UseWeeks() && layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerInfobar )) |
|
1330 layoutVariant = 2; |
|
1331 else if (layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerInfobar )) |
|
1332 layoutVariant = 3; |
|
1333 else if(UseWeeks()) |
|
1334 layoutVariant = 0; |
|
1335 else |
|
1336 layoutVariant = 1; |
|
1337 } |
|
1338 break; |
|
1339 } |
|
1340 |
|
1341 case ECaleMonthWeekPaneT: |
|
1342 case EBgCaleSidePaneCp01: |
|
1343 { |
|
1344 if( layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerToolbar ) ) |
|
1345 { |
|
1346 if(layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerInfobar )) |
|
1347 layoutVariant = 3; |
|
1348 else |
|
1349 layoutVariant = 2; |
|
1350 } |
|
1351 else |
|
1352 { |
|
1353 if(layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerInfobar )) |
|
1354 layoutVariant = 1; |
|
1355 else |
|
1356 layoutVariant = 0; |
|
1357 } |
|
1358 break; |
|
1359 } |
|
1360 |
|
1361 case ECellCaleMonthPaneG1: |
|
1362 { |
|
1363 if( layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerToolbar ) ) |
|
1364 { |
|
1365 if(UseWeeks() && layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerInfobar )) |
|
1366 layoutVariant = 6; |
|
1367 else if(layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerInfobar )) |
|
1368 layoutVariant = 7; |
|
1369 else if(UseWeeks()) |
|
1370 layoutVariant = 4; |
|
1371 else |
|
1372 layoutVariant = 5; |
|
1373 } |
|
1374 else |
|
1375 { |
|
1376 if(UseWeeks() && layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerInfobar )) |
|
1377 layoutVariant = 2; |
|
1378 else if(layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerInfobar )) |
|
1379 layoutVariant = 3; |
|
1380 else if(UseWeeks()) |
|
1381 layoutVariant = 0; |
|
1382 else |
|
1383 layoutVariant = 1; |
|
1384 } |
|
1385 break; |
|
1386 } |
|
1387 case ECellCaleMonthPaneT1: |
|
1388 { |
|
1389 if( layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerToolbar ) ) |
|
1390 { |
|
1391 if(UseWeeks() && layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerInfobar )) |
|
1392 layoutVariant = 7; |
|
1393 else if(layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerInfobar )) |
|
1394 layoutVariant = 8; |
|
1395 else if(UseWeeks()) |
|
1396 layoutVariant = 5; |
|
1397 else |
|
1398 layoutVariant = 6; |
|
1399 } |
|
1400 else |
|
1401 { |
|
1402 if(UseWeeks() && layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerInfobar )) |
|
1403 layoutVariant = 3; |
|
1404 else if(layoutFlags.IsSet( CCalenContainerLayoutManager::ECalenContainerInfobar )) |
|
1405 layoutVariant = 4; |
|
1406 else if(UseWeeks()) |
|
1407 layoutVariant = 0; |
|
1408 else |
|
1409 layoutVariant = 2; |
|
1410 } |
|
1411 break; |
|
1412 } |
|
1413 } |
|
1414 |
|
1415 TRACE_EXIT_POINT; |
|
1416 return layoutVariant; |
|
1417 } |
|
1418 |
|
1419 // ---------------------------------------------------------------------------- |
|
1420 // CCalenMonthContainer::DoEntryTimeCompareL |
|
1421 // ---------------------------------------------------------------------------- |
|
1422 // |
|
1423 TInt CCalenMonthContainer::DoEntryTimeCompareL( const CCalInstance& aInstance_1, |
|
1424 const CCalInstance& aInstance_2 ) |
|
1425 { |
|
1426 TRACE_ENTRY_POINT; |
|
1427 |
|
1428 TInt ret( EEqual ); |
|
1429 |
|
1430 TTime time_1; |
|
1431 TTime time_2; |
|
1432 |
|
1433 if( aInstance_1.Entry().EntryTypeL() == CCalEntry::ETodo ) |
|
1434 { |
|
1435 time_1 = aInstance_1.EndTimeL().TimeUtcL(); |
|
1436 } |
|
1437 else |
|
1438 { |
|
1439 time_1 = aInstance_1.StartTimeL().TimeUtcL(); |
|
1440 } |
|
1441 |
|
1442 if( aInstance_2.Entry().EntryTypeL() == CCalEntry::ETodo ) |
|
1443 { |
|
1444 time_2 = aInstance_2.EndTimeL().TimeUtcL(); |
|
1445 } |
|
1446 else |
|
1447 { |
|
1448 time_2 = aInstance_2.StartTimeL().TimeUtcL(); |
|
1449 } |
|
1450 |
|
1451 if( time_1 == time_2 ) |
|
1452 { |
|
1453 ret = EEqual; |
|
1454 } |
|
1455 else if( time_1 > time_2 ) |
|
1456 { |
|
1457 ret = EGreaterThan; // oldest first |
|
1458 } |
|
1459 else |
|
1460 { |
|
1461 ret = ELessThan; |
|
1462 } |
|
1463 |
|
1464 TRACE_EXIT_POINT; |
|
1465 return ret; |
|
1466 } |
|
1467 |
|
1468 // ---------------------------------------------------------------------------- |
|
1469 // Utility function to compare entry times, handles Todos correctly. |
|
1470 // ---------------------------------------------------------------------------- |
|
1471 // |
|
1472 TInt CCalenMonthContainer::EntryTimeCompare(const CCalInstance& aInstance_1, |
|
1473 const CCalInstance& aInstance_2) |
|
1474 { |
|
1475 TRACE_ENTRY_POINT; |
|
1476 |
|
1477 TInt ret( EEqual ); |
|
1478 PIM_TRAPD_HANDLE( (ret = DoEntryTimeCompareL(aInstance_1, aInstance_2)) ); |
|
1479 |
|
1480 TRACE_EXIT_POINT; |
|
1481 return ret; |
|
1482 } |
|
1483 |
|
1484 // ---------------------------------------------------------------------------- |
|
1485 // |
|
1486 // ---------------------------------------------------------------------------- |
|
1487 // |
|
1488 CCalenMonthView& CCalenMonthContainer::MonthView() const |
|
1489 { |
|
1490 TRACE_ENTRY_POINT; |
|
1491 |
|
1492 TRACE_EXIT_POINT; |
|
1493 return *(static_cast<CCalenMonthView*>(iView)); |
|
1494 } |
|
1495 |
|
1496 |
|
1497 // ---------------------------------------------------------------------------- |
|
1498 // CCalenMonthContainer::HandleNaviDecorationPointerEventL |
|
1499 // processing of a navi decoration event |
|
1500 // (other items were commented in a header). |
|
1501 // ---------------------------------------------------------------------------- |
|
1502 // |
|
1503 void CCalenMonthContainer::HandleNaviDecoratorEventL(TInt aEventID) |
|
1504 { |
|
1505 TRACE_ENTRY_POINT; |
|
1506 |
|
1507 if(AknLayoutUtils::PenEnabled()) |
|
1508 { |
|
1509 TInt direction(0); |
|
1510 if(aEventID == EAknNaviDecoratorEventLeftTabArrow) |
|
1511 { |
|
1512 if(AknLayoutUtils::LayoutMirrored()) |
|
1513 { |
|
1514 direction = 1; |
|
1515 } |
|
1516 else |
|
1517 { |
|
1518 direction = -1; |
|
1519 } |
|
1520 } |
|
1521 |
|
1522 else if(aEventID == EAknNaviDecoratorEventRightTabArrow) |
|
1523 { |
|
1524 if(AknLayoutUtils::LayoutMirrored()) |
|
1525 { |
|
1526 direction = -1; |
|
1527 } |
|
1528 else |
|
1529 { |
|
1530 direction = 1; |
|
1531 } |
|
1532 } |
|
1533 else |
|
1534 return; |
|
1535 /** |
|
1536 * Tapping of navi arrows in month view |
|
1537 * should change month. |
|
1538 */ |
|
1539 TTime newDay( iDate + TTimeIntervalMonths(direction) ); |
|
1540 |
|
1541 // test |
|
1542 TDateTime newDayTime = newDay.DateTime(); |
|
1543 |
|
1544 // set the context |
|
1545 TCalTime time; |
|
1546 time.SetTimeLocalL( newDay ); |
|
1547 iServices.Context().SetFocusDateL( time, |
|
1548 TVwsViewId( KUidCalendar, KUidCalenMonthView ) ); |
|
1549 |
|
1550 |
|
1551 if (!CalenDateUtils::IsValidDay(newDay)) |
|
1552 { |
|
1553 CalenViewUtils::ShowDateOutOfRangeErrorNoteL(); |
|
1554 } |
|
1555 else |
|
1556 { |
|
1557 iGrid->View()->SetDisableRedraw(ETrue); |
|
1558 iView->BeginRepopulationL(); |
|
1559 } |
|
1560 // Hide/unhide "today" toolbar item based on the focused day |
|
1561 UpdateTodayToolbarItemL(); |
|
1562 } |
|
1563 |
|
1564 TRACE_EXIT_POINT; |
|
1565 } |
|
1566 |
|
1567 // ---------------------------------------------------------------------------- |
|
1568 // CCalenMonthContainer::HandleWeekNumberTapL |
|
1569 // processing of a week number tap |
|
1570 // (other items were commented in a header). |
|
1571 // ---------------------------------------------------------------------------- |
|
1572 // |
|
1573 void CCalenMonthContainer::HandleWeekNumberTapL(const TPoint &aPosition) |
|
1574 { |
|
1575 TRACE_ENTRY_POINT; |
|
1576 |
|
1577 TInt layoutVariant( ENoLayoutVariantSet ); |
|
1578 if(AknLayoutUtils::PenEnabled()) |
|
1579 { |
|
1580 /* Steps to implement week number tapping |
|
1581 * 1. find out tapped row in week number area. |
|
1582 * 2. change current day of the week active in new row |
|
1583 * 3. open week view |
|
1584 */ |
|
1585 TRect main_pane( ReducePreview( Rect() ) ); |
|
1586 |
|
1587 TAknLayoutRect main_cale_month_pane; |
|
1588 layoutVariant = LayoutVariantIndex( EMainCaleMonthPane ); |
|
1589 main_cale_month_pane.LayoutRect(main_pane, |
|
1590 AknLayoutScalable_Apps::main_cale_month_pane(layoutVariant).LayoutLine()); |
|
1591 TAknLayoutRect cale_month_week_pane; |
|
1592 layoutVariant = LayoutVariantIndex( ECaleMonthWeekPane); |
|
1593 cale_month_week_pane.LayoutRect(main_cale_month_pane.Rect(), |
|
1594 AknLayoutScalable_Apps::cale_month_week_pane(layoutVariant).LayoutLine()); |
|
1595 if(cale_month_week_pane.Rect().Contains(aPosition)) |
|
1596 { |
|
1597 TInt tappedRow (0); |
|
1598 tappedRow = (aPosition.iY - cale_month_week_pane.Rect().iTl.iY)/ |
|
1599 (iGrid->View()->ItemSize(iGrid->CurrentItemIndex()).iHeight); |
|
1600 |
|
1601 TAknLayoutScalableTableLimits cale_month_week_pane_t_limits = |
|
1602 AknLayoutScalable_Apps::cale_month_week_pane_t_Limits(); |
|
1603 if(tappedRow > cale_month_week_pane_t_limits.LastIndex()) |
|
1604 tappedRow = cale_month_week_pane_t_limits.LastIndex(); |
|
1605 |
|
1606 TTime newWeekFirst(iFirstDayOfGrid + |
|
1607 TTimeIntervalDays(KCalenDaysInWeek * tappedRow)); |
|
1608 iDate = newWeekFirst; |
|
1609 TInt direction = newWeekFirst.WeekNoInYear() - |
|
1610 iDate.WeekNoInYear(); |
|
1611 |
|
1612 TTime newActiveDay(iDate + |
|
1613 TTimeIntervalDays(KCalenDaysInWeek * direction)); |
|
1614 if ( !CalenDateUtils::IsValidDay(newActiveDay) ) |
|
1615 { |
|
1616 CalenViewUtils::ShowDateOutOfRangeErrorNoteL(); |
|
1617 return; |
|
1618 } |
|
1619 |
|
1620 // set the context |
|
1621 TCalTime time; |
|
1622 time.SetTimeLocalL( newActiveDay ); |
|
1623 iServices.Context().SetFocusDateL( time, |
|
1624 TVwsViewId( KUidCalendar, KUidCalenMonthView ) ); |
|
1625 |
|
1626 SetActiveDayL( newActiveDay ); |
|
1627 iServices.IssueCommandL( ECalenWeekView ); |
|
1628 } |
|
1629 } |
|
1630 |
|
1631 TRACE_EXIT_POINT; |
|
1632 } |
|
1633 |
|
1634 // ---------------------------------------------------------------------------- |
|
1635 // CCalenMonthContainer::HandleLongTapEventL |
|
1636 // processing of a long tap event |
|
1637 // (other items were commented in a header). |
|
1638 // ---------------------------------------------------------------------------- |
|
1639 // |
|
1640 void CCalenMonthContainer::HandleLongTapEventL( const TPoint& /*aPenEventLocation*/, |
|
1641 const TPoint& /*aPenEventScreenLocation*/ ) |
|
1642 { |
|
1643 TRACE_ENTRY_POINT; |
|
1644 |
|
1645 |
|
1646 TRACE_EXIT_POINT; |
|
1647 } |
|
1648 |
|
1649 // ---------------------------------------------------------------------------- |
|
1650 // CCalenMonthContainer::HandlePointerEventL |
|
1651 // processing of a pointer event |
|
1652 // (other items were commented in a header). |
|
1653 // ---------------------------------------------------------------------------- |
|
1654 // |
|
1655 void CCalenMonthContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
1656 { |
|
1657 TRACE_ENTRY_POINT; |
|
1658 |
|
1659 if(AknLayoutUtils::PenEnabled()) |
|
1660 { |
|
1661 TInt pointerIndex(-1); |
|
1662 TBool isItem (iGrid->View()->XYPosToItemIndex(aPointerEvent.iPosition, pointerIndex)); |
|
1663 CAknGridM* gridModel = static_cast<CAknGridM*>(iGrid->Model()); |
|
1664 |
|
1665 if(gridModel->NumberOfData() <= 0) |
|
1666 return; |
|
1667 |
|
1668 if(isItem == EFalse) |
|
1669 /* Handle pointer event in week number area */ |
|
1670 { |
|
1671 switch(aPointerEvent.iType) |
|
1672 { |
|
1673 case TPointerEvent::EButton1Down: |
|
1674 { |
|
1675 HandleWeekNumberTapL(aPointerEvent.iPosition); |
|
1676 break; |
|
1677 } |
|
1678 default: |
|
1679 break; |
|
1680 } |
|
1681 } |
|
1682 else |
|
1683 /* Handle pointer event in months day area */ |
|
1684 { |
|
1685 |
|
1686 RDebug::Print( _L("pointerEvent.iModifiers = 0x%08x"), |
|
1687 aPointerEvent.iModifiers ); |
|
1688 // Event modifiers are ignored for now because |
|
1689 // those are not needed but cause problems |
|
1690 TPointerEvent pointerEvent( aPointerEvent ); |
|
1691 pointerEvent.iModifiers = |
|
1692 ( aPointerEvent.iModifiers & ( ~EAllModifiers ) ); |
|
1693 TInt index( iGrid->CurrentItemIndex() ); |
|
1694 TTime isValidDay; |
|
1695 if( TPointerEvent::EButton1Up == aPointerEvent.iType ) |
|
1696 { |
|
1697 isValidDay = iOldFirstDayOfGrid + |
|
1698 TTimeIntervalDays(pointerIndex); |
|
1699 } |
|
1700 else |
|
1701 { |
|
1702 iOldFirstDayOfGrid = iFirstDayOfGrid; |
|
1703 isValidDay = iFirstDayOfGrid + |
|
1704 TTimeIntervalDays(pointerIndex); |
|
1705 } |
|
1706 if (!CalenDateUtils::IsValidDay(isValidDay)) |
|
1707 { |
|
1708 if( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
1709 { |
|
1710 CalenViewUtils::ShowDateOutOfRangeErrorNoteL(); |
|
1711 } |
|
1712 TRACE_EXIT_POINT; |
|
1713 return; |
|
1714 } |
|
1715 |
|
1716 if ( aPointerEvent.iType == TPointerEvent::EButton1Down |
|
1717 || aPointerEvent.iType == TPointerEvent::EDrag ) |
|
1718 { |
|
1719 TTime newActiveDay( |
|
1720 iDate + TTimeIntervalDays( pointerIndex - index ) ); |
|
1721 TDateTime newActiveDayTime = newActiveDay.DateTime(); |
|
1722 |
|
1723 // set the context |
|
1724 TCalTime time; |
|
1725 time.SetTimeLocalL( newActiveDay ); |
|
1726 iServices.Context().SetFocusDateL( time, |
|
1727 TVwsViewId( KUidCalendar, KUidCalenMonthView ) ); |
|
1728 TMonth activeMonth( iDate.DateTime().Month() ); |
|
1729 TMonth newMonth( newActiveDay.DateTime().Month() ); |
|
1730 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
1731 { |
|
1732 iGrid->HandlePointerEventL( pointerEvent ); |
|
1733 iPreview->Hide(); |
|
1734 if ( pointerIndex != index ) |
|
1735 { |
|
1736 iChangeMonth = EFalse; |
|
1737 if ( activeMonth != newMonth ) |
|
1738 { |
|
1739 iChangeMonth = ETrue; |
|
1740 iGrid->View()->SetDisableRedraw(ETrue); |
|
1741 iView->BeginRepopulationL(); |
|
1742 } |
|
1743 HandleDayChangeL( newActiveDay ); |
|
1744 } |
|
1745 } |
|
1746 else if ( activeMonth == newMonth |
|
1747 && newActiveDay != iDate && !iChangeMonth ) |
|
1748 { |
|
1749 iGrid->HandlePointerEventL( pointerEvent ); |
|
1750 // use grid index to make sure that correct grid |
|
1751 // element is focused when dragged |
|
1752 TInt gridIndex = GridIndex(); |
|
1753 newActiveDay = |
|
1754 ( iFirstDayOfGrid + TTimeIntervalDays( gridIndex ) ); |
|
1755 HandleDayChangeL( newActiveDay ); |
|
1756 iChangeMonth = EFalse; |
|
1757 } |
|
1758 } |
|
1759 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
1760 { |
|
1761 iGrid->HandlePointerEventL( pointerEvent ); |
|
1762 } |
|
1763 } |
|
1764 } |
|
1765 |
|
1766 TRACE_EXIT_POINT; |
|
1767 } |
|
1768 |
|
1769 |
|
1770 |
|
1771 // ---------------------------------------------------------------------------- |
|
1772 // CCalenMonthContainer::HandleListBoxEventL |
|
1773 // ---------------------------------------------------------------------------- |
|
1774 // |
|
1775 void CCalenMonthContainer::HandleListBoxEventL( |
|
1776 CEikListBox* /*aListBox*/, TListBoxEvent aEventType ) |
|
1777 { |
|
1778 switch ( aEventType ) |
|
1779 { |
|
1780 case ( MEikListBoxObserver::EEventItemDoubleClicked ): |
|
1781 { |
|
1782 if ( !iView->MenuBar()->IsDisplayed() ) |
|
1783 { |
|
1784 iServices.IssueCommandL( ECalenForwardsToDayView ); |
|
1785 } |
|
1786 break; |
|
1787 } |
|
1788 } |
|
1789 } |
|
1790 |
|
1791 |
|
1792 |
|
1793 void CCalenMonthContainer::HidePopup() |
|
1794 { |
|
1795 TRACE_ENTRY_POINT; |
|
1796 |
|
1797 iPreview->Hide(); |
|
1798 |
|
1799 TRACE_EXIT_POINT; |
|
1800 } |
|
1801 |
|
1802 // ---------------------------------------------------------------------------- |
|
1803 // CCalenMonthContainer::RedrawPreviewPane |
|
1804 // Redraws the preview pane |
|
1805 // ---------------------------------------------------------------------------- |
|
1806 void CCalenMonthContainer::RedrawPreviewPane() |
|
1807 { |
|
1808 // dont focus the preview popup/previewpane if any dialog or faster app is active |
|
1809 if(iPreview && ! iView->IsEditorActiveOrFasterAppExit()) |
|
1810 { |
|
1811 TRAPD(error,iPreview->FocusChangedL( iServices.Context().FocusDateAndTimeL().TimeLocalL() ) ); |
|
1812 if(error!=KErrNone) |
|
1813 { |
|
1814 // Do nothing to avoid warning |
|
1815 } |
|
1816 } |
|
1817 } |
|
1818 |
|
1819 // ---------------------------------------------------------------------------- |
|
1820 // CCalenMonthContainer::PrepareForPopulationL |
|
1821 // First population step (with no instance view). |
|
1822 // (other items were commented in a header). |
|
1823 // ---------------------------------------------------------------------------- |
|
1824 // |
|
1825 void CCalenMonthContainer::PrepareForPopulationL() |
|
1826 { |
|
1827 TRACE_ENTRY_POINT; |
|
1828 |
|
1829 iGrid->View()->SetDisableRedraw( ETrue ); |
|
1830 HidePopup(); |
|
1831 UpdateSize(); |
|
1832 SetActiveDayL( CCalenContainer::DateFromContextL( iServices.Context() ) ); |
|
1833 SetDateL(); |
|
1834 |
|
1835 TRACE_EXIT_POINT; |
|
1836 } |
|
1837 |
|
1838 // ---------------------------------------------------------------------------- |
|
1839 // CCalenMonthContainer::PopulateWithInstanceViewL |
|
1840 // Second population step (first with instance view). |
|
1841 // Populates data from agenda server and sets number of notes. |
|
1842 // (other items were commented in a header). |
|
1843 // ---------------------------------------------------------------------------- |
|
1844 // |
|
1845 void CCalenMonthContainer::PopulateWithInstanceViewL() |
|
1846 { |
|
1847 TRACE_ENTRY_POINT; |
|
1848 RArray<TInt> colIdArray; |
|
1849 CCalenNativeView::GetActiveCollectionidsL( iServices, colIdArray ); |
|
1850 |
|
1851 CCalInstanceView* instView = NULL; |
|
1852 if( colIdArray.Count() > 0 ) |
|
1853 { |
|
1854 instView = iServices.InstanceViewL( colIdArray ); |
|
1855 } |
|
1856 |
|
1857 colIdArray.Reset(); |
|
1858 |
|
1859 if( !instView ) |
|
1860 { |
|
1861 TRACE_EXIT_POINT; |
|
1862 return; |
|
1863 } |
|
1864 |
|
1865 // 1) Find passed incompleted todos |
|
1866 RPointerArray<CCalInstance> list; |
|
1867 CleanupResetAndDestroyPushL( list ); |
|
1868 |
|
1869 TCalTime dummy; |
|
1870 CalCommon::TCalTimeRange dayRange( dummy, dummy ); |
|
1871 |
|
1872 const TTime today( CalenDateUtils::Today() ); |
|
1873 const TTime gridStart( CalenDateUtils::BeginningOfDay( iFirstDayOfGrid ) ); |
|
1874 |
|
1875 const TInt todayIndex( today.DaysFrom( gridStart ).Int() ); // grid index for "today" |
|
1876 const TInt cellCount( KCalenDaysInWeek * KNumberOfRows ); |
|
1877 |
|
1878 CalCommon::TCalViewFilter filter; |
|
1879 |
|
1880 //If we are viewing months in the past |
|
1881 if( todayIndex >= cellCount ) |
|
1882 { |
|
1883 filter = CalCommon::EIncludeEvents | |
|
1884 CalCommon::EIncludeAppts | |
|
1885 CalCommon::EIncludeReminder | |
|
1886 CalCommon::EIncludeAnnivs; |
|
1887 } |
|
1888 else //else we are viewing current or future months |
|
1889 { |
|
1890 filter = CalCommon::EIncludeEvents | |
|
1891 CalCommon::EIncludeIncompletedTodos | |
|
1892 CalCommon::EIncludeAppts | |
|
1893 CalCommon::EIncludeReminder | |
|
1894 CalCommon::EIncludeAnnivs; |
|
1895 } |
|
1896 |
|
1897 // Find To Dos, Meetings, Reminders, Anniversaries and Day Notes |
|
1898 CalenDateUtils::GetDayRangeL( gridStart, |
|
1899 gridStart + TTimeIntervalDays(cellCount-1), |
|
1900 dayRange ); |
|
1901 instView->FindInstanceL( list, filter, dayRange ); |
|
1902 |
|
1903 //Parse fetched items |
|
1904 if( list.Count() ) |
|
1905 { |
|
1906 CCalInstance* instance = NULL; |
|
1907 for (TInt i(0); i < list.Count(); i++) |
|
1908 { |
|
1909 instance = list[i]; |
|
1910 CCalEntry& entry = instance->Entry(); |
|
1911 //Parse Day Notes, Appointments and Reminders |
|
1912 //Start and end time of Event/Appointment/Reminders has to be indentified before marking the tags |
|
1913 //EEvents/Appointments can span multiple days, while Anniversaries cannot. |
|
1914 if( ( entry.EntryTypeL() == CCalEntry::EEvent ) || |
|
1915 ( entry.EntryTypeL() == CCalEntry::EAppt ) || |
|
1916 ( entry.EntryTypeL() == CCalEntry::EReminder ) ) |
|
1917 { |
|
1918 // The start time of the instance |
|
1919 TTime instStartTime = instance->StartTimeL().TimeLocalL(); |
|
1920 // The instance's start index from the grid start |
|
1921 TInt startIndex(instStartTime.DaysFrom(gridStart).Int()); |
|
1922 // The end time of the instance |
|
1923 TTime instEndTime = instance->EndTimeL().TimeLocalL(); |
|
1924 |
|
1925 if( CalenAgendaUtils::EndsAtStartOfDayL( instance, instEndTime ) ) |
|
1926 { |
|
1927 // prevent problems with items ending tomorrow at 00:00 |
|
1928 instEndTime -= TTimeIntervalMinutes( 1 ); |
|
1929 |
|
1930 if( instEndTime <= gridStart ) |
|
1931 { |
|
1932 // ends at the start of the grid -> not visible |
|
1933 continue; // skip |
|
1934 } |
|
1935 } |
|
1936 // The instance's end index from the grid start |
|
1937 TInt endIndex(instEndTime.DaysFrom(gridStart).Int()); |
|
1938 |
|
1939 // Mark the days from start index to end index |
|
1940 for( ; startIndex <= endIndex; startIndex++) |
|
1941 { |
|
1942 if( startIndex >= 0 && startIndex < cellCount ) |
|
1943 { |
|
1944 iMonthDataArray->At( startIndex ).SetHasEvents( ETrue ); |
|
1945 } |
|
1946 } |
|
1947 } |
|
1948 //Parse Anniversaries |
|
1949 else if( entry.EntryTypeL() == CCalEntry::EAnniv ) |
|
1950 { |
|
1951 // The start time of the instance |
|
1952 TTime instStartTime = instance->StartTimeL().TimeLocalL(); |
|
1953 // The instance's start index from the grid start |
|
1954 TInt index(instStartTime.DaysFrom(gridStart).Int()); |
|
1955 // Mark the particular day |
|
1956 if( index >= 0 && index < cellCount) |
|
1957 { |
|
1958 iMonthDataArray->At( index ).SetHasEvents( ETrue ); |
|
1959 } |
|
1960 } |
|
1961 //Parse To DOs |
|
1962 else if( entry.EntryTypeL() == CCalEntry::ETodo ) |
|
1963 { |
|
1964 // The start time of the instance |
|
1965 TTime instStartTime = instance->StartTimeL().TimeLocalL(); |
|
1966 TInt index; |
|
1967 // Mark the particular day if the instance's start time is not in the past |
|
1968 if( instStartTime >= today ) |
|
1969 { |
|
1970 index = instStartTime.DaysFrom(gridStart).Int(); |
|
1971 } |
|
1972 else // Mark for today if the instance's start time is in the past |
|
1973 { |
|
1974 index = todayIndex; |
|
1975 } |
|
1976 if( index >= 0 && index < cellCount) |
|
1977 { |
|
1978 iMonthDataArray->At( index ).SetHasEvents( ETrue ); |
|
1979 } |
|
1980 } |
|
1981 } |
|
1982 } |
|
1983 list.ResetAndDestroy(); |
|
1984 |
|
1985 //Fetch incomplete To Dos if todayindex is not marked |
|
1986 if( todayIndex >= 0 && todayIndex < cellCount ) |
|
1987 { |
|
1988 // If today is not marked |
|
1989 if( !iMonthDataArray->At( todayIndex ).HasEvents() ) |
|
1990 { |
|
1991 // Find incomplete ToDos from MinTime() to end of this month |
|
1992 CalenDateUtils::GetDayRangeL( TCalTime::MinTime(), |
|
1993 today, |
|
1994 dayRange ); |
|
1995 instView->FindInstanceL( list, CalCommon::EIncludeIncompletedTodos | |
|
1996 // only fetch the first instance for repeating to-dos! |
|
1997 CalCommon::EIncludeRptsNextInstanceOnly, dayRange ); |
|
1998 |
|
1999 // If there exists any To do, the mark for today |
|
2000 if( list.Count() ) |
|
2001 { |
|
2002 iMonthDataArray->At( todayIndex ).SetHasEvents( ETrue ); |
|
2003 } |
|
2004 list.ResetAndDestroy(); |
|
2005 } |
|
2006 } |
|
2007 CleanupStack::PopAndDestroy( &list ); |
|
2008 |
|
2009 TRACE_EXIT_POINT; |
|
2010 } |
|
2011 |
|
2012 // ---------------------------------------------------------------------------- |
|
2013 // CCalenMonthContainer::SetIndicatorL |
|
2014 // Set event indicator to each day. |
|
2015 // Third population step (second with instance view). |
|
2016 // (other items were commented in a header). |
|
2017 // ---------------------------------------------------------------------------- |
|
2018 // |
|
2019 void CCalenMonthContainer::SetIndicatorL() |
|
2020 { |
|
2021 TRACE_ENTRY_POINT; |
|
2022 |
|
2023 // set data for note's indicators |
|
2024 CDesCArray* itemArray = |
|
2025 static_cast<CDesCArray*>( iGrid->Model()->ItemTextArray() ); |
|
2026 itemArray->Reset(); |
|
2027 |
|
2028 TDateTime currentTime( iDate.DateTime() ); |
|
2029 TInt days(Time::DaysInMonth(currentTime.Year(), currentTime.Month())); |
|
2030 TLocale locale; |
|
2031 TTime firstDay(iDate - |
|
2032 TTimeIntervalDays(iDate.DayNoInMonth())); |
|
2033 TInt start(firstDay.DayNoInWeek() - locale.StartOfWeek()); |
|
2034 if (start < 0) |
|
2035 { |
|
2036 start += KCalenDaysInWeek; |
|
2037 } |
|
2038 TInt end(days + start); |
|
2039 |
|
2040 TInt i(0); |
|
2041 for ( ; i < KNumberOfRows * KCalenDaysInWeek; ++i ) |
|
2042 { |
|
2043 TBuf<16> data; // Enough for day number (2) + '\t' + icon number |
|
2044 TCalenMonthData orgData(iMonthDataArray->At(i)); |
|
2045 TTime time(orgData.Day()); |
|
2046 time.FormatL(data, iDayFormat); |
|
2047 |
|
2048 TIconIndex iconIndex = EIconNull; |
|
2049 if (orgData.HasEvents()) |
|
2050 { |
|
2051 if (i < start || i >= end ) |
|
2052 { |
|
2053 iconIndex = EIconGrayed; |
|
2054 } |
|
2055 else |
|
2056 { |
|
2057 iconIndex = EIconMany; |
|
2058 } |
|
2059 } |
|
2060 else |
|
2061 { |
|
2062 iconIndex = EIconNull; |
|
2063 } |
|
2064 |
|
2065 TBuf<3> icon; |
|
2066 icon.Num(static_cast<TInt64>(iconIndex)); |
|
2067 data.Append(icon); |
|
2068 |
|
2069 itemArray->AppendL(data); |
|
2070 } |
|
2071 iGrid->HandleItemAdditionL(); |
|
2072 |
|
2073 // if month of item of index is same as month of active day, |
|
2074 // then item is selected,if not, item is deselected. |
|
2075 // Deselected items will be writted in light. |
|
2076 for ( i = 0; i < KNumberOfRows * KCalenDaysInWeek; ++i ) |
|
2077 { |
|
2078 TCalenMonthData orgData(iMonthDataArray->At(i)); |
|
2079 TTime time(orgData.Day()); |
|
2080 |
|
2081 TInt listBoxIndex(static_cast<CAknGridView*>( |
|
2082 iGrid->View())->ListBoxIndex(i)); |
|
2083 |
|
2084 if (time.DateTime().Month() == iDate.DateTime().Month()) |
|
2085 { |
|
2086 iGrid->View()->SelectItemL(listBoxIndex); |
|
2087 } |
|
2088 else |
|
2089 { |
|
2090 iGrid->View()->DeselectItem(listBoxIndex); |
|
2091 } |
|
2092 } |
|
2093 |
|
2094 TRACE_EXIT_POINT; |
|
2095 } |
|
2096 |
|
2097 // ---------------------------------------------------------------------------- |
|
2098 // CCalenMonthContainer::SetFocusL |
|
2099 // Sets the current focus. |
|
2100 // Fourth population step (third with instance view). |
|
2101 // (other items were commented in a header). |
|
2102 // ---------------------------------------------------------------------------- |
|
2103 // |
|
2104 void CCalenMonthContainer::SetFocusL() |
|
2105 { |
|
2106 TRACE_ENTRY_POINT; |
|
2107 |
|
2108 SetActiveDayL( CCalenContainer::DateFromContextL( iServices.Context() ) ); |
|
2109 iGrid->View()->SetDisableRedraw( EFalse ); |
|
2110 SetCursorToActiveDay(); |
|
2111 DrawDeferred(); |
|
2112 |
|
2113 TRACE_EXIT_POINT; |
|
2114 } |
|
2115 |
|
2116 // ---------------------------------------------------------------------------- |
|
2117 // CCalenMonthContainer::CompletePopulationL |
|
2118 // Completes population. |
|
2119 // Fifth population step (fourth with instance view). |
|
2120 // (other items were commented in a header). |
|
2121 // ---------------------------------------------------------------------------- |
|
2122 // |
|
2123 void CCalenMonthContainer::CompletePopulationL() |
|
2124 { |
|
2125 TRACE_ENTRY_POINT; |
|
2126 |
|
2127 AddToStackAndMakeVisibleL(); |
|
2128 |
|
2129 iView->SetEditorActive( EFalse ); |
|
2130 |
|
2131 // dont focus the preview popup/previewpane if any dialog or faster app is active |
|
2132 if(!iView->IsEditorActiveOrFasterAppExit()) |
|
2133 { |
|
2134 // preview popup is shown when application comes to foreground |
|
2135 iPreview->FocusChangedL( iServices.Context().FocusDateAndTimeL().TimeLocalL() ); |
|
2136 } |
|
2137 |
|
2138 UpdateStatusPaneAndExtensionsL(); |
|
2139 // Hide/unhide "today" toolbar item based on the focused day |
|
2140 UpdateTodayToolbarItemL(); |
|
2141 TRACE_EXIT_POINT; |
|
2142 } |
|
2143 |
|
2144 // ---------------------------------------------------------------------------- |
|
2145 // CCalenMonthContainer::InfoBarRectL |
|
2146 // Returns the available info bar rect for this container |
|
2147 // ---------------------------------------------------------------------------- |
|
2148 TRect CCalenMonthContainer::InfoBarRectL( TBool aToolbarAvailable ) |
|
2149 { |
|
2150 TRACE_ENTRY_POINT; |
|
2151 |
|
2152 TRect rect = Rect(); |
|
2153 |
|
2154 // Get the main pane |
|
2155 TAknLayoutRect main_cale_month_pane; |
|
2156 main_cale_month_pane.LayoutRect( Rect(), |
|
2157 AknLayoutScalable_Apps::main_cale_month_pane().LayoutLine() ); |
|
2158 |
|
2159 TRect monthrect = main_cale_month_pane.Rect(); |
|
2160 |
|
2161 // Create a dummy label to find the layout rect |
|
2162 CEikLabel* dummyLabel = new( ELeave ) CEikLabel; |
|
2163 CleanupStack::PushL( dummyLabel ); |
|
2164 |
|
2165 // Get the layout variant for the month view infobar. |
|
2166 // We assume that we have one for this check, as we need to |
|
2167 // find the size that would be available if we do have one. |
|
2168 TInt layoutVariant = 0; |
|
2169 if( aToolbarAvailable ) |
|
2170 { |
|
2171 layoutVariant = UseWeeks() ? 2 : 3 ; |
|
2172 } |
|
2173 else |
|
2174 { |
|
2175 layoutVariant = UseWeeks() ? 0 : 1 ; |
|
2176 } |
|
2177 |
|
2178 // Layout the dummy label to set its size |
|
2179 AknLayoutUtils::LayoutLabel( dummyLabel, main_cale_month_pane.Rect(), |
|
2180 AknLayoutScalable_Apps::cale_month_pane_t1( layoutVariant ).LayoutLine() ); |
|
2181 |
|
2182 TRect infoRect = dummyLabel->Rect(); |
|
2183 //TRect rect1; |
|
2184 |
|
2185 // Discard the label |
|
2186 CleanupStack::PopAndDestroy( dummyLabel ); |
|
2187 |
|
2188 TRACE_EXIT_POINT; |
|
2189 return infoRect; |
|
2190 } |
|
2191 |
|
2192 // ---------------------------------------------------------------------------- |
|
2193 // CCalenMonthContainer::CreateIconIndicesL |
|
2194 // Create icon index for day view |
|
2195 // ---------------------------------------------------------------------------- |
|
2196 void CCalenMonthContainer::CreateIconIndicesL( RArray<MCalenServices::TCalenIcons>& aIndexArray) |
|
2197 { |
|
2198 TRACE_ENTRY_POINT; |
|
2199 // Icons needed for the day view |
|
2200 aIndexArray.Reset(); |
|
2201 aIndexArray.AppendL( MCalenServices::ECalenMonthManyEventIcon ); |
|
2202 aIndexArray.AppendL( MCalenServices::ECalenMonthGrayedEventIcon ); |
|
2203 |
|
2204 TRACE_EXIT_POINT; |
|
2205 } |
|
2206 |
|
2207 // End of File |