|
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 <avkon.rsg> |
|
41 #include <eikcapc.h> |
|
42 |
|
43 //User include |
|
44 #include "multicaluidialogimpl.h" |
|
45 #include "multicaluidialogmodel.h" |
|
46 #include "calendarui_debug.h" |
|
47 #include "calendar.hrh" |
|
48 #include <aknPopup.h> |
|
49 |
|
50 |
|
51 // ---------------------------------------------------------------------------- |
|
52 // CMultiCalUiDialogImpl::CMultiCalUiDialogImpl |
|
53 // (other items were commented in a header). |
|
54 // ---------------------------------------------------------------------------- |
|
55 // |
|
56 CMultiCalUiDialogImpl::CMultiCalUiDialogImpl() |
|
57 { |
|
58 TRACE_ENTRY_POINT |
|
59 |
|
60 TRACE_EXIT_POINT |
|
61 } |
|
62 |
|
63 // ---------------------------------------------------------------------------- |
|
64 // CMultiCalUiDialogImpl::NewL |
|
65 // (other items were commented in a header). |
|
66 // ---------------------------------------------------------------------------- |
|
67 // |
|
68 CMultiCalUiDialogImpl* CMultiCalUiDialogImpl::NewL(const RPointerArray<CCalEntry>& |
|
69 aCalEntries) |
|
70 { |
|
71 TRACE_ENTRY_POINT |
|
72 CMultiCalUiDialogImpl* self = CMultiCalUiDialogImpl::NewLC(aCalEntries); |
|
73 CleanupStack::Pop(self); |
|
74 TRACE_EXIT_POINT |
|
75 return self; |
|
76 } |
|
77 |
|
78 // ---------------------------------------------------------------------------- |
|
79 // CMultiCalUiDialogImpl::NewLC |
|
80 // (other items were commented in a header). |
|
81 // ---------------------------------------------------------------------------- |
|
82 // |
|
83 CMultiCalUiDialogImpl* CMultiCalUiDialogImpl::NewLC(const RPointerArray<CCalEntry>& |
|
84 aCalEntries) |
|
85 { |
|
86 TRACE_ENTRY_POINT |
|
87 CMultiCalUiDialogImpl* self = new(ELeave) CMultiCalUiDialogImpl(); |
|
88 CleanupStack::PushL(self); |
|
89 self->ConstructL(aCalEntries); |
|
90 TRACE_EXIT_POINT |
|
91 return self; |
|
92 } |
|
93 |
|
94 // ---------------------------------------------------------------------------- |
|
95 // CMultiCalUiDialogImpl::~CMultiCalUiDialogImpl |
|
96 // (other items were commented in a header). |
|
97 // ---------------------------------------------------------------------------- |
|
98 // |
|
99 CMultiCalUiDialogImpl::~CMultiCalUiDialogImpl() |
|
100 { |
|
101 TRACE_ENTRY_POINT |
|
102 |
|
103 if(iListBox) |
|
104 { |
|
105 iListBox->Reset(); |
|
106 delete iListBox; |
|
107 } |
|
108 |
|
109 if( iResourceFileOffset ) |
|
110 { |
|
111 CCoeEnv::Static()->DeleteResourceFile( iResourceFileOffset ); |
|
112 } |
|
113 |
|
114 // Don't set the title pane text. |
|
115 TRAP_IGNORE( SetTitlePaneL( EFalse ) ); |
|
116 |
|
117 if(iMultiCalUiDialogModel) |
|
118 { |
|
119 delete iMultiCalUiDialogModel; |
|
120 iMultiCalUiDialogModel = NULL; |
|
121 } |
|
122 |
|
123 iColorUidArray.Reset(); |
|
124 |
|
125 delete iDesArray; |
|
126 |
|
127 delete iBgContext; |
|
128 |
|
129 TRACE_EXIT_POINT |
|
130 } |
|
131 |
|
132 // ---------------------------------------------------------------------------- |
|
133 // CMultiCalUiDialogImpl::ConstructL |
|
134 // (other items were commented in a header). |
|
135 // ---------------------------------------------------------------------------- |
|
136 // |
|
137 void CMultiCalUiDialogImpl::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->SetCalEntryL(aCalEntries); |
|
166 |
|
167 CAknDialog::ConstructL (R_CALENDB_LIST_MENUBAR); |
|
168 TRACE_EXIT_POINT |
|
169 } |
|
170 |
|
171 // ---------------------------------------------------------------------------- |
|
172 // CMultiCalUiDialogImpl::LaunchCalenDbListDialogL |
|
173 // (other items were commented in a header). |
|
174 // ---------------------------------------------------------------------------- |
|
175 // |
|
176 TInt CMultiCalUiDialogImpl::LaunchCalenDbListDialogL() |
|
177 { |
|
178 TRACE_ENTRY_POINT |
|
179 |
|
180 TInt returnVal( KErrNone ); |
|
181 |
|
182 returnVal = CAknDialog::ExecuteLD( R_CALENDB_LIST_DIALOG ); |
|
183 |
|
184 TRACE_EXIT_POINT |
|
185 return returnVal; |
|
186 } |
|
187 |
|
188 // ---------------------------------------------------------------------------- |
|
189 // CMultiCalUiDialogImpl::FocusChanged |
|
190 // (other items were commented in a header). |
|
191 // ---------------------------------------------------------------------------- |
|
192 // |
|
193 void CMultiCalUiDialogImpl::FocusChanged( TDrawNow aDrawNow ) |
|
194 { |
|
195 TRACE_ENTRY_POINT; |
|
196 |
|
197 CAknDialog::FocusChanged( aDrawNow ); |
|
198 |
|
199 TRACE_EXIT_POINT; |
|
200 } |
|
201 |
|
202 // ---------------------------------------------------------------------------- |
|
203 // CMultiCalUiDialogImpl::ConstructListL |
|
204 // (other items were commented in a header). |
|
205 // ---------------------------------------------------------------------------- |
|
206 // |
|
207 void CMultiCalUiDialogImpl::ConstructListL() |
|
208 { |
|
209 TRACE_ENTRY_POINT; |
|
210 |
|
211 if(iListBox) |
|
212 { |
|
213 iListBox->Reset(); |
|
214 delete iListBox; |
|
215 iListBox = NULL; |
|
216 } |
|
217 |
|
218 if(iDesArray) |
|
219 { |
|
220 delete iDesArray; |
|
221 iDesArray = NULL; |
|
222 } |
|
223 |
|
224 iDesArray = new (ELeave) CDesCArrayFlat(5); |
|
225 iListBox = new (ELeave) CCalenDbListbox(iColorUidArray); |
|
226 iListBox->SetContainerWindowL( *this ); |
|
227 iListBox->ConstructL(this, EAknListBoxSelectionList ); |
|
228 |
|
229 //Create scroll bar |
|
230 iListBox->CreateScrollBarFrameL(ETrue); |
|
231 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
232 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); |
|
233 |
|
234 CTextListBoxModel* model = iListBox->Model(); |
|
235 model->SetItemTextArray(iDesArray); |
|
236 model->SetOwnershipType(ELbmDoesNotOwnItemArray); |
|
237 |
|
238 iListBox->SetListBoxObserver( this ); |
|
239 |
|
240 PrepareIconsL(); |
|
241 |
|
242 iListBox->View()->SetListEmptyTextL( _L("No Items") ); |
|
243 |
|
244 TRACE_EXIT_POINT; |
|
245 } |
|
246 |
|
247 // ---------------------------------------------------------------------------- |
|
248 // CCalenMultipleDbUi::UpdateListboxL |
|
249 // (other items were commented in a header). |
|
250 // ---------------------------------------------------------------------------- |
|
251 // |
|
252 void CMultiCalUiDialogImpl::UpdateListboxL() |
|
253 { |
|
254 TRACE_ENTRY_POINT; |
|
255 |
|
256 iListBox->View()->SetDisableRedraw( ETrue ); |
|
257 iDesArray->Reset(); |
|
258 iColorUidArray.Close(); |
|
259 |
|
260 RPointerArray<CCalCalendarInfo>& calendarInfoArray = |
|
261 iMultiCalUiDialogModel->GetCalendarInfoArray(); |
|
262 |
|
263 if( calendarInfoArray.Count() > 0 ) |
|
264 { |
|
265 iListBox->ItemDrawer()->ColumnData()->SetIconArray( iIconsList ); |
|
266 |
|
267 for(TInt i = 0 ; i < calendarInfoArray.Count() ; i++) |
|
268 { |
|
269 TBuf<KMultiDbMaxLength> tempString; |
|
270 CCalCalendarInfo* calendarInfo = calendarInfoArray[i]; |
|
271 |
|
272 TPtrC nameBuf = calendarInfo->NameL(); |
|
273 |
|
274 //"%d\t%S\t%S\t%d" |
|
275 TBuf<10> icon; |
|
276 TInt iconIndex(1); |
|
277 icon.Format(KIconFormat,iconIndex); |
|
278 |
|
279 tempString.Append(icon); |
|
280 |
|
281 tempString.Append(KListSeparatorFormat); |
|
282 tempString.Append(nameBuf); |
|
283 tempString.Append(KListSeparatorFormat); |
|
284 |
|
285 HBufC* strTemp = NULL; |
|
286 if(calendarInfo->Enabled()) |
|
287 { |
|
288 strTemp = StringLoader::LoadLC(R_CALEN_DB_VISIBLE,iCoeEnv); |
|
289 } |
|
290 else |
|
291 { |
|
292 strTemp = StringLoader::LoadLC(R_CALEN_DB_HIDDEN,iCoeEnv); |
|
293 } |
|
294 |
|
295 tempString.Append(strTemp->Des()); |
|
296 CleanupStack::PopAndDestroy(strTemp); |
|
297 |
|
298 tempString.Append(KListSeparatorFormat); |
|
299 |
|
300 //Collect color info to be used in itemdrawer for painting strip |
|
301 iColorUidArray.Append(calendarInfo->Color().Value()); |
|
302 |
|
303 iDesArray->AppendL(tempString); |
|
304 } |
|
305 } |
|
306 |
|
307 iListBox->View()->SetDisableRedraw( EFalse ); |
|
308 iListBox->HandleItemAdditionL(); //Update and draw listbox |
|
309 |
|
310 TRACE_EXIT_POINT; |
|
311 } |
|
312 |
|
313 // ---------------------------------------------------------------------------- |
|
314 // CMultiCalUiDialogImpl::PrepareIconsL |
|
315 // (other items were commented in a header). |
|
316 // ---------------------------------------------------------------------------- |
|
317 // |
|
318 void CMultiCalUiDialogImpl::PrepareIconsL() |
|
319 { |
|
320 TRACE_ENTRY_POINT; |
|
321 |
|
322 iIconsList = CreateIconsL(); |
|
323 |
|
324 TRACE_EXIT_POINT; |
|
325 } |
|
326 |
|
327 // ---------------------------------------------------------------------------- |
|
328 // CMultiCalUiDialogImpl::GetIconL |
|
329 // (other items were commented in a header). |
|
330 // ---------------------------------------------------------------------------- |
|
331 // |
|
332 CGulIcon* CMultiCalUiDialogImpl::GetIconL( TCalenListDbIcons aIndex ) |
|
333 { |
|
334 TRACE_ENTRY_POINT; |
|
335 |
|
336 CGulIcon* icon; |
|
337 TRgb nonSkinColor = AKN_LAF_COLOR(215); |
|
338 CFbsBitmap* bitmap = NULL; |
|
339 CFbsBitmap* mask = NULL; |
|
340 TAknsItemID KSearchCheckboxOff; |
|
341 TAknsItemID KSearchCheckboxOn; |
|
342 switch( aIndex ) |
|
343 { |
|
344 case ECalenListDbIconUnMarked: |
|
345 { |
|
346 KSearchCheckboxOff.Set( 0x0A8461F4, 1 ); |
|
347 icon = CreateBitmapSkinnedIconL( |
|
348 KSearchCheckboxOff, |
|
349 iIconFile, |
|
350 EMbmMulticaluidialogQgn_prop_checkbox_off, |
|
351 EMbmMulticaluidialogQgn_prop_checkbox_off_mask ); |
|
352 } |
|
353 break; |
|
354 |
|
355 case ECalenListDbIconMarked: |
|
356 { |
|
357 KSearchCheckboxOn.Set( 0x0A8461F4, 2 ); |
|
358 icon = CreateBitmapSkinnedIconL( |
|
359 KSearchCheckboxOn, |
|
360 iIconFile, |
|
361 EMbmMulticaluidialogQgn_prop_checkbox_on, |
|
362 EMbmMulticaluidialogQgn_prop_checkbox_on_mask ); |
|
363 } |
|
364 break; |
|
365 |
|
366 default: |
|
367 { |
|
368 icon = CGulIcon::NewL( bitmap, mask ); |
|
369 } |
|
370 break; |
|
371 } |
|
372 |
|
373 TRACE_EXIT_POINT; |
|
374 return icon; |
|
375 } |
|
376 |
|
377 // ---------------------------------------------------------------------------- |
|
378 // CMultiCalUiDialogImpl::CreateIconsL |
|
379 // (other items were commented in header.) |
|
380 // ---------------------------------------------------------------------------- |
|
381 // |
|
382 CAknIconArray* CMultiCalUiDialogImpl::CreateIconsL() |
|
383 { |
|
384 TRACE_ENTRY_POINT; |
|
385 const TInt iconCount( 2 ); |
|
386 CAknIconArray* icons = new(ELeave) CAknIconArray( iconCount ); |
|
387 CleanupStack::PushL( icons ); |
|
388 icons->SetReserveL( iconCount ); |
|
389 icons->AppendL( GetIconL( ECalenListDbIconMarked ) ); |
|
390 icons->AppendL( GetIconL( ECalenListDbIconUnMarked ) ); |
|
391 CleanupStack::Pop( icons ); |
|
392 TRACE_EXIT_POINT; |
|
393 return icons; |
|
394 } |
|
395 |
|
396 // ----------------------------------------------------------------------------- |
|
397 // CMultiCalUiDialogImpl::CreateBitmapSkinnedIconL |
|
398 // (other items were commented in a header). |
|
399 // ----------------------------------------------------------------------------- |
|
400 // |
|
401 CGulIcon* CMultiCalUiDialogImpl::CreateBitmapSkinnedIconL(const TAknsItemID& aSkinIconId, |
|
402 const TDesC& aFilename, |
|
403 TInt aNormalIconId, |
|
404 TInt aNormalMaskId) const |
|
405 { |
|
406 TRACE_ENTRY_POINT; |
|
407 |
|
408 CFbsBitmap* bitmap = NULL; |
|
409 CFbsBitmap* mask = NULL; |
|
410 |
|
411 AknsUtils::CreateIconLC(AknsUtils::SkinInstance(), aSkinIconId, |
|
412 bitmap, mask, |
|
413 aFilename, aNormalIconId, aNormalMaskId); |
|
414 |
|
415 CGulIcon* icon = CGulIcon::NewL(bitmap, mask); |
|
416 |
|
417 // Ownership of bitmap and mask transferred |
|
418 CleanupStack::Pop(2); // bitmap, mask |
|
419 |
|
420 TRACE_EXIT_POINT; |
|
421 return icon; |
|
422 } |
|
423 |
|
424 // ----------------------------------------------------------------------------- |
|
425 // CMultiCalUiDialogImpl::MarkUnmarkCalendarL |
|
426 // (other items were commented in a header). |
|
427 // ----------------------------------------------------------------------------- |
|
428 // |
|
429 void CMultiCalUiDialogImpl::MarkUnmarkCalendarL() |
|
430 { |
|
431 TRACE_ENTRY_POINT |
|
432 |
|
433 TInt index = iListBox->CurrentItemIndex(); |
|
434 |
|
435 TBool status = EFalse; |
|
436 status = iMultiCalUiDialogModel->GetCalendarStatus(index); |
|
437 |
|
438 if(status) |
|
439 { |
|
440 status = EFalse; |
|
441 } |
|
442 else |
|
443 { |
|
444 status = ETrue; |
|
445 } |
|
446 |
|
447 iMultiCalUiDialogModel->SetCalendarStatus(index,status); |
|
448 |
|
449 TPtrC indexText = iDesArray->MdcaPoint(index); |
|
450 HBufC* formatText = indexText.AllocLC(); |
|
451 TPtr modified = formatText->Des(); |
|
452 modified[0] = status ? '0' : '1'; |
|
453 |
|
454 indexText.Set(modified); |
|
455 iDesArray->Delete(index); |
|
456 iDesArray->InsertL(index,indexText); |
|
457 CleanupStack::PopAndDestroy(formatText); |
|
458 |
|
459 iListBox->RedrawItem(index); |
|
460 UpdateCbaL(); |
|
461 |
|
462 TRACE_EXIT_POINT |
|
463 } |
|
464 |
|
465 // ---------------------------------------------------------------------------- |
|
466 // CMultiCalUiDialogImpl::UpdateCbaL |
|
467 // (other items were commented in header.) |
|
468 // ---------------------------------------------------------------------------- |
|
469 // |
|
470 void CMultiCalUiDialogImpl::UpdateCbaL() |
|
471 { |
|
472 TRACE_ENTRY_POINT; |
|
473 CEikButtonGroupContainer& cba = ButtonGroupContainer (); |
|
474 |
|
475 if(!iMultiCalUiDialogModel->MarkedCalendarsCount()) |
|
476 { |
|
477 cba.MakeCommandVisible( EAknSoftkeyOptions, EFalse ); |
|
478 } |
|
479 else |
|
480 { |
|
481 cba.MakeCommandVisible( EAknSoftkeyOptions, ETrue ); |
|
482 } |
|
483 cba.DrawNow(); |
|
484 |
|
485 TRACE_EXIT_POINT; |
|
486 } |
|
487 |
|
488 // ---------------------------------------------------------------------------- |
|
489 // CMultiCalUiDialogImpl::SetTitlePaneL |
|
490 // (other items were commented in header.) |
|
491 // ---------------------------------------------------------------------------- |
|
492 // |
|
493 void CMultiCalUiDialogImpl::SetTitlePaneL( TBool aCurrentState ) |
|
494 { |
|
495 TRACE_ENTRY_POINT; |
|
496 CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); |
|
497 |
|
498 // Set empty navi pane label |
|
499 iNaviContainer = static_cast<CAknNavigationControlContainer*>( |
|
500 sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
501 iNaviContainer->PushDefaultL(); |
|
502 |
|
503 // Set title text |
|
504 CAknTitlePane* tp = static_cast<CAknTitlePane*>( |
|
505 sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
506 |
|
507 if( aCurrentState ) |
|
508 { |
|
509 iTitlepaneText = ( *tp->Text() ); |
|
510 HBufC* titleText = StringLoader::LoadLC( R_CALEN_DB_LIST_TITLE , iCoeEnv ); |
|
511 tp->SetTextL( *titleText ); |
|
512 CleanupStack::PopAndDestroy( titleText ); |
|
513 } |
|
514 else |
|
515 { |
|
516 tp->SetTextL(iTitlepaneText); |
|
517 } |
|
518 TRACE_EXIT_POINT; |
|
519 } |
|
520 |
|
521 // ---------------------------------------------------------------------------- |
|
522 // CMultiCalUiDialogImpl::DynInitMenuPaneL |
|
523 // (other items were commented in header.) |
|
524 // ---------------------------------------------------------------------------- |
|
525 // |
|
526 void CMultiCalUiDialogImpl::DynInitMenuPaneL( TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/ ) |
|
527 { |
|
528 TRACE_ENTRY_POINT; |
|
529 |
|
530 |
|
531 TRACE_EXIT_POINT; |
|
532 } |
|
533 |
|
534 // ---------------------------------------------------------------------------- |
|
535 // CMultiCalUiDialogImpl::ProcessCommandL |
|
536 // (other items were commented in header.) |
|
537 // ---------------------------------------------------------------------------- |
|
538 // |
|
539 void CMultiCalUiDialogImpl::ProcessCommandL( TInt aCommandId ) |
|
540 { |
|
541 TRACE_ENTRY_POINT; |
|
542 |
|
543 CAknDialog::ProcessCommandL(aCommandId); |
|
544 |
|
545 switch(aCommandId) |
|
546 { |
|
547 case EAknSoftkeyOptions: |
|
548 case EAknSoftkeyUnmark: |
|
549 { |
|
550 MarkUnmarkCalendarL(); |
|
551 } |
|
552 break; |
|
553 |
|
554 default: |
|
555 { |
|
556 // No implementation yet. |
|
557 } |
|
558 break; |
|
559 } |
|
560 |
|
561 TRACE_EXIT_POINT; |
|
562 } |
|
563 |
|
564 // ---------------------------------------------------------------------------- |
|
565 // CMultiCalUiDialogImpl::OfferKeyEventL |
|
566 // (other items were commented in header.) |
|
567 // ---------------------------------------------------------------------------- |
|
568 // |
|
569 TKeyResponse CMultiCalUiDialogImpl::OfferKeyEventL(const TKeyEvent& aKeyEvent, |
|
570 TEventCode aType) |
|
571 { |
|
572 |
|
573 TRACE_ENTRY_POINT; |
|
574 TKeyResponse exitCode(EKeyWasNotConsumed); |
|
575 |
|
576 if(aType == EEventKey ) |
|
577 { |
|
578 if( aKeyEvent.iCode == EKeyEscape ) |
|
579 { |
|
580 TryExitL( EKeyEscape ); |
|
581 return exitCode; |
|
582 } |
|
583 else if(aType == EKeyOK) |
|
584 { |
|
585 MarkUnmarkCalendarL(); |
|
586 } |
|
587 else if(aKeyEvent.iCode == EKeyBackspace) |
|
588 { |
|
589 return exitCode; |
|
590 } |
|
591 else |
|
592 { |
|
593 exitCode = EKeyWasConsumed; |
|
594 iListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
595 |
|
596 // Draw because pressing up/down means we have to redraw the backgrouns skin. |
|
597 DrawDeferred(); |
|
598 } |
|
599 } |
|
600 TRACE_EXIT_POINT; |
|
601 return exitCode; |
|
602 } |
|
603 |
|
604 // ---------------------------------------------------------------------------- |
|
605 // CMultiCalUiDialogImpl::HandlePointerEventL |
|
606 // (other items were commented in header.) |
|
607 // ---------------------------------------------------------------------------- |
|
608 // |
|
609 void CMultiCalUiDialogImpl::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
610 { |
|
611 // single click |
|
612 TRACE_ENTRY_POINT; |
|
613 |
|
614 if( !AknLayoutUtils::PenEnabled() ) |
|
615 { |
|
616 return; |
|
617 } |
|
618 TInt index = iListBox->CurrentItemIndex(); |
|
619 iListBox->HandlePointerEventL(aPointerEvent); |
|
620 |
|
621 TRACE_EXIT_POINT; |
|
622 } |
|
623 |
|
624 // ---------------------------------------------------------------------------- |
|
625 // CMultiCalUiDialogImpl::OkToExitL |
|
626 // (other items were commented in header.) |
|
627 // ---------------------------------------------------------------------------- |
|
628 // |
|
629 TBool CMultiCalUiDialogImpl::OkToExitL( TInt aButtonId ) |
|
630 { |
|
631 TRACE_ENTRY_POINT; |
|
632 |
|
633 TBool okExit = EFalse; |
|
634 |
|
635 switch(aButtonId) |
|
636 { |
|
637 case EKeyEscape: |
|
638 case EAknSoftkeyCancel: |
|
639 { |
|
640 okExit = ETrue; |
|
641 } |
|
642 break; |
|
643 |
|
644 case EAknSoftkeyOk: |
|
645 case ECalenSelectCmdOk: |
|
646 { |
|
647 TInt index = iListBox->CurrentItemIndex(); |
|
648 |
|
649 if(!iMultiCalUiDialogModel->MarkedCalendarsCount()) |
|
650 { |
|
651 iMultiCalUiDialogModel->SetCalendarStatus(index,ETrue); |
|
652 } |
|
653 |
|
654 iMultiCalUiDialogModel->StoreCalEntryL(); |
|
655 |
|
656 okExit = ETrue; |
|
657 } |
|
658 break; |
|
659 |
|
660 default: |
|
661 { |
|
662 okExit = CAknDialog::OkToExitL(aButtonId); |
|
663 } |
|
664 break; |
|
665 } |
|
666 TRACE_EXIT_POINT; |
|
667 |
|
668 return okExit; |
|
669 } |
|
670 |
|
671 // ---------------------------------------------------------------------------- |
|
672 // CMultiCalUiDialogImpl::SizeChanged |
|
673 // Set the rect to dialog and listbox |
|
674 // ---------------------------------------------------------------------------- |
|
675 // |
|
676 void CMultiCalUiDialogImpl::SizeChanged() |
|
677 { |
|
678 TRACE_ENTRY_POINT; |
|
679 |
|
680 CAknDialog::SizeChanged(); |
|
681 |
|
682 TRect rect = iRect = Rect(); |
|
683 |
|
684 if( iBgContext ) |
|
685 { |
|
686 iBgContext->SetRect( rect ); |
|
687 } |
|
688 |
|
689 if( iListBox ) |
|
690 { |
|
691 TInt orientation = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
|
692 TAknLayoutRect application_window; |
|
693 |
|
694 if( ( !orientation ) && AknLayoutUtils::PenEnabled() ) |
|
695 { |
|
696 TRect appWindow; |
|
697 TAknLayoutRect application_window; |
|
698 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EApplicationWindow, |
|
699 appWindow ); |
|
700 application_window.LayoutRect( |
|
701 appWindow, |
|
702 AknLayoutScalable_Apps::application_window().LayoutLine() ); |
|
703 |
|
704 // Find the size of the main pane. |
|
705 TAknLayoutRect main_pane; |
|
706 |
|
707 main_pane.LayoutRect( |
|
708 application_window.Rect(), |
|
709 AknLayoutScalable_Apps::main_pane( orientation ).LayoutLine() ); |
|
710 |
|
711 TRect listboxRect; |
|
712 listboxRect.SetWidth( main_pane.Rect().Width() ); |
|
713 listboxRect.SetHeight( main_pane.Rect().Height() ); |
|
714 iListBox->SetRect( listboxRect ); |
|
715 } |
|
716 else |
|
717 { |
|
718 iListBox->SetRect( rect ); |
|
719 } |
|
720 } |
|
721 |
|
722 TRACE_EXIT_POINT; |
|
723 } |
|
724 |
|
725 // ---------------------------------------------------------------------------- |
|
726 // CMultiCalUiDialogImpl::ComponentControl |
|
727 // (other items were commented in a header). |
|
728 // ---------------------------------------------------------------------------- |
|
729 // |
|
730 CCoeControl* CMultiCalUiDialogImpl::ComponentControl( TInt /*aIndex*/) const |
|
731 { |
|
732 TRACE_ENTRY_POINT; |
|
733 |
|
734 if(iListBox) |
|
735 { |
|
736 TRACE_EXIT_POINT; |
|
737 return iListBox; |
|
738 } |
|
739 |
|
740 TRACE_EXIT_POINT; |
|
741 return NULL; |
|
742 } |
|
743 |
|
744 // ---------------------------------------------------------------------------- |
|
745 // CMultiCalUiDialogImpl::CountComponentControls |
|
746 // (other items were commented in a header). |
|
747 // ---------------------------------------------------------------------------- |
|
748 // |
|
749 TInt CMultiCalUiDialogImpl::CountComponentControls() const |
|
750 { |
|
751 TRACE_ENTRY_POINT; |
|
752 |
|
753 if(iListBox) |
|
754 { |
|
755 TRACE_EXIT_POINT; |
|
756 return 1; |
|
757 } |
|
758 |
|
759 TRACE_EXIT_POINT; |
|
760 return 0; |
|
761 } |
|
762 |
|
763 // ---------------------------------------------------------------------------- |
|
764 // CMultiCalUiDialogImpl::PreLayoutDynInitL |
|
765 // (other items were commented in a header). |
|
766 // ---------------------------------------------------------------------------- |
|
767 // |
|
768 void CMultiCalUiDialogImpl::PreLayoutDynInitL() |
|
769 { |
|
770 TRACE_ENTRY_POINT; |
|
771 iBgContext = |
|
772 CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain,iRect,ETrue ); |
|
773 |
|
774 SetTitlePaneL( ETrue ); |
|
775 ConstructListL(); |
|
776 UpdateListboxL(); |
|
777 TInt orientation = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
|
778 if( AknLayoutUtils::PenEnabled() ) |
|
779 { |
|
780 // Find the size of the main pane. |
|
781 // Find the application window |
|
782 TRect appWindow; |
|
783 TAknLayoutRect application_window; |
|
784 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EApplicationWindow, |
|
785 appWindow ); |
|
786 application_window.LayoutRect( |
|
787 appWindow, |
|
788 AknLayoutScalable_Apps::application_window().LayoutLine() ); |
|
789 |
|
790 // Find the size of the main pane. |
|
791 TAknLayoutRect main_pane; |
|
792 |
|
793 main_pane.LayoutRect( |
|
794 application_window.Rect(), |
|
795 AknLayoutScalable_Apps::main_pane( orientation ).LayoutLine() ); |
|
796 |
|
797 TRect listboxRect; |
|
798 listboxRect.SetWidth( main_pane.Rect().Width() ); |
|
799 listboxRect.SetHeight( main_pane.Rect().Height() ); |
|
800 iListBox->SetRect( listboxRect ); |
|
801 } |
|
802 |
|
803 TRACE_EXIT_POINT; |
|
804 } |
|
805 |
|
806 // ---------------------------------------------------------------------------- |
|
807 // CMultiCalUiDialogImpl::PostLayoutDynInitL |
|
808 // (other items were commented in a header). |
|
809 // ---------------------------------------------------------------------------- |
|
810 // |
|
811 void CMultiCalUiDialogImpl::PostLayoutDynInitL() |
|
812 { |
|
813 TRACE_ENTRY_POINT; |
|
814 UpdateCbaL(); |
|
815 TRACE_EXIT_POINT; |
|
816 } |
|
817 |
|
818 // ---------------------------------------------------------------------------- |
|
819 // CMultiCalUiDialogImpl::MopSupplyObject |
|
820 // (other items were commented in a header). |
|
821 // ---------------------------------------------------------------------------- |
|
822 // |
|
823 TTypeUid::Ptr CMultiCalUiDialogImpl::MopSupplyObject(TTypeUid aId) |
|
824 { |
|
825 TRACE_ENTRY_POINT; |
|
826 |
|
827 if(aId.iUid == MAknsControlContext::ETypeId ) |
|
828 { |
|
829 MAknsControlContext* cc = iBgContext; |
|
830 if ( cc ) |
|
831 { |
|
832 return MAknsControlContext::SupplyMopObject( aId, cc ); |
|
833 } |
|
834 } |
|
835 |
|
836 TRACE_EXIT_POINT; |
|
837 |
|
838 return CAknDialog::MopSupplyObject( aId ); |
|
839 } |
|
840 |
|
841 // ---------------------------------------------------------------------------- |
|
842 // CMultiCalUiDialogImpl::HandleResourceChange |
|
843 // (other items were commented in a header). |
|
844 // ---------------------------------------------------------------------------- |
|
845 // |
|
846 void CMultiCalUiDialogImpl::HandleResourceChange(TInt aType) |
|
847 { |
|
848 TRACE_ENTRY_POINT; |
|
849 CAknDialog::HandleResourceChange( aType ); |
|
850 if ( aType == KAknsMessageSkinChange || aType == KEikDynamicLayoutVariantSwitch ) |
|
851 { |
|
852 SizeChanged(); |
|
853 } |
|
854 |
|
855 TRACE_EXIT_POINT; |
|
856 } |
|
857 |
|
858 // ---------------------------------------------------------------------------- |
|
859 // CMultiCalUiDialogImpl::Draw |
|
860 // (other items were commented in a header). |
|
861 // ---------------------------------------------------------------------------- |
|
862 // |
|
863 void CMultiCalUiDialogImpl::Draw(const TRect& aRect) const |
|
864 { |
|
865 TRACE_ENTRY_POINT; |
|
866 |
|
867 CWindowGc& gc = SystemGc(); |
|
868 TRect mainPane; |
|
869 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPane ); |
|
870 TRect zerodRect( TPoint(0, 0), mainPane.Size() ); |
|
871 iBgContext->SetRect( zerodRect ); |
|
872 iBgContext->SetParentPos( mainPane.iTl ); |
|
873 AknsDrawUtils::Background( AknsUtils::SkinInstance(), iBgContext, this, gc, aRect ); |
|
874 |
|
875 TRACE_EXIT_POINT; |
|
876 } |
|
877 |
|
878 // ---------------------------------------------------------------------------- |
|
879 // CMultiCalUiDialogImpl::HandleListBoxEventL |
|
880 // (other items were commented in a header). |
|
881 // ---------------------------------------------------------------------------- |
|
882 // |
|
883 void CMultiCalUiDialogImpl::HandleListBoxEventL(CEikListBox* /*aListBox */, |
|
884 TListBoxEvent aEventType) |
|
885 { |
|
886 switch (aEventType) |
|
887 { |
|
888 //Single click integration |
|
889 case EEventItemSingleClicked: |
|
890 case EEventEnterKeyPressed: |
|
891 { |
|
892 const TInt index(iListBox->CurrentItemIndex()); |
|
893 if (index != KErrNotFound) |
|
894 { |
|
895 MarkUnmarkCalendarL(); |
|
896 } |
|
897 } |
|
898 break; |
|
899 } |
|
900 } |
|
901 |
|
902 |
|
903 // ---------------------------------------------------------------------------- |
|
904 // CMultiCalUiDialogImpl::CallBackFor select |
|
905 // (other items were commented in a header). |
|
906 // ---------------------------------------------------------------------------- |
|
907 // |
|
908 TInt CMultiCalUiDialogImpl::DoAsyncExitL(TAny* aPtr) |
|
909 { |
|
910 TRACE_ENTRY_POINT |
|
911 CMultiCalUiDialogImpl* self = static_cast<CMultiCalUiDialogImpl*>(aPtr); |
|
912 self->TryExitL(self->iAsyncExitCmd); |
|
913 TRACE_EXIT_POINT |
|
914 return 0; |
|
915 } |
|
916 |
|
917 // End of file. |