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) 2002-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: CCalenTodoView is derived from CCalenNativeView. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#include <calenagendautils.h> |
|
20 |
#include <calsession.h> |
|
21 |
#include <calinstance.h> |
|
22 |
#include <StringLoader.h> |
|
23 |
#include <centralrepository.h> |
|
24 |
#include <hlplch.h> |
|
25 |
#include <eikclb.h> |
|
26 |
#include <eikmenup.h> |
|
27 |
#include <sendui.h> |
|
28 |
#include <featmgr.h> |
|
29 |
#include <aknbutton.h> |
|
30 |
#include <akntoolbar.h> |
|
31 |
#include <Calendar.rsg> |
|
32 |
#include <calencommonui.rsg> |
|
33 |
#include <Sendnorm.rsg> |
|
34 |
#include <calencontext.h> |
|
35 |
#include <CalenStatusPaneUtils.h> |
|
36 |
#include <aknnotewrappers.h> |
|
37 |
#include <calenservices.h> |
|
38 |
#include <caleninstanceid.h> |
|
39 |
#include <calenviewutils.h> |
|
40 |
||
41 |
#include "calendarui_debug.h" |
|
42 |
#include "calentodoview.h" |
|
43 |
#include "CalendarPrivateCRKeys.h" |
|
44 |
#include "calencontroller.h" |
|
45 |
#include "calensend.h" |
|
46 |
#include "calentitlepane.h" |
|
47 |
#include "calentodocontroller.h" |
|
48 |
#include "calentodocontainer.h" |
|
49 |
#include "CalenInterimUtils2.h" |
|
50 |
#include "CalenUid.h" |
|
51 |
#include "CalenUid.h" |
|
52 |
#include "calendar.hrh" |
|
53 |
#include "multicaluidialog.h" |
|
54 |
||
55 |
// ================= MEMBER FUNCTIONS ========================================= |
|
56 |
||
57 |
// ---------------------------------------------------------------------------- |
|
58 |
// CCalenTodoView::NewL |
|
59 |
// Two-phased constructor. |
|
60 |
// ---------------------------------------------------------------------------- |
|
61 |
// |
|
62 |
EXPORT_C CCalenTodoView* CCalenTodoView::NewL( MCalenServices& aServices ) |
|
63 |
{ |
|
64 |
TRACE_ENTRY_POINT; |
|
65 |
||
66 |
CCalenTodoView* self = new( ELeave )CCalenTodoView( aServices ); |
|
67 |
CleanupStack::PushL( self ); |
|
68 |
self->ConstructL(); |
|
69 |
CleanupStack::Pop( self ); |
|
70 |
||
71 |
TRACE_EXIT_POINT; |
|
72 |
return self; |
|
73 |
} |
|
74 |
||
75 |
// ---------------------------------------------------------------------------- |
|
76 |
// CCalenTodoView::ConstructL |
|
77 |
// Constructor |
|
78 |
// ---------------------------------------------------------------------------- |
|
79 |
// |
|
80 |
void CCalenTodoView::ConstructL() |
|
81 |
{ |
|
82 |
TRACE_ENTRY_POINT; |
|
83 |
||
84 |
iCountOfSelectedItems = -1; |
|
85 |
CommonConstructL( R_TODO_LISTVIEW ); |
|
86 |
||
87 |
TRACE_EXIT_POINT; |
|
88 |
} |
|
89 |
||
90 |
// ---------------------------------------------------------------------------- |
|
91 |
// CCalenTodoView::CCalenTodoView |
|
92 |
// C++ constructor. |
|
93 |
// ---------------------------------------------------------------------------- |
|
94 |
// |
|
95 |
CCalenTodoView::CCalenTodoView( MCalenServices& aServices ) |
|
96 |
: CCalenNativeView( aServices ), |
|
97 |
iPopulationStep( ENothingDone ) |
|
98 |
{ |
|
99 |
TRACE_ENTRY_POINT; |
|
100 |
TRACE_EXIT_POINT; |
|
101 |
} |
|
102 |
||
103 |
// ---------------------------------------------------------------------------- |
|
104 |
// CCalenTodoView::~CCalenTodoView |
|
105 |
// Destructor |
|
106 |
// ---------------------------------------------------------------------------- |
|
107 |
// |
|
108 |
CCalenTodoView::~CCalenTodoView() |
|
109 |
{ |
|
110 |
TRACE_ENTRY_POINT; |
|
111 |
||
112 |
delete iIdle; |
|
113 |
if( iCmdCallback ) |
|
114 |
{ |
|
115 |
delete iCmdCallback; |
|
116 |
} |
|
117 |
iMarkedInstances.Reset(); |
|
118 |
iMarkedInstances.Close(); |
|
119 |
||
120 |
if(iMarkedTodoItems) |
|
121 |
{ |
|
122 |
delete iMarkedTodoItems; |
|
123 |
iMarkedTodoItems = NULL; |
|
124 |
} |
|
125 |
||
126 |
TRACE_EXIT_POINT; |
|
127 |
} |
|
128 |
||
129 |
// ---------------------------------------------------------------------------- |
|
130 |
// CCalenTodoView::OnCmdDeleteEntryL |
|
131 |
// Handling command "Delete" |
|
132 |
// (other items were commented in a header). |
|
133 |
// ---------------------------------------------------------------------------- |
|
134 |
// |
|
135 |
void CCalenTodoView::OnCmdDeleteEntryL(void) |
|
136 |
{ |
|
137 |
TRACE_ENTRY_POINT; |
|
138 |
||
139 |
const TInt count( Container()->Controller()->Count() ); |
|
140 |
const TInt markCount( Container()->MarkedCount() ); |
|
141 |
||
142 |
if( markCount > 0 ) |
|
143 |
{ |
|
144 |
CreateMultiplecontextForMarkedItemsL(ECalenDeleteEntryWithoutQuery); |
|
145 |
} |
|
146 |
else |
|
147 |
{ |
|
148 |
// Delete the current item. |
|
149 |
iServices.IssueCommandL( ECalenDeleteCurrentEntry ); |
|
150 |
} |
|
151 |
TRACE_EXIT_POINT; |
|
152 |
} |
|
153 |
||
154 |
// ---------------------------------------------------------------------------- |
|
155 |
// CCalenTodoView::OnLocaleChangedL |
|
156 |
// This function is called when Locale or Today was changed. |
|
157 |
// (other items were commented in a header). |
|
158 |
// ---------------------------------------------------------------------------- |
|
159 |
// |
|
160 |
void CCalenTodoView::OnLocaleChangedL(TInt aReason) // Notify reson EChangesLocale | EChangesMidnightCrossover |
|
161 |
{ |
|
162 |
TRACE_ENTRY_POINT; |
|
163 |
||
164 |
if (!iContainer) |
|
165 |
{ |
|
166 |
return; |
|
167 |
} |
|
168 |
// FIXME...See examples from day, week and month views |
|
169 |
||
170 |
// JH although this does the refresh it might not be even needed as we don't have any UI |
|
171 |
// elements(?) that change after local change. |
|
172 |
if (IsContainerFocused()) |
|
173 |
{ |
|
174 |
||
175 |
if (!iContainer->IsFocused()) |
|
176 |
||
177 |
{ |
|
178 |
iLocChangeReason = EChangesLocale; |
|
179 |
} |
|
180 |
else |
|
181 |
{ |
|
182 |
if (aReason & EChangesLocale) |
|
183 |
{ |
|
184 |
BeginRepopulationL(); |
|
185 |
} |
|
186 |
else |
|
187 |
{ |
|
188 |
RedrawStatusPaneL(); |
|
189 |
} |
|
190 |
} |
|
191 |
} |
|
192 |
else |
|
193 |
{ |
|
194 |
iLocChangeReason = EChangesLocale; |
|
195 |
} |
|
196 |
||
197 |
TRACE_EXIT_POINT; |
|
198 |
} |
|
199 |
||
200 |
// ---------------------------------------------------------------------------- |
|
201 |
// CCalenTodoView::ItemCount |
|
202 |
// Return number of item. |
|
203 |
// (other items were commented in a header). |
|
204 |
// ---------------------------------------------------------------------------- |
|
205 |
// |
|
206 |
TInt CCalenTodoView::ItemCount() |
|
207 |
{ |
|
208 |
TRACE_ENTRY_POINT; |
|
209 |
||
210 |
TRACE_EXIT_POINT; |
|
211 |
return Container()->Controller()->Count(); |
|
212 |
} |
|
213 |
||
214 |
// ---------------------------------------------------------------------------- |
|
215 |
// CCalenTodoView::CurrentItemIsCrossOutL |
|
216 |
// Check cross out of current item. |
|
217 |
// (other items were commented in a header). |
|
218 |
// ---------------------------------------------------------------------------- |
|
219 |
// |
|
220 |
TBool CCalenTodoView::CurrentItemIsCrossOutL() |
|
221 |
{ |
|
222 |
TRACE_ENTRY_POINT; |
|
223 |
||
224 |
TBool status( EFalse ); |
|
225 |
TInt index( Container()->CurrentItemIndex() ); |
|
226 |
||
227 |
if( index >= 0 ) |
|
228 |
{ |
|
229 |
status = Container()->Controller()->IsCrossOutL( index ); |
|
230 |
} |
|
231 |
||
232 |
TRACE_EXIT_POINT; |
|
233 |
return status; |
|
234 |
} |
|
235 |
||
236 |
// ---------------------------------------------------------------------------- |
|
237 |
// CCalenTodoView::SaveCurrentItemIndexL |
|
238 |
// Save the index of current item. |
|
239 |
// ---------------------------------------------------------------------------- |
|
240 |
// |
|
241 |
void CCalenTodoView::SaveCurrentItemIndexL() |
|
242 |
{ |
|
243 |
TRACE_ENTRY_POINT; |
|
244 |
||
245 |
TInt index = Container()->CurrentItemIndex(); |
|
246 |
||
247 |
CCalInstance* instance = Container()->Controller()->InstanceL( index ); |
|
248 |
||
249 |
if( index >= 0 && instance ) |
|
250 |
{ |
|
251 |
TCalenInstanceId id = TCalenInstanceId::CreateL( *instance ); |
|
252 |
iServices.Context().SetInstanceIdL( id, |
|
253 |
TVwsViewId( KUidCalendar, KUidCalenTodoView ) ); |
|
254 |
||
255 |
iFirstEntryOnScreenIndex = Container()->ListBox()->TopItemIndex(); |
|
256 |
iHighlightedRowNumber = Container()->ListBox()->CurrentItemIndex(); |
|
257 |
} |
|
258 |
||
259 |
TRACE_EXIT_POINT; |
|
260 |
} |
|
261 |
||
262 |
// ---------------------------------------------------------------------------- |
|
263 |
// CCalenTodoView::Container |
|
264 |
// Return the container pointer. |
|
265 |
// ---------------------------------------------------------------------------- |
|
266 |
// |
|
267 |
CCalenTodoContainer* CCalenTodoView::Container() |
|
268 |
{ |
|
269 |
TRACE_ENTRY_POINT; |
|
270 |
||
271 |
TRACE_EXIT_POINT; |
|
272 |
return static_cast<CCalenTodoContainer*>( iContainer ); |
|
273 |
} |
|
274 |
||
275 |
// ---------------------------------------------------------------------------- |
|
276 |
// CCalenTodoView::HandleCommandL |
|
277 |
// Command handling for each view |
|
278 |
// (other items were commented in a header). |
|
279 |
// ---------------------------------------------------------------------------- |
|
280 |
// |
|
281 |
void CCalenTodoView::HandleCommandL( TInt aCommand ) // command ID |
|
282 |
{ |
|
283 |
TRACE_ENTRY_POINT; |
|
284 |
||
285 |
switch( aCommand ) |
|
286 |
{ |
|
287 |
// Handle MSK command Open |
|
288 |
case ECalenViewCurrentEntry: |
|
289 |
case EAknSoftkeyOpen: |
|
290 |
SaveCurrentItemIndexL(); |
|
291 |
||
292 |
if(!Container()->IsEmptyView() && !iEventViewCommandHandled) |
|
293 |
{ |
|
294 |
if(!Container()->MarkedCount()) |
|
295 |
{ |
|
296 |
CCalenNativeView::HandleCommandL(ECalenEventView); |
|
297 |
iEventViewCommandHandled = ETrue; |
|
298 |
break; |
|
299 |
} |
|
300 |
||
301 |
||
302 |
else |
|
303 |
{ |
|
304 |
CListBoxView* listboxview = Container()->ListBox()->View(); |
|
305 |
TInt index = Container()->CurrentItemIndex(); |
|
306 |
TBool iselected=listboxview->ItemIsSelected(index); |
|
307 |
||
308 |
if( !Container()->Controller()->Count() || iselected ) |
|
309 |
{ |
|
310 |
// display the context sensitive menu |
|
311 |
/* CEikMenuBar* menuBar = MenuBar(); |
|
312 |
menuBar->SetContextMenuTitleResourceId( R_TODO_LIST_SELECTION_CONTEXT_MENUBAR ); |
|
313 |
menuBar->TryDisplayContextMenuBarL(); |
|
314 |
*/ |
|
315 |
} |
|
316 |
else |
|
317 |
{ |
|
318 |
CCalenNativeView::HandleCommandL( ECalenEventView ); |
|
319 |
} |
|
320 |
} |
|
321 |
} |
|
322 |
break; |
|
323 |
//TODO: will be uncommented with copy to cal functionality. |
|
324 |
case ECalenCopyToCalendars: |
|
325 |
{ |
|
326 |
SaveCurrentItemIndexL(); |
|
327 |
CopyToCalendarsL(); |
|
328 |
} |
|
329 |
break; |
|
330 |
||
331 |
#ifdef RD_CALEN_ENHANCED_MSK |
|
332 |
case ECalenCmdOpenMskDialog: |
|
333 |
CCalenNativeView::HandleCommandL( ECalenNewMeeting ); |
|
334 |
break; |
|
335 |
#else |
|
336 |
case EAknSoftkeyContextOptions: |
|
337 |
MenuBar()->TryDisplayContextMenuBarL(); |
|
338 |
break; |
|
339 |
#endif //RD_CALEN_ENHANCED_MSK |
|
340 |
||
341 |
case ECalenDeleteCurrentEntry: |
|
342 |
{ |
|
343 |
SaveCurrentItemIndexL(); |
|
344 |
||
345 |
if( Container()->MarkedCount() >= 1 ) |
|
346 |
{ |
|
347 |
// delete marked entries |
|
348 |
OnCmdDeleteEntryL(); |
|
349 |
} |
|
350 |
else |
|
351 |
{ |
|
352 |
SaveCurrentItemIndexL(); |
|
353 |
CCalenNativeView::HandleCommandL( aCommand ); |
|
354 |
} |
|
355 |
} |
|
356 |
break; |
|
357 |
case ECalenMarkOne: |
|
358 |
SaveCurrentItemIndexL(); |
|
359 |
Container()->MarkCurrentL( ETrue ); |
|
360 |
break; |
|
361 |
||
362 |
case ECalenUnmarkOne: |
|
363 |
SaveCurrentItemIndexL(); |
|
364 |
Container()->MarkCurrentL( EFalse ); |
|
365 |
break; |
|
366 |
||
367 |
case ECalenMarkAll: |
|
368 |
SaveCurrentItemIndexL(); |
|
369 |
Container()->MarkAllL( ETrue ); |
|
370 |
break; |
|
371 |
||
372 |
case ECalenUnmarkAll: |
|
373 |
SaveCurrentItemIndexL(); |
|
374 |
Container()->MarkAllL( EFalse ); |
|
375 |
break; |
|
376 |
||
377 |
case ECalenMarkDone: |
|
378 |
SaveCurrentItemIndexL(); |
|
379 |
CreateMultiplecontextForMarkedItemsL(ECalenMarkDone); |
|
380 |
break; |
|
381 |
case ECalenMarkUnDone: |
|
382 |
SaveCurrentItemIndexL(); |
|
383 |
CreateMultiplecontextForMarkedItemsL(ECalenMarkUnDone); |
|
384 |
break; |
|
385 |
||
386 |
// These differ from native view because all new entries from the |
|
387 |
// todo view start today. However this does mean that if the user |
|
388 |
// discards changes to the new entry, we are returned to the top of |
|
389 |
// the list as the context is today. Can't see an easy way round it. |
|
390 |
case ECalenNewMeeting: |
|
391 |
case ECalenNewMeetingRequest: |
|
392 |
case ECalenNewAnniv: |
|
393 |
case ECalenNewDayNote: |
|
394 |
case ECalenNewTodo: |
|
395 |
{ |
|
396 |
// set the editoractive for not showing the preview popup or preview pane |
|
397 |
SetEditorActive(ETrue); |
|
398 |
||
399 |
MCalenContext& context = iServices.Context(); |
|
400 |
// Set the date on the context to today. It will set it to be the |
|
401 |
// default of view (8am) on that day as we don't specify the time. |
|
402 |
TTime homeTime; |
|
403 |
homeTime.HomeTime(); |
|
404 |
TCalTime today; |
|
405 |
today.SetTimeLocalL( homeTime ); |
|
406 |
context.SetFocusDateL( today, |
|
407 |
TVwsViewId( KUidCalendar, Id() ) ); |
|
408 |
iServices.IssueCommandL( aCommand ); |
|
409 |
break; |
|
410 |
} |
|
411 |
||
412 |
case ECalenDayView: |
|
413 |
case ECalenWeekView: |
|
414 |
case ECalenMonthView: |
|
415 |
{ |
|
416 |
SaveCurrentItemIndexL(); |
|
417 |
||
418 |
// clear marked to do items before launching the native views |
|
419 |
if(iMarkedTodoItems) |
|
420 |
{ |
|
421 |
ClearMarkedToDoItems(); |
|
422 |
} |
|
423 |
||
424 |
iServices.IssueCommandL( aCommand ); |
|
425 |
} |
|
426 |
break; |
|
427 |
case ECalenShowCalendars: |
|
428 |
SaveCurrentItemIndexL(); |
|
429 |
Container()->MarkAllL( EFalse ); |
|
430 |
CCalenNativeView::HandleCommandL( aCommand ); |
|
431 |
break; |
|
432 |
default: |
|
433 |
SaveCurrentItemIndexL(); |
|
434 |
CCalenNativeView::HandleCommandL( aCommand ); |
|
435 |
break; |
|
436 |
} |
|
437 |
UpdateCBAButtonsL(); |
|
438 |
||
439 |
TRACE_EXIT_POINT; |
|
440 |
} |
|
441 |
||
442 |
// ---------------------------------------------------------------------------- |
|
443 |
// CCalenTodoView::DeleteMarkedNotesL |
|
444 |
// Delete marked notes. |
|
445 |
// (other items were commented in a header). |
|
446 |
// ---------------------------------------------------------------------------- |
|
447 |
// |
|
448 |
void CCalenTodoView::DeleteMarkedNotesL() |
|
449 |
{ |
|
450 |
TRACE_ENTRY_POINT; |
|
451 |
||
452 |
CEikColumnListBox* listbox = Container()->ListBox(); |
|
453 |
||
454 |
const CListBoxView::CSelectionIndexArray& selectedItems = *(listbox->SelectionIndexes()); |
|
455 |
||
456 |
TInt markCount( selectedItems.Count() ); |
|
457 |
ASSERT( markCount ); |
|
458 |
||
459 |
iCountOfSelectedItems = markCount; // Save count of marked item |
|
460 |
||
461 |
CCalenTodoController* controller = Container()->Controller(); |
|
462 |
iMarkedInstances.Reset(); |
|
463 |
||
464 |
for( TInt i(0); i < markCount; ++i ) |
|
465 |
{ |
|
466 |
TInt indexPos( selectedItems[i] ); |
|
467 |
iMarkedInstances.AppendL( controller->InstanceL( indexPos ) ); |
|
468 |
} |
|
469 |
||
470 |
SetMultipleContexts(); |
|
471 |
||
472 |
// Find index of the item to be focused after deletion. |
|
473 |
FindFocusAfterDeletionL( selectedItems ); |
|
474 |
||
475 |
iServices.IssueCommandL( ECalenDeleteEntryWithoutQuery ); |
|
476 |
||
477 |
TRACE_EXIT_POINT; |
|
478 |
} |
|
479 |
||
480 |
// ---------------------------------------------------------------------------- |
|
481 |
// CCalenTodoView::FindFocusAfterDeletionL |
|
482 |
// Save new current postion of item after deleting marked items. |
|
483 |
// ---------------------------------------------------------------------------- |
|
484 |
// |
|
485 |
void CCalenTodoView::FindFocusAfterDeletionL(const CListBoxView::CSelectionIndexArray& aSelectedItems) |
|
486 |
{ |
|
487 |
TRACE_ENTRY_POINT; |
|
488 |
||
489 |
// calculate the item position after deleting marked items. |
|
490 |
TInt index( Container()->CurrentItemIndex() ); |
|
491 |
TInt indexpos( 0 ); |
|
492 |
TInt adjustitems( 0 ); |
|
493 |
TBool markedAndFocus( EFalse ); |
|
494 |
iItemIndexAfterDeletion = 0; // Initialize item position |
|
495 |
||
496 |
for( TInt n(0); n < iCountOfSelectedItems; n++ ) |
|
497 |
{ |
|
498 |
indexpos = (aSelectedItems)[n]; |
|
499 |
||
500 |
if( indexpos <= index ) |
|
501 |
{ |
|
502 |
++adjustitems; |
|
503 |
} |
|
504 |
||
505 |
if( indexpos == index ) |
|
506 |
{ |
|
507 |
markedAndFocus = ETrue; // Focused item is marked. |
|
508 |
} |
|
509 |
} |
|
510 |
||
511 |
// (Selection Service Spec 10.0 section 1.2.2.) |
|
512 |
indexpos = index -adjustitems; // Adjust postion |
|
513 |
||
514 |
// Current item is marked and focused. |
|
515 |
if( markedAndFocus ) |
|
516 |
{ |
|
517 |
TInt prevcount( Container()->Controller()->Count() ); |
|
518 |
||
519 |
if( indexpos < (prevcount -iCountOfSelectedItems -1) ) |
|
520 |
{ |
|
521 |
// Focused item is not last. |
|
522 |
// Focus goes to the next item. |
|
523 |
++indexpos; |
|
524 |
} |
|
525 |
} |
|
526 |
||
527 |
// Save new item position after deleting. |
|
528 |
iItemIndexAfterDeletion = indexpos; |
|
529 |
||
530 |
TRACE_EXIT_POINT; |
|
531 |
} |
|
532 |
||
533 |
// ---------------------------------------------------------------------------- |
|
534 |
// CCalenTodoView::DynInitMenuPaneL |
|
535 |
// This function called to initialize menu pane. |
|
536 |
// ---------------------------------------------------------------------------- |
|
537 |
// |
|
538 |
void CCalenTodoView::DynInitMenuPaneL(TInt aResourceId, // Resource Id |
|
539 |
CEikMenuPane* aMenuPane) // Menu pane pointer |
|
540 |
{ |
|
541 |
TRACE_ENTRY_POINT; |
|
542 |
||
543 |
CCalenNativeView::DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
544 |
||
545 |
switch( aResourceId ) |
|
546 |
{ |
|
547 |
case R_TODO_LIST_MENUPANE: |
|
548 |
{ |
|
549 |
||
550 |
#ifdef RD_CALEN_EXTERNAL_CAL |
|
551 |
TBool isit=ExtCalendarAvailableL(); |
|
552 |
if (!isit) |
|
553 |
{ |
|
554 |
//ECalenExtAiwCommandId |
|
555 |
ReleaseServiceHandler(); |
|
556 |
TInt dummy; |
|
557 |
if (aMenuPane->MenuItemExists(ECalenExtAiwCommandId,dummy)) |
|
558 |
{ |
|
559 |
aMenuPane->DeleteMenuItem(ECalenExtAiwCommandId); |
|
560 |
} |
|
561 |
} |
|
562 |
#endif //RD_CALEN_EXTERNAL_CAL |
|
563 |
||
564 |
if ( ! FeatureManager::FeatureSupported(KFeatureIdHelp) ) |
|
565 |
{ |
|
566 |
aMenuPane->DeleteMenuItem(EAknCmdHelp); |
|
567 |
} |
|
568 |
if( !ItemCount() ) |
|
569 |
{ |
|
570 |
aMenuPane->DeleteMenuItem( ECalenViewCurrentEntry ); |
|
571 |
aMenuPane->DeleteMenuItem( ECalenDeleteCurrentEntry ); |
|
572 |
aMenuPane->DeleteMenuItem( ECalenCompleteTodo ); |
|
573 |
aMenuPane->DeleteMenuItem( ECalenRestoreTodo ); |
|
574 |
aMenuPane->DeleteMenuItem( ECalenCmdComplete ); |
|
575 |
aMenuPane->DeleteMenuItem( ECalenMarkDone ); |
|
576 |
aMenuPane->DeleteMenuItem( ECalenMarkUnDone ); |
|
577 |
aMenuPane->DeleteMenuItem( ECalenCmdMark ); |
|
578 |
aMenuPane->DeleteMenuItem( ECalenSend ); |
|
579 |
||
580 |
//TODO: will be uncommented with copy to cal functionality. |
|
581 |
aMenuPane->DeleteMenuItem(ECalenCopyToCalendars); |
|
582 |
} |
|
583 |
else |
|
584 |
{ |
|
585 |
if( Container()->MarkedCount() ) |
|
586 |
{ |
|
31
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
587 |
aMenuPane->SetItemSpecific( ECalenDeleteCurrentEntry, EFalse ); |
30 | 588 |
if(Container()->IsCurrentItemSelected()) // If focused list item is marked |
589 |
{ |
|
590 |
aMenuPane->DeleteMenuItem( ECalenViewCurrentEntry ); |
|
591 |
} |
|
592 |
aMenuPane->DeleteMenuItem( ECalenNewMeeting ); |
|
593 |
aMenuPane->DeleteMenuItem( ECalenCompleteTodo ); |
|
594 |
aMenuPane->DeleteMenuItem( ECalenRestoreTodo ); |
|
595 |
aMenuPane->DeleteMenuItem( ECalenSend ); |
|
31
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
596 |
|
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
597 |
if(Container()->MarkedCount() == 1) |
30 | 598 |
{ |
31
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
599 |
aMenuPane->DeleteMenuItem( ECalenCmdComplete ); |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
600 |
TBool crossout( EFalse ); |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
601 |
crossout = CheckMarkedItemCompletedL(); |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
602 |
if( crossout ) |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
603 |
{ |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
604 |
aMenuPane->DeleteMenuItem( ECalenMarkDone ); |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
605 |
} |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
606 |
else |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
607 |
{ |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
608 |
aMenuPane->DeleteMenuItem( ECalenMarkUnDone ); |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
609 |
} |
30 | 610 |
} |
611 |
else |
|
612 |
{ |
|
31
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
613 |
aMenuPane->DeleteMenuItem( ECalenMarkDone ); |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
614 |
aMenuPane->DeleteMenuItem( ECalenMarkUnDone ); |
30 | 615 |
} |
31
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
616 |
if(Container()->MarkedCount() > 1) |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
617 |
{ |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
618 |
aMenuPane->DeleteMenuItem( ECalenCopyToCalendars ); |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
619 |
} |
30 | 620 |
} |
621 |
else |
|
622 |
{ |
|
623 |
aMenuPane->SetItemSpecific( ECalenDeleteCurrentEntry, ETrue ); |
|
624 |
TBool crossout( EFalse ); |
|
625 |
aMenuPane->DeleteMenuItem( ECalenCmdComplete ); |
|
626 |
aMenuPane->DeleteMenuItem( ECalenMarkDone ); |
|
627 |
aMenuPane->DeleteMenuItem( ECalenMarkUnDone ); |
|
628 |
crossout = CurrentItemIsCrossOutL(); |
|
629 |
||
630 |
if( crossout ) |
|
631 |
{ |
|
632 |
aMenuPane->DeleteMenuItem( ECalenCompleteTodo ); |
|
633 |
} |
|
634 |
else |
|
635 |
{ |
|
636 |
aMenuPane->DeleteMenuItem( ECalenRestoreTodo ); |
|
637 |
} |
|
638 |
} |
|
639 |
} |
|
640 |
if( !iServices.InterimUtilsL().MRViewersEnabledL( ETrue ) ) |
|
641 |
{ |
|
642 |
aMenuPane->DeleteMenuItem( ECalenNewMeetingRequest ); |
|
643 |
} |
|
644 |
||
645 |
// Offer the menu pane to the services for customisation by the |
|
646 |
// the view manager/plugins |
|
647 |
iServices.OfferMenuPaneL( aResourceId, aMenuPane ); |
|
648 |
||
649 |
// Single click integration |
|
650 |
TInt menuIndex( 0 ); |
|
651 |
if ( aMenuPane->MenuItemExists( ECalenSend, menuIndex ) ) |
|
652 |
{ |
|
653 |
aMenuPane->SetItemSpecific( ECalenSend, ETrue ); |
|
654 |
} |
|
655 |
break; |
|
656 |
} |
|
657 |
||
658 |
// setup edit/mark menu |
|
659 |
case R_CALENDAR_MARK_UNMARK: |
|
660 |
if( ItemCount() ) |
|
661 |
{ |
|
662 |
if( Container()->MarkedCount() ) |
|
663 |
{ |
|
664 |
// all selected |
|
665 |
if( Container()->MarkedCount() == ItemCount() ) |
|
666 |
{ |
|
667 |
aMenuPane->DeleteMenuItem( ECalenMarkAll ); |
|
668 |
aMenuPane->DeleteMenuItem( ECalenMarkOne ); |
|
669 |
} |
|
670 |
else // some selected |
|
671 |
{ |
|
672 |
if( Container()->IsCurrentItemSelected() ) |
|
673 |
{ |
|
674 |
aMenuPane->DeleteMenuItem( ECalenMarkOne ); |
|
675 |
} |
|
676 |
else |
|
677 |
{ |
|
678 |
aMenuPane->DeleteMenuItem( ECalenUnmarkOne ); |
|
679 |
} |
|
680 |
} |
|
681 |
} |
|
682 |
else // none selected |
|
683 |
{ |
|
684 |
aMenuPane->DeleteMenuItem( ECalenUnmarkAll ); |
|
685 |
aMenuPane->DeleteMenuItem( ECalenUnmarkOne ); |
|
686 |
||
687 |
} |
|
688 |
} |
|
689 |
break; |
|
690 |
// setup edit/mark menu |
|
691 |
case R_CALENDAR_DONE_UNDONE: |
|
692 |
{ |
|
693 |
if( Container()->MarkedCount() ) |
|
694 |
{ |
|
695 |
TBool crossout( EFalse ); |
|
696 |
crossout = CheckMarkedItemCompletedL(); |
|
697 |
||
698 |
if( crossout ) |
|
699 |
{ |
|
700 |
aMenuPane->DeleteMenuItem( ECalenMarkDone ); |
|
701 |
} |
|
702 |
else |
|
703 |
{ |
|
704 |
aMenuPane->DeleteMenuItem( ECalenMarkUnDone ); |
|
705 |
} |
|
706 |
} |
|
707 |
} |
|
708 |
break; |
|
709 |
/* case R_TODO_LIST_SELECTION_CONTEXT_MENUPANE: |
|
710 |
if( !ItemCount() || !Container()->MarkedCount() ) |
|
711 |
{ |
|
712 |
aMenuPane->DeleteMenuItem( ECalenDeleteCurrentEntry ); |
|
713 |
} |
|
714 |
break; |
|
715 |
*/ |
|
716 |
||
717 |
default: |
|
718 |
break; |
|
719 |
} |
|
720 |
||
721 |
TRACE_EXIT_POINT; |
|
722 |
} |
|
723 |
||
724 |
// ---------------------------------------------------------------------------- |
|
725 |
// CCalenTodoView::DoActivateImplL |
|
726 |
// Called when List View becomes active. |
|
727 |
// (other items were commented in a header). |
|
728 |
// ---------------------------------------------------------------------------- |
|
729 |
// |
|
730 |
void CCalenTodoView::DoActivateImplL( const TVwsViewId& /*aPrevViewId*/, |
|
731 |
TUid /*aCustomMessageId*/, |
|
732 |
const TDesC8& /*aCustomMessage*/ ) |
|
733 |
{ |
|
734 |
TRACE_ENTRY_POINT; |
|
735 |
||
736 |
RedrawStatusPaneL(); // Set a text to title pane. |
|
737 |
||
738 |
/*MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull(); |
|
739 |
if(toolbarImpl) |
|
740 |
{ |
|
741 |
CAknToolbar& toolbar = toolbarImpl->Toolbar(); |
|
742 |
||
743 |
// dim clear and clear all toolbar buttons |
|
744 |
toolbar.SetItemDimmed(ECalenGotoToday,ETrue,ETrue); |
|
745 |
}*/ |
|
746 |
iEventViewCommandHandled = EFalse; |
|
747 |
||
748 |
TRACE_EXIT_POINT; |
|
749 |
} |
|
750 |
||
751 |
// ---------------------------------------------------------------------------- |
|
752 |
// CCalenTodoView::DoDeactivateImpl |
|
753 |
// Called when List View becomes inactive. |
|
754 |
// ---------------------------------------------------------------------------- |
|
755 |
// |
|
756 |
void CCalenTodoView::DoDeactivateImpl() |
|
757 |
{ |
|
758 |
TRACE_ENTRY_POINT; |
|
759 |
||
760 |
/*MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull(); |
|
761 |
if(toolbarImpl) |
|
762 |
{ |
|
763 |
CAknToolbar& toolbar = toolbarImpl->Toolbar(); |
|
764 |
||
765 |
if(&toolbar) |
|
766 |
{ |
|
767 |
// dim clear and clear all toolbar buttons |
|
768 |
toolbar.SetItemDimmed(ECalenGotoToday,EFalse,ETrue); |
|
769 |
} |
|
770 |
}*/ |
|
771 |
||
772 |
// Remove all markings when the view is deactivated. |
|
773 |
static_cast< CCalenTodoContainer* > ( iContainer )->MarkAllL( |
|
774 |
EFalse ); |
|
775 |
||
776 |
TRACE_EXIT_POINT; |
|
777 |
} |
|
778 |
||
779 |
// ---------------------------------------------------------------------------- |
|
780 |
// CCalenTodoView::RedrawStatusPaneL |
|
781 |
// Redraw status pane when Form is closed |
|
782 |
// (other items were commented in a header). |
|
783 |
// ---------------------------------------------------------------------------- |
|
784 |
// |
|
785 |
void CCalenTodoView::RedrawStatusPaneL() |
|
786 |
{ |
|
787 |
TRACE_ENTRY_POINT; |
|
788 |
||
789 |
HBufC* titleText = StringLoader::LoadLC( R_QTN_CALE_TITLE_TODOS, iCoeEnv ); |
|
790 |
iSPUtils->UnderLineTitleText( EFalse ); |
|
791 |
iSPUtils->SetTitleText( titleText ); // ownership passed |
|
792 |
CleanupStack::Pop( titleText ); |
|
793 |
iSPUtils->RefreshStatusPane(); |
|
794 |
||
795 |
TRACE_EXIT_POINT; |
|
796 |
} |
|
797 |
||
798 |
// ---------------------------------------------------------------------------- |
|
799 |
// CCalenTodoView::CreateContainerImplL |
|
800 |
// making CCalenContainer. In this class, it is CCalenTodoContainer. |
|
801 |
// (other items were commented in a header). |
|
802 |
// ---------------------------------------------------------------------------- |
|
803 |
// |
|
804 |
CCalenContainer* CCalenTodoView::CreateContainerImplL() |
|
805 |
{ |
|
806 |
TRACE_ENTRY_POINT; |
|
807 |
||
808 |
TRACE_EXIT_POINT; |
|
809 |
return new( ELeave )CCalenTodoContainer( this, |
|
810 |
iHighlightedRowNumber, |
|
811 |
iFirstEntryOnScreenIndex, |
|
812 |
iServices ); |
|
813 |
} |
|
814 |
||
815 |
||
816 |
// ---------------------------------------------------------------------------- |
|
817 |
// CCalenTodoView::UpdateCBAButtonsL |
|
818 |
// Update CBA buttons depending if we have empty view or not. |
|
819 |
// FIXME: Same function is also implemented in day view -> could |
|
820 |
// be virtual in CalenView. |
|
821 |
// (other items were commented in a header). |
|
822 |
// ---------------------------------------------------------------------------- |
|
823 |
void CCalenTodoView::UpdateCBAButtonsL() |
|
824 |
{ |
|
825 |
TRACE_ENTRY_POINT; |
|
826 |
||
827 |
const TInt index( Container()->CurrentItemIndex() ); |
|
828 |
const TBool isSelected( Container()->ListBox()->View()->ItemIsSelected( index ) ); |
|
829 |
TInt cbaId, menuId; |
|
830 |
||
831 |
// select CBA |
|
832 |
#ifndef RD_CALEN_ENHANCED_MSK |
|
833 |
if( Container()->IsEmptyView() || isSelected ) |
|
834 |
#else |
|
835 |
if( Container()->IsEmptyView()) |
|
836 |
#endif //RD_CALEN_ENHANCED_MSK |
|
837 |
{ |
|
838 |
// context sensitive CBA |
|
839 |
cbaId = R_CALEN_DAY_AND_TODO_VIEW_CONTEXT_MENU_CBA; |
|
840 |
} |
|
841 |
#ifdef RD_CALEN_ENHANCED_MSK |
|
842 |
else if(isSelected) |
|
843 |
{ |
|
844 |
// focused toDo is marked |
|
845 |
cbaId = R_CALEN_TODO_VIEW_CONTEXT_MENU_CBA; |
|
846 |
} |
|
847 |
#endif //RD_CALEN_ENHANCED_MSK |
|
848 |
else // normal CBA |
|
849 |
{ |
|
850 |
cbaId = R_CALEN_DAY_AND_TODO_VIEW_NORMAL_CBA; |
|
851 |
} |
|
852 |
||
853 |
// select menu |
|
854 |
if( isSelected ) |
|
855 |
{ |
|
856 |
// context sensitice menu |
|
857 |
menuId = R_TODO_LIST_SELECTION_CONTEXT_MENUBAR; |
|
858 |
} |
|
859 |
else // normal menu |
|
860 |
{ |
|
861 |
menuId = R_TODO_NEW_ENTRY_CONTEXT_MENUBAR; |
|
862 |
} |
|
863 |
||
864 |
SetCbaL( cbaId ); |
|
865 |
MenuBar()->SetContextMenuTitleResourceId( menuId ); |
|
866 |
||
867 |
TRACE_EXIT_POINT; |
|
868 |
} |
|
869 |
||
870 |
// ---------------------------------------------------------------------------- |
|
871 |
// CCalenTodoView::Id |
|
872 |
// From CAknView |
|
873 |
// Return the UID of the todo view |
|
874 |
// (other items were commented in a header) |
|
875 |
// ---------------------------------------------------------------------------- |
|
876 |
TUid CCalenTodoView::Id() const |
|
877 |
{ |
|
878 |
TRACE_ENTRY_POINT; |
|
879 |
||
880 |
TRACE_EXIT_POINT; |
|
881 |
return KUidCalenTodoView; |
|
882 |
} |
|
883 |
||
884 |
// ---------------------------------------------------------------------------- |
|
885 |
// CCalenTodoView::ClearViewSpecificDataL |
|
886 |
// Clears any cached data for the specific view, e.g. currently |
|
887 |
// highlighted row, column, etc. |
|
888 |
// (other items were commented in a header) |
|
889 |
// ---------------------------------------------------------------------------- |
|
890 |
// |
|
891 |
void CCalenTodoView::ClearViewSpecificDataL() |
|
892 |
{ |
|
893 |
TRACE_ENTRY_POINT; |
|
894 |
||
895 |
iFirstEntryOnScreenIndex = KErrNotFound; |
|
896 |
iHighlightedRowNumber = KErrNotFound; |
|
897 |
||
898 |
ClearMarkedToDoItems(); |
|
899 |
||
900 |
TRACE_EXIT_POINT; |
|
901 |
} |
|
902 |
||
903 |
// ---------------------------------------------------------------------------- |
|
904 |
// CCalenTodoView::IsViewSpecificDataNullL |
|
905 |
// From CCalenNativeView |
|
906 |
// Returns ETrue if the view specific data is null, EFalse otherwise. |
|
907 |
// (other items were commented in a header) |
|
908 |
// ---------------------------------------------------------------------------- |
|
909 |
// |
|
910 |
TBool CCalenTodoView::IsViewSpecificDataNullL() |
|
911 |
{ |
|
912 |
TRACE_ENTRY_POINT; |
|
913 |
TRACE_EXIT_POINT; |
|
914 |
return ( iFirstEntryOnScreenIndex == KErrNotFound ) && |
|
915 |
( iHighlightedRowNumber == KErrNotFound ); |
|
916 |
} |
|
917 |
||
918 |
||
919 |
||
920 |
// ---------------------------------------------------------------------------- |
|
921 |
// CCalenTodoView::ActiveStepL |
|
922 |
// From CCalenView |
|
923 |
// (other items were commented in a header) |
|
924 |
// ---------------------------------------------------------------------------- |
|
925 |
// |
|
926 |
CCalenView::TNextPopulationStep CCalenTodoView::ActiveStepL() |
|
927 |
{ |
|
928 |
TRACE_ENTRY_POINT; |
|
929 |
||
930 |
switch( iPopulationStep ) |
|
931 |
{ |
|
932 |
case ENothingDone: |
|
933 |
{ |
|
934 |
iPopulationStep = ERequestedInstanceView; |
|
935 |
RArray<TInt> colIdArray; |
|
936 |
CCalenNativeView::GetActiveCollectionidsL( iServices, colIdArray ); |
|
937 |
||
938 |
if(colIdArray.Count() > 0) |
|
939 |
{ |
|
940 |
colIdArray.Close(); |
|
941 |
if( !iServices.InstanceViewL(colIdArray) ) |
|
942 |
{ |
|
943 |
TRACE_EXIT_POINT; |
|
944 |
return CCalenView::EWaitForInstanceView; |
|
945 |
} |
|
946 |
else |
|
947 |
{ |
|
948 |
TRACE_EXIT_POINT; |
|
949 |
return CCalenView::EKeepGoing; |
|
950 |
} |
|
951 |
} |
|
952 |
else |
|
953 |
{ |
|
954 |
colIdArray.Close(); |
|
955 |
if( !iServices.InstanceViewL() ) |
|
956 |
{ |
|
957 |
TRACE_EXIT_POINT; |
|
958 |
return CCalenView::EWaitForInstanceView; |
|
959 |
} |
|
960 |
else |
|
961 |
{ |
|
962 |
TRACE_EXIT_POINT; |
|
963 |
return CCalenView::EKeepGoing; |
|
964 |
} |
|
965 |
} |
|
966 |
} |
|
967 |
// else fall through... |
|
968 |
case ERequestedInstanceView: |
|
969 |
{ |
|
970 |
MCalenContext& context = iServices.Context(); |
|
971 |
if ( !(context.InstanceId() == TCalenInstanceId::NullInstanceId()) ) |
|
972 |
{ |
|
973 |
iHighlightedRowNumber = Container()->Controller()->FindInstanceIndexL( context.InstanceId() ); |
|
974 |
} |
|
975 |
Container()->BeginPopulationWithInstanceViewL(); |
|
976 |
iPopulationStep = EAddToStackNext; |
|
977 |
TRACE_EXIT_POINT; |
|
978 |
return CCalenView::EKeepGoing; |
|
979 |
} |
|
980 |
case EAddToStackNext: |
|
981 |
default: |
|
982 |
Container()->CompletePopulationL(); |
|
983 |
iPopulationStep = EPopulationDone; |
|
984 |
TRACE_EXIT_POINT; |
|
985 |
return CCalenView::EDone; |
|
986 |
} |
|
987 |
} |
|
988 |
||
989 |
// ---------------------------------------------------------------------------- |
|
990 |
// CCalenTodoView::CancelPopulation |
|
991 |
// From CCalenView |
|
992 |
// (other items were commented in a header) |
|
993 |
// ---------------------------------------------------------------------------- |
|
994 |
// |
|
995 |
void CCalenTodoView::CancelPopulation() |
|
996 |
{ |
|
997 |
TRACE_ENTRY_POINT; |
|
998 |
||
999 |
iPopulationStep = ENothingDone; |
|
1000 |
||
1001 |
TRACE_EXIT_POINT; |
|
1002 |
} |
|
1003 |
||
1004 |
// ---------------------------------------------------------------------------- |
|
1005 |
// CCalenTodoView::CyclePosition |
|
1006 |
// From CCalenView |
|
1007 |
// (other items were commented in a header) |
|
1008 |
// ---------------------------------------------------------------------------- |
|
1009 |
// |
|
1010 |
CCalenView::TCyclePosition CCalenTodoView::CyclePosition() const |
|
1011 |
{ |
|
1012 |
TRACE_ENTRY_POINT; |
|
1013 |
TRACE_EXIT_POINT; |
|
1014 |
return CCalenView::EReplaceTodoView; |
|
1015 |
} |
|
1016 |
||
1017 |
// ---------------------------------------------------------------------------- |
|
1018 |
// CCalenTodoView::LocalisedViewNameL |
|
1019 |
// From CCalenView |
|
1020 |
// (other items were commented in a header) |
|
1021 |
// ---------------------------------------------------------------------------- |
|
1022 |
// |
|
1023 |
const TDesC& CCalenTodoView::LocalisedViewNameL( CCalenView::TViewName aViewName ) |
|
1024 |
{ |
|
1025 |
TRACE_ENTRY_POINT; |
|
1026 |
||
1027 |
HBufC* ret = NULL; |
|
1028 |
||
1029 |
switch (aViewName) |
|
1030 |
{ |
|
1031 |
case CCalenView::EMenuName: |
|
1032 |
if( !iMenuName ) |
|
1033 |
{ |
|
1034 |
iMenuName = StringLoader::LoadL( R_CALEN_VIEW_TODO, iCoeEnv ); |
|
1035 |
} |
|
1036 |
ret = iMenuName; |
|
1037 |
break; |
|
1038 |
case CCalenView::ESettingsName: |
|
1039 |
if( !iSettingsName ) |
|
1040 |
{ |
|
1041 |
iSettingsName = StringLoader::LoadL( |
|
1042 |
R_CALEN_QTN_DEFAULT_TODO_VIEW, iCoeEnv ); |
|
1043 |
} |
|
1044 |
ret = iSettingsName; |
|
1045 |
break; |
|
1046 |
default: |
|
1047 |
ASSERT( EFalse ); |
|
1048 |
break; |
|
1049 |
} |
|
1050 |
||
1051 |
TRACE_EXIT_POINT; |
|
1052 |
return *ret; |
|
1053 |
} |
|
1054 |
||
1055 |
// ---------------------------------------------------------------------------- |
|
1056 |
// CCalenTodoView::ViewIcon |
|
1057 |
// From CCalenView |
|
1058 |
// (other items were commented in a header) |
|
1059 |
// ---------------------------------------------------------------------------- |
|
1060 |
// |
|
1061 |
CGulIcon* CCalenTodoView::ViewIconL() const |
|
1062 |
{ |
|
1063 |
TRACE_ENTRY_POINT; |
|
1064 |
||
1065 |
TRACE_EXIT_POINT; |
|
1066 |
||
1067 |
return iServices.GetIconL( MCalenServices::ECalenTodoViewIcon ); |
|
1068 |
} |
|
1069 |
||
1070 |
// ---------------------------------------------------------------------------- |
|
1071 |
// CCalenTodoView::NotifyMarkedEntryDeletedL() |
|
1072 |
// From CCalenView |
|
1073 |
// (other items were commented in a header) |
|
1074 |
// ---------------------------------------------------------------------------- |
|
1075 |
// |
|
1076 |
void CCalenTodoView::NotifyMarkedEntryDeletedL() |
|
1077 |
{ |
|
1078 |
TRACE_ENTRY_POINT; |
|
1079 |
||
1080 |
// reset the marked items count |
|
1081 |
iCountOfSelectedItems = iServices.Context().MutlipleContextIdsCount(); |
|
1082 |
||
1083 |
ClearMarkedToDoItems(); |
|
1084 |
||
1085 |
iFirstEntryOnScreenIndex = KErrNotFound; |
|
1086 |
iHighlightedRowNumber = KErrNotFound; |
|
1087 |
||
1088 |
// DON'T issue MultipleEntriesDeleted notification immediately, which would result in |
|
1089 |
// alter the state, on recieving a another notification. It would fxxk up the state. |
|
1090 |
// Instead create a callback to issue new notification |
|
1091 |
if( !iCmdCallback ) |
|
1092 |
{ |
|
1093 |
TCallBack callback( NotificationCallback, this ); |
|
1094 |
iCmdCallback = new ( ELeave ) CAsyncCallBack( callback, |
|
1095 |
CActive::EPriorityHigh ); |
|
1096 |
} |
|
1097 |
iCmdCallback->CallBack(); |
|
1098 |
||
1099 |
TRACE_EXIT_POINT; |
|
1100 |
} |
|
1101 |
||
1102 |
// ---------------------------------------------------------------------------- |
|
1103 |
// CCalenTodoView::NotificationCallback |
|
1104 |
// static callback function |
|
1105 |
// (other items were commented in a header) |
|
1106 |
// ---------------------------------------------------------------------------- |
|
1107 |
// |
|
1108 |
TInt CCalenTodoView::NotificationCallback( TAny* aCommandStruct ) |
|
1109 |
{ |
|
1110 |
TRACE_ENTRY_POINT; |
|
1111 |
||
1112 |
CCalenTodoView* self = static_cast<CCalenTodoView*> ( aCommandStruct ); |
|
1113 |
PIM_TRAPD_HANDLE( self->DoNotificationCallbackL() ); |
|
1114 |
||
1115 |
TRACE_EXIT_POINT; |
|
1116 |
return EFalse; |
|
1117 |
} |
|
1118 |
||
1119 |
// ---------------------------------------------------------------------------- |
|
1120 |
// CCalenTodoView::DoNotificationCallbackL |
|
1121 |
// Leaving implementation of the callback function |
|
1122 |
// (other items were commented in a header) |
|
1123 |
// ---------------------------------------------------------------------------- |
|
1124 |
// |
|
1125 |
void CCalenTodoView::DoNotificationCallbackL() |
|
1126 |
{ |
|
1127 |
TRACE_ENTRY_POINT; |
|
1128 |
||
1129 |
iServices.IssueNotificationL( ECalenNotifyMultipleEntriesDeleted ); |
|
1130 |
||
1131 |
TRACE_EXIT_POINT; |
|
1132 |
} |
|
1133 |
||
1134 |
// ---------------------------------------------------------------------------- |
|
1135 |
// CCalenTodoView::DeleteMarkedNotesL |
|
1136 |
// Delete marked notes. |
|
1137 |
// (other items were commented in a header). |
|
1138 |
// ---------------------------------------------------------------------------- |
|
1139 |
// |
|
1140 |
void CCalenTodoView::CreateMultiplecontextForMarkedItemsL(TInt aCommand) |
|
1141 |
{ |
|
1142 |
TRACE_ENTRY_POINT; |
|
1143 |
||
1144 |
CEikColumnListBox* listbox = Container()->ListBox(); |
|
1145 |
||
1146 |
const CListBoxView::CSelectionIndexArray& selectedItems = |
|
1147 |
*( listbox->SelectionIndexes() ); |
|
1148 |
||
1149 |
TInt markCount( selectedItems.Count() ); |
|
1150 |
ASSERT( markCount ); |
|
1151 |
||
1152 |
iCountOfSelectedItems = markCount; // Save count of marked item |
|
1153 |
||
1154 |
CCalenTodoController* controller = Container()->Controller(); |
|
1155 |
iMarkedInstances.Reset(); |
|
1156 |
||
1157 |
switch (aCommand) |
|
1158 |
{ |
|
1159 |
case ECalenMarkDone: |
|
1160 |
{ |
|
1161 |
for (TInt i( 0 ); i < markCount; ++i) |
|
1162 |
{ |
|
1163 |
TInt indexPos( selectedItems[ i ] ); |
|
1164 |
if( !( controller->IsCrossOutL( indexPos ) ) ) |
|
1165 |
{ |
|
1166 |
iMarkedInstances.AppendL( |
|
1167 |
controller->InstanceL( indexPos ) ); |
|
1168 |
} |
|
1169 |
} |
|
1170 |
||
1171 |
if( !iMarkedInstances.Count() ) |
|
1172 |
{ |
|
1173 |
TInt resID = R_CALEN_QTN_TODO_ALL_TASK_UPDATED; |
|
1174 |
HBufC* buf = |
|
1175 |
StringLoader::LoadLC( resID, CEikonEnv::Static() ); |
|
1176 |
CAknInformationNote* dialog = |
|
1177 |
new ( ELeave ) CAknInformationNote(); |
|
1178 |
||
1179 |
dialog->ExecuteLD( *buf ); |
|
1180 |
||
1181 |
CleanupStack::PopAndDestroy( buf ); |
|
1182 |
||
1183 |
// Remove all markings before completing the execution of cmd. |
|
1184 |
static_cast<CCalenTodoContainer*> ( iContainer )->MarkAllL( |
|
1185 |
EFalse ); |
|
1186 |
} |
|
1187 |
else |
|
1188 |
{ |
|
1189 |
SetMultipleContexts(); |
|
1190 |
||
1191 |
iServices.IssueCommandL( ECalenMarkEntryAsDone ); |
|
1192 |
} |
|
1193 |
} |
|
1194 |
break; |
|
1195 |
||
1196 |
case ECalenMarkUnDone: |
|
1197 |
{ |
|
1198 |
for (TInt i( 0 ); i < markCount; ++i) |
|
1199 |
{ |
|
1200 |
TInt indexPos( selectedItems[ i ] ); |
|
1201 |
if( controller->IsCrossOutL( indexPos ) ) |
|
1202 |
{ |
|
1203 |
iMarkedInstances.AppendL( |
|
1204 |
controller->InstanceL( indexPos ) ); |
|
1205 |
} |
|
1206 |
} |
|
1207 |
if( !iMarkedInstances.Count() ) |
|
1208 |
{ |
|
1209 |
TInt resID = R_CALEN_QTN_TODO_ALL_TASK_UPDATED; |
|
1210 |
HBufC* buf = |
|
1211 |
StringLoader::LoadLC( resID, CEikonEnv::Static() ); |
|
1212 |
CAknInformationNote* dialog = |
|
1213 |
new ( ELeave ) CAknInformationNote(); |
|
1214 |
||
1215 |
dialog->ExecuteLD( *buf ); |
|
1216 |
||
1217 |
CleanupStack::PopAndDestroy( buf ); |
|
1218 |
||
1219 |
// Remove all markings before completing the execution of cmd. |
|
1220 |
static_cast<CCalenTodoContainer*> ( iContainer )->MarkAllL( |
|
1221 |
EFalse ); |
|
1222 |
} |
|
1223 |
else |
|
1224 |
{ |
|
1225 |
SetMultipleContexts(); |
|
1226 |
||
1227 |
iServices.IssueCommandL( ECalenMarkEntryAsUnDone ); |
|
1228 |
} |
|
1229 |
} |
|
1230 |
break; |
|
1231 |
||
1232 |
case ECalenDeleteEntryWithoutQuery: |
|
1233 |
{ |
|
1234 |
for( TInt i( 0 ); i < markCount; ++i ) |
|
1235 |
{ |
|
1236 |
TInt indexPos( selectedItems[ i ] ); |
|
1237 |
iMarkedInstances.AppendL( controller->InstanceL( indexPos ) ); |
|
1238 |
} |
|
1239 |
||
1240 |
SetMultipleContexts(); |
|
1241 |
// Find index of the item to be focused after deletion. |
|
1242 |
FindFocusAfterDeletionL( selectedItems ); |
|
1243 |
||
1244 |
iServices.IssueCommandL( ECalenDeleteEntryWithoutQuery ); |
|
1245 |
} |
|
1246 |
break; |
|
1247 |
||
1248 |
default: |
|
1249 |
//no implemenatation as of now. |
|
1250 |
break; |
|
1251 |
} |
|
1252 |
||
1253 |
TRACE_EXIT_POINT; |
|
1254 |
} |
|
1255 |
||
1256 |
// ---------------------------------------------------------------------------- |
|
1257 |
// CCalenTodoView::SetMutlipleContexts |
|
1258 |
// Set Multiple contexts |
|
1259 |
// (other items were commented in a header) |
|
1260 |
// ---------------------------------------------------------------------------- |
|
1261 |
// |
|
1262 |
void CCalenTodoView::SetMultipleContexts() |
|
1263 |
{ |
|
1264 |
TRACE_ENTRY_POINT; |
|
1265 |
||
1266 |
if( iMarkedInstances.Count() ) |
|
1267 |
{ |
|
1268 |
RArray< TCalenInstanceId > multipleContextIds; |
|
1269 |
TCalenInstanceId instanceId; |
|
1270 |
for( TInt index = 0; index < iMarkedInstances.Count(); index++ ) |
|
1271 |
{ |
|
1272 |
// pack instance ids of the marked instancesS |
|
1273 |
TRAPD( error, |
|
1274 |
instanceId = TCalenInstanceId::CreateL( *iMarkedInstances[ index ] ) ); |
|
1275 |
if( error != KErrNone ) |
|
1276 |
{ |
|
1277 |
// Do nothing to avoid warning |
|
1278 |
} |
|
1279 |
multipleContextIds.Append( instanceId ); |
|
1280 |
} |
|
1281 |
||
1282 |
// set the multiple contexts |
|
1283 |
iServices.Context().SetMutlipleContextIds( multipleContextIds ); |
|
1284 |
} |
|
1285 |
||
1286 |
TRACE_EXIT_POINT; |
|
1287 |
} |
|
1288 |
||
1289 |
// ---------------------------------------------------------------------------- |
|
1290 |
// CCalenTodoView::SetMarkedToDoItems |
|
1291 |
// Set marked to do items |
|
1292 |
// ---------------------------------------------------------------------------- |
|
1293 |
// |
|
1294 |
void CCalenTodoView::SetMarkedToDoItems( |
|
1295 |
CListBoxView::CSelectionIndexArray* aMarkedTodoItems) |
|
1296 |
{ |
|
1297 |
TRACE_ENTRY_POINT; |
|
1298 |
||
1299 |
if( iMarkedTodoItems ) |
|
1300 |
{ |
|
1301 |
delete iMarkedTodoItems; |
|
1302 |
iMarkedTodoItems = NULL; |
|
1303 |
} |
|
1304 |
iMarkedTodoItems = aMarkedTodoItems; |
|
1305 |
||
1306 |
TRACE_EXIT_POINT; |
|
1307 |
} |
|
1308 |
||
1309 |
// ---------------------------------------------------------------------------- |
|
1310 |
// CCalenTodoView::GetMarkedToDoItems |
|
1311 |
// Get marked to do items |
|
1312 |
// ---------------------------------------------------------------------------- |
|
1313 |
// |
|
1314 |
CListBoxView::CSelectionIndexArray* CCalenTodoView::GetMarkedToDoItems() |
|
1315 |
{ |
|
1316 |
TRACE_ENTRY_POINT; |
|
1317 |
||
1318 |
TRACE_EXIT_POINT; |
|
1319 |
||
1320 |
return iMarkedTodoItems; |
|
1321 |
} |
|
1322 |
||
1323 |
// ---------------------------------------------------------------------------- |
|
1324 |
// CCalenTodoView::ClearMarkedToDoItems |
|
1325 |
// Clear all marked todo items |
|
1326 |
// (other items were commented in a header) |
|
1327 |
// ---------------------------------------------------------------------------- |
|
1328 |
// |
|
1329 |
void CCalenTodoView::ClearMarkedToDoItems() |
|
1330 |
{ |
|
1331 |
TRACE_ENTRY_POINT; |
|
1332 |
||
1333 |
if( iMarkedTodoItems ) |
|
1334 |
{ |
|
1335 |
delete iMarkedTodoItems; |
|
1336 |
iMarkedTodoItems = NULL; |
|
1337 |
} |
|
1338 |
||
1339 |
TRACE_EXIT_POINT; |
|
1340 |
} |
|
1341 |
||
1342 |
// ---------------------------------------------------------------------------- |
|
1343 |
// CCalenTodoView::NotifyMarkedEntryCompletedL |
|
1344 |
// (other items were commented in a header) |
|
1345 |
// ---------------------------------------------------------------------------- |
|
1346 |
// |
|
1347 |
void CCalenTodoView::NotifyMarkedEntryCompletedL() |
|
1348 |
{ |
|
1349 |
TRACE_ENTRY_POINT; |
|
1350 |
||
1351 |
Container()->MarkAllL( EFalse ); |
|
1352 |
||
1353 |
TRACE_EXIT_POINT; |
|
1354 |
} |
|
1355 |
||
1356 |
// ---------------------------------------------------------------------------- |
|
1357 |
// CCalenTodoView::CheckMarkedItemCompletedL |
|
1358 |
// (other items were commented in a header) |
|
1359 |
// ---------------------------------------------------------------------------- |
|
1360 |
// |
|
1361 |
TBool CCalenTodoView::CheckMarkedItemCompletedL() |
|
1362 |
{ |
|
1363 |
TRACE_ENTRY_POINT; |
|
1364 |
||
1365 |
CEikColumnListBox* listbox = Container()->ListBox(); |
|
1366 |
const CListBoxView::CSelectionIndexArray& selectedItems = |
|
1367 |
*( listbox->SelectionIndexes() ); |
|
1368 |
return Container()->Controller()->IsCrossOutL( selectedItems[ 0 ] ); |
|
1369 |
||
1370 |
TRACE_EXIT_POINT; |
|
1371 |
} |
|
1372 |
||
1373 |
// End of File |