author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 21:17:03 +0300 | |
branch | RCL_3 |
changeset 31 | 97232defd20e |
parent 30 | bd7edf625bdd |
permissions | -rw-r--r-- |
30 | 1 |
/* |
2 |
* Copyright (c) 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: Container for missed alarm view's controls. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
// System Includes |
|
21 |
#include <StringLoader.h> |
|
22 |
#include <eikdef.h> |
|
23 |
#include <eikenv.h> |
|
24 |
#include <avkon.rsg> |
|
25 |
#include <AknUtils.h> |
|
26 |
#include <aknlists.h> |
|
27 |
#include <AknsUtils.h> |
|
28 |
#include <AknIconArray.h> |
|
29 |
#include <avkon.hrh> |
|
30 |
#include <aknconsts.h> |
|
31 |
#include <data_caging_path_literals.hrh> |
|
32 |
#include <AknIconArray.h> |
|
33 |
#include <AknsDrawUtils.h> |
|
34 |
#include <avkon.mbg> |
|
35 |
#include <gulicon.h> |
|
36 |
#include <aknenv.h> |
|
37 |
#include <eikapp.h> |
|
38 |
#include <AknBidiTextUtils.h> |
|
39 |
#include <aknlayoutscalable_apps.cdl.h> |
|
40 |
#include <AknsFrameBackgroundControlContext.h> |
|
41 |
#include <csxhelp/cale.hlp.hrh> |
|
42 |
#include <calentryview.h> |
|
43 |
#include <calsession.h> |
|
44 |
#include <calinstanceview.h> |
|
45 |
#include <calinstance.h> |
|
46 |
#include <missedalarmstore.h> |
|
47 |
#include <missedalarm.h> |
|
48 |
#include <calenagendautils.h> |
|
49 |
#include <calenglobaldata.h> |
|
50 |
#include <calendar.mbg> |
|
51 |
#include <Calendar.rsg> |
|
52 |
#include <calencommands.hrh> // Calendar commands |
|
53 |
#include <calencontext.h> |
|
54 |
#include <caleninstanceid.h> // TCalenInstanceId |
|
55 |
#include <calenservices.h> |
|
56 |
#include <calentoolbar.h> |
|
57 |
#include <calenviewutils.h> |
|
58 |
||
59 |
// User Includes |
|
60 |
#include "calendarui_debug.h" |
|
61 |
#include "calenmissedalarmscontainer.h" |
|
62 |
#include "calendar.hrh" |
|
63 |
#include "calencontainer.h" |
|
64 |
#include "calenicons.h" |
|
65 |
#include "calenicons.h" |
|
66 |
#include "CalenUid.h" |
|
67 |
||
68 |
// Constants |
|
69 |
const TInt KMissedAlarmListMaxLength = 25; |
|
70 |
const TInt KMissedAlarmListBoxItems = 10; |
|
71 |
const TInt KListDataLength = 256; |
|
72 |
_LIT( KListSeparator, "\t" ); |
|
73 |
_LIT( KIconFormat,"%d"); |
|
74 |
||
75 |
// ----------------------------------------------------------------------------- |
|
76 |
// CCalenMissedAlarmsContainer::CCalenMissedAlarmsContainer |
|
77 |
// Performs the first phase of two phase construction. |
|
78 |
// ----------------------------------------------------------------------------- |
|
79 |
// |
|
80 |
CCalenMissedAlarmsContainer::CCalenMissedAlarmsContainer(CCalenNativeView* aView, |
|
81 |
MCalenServices& aServices,TInt& aHighlightedRowNumber) : |
|
82 |
CCalenContainer(aView, aServices), |
|
83 |
iHighlightedRowNumber(aHighlightedRowNumber) |
|
84 |
{ |
|
85 |
TRACE_ENTRY_POINT; |
|
86 |
TRACE_EXIT_POINT; |
|
87 |
} |
|
88 |
||
89 |
// ----------------------------------------------------------------------------- |
|
90 |
// CCalenMissedAlarmsContainer::~CCalenMissedAlarmsContainer |
|
91 |
// Destructor |
|
92 |
// ----------------------------------------------------------------------------- |
|
93 |
// |
|
94 |
CCalenMissedAlarmsContainer::~CCalenMissedAlarmsContainer() |
|
95 |
{ |
|
96 |
TRACE_ENTRY_POINT; |
|
97 |
||
98 |
if(iListBoxItemArray) |
|
99 |
{ |
|
100 |
delete iListBoxItemArray; |
|
101 |
} |
|
102 |
if(iMissedAlarmsArray.Count()) |
|
103 |
{ |
|
104 |
iMissedAlarmsArray.Reset(); |
|
105 |
iMissedAlarmsArray.Close(); |
|
106 |
} |
|
107 |
if (iListBox) |
|
108 |
{ |
|
109 |
delete iListBox; |
|
110 |
iListBox = NULL; |
|
111 |
} |
|
112 |
||
113 |
TRACE_EXIT_POINT; |
|
114 |
} |
|
115 |
||
116 |
// ---------------------------------------------------------------------------- |
|
117 |
// CCalenMissedAlarmsContainer::ConstructImplL |
|
118 |
// Third phase constructor. |
|
119 |
// This function was called CCalenNativeView::ConstructL(). |
|
120 |
// (other items were commented in a header). |
|
121 |
// ---------------------------------------------------------------------------- |
|
122 |
// |
|
123 |
void CCalenMissedAlarmsContainer::ConstructImplL() |
|
124 |
{ |
|
125 |
TRACE_ENTRY_POINT; |
|
126 |
||
127 |
iListBoxItemArray = new(ELeave) CDesCArrayFlat(KMissedAlarmListBoxItems); |
|
128 |
||
129 |
iMissedAlarmStore = iServices.MissedAlarmStore(); |
|
130 |
||
131 |
// Get the missed alarms count |
|
132 |
iMissedAlarmStore->CountL(iMissedAlarmsCount); |
|
133 |
||
134 |
iListBox = new( ELeave ) CAknDoubleGraphicStyleListBox; |
|
135 |
iListBox->ConstructL( this, 0); |
|
136 |
iListBox->SetContainerWindowL( *this); |
|
137 |
||
138 |
// Create scroll bar |
|
139 |
iListBox->CreateScrollBarFrameL(ETrue); |
|
140 |
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, |
|
141 |
CEikScrollBarFrame::EAuto); |
|
142 |
iListBox->SetListBoxObserver( this ); // single click changes MK |
|
143 |
// set the model array |
|
144 |
iListBox->Model()->SetItemTextArray(iListBoxItemArray); |
|
145 |
||
146 |
// set icon array |
|
147 |
CAknIconArray* iconArray = CreateIconsL( iIconIndices, KCalenMissedAlarmsViewUidValue ); |
|
148 |
CleanupStack::PushL(iconArray); |
|
149 |
iListBox->ItemDrawer()->FormattedCellData()->SetIconArray(iconArray); |
|
150 |
CleanupStack::Pop(); |
|
151 |
||
152 |
iListBox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); |
|
153 |
iListBox->View()->SetListEmptyTextL( KNullDesC ); |
|
154 |
iFirstTap = EFalse; |
|
155 |
||
156 |
//Set toolbar visibility to false, bcoz this view is not using the ToolBar |
|
157 |
MCalenToolbar* toolbar = iServices.ToolbarOrNull(); |
|
158 |
if(toolbar) |
|
159 |
{ |
|
160 |
toolbar->SetToolbarVisibilityL(EFalse); |
|
161 |
} |
|
162 |
||
163 |
TRACE_EXIT_POINT; |
|
164 |
} |
|
165 |
||
166 |
// ---------------------------------------------------------------------------- |
|
167 |
// CCalenMissedAlarmsContainer::UpdateSize |
|
168 |
// Do layout changes after calendar settings are |
|
169 |
// changed. No necessary actions for this view. |
|
170 |
// ---------------------------------------------------------------------------- |
|
171 |
// |
|
172 |
void CCalenMissedAlarmsContainer::UpdateSize() |
|
173 |
{ |
|
174 |
TRACE_ENTRY_POINT; |
|
175 |
TRACE_EXIT_POINT; |
|
176 |
} |
|
177 |
||
178 |
// ----------------------------------------------------------------------------- |
|
179 |
// CCalenMissedAlarmsContainer::IconIndexForEntryL |
|
180 |
// Gets the Icon Index for the missed alarm entry |
|
181 |
// (other items were commented in a header). |
|
182 |
// ----------------------------------------------------------------------------- |
|
183 |
// |
|
184 |
TInt CCalenMissedAlarmsContainer::IconIndexForEntryL(CCalEntry& aEntry, |
|
185 |
TInt aSeenMissedAlarm) |
|
186 |
{ |
|
187 |
TRACE_ENTRY_POINT; |
|
188 |
TInt iconIndex(0); |
|
189 |
||
190 |
if(aSeenMissedAlarm) |
|
191 |
{ |
|
192 |
switch(aEntry.EntryTypeL()) |
|
193 |
{ |
|
194 |
case CCalEntry::EAnniv: |
|
195 |
iconIndex = IconIndex(MCalenServices::ECalenBirthdayIcon); |
|
196 |
break; |
|
197 |
case CCalEntry::EEvent: |
|
198 |
iconIndex = IconIndex(MCalenServices::ECalenDaynoteIcon); |
|
199 |
break; |
|
200 |
case CCalEntry::EAppt: |
|
201 |
iconIndex = IconIndex(MCalenServices::ECalenMeetingIcon); |
|
202 |
break; |
|
203 |
case CCalEntry::ETodo: |
|
204 |
iconIndex = IconIndex(MCalenServices::ECalenTodoIconUndone); |
|
205 |
break; |
|
206 |
default: |
|
207 |
ASSERT( EFalse ); |
|
208 |
break; |
|
209 |
} |
|
210 |
} |
|
211 |
else |
|
212 |
{ |
|
213 |
switch(aEntry.EntryTypeL()) |
|
214 |
{ |
|
215 |
case CCalEntry::EAnniv: |
|
216 |
iconIndex = IconIndex(MCalenServices::ECalenBirthdayIconMissed); |
|
217 |
break; |
|
218 |
case CCalEntry::EEvent: |
|
219 |
iconIndex = IconIndex(MCalenServices::ECalenDaynoteIconMissed); |
|
220 |
break; |
|
221 |
case CCalEntry::EAppt: |
|
222 |
iconIndex = IconIndex(MCalenServices::ECalenMeetingIconMissed); |
|
223 |
break; |
|
224 |
case CCalEntry::ETodo: |
|
225 |
iconIndex = IconIndex(MCalenServices::ECalenToDoIconMissed); |
|
226 |
break; |
|
227 |
default: |
|
228 |
ASSERT( EFalse ); |
|
229 |
break; |
|
230 |
} |
|
231 |
} |
|
232 |
return iconIndex; |
|
233 |
TRACE_EXIT_POINT; |
|
234 |
} |
|
235 |
||
236 |
// ---------------------------------------------------------------------------- |
|
237 |
// CCalenMissedAlarmsContainer::CreateIconIndicesL |
|
238 |
// Fill the list of icons used by the MAV |
|
239 |
// (other items were commented in a header). |
|
240 |
// ---------------------------------------------------------------------------- |
|
241 |
// |
|
242 |
void CCalenMissedAlarmsContainer::CreateIconIndicesL( |
|
243 |
RArray<MCalenServices::TCalenIcons>& aIndexArray) |
|
244 |
{ |
|
245 |
TRACE_ENTRY_POINT; |
|
246 |
||
247 |
aIndexArray.Reset(); |
|
248 |
aIndexArray.AppendL( MCalenServices::ECalenBirthdayIcon ); |
|
249 |
aIndexArray.AppendL( MCalenServices::ECalenDaynoteIcon ); |
|
250 |
aIndexArray.AppendL( MCalenServices::ECalenMeetingIcon ); |
|
251 |
aIndexArray.AppendL( MCalenServices::ECalenTodoIconUndone ); |
|
252 |
aIndexArray.AppendL( MCalenServices::ECalenBirthdayIconMissed ); |
|
253 |
aIndexArray.AppendL( MCalenServices::ECalenDaynoteIconMissed ); |
|
254 |
aIndexArray.AppendL( MCalenServices::ECalenMeetingIconMissed ); |
|
255 |
aIndexArray.AppendL( MCalenServices::ECalenToDoIconMissed ); |
|
256 |
aIndexArray.AppendL( MCalenServices::ECalenClearMissedAlarms ); |
|
257 |
aIndexArray.AppendL( MCalenServices::ECalenClearAllMissedAlarms ) |
|
258 |
||
259 |
TRACE_EXIT_POINT; |
|
260 |
} |
|
261 |
||
262 |
// ---------------------------------------------------------------------------- |
|
263 |
// CCalenMissedAlarmsContainer::GetHelpContext |
|
264 |
// Get help context. |
|
265 |
// (other items were commented in a header). |
|
266 |
// ---------------------------------------------------------------------------- |
|
267 |
// |
|
268 |
void CCalenMissedAlarmsContainer::GetHelpContext(TCoeHelpContext& aContext) const |
|
269 |
{ |
|
270 |
TRACE_ENTRY_POINT; |
|
271 |
||
272 |
aContext.iMajor = KUidCalendar; |
|
273 |
aContext.iContext = KCALE_HLP_MONTH_VIEW; // need to change |
|
274 |
||
275 |
TRACE_EXIT_POINT; |
|
276 |
} |
|
277 |
||
278 |
// ----------------------------------------------------------------------------- |
|
279 |
// CCalenMissedAlarmsContainer::MopSupplyObject |
|
280 |
// Pass the skin information |
|
281 |
// (other items were commented in a header). |
|
282 |
// ----------------------------------------------------------------------------- |
|
283 |
// |
|
284 |
TTypeUid::Ptr CCalenMissedAlarmsContainer::MopSupplyObject(TTypeUid aId) |
|
285 |
{ |
|
286 |
TRACE_ENTRY_POINT; |
|
287 |
TRACE_EXIT_POINT; |
|
288 |
||
289 |
return MAknsControlContext::SupplyMopObject(aId, iBgContext); |
|
290 |
} |
|
291 |
||
292 |
// ----------------------------------------------------------------------------- |
|
293 |
// CCalenMissedAlarmsContainer::ListBox |
|
294 |
// Returns the listbox |
|
295 |
// ----------------------------------------------------------------------------- |
|
296 |
// |
|
297 |
CAknDoubleGraphicStyleListBox* CCalenMissedAlarmsContainer::ListBox() const |
|
298 |
{ |
|
299 |
TRACE_ENTRY_POINT; |
|
300 |
TRACE_EXIT_POINT; |
|
301 |
||
302 |
return iListBox; |
|
303 |
} |
|
304 |
||
305 |
// ----------------------------------------------------------------------------- |
|
306 |
// CCalenMissedAlarmsContainer::SizeChanged |
|
307 |
// Called by the framework when the view size is changed. |
|
308 |
// ----------------------------------------------------------------------------- |
|
309 |
// |
|
310 |
void CCalenMissedAlarmsContainer::SizeChanged() |
|
311 |
{ |
|
312 |
TRACE_ENTRY_POINT; |
|
313 |
TRect main_pane( Rect() ); |
|
314 |
CCalenContainer::SizeChanged( main_pane ); |
|
315 |
||
316 |
if(iListBox) |
|
317 |
{ |
|
318 |
iListBox->SetRect( main_pane ); |
|
319 |
} |
|
320 |
||
321 |
TRACE_EXIT_POINT; |
|
322 |
} |
|
323 |
||
324 |
// ----------------------------------------------------------------------------- |
|
325 |
// CCalenMissedAlarmsContainer::CountComponentControls |
|
326 |
// Gets the number of controls contained in a compound control. |
|
327 |
// ----------------------------------------------------------------------------- |
|
328 |
// |
|
329 |
TInt CCalenMissedAlarmsContainer::CountComponentControls() const |
|
330 |
{ |
|
331 |
TRACE_ENTRY_POINT; |
|
332 |
TRACE_EXIT_POINT; |
|
333 |
||
334 |
return 1; |
|
335 |
} |
|
336 |
||
337 |
// ----------------------------------------------------------------------------- |
|
338 |
// CCalenMissedAlarmsContainer::ComponentControl |
|
339 |
// Gets the specified component of a compound control. |
|
340 |
// ----------------------------------------------------------------------------- |
|
341 |
// |
|
342 |
CCoeControl* CCalenMissedAlarmsContainer::ComponentControl(TInt aIndex) const |
|
343 |
{ |
|
344 |
TRACE_ENTRY_POINT; |
|
345 |
TRACE_EXIT_POINT; |
|
346 |
switch (aIndex) |
|
347 |
{ |
|
348 |
case 0: |
|
349 |
return iListBox; |
|
350 |
default: |
|
351 |
return NULL; |
|
352 |
} |
|
353 |
} |
|
354 |
||
355 |
// ----------------------------------------------------------------------------- |
|
356 |
// CCalenMissedAlarmsContainer::OfferKeyEventL |
|
357 |
// Called by the framework when a key event needs to be processed. |
|
358 |
// ----------------------------------------------------------------------------- |
|
359 |
// |
|
360 |
TKeyResponse CCalenMissedAlarmsContainer::OfferKeyEventL( |
|
361 |
const TKeyEvent& aKeyEvent, TEventCode aType) |
|
362 |
{ |
|
363 |
TRACE_ENTRY_POINT; |
|
364 |
||
365 |
TKeyResponse ret(EKeyWasNotConsumed); |
|
366 |
||
367 |
if (EEventKey == aType) |
|
368 |
{ |
|
369 |
switch (aKeyEvent.iCode) |
|
370 |
{ |
|
371 |
case EKeyBackspace: |
|
372 |
case EKeyDelete: |
|
373 |
{ |
|
374 |
iView->HandleCommandL(ECalenCmdClear); |
|
375 |
ret = EKeyWasConsumed; |
|
376 |
} |
|
377 |
break; |
|
378 |
default: |
|
379 |
break; |
|
380 |
} |
|
381 |
} |
|
382 |
||
383 |
if(ret == EKeyWasNotConsumed) |
|
384 |
{ |
|
385 |
TInt oldCursor = iListBox->View()->CurrentItemIndex(); |
|
386 |
ret = iListBox->OfferKeyEventL(aKeyEvent, aType); |
|
387 |
TInt newCursor = iListBox->View()->CurrentItemIndex(); |
|
388 |
if(oldCursor != newCursor) |
|
389 |
{ |
|
390 |
iHighlightedRowNumber = newCursor; |
|
391 |
SetContextFromMissedAlarmEntryL(newCursor); |
|
392 |
} |
|
393 |
} |
|
394 |
TRACE_EXIT_POINT; |
|
395 |
return ret; |
|
396 |
} |
|
397 |
||
398 |
// ----------------------------------------------------------------------------- |
|
399 |
// CCalenMissedAlarmsContainer::HandleResourceChange |
|
400 |
// Handles a change to the application's resources which are shared across the environment. |
|
401 |
// ----------------------------------------------------------------------------- |
|
402 |
// |
|
403 |
void CCalenMissedAlarmsContainer::HandleResourceChange(TInt aType) |
|
404 |
{ |
|
405 |
TRACE_ENTRY_POINT; |
|
406 |
||
407 |
CCalenContainer::HandleResourceChange( aType ); |
|
408 |
||
409 |
if ( aType == KAknsMessageSkinChange || aType == KEikDynamicLayoutVariantSwitch ) |
|
410 |
{ |
|
411 |
SizeChanged(); |
|
412 |
/*TRect main_pane; |
|
413 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, main_pane ); |
|
414 |
SetRect( main_pane ); |
|
415 |
if(iListBox) |
|
416 |
{ |
|
417 |
TRect mainPane; |
|
418 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPane ); |
|
419 |
TRect bgContextRect( TPoint(0, 0), mainPane.Size() ); |
|
420 |
iListBox->SetRect( bgContextRect ); |
|
421 |
}*/ |
|
422 |
||
423 |
// refresh |
|
424 |
TRAPD(error,iView->BeginRepopulationL()); |
|
425 |
if(error!=KErrNone) |
|
426 |
{ |
|
427 |
// do avoid warning |
|
428 |
} |
|
429 |
} |
|
430 |
||
431 |
CCoeControl::HandleResourceChange( aType ); |
|
432 |
||
433 |
TRACE_EXIT_POINT; |
|
434 |
} |
|
435 |
||
436 |
// ----------------------------------------------------------------------------- |
|
437 |
// CCalenMissedAlarmsContainer::Draw |
|
438 |
// Draws the control |
|
439 |
// ----------------------------------------------------------------------------- |
|
440 |
// |
|
441 |
void CCalenMissedAlarmsContainer::Draw(const TRect& aRect) const |
|
442 |
{ |
|
443 |
TRACE_ENTRY_POINT; |
|
444 |
||
445 |
CWindowGc& gc = SystemGc(); |
|
446 |
TRect main_pane( Rect() ); |
|
447 |
||
448 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
449 |
MAknsControlContext* cc = AknsDrawUtils::ControlContext(this); |
|
450 |
||
451 |
AknsDrawUtils::Background(skin, cc, this, gc, aRect); |
|
452 |
||
453 |
TRACE_EXIT_POINT; |
|
454 |
} |
|
455 |
||
456 |
// ----------------------------------------------------------------------------- |
|
457 |
// CCalenMissedAlarmsContainer::HandlePointerEventL |
|
458 |
// Handles the pointer events in touch resolutions |
|
459 |
// ----------------------------------------------------------------------------- |
|
460 |
// |
|
461 |
void CCalenMissedAlarmsContainer::HandlePointerEventL( |
|
462 |
const TPointerEvent& aPointerEvent) |
|
463 |
{ |
|
464 |
TRACE_ENTRY_POINT; |
|
465 |
||
466 |
TInt pointerIndex(-1); |
|
467 |
TBool isItem (iListBox->View()->XYPosToItemIndex(aPointerEvent.iPosition, pointerIndex)); |
|
31
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
468 |
if(iView->IsCalenLaunchedFromExtApp()) |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
469 |
{ |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
470 |
return; |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
471 |
} |
30 | 472 |
|
473 |
if(isItem == EFalse) |
|
474 |
{ |
|
475 |
iListBox->HandlePointerEventL(aPointerEvent); |
|
476 |
return; |
|
477 |
} |
|
478 |
||
479 |
TInt index = iListBox->CurrentItemIndex(); |
|
480 |
||
481 |
switch (aPointerEvent.iType) |
|
482 |
{ |
|
483 |
case TPointerEvent::EButton1Down: |
|
484 |
{ |
|
485 |
TBool isItem (iListBox->View()->XYPosToItemIndex(aPointerEvent.iPosition, pointerIndex)); |
|
486 |
||
487 |
if(isItem && MissedAlarmsCount() > 0) |
|
488 |
{ |
|
489 |
iHighlightedRowNumber = iListBox->View()->CurrentItemIndex(); |
|
490 |
SetContextFromMissedAlarmEntryL(iListBox->View()->CurrentItemIndex()); |
|
491 |
} |
|
492 |
||
493 |
break; |
|
494 |
} |
|
495 |
case TPointerEvent::EDrag: |
|
496 |
{ |
|
497 |
/*iListBox->HandlePointerEventL(aPointerEvent); |
|
498 |
if (iFirstTap && index != iListBox->CurrentItemIndex()) |
|
499 |
{ |
|
500 |
iFirstTap = EFalse; |
|
501 |
}*/ |
|
502 |
break; |
|
503 |
} |
|
504 |
||
505 |
case TPointerEvent::EButton1Up: |
|
506 |
{ |
|
507 |
// if (iFirstTap) |
|
508 |
{ |
|
509 |
// iView->HandleCommandL(ECalenMissedEventView); |
|
510 |
} |
|
511 |
break; |
|
512 |
} |
|
513 |
default: |
|
514 |
break; |
|
515 |
} |
|
516 |
||
517 |
if ( aPointerEvent.iType != TPointerEvent::EButtonRepeat ) |
|
518 |
{ |
|
519 |
iListBox->HandlePointerEventL( aPointerEvent ); |
|
520 |
} |
|
521 |
||
522 |
TRACE_EXIT_POINT; |
|
523 |
} |
|
524 |
||
525 |
// ---------------------------------------------------------------------------- |
|
526 |
// CCalenMissedAlarmsContainer::HandleNaviDecoratorEventL |
|
527 |
// ?implementation_description |
|
528 |
// (other items were commented in a header). |
|
529 |
// ---------------------------------------------------------------------------- |
|
530 |
// |
|
531 |
void CCalenMissedAlarmsContainer::HandleNaviDecoratorEventL( TInt /*aEventID*/ ) |
|
532 |
{ |
|
533 |
TRACE_ENTRY_POINT; |
|
534 |
||
535 |
TRACE_EXIT_POINT; |
|
536 |
} |
|
537 |
||
538 |
// ---------------------------------------------------------------------------- |
|
539 |
// CCalenMissedAlarmsContainer::HandleLongTapEventL |
|
540 |
// processing of a long tap event |
|
541 |
// (other items were commented in a header). |
|
542 |
// ---------------------------------------------------------------------------- |
|
543 |
// |
|
544 |
void CCalenMissedAlarmsContainer::HandleLongTapEventL( const TPoint& /*aPenEventLocation*/, |
|
545 |
const TPoint& /*aPenEventScreenLocation*/ ) |
|
546 |
{ |
|
547 |
TRACE_ENTRY_POINT; |
|
548 |
||
549 |
TRACE_EXIT_POINT; |
|
550 |
} |
|
551 |
||
552 |
||
553 |
// ----------------------------------------------------------------------------- |
|
554 |
// CCalenMissedAlarmsContainer::CurrentItemIndex |
|
555 |
// Returns the current/highlighted listbox index |
|
556 |
// ----------------------------------------------------------------------------- |
|
557 |
// |
|
558 |
TInt CCalenMissedAlarmsContainer::CurrentItemIndex() |
|
559 |
{ |
|
560 |
TRACE_ENTRY_POINT; |
|
561 |
TRACE_EXIT_POINT; |
|
562 |
||
563 |
return iListBox->CurrentItemIndex(); |
|
564 |
} |
|
565 |
||
566 |
// ----------------------------------------------------------------------------- |
|
567 |
// CCalenMissedAlarmsContainer::SetEmptyListTextL |
|
568 |
// Sets the empty list box text (no events) |
|
569 |
// ----------------------------------------------------------------------------- |
|
570 |
// |
|
571 |
void CCalenMissedAlarmsContainer::SetEmptyListTextL() |
|
572 |
{ |
|
573 |
TRACE_ENTRY_POINT; |
|
574 |
||
575 |
HBufC* noEvents = StringLoader::LoadLC(R_CALEN_QTN_CALE_NO_EVENTS); |
|
576 |
iListBox->View()->SetListEmptyTextL(noEvents->Des()); |
|
577 |
CleanupStack::PopAndDestroy(noEvents); |
|
578 |
||
579 |
TRACE_EXIT_POINT; |
|
580 |
} |
|
581 |
||
582 |
// ----------------------------------------------------------------------------- |
|
583 |
// CCalenMissedAlarmsContainer::MissedAlarmsCount |
|
584 |
// Returns the missed alarms count. |
|
585 |
// ----------------------------------------------------------------------------- |
|
586 |
// |
|
587 |
TInt CCalenMissedAlarmsContainer::MissedAlarmsCount() |
|
588 |
{ |
|
589 |
TRACE_ENTRY_POINT; |
|
590 |
TRACE_EXIT_POINT; |
|
591 |
||
592 |
return iMissedAlarmsArray.Count(); |
|
593 |
} |
|
594 |
||
595 |
// ---------------------------------------------------------------------------- |
|
596 |
// CCalenMissedAlarmsContainer::SetHighlightingL |
|
597 |
// Sets the highlighting |
|
598 |
// ---------------------------------------------------------------------------- |
|
599 |
// |
|
600 |
void CCalenMissedAlarmsContainer::SetHighlightingL() |
|
601 |
{ |
|
602 |
TRACE_ENTRY_POINT; |
|
603 |
||
604 |
TInt focusIx = KErrNotFound; |
|
605 |
||
606 |
if ( iHighlightedRowNumber != KErrNotFound ) |
|
607 |
{ |
|
608 |
focusIx = iHighlightedRowNumber; |
|
609 |
} |
|
610 |
else |
|
611 |
{ |
|
612 |
MCalenContext& context = iServices.Context(); |
|
613 |
if ( !(context.InstanceId() == TCalenInstanceId::NullInstanceId()) ) |
|
614 |
{ |
|
615 |
iHighlightedRowNumber = focusIx = FindMissedAlarmEntryIndexL(context.InstanceId()); |
|
616 |
} |
|
617 |
} |
|
618 |
||
619 |
// If everything else fails, focus on first item |
|
620 |
if ( focusIx == KErrNotFound ) |
|
621 |
{ |
|
622 |
focusIx = 0; |
|
623 |
} |
|
624 |
||
625 |
// Set iHighlightedRowNumber as the current focus |
|
626 |
SetCurrentItemIndex( focusIx ); |
|
627 |
// Draw listbox with this new iHighlightedRowNumber value. |
|
628 |
// otherwise we won't get updated focus |
|
629 |
SetCurrentItemIndexAndDraw(); |
|
630 |
||
631 |
TRACE_EXIT_POINT; |
|
632 |
} |
|
633 |
||
634 |
// ---------------------------------------------------------------------------- |
|
635 |
// CCalenTodoContainer::SetCurrentItemIndex |
|
636 |
// Set current item index. |
|
637 |
// (other items were commented in a header). |
|
638 |
// ---------------------------------------------------------------------------- |
|
639 |
// |
|
640 |
void CCalenMissedAlarmsContainer::SetCurrentItemIndex(TInt aIndex) |
|
641 |
{ |
|
642 |
TRACE_ENTRY_POINT; |
|
643 |
||
644 |
TInt count(iMissedAlarmsArray.Count()); |
|
645 |
if( aIndex < count ) |
|
646 |
{ |
|
647 |
iHighlightedRowNumber = aIndex; |
|
648 |
} |
|
649 |
else |
|
650 |
{ |
|
651 |
iHighlightedRowNumber = count-1; |
|
652 |
} |
|
653 |
||
654 |
TRACE_EXIT_POINT; |
|
655 |
} |
|
656 |
||
657 |
// ---------------------------------------------------------------------------- |
|
658 |
// CCalenMissedAlarmsContainer::SetCurrentItemIndexAndDraw |
|
659 |
// Set current item index and draw list. |
|
660 |
// ---------------------------------------------------------------------------- |
|
661 |
// |
|
662 |
void CCalenMissedAlarmsContainer::SetCurrentItemIndexAndDraw() |
|
663 |
{ |
|
664 |
TRACE_ENTRY_POINT; |
|
665 |
||
666 |
if( iHighlightedRowNumber != KErrNotFound && |
|
667 |
iHighlightedRowNumber < iListBox->Model()->NumberOfItems() ) |
|
668 |
{ |
|
669 |
iListBox->SetCurrentItemIndexAndDraw( iHighlightedRowNumber ); |
|
670 |
} |
|
671 |
||
672 |
TRACE_EXIT_POINT; |
|
673 |
} |
|
674 |
||
675 |
// ----------------------------------------------------------------------------- |
|
676 |
// CCalenMissedAlarmsContainer::UpdateMissedAlarmsArray |
|
677 |
// Update Missed Alarms Array |
|
678 |
// ----------------------------------------------------------------------------- |
|
679 |
// |
|
680 |
void CCalenMissedAlarmsContainer::UpdateMissedAlarmsArrayL() |
|
681 |
{ |
|
682 |
TRACE_ENTRY_POINT; |
|
683 |
||
684 |
if(iMissedAlarmsArray.Count()) |
|
685 |
{ |
|
686 |
iMissedAlarmsArray.Reset(); |
|
687 |
} |
|
688 |
||
689 |
// get missed alarms list from services |
|
690 |
iServices.GetMissedAlarmsList(iMissedAlarmsArray); |
|
691 |
||
692 |
// Get the missed alarms count |
|
693 |
iMissedAlarmStore->CountL(iMissedAlarmsCount); |
|
694 |
||
695 |
TRACE_EXIT_POINT; |
|
696 |
} |
|
697 |
||
698 |
// ---------------------------------------------------------------------------- |
|
699 |
// CCalenMissedAlarmsContainer::PopulateWithMissedAlarmsL |
|
700 |
// Populate Missed alarms view |
|
701 |
// ---------------------------------------------------------------------------- |
|
702 |
// |
|
703 |
void CCalenMissedAlarmsContainer::PopulateWithMissedAlarmsL() |
|
704 |
{ |
|
705 |
TRACE_ENTRY_POINT; |
|
706 |
||
707 |
// resets list box item array |
|
708 |
if(iListBoxItemArray) |
|
709 |
{ |
|
710 |
delete iListBoxItemArray; |
|
711 |
iListBoxItemArray = NULL; |
|
712 |
} |
|
713 |
||
714 |
iListBoxItemArray = new(ELeave) CDesCArrayFlat(KMissedAlarmListBoxItems); |
|
715 |
||
716 |
if(iMissedAlarmsArray.Count()) |
|
717 |
{ |
|
718 |
for(TInt index = 0;index < iMissedAlarmsArray.Count(); index++ ) |
|
719 |
{ |
|
720 |
CreateListBoxDataL(index); |
|
721 |
} |
|
722 |
iListBox->Model()->SetItemTextArray(iListBoxItemArray); |
|
723 |
||
724 |
if(!iHighlightedRowNumber || iHighlightedRowNumber == KErrNotFound ) |
|
725 |
{ |
|
726 |
//set first missed alarm entry to the context |
|
727 |
SetContextFromMissedAlarmEntryL(0); |
|
728 |
} |
|
729 |
iListBox->HandleItemAdditionL(); |
|
730 |
} |
|
731 |
else |
|
732 |
{ |
|
733 |
iListBox->Model()->SetItemTextArray(iListBoxItemArray); |
|
734 |
SetEmptyListTextL(); |
|
735 |
} |
|
736 |
||
737 |
TRACE_EXIT_POINT; |
|
738 |
} |
|
739 |
||
740 |
// ----------------------------------------------------------------------------- |
|
741 |
// CCalenMissedAlarmsContainer::CreateListBoxDataL |
|
742 |
// Creates the list box items and appends in to listrbox item array |
|
743 |
// ----------------------------------------------------------------------------- |
|
744 |
// |
|
745 |
void CCalenMissedAlarmsContainer::CreateListBoxDataL(TInt aIndex) |
|
746 |
{ |
|
747 |
TRACE_ENTRY_POINT; |
|
748 |
||
749 |
// temporary buffer |
|
750 |
HBufC* buffer = HBufC::NewLC( KListDataLength ); |
|
751 |
CleanupStack::Pop(buffer); |
|
752 |
||
753 |
// initialise the item to construct a new listbox entry |
|
754 |
buffer->Des().Zero(); |
|
755 |
||
756 |
// double graphic style "0\tText\tText2\t1 |
|
757 |
TPtr ptr( buffer->Des() ); |
|
758 |
||
759 |
CCalEntry* entry = NULL; |
|
760 |
TTime instanceTime; |
|
761 |
TInt isEventViewed; |
|
762 |
||
763 |
// Get the missed alarm entry |
|
764 |
entry = GetMissedAlarmEntryL(aIndex); |
|
765 |
||
766 |
// Get the instance time |
|
767 |
instanceTime = GetInstanceTime(aIndex); |
|
768 |
||
769 |
// Get the viewed event info |
|
770 |
isEventViewed = GetViewedEventInfo(aIndex); |
|
771 |
||
772 |
if(entry) |
|
773 |
{ |
|
774 |
// get the icon from the entry |
|
775 |
TBuf<10> icon; |
|
776 |
TInt iconIndex(0); |
|
777 |
iconIndex =IconIndexForEntryL( *entry , isEventViewed); |
|
778 |
icon.Format(KIconFormat,iconIndex); |
|
779 |
||
780 |
ptr.Append(icon); |
|
781 |
ptr.Append(KListSeparator); |
|
782 |
||
783 |
// get the subject from the entry |
|
784 |
// Set summary |
|
785 |
// Create temporary buffer for summary |
|
786 |
||
787 |
HBufC* summary = HBufC::NewLC( KMissedAlarmListMaxLength ); |
|
788 |
TPtr summaryPtr = summary->Des(); |
|
789 |
TInt maxLength = summary->Length()- KMissedAlarmListMaxLength; |
|
790 |
CalenViewUtils::GetSummaryLocationTextL( *entry, summaryPtr, KMissedAlarmListMaxLength ); |
|
791 |
||
792 |
AknBidiTextUtils::ConvertToVisualAndClipL( summaryPtr, |
|
793 |
*iEikonEnv->NormalFont(), |
|
794 |
KListDataLength, |
|
795 |
KListDataLength ); |
|
796 |
ptr.Append(summary->Des()); |
|
797 |
ptr.Append(KListSeparator); |
|
798 |
||
799 |
CleanupStack::PopAndDestroy( summary ); |
|
800 |
||
801 |
// get the start time and date |
|
802 |
// for timed display both start time and date |
|
803 |
// append start time of the instance |
|
804 |
TBuf<10> timeString; |
|
805 |
||
806 |
if(entry->EntryTypeL() == CCalEntry::EAppt ) |
|
807 |
{ |
|
808 |
HBufC* timeFormat = StringLoader::LoadLC(R_QTN_TIME_USUAL_WITH_ZERO); |
|
809 |
instanceTime.FormatL(timeString, *timeFormat); |
|
810 |
// convert the date numbers into Arabic-Indic numbers |
|
811 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion( timeString ); |
|
812 |
CleanupStack::PopAndDestroy(timeFormat); |
|
813 |
} |
|
814 |
||
815 |
//append date |
|
816 |
TBuf<20> dateString; |
|
817 |
HBufC* dateFormat = StringLoader::LoadLC(R_QTN_DATE_USUAL_WITH_ZERO); |
|
818 |
instanceTime.FormatL(dateString, *dateFormat); |
|
819 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion( dateString ); |
|
820 |
CleanupStack::PopAndDestroy(dateFormat); |
|
821 |
||
822 |
CDesCArrayFlat* strings = new (ELeave) CDesCArrayFlat(2); |
|
823 |
CleanupStack::PushL( strings ); |
|
824 |
||
825 |
strings->AppendL(timeString); |
|
826 |
strings->AppendL(dateString); |
|
827 |
||
828 |
HBufC* timeDateFormat = StringLoader::LoadL(R_CALE_MAV_START_TIME,*strings); |
|
829 |
CleanupStack::PushL( timeDateFormat ); |
|
830 |
ptr.Append(timeDateFormat->Des()); |
|
831 |
CleanupStack::PopAndDestroy(timeDateFormat); |
|
832 |
CleanupStack::PopAndDestroy(strings);// strings |
|
833 |
||
834 |
CleanupStack::PopAndDestroy(entry); |
|
835 |
||
836 |
ptr.Append( KListSeparator ); |
|
837 |
||
838 |
iListBoxItemArray->AppendL(ptr); |
|
839 |
} |
|
840 |
||
841 |
delete buffer; |
|
842 |
||
843 |
TRACE_EXIT_POINT; |
|
844 |
} |
|
845 |
||
846 |
// ----------------------------------------------------------------------------- |
|
847 |
// CCalenMissedAlarmsContainer::GetMissedAlarmEntryL |
|
848 |
// Get a Missed Alarm entry based on the index |
|
849 |
// ----------------------------------------------------------------------------- |
|
850 |
// |
|
851 |
CCalEntry* CCalenMissedAlarmsContainer::GetMissedAlarmEntryL(TInt aIndex) const |
|
852 |
{ |
|
853 |
TRACE_ENTRY_POINT; |
|
854 |
||
855 |
TInt localUid; |
|
856 |
TTime instanceTime; |
|
857 |
TCalenInstanceId missedAlarm = iMissedAlarmsArray[aIndex]; |
|
858 |
||
859 |
// get the local uid and instancetime |
|
860 |
localUid = missedAlarm.iEntryLocalUid; |
|
861 |
instanceTime = missedAlarm.iInstanceTime; |
|
862 |
||
863 |
CCalEntry* entry=NULL; |
|
864 |
// Get the entry using the localUid |
|
865 |
TRAP_IGNORE(entry=iServices.EntryViewL(missedAlarm.iColId)->FetchL(localUid)); |
|
866 |
||
867 |
CleanupStack::PushL(entry); |
|
868 |
||
869 |
TRACE_EXIT_POINT; |
|
870 |
return entry; |
|
871 |
} |
|
872 |
||
873 |
// ----------------------------------------------------------------------------- |
|
874 |
// CCalenMissedAlarmsContainer::GetInstanceTime |
|
875 |
// Get the instance time |
|
876 |
// ----------------------------------------------------------------------------- |
|
877 |
// |
|
878 |
TTime CCalenMissedAlarmsContainer::GetInstanceTime(TInt aIndex) const |
|
879 |
{ |
|
880 |
TRACE_ENTRY_POINT; |
|
881 |
||
882 |
TCalenInstanceId missedAlarm = iMissedAlarmsArray[aIndex]; |
|
883 |
||
884 |
TRACE_EXIT_POINT; |
|
885 |
return missedAlarm.iInstanceTime; |
|
886 |
} |
|
887 |
||
888 |
// ----------------------------------------------------------------------------- |
|
889 |
// CCalenMissedAlarmsContainer::GetViewedEventInfo |
|
890 |
// Get the viewed event information |
|
891 |
// ----------------------------------------------------------------------------- |
|
892 |
// |
|
893 |
TInt CCalenMissedAlarmsContainer::GetViewedEventInfo(TInt aIndex) |
|
894 |
{ |
|
895 |
TRACE_ENTRY_POINT; |
|
896 |
||
897 |
TCalenInstanceId missedAlarm= iMissedAlarmsArray[aIndex]; |
|
898 |
||
899 |
TRACE_EXIT_POINT; |
|
900 |
return missedAlarm.iInstanceViewed; |
|
901 |
} |
|
902 |
||
903 |
// ---------------------------------------------------------------------------- |
|
904 |
// CCalenMissedAlarmsContainer::CompletePopulationL |
|
905 |
// Complete population |
|
906 |
// ---------------------------------------------------------------------------- |
|
907 |
// |
|
908 |
void CCalenMissedAlarmsContainer::CompletePopulationL() |
|
909 |
{ |
|
910 |
TRACE_ENTRY_POINT; |
|
911 |
||
912 |
AddToStackAndMakeVisibleL(); |
|
913 |
SetHighlightingL(); |
|
914 |
DrawDeferred(); |
|
915 |
||
916 |
TRACE_EXIT_POINT; |
|
917 |
} |
|
918 |
||
919 |
// ----------------------------------------------------------------------------- |
|
920 |
// CCalenMissedAlarmsContainer::SetContextFromMissedAlarmEntryL |
|
921 |
// Sets the context from the current focused missed alarm entry |
|
922 |
// ----------------------------------------------------------------------------- |
|
923 |
// |
|
924 |
void CCalenMissedAlarmsContainer::SetContextFromMissedAlarmEntryL(TInt aIndex) |
|
925 |
{ |
|
926 |
TRACE_ENTRY_POINT; |
|
927 |
||
928 |
TCalenInstanceId missedAlarm = iMissedAlarmsArray[aIndex]; |
|
929 |
||
930 |
CCalEntry* entry = iServices.EntryViewL(missedAlarm.iColId)->FetchL( missedAlarm.iEntryLocalUid ); |
|
931 |
//User::LeaveIfNull( entry ); |
|
932 |
if (entry) |
|
933 |
{ |
|
934 |
CleanupStack::PushL( entry ); |
|
935 |
||
936 |
TTime instanceTime; |
|
937 |
TCalTime inscaltime; |
|
938 |
||
939 |
instanceTime = CalenAgendaUtils::EntryTimeL( *entry ); |
|
940 |
inscaltime.SetTimeLocalL( instanceTime ); |
|
941 |
||
942 |
// set the context |
|
943 |
MCalenContext &context = iServices.Context(); |
|
944 |
TCalenInstanceId id = TCalenInstanceId::CreateL( *entry, inscaltime ); |
|
945 |
id.iColId = missedAlarm.iColId; |
|
946 |
context.SetInstanceIdL( id, context.ViewId() ); |
|
947 |
||
948 |
CleanupStack::PopAndDestroy( entry ); |
|
949 |
} |
|
950 |
||
951 |
TRACE_EXIT_POINT; |
|
952 |
} |
|
953 |
||
954 |
// ----------------------------------------------------------------------------- |
|
955 |
// CCalenMissedAlarmsContainer::FindMissedAlarmEntryIndexL |
|
956 |
// Find missed alarm entry's index |
|
957 |
// ----------------------------------------------------------------------------- |
|
958 |
// |
|
959 |
TInt CCalenMissedAlarmsContainer::FindMissedAlarmEntryIndexL( |
|
960 |
const TCalenInstanceId& aId) |
|
961 |
{ |
|
962 |
TRACE_ENTRY_POINT; |
|
963 |
||
964 |
for(TInt index(0); index < iMissedAlarmsArray.Count(); ++index) |
|
965 |
{ |
|
966 |
if( iMissedAlarmsArray[index].iEntryLocalUid == aId.iEntryLocalUid ) |
|
967 |
{ |
|
968 |
TRACE_EXIT_POINT; |
|
969 |
return index; |
|
970 |
} |
|
971 |
} |
|
972 |
||
973 |
TRACE_EXIT_POINT; |
|
974 |
return KErrNotFound; |
|
975 |
} |
|
976 |
||
977 |
||
978 |
void CCalenMissedAlarmsContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, |
|
979 |
TListBoxEvent aEventType) |
|
980 |
{ |
|
981 |
TRACE_ENTRY_POINT; |
|
982 |
switch( aEventType ) |
|
983 |
{ |
|
984 |
// Single click integration |
|
985 |
case EEventItemSingleClicked: |
|
986 |
{ |
|
987 |
iHighlightedRowNumber = iListBox->View()->CurrentItemIndex(); |
|
988 |
||
989 |
SetContextFromMissedAlarmEntryL(iListBox->View()->CurrentItemIndex()); |
|
990 |
//Handle listbox item selection event |
|
991 |
// iListBox->HandlePointerEventL(aPointerEvent); |
|
992 |
if(iView->MenuBar()->IsDisplayed() == EFalse) |
|
993 |
{ |
|
994 |
iView->HandleCommandL( ECalenMissedEventView ); |
|
995 |
} |
|
996 |
break; |
|
997 |
} |
|
998 |
||
999 |
// Single click integration |
|
1000 |
case EEventEnterKeyPressed: |
|
1001 |
{ |
|
1002 |
iHighlightedRowNumber = iListBox->View()->CurrentItemIndex(); |
|
1003 |
||
1004 |
SetContextFromMissedAlarmEntryL(iListBox->View()->CurrentItemIndex()); |
|
1005 |
iView->HandleCommandL( ECalenMissedEventView ); |
|
1006 |
break; |
|
1007 |
} |
|
1008 |
default: |
|
1009 |
break; |
|
1010 |
}; |
|
1011 |
TRACE_EXIT_POINT; |
|
1012 |
} |
|
1013 |
||
1014 |
||
1015 |
||
1016 |
// End of File |