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