66
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 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 To-Do view's controls.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#include <AknIconArray.h>
|
|
21 |
#include <aknlists.h>
|
|
22 |
#include <AknsUtils.h>
|
|
23 |
#include <avkon.mbg>
|
|
24 |
#include <aknbutton.h>
|
|
25 |
#include <akntoolbar.h>
|
|
26 |
#include <calalarm.h>
|
|
27 |
#include <calentry.h>
|
|
28 |
#include <calinstance.h>
|
|
29 |
#include <data_caging_path_literals.hrh>
|
|
30 |
#include <eikclbd.h>
|
|
31 |
#include <eikmenub.h>
|
|
32 |
#include <gulicon.h>
|
|
33 |
#include <StringLoader.h>
|
|
34 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
35 |
#include <barsread.h>
|
|
36 |
#include <calencontext.h>
|
|
37 |
#include <aknlayoutscalable_apps.cdl.h>
|
|
38 |
#include <AknsFrameBackgroundControlContext.h>
|
|
39 |
#include <centralrepository.h>
|
|
40 |
#include <caleninstanceid.h>
|
|
41 |
#include <calenviewutils.h>
|
|
42 |
#include <calenservices.h>
|
|
43 |
#include <calendateutils.h>
|
|
44 |
#include <calenagendautils.h>
|
|
45 |
#include <calendar.mbg>
|
|
46 |
#include <Calendar.rsg>
|
|
47 |
#include <csxhelp/cale.hlp.hrh> // For help context of ToDo
|
|
48 |
#include <calcalendarinfo.h>
|
|
49 |
|
|
50 |
#include "calendarui_debug.h"
|
|
51 |
#include "calentodoview.h"
|
|
52 |
#include "calentodocontainer.h"
|
|
53 |
#include "calentodocontroller.h"
|
|
54 |
#include "calencontainerlayoutmanager.h" // CCalenContainerLayoutManager
|
|
55 |
#include "calencontroller.h"
|
|
56 |
#include "CalendarPrivateCRKeys.h"
|
|
57 |
#include "calenglobaldata.h"
|
|
58 |
#include "calendar.hrh"
|
|
59 |
#include "CalenUid.h"
|
|
60 |
#include "calenicons.h"
|
|
61 |
|
|
62 |
// LOCAL CONSTANTS AND MACROS
|
|
63 |
const TInt KListDataLength(100);
|
|
64 |
const TInt KListDataLengthOfSubject(60);
|
|
65 |
|
|
66 |
_LIT( KTaskStateFormat, "%d\t" );
|
|
67 |
_LIT( KListSeparatorFormat, "\t" );
|
|
68 |
_LIT( KIconSeparatorFormat, " \t%d" );
|
|
69 |
_LIT( KSpaceText, " " );
|
|
70 |
|
|
71 |
|
|
72 |
// LOCAL FUNCTIONS
|
|
73 |
|
|
74 |
// ----------------------------------------------------------------------------
|
|
75 |
// Check the date of todo entry is valid
|
|
76 |
// ----------------------------------------------------------------------------
|
|
77 |
//
|
|
78 |
static TBool IsValidDueDateL(CCalInstance* aInstance)
|
|
79 |
{
|
|
80 |
TRACE_ENTRY_POINT;
|
|
81 |
|
|
82 |
CCalEntry& entry = aInstance->Entry();
|
|
83 |
|
|
84 |
if( entry.EntryTypeL() == CCalEntry::ETodo )
|
|
85 |
{
|
|
86 |
TTime endTime = entry.EndTimeL().TimeLocalL();
|
|
87 |
|
|
88 |
if( endTime != Time::NullTTime() )
|
|
89 |
{
|
|
90 |
TRACE_EXIT_POINT;
|
|
91 |
return CalenDateUtils::IsValidDay( endTime );
|
|
92 |
}
|
|
93 |
}
|
|
94 |
|
|
95 |
TRACE_EXIT_POINT;
|
|
96 |
return EFalse; // The due date is NULL or entry is not Todo entry
|
|
97 |
}
|
|
98 |
|
|
99 |
|
|
100 |
// ================= MEMBER FUNCTIONS =======================
|
|
101 |
|
|
102 |
// ----------------------------------------------------------------------------
|
|
103 |
// CCalenTodoListBoxItemDrawer::CCalenTodoListBoxItemDrawer
|
|
104 |
// ----------------------------------------------------------------------------
|
|
105 |
//
|
|
106 |
CCalenTodoListBoxItemDrawer::CCalenTodoListBoxItemDrawer( MTextListBoxModel* aTextListBoxModel,
|
|
107 |
const CFont* aFont,
|
|
108 |
CColumnListBoxData* aFormattedCellData,
|
|
109 |
CEikListBox* aListBox ,
|
|
110 |
const RArray<TInt>& aColorUidArray)
|
|
111 |
:CSingleHeadingStyleItemDrawer(aTextListBoxModel, aFont, aFormattedCellData),
|
|
112 |
iListBox( aListBox ),
|
|
113 |
iColorUidArray(aColorUidArray)
|
|
114 |
{
|
|
115 |
TRACE_ENTRY_POINT
|
|
116 |
TRACE_EXIT_POINT
|
|
117 |
}
|
|
118 |
|
|
119 |
|
|
120 |
// ----------------------------------------------------------------------------
|
|
121 |
// CCalenTodoListBoxItemDrawer::~CCalenTodoListBoxItemDrawer
|
|
122 |
// ----------------------------------------------------------------------------
|
|
123 |
//
|
|
124 |
CCalenTodoListBoxItemDrawer::~CCalenTodoListBoxItemDrawer()
|
|
125 |
{
|
|
126 |
TRACE_ENTRY_POINT
|
|
127 |
TRACE_ENTRY_POINT
|
|
128 |
}
|
|
129 |
|
|
130 |
// ----------------------------------------------------------------------------
|
|
131 |
// CCalenTodoListBoxItemDrawer::DrawItem
|
|
132 |
// ----------------------------------------------------------------------------
|
|
133 |
//
|
|
134 |
void CCalenTodoListBoxItemDrawer::DrawItem(TInt aItemIndex,
|
|
135 |
TPoint aItemRectPos,
|
|
136 |
TBool aItemIsSelected,
|
|
137 |
TBool aItemIsCurrent,
|
|
138 |
TBool aViewIsEmphasized,
|
|
139 |
TBool aViewIsDimmed) const
|
|
140 |
{
|
|
141 |
TRACE_ENTRY_POINT
|
|
142 |
TRect actualItemRect(aItemRectPos, iItemCellSize);
|
|
143 |
|
|
144 |
SetupGc(aItemIndex);
|
|
145 |
|
|
146 |
CSingleHeadingStyleItemDrawer::DrawItem(aItemIndex,
|
|
147 |
aItemRectPos,
|
|
148 |
aItemIsSelected,
|
|
149 |
aItemIsCurrent,
|
|
150 |
aViewIsEmphasized,
|
|
151 |
aViewIsDimmed);
|
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
|
|
156 |
TAknWindowComponentLayout tempLayout = AknLayoutScalable_Apps::list_cale_time_pane_g6(0);
|
|
157 |
TAknLayoutRect colourstrips;
|
|
158 |
colourstrips.LayoutRect( actualItemRect, tempLayout.LayoutLine() );
|
|
159 |
|
|
160 |
iGc->SetPenColor( CGraphicsContext::ENullPen );
|
|
161 |
iGc->DrawRect( colourstrips.Rect() );
|
|
162 |
iGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
|
|
163 |
iGc->SetBrushColor( TRgb(iColorUidArray[aItemIndex] ));
|
|
164 |
iGc->DrawRect( colourstrips.Rect() );
|
|
165 |
|
|
166 |
TRACE_EXIT_POINT
|
|
167 |
}
|
|
168 |
|
|
169 |
// ----------------------------------------------------------------------------
|
|
170 |
// CCalenTodoListBox::CCalenTodoListBox
|
|
171 |
// ----------------------------------------------------------------------------
|
|
172 |
//
|
|
173 |
CCalenTodoListBox::CCalenTodoListBox(const RArray<TInt>& aColorUidArray) :
|
|
174 |
iColorUidArray(aColorUidArray)
|
|
175 |
{
|
|
176 |
TRACE_ENTRY_POINT
|
|
177 |
TRACE_EXIT_POINT
|
|
178 |
}
|
|
179 |
|
|
180 |
// ----------------------------------------------------------------------------
|
|
181 |
// CCalenTodoListBox::CreateItemDrawerL
|
|
182 |
// ----------------------------------------------------------------------------
|
|
183 |
//
|
|
184 |
void CCalenTodoListBox::CreateItemDrawerL()
|
|
185 |
{
|
|
186 |
TRACE_ENTRY_POINT
|
|
187 |
CColumnListBoxData* listboxData = CColumnListBoxData::NewL();
|
|
188 |
CleanupStack::PushL( listboxData );
|
|
189 |
iItemDrawer = new ( ELeave) CCalenTodoListBoxItemDrawer( Model(),
|
|
190 |
iEikonEnv->NormalFont(),
|
|
191 |
listboxData,
|
|
192 |
this ,
|
|
193 |
iColorUidArray);
|
|
194 |
CleanupStack::Pop( listboxData );
|
|
195 |
TRACE_EXIT_POINT
|
|
196 |
}
|
|
197 |
|
|
198 |
// ----------------------------------------------------------------------------
|
|
199 |
// CCalenTodoListBox::SizeChangedL
|
|
200 |
// ----------------------------------------------------------------------------
|
|
201 |
//
|
|
202 |
void CCalenTodoListBox::SizeChangedL()
|
|
203 |
{
|
|
204 |
//Pass to base class
|
|
205 |
CAknSingleGraphicHeadingStyleListBox::SizeChanged();
|
|
206 |
}
|
|
207 |
|
|
208 |
// ----------------------------------------------------------------------------
|
|
209 |
// CCalenTodoListBox::SizeChanged
|
|
210 |
// ----------------------------------------------------------------------------
|
|
211 |
//
|
|
212 |
void CCalenTodoListBox::SizeChanged()
|
|
213 |
{
|
|
214 |
TRACE_ENTRY_POINT
|
|
215 |
TRAP_IGNORE(SizeChangedL());
|
|
216 |
TRACE_EXIT_POINT
|
|
217 |
}
|
|
218 |
|
|
219 |
// ----------------------------------------------------------------------------
|
|
220 |
// CCalenTodoListBox::MakeViewClassInstanceL
|
|
221 |
// ----------------------------------------------------------------------------
|
|
222 |
//
|
|
223 |
CListBoxView* CCalenTodoListBox::MakeViewClassInstanceL()
|
|
224 |
{
|
|
225 |
TRACE_ENTRY_POINT
|
|
226 |
TRACE_EXIT_POINT
|
|
227 |
return new(ELeave) CSingleHeadingStyleView;
|
|
228 |
}
|
|
229 |
|
|
230 |
// ----------------------------------------------------------------------------
|
|
231 |
// CCalenTodoContainer::CCalenTodoContainer
|
|
232 |
// C++ constructor.
|
|
233 |
// ----------------------------------------------------------------------------
|
|
234 |
//
|
|
235 |
CCalenTodoContainer::CCalenTodoContainer( CCalenNativeView* aView,
|
|
236 |
TInt& aHighlightedRowNumber,
|
|
237 |
TInt& aFirstEntryOnScreenIndex,
|
|
238 |
MCalenServices& aServices )
|
|
239 |
: CCalenContainer( aView, aServices ),
|
|
240 |
iHighlightedRowNumber( aHighlightedRowNumber ),
|
|
241 |
iFirstEntryOnScreenIndex( aFirstEntryOnScreenIndex )
|
|
242 |
{
|
|
243 |
TRACE_ENTRY_POINT;
|
|
244 |
TRACE_EXIT_POINT;
|
|
245 |
}
|
|
246 |
|
|
247 |
// ----------------------------------------------------------------------------
|
|
248 |
// CCalenTodoContainer::~CCalenTodoContainer
|
|
249 |
// Destructor
|
|
250 |
// ----------------------------------------------------------------------------
|
|
251 |
//
|
|
252 |
CCalenTodoContainer::~CCalenTodoContainer()
|
|
253 |
{
|
|
254 |
TRACE_ENTRY_POINT;
|
|
255 |
delete iController;
|
|
256 |
delete iDesArray;
|
|
257 |
delete iListBox;
|
|
258 |
//delete iEmptyListText;
|
|
259 |
|
|
260 |
iColorUidArray.Close();
|
|
261 |
TRACE_EXIT_POINT;
|
|
262 |
}
|
|
263 |
|
|
264 |
// ---------------------------------------------------------
|
|
265 |
// CToDoContainer::HandleListBoxEventL
|
|
266 |
// Handle events incoming from list instance.
|
|
267 |
// ---------------------------------------------------------
|
|
268 |
//
|
|
269 |
void CCalenTodoContainer::HandleListBoxEventL( CEikListBox* /*aListBox*/,
|
|
270 |
TListBoxEvent aEventType)
|
|
271 |
{
|
|
272 |
TRACE_ENTRY_POINT;
|
|
273 |
switch( aEventType )
|
|
274 |
{
|
|
275 |
case EEventItemSingleClicked:
|
|
276 |
case EEventEnterKeyPressed:
|
|
277 |
{
|
|
278 |
if(iView->MenuBar()->IsDisplayed() == EFalse )
|
|
279 |
{
|
|
280 |
// Single click integration
|
|
281 |
if( MarkedCount() )
|
|
282 |
{
|
|
283 |
// display the context sensitive menu
|
|
284 |
CEikMenuBar* menuBar = iView->MenuBar();
|
|
285 |
menuBar->SetContextMenuTitleResourceId(
|
|
286 |
R_TODO_LIST_SELECTION_CONTEXT_MENUBAR );
|
|
287 |
menuBar->TryDisplayContextMenuBarL();
|
|
288 |
}
|
|
289 |
else
|
|
290 |
{
|
|
291 |
static_cast<CCalenTodoView*>( iView )->HandleCommandL(
|
|
292 |
ECalenViewCurrentEntry );
|
|
293 |
}
|
|
294 |
}
|
|
295 |
break;
|
|
296 |
}
|
|
297 |
default:
|
|
298 |
break;
|
|
299 |
}
|
|
300 |
TRACE_EXIT_POINT;
|
|
301 |
}
|
|
302 |
|
|
303 |
// ----------------------------------------------------------------------------
|
|
304 |
// CCalenTodoContainer::Controller
|
|
305 |
// Return pointer of controler for Agenda server.
|
|
306 |
// ----------------------------------------------------------------------------
|
|
307 |
//
|
|
308 |
CCalenTodoController* CCalenTodoContainer::Controller()
|
|
309 |
{
|
|
310 |
TRACE_ENTRY_POINT;
|
|
311 |
|
|
312 |
TRACE_EXIT_POINT;
|
|
313 |
return iController;
|
|
314 |
}
|
|
315 |
|
|
316 |
// ----------------------------------------------------------------------------
|
|
317 |
// CCalenTodoContainer::CurrentItemIndex
|
|
318 |
// Return a focused item index.
|
|
319 |
// (other items were commented in a header).
|
|
320 |
// ----------------------------------------------------------------------------
|
|
321 |
//
|
|
322 |
TInt CCalenTodoContainer::CurrentItemIndex() const
|
|
323 |
{
|
|
324 |
TRACE_ENTRY_POINT;
|
|
325 |
|
|
326 |
TInt index( KErrNotFound );
|
|
327 |
|
|
328 |
if( iListBox->Model()->NumberOfItems() )
|
|
329 |
{
|
|
330 |
index = iListBox->CurrentItemIndex();
|
|
331 |
}
|
|
332 |
|
|
333 |
TRACE_EXIT_POINT;
|
|
334 |
return index;
|
|
335 |
}
|
|
336 |
|
|
337 |
// ----------------------------------------------------------------------------
|
|
338 |
// CCalenTodoContainer::ConstructImplL
|
|
339 |
// Third phase constructor.
|
|
340 |
// (other items were commented in a header).
|
|
341 |
// ----------------------------------------------------------------------------
|
|
342 |
//
|
|
343 |
void CCalenTodoContainer::ConstructImplL()
|
|
344 |
{
|
|
345 |
TRACE_ENTRY_POINT;
|
|
346 |
|
|
347 |
iController = new( ELeave )CCalenTodoController( iServices );
|
|
348 |
iController->ConstructL();
|
|
349 |
|
|
350 |
iDesArray = new (ELeave) CDesCArrayFlat(5);
|
|
351 |
iListBox = new (ELeave) CCalenTodoListBox(iColorUidArray);
|
|
352 |
iListBox->SetContainerWindowL( *this );
|
|
353 |
iListBox->ConstructL(this, EAknListBoxMarkableList);
|
|
354 |
iListBox->SetListBoxObserver( this );
|
|
355 |
|
|
356 |
// Create scroll bar
|
|
357 |
iListBox->CreateScrollBarFrameL(ETrue);
|
|
358 |
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
|
|
359 |
CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
|
|
360 |
|
|
361 |
CTextListBoxModel* model = iListBox->Model();
|
|
362 |
model->SetItemTextArray(iDesArray);
|
|
363 |
model->SetOwnershipType(ELbmDoesNotOwnItemArray);
|
|
364 |
|
|
365 |
CAknIconArray* iconList = CreateIconsL( iIconIndices, KCalenTodoViewUidValue );
|
|
366 |
|
|
367 |
// Transfer iconlist ownership to the listbox
|
|
368 |
iListBox->ItemDrawer()->ColumnData()->SetIconArray( iconList );
|
|
369 |
|
|
370 |
/*// Save empty text and set null for list box.
|
|
371 |
// It is made not to display "No data".
|
|
372 |
iEmptyListText = iListBox->View()->EmptyListText()->AllocL();*/
|
|
373 |
|
|
374 |
//set NULL string so that "no entries" is not shown
|
|
375 |
//until the list is populated
|
|
376 |
iListBox->View()->SetListEmptyTextL( KNullDesC );
|
|
377 |
|
|
378 |
TRACE_EXIT_POINT;
|
|
379 |
}
|
|
380 |
|
|
381 |
// ----------------------------------------------------------------------------
|
|
382 |
// CCalenTodoContainer::SetCurrentItemIndex
|
|
383 |
// Set current item index.
|
|
384 |
// (other items were commented in a header).
|
|
385 |
// ----------------------------------------------------------------------------
|
|
386 |
//
|
|
387 |
void CCalenTodoContainer::SetCurrentItemIndex(TInt aIndex)
|
|
388 |
{
|
|
389 |
TRACE_ENTRY_POINT;
|
|
390 |
|
|
391 |
TInt count( iController->Count() );
|
|
392 |
|
|
393 |
if( aIndex < count )
|
|
394 |
{
|
|
395 |
iHighlightedRowNumber = aIndex;
|
|
396 |
}
|
|
397 |
else
|
|
398 |
{
|
|
399 |
iHighlightedRowNumber = count -1;
|
|
400 |
}
|
|
401 |
|
|
402 |
TRACE_EXIT_POINT;
|
|
403 |
}
|
|
404 |
|
|
405 |
// ----------------------------------------------------------------------------
|
|
406 |
// CCalenTodoContainer::ListBox
|
|
407 |
// Return list box pointer.
|
|
408 |
// ----------------------------------------------------------------------------
|
|
409 |
//
|
|
410 |
CEikColumnListBox* CCalenTodoContainer::ListBox() const
|
|
411 |
{
|
|
412 |
TRACE_ENTRY_POINT;
|
|
413 |
|
|
414 |
TRACE_EXIT_POINT;
|
|
415 |
return iListBox;
|
|
416 |
}
|
|
417 |
|
|
418 |
// ----------------------------------------------------------------------------
|
|
419 |
// CCalenTodoContainer::MarkedCount
|
|
420 |
// Return marked count of list box.
|
|
421 |
// ----------------------------------------------------------------------------
|
|
422 |
//
|
|
423 |
TInt CCalenTodoContainer::MarkedCount()
|
|
424 |
{
|
|
425 |
TRACE_ENTRY_POINT;
|
|
426 |
|
|
427 |
TRACE_EXIT_POINT;
|
|
428 |
return ListBox()->SelectionIndexes()->Count();
|
|
429 |
}
|
|
430 |
|
|
431 |
// ----------------------------------------------------------------------------
|
|
432 |
// CCalenTodoContainer::SetCurrentItemIndexAndDraw
|
|
433 |
// Set current item index and draw list.
|
|
434 |
// ----------------------------------------------------------------------------
|
|
435 |
//
|
|
436 |
void CCalenTodoContainer::SetCurrentItemIndexAndDraw()
|
|
437 |
{
|
|
438 |
TRACE_ENTRY_POINT;
|
|
439 |
|
|
440 |
if( iHighlightedRowNumber != KErrNotFound &&
|
|
441 |
iHighlightedRowNumber < iListBox->Model()->NumberOfItems() )
|
|
442 |
{
|
|
443 |
iListBox->SetCurrentItemIndexAndDraw( iHighlightedRowNumber );
|
|
444 |
}
|
|
445 |
|
|
446 |
TRACE_EXIT_POINT;
|
|
447 |
}
|
|
448 |
|
|
449 |
// ----------------------------------------------------------------------------
|
|
450 |
// CCalenTodoContainer::SetHighlightingL
|
|
451 |
// Sets the highlighting
|
|
452 |
// ----------------------------------------------------------------------------
|
|
453 |
//
|
|
454 |
void CCalenTodoContainer::SetHighlightingL()
|
|
455 |
{
|
|
456 |
TRACE_ENTRY_POINT;
|
|
457 |
|
|
458 |
TInt focusIx = KErrNotFound;
|
|
459 |
TInt topIx = KErrNotFound;
|
|
460 |
|
|
461 |
topIx = iListBox->TopItemIndex();
|
|
462 |
// If top item is specified, set it
|
|
463 |
if ( topIx != KErrNotFound )
|
|
464 |
{
|
|
465 |
iListBox->SetTopItemIndex( topIx );
|
|
466 |
}
|
|
467 |
|
|
468 |
if ( iHighlightedRowNumber != KErrNotFound )
|
|
469 |
{
|
|
470 |
focusIx = iHighlightedRowNumber;
|
|
471 |
}
|
|
472 |
else
|
|
473 |
{
|
|
474 |
MCalenContext& context = iServices.Context();
|
|
475 |
if ( !(context.InstanceId() == TCalenInstanceId::NullInstanceId()) )
|
|
476 |
{
|
|
477 |
iHighlightedRowNumber = focusIx = iController->FindInstanceIndexL( context.InstanceId() );
|
|
478 |
}
|
|
479 |
}
|
|
480 |
|
|
481 |
// If everything else fails, focus on first item
|
|
482 |
if ( focusIx == KErrNotFound )
|
|
483 |
{
|
|
484 |
focusIx = 0;
|
|
485 |
}
|
|
486 |
|
|
487 |
// Set iHighlightedRowNumber as the current focus
|
|
488 |
SetCurrentItemIndex( focusIx );
|
|
489 |
// Draw listbox with this new iHighlightedRowNumber value.
|
|
490 |
// otherwise we won't get updated focus
|
|
491 |
SetCurrentItemIndexAndDraw();
|
|
492 |
|
|
493 |
iListBox->View()->SetDisableRedraw( EFalse );
|
|
494 |
DrawNow();
|
|
495 |
|
|
496 |
// static_cast<CCalenTodoView*>(iView)->SaveCurrentItemIndexL();
|
|
497 |
|
|
498 |
TRACE_EXIT_POINT;
|
|
499 |
}
|
|
500 |
|
|
501 |
// ----------------------------------------------------------------------------
|
|
502 |
// CCalenTodoContainer::CreateEntryItertorL
|
|
503 |
// Creat all item data and draw for list box.
|
|
504 |
// ----------------------------------------------------------------------------
|
|
505 |
//
|
|
506 |
void CCalenTodoContainer::CreateEntryItertorL()
|
|
507 |
{
|
|
508 |
TRACE_ENTRY_POINT;
|
|
509 |
|
|
510 |
TInt cnt( iController->Count() );
|
|
511 |
TInt empflag( 0 );
|
|
512 |
|
|
513 |
if( cnt == 0 )
|
|
514 |
{
|
|
515 |
empflag = 1; // Set empty flag.
|
|
516 |
cnt = 1;
|
|
517 |
}
|
|
518 |
else
|
|
519 |
{
|
|
520 |
iController->SetToStartL();
|
|
521 |
}
|
|
522 |
|
|
523 |
iListBox->View()->SetDisableRedraw( ETrue );
|
|
524 |
iListBox->Reset(); // Clear all items.
|
|
525 |
iDesArray->Reset();
|
|
526 |
iColorUidArray.Reset();
|
|
527 |
|
|
528 |
RPointerArray<CCalCalendarInfo> calendarInfoList;
|
|
529 |
iServices.GetAllCalendarInfoL(calendarInfoList);
|
|
530 |
CleanupClosePushL(calendarInfoList);
|
|
531 |
|
|
532 |
HBufC* listDes = HBufC::NewLC( KListDataLength );
|
|
533 |
for( TInt loop(0); loop < cnt; ++loop )
|
|
534 |
{
|
|
535 |
TPtr ptr = listDes->Des();
|
|
536 |
ptr.Zero(); // Set zero length.
|
|
537 |
|
|
538 |
if( !empflag )
|
|
539 |
{
|
|
540 |
TBool dbStatus = EFalse;
|
|
541 |
// List is not empty.
|
|
542 |
if( !iController->IsAtEnd() )
|
|
543 |
{
|
|
544 |
// Make one line data for list box.
|
|
545 |
CCalInstance* instance = iController->Instance();
|
|
546 |
TCalCollectionId colId = instance->InstanceIdL().iCollectionId;
|
|
547 |
HBufC* calendarFileName = iServices.GetCalFileNameForCollectionId(colId).AllocLC();
|
|
548 |
TInt index = calendarInfoList.Find( *calendarFileName,
|
|
549 |
CCalenTodoContainer::CalendarInfoIdentifierL );
|
|
550 |
CleanupStack::PopAndDestroy(calendarFileName);
|
|
551 |
|
|
552 |
if(index != KErrNotFound && calendarInfoList[index]->Enabled())
|
|
553 |
{
|
|
554 |
MakeListDataL( instance, ptr );
|
|
555 |
dbStatus = ETrue;
|
|
556 |
//We want this in the listbox drawer
|
|
557 |
iColorUidArray.Append(calendarInfoList[index]->Color().Value());
|
|
558 |
iController->iActiveListIndices.AppendL(loop);
|
|
559 |
}
|
|
560 |
iController->SetToNextL();
|
|
561 |
}
|
|
562 |
else
|
|
563 |
{
|
|
564 |
cnt = 0;
|
|
565 |
}
|
|
566 |
|
|
567 |
if(dbStatus)
|
|
568 |
iDesArray->AppendL( *listDes );
|
|
569 |
|
|
570 |
}
|
|
571 |
}
|
|
572 |
|
|
573 |
CleanupStack::PopAndDestroy( listDes );
|
|
574 |
CleanupStack::PopAndDestroy( &calendarInfoList );
|
|
575 |
iListBox->HandleItemAdditionL();
|
|
576 |
|
|
577 |
//Whenever listbox is empty, it will set with this empty text.
|
|
578 |
HBufC* emptyText = StringLoader::LoadLC(R_CALEN_QTN_CALE_NO_EVENTS,
|
|
579 |
iEikonEnv);
|
|
580 |
iListBox->View()->SetListEmptyTextL( *emptyText );
|
|
581 |
CleanupStack::PopAndDestroy(emptyText);
|
|
582 |
|
|
583 |
|
|
584 |
TRACE_EXIT_POINT;
|
|
585 |
}
|
|
586 |
|
|
587 |
// ----------------------------------------------------------------------------
|
|
588 |
// CCalenTodoContainer::MakeListDataL
|
|
589 |
// Make a list data of ToDo list.
|
|
590 |
// (other items were commented in a header).
|
|
591 |
// ----------------------------------------------------------------------------
|
|
592 |
//
|
|
593 |
void CCalenTodoContainer::MakeListDataL(CCalInstance* aInstance, TPtr& aPtr)
|
|
594 |
{
|
|
595 |
TRACE_ENTRY_POINT;
|
|
596 |
|
|
597 |
CCalEntry& entry = aInstance->Entry();
|
|
598 |
|
|
599 |
// Set a due date
|
|
600 |
TTime duedate;
|
|
601 |
|
|
602 |
if( IsValidDueDateL( aInstance ) )
|
|
603 |
{
|
|
604 |
duedate = entry.EndTimeL().TimeLocalL();
|
|
605 |
}
|
|
606 |
else
|
|
607 |
{
|
|
608 |
// If due date is invalid, set today date to note.
|
|
609 |
duedate = CalenDateUtils::Today();
|
|
610 |
}
|
|
611 |
|
|
612 |
TBuf<20> tempString;
|
|
613 |
|
|
614 |
CCalEntry::TStatus status = entry.StatusL();
|
|
615 |
tempString.Format( KTaskStateFormat, status == CCalEntry::ETodoCompleted ?
|
|
616 |
IconIndex( MCalenServices::ECalenTodoIconDone ) :
|
|
617 |
IconIndex( MCalenServices::ECalenTodoIconUndone ));
|
|
618 |
aPtr.Append( tempString );
|
|
619 |
|
|
620 |
// Read format text from resource.
|
|
621 |
HBufC* listdateFormat = StringLoader::LoadLC( R_QTN_DATE_WITHOUT_YEAR_WITH_ZERO, iCoeEnv );
|
|
622 |
|
|
623 |
duedate.FormatL( tempString, *listdateFormat );
|
|
624 |
|
|
625 |
// convert the date numbers into Arabic-Indic numbers
|
|
626 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion( tempString );
|
|
627 |
aPtr.Append( tempString );
|
|
628 |
aPtr.Append( KListSeparatorFormat );
|
|
629 |
|
|
630 |
CleanupStack::PopAndDestroy( listdateFormat );
|
|
631 |
|
|
632 |
// Set summary
|
|
633 |
// Create temporary buffer for summary
|
|
634 |
const TInt summaryMaxLength = aPtr.MaxLength() - aPtr.Length();
|
|
635 |
HBufC* summary = HBufC::NewLC( summaryMaxLength );
|
|
636 |
TPtr summaryPtr = summary->Des();
|
|
637 |
|
|
638 |
CalenViewUtils::GetSummaryLocationTextL( entry, summaryPtr, summaryMaxLength );
|
|
639 |
|
|
640 |
// Append only as much as needed or fits
|
|
641 |
TInt freeSpace = Min( Min( summary->Length(), KListDataLengthOfSubject ),
|
|
642 |
aPtr.MaxLength() - aPtr.Length() );
|
|
643 |
|
|
644 |
aPtr.Append( _L(" ") );
|
|
645 |
aPtr.Append( _L(" ") );
|
|
646 |
aPtr.Append( _L(" ") );
|
|
647 |
|
|
648 |
aPtr.Append( summary->Left( freeSpace ) );
|
|
649 |
CleanupStack::PopAndDestroy( summary );
|
|
650 |
|
|
651 |
// EFalse: do not push _\t to push icon to right
|
|
652 |
// in case there is 1 icon to show
|
|
653 |
// ETrue: mirror the order of icons
|
|
654 |
InsertAdditionalIconsL(entry, KIconSeparatorFormat(), aPtr, EFalse, ETrue);
|
|
655 |
|
|
656 |
TRACE_EXIT_POINT;
|
|
657 |
}
|
|
658 |
|
|
659 |
// ----------------------------------------------------------------------------
|
|
660 |
// CCalenTodoContainer::CreateAndAppendIconL
|
|
661 |
// ----------------------------------------------------------------------------
|
|
662 |
//
|
|
663 |
void CCalenTodoContainer::CreateAndAppendIconL(const TAknsItemID& aID,
|
|
664 |
const TDesC& aFileName,
|
|
665 |
const TInt aBitmapId,
|
|
666 |
const TInt aMaskId,
|
|
667 |
CAknIconArray* aIconList)
|
|
668 |
{
|
|
669 |
TRACE_ENTRY_POINT;
|
|
670 |
|
|
671 |
CGulIcon* icon = AknsUtils::CreateGulIconL(
|
|
672 |
AknsUtils::SkinInstance(), aID, aFileName, aBitmapId, aMaskId );
|
|
673 |
|
|
674 |
CleanupStack::PushL( icon );
|
|
675 |
aIconList->AppendL( icon );
|
|
676 |
CleanupStack::Pop( icon );
|
|
677 |
|
|
678 |
TRACE_EXIT_POINT;
|
|
679 |
}
|
|
680 |
|
|
681 |
// ----------------------------------------------------------------------------
|
|
682 |
// CCalenTodoContainer::ReplaceToWhiteSpace
|
|
683 |
// Replace a white space character in text buffer by blank
|
|
684 |
// character (" ").
|
|
685 |
// ----------------------------------------------------------------------------
|
|
686 |
//
|
|
687 |
void CCalenTodoContainer::ReplaceToWhiteSpace(TDes& aBuf)
|
|
688 |
{
|
|
689 |
TRACE_ENTRY_POINT;
|
|
690 |
|
|
691 |
TInt length( aBuf.Length() );
|
|
692 |
|
|
693 |
for( TInt i(0); i < length; ++i)
|
|
694 |
{
|
|
695 |
TChar onechar( aBuf[i] );
|
|
696 |
|
|
697 |
if( onechar.IsSpace() )
|
|
698 |
{
|
|
699 |
// Replace by blank character.
|
|
700 |
aBuf.Replace( i, 1, KSpaceText );
|
|
701 |
}
|
|
702 |
}
|
|
703 |
|
|
704 |
TRACE_EXIT_POINT;
|
|
705 |
}
|
|
706 |
|
|
707 |
// ----------------------------------------------------------------------------
|
|
708 |
// CCalenTodoContainer::SizeChanged
|
|
709 |
// Child control was resized.
|
|
710 |
// ----------------------------------------------------------------------------
|
|
711 |
//
|
|
712 |
void CCalenTodoContainer::SizeChanged()
|
|
713 |
{
|
|
714 |
TRACE_ENTRY_POINT;
|
|
715 |
|
|
716 |
TRect main_pane( Rect() );
|
|
717 |
CCalenContainer::SizeChanged( main_pane );
|
|
718 |
iLayoutManager->GetLayoutAndExtensionL();
|
|
719 |
iListBox->SetRect( main_pane );
|
|
720 |
|
|
721 |
TRACE_EXIT_POINT;
|
|
722 |
}
|
|
723 |
|
|
724 |
// ----------------------------------------------------------------------------
|
|
725 |
// CCalenTodoContainer::CountComponentControls
|
|
726 |
// Return child control count.
|
|
727 |
// (other items were commented in a header).
|
|
728 |
// ----------------------------------------------------------------------------
|
|
729 |
//
|
|
730 |
TInt CCalenTodoContainer::CountComponentControls() const
|
|
731 |
{
|
|
732 |
TRACE_ENTRY_POINT;
|
|
733 |
|
|
734 |
TRACE_EXIT_POINT;
|
|
735 |
return 1;
|
|
736 |
}
|
|
737 |
|
|
738 |
// ----------------------------------------------------------------------------
|
|
739 |
// CCalenTodoContainer::ComponentControl
|
|
740 |
// Return child control pointer.
|
|
741 |
// (other items were commented in a header).
|
|
742 |
// ----------------------------------------------------------------------------
|
|
743 |
//
|
|
744 |
CCoeControl* CCalenTodoContainer::ComponentControl(TInt /*aIndex*/) const // Child control index
|
|
745 |
{
|
|
746 |
TRACE_ENTRY_POINT;
|
|
747 |
|
|
748 |
TRACE_EXIT_POINT;
|
|
749 |
return iListBox;
|
|
750 |
}
|
|
751 |
|
|
752 |
// ----------------------------------------------------------------------------
|
|
753 |
// CCalenTodoContainer::OfferKeyEventL
|
|
754 |
// Process key event.
|
|
755 |
// (other items were commented in a header).
|
|
756 |
// ----------------------------------------------------------------------------
|
|
757 |
//
|
|
758 |
TKeyResponse CCalenTodoContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
|
|
759 |
{
|
|
760 |
TRACE_ENTRY_POINT;
|
|
761 |
|
|
762 |
// common view key handling
|
|
763 |
// NOTE! Common key handling has to be performed before custom handling
|
|
764 |
// otherwise view-cycling state handling breaks.
|
|
765 |
if (CCalenContainer::OfferKeyEventL(aKeyEvent, aType) == EKeyWasConsumed)
|
|
766 |
{
|
|
767 |
TRACE_EXIT_POINT;
|
|
768 |
return EKeyWasConsumed;
|
|
769 |
}
|
|
770 |
|
|
771 |
TKeyResponse exitCode(EKeyWasNotConsumed);
|
|
772 |
TUint modifiers = aKeyEvent.iModifiers;
|
|
773 |
|
|
774 |
if (aType == EEventKey)
|
|
775 |
{
|
|
776 |
if (aKeyEvent.iCode == EKeyOK)
|
|
777 |
{
|
|
778 |
// Check no pressing shift key.
|
|
779 |
if( !(modifiers & (EModifierShift+EModifierRightShift)) )
|
|
780 |
{
|
|
781 |
// Single click integration
|
|
782 |
if( !iController->Count() )
|
|
783 |
{
|
|
784 |
// display the context sensitive menu
|
|
785 |
/*CEikMenuBar* menuBar = iView->MenuBar();
|
|
786 |
menuBar->SetContextMenuTitleResourceId( R_TODO_LIST_SELECTION_CONTEXT_MENUBAR );
|
|
787 |
menuBar->TryDisplayContextMenuBarL();
|
|
788 |
*/ }
|
|
789 |
else
|
|
790 |
{
|
|
791 |
iListBox->OfferKeyEventL( aKeyEvent, aType );
|
|
792 |
}
|
|
793 |
exitCode = EKeyWasConsumed;
|
|
794 |
}
|
|
795 |
|
|
796 |
}
|
|
797 |
else if( ( aKeyEvent.iCode == EKeyBackspace )
|
|
798 |
&& iView->MenuBar()->ItemSpecificCommandsEnabled() &&
|
|
799 |
(iController->Count()) )
|
|
800 |
{
|
|
801 |
// Handle delete command.
|
|
802 |
static_cast<CCalenTodoView*>(iView)->HandleCommandL( ECalenDeleteCurrentEntry );
|
|
803 |
exitCode = EKeyWasConsumed;
|
|
804 |
}
|
|
805 |
// Change Note View.
|
|
806 |
else if( aKeyEvent.iCode == EKeyEnter )
|
|
807 |
{
|
|
808 |
if(IsEmptyView())
|
|
809 |
{
|
|
810 |
iView->HandleCommandL(ECalenCmdOpenMskDialog);
|
|
811 |
}
|
|
812 |
else
|
|
813 |
{
|
|
814 |
// Single click integration
|
|
815 |
iListBox->OfferKeyEventL( aKeyEvent, aType );
|
|
816 |
}
|
|
817 |
exitCode = EKeyWasConsumed;
|
|
818 |
}
|
|
819 |
}
|
|
820 |
|
|
821 |
if (exitCode == EKeyWasNotConsumed)
|
|
822 |
{
|
|
823 |
TInt oldCursor = iListBox->View()->CurrentItemIndex();
|
|
824 |
exitCode = iListBox->OfferKeyEventL(aKeyEvent, aType);
|
|
825 |
TInt newCursor = iListBox->View()->CurrentItemIndex();
|
|
826 |
|
|
827 |
if (oldCursor != newCursor)
|
|
828 |
{
|
|
829 |
static_cast<CCalenTodoView*>(iView)->SaveCurrentItemIndexL();
|
|
830 |
}
|
|
831 |
}
|
|
832 |
static_cast<CCalenTodoView*>(iView)->UpdateCBAButtonsL();
|
|
833 |
|
|
834 |
TRACE_EXIT_POINT;
|
|
835 |
|
|
836 |
return exitCode;
|
|
837 |
}
|
|
838 |
|
|
839 |
// ----------------------------------------------------------------------------
|
|
840 |
// CCalenTodoContainer::GetHelpContext
|
|
841 |
// Get help context.
|
|
842 |
// (other items were commented in a header).
|
|
843 |
// ----------------------------------------------------------------------------
|
|
844 |
//
|
|
845 |
void CCalenTodoContainer::GetHelpContext(TCoeHelpContext& aContext) const
|
|
846 |
{
|
|
847 |
TRACE_ENTRY_POINT;
|
|
848 |
|
|
849 |
aContext.iMajor = KUidCalendar;
|
|
850 |
aContext.iContext = KCALE_HLP_TODO_VIEW;
|
|
851 |
|
|
852 |
TRACE_EXIT_POINT;
|
|
853 |
}
|
|
854 |
|
|
855 |
// ----------------------------------------------------------------------------
|
|
856 |
// CCalenTodoContainer::UpdateSize
|
|
857 |
// Do layout changes after calendar settings are
|
|
858 |
// changed. No necessary actions for this view.
|
|
859 |
// ----------------------------------------------------------------------------
|
|
860 |
//
|
|
861 |
void CCalenTodoContainer::UpdateSize()
|
|
862 |
{
|
|
863 |
TRACE_ENTRY_POINT;
|
|
864 |
SizeChanged();
|
|
865 |
TRACE_EXIT_POINT;
|
|
866 |
}
|
|
867 |
|
|
868 |
// ----------------------------------------------------------------------------
|
|
869 |
// CCalenTodoContainer::HandleResourceChange
|
|
870 |
// Handles a resource relative event
|
|
871 |
// (other items were commented in a header).
|
|
872 |
// ----------------------------------------------------------------------------
|
|
873 |
//
|
|
874 |
void CCalenTodoContainer::HandleResourceChange(TInt aType)
|
|
875 |
{
|
|
876 |
TRACE_ENTRY_POINT;
|
|
877 |
|
|
878 |
CCalenContainer::HandleResourceChange( aType );
|
|
879 |
|
|
880 |
if ( aType == KAknsMessageSkinChange || aType == KEikDynamicLayoutVariantSwitch )
|
|
881 |
{
|
|
882 |
SizeChanged();
|
|
883 |
CAknIconArray* iconList = CreateIconsL( iIconIndices, KCalenTodoViewUidValue );
|
|
884 |
|
|
885 |
// Transfer iconlist ownership to the listbox
|
|
886 |
iListBox->ItemDrawer()->ColumnData()->SetIconArray( iconList );
|
|
887 |
// refresh
|
|
888 |
TRAPD(error,iView->BeginRepopulationL());
|
|
889 |
if(error!=KErrNone)
|
|
890 |
{
|
|
891 |
// do avoid warning
|
|
892 |
}
|
|
893 |
}
|
|
894 |
|
|
895 |
CCoeControl::HandleResourceChange( aType );
|
|
896 |
|
|
897 |
TRACE_EXIT_POINT;
|
|
898 |
}
|
|
899 |
|
|
900 |
// ----------------------------------------------------------------------------
|
|
901 |
// CCalenTodoContainer::MarkCurrentL
|
|
902 |
// (other items were commented in a header).
|
|
903 |
// ----------------------------------------------------------------------------
|
|
904 |
//
|
|
905 |
void CCalenTodoContainer::MarkCurrentL(TBool aMark)
|
|
906 |
{
|
|
907 |
TRACE_ENTRY_POINT;
|
|
908 |
|
|
909 |
const CListBoxView::CSelectionIndexArray* oldArray = iListBox->SelectionIndexes();
|
|
910 |
CListBoxView::CSelectionIndexArray* newArray = new( ELeave )CArrayFixFlat<TInt>( oldArray->Count() + 1 );
|
|
911 |
CleanupStack::PushL( newArray );
|
|
912 |
|
|
913 |
TInt currentIndex( iListBox->CurrentItemIndex() );
|
|
914 |
|
|
915 |
for( TInt i(0); i < oldArray->Count(); ++i )
|
|
916 |
{
|
|
917 |
if( oldArray->At( i ) != currentIndex )
|
|
918 |
{
|
|
919 |
newArray->AppendL( oldArray->At( i ) );
|
|
920 |
}
|
|
921 |
}
|
|
922 |
|
|
923 |
if( aMark )
|
|
924 |
{
|
|
925 |
newArray->AppendL( currentIndex );
|
|
926 |
}
|
|
927 |
else
|
|
928 |
{
|
|
929 |
// when a todo item is unmarked,clear marked to do item info
|
|
930 |
static_cast<CCalenTodoView*>( iView )->ClearMarkedToDoItems();
|
|
931 |
}
|
|
932 |
|
|
933 |
iListBox->SetSelectionIndexesL( newArray );
|
|
934 |
|
|
935 |
// set marked todo items info
|
|
936 |
static_cast<CCalenTodoView*>( iView )->SetMarkedToDoItems(newArray);
|
|
937 |
|
|
938 |
MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull();
|
|
939 |
if( MarkedCount() )
|
|
940 |
{
|
|
941 |
if(toolbarImpl)
|
|
942 |
{
|
|
943 |
CAknToolbar& toolbar = toolbarImpl->Toolbar();
|
|
944 |
|
|
945 |
// dim clear and clear all toolbar buttons
|
|
946 |
toolbar.SetItemDimmed(ECalenNewMeeting,ETrue,ETrue);
|
|
947 |
}
|
|
948 |
|
|
949 |
}
|
|
950 |
else
|
|
951 |
{
|
|
952 |
if(toolbarImpl)
|
|
953 |
{
|
|
954 |
CAknToolbar& toolbar = toolbarImpl->Toolbar();
|
|
955 |
|
|
956 |
// dim clear and clear all toolbar buttons
|
|
957 |
toolbar.SetItemDimmed(ECalenNewMeeting,EFalse,ETrue);
|
|
958 |
}
|
|
959 |
}
|
|
960 |
|
|
961 |
CleanupStack::Pop( newArray );
|
|
962 |
|
|
963 |
TRACE_EXIT_POINT;
|
|
964 |
}
|
|
965 |
|
|
966 |
// ----------------------------------------------------------------------------
|
|
967 |
// CCalenTodoContainer::MarkAllL
|
|
968 |
// (other items were commented in a header).
|
|
969 |
// ----------------------------------------------------------------------------
|
|
970 |
//
|
|
971 |
void CCalenTodoContainer::MarkAllL(TBool aMark)
|
|
972 |
{
|
|
973 |
TRACE_ENTRY_POINT;
|
|
974 |
|
|
975 |
if( aMark )
|
|
976 |
{
|
|
977 |
TInt count = iListBox->Model()->NumberOfItems();
|
|
978 |
CListBoxView::CSelectionIndexArray* array = new( ELeave )CArrayFixFlat<TInt>( count );
|
|
979 |
CleanupStack::PushL( array );
|
|
980 |
|
|
981 |
for( TInt i(0); i < count; ++i )
|
|
982 |
{
|
|
983 |
array->AppendL( i );
|
|
984 |
}
|
|
985 |
iListBox->SetSelectionIndexesL( array );
|
|
986 |
|
|
987 |
// set marked todo items info
|
|
988 |
static_cast<CCalenTodoView*>( iView )->SetMarkedToDoItems(array);
|
|
989 |
|
|
990 |
CleanupStack::Pop( array );
|
|
991 |
}
|
|
992 |
else
|
|
993 |
{
|
|
994 |
iListBox->ClearSelection();
|
|
995 |
|
|
996 |
// when all the todo items are unmarked,clear all marked todo items info from View
|
|
997 |
static_cast<CCalenTodoView*>( iView )->ClearMarkedToDoItems();
|
|
998 |
}
|
|
999 |
|
|
1000 |
MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull();
|
|
1001 |
if( MarkedCount() )
|
|
1002 |
{
|
|
1003 |
if(toolbarImpl)
|
|
1004 |
{
|
|
1005 |
CAknToolbar& toolbar = toolbarImpl->Toolbar();
|
|
1006 |
|
|
1007 |
// dim clear and clear all toolbar buttons
|
|
1008 |
toolbar.SetItemDimmed(ECalenNewMeeting,ETrue,ETrue);
|
|
1009 |
}
|
|
1010 |
|
|
1011 |
}
|
|
1012 |
else
|
|
1013 |
{
|
|
1014 |
if(toolbarImpl)
|
|
1015 |
{
|
|
1016 |
CAknToolbar& toolbar = toolbarImpl->Toolbar();
|
|
1017 |
|
|
1018 |
// dim clear and clear all toolbar buttons
|
|
1019 |
toolbar.SetItemDimmed(ECalenNewMeeting,EFalse,ETrue);
|
|
1020 |
}
|
|
1021 |
}
|
|
1022 |
|
|
1023 |
TRACE_EXIT_POINT;
|
|
1024 |
}
|
|
1025 |
|
|
1026 |
// ----------------------------------------------------------------------------
|
|
1027 |
// CCalenTodoContainer::IsCurrentItemSelected
|
|
1028 |
// (other items were commented in a header).
|
|
1029 |
// ----------------------------------------------------------------------------
|
|
1030 |
//
|
|
1031 |
TBool CCalenTodoContainer::IsCurrentItemSelected(void)
|
|
1032 |
{
|
|
1033 |
TRACE_ENTRY_POINT;
|
|
1034 |
|
|
1035 |
const CListBoxView::CSelectionIndexArray* selectionArray = iListBox->SelectionIndexes();
|
|
1036 |
|
|
1037 |
TInt currentIndex( iListBox->CurrentItemIndex() );
|
|
1038 |
|
|
1039 |
for( TInt i(0); i < selectionArray->Count(); ++i )
|
|
1040 |
{
|
|
1041 |
if( selectionArray->At( i ) == currentIndex )
|
|
1042 |
{
|
|
1043 |
TRACE_EXIT_POINT;
|
|
1044 |
return ETrue;
|
|
1045 |
}
|
|
1046 |
}
|
|
1047 |
|
|
1048 |
TRACE_EXIT_POINT;
|
|
1049 |
return EFalse;
|
|
1050 |
}
|
|
1051 |
|
|
1052 |
|
|
1053 |
// ----------------------------------------------------------------------------
|
|
1054 |
// CCalenTodoContainer::FocusChanged(TDrawNow aDrawNow)
|
|
1055 |
// Called when focus is changed
|
|
1056 |
// (other items were commented in a header).
|
|
1057 |
// ----------------------------------------------------------------------------
|
|
1058 |
//
|
|
1059 |
void CCalenTodoContainer::FocusChanged(TDrawNow aDrawNow)
|
|
1060 |
{
|
|
1061 |
TRACE_ENTRY_POINT;
|
|
1062 |
|
|
1063 |
// Super-class does some common routines when focus is changed
|
|
1064 |
CCalenContainer::FocusChanged( aDrawNow );
|
|
1065 |
// Pass focus change event to grid for highlight animation
|
|
1066 |
if ( iListBox )
|
|
1067 |
{
|
|
1068 |
iListBox->SetFocus( IsFocused() );
|
|
1069 |
}
|
|
1070 |
|
|
1071 |
TRACE_EXIT_POINT;
|
|
1072 |
}
|
|
1073 |
|
|
1074 |
// ----------------------------------------------------------------------------
|
|
1075 |
// CCalenTodoContainer::IsEmptyView()
|
|
1076 |
// Return ETrue if view is currently empty.
|
|
1077 |
// (other items were commented in a header).
|
|
1078 |
// ----------------------------------------------------------------------------
|
|
1079 |
//
|
|
1080 |
TBool CCalenTodoContainer::IsEmptyView() const
|
|
1081 |
{
|
|
1082 |
TRACE_ENTRY_POINT;
|
|
1083 |
|
|
1084 |
TInt count=iController->Count();
|
|
1085 |
|
|
1086 |
TRACE_EXIT_POINT;
|
|
1087 |
return ( count <= 0);
|
|
1088 |
}
|
|
1089 |
|
|
1090 |
|
|
1091 |
// ----------------------------------------------------------------------------
|
|
1092 |
// CCalenTodoContainer::MopSupplyObject()
|
|
1093 |
// Pass skin information if needed.
|
|
1094 |
// ----------------------------------------------------------------------------
|
|
1095 |
//
|
|
1096 |
TTypeUid::Ptr CCalenTodoContainer::MopSupplyObject(TTypeUid aId)
|
|
1097 |
{
|
|
1098 |
TRACE_ENTRY_POINT;
|
|
1099 |
|
|
1100 |
if(aId.iUid == MAknsControlContext::ETypeId )
|
|
1101 |
{
|
|
1102 |
MAknsControlContext* cc = iBgContext;
|
|
1103 |
if ( cc )
|
|
1104 |
{
|
|
1105 |
TRACE_EXIT_POINT;
|
|
1106 |
return MAknsControlContext::SupplyMopObject( aId, cc );
|
|
1107 |
}
|
|
1108 |
}
|
|
1109 |
TRACE_EXIT_POINT;
|
|
1110 |
return CCoeControl::MopSupplyObject( aId );
|
|
1111 |
}
|
|
1112 |
|
|
1113 |
// ----------------------------------------------------------------------------
|
|
1114 |
// CCalenTodoContainer::Draw
|
|
1115 |
// drawing todo view background
|
|
1116 |
// (other items were commented in a header).
|
|
1117 |
// ----------------------------------------------------------------------------
|
|
1118 |
//
|
|
1119 |
void CCalenTodoContainer::Draw(const TRect& /*aRect*/) const
|
|
1120 |
{
|
|
1121 |
TRACE_ENTRY_POINT;
|
|
1122 |
CWindowGc& gc = SystemGc();
|
|
1123 |
TRect main_pane( Rect() );
|
|
1124 |
|
|
1125 |
MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
|
|
1126 |
|
|
1127 |
const TInt drawParams = 0;
|
|
1128 |
AknsDrawUtils::Background( AknsUtils::SkinInstance(),
|
|
1129 |
cc,
|
|
1130 |
NULL,
|
|
1131 |
gc,
|
|
1132 |
main_pane,
|
|
1133 |
drawParams);
|
|
1134 |
|
|
1135 |
TRACE_EXIT_POINT;
|
|
1136 |
}
|
|
1137 |
|
|
1138 |
// ----------------------------------------------------------------------------
|
|
1139 |
// CCalenTodoContainer::HandleNaviDecorationPointerEventL
|
|
1140 |
// Navi decoration is not present in todo view
|
|
1141 |
// (other items were commented in a header).
|
|
1142 |
// ----------------------------------------------------------------------------
|
|
1143 |
//
|
|
1144 |
void CCalenTodoContainer::HandleNaviDecoratorEventL(TInt)
|
|
1145 |
{
|
|
1146 |
TRACE_ENTRY_POINT;
|
|
1147 |
TRACE_EXIT_POINT;
|
|
1148 |
}
|
|
1149 |
|
|
1150 |
// ----------------------------------------------------------------------------
|
|
1151 |
// CCalenMonthContainer::HandleLongTapEventL
|
|
1152 |
// processing of a long tap event
|
|
1153 |
// (other items were commented in a header).
|
|
1154 |
// ----------------------------------------------------------------------------
|
|
1155 |
//
|
|
1156 |
void CCalenTodoContainer::HandleLongTapEventL( const TPoint& /*aPenEventLocation*/,
|
|
1157 |
const TPoint& /*aPenEventScreenLocation*/ )
|
|
1158 |
{
|
|
1159 |
TRACE_ENTRY_POINT;
|
|
1160 |
TRACE_EXIT_POINT;
|
|
1161 |
}
|
|
1162 |
|
|
1163 |
// ----------------------------------------------------------------------------
|
|
1164 |
// CCalenTodoContainer::HandlePointerEventL
|
|
1165 |
// Process pointer event.
|
|
1166 |
// (other items were commented in a header).
|
|
1167 |
// ----------------------------------------------------------------------------
|
|
1168 |
//
|
|
1169 |
void CCalenTodoContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent)
|
|
1170 |
{
|
|
1171 |
TRACE_ENTRY_POINT;
|
|
1172 |
|
|
1173 |
if(AknLayoutUtils::PenEnabled())
|
|
1174 |
{
|
|
1175 |
if(iView->IsEventViewLaunchedFromAlarm())
|
|
1176 |
{
|
|
1177 |
return;
|
|
1178 |
}
|
|
1179 |
TInt pointerIndex(-1);
|
|
1180 |
TBool isItem (iListBox->View()->XYPosToItemIndex(aPointerEvent.iPosition, pointerIndex));
|
|
1181 |
|
|
1182 |
if(aPointerEvent.iType == TPointerEvent::EButton1Down)
|
|
1183 |
{
|
|
1184 |
this->GenerateTactileFeedback(); //Tactile feedback.
|
|
1185 |
}
|
|
1186 |
|
|
1187 |
if(isItem == EFalse && IsEmptyView())
|
|
1188 |
{
|
|
1189 |
iListBox->HandlePointerEventL(aPointerEvent);
|
|
1190 |
iView->HandleCommandL(ECalenCmdOpenMskDialog);
|
|
1191 |
return;
|
|
1192 |
}
|
|
1193 |
|
|
1194 |
// Single click integration
|
|
1195 |
/** Event modifiers are ignored for now because
|
|
1196 |
* those are not needed but cause problems
|
|
1197 |
*/
|
|
1198 |
TPointerEvent pointerEvent( aPointerEvent );
|
|
1199 |
pointerEvent.iModifiers =
|
|
1200 |
( aPointerEvent.iModifiers & ( ~EAllModifiers ) );
|
|
1201 |
iListBox->HandlePointerEventL( pointerEvent );
|
|
1202 |
}
|
|
1203 |
|
|
1204 |
TRACE_EXIT_POINT;
|
|
1205 |
}
|
|
1206 |
|
|
1207 |
|
|
1208 |
// ----------------------------------------------------------------------------
|
|
1209 |
// CCalenTodoContainer::BeginPopulationWithInstanceViewL
|
|
1210 |
// First stage of population.
|
|
1211 |
// (other items were commented in a header).
|
|
1212 |
// ----------------------------------------------------------------------------
|
|
1213 |
//
|
|
1214 |
void CCalenTodoContainer::BeginPopulationWithInstanceViewL()
|
|
1215 |
{
|
|
1216 |
TRACE_ENTRY_POINT;
|
|
1217 |
|
|
1218 |
iController->RefreshL();
|
|
1219 |
// prepare listbox model with data from entries
|
|
1220 |
CreateEntryItertorL();
|
|
1221 |
|
|
1222 |
MCalenContext& context = iServices.Context();
|
|
1223 |
if ( !(context.InstanceId() == TCalenInstanceId::NullInstanceId()) )
|
|
1224 |
{
|
|
1225 |
iHighlightedRowNumber = Controller()->FindInstanceIndexL( context.InstanceId() );
|
|
1226 |
}
|
|
1227 |
|
|
1228 |
// handle possible view cycling and set current item index.
|
|
1229 |
SetHighlightingL();
|
|
1230 |
|
|
1231 |
// get marked todo items from view if any items are marked.
|
|
1232 |
iListBox->SetSelectionIndexesL(static_cast<CCalenTodoView*>( iView )->GetMarkedToDoItems());
|
|
1233 |
|
|
1234 |
iListBox->View()->SetDisableRedraw( EFalse );
|
|
1235 |
DrawNow();
|
|
1236 |
|
|
1237 |
TRACE_EXIT_POINT;
|
|
1238 |
}
|
|
1239 |
|
|
1240 |
// ----------------------------------------------------------------------------
|
|
1241 |
// CCalenTodoContainer::CompletePopulationL
|
|
1242 |
// Second and final stage of population.
|
|
1243 |
// (other items were commented in a header).
|
|
1244 |
// ----------------------------------------------------------------------------
|
|
1245 |
//
|
|
1246 |
void CCalenTodoContainer::CompletePopulationL()
|
|
1247 |
{
|
|
1248 |
TRACE_ENTRY_POINT;
|
|
1249 |
|
|
1250 |
AddToStackAndMakeVisibleL();
|
|
1251 |
// Now we know if the view is empty or not we can update the CBA buttons.
|
|
1252 |
static_cast<CCalenTodoView*>( iView )->UpdateCBAButtonsL();
|
|
1253 |
UpdateStatusPaneAndExtensionsL();
|
|
1254 |
UpdateTodayToolbarItemL();
|
|
1255 |
|
|
1256 |
TRACE_EXIT_POINT;
|
|
1257 |
}
|
|
1258 |
|
|
1259 |
// ----------------------------------------------------------------------------
|
|
1260 |
// CCalenTodoContainer::CreateIconIndicesL
|
|
1261 |
// Second and final stage of population.
|
|
1262 |
// (other items were commented in a header).
|
|
1263 |
// ----------------------------------------------------------------------------
|
|
1264 |
//
|
|
1265 |
void CCalenTodoContainer::CreateIconIndicesL( RArray<MCalenServices::TCalenIcons>& aIndexArray )
|
|
1266 |
{
|
|
1267 |
TRACE_ENTRY_POINT;
|
|
1268 |
aIndexArray.Reset();
|
|
1269 |
aIndexArray.AppendL( MCalenServices::ECalenMarkedTodoIcon );
|
|
1270 |
aIndexArray.AppendL( MCalenServices::ECalenAlarmIcon );
|
|
1271 |
aIndexArray.AppendL( MCalenServices::ECalenNotePriorityLow );
|
|
1272 |
aIndexArray.AppendL( MCalenServices::ECalenNotePriorityHigh );
|
|
1273 |
aIndexArray.AppendL( MCalenServices::ECalenTodoIconUndone );
|
|
1274 |
aIndexArray.AppendL( MCalenServices::ECalenTodoIconDone );
|
|
1275 |
|
|
1276 |
TRACE_EXIT_POINT;
|
|
1277 |
}
|
|
1278 |
|
|
1279 |
|
|
1280 |
void CCalenTodoContainer::CleanupInstances()
|
|
1281 |
{
|
|
1282 |
TRACE_ENTRY_POINT
|
|
1283 |
iController->CleanupInstances();
|
|
1284 |
TRACE_EXIT_POINT
|
|
1285 |
}
|
|
1286 |
|
|
1287 |
// ----------------------------------------------------------------------------
|
|
1288 |
// CCalenTodoContainer::PreviewRectL
|
|
1289 |
// Returns an empty rect - Day view does not support preview pane
|
|
1290 |
// ----------------------------------------------------------------------------
|
|
1291 |
TRect CCalenTodoContainer::PreviewRectL()
|
|
1292 |
{
|
|
1293 |
TRACE_ENTRY_POINT;
|
|
1294 |
|
|
1295 |
TRect rect;
|
|
1296 |
|
|
1297 |
TRACE_EXIT_POINT;
|
|
1298 |
return rect;
|
|
1299 |
}
|
|
1300 |
|
|
1301 |
// -----------------------------------------------------------------------------
|
|
1302 |
// CCalenTodoContainer::CalendarInfoIdentifierL
|
|
1303 |
// Searches for the index in calendar info list based on calendar file name
|
|
1304 |
// -----------------------------------------------------------------------------
|
|
1305 |
//
|
|
1306 |
TBool CCalenTodoContainer::CalendarInfoIdentifierL( const HBufC* aName,
|
|
1307 |
const CCalCalendarInfo& aCalendarInfo)
|
|
1308 |
{
|
|
1309 |
TRACE_ENTRY_POINT;
|
|
1310 |
TBool retVal = EFalse;
|
|
1311 |
HBufC* calendarFileName = aCalendarInfo.FileNameL().AllocLC();
|
|
1312 |
retVal = calendarFileName->CompareF(*aName);
|
|
1313 |
CleanupStack::PopAndDestroy(calendarFileName);
|
|
1314 |
TRACE_EXIT_POINT;
|
|
1315 |
return (!retVal);
|
|
1316 |
}
|
|
1317 |
|
|
1318 |
// End of File
|