|
1 /* |
|
2 * Copyright (c) 2009 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 : Implemrntation class for calenlistdialog . |
|
15 */ |
|
16 |
|
17 //System include |
|
18 #include <calsession.h> |
|
19 #include <calentryview.h> |
|
20 #include <calcalendarinfo.h> |
|
21 #include <StringLoader.h> |
|
22 #include <AknsBasicBackgroundControlContext.h> |
|
23 #include <aknconsts.h> |
|
24 #include <AknIconArray.h> |
|
25 #include <aknlists.h> |
|
26 #include <akntitle.h> |
|
27 #include <eikclbd.h> |
|
28 #include <aknnavi.h> |
|
29 #include <aknlayoutscalable_apps.cdl.h> |
|
30 #include <layoutmetadata.cdl.h> |
|
31 #include <data_caging_path_literals.hrh> |
|
32 #include <pathinfo.h> |
|
33 #include <bautils.h> |
|
34 #include <aknenv.h> |
|
35 #include <eikapp.h> |
|
36 #include <eikenv.h> |
|
37 #include <gulicon.h> |
|
38 #include <multicaluidialog.rsg> |
|
39 #include <multicaluidialog.mbg> |
|
40 #include <AknDialog.h> |
|
41 //User include |
|
42 #include "caluidialogimpl.h" |
|
43 #include "multicaluidialogmodel.h" |
|
44 #include "calendarui_debug.h" |
|
45 #include "calendar.hrh" |
|
46 |
|
47 // ---------------------------------------------------------------------------- |
|
48 // CCalUiDialogImpl::CCalUiDialogImpl |
|
49 // (other items were commented in a header). |
|
50 // ---------------------------------------------------------------------------- |
|
51 // |
|
52 CCalUiDialogImpl::CCalUiDialogImpl() |
|
53 { |
|
54 TRACE_ENTRY_POINT |
|
55 |
|
56 TRACE_EXIT_POINT |
|
57 } |
|
58 |
|
59 // ---------------------------------------------------------------------------- |
|
60 // CCalUiDialogImpl::NewL |
|
61 // (other items were commented in a header). |
|
62 // ---------------------------------------------------------------------------- |
|
63 // |
|
64 CCalUiDialogImpl* CCalUiDialogImpl::NewL(const RPointerArray<CCalEntry>& |
|
65 aCalEntries) |
|
66 { |
|
67 TRACE_ENTRY_POINT |
|
68 CCalUiDialogImpl* self = CCalUiDialogImpl::NewLC(aCalEntries); |
|
69 CleanupStack::Pop(self); |
|
70 TRACE_EXIT_POINT |
|
71 return self; |
|
72 } |
|
73 |
|
74 // ---------------------------------------------------------------------------- |
|
75 // CCalUiDialogImpl::NewLC |
|
76 // (other items were commented in a header). |
|
77 // ---------------------------------------------------------------------------- |
|
78 // |
|
79 CCalUiDialogImpl* CCalUiDialogImpl::NewLC(const RPointerArray<CCalEntry>& |
|
80 aCalEntries) |
|
81 { |
|
82 TRACE_ENTRY_POINT |
|
83 CCalUiDialogImpl* self = new(ELeave) CCalUiDialogImpl(); |
|
84 CleanupStack::PushL(self); |
|
85 self->ConstructL(aCalEntries); |
|
86 TRACE_EXIT_POINT |
|
87 return self; |
|
88 } |
|
89 |
|
90 // ---------------------------------------------------------------------------- |
|
91 // CCalUiDialogImpl::~CCalUiDialogImpl |
|
92 // (other items were commented in a header). |
|
93 // ---------------------------------------------------------------------------- |
|
94 // |
|
95 CCalUiDialogImpl::~CCalUiDialogImpl() |
|
96 { |
|
97 TRACE_ENTRY_POINT |
|
98 |
|
99 if(iListBox) |
|
100 { |
|
101 iListBox->Reset(); |
|
102 delete iListBox; |
|
103 } |
|
104 |
|
105 if( iResourceFileOffset ) |
|
106 { |
|
107 CCoeEnv::Static()->DeleteResourceFile( iResourceFileOffset ); |
|
108 } |
|
109 |
|
110 // Don't set the title pane text. |
|
111 TRAP_IGNORE( SetTitlePaneL( EFalse ) ); |
|
112 |
|
113 if(iMultiCalUiDialogModel) |
|
114 { |
|
115 delete iMultiCalUiDialogModel; |
|
116 iMultiCalUiDialogModel = NULL; |
|
117 } |
|
118 |
|
119 iColorUidArray.Reset(); |
|
120 iColorUidArray.Close(); |
|
121 |
|
122 delete iDesArray; |
|
123 |
|
124 delete iBgContext; |
|
125 |
|
126 iAsyncExit->Cancel(); |
|
127 delete iAsyncExit; |
|
128 |
|
129 TRACE_EXIT_POINT |
|
130 } |
|
131 |
|
132 // ---------------------------------------------------------------------------- |
|
133 // CCalUiDialogImpl::ConstructL |
|
134 // (other items were commented in a header). |
|
135 // ---------------------------------------------------------------------------- |
|
136 // |
|
137 void CCalUiDialogImpl::ConstructL(const RPointerArray<CCalEntry>& aCalEntries) |
|
138 { |
|
139 TRACE_ENTRY_POINT |
|
140 |
|
141 TFileName fileName; |
|
142 // Get the complate path of the DLL from where it is currently loaded |
|
143 Dll::FileName( fileName ); |
|
144 |
|
145 TFileName resFile; |
|
146 TFileName iconFile; |
|
147 |
|
148 // Append the Drive letters ex., Z: or C: |
|
149 resFile.Append(fileName.Mid(0,2)); |
|
150 resFile.Append(KDC_RESOURCE_FILES_DIR); |
|
151 resFile.Append(KResourceFile); |
|
152 |
|
153 BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), resFile ); |
|
154 |
|
155 iResourceFileOffset = CEikonEnv::Static()->AddResourceFileL( resFile ); |
|
156 |
|
157 iIconFile.Append(fileName.Mid(0,2)); |
|
158 iIconFile.Append(KDC_APP_BITMAP_DIR); |
|
159 iIconFile.Append(KIconFile); |
|
160 |
|
161 //iIconFile = ((CEikAppUi*)CCoeEnv::Static()->AppUi())->Application()->BitmapStoreName(); |
|
162 |
|
163 iMultiCalUiDialogModel = CMultiCalUiDialogModel::NewL(); |
|
164 |
|
165 iMultiCalUiDialogModel->SetCalEntry(aCalEntries); |
|
166 |
|
167 // CAknDialog::ConstructL( R_CALEN_CALDB_MENUBAR ); |
|
168 CAknDialog::ConstructL( R_CALENDB_LIST_MENUBAR ); |
|
169 |
|
170 TCallBack callBack(CCalUiDialogImpl::DoAsyncExit,this); |
|
171 iAsyncExit = new(ELeave) CAsyncCallBack(callBack,CActive::EPriorityStandard); |
|
172 |
|
173 TRACE_EXIT_POINT |
|
174 } |
|
175 |
|
176 // ---------------------------------------------------------------------------- |
|
177 // CCalUiDialogImpl::LaunchCalenDbListDialogL |
|
178 // (other items were commented in a header). |
|
179 // ---------------------------------------------------------------------------- |
|
180 // |
|
181 TInt CCalUiDialogImpl::LaunchCalenDbListDialogL() |
|
182 { |
|
183 TRACE_ENTRY_POINT |
|
184 |
|
185 TInt returnVal( KErrNone ); |
|
186 |
|
187 returnVal = CAknDialog::ExecuteLD( R_CALENDB_LIST_SINGLESELECT_DIALOG ); |
|
188 |
|
189 |
|
190 TRACE_EXIT_POINT |
|
191 return returnVal; |
|
192 } |
|
193 |
|
194 // ---------------------------------------------------------------------------- |
|
195 // CCalUiDialogImpl::FocusChanged |
|
196 // (other items were commented in a header). |
|
197 // ---------------------------------------------------------------------------- |
|
198 // |
|
199 void CCalUiDialogImpl::FocusChanged( TDrawNow aDrawNow ) |
|
200 { |
|
201 TRACE_ENTRY_POINT; |
|
202 |
|
203 CAknDialog::FocusChanged( aDrawNow ); |
|
204 |
|
205 TRACE_EXIT_POINT; |
|
206 } |
|
207 |
|
208 // ---------------------------------------------------------------------------- |
|
209 // CCalUiDialogImpl::ConstructListL |
|
210 // (other items were commented in a header). |
|
211 // ---------------------------------------------------------------------------- |
|
212 // |
|
213 void CCalUiDialogImpl::ConstructListL() |
|
214 { |
|
215 TRACE_ENTRY_POINT; |
|
216 |
|
217 if(iDesArray && iListBox) |
|
218 { |
|
219 return; |
|
220 } |
|
221 |
|
222 iDesArray = new (ELeave) CDesCArrayFlat(5); |
|
223 iListBox = new (ELeave) CCalenDbListbox(iColorUidArray); |
|
224 iListBox->SetContainerWindowL( *this ); |
|
225 iListBox->ConstructL(this, 0 ); |
|
226 |
|
227 //Create scroll bar |
|
228 iListBox->CreateScrollBarFrameL(ETrue); |
|
229 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
230 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); |
|
231 |
|
232 CTextListBoxModel* model = iListBox->Model(); |
|
233 model->SetItemTextArray(iDesArray); |
|
234 model->SetOwnershipType(ELbmDoesNotOwnItemArray); |
|
235 |
|
236 iListBox->SetListBoxObserver( this ); |
|
237 |
|
238 iListBox->View()->SetListEmptyTextL( _L("No Items") ); |
|
239 |
|
240 TRACE_EXIT_POINT; |
|
241 } |
|
242 |
|
243 // ---------------------------------------------------------------------------- |
|
244 // CCalenMultipleDbUi::UpdateListboxL |
|
245 // (other items were commented in a header). |
|
246 // ---------------------------------------------------------------------------- |
|
247 // |
|
248 void CCalUiDialogImpl::UpdateListboxL() |
|
249 { |
|
250 TRACE_ENTRY_POINT; |
|
251 |
|
252 iListBox->View()->SetDisableRedraw( ETrue ); |
|
253 iDesArray->Reset(); |
|
254 iColorUidArray.Close(); |
|
255 |
|
256 RPointerArray<CCalCalendarInfo>& calendarInfoArray = |
|
257 iMultiCalUiDialogModel->GetCalendarInfoArray(); |
|
258 |
|
259 if( calendarInfoArray.Count() > 0 ) |
|
260 { |
|
261 //iListBox->ItemDrawer()->ColumnData()->SetIconArray( iIconsList ); |
|
262 |
|
263 for(TInt i = 0 ; i < calendarInfoArray.Count() ; i++) |
|
264 { |
|
265 TBuf<KMultiDbMaxLength> tempString; |
|
266 CCalCalendarInfo* calendarInfo = calendarInfoArray[i]; |
|
267 |
|
268 TPtrC nameBuf = calendarInfo->NameL(); |
|
269 |
|
270 //"%d\t%S\t%S\t%d" |
|
271 TBuf<10> icon; |
|
272 TInt iconIndex(1); |
|
273 icon.Format(KIconFormat,iconIndex); |
|
274 |
|
275 //tempString.Append(icon); |
|
276 |
|
277 tempString.Append(KListSeparatorFormat); |
|
278 tempString.Append(nameBuf); |
|
279 tempString.Append(KListSeparatorFormat); |
|
280 |
|
281 HBufC* strTemp = NULL; |
|
282 if(calendarInfo->Enabled()) |
|
283 { |
|
284 strTemp = StringLoader::LoadLC(R_CALEN_DB_VISIBLE,iCoeEnv); |
|
285 } |
|
286 else |
|
287 { |
|
288 strTemp = StringLoader::LoadLC(R_CALEN_DB_HIDDEN,iCoeEnv); |
|
289 } |
|
290 |
|
291 tempString.Append(strTemp->Des()); |
|
292 CleanupStack::PopAndDestroy(strTemp); |
|
293 |
|
294 tempString.Append(KListSeparatorFormat); |
|
295 |
|
296 //Collect color info to be used in itemdrawer for painting strip |
|
297 iColorUidArray.Append(calendarInfo->Color().Value()); |
|
298 |
|
299 iDesArray->AppendL(tempString); |
|
300 } |
|
301 } |
|
302 |
|
303 iListBox->View()->SetDisableRedraw( EFalse ); |
|
304 iListBox->HandleItemAdditionL(); //Update and draw listbox |
|
305 |
|
306 TRACE_EXIT_POINT; |
|
307 } |
|
308 |
|
309 // ----------------------------------------------------------------------------- |
|
310 // CCalUiDialogImpl::MarkUnmarkCalendarL |
|
311 // (other items were commented in a header). |
|
312 // ----------------------------------------------------------------------------- |
|
313 // |
|
314 void CCalUiDialogImpl::MarkUnmarkCalendarL() |
|
315 { |
|
316 TRACE_ENTRY_POINT |
|
317 |
|
318 TInt index = iListBox->CurrentItemIndex(); |
|
319 |
|
320 TBool status = EFalse; |
|
321 status = iMultiCalUiDialogModel->GetCalendarStatus(index); |
|
322 |
|
323 if(status) |
|
324 { |
|
325 status = EFalse; |
|
326 } |
|
327 else |
|
328 { |
|
329 status = ETrue; |
|
330 } |
|
331 |
|
332 iMultiCalUiDialogModel->SetCalendarStatus(index,status); |
|
333 |
|
334 TPtrC indexText = iDesArray->MdcaPoint(index); |
|
335 HBufC* formatText = indexText.AllocLC(); |
|
336 TPtr modified = formatText->Des(); |
|
337 modified[0] = status ? '0' : '1'; |
|
338 |
|
339 indexText.Set(modified); |
|
340 iDesArray->Delete(index); |
|
341 iDesArray->InsertL(index,indexText); |
|
342 |
|
343 iMultiCalUiDialogModel->StoreCalEntryL(); |
|
344 |
|
345 CleanupStack::PopAndDestroy(formatText); |
|
346 iAsyncExitCmd = ECalenSelectCmdOk; |
|
347 iAsyncExit->CallBack(); |
|
348 |
|
349 |
|
350 TRACE_EXIT_POINT |
|
351 } |
|
352 |
|
353 |
|
354 // ---------------------------------------------------------------------------- |
|
355 // CCalUiDialogImpl::SetTitlePaneL |
|
356 // (other items were commented in header.) |
|
357 // ---------------------------------------------------------------------------- |
|
358 // |
|
359 void CCalUiDialogImpl::SetTitlePaneL( TBool aCurrentState ) |
|
360 { |
|
361 TRACE_ENTRY_POINT; |
|
362 CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); |
|
363 |
|
364 // Set empty navi pane label |
|
365 iNaviContainer = static_cast<CAknNavigationControlContainer*>( |
|
366 sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
367 iNaviContainer->PushDefaultL(); |
|
368 |
|
369 // Set title text |
|
370 CAknTitlePane* tp = static_cast<CAknTitlePane*>( |
|
371 sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
372 |
|
373 if( aCurrentState ) |
|
374 { |
|
375 iTitlepaneText = ( *tp->Text() ); |
|
376 HBufC* titleText = StringLoader::LoadLC( R_CALEN_DB_LIST_TITLE , iCoeEnv ); |
|
377 tp->SetTextL( *titleText ); |
|
378 CleanupStack::PopAndDestroy( titleText ); |
|
379 } |
|
380 else |
|
381 { |
|
382 tp->SetTextL(iTitlepaneText); |
|
383 } |
|
384 TRACE_EXIT_POINT; |
|
385 } |
|
386 |
|
387 // ---------------------------------------------------------------------------- |
|
388 // CCalUiDialogImpl::DynInitMenuPaneL |
|
389 // (other items were commented in header.) |
|
390 // ---------------------------------------------------------------------------- |
|
391 // |
|
392 void CCalUiDialogImpl::DynInitMenuPaneL( TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/ ) |
|
393 { |
|
394 TRACE_ENTRY_POINT; |
|
395 |
|
396 TRACE_EXIT_POINT; |
|
397 } |
|
398 |
|
399 // ---------------------------------------------------------------------------- |
|
400 // CCalUiDialogImpl::ProcessCommandL |
|
401 // (other items were commented in header.) |
|
402 // ---------------------------------------------------------------------------- |
|
403 // |
|
404 void CCalUiDialogImpl::ProcessCommandL( TInt aCommandId ) |
|
405 { |
|
406 TRACE_ENTRY_POINT; |
|
407 |
|
408 CAknDialog::ProcessCommandL(aCommandId); |
|
409 |
|
410 switch(aCommandId) |
|
411 { |
|
412 case EAknSoftkeyMark: |
|
413 case ECalenCmdItemSelect: |
|
414 { |
|
415 MarkUnmarkCalendarL(); |
|
416 } |
|
417 break; |
|
418 |
|
419 default: |
|
420 { |
|
421 // No implementation yet. |
|
422 } |
|
423 break; |
|
424 } |
|
425 |
|
426 TRACE_EXIT_POINT; |
|
427 } |
|
428 |
|
429 // ---------------------------------------------------------------------------- |
|
430 // CCalUiDialogImpl::OfferKeyEventL |
|
431 // (other items were commented in header.) |
|
432 // ---------------------------------------------------------------------------- |
|
433 // |
|
434 TKeyResponse CCalUiDialogImpl::OfferKeyEventL(const TKeyEvent& aKeyEvent, |
|
435 TEventCode aType) |
|
436 { |
|
437 TRACE_ENTRY_POINT; |
|
438 |
|
439 TKeyResponse exitCode(EKeyWasNotConsumed); |
|
440 if(aType == EEventKey ) |
|
441 { |
|
442 if( aKeyEvent.iCode == EKeyEscape ) |
|
443 { |
|
444 TryExitL( EKeyEscape ); |
|
445 return exitCode; // Chain this one up to the main app so it closes calendar app. |
|
446 } |
|
447 else if(aType == EKeyOK) |
|
448 { |
|
449 // Single click integration |
|
450 iListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
451 } |
|
452 |
|
453 else |
|
454 { |
|
455 exitCode = EKeyWasConsumed; |
|
456 iListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
457 |
|
458 // Draw because pressing up/down means we have to redraw the backgrouns skin. |
|
459 DrawDeferred(); |
|
460 } |
|
461 } |
|
462 return exitCode; |
|
463 |
|
464 } |
|
465 |
|
466 // ---------------------------------------------------------------------------- |
|
467 // CCalUiDialogImpl::HandlePointerEventL |
|
468 // (other items were commented in header.) |
|
469 // ---------------------------------------------------------------------------- |
|
470 // |
|
471 void CCalUiDialogImpl::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
472 { |
|
473 TRACE_ENTRY_POINT; |
|
474 |
|
475 if( !AknLayoutUtils::PenEnabled() ) |
|
476 { |
|
477 return; |
|
478 } |
|
479 TInt index = iListBox->CurrentItemIndex(); |
|
480 iListBox->HandlePointerEventL(aPointerEvent); |
|
481 |
|
482 TRACE_EXIT_POINT; |
|
483 } |
|
484 |
|
485 // ---------------------------------------------------------------------------- |
|
486 // CCalUiDialogImpl::OkToExitL |
|
487 // (other items were commented in header.) |
|
488 // ---------------------------------------------------------------------------- |
|
489 // |
|
490 TBool CCalUiDialogImpl::OkToExitL(TInt aButtonId) |
|
491 { |
|
492 TRACE_ENTRY_POINT; |
|
493 |
|
494 TBool okExit = EFalse; |
|
495 |
|
496 switch (aButtonId) |
|
497 { |
|
498 case EKeyEscape: |
|
499 { |
|
500 okExit = ETrue; |
|
501 } |
|
502 break; |
|
503 case EAknSoftkeyCancel: |
|
504 { |
|
505 okExit = ETrue; |
|
506 } |
|
507 break; |
|
508 case ECalenSelectCmdOk: |
|
509 { |
|
510 okExit = ETrue; |
|
511 } |
|
512 break; |
|
513 case EAknSoftkeyOk: |
|
514 { |
|
515 MarkUnmarkCalendarL(); |
|
516 } |
|
517 break; |
|
518 default: |
|
519 { |
|
520 okExit = CAknDialog::OkToExitL(aButtonId); |
|
521 } |
|
522 break; |
|
523 } |
|
524 |
|
525 TRACE_EXIT_POINT; |
|
526 |
|
527 return okExit; |
|
528 } |
|
529 |
|
530 // ---------------------------------------------------------------------------- |
|
531 // CCalUiDialogImpl::SizeChanged |
|
532 // Set the rect to dialog and listbox |
|
533 // ---------------------------------------------------------------------------- |
|
534 // |
|
535 void CCalUiDialogImpl::SizeChanged() |
|
536 { |
|
537 TRACE_ENTRY_POINT; |
|
538 |
|
539 CAknDialog::SizeChanged(); |
|
540 |
|
541 TRect rect = iRect = Rect(); |
|
542 |
|
543 if( iBgContext ) |
|
544 { |
|
545 iBgContext->SetRect( rect ); |
|
546 } |
|
547 |
|
548 if( iListBox ) |
|
549 { |
|
550 TInt orientation = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
|
551 TAknLayoutRect application_window; |
|
552 |
|
553 if( ( !orientation ) && AknLayoutUtils::PenEnabled() ) |
|
554 { |
|
555 TRect appWindow; |
|
556 TAknLayoutRect application_window; |
|
557 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EApplicationWindow, |
|
558 appWindow ); |
|
559 application_window.LayoutRect( |
|
560 appWindow, |
|
561 AknLayoutScalable_Apps::application_window().LayoutLine() ); |
|
562 |
|
563 // Find the size of the main pane. |
|
564 TAknLayoutRect main_pane; |
|
565 |
|
566 main_pane.LayoutRect( |
|
567 application_window.Rect(), |
|
568 AknLayoutScalable_Apps::main_pane( orientation ).LayoutLine() ); |
|
569 |
|
570 TRect listboxRect; |
|
571 listboxRect.SetWidth( main_pane.Rect().Width() ); |
|
572 listboxRect.SetHeight( main_pane.Rect().Height() ); |
|
573 iListBox->SetRect( listboxRect ); |
|
574 } |
|
575 else |
|
576 { |
|
577 iListBox->SetRect( rect ); |
|
578 } |
|
579 } |
|
580 |
|
581 TRACE_EXIT_POINT; |
|
582 } |
|
583 |
|
584 // ---------------------------------------------------------------------------- |
|
585 // CCalUiDialogImpl::ComponentControl |
|
586 // (other items were commented in a header). |
|
587 // ---------------------------------------------------------------------------- |
|
588 // |
|
589 CCoeControl* CCalUiDialogImpl::ComponentControl( TInt /*aIndex*/) const |
|
590 { |
|
591 TRACE_ENTRY_POINT; |
|
592 |
|
593 if(iListBox) |
|
594 { |
|
595 TRACE_EXIT_POINT; |
|
596 return iListBox; |
|
597 } |
|
598 |
|
599 TRACE_EXIT_POINT; |
|
600 return NULL; |
|
601 } |
|
602 |
|
603 // ---------------------------------------------------------------------------- |
|
604 // CCalUiDialogImpl::CountComponentControls |
|
605 // (other items were commented in a header). |
|
606 // ---------------------------------------------------------------------------- |
|
607 // |
|
608 TInt CCalUiDialogImpl::CountComponentControls() const |
|
609 { |
|
610 TRACE_ENTRY_POINT; |
|
611 |
|
612 if(iListBox) |
|
613 { |
|
614 TRACE_EXIT_POINT; |
|
615 return 1; |
|
616 } |
|
617 |
|
618 TRACE_EXIT_POINT; |
|
619 return 0; |
|
620 } |
|
621 |
|
622 // ---------------------------------------------------------------------------- |
|
623 // CCalUiDialogImpl::PreLayoutDynInitL |
|
624 // (other items were commented in a header). |
|
625 // ---------------------------------------------------------------------------- |
|
626 // |
|
627 void CCalUiDialogImpl::PreLayoutDynInitL() |
|
628 { |
|
629 TRACE_ENTRY_POINT; |
|
630 iBgContext = |
|
631 CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain,iRect,ETrue ); |
|
632 |
|
633 SetTitlePaneL( ETrue ); |
|
634 ConstructListL(); |
|
635 UpdateListboxL(); |
|
636 //UpdateCbaL(); |
|
637 |
|
638 TInt orientation = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
|
639 if( AknLayoutUtils::PenEnabled() ) |
|
640 { |
|
641 // Find the size of the main pane. |
|
642 // Find the application window |
|
643 TRect appWindow; |
|
644 TAknLayoutRect application_window; |
|
645 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EApplicationWindow, |
|
646 appWindow ); |
|
647 application_window.LayoutRect( |
|
648 appWindow, |
|
649 AknLayoutScalable_Apps::application_window().LayoutLine() ); |
|
650 |
|
651 // Find the size of the main pane. |
|
652 TAknLayoutRect main_pane; |
|
653 |
|
654 main_pane.LayoutRect( |
|
655 application_window.Rect(), |
|
656 AknLayoutScalable_Apps::main_pane( orientation ).LayoutLine() ); |
|
657 |
|
658 TRect listboxRect; |
|
659 listboxRect.SetWidth( main_pane.Rect().Width() ); |
|
660 listboxRect.SetHeight( main_pane.Rect().Height() ); |
|
661 iListBox->SetRect( listboxRect ); |
|
662 } |
|
663 |
|
664 TRACE_EXIT_POINT; |
|
665 } |
|
666 |
|
667 // ---------------------------------------------------------------------------- |
|
668 // CCalUiDialogImpl::PostLayoutDynInitL |
|
669 // (other items were commented in a header). |
|
670 // ---------------------------------------------------------------------------- |
|
671 // |
|
672 void CCalUiDialogImpl::PostLayoutDynInitL() |
|
673 { |
|
674 TRACE_ENTRY_POINT; |
|
675 |
|
676 iListBox->UpdateScrollBarsL(); |
|
677 |
|
678 TRACE_EXIT_POINT; |
|
679 } |
|
680 |
|
681 // ---------------------------------------------------------------------------- |
|
682 // CCalUiDialogImpl::MopSupplyObject |
|
683 // (other items were commented in a header). |
|
684 // ---------------------------------------------------------------------------- |
|
685 // |
|
686 TTypeUid::Ptr CCalUiDialogImpl::MopSupplyObject(TTypeUid aId) |
|
687 { |
|
688 TRACE_ENTRY_POINT; |
|
689 |
|
690 if(aId.iUid == MAknsControlContext::ETypeId ) |
|
691 { |
|
692 MAknsControlContext* cc = iBgContext; |
|
693 if ( cc ) |
|
694 { |
|
695 return MAknsControlContext::SupplyMopObject( aId, cc ); |
|
696 } |
|
697 } |
|
698 |
|
699 TRACE_EXIT_POINT; |
|
700 |
|
701 return CAknDialog::MopSupplyObject( aId ); |
|
702 } |
|
703 |
|
704 // ---------------------------------------------------------------------------- |
|
705 // CCalUiDialogImpl::HandleResourceChange |
|
706 // (other items were commented in a header). |
|
707 // ---------------------------------------------------------------------------- |
|
708 // |
|
709 void CCalUiDialogImpl::HandleResourceChange(TInt aType) |
|
710 { |
|
711 TRACE_ENTRY_POINT; |
|
712 |
|
713 if ( aType == KAknsMessageSkinChange || aType == KEikDynamicLayoutVariantSwitch ) |
|
714 { |
|
715 SizeChanged(); |
|
716 TRAP_IGNORE(UpdateListboxL()); |
|
717 } |
|
718 |
|
719 CAknDialog::HandleResourceChange( aType ); |
|
720 TRACE_EXIT_POINT; |
|
721 } |
|
722 |
|
723 // ---------------------------------------------------------------------------- |
|
724 // CCalUiDialogImpl::Draw |
|
725 // (other items were commented in a header). |
|
726 // ---------------------------------------------------------------------------- |
|
727 // |
|
728 void CCalUiDialogImpl::Draw(const TRect& aRect) const |
|
729 { |
|
730 TRACE_ENTRY_POINT; |
|
731 |
|
732 CWindowGc& gc = SystemGc(); |
|
733 TRect mainPane; |
|
734 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPane ); |
|
735 TRect zerodRect( TPoint(0, 0), mainPane.Size() ); |
|
736 iBgContext->SetRect( zerodRect ); |
|
737 iBgContext->SetParentPos( mainPane.iTl ); |
|
738 AknsDrawUtils::Background( AknsUtils::SkinInstance(), iBgContext, this, gc, aRect ); |
|
739 |
|
740 TRACE_EXIT_POINT; |
|
741 } |
|
742 |
|
743 // ---------------------------------------------------------------------------- |
|
744 // CCalUiDialogImpl::HandleListBoxEventL |
|
745 // (other items were commented in a header). |
|
746 // ---------------------------------------------------------------------------- |
|
747 // |
|
748 void CCalUiDialogImpl::HandleListBoxEventL(CEikListBox* /*aListBox */, |
|
749 TListBoxEvent aEventType) |
|
750 { |
|
751 switch (aEventType) |
|
752 { |
|
753 //Single click integration |
|
754 case EEventItemSingleClicked: |
|
755 case EEventEnterKeyPressed: |
|
756 { |
|
757 const TInt index(iListBox->CurrentItemIndex()); |
|
758 if (index != KErrNotFound) |
|
759 { |
|
760 MarkUnmarkCalendarL(); |
|
761 } |
|
762 } |
|
763 break; |
|
764 } |
|
765 } |
|
766 |
|
767 |
|
768 // ---------------------------------------------------------------------------- |
|
769 // CCalUiDialogImpl::CallBackFor select |
|
770 // (other items were commented in a header). |
|
771 // ---------------------------------------------------------------------------- |
|
772 // |
|
773 TInt CCalUiDialogImpl::DoAsyncExit(TAny* aPtr) |
|
774 { |
|
775 TRACE_ENTRY_POINT |
|
776 CCalUiDialogImpl* self = static_cast<CCalUiDialogImpl*>(aPtr); |
|
777 self->TryExitL(self->iAsyncExitCmd); |
|
778 TRACE_EXIT_POINT |
|
779 return 0; |
|
780 } |
|
781 |
|
782 // End of file. |