|
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 if(!Container()->IsEmptyView()) |
|
292 { |
|
293 if(!Container()->MarkedCount()) |
|
294 { |
|
295 CCalenNativeView::HandleCommandL(ECalenEventView); |
|
296 break; |
|
297 } |
|
298 |
|
299 |
|
300 else |
|
301 { |
|
302 CListBoxView* listboxview = Container()->ListBox()->View(); |
|
303 TInt index = Container()->CurrentItemIndex(); |
|
304 TBool iselected=listboxview->ItemIsSelected(index); |
|
305 |
|
306 if( !Container()->Controller()->Count() || iselected ) |
|
307 { |
|
308 // display the context sensitive menu |
|
309 /* CEikMenuBar* menuBar = MenuBar(); |
|
310 menuBar->SetContextMenuTitleResourceId( R_TODO_LIST_SELECTION_CONTEXT_MENUBAR ); |
|
311 menuBar->TryDisplayContextMenuBarL(); |
|
312 */ |
|
313 } |
|
314 else |
|
315 { |
|
316 CCalenNativeView::HandleCommandL( ECalenEventView ); |
|
317 } |
|
318 } |
|
319 } |
|
320 break; |
|
321 //TODO: will be uncommented with copy to cal functionality. |
|
322 case ECalenCopyToCalendars: |
|
323 { |
|
324 CopyToCalendarsL(); |
|
325 } |
|
326 break; |
|
327 |
|
328 #ifdef RD_CALEN_ENHANCED_MSK |
|
329 case ECalenCmdOpenMskDialog: |
|
330 CCalenNativeView::HandleCommandL( ECalenNewMeeting ); |
|
331 break; |
|
332 #else |
|
333 case EAknSoftkeyContextOptions: |
|
334 MenuBar()->TryDisplayContextMenuBarL(); |
|
335 break; |
|
336 #endif //RD_CALEN_ENHANCED_MSK |
|
337 |
|
338 case ECalenDeleteCurrentEntry: |
|
339 { |
|
340 SaveCurrentItemIndexL(); |
|
341 |
|
342 if( Container()->MarkedCount() >= 1 ) |
|
343 { |
|
344 // delete marked entries |
|
345 OnCmdDeleteEntryL(); |
|
346 } |
|
347 else |
|
348 { |
|
349 SaveCurrentItemIndexL(); |
|
350 CCalenNativeView::HandleCommandL( aCommand ); |
|
351 } |
|
352 } |
|
353 break; |
|
354 case ECalenMarkOne: |
|
355 SaveCurrentItemIndexL(); |
|
356 Container()->MarkCurrentL( ETrue ); |
|
357 break; |
|
358 |
|
359 case ECalenUnmarkOne: |
|
360 SaveCurrentItemIndexL(); |
|
361 Container()->MarkCurrentL( EFalse ); |
|
362 break; |
|
363 |
|
364 case ECalenMarkAll: |
|
365 SaveCurrentItemIndexL(); |
|
366 Container()->MarkAllL( ETrue ); |
|
367 break; |
|
368 |
|
369 case ECalenUnmarkAll: |
|
370 SaveCurrentItemIndexL(); |
|
371 Container()->MarkAllL( EFalse ); |
|
372 break; |
|
373 |
|
374 case ECalenMarkDone: |
|
375 SaveCurrentItemIndexL(); |
|
376 CreateMultiplecontextForMarkedItemsL(ECalenMarkDone); |
|
377 break; |
|
378 case ECalenMarkUnDone: |
|
379 SaveCurrentItemIndexL(); |
|
380 CreateMultiplecontextForMarkedItemsL(ECalenMarkUnDone); |
|
381 break; |
|
382 |
|
383 // These differ from native view because all new entries from the |
|
384 // todo view start today. However this does mean that if the user |
|
385 // discards changes to the new entry, we are returned to the top of |
|
386 // the list as the context is today. Can't see an easy way round it. |
|
387 case ECalenNewMeeting: |
|
388 case ECalenNewMeetingRequest: |
|
389 case ECalenNewAnniv: |
|
390 case ECalenNewDayNote: |
|
391 case ECalenNewTodo: |
|
392 { |
|
393 // set the editoractive for not showing the preview popup or preview pane |
|
394 SetEditorActive(ETrue); |
|
395 |
|
396 MCalenContext& context = iServices.Context(); |
|
397 // Set the date on the context to today. It will set it to be the |
|
398 // default of view (8am) on that day as we don't specify the time. |
|
399 TTime homeTime; |
|
400 homeTime.HomeTime(); |
|
401 TCalTime today; |
|
402 today.SetTimeLocalL( homeTime ); |
|
403 context.SetFocusDateL( today, |
|
404 TVwsViewId( KUidCalendar, Id() ) ); |
|
405 iServices.IssueCommandL( aCommand ); |
|
406 break; |
|
407 } |
|
408 |
|
409 case ECalenDayView: |
|
410 case ECalenWeekView: |
|
411 case ECalenMonthView: |
|
412 { |
|
413 SaveCurrentItemIndexL(); |
|
414 |
|
415 // clear marked to do items before launching the native views |
|
416 if(iMarkedTodoItems) |
|
417 { |
|
418 ClearMarkedToDoItems(); |
|
419 } |
|
420 |
|
421 iServices.IssueCommandL( aCommand ); |
|
422 } |
|
423 break; |
|
424 default: |
|
425 SaveCurrentItemIndexL(); |
|
426 CCalenNativeView::HandleCommandL( aCommand ); |
|
427 break; |
|
428 } |
|
429 UpdateCBAButtonsL(); |
|
430 |
|
431 TRACE_EXIT_POINT; |
|
432 } |
|
433 |
|
434 // ---------------------------------------------------------------------------- |
|
435 // CCalenTodoView::DeleteMarkedNotesL |
|
436 // Delete marked notes. |
|
437 // (other items were commented in a header). |
|
438 // ---------------------------------------------------------------------------- |
|
439 // |
|
440 void CCalenTodoView::DeleteMarkedNotesL() |
|
441 { |
|
442 TRACE_ENTRY_POINT; |
|
443 |
|
444 CEikColumnListBox* listbox = Container()->ListBox(); |
|
445 |
|
446 const CListBoxView::CSelectionIndexArray& selectedItems = *(listbox->SelectionIndexes()); |
|
447 |
|
448 TInt markCount( selectedItems.Count() ); |
|
449 ASSERT( markCount ); |
|
450 |
|
451 iCountOfSelectedItems = markCount; // Save count of marked item |
|
452 |
|
453 CCalenTodoController* controller = Container()->Controller(); |
|
454 iMarkedInstances.Reset(); |
|
455 |
|
456 for( TInt i(0); i < markCount; ++i ) |
|
457 { |
|
458 TInt indexPos( selectedItems[i] ); |
|
459 iMarkedInstances.AppendL( controller->InstanceL( indexPos ) ); |
|
460 } |
|
461 |
|
462 SetMultipleContexts(); |
|
463 |
|
464 // Find index of the item to be focused after deletion. |
|
465 FindFocusAfterDeletionL( selectedItems ); |
|
466 |
|
467 iServices.IssueCommandL( ECalenDeleteEntryWithoutQuery ); |
|
468 |
|
469 TRACE_EXIT_POINT; |
|
470 } |
|
471 |
|
472 // ---------------------------------------------------------------------------- |
|
473 // CCalenTodoView::FindFocusAfterDeletionL |
|
474 // Save new current postion of item after deleting marked items. |
|
475 // ---------------------------------------------------------------------------- |
|
476 // |
|
477 void CCalenTodoView::FindFocusAfterDeletionL(const CListBoxView::CSelectionIndexArray& aSelectedItems) |
|
478 { |
|
479 TRACE_ENTRY_POINT; |
|
480 |
|
481 // calculate the item position after deleting marked items. |
|
482 TInt index( Container()->CurrentItemIndex() ); |
|
483 TInt indexpos( 0 ); |
|
484 TInt adjustitems( 0 ); |
|
485 TBool markedAndFocus( EFalse ); |
|
486 iItemIndexAfterDeletion = 0; // Initialize item position |
|
487 |
|
488 for( TInt n(0); n < iCountOfSelectedItems; n++ ) |
|
489 { |
|
490 indexpos = (aSelectedItems)[n]; |
|
491 |
|
492 if( indexpos <= index ) |
|
493 { |
|
494 ++adjustitems; |
|
495 } |
|
496 |
|
497 if( indexpos == index ) |
|
498 { |
|
499 markedAndFocus = ETrue; // Focused item is marked. |
|
500 } |
|
501 } |
|
502 |
|
503 // (Selection Service Spec 10.0 section 1.2.2.) |
|
504 indexpos = index -adjustitems; // Adjust postion |
|
505 |
|
506 // Current item is marked and focused. |
|
507 if( markedAndFocus ) |
|
508 { |
|
509 TInt prevcount( Container()->Controller()->Count() ); |
|
510 |
|
511 if( indexpos < (prevcount -iCountOfSelectedItems -1) ) |
|
512 { |
|
513 // Focused item is not last. |
|
514 // Focus goes to the next item. |
|
515 ++indexpos; |
|
516 } |
|
517 } |
|
518 |
|
519 // Save new item position after deleting. |
|
520 iItemIndexAfterDeletion = indexpos; |
|
521 |
|
522 TRACE_EXIT_POINT; |
|
523 } |
|
524 |
|
525 // ---------------------------------------------------------------------------- |
|
526 // CCalenTodoView::DynInitMenuPaneL |
|
527 // This function called to initialize menu pane. |
|
528 // ---------------------------------------------------------------------------- |
|
529 // |
|
530 void CCalenTodoView::DynInitMenuPaneL(TInt aResourceId, // Resource Id |
|
531 CEikMenuPane* aMenuPane) // Menu pane pointer |
|
532 { |
|
533 TRACE_ENTRY_POINT; |
|
534 |
|
535 CCalenNativeView::DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
536 |
|
537 switch( aResourceId ) |
|
538 { |
|
539 case R_TODO_LIST_MENUPANE: |
|
540 { |
|
541 |
|
542 #ifdef RD_CALEN_EXTERNAL_CAL |
|
543 TBool isit=ExtCalendarAvailableL(); |
|
544 if (!isit) |
|
545 { |
|
546 //ECalenExtAiwCommandId |
|
547 ReleaseServiceHandler(); |
|
548 TInt dummy; |
|
549 if (aMenuPane->MenuItemExists(ECalenExtAiwCommandId,dummy)) |
|
550 { |
|
551 aMenuPane->DeleteMenuItem(ECalenExtAiwCommandId); |
|
552 } |
|
553 } |
|
554 #endif //RD_CALEN_EXTERNAL_CAL |
|
555 |
|
556 if ( ! FeatureManager::FeatureSupported(KFeatureIdHelp) ) |
|
557 { |
|
558 aMenuPane->DeleteMenuItem(EAknCmdHelp); |
|
559 } |
|
560 if( !ItemCount() ) |
|
561 { |
|
562 aMenuPane->DeleteMenuItem( ECalenViewCurrentEntry ); |
|
563 aMenuPane->DeleteMenuItem( ECalenDeleteCurrentEntry ); |
|
564 aMenuPane->DeleteMenuItem( ECalenCompleteTodo ); |
|
565 aMenuPane->DeleteMenuItem( ECalenRestoreTodo ); |
|
566 aMenuPane->DeleteMenuItem( ECalenCmdComplete ); |
|
567 aMenuPane->DeleteMenuItem( ECalenMarkDone ); |
|
568 aMenuPane->DeleteMenuItem( ECalenMarkUnDone ); |
|
569 aMenuPane->DeleteMenuItem( ECalenCmdMark ); |
|
570 aMenuPane->DeleteMenuItem( ECalenSend ); |
|
571 |
|
572 //TODO: will be uncommented with copy to cal functionality. |
|
573 aMenuPane->DeleteMenuItem(ECalenCopyToCalendars); |
|
574 } |
|
575 else |
|
576 { |
|
577 if( Container()->MarkedCount() ) |
|
578 { |
|
579 aMenuPane->SetItemSpecific( ECalenDeleteCurrentEntry, EFalse ); |
|
580 if(Container()->IsCurrentItemSelected()) // If focused list item is marked |
|
581 { |
|
582 aMenuPane->DeleteMenuItem( ECalenViewCurrentEntry ); |
|
583 } |
|
584 aMenuPane->DeleteMenuItem( ECalenNewMeeting ); |
|
585 aMenuPane->DeleteMenuItem( ECalenCompleteTodo ); |
|
586 aMenuPane->DeleteMenuItem( ECalenRestoreTodo ); |
|
587 aMenuPane->DeleteMenuItem( ECalenSend ); |
|
588 |
|
589 if(Container()->MarkedCount() == 1) |
|
590 { |
|
591 aMenuPane->DeleteMenuItem( ECalenCmdComplete ); |
|
592 TBool crossout( EFalse ); |
|
593 crossout = CheckMarkedItemCompletedL(); |
|
594 if( crossout ) |
|
595 { |
|
596 aMenuPane->DeleteMenuItem( ECalenMarkDone ); |
|
597 } |
|
598 else |
|
599 { |
|
600 aMenuPane->DeleteMenuItem( ECalenMarkUnDone ); |
|
601 } |
|
602 } |
|
603 else |
|
604 { |
|
605 aMenuPane->DeleteMenuItem( ECalenMarkDone ); |
|
606 aMenuPane->DeleteMenuItem( ECalenMarkUnDone ); |
|
607 } |
|
608 } |
|
609 else |
|
610 { |
|
611 aMenuPane->SetItemSpecific( ECalenDeleteCurrentEntry, ETrue ); |
|
612 TBool crossout( EFalse ); |
|
613 aMenuPane->DeleteMenuItem( ECalenCmdComplete ); |
|
614 aMenuPane->DeleteMenuItem( ECalenMarkDone ); |
|
615 aMenuPane->DeleteMenuItem( ECalenMarkUnDone ); |
|
616 crossout = CurrentItemIsCrossOutL(); |
|
617 |
|
618 if( crossout ) |
|
619 { |
|
620 aMenuPane->DeleteMenuItem( ECalenCompleteTodo ); |
|
621 } |
|
622 else |
|
623 { |
|
624 aMenuPane->DeleteMenuItem( ECalenRestoreTodo ); |
|
625 } |
|
626 } |
|
627 } |
|
628 if( !iServices.InterimUtilsL().MRViewersEnabledL( ETrue ) ) |
|
629 { |
|
630 aMenuPane->DeleteMenuItem( ECalenNewMeetingRequest ); |
|
631 } |
|
632 |
|
633 // Offer the menu pane to the services for customisation by the |
|
634 // the view manager/plugins |
|
635 iServices.OfferMenuPaneL( aResourceId, aMenuPane ); |
|
636 |
|
637 // Single click integration |
|
638 TInt menuIndex( 0 ); |
|
639 if ( aMenuPane->MenuItemExists( ECalenSend, menuIndex ) ) |
|
640 { |
|
641 aMenuPane->SetItemSpecific( ECalenSend, ETrue ); |
|
642 } |
|
643 break; |
|
644 } |
|
645 |
|
646 // setup edit/mark menu |
|
647 case R_CALENDAR_MARK_UNMARK: |
|
648 if( ItemCount() ) |
|
649 { |
|
650 if( Container()->MarkedCount() ) |
|
651 { |
|
652 // all selected |
|
653 if( Container()->MarkedCount() == ItemCount() ) |
|
654 { |
|
655 aMenuPane->DeleteMenuItem( ECalenMarkAll ); |
|
656 aMenuPane->DeleteMenuItem( ECalenMarkOne ); |
|
657 } |
|
658 else // some selected |
|
659 { |
|
660 if( Container()->IsCurrentItemSelected() ) |
|
661 { |
|
662 aMenuPane->DeleteMenuItem( ECalenMarkOne ); |
|
663 } |
|
664 else |
|
665 { |
|
666 aMenuPane->DeleteMenuItem( ECalenUnmarkOne ); |
|
667 } |
|
668 } |
|
669 } |
|
670 else // none selected |
|
671 { |
|
672 aMenuPane->DeleteMenuItem( ECalenUnmarkAll ); |
|
673 aMenuPane->DeleteMenuItem( ECalenUnmarkOne ); |
|
674 |
|
675 } |
|
676 } |
|
677 break; |
|
678 // setup edit/mark menu |
|
679 case R_CALENDAR_DONE_UNDONE: |
|
680 { |
|
681 if( Container()->MarkedCount() == 1) |
|
682 { |
|
683 TBool crossout( EFalse ); |
|
684 crossout = CheckMarkedItemCompletedL(); |
|
685 |
|
686 if( crossout ) |
|
687 { |
|
688 aMenuPane->DeleteMenuItem( ECalenMarkDone ); |
|
689 } |
|
690 else |
|
691 { |
|
692 aMenuPane->DeleteMenuItem( ECalenMarkUnDone ); |
|
693 } |
|
694 } |
|
695 } |
|
696 break; |
|
697 /* case R_TODO_LIST_SELECTION_CONTEXT_MENUPANE: |
|
698 if( !ItemCount() || !Container()->MarkedCount() ) |
|
699 { |
|
700 aMenuPane->DeleteMenuItem( ECalenDeleteCurrentEntry ); |
|
701 } |
|
702 break; |
|
703 */ |
|
704 |
|
705 default: |
|
706 break; |
|
707 } |
|
708 |
|
709 TRACE_EXIT_POINT; |
|
710 } |
|
711 |
|
712 // ---------------------------------------------------------------------------- |
|
713 // CCalenTodoView::DoActivateImplL |
|
714 // Called when List View becomes active. |
|
715 // (other items were commented in a header). |
|
716 // ---------------------------------------------------------------------------- |
|
717 // |
|
718 void CCalenTodoView::DoActivateImplL( const TVwsViewId& /*aPrevViewId*/, |
|
719 TUid /*aCustomMessageId*/, |
|
720 const TDesC8& /*aCustomMessage*/ ) |
|
721 { |
|
722 TRACE_ENTRY_POINT; |
|
723 |
|
724 RedrawStatusPaneL(); // Set a text to title pane. |
|
725 |
|
726 MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull(); |
|
727 if(toolbarImpl) |
|
728 { |
|
729 CAknToolbar& toolbar = toolbarImpl->Toolbar(); |
|
730 |
|
731 // dim clear and clear all toolbar buttons |
|
732 toolbar.SetItemDimmed(ECalenGotoToday,ETrue,ETrue); |
|
733 } |
|
734 |
|
735 TRACE_EXIT_POINT; |
|
736 } |
|
737 |
|
738 // ---------------------------------------------------------------------------- |
|
739 // CCalenTodoView::DoDeactivateImpl |
|
740 // Called when List View becomes inactive. |
|
741 // ---------------------------------------------------------------------------- |
|
742 // |
|
743 void CCalenTodoView::DoDeactivateImpl() |
|
744 { |
|
745 TRACE_ENTRY_POINT; |
|
746 |
|
747 MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull(); |
|
748 if(toolbarImpl) |
|
749 { |
|
750 CAknToolbar& toolbar = toolbarImpl->Toolbar(); |
|
751 |
|
752 if(&toolbar) |
|
753 { |
|
754 // dim clear and clear all toolbar buttons |
|
755 toolbar.SetItemDimmed(ECalenGotoToday,EFalse,ETrue); |
|
756 } |
|
757 } |
|
758 |
|
759 // Remove all markings when the view is deactivated. |
|
760 static_cast< CCalenTodoContainer* > ( iContainer )->MarkAllL( |
|
761 EFalse ); |
|
762 |
|
763 TRACE_EXIT_POINT; |
|
764 } |
|
765 |
|
766 // ---------------------------------------------------------------------------- |
|
767 // CCalenTodoView::RedrawStatusPaneL |
|
768 // Redraw status pane when Form is closed |
|
769 // (other items were commented in a header). |
|
770 // ---------------------------------------------------------------------------- |
|
771 // |
|
772 void CCalenTodoView::RedrawStatusPaneL() |
|
773 { |
|
774 TRACE_ENTRY_POINT; |
|
775 |
|
776 HBufC* titleText = StringLoader::LoadLC( R_QTN_CALE_TITLE_TODOS, iCoeEnv ); |
|
777 iSPUtils->UnderLineTitleText( EFalse ); |
|
778 iSPUtils->SetTitleText( titleText ); // ownership passed |
|
779 CleanupStack::Pop( titleText ); |
|
780 iSPUtils->RefreshStatusPane(); |
|
781 |
|
782 TRACE_EXIT_POINT; |
|
783 } |
|
784 |
|
785 // ---------------------------------------------------------------------------- |
|
786 // CCalenTodoView::CreateContainerImplL |
|
787 // making CCalenContainer. In this class, it is CCalenTodoContainer. |
|
788 // (other items were commented in a header). |
|
789 // ---------------------------------------------------------------------------- |
|
790 // |
|
791 CCalenContainer* CCalenTodoView::CreateContainerImplL() |
|
792 { |
|
793 TRACE_ENTRY_POINT; |
|
794 |
|
795 TRACE_EXIT_POINT; |
|
796 return new( ELeave )CCalenTodoContainer( this, |
|
797 iHighlightedRowNumber, |
|
798 iFirstEntryOnScreenIndex, |
|
799 iServices ); |
|
800 } |
|
801 |
|
802 |
|
803 // ---------------------------------------------------------------------------- |
|
804 // CCalenTodoView::UpdateCBAButtonsL |
|
805 // Update CBA buttons depending if we have empty view or not. |
|
806 // FIXME: Same function is also implemented in day view -> could |
|
807 // be virtual in CalenView. |
|
808 // (other items were commented in a header). |
|
809 // ---------------------------------------------------------------------------- |
|
810 void CCalenTodoView::UpdateCBAButtonsL() |
|
811 { |
|
812 TRACE_ENTRY_POINT; |
|
813 |
|
814 const TInt index( Container()->CurrentItemIndex() ); |
|
815 const TBool isSelected( Container()->ListBox()->View()->ItemIsSelected( index ) ); |
|
816 TInt cbaId, menuId; |
|
817 |
|
818 // select CBA |
|
819 #ifndef RD_CALEN_ENHANCED_MSK |
|
820 if( Container()->IsEmptyView() || isSelected ) |
|
821 #else |
|
822 if( Container()->IsEmptyView()) |
|
823 #endif //RD_CALEN_ENHANCED_MSK |
|
824 { |
|
825 // context sensitive CBA |
|
826 cbaId = R_CALEN_DAY_AND_TODO_VIEW_CONTEXT_MENU_CBA; |
|
827 } |
|
828 #ifdef RD_CALEN_ENHANCED_MSK |
|
829 else if(isSelected) |
|
830 { |
|
831 // focused toDo is marked |
|
832 cbaId = R_CALEN_TODO_VIEW_CONTEXT_MENU_CBA; |
|
833 } |
|
834 #endif //RD_CALEN_ENHANCED_MSK |
|
835 else // normal CBA |
|
836 { |
|
837 cbaId = R_CALEN_DAY_AND_TODO_VIEW_NORMAL_CBA; |
|
838 } |
|
839 |
|
840 // select menu |
|
841 if( isSelected ) |
|
842 { |
|
843 // context sensitice menu |
|
844 menuId = R_TODO_LIST_SELECTION_CONTEXT_MENUBAR; |
|
845 } |
|
846 else // normal menu |
|
847 { |
|
848 menuId = R_TODO_NEW_ENTRY_CONTEXT_MENUBAR; |
|
849 } |
|
850 |
|
851 SetCbaL( cbaId ); |
|
852 MenuBar()->SetContextMenuTitleResourceId( menuId ); |
|
853 |
|
854 TRACE_EXIT_POINT; |
|
855 } |
|
856 |
|
857 // ---------------------------------------------------------------------------- |
|
858 // CCalenTodoView::Id |
|
859 // From CAknView |
|
860 // Return the UID of the todo view |
|
861 // (other items were commented in a header) |
|
862 // ---------------------------------------------------------------------------- |
|
863 TUid CCalenTodoView::Id() const |
|
864 { |
|
865 TRACE_ENTRY_POINT; |
|
866 |
|
867 TRACE_EXIT_POINT; |
|
868 return KUidCalenTodoView; |
|
869 } |
|
870 |
|
871 // ---------------------------------------------------------------------------- |
|
872 // CCalenTodoView::ClearViewSpecificDataL |
|
873 // Clears any cached data for the specific view, e.g. currently |
|
874 // highlighted row, column, etc. |
|
875 // (other items were commented in a header) |
|
876 // ---------------------------------------------------------------------------- |
|
877 // |
|
878 void CCalenTodoView::ClearViewSpecificDataL() |
|
879 { |
|
880 TRACE_ENTRY_POINT; |
|
881 |
|
882 iFirstEntryOnScreenIndex = KErrNotFound; |
|
883 iHighlightedRowNumber = KErrNotFound; |
|
884 |
|
885 ClearMarkedToDoItems(); |
|
886 |
|
887 TRACE_EXIT_POINT; |
|
888 } |
|
889 |
|
890 // ---------------------------------------------------------------------------- |
|
891 // CCalenTodoView::IsViewSpecificDataNullL |
|
892 // From CCalenNativeView |
|
893 // Returns ETrue if the view specific data is null, EFalse otherwise. |
|
894 // (other items were commented in a header) |
|
895 // ---------------------------------------------------------------------------- |
|
896 // |
|
897 TBool CCalenTodoView::IsViewSpecificDataNullL() |
|
898 { |
|
899 TRACE_ENTRY_POINT; |
|
900 TRACE_EXIT_POINT; |
|
901 return ( iFirstEntryOnScreenIndex == KErrNotFound ) && |
|
902 ( iHighlightedRowNumber == KErrNotFound ); |
|
903 } |
|
904 |
|
905 // ---------------------------------------------------------------------------- |
|
906 // CCalenTodoView::CopyToCalendarsL |
|
907 // |
|
908 // (other items were commented in a header) |
|
909 // ---------------------------------------------------------------------------- |
|
910 // |
|
911 void CCalenTodoView::CopyToCalendarsL() |
|
912 { |
|
913 |
|
914 // Hide the toolbar before we display settings menu |
|
915 MCalenToolbar* toolbar = iServices.ToolbarOrNull(); |
|
916 if(toolbar) |
|
917 { |
|
918 toolbar->SetToolbarVisibilityL(EFalse); |
|
919 } |
|
920 |
|
921 MCalenContext& context = iServices.Context(); |
|
922 TCalLocalUid instanceId = context.InstanceId().iEntryLocalUid; |
|
923 |
|
924 CCalEntry* entry = iServices.EntryViewL(context.InstanceId().iColId)->FetchL(instanceId); |
|
925 CleanupStack::PushL(entry); |
|
926 |
|
927 RPointerArray<CCalEntry> entryArray; |
|
928 entryArray.Append(entry); |
|
929 |
|
930 |
|
931 // Launch the Calendar List Dialiog. |
|
932 CMultiCalUiDialog* multiCalUiDialog = CMultiCalUiDialog::NewLC(entryArray , ETrue ); |
|
933 TInt err = KErrNone; |
|
934 // Execute. |
|
935 TRAP( err,multiCalUiDialog->LaunchL() ); |
|
936 CleanupStack::PopAndDestroy( multiCalUiDialog ); |
|
937 |
|
938 // Unhide the toolbar when settings is closed |
|
939 if(toolbar) |
|
940 { |
|
941 toolbar->SetToolbarVisibilityL(ETrue); |
|
942 } |
|
943 |
|
944 CleanupStack::Pop(entry); |
|
945 entryArray.ResetAndDestroy(); |
|
946 |
|
947 BeginRepopulationL(); |
|
948 } |
|
949 |
|
950 |
|
951 // ---------------------------------------------------------------------------- |
|
952 // CCalenTodoView::ActiveStepL |
|
953 // From CCalenView |
|
954 // (other items were commented in a header) |
|
955 // ---------------------------------------------------------------------------- |
|
956 // |
|
957 CCalenView::TNextPopulationStep CCalenTodoView::ActiveStepL() |
|
958 { |
|
959 TRACE_ENTRY_POINT; |
|
960 |
|
961 switch( iPopulationStep ) |
|
962 { |
|
963 case ENothingDone: |
|
964 { |
|
965 iPopulationStep = ERequestedInstanceView; |
|
966 RArray<TInt> colIdArray; |
|
967 CCalenNativeView::GetActiveCollectionidsL( iServices, colIdArray ); |
|
968 |
|
969 if(colIdArray.Count() > 0) |
|
970 { |
|
971 if( !iServices.InstanceViewL(colIdArray) ) |
|
972 { |
|
973 TRACE_EXIT_POINT; |
|
974 return CCalenView::EWaitForInstanceView; |
|
975 } |
|
976 else |
|
977 { |
|
978 TRACE_EXIT_POINT; |
|
979 return CCalenView::EKeepGoing; |
|
980 } |
|
981 } |
|
982 else |
|
983 { |
|
984 if( !iServices.InstanceViewL() ) |
|
985 { |
|
986 TRACE_EXIT_POINT; |
|
987 return CCalenView::EWaitForInstanceView; |
|
988 } |
|
989 else |
|
990 { |
|
991 TRACE_EXIT_POINT; |
|
992 return CCalenView::EKeepGoing; |
|
993 } |
|
994 } |
|
995 colIdArray.Reset(); |
|
996 } |
|
997 // else fall through... |
|
998 case ERequestedInstanceView: |
|
999 { |
|
1000 MCalenContext& context = iServices.Context(); |
|
1001 if ( !(context.InstanceId() == TCalenInstanceId::NullInstanceId()) ) |
|
1002 { |
|
1003 iHighlightedRowNumber = Container()->Controller()->FindInstanceIndexL( context.InstanceId() ); |
|
1004 } |
|
1005 Container()->BeginPopulationWithInstanceViewL(); |
|
1006 iPopulationStep = EAddToStackNext; |
|
1007 TRACE_EXIT_POINT; |
|
1008 return CCalenView::EKeepGoing; |
|
1009 } |
|
1010 case EAddToStackNext: |
|
1011 default: |
|
1012 Container()->CompletePopulationL(); |
|
1013 iPopulationStep = EPopulationDone; |
|
1014 TRACE_EXIT_POINT; |
|
1015 return CCalenView::EDone; |
|
1016 } |
|
1017 } |
|
1018 |
|
1019 // ---------------------------------------------------------------------------- |
|
1020 // CCalenTodoView::CancelPopulation |
|
1021 // From CCalenView |
|
1022 // (other items were commented in a header) |
|
1023 // ---------------------------------------------------------------------------- |
|
1024 // |
|
1025 void CCalenTodoView::CancelPopulation() |
|
1026 { |
|
1027 TRACE_ENTRY_POINT; |
|
1028 |
|
1029 iPopulationStep = ENothingDone; |
|
1030 |
|
1031 TRACE_EXIT_POINT; |
|
1032 } |
|
1033 |
|
1034 // ---------------------------------------------------------------------------- |
|
1035 // CCalenTodoView::CyclePosition |
|
1036 // From CCalenView |
|
1037 // (other items were commented in a header) |
|
1038 // ---------------------------------------------------------------------------- |
|
1039 // |
|
1040 CCalenView::TCyclePosition CCalenTodoView::CyclePosition() const |
|
1041 { |
|
1042 TRACE_ENTRY_POINT; |
|
1043 TRACE_EXIT_POINT; |
|
1044 return CCalenView::EReplaceTodoView; |
|
1045 } |
|
1046 |
|
1047 // ---------------------------------------------------------------------------- |
|
1048 // CCalenTodoView::LocalisedViewNameL |
|
1049 // From CCalenView |
|
1050 // (other items were commented in a header) |
|
1051 // ---------------------------------------------------------------------------- |
|
1052 // |
|
1053 const TDesC& CCalenTodoView::LocalisedViewNameL( CCalenView::TViewName aViewName ) |
|
1054 { |
|
1055 TRACE_ENTRY_POINT; |
|
1056 |
|
1057 HBufC* ret = NULL; |
|
1058 |
|
1059 switch (aViewName) |
|
1060 { |
|
1061 case CCalenView::EMenuName: |
|
1062 if( !iMenuName ) |
|
1063 { |
|
1064 iMenuName = StringLoader::LoadL( R_CALEN_VIEW_TODO, iCoeEnv ); |
|
1065 } |
|
1066 ret = iMenuName; |
|
1067 break; |
|
1068 case CCalenView::ESettingsName: |
|
1069 if( !iSettingsName ) |
|
1070 { |
|
1071 iSettingsName = StringLoader::LoadL( |
|
1072 R_CALEN_QTN_DEFAULT_TODO_VIEW, iCoeEnv ); |
|
1073 } |
|
1074 ret = iSettingsName; |
|
1075 break; |
|
1076 default: |
|
1077 ASSERT( EFalse ); |
|
1078 break; |
|
1079 } |
|
1080 |
|
1081 TRACE_EXIT_POINT; |
|
1082 return *ret; |
|
1083 } |
|
1084 |
|
1085 // ---------------------------------------------------------------------------- |
|
1086 // CCalenTodoView::ViewIcon |
|
1087 // From CCalenView |
|
1088 // (other items were commented in a header) |
|
1089 // ---------------------------------------------------------------------------- |
|
1090 // |
|
1091 CGulIcon* CCalenTodoView::ViewIconL() const |
|
1092 { |
|
1093 TRACE_ENTRY_POINT; |
|
1094 |
|
1095 TRACE_EXIT_POINT; |
|
1096 |
|
1097 return iServices.GetIconL( MCalenServices::ECalenTodoViewIcon ); |
|
1098 } |
|
1099 |
|
1100 // ---------------------------------------------------------------------------- |
|
1101 // CCalenTodoView::NotifyMarkedEntryDeletedL() |
|
1102 // From CCalenView |
|
1103 // (other items were commented in a header) |
|
1104 // ---------------------------------------------------------------------------- |
|
1105 // |
|
1106 void CCalenTodoView::NotifyMarkedEntryDeletedL() |
|
1107 { |
|
1108 TRACE_ENTRY_POINT; |
|
1109 |
|
1110 // reset the marked items count |
|
1111 iCountOfSelectedItems = iServices.Context().MutlipleContextIdsCount(); |
|
1112 |
|
1113 ClearMarkedToDoItems(); |
|
1114 |
|
1115 iFirstEntryOnScreenIndex = KErrNotFound; |
|
1116 iHighlightedRowNumber = KErrNotFound; |
|
1117 |
|
1118 // DON'T issue MultipleEntriesDeleted notification immediately, which would result in |
|
1119 // alter the state, on recieving a another notification. It would fxxk up the state. |
|
1120 // Instead create a callback to issue new notification |
|
1121 if( !iCmdCallback ) |
|
1122 { |
|
1123 TCallBack callback( NotificationCallback, this ); |
|
1124 iCmdCallback = new ( ELeave ) CAsyncCallBack( callback, |
|
1125 CActive::EPriorityHigh ); |
|
1126 } |
|
1127 iCmdCallback->CallBack(); |
|
1128 |
|
1129 TRACE_EXIT_POINT; |
|
1130 } |
|
1131 |
|
1132 // ---------------------------------------------------------------------------- |
|
1133 // CCalenTodoView::NotificationCallback |
|
1134 // static callback function |
|
1135 // (other items were commented in a header) |
|
1136 // ---------------------------------------------------------------------------- |
|
1137 // |
|
1138 TInt CCalenTodoView::NotificationCallback( TAny* aCommandStruct ) |
|
1139 { |
|
1140 TRACE_ENTRY_POINT; |
|
1141 |
|
1142 CCalenTodoView* self = static_cast<CCalenTodoView*> ( aCommandStruct ); |
|
1143 PIM_TRAPD_HANDLE( self->DoNotificationCallbackL() ); |
|
1144 |
|
1145 TRACE_EXIT_POINT; |
|
1146 return EFalse; |
|
1147 } |
|
1148 |
|
1149 // ---------------------------------------------------------------------------- |
|
1150 // CCalenTodoView::DoNotificationCallbackL |
|
1151 // Leaving implementation of the callback function |
|
1152 // (other items were commented in a header) |
|
1153 // ---------------------------------------------------------------------------- |
|
1154 // |
|
1155 void CCalenTodoView::DoNotificationCallbackL() |
|
1156 { |
|
1157 TRACE_ENTRY_POINT; |
|
1158 |
|
1159 iServices.IssueNotificationL( ECalenNotifyMultipleEntriesDeleted ); |
|
1160 |
|
1161 TRACE_EXIT_POINT; |
|
1162 } |
|
1163 |
|
1164 // ---------------------------------------------------------------------------- |
|
1165 // CCalenTodoView::DeleteMarkedNotesL |
|
1166 // Delete marked notes. |
|
1167 // (other items were commented in a header). |
|
1168 // ---------------------------------------------------------------------------- |
|
1169 // |
|
1170 void CCalenTodoView::CreateMultiplecontextForMarkedItemsL(TInt aCommand) |
|
1171 { |
|
1172 TRACE_ENTRY_POINT; |
|
1173 |
|
1174 CEikColumnListBox* listbox = Container()->ListBox(); |
|
1175 |
|
1176 const CListBoxView::CSelectionIndexArray& selectedItems = |
|
1177 *( listbox->SelectionIndexes() ); |
|
1178 |
|
1179 TInt markCount( selectedItems.Count() ); |
|
1180 ASSERT( markCount ); |
|
1181 |
|
1182 iCountOfSelectedItems = markCount; // Save count of marked item |
|
1183 |
|
1184 CCalenTodoController* controller = Container()->Controller(); |
|
1185 iMarkedInstances.Reset(); |
|
1186 |
|
1187 switch (aCommand) |
|
1188 { |
|
1189 case ECalenMarkDone: |
|
1190 { |
|
1191 for (TInt i( 0 ); i < markCount; ++i) |
|
1192 { |
|
1193 TInt indexPos( selectedItems[ i ] ); |
|
1194 if( !( controller->IsCrossOutL( indexPos ) ) ) |
|
1195 { |
|
1196 iMarkedInstances.AppendL( |
|
1197 controller->InstanceL( indexPos ) ); |
|
1198 } |
|
1199 } |
|
1200 |
|
1201 if( !iMarkedInstances.Count() ) |
|
1202 { |
|
1203 TInt resID = R_CALEN_QTN_TODO_ALL_TASK_UPDATED; |
|
1204 HBufC* buf = |
|
1205 StringLoader::LoadLC( resID, CEikonEnv::Static() ); |
|
1206 CAknInformationNote* dialog = |
|
1207 new ( ELeave ) CAknInformationNote(); |
|
1208 |
|
1209 dialog->ExecuteLD( *buf ); |
|
1210 |
|
1211 CleanupStack::PopAndDestroy( buf ); |
|
1212 |
|
1213 // Remove all markings before completing the execution of cmd. |
|
1214 static_cast<CCalenTodoContainer*> ( iContainer )->MarkAllL( |
|
1215 EFalse ); |
|
1216 } |
|
1217 else |
|
1218 { |
|
1219 SetMultipleContexts(); |
|
1220 |
|
1221 iServices.IssueCommandL( ECalenMarkEntryAsDone ); |
|
1222 } |
|
1223 } |
|
1224 break; |
|
1225 |
|
1226 case ECalenMarkUnDone: |
|
1227 { |
|
1228 for (TInt i( 0 ); i < markCount; ++i) |
|
1229 { |
|
1230 TInt indexPos( selectedItems[ i ] ); |
|
1231 if( controller->IsCrossOutL( indexPos ) ) |
|
1232 { |
|
1233 iMarkedInstances.AppendL( |
|
1234 controller->InstanceL( indexPos ) ); |
|
1235 } |
|
1236 } |
|
1237 if( !iMarkedInstances.Count() ) |
|
1238 { |
|
1239 TInt resID = R_CALEN_QTN_TODO_ALL_TASK_UPDATED; |
|
1240 HBufC* buf = |
|
1241 StringLoader::LoadLC( resID, CEikonEnv::Static() ); |
|
1242 CAknInformationNote* dialog = |
|
1243 new ( ELeave ) CAknInformationNote(); |
|
1244 |
|
1245 dialog->ExecuteLD( *buf ); |
|
1246 |
|
1247 CleanupStack::PopAndDestroy( buf ); |
|
1248 |
|
1249 // Remove all markings before completing the execution of cmd. |
|
1250 static_cast<CCalenTodoContainer*> ( iContainer )->MarkAllL( |
|
1251 EFalse ); |
|
1252 } |
|
1253 else |
|
1254 { |
|
1255 SetMultipleContexts(); |
|
1256 |
|
1257 iServices.IssueCommandL( ECalenMarkEntryAsUnDone ); |
|
1258 } |
|
1259 } |
|
1260 break; |
|
1261 |
|
1262 case ECalenDeleteEntryWithoutQuery: |
|
1263 { |
|
1264 for( TInt i( 0 ); i < markCount; ++i ) |
|
1265 { |
|
1266 TInt indexPos( selectedItems[ i ] ); |
|
1267 iMarkedInstances.AppendL( controller->InstanceL( indexPos ) ); |
|
1268 } |
|
1269 |
|
1270 SetMultipleContexts(); |
|
1271 // Find index of the item to be focused after deletion. |
|
1272 FindFocusAfterDeletionL( selectedItems ); |
|
1273 |
|
1274 iServices.IssueCommandL( ECalenDeleteEntryWithoutQuery ); |
|
1275 } |
|
1276 break; |
|
1277 |
|
1278 default: |
|
1279 //no implemenatation as of now. |
|
1280 break; |
|
1281 } |
|
1282 |
|
1283 TRACE_EXIT_POINT; |
|
1284 } |
|
1285 |
|
1286 // ---------------------------------------------------------------------------- |
|
1287 // CCalenTodoView::SetMutlipleContexts |
|
1288 // Set Multiple contexts |
|
1289 // (other items were commented in a header) |
|
1290 // ---------------------------------------------------------------------------- |
|
1291 // |
|
1292 void CCalenTodoView::SetMultipleContexts() |
|
1293 { |
|
1294 TRACE_ENTRY_POINT; |
|
1295 |
|
1296 if( iMarkedInstances.Count() ) |
|
1297 { |
|
1298 RArray< TCalenInstanceId > multipleContextIds; |
|
1299 TCalenInstanceId instanceId; |
|
1300 for( TInt index = 0; index < iMarkedInstances.Count(); index++ ) |
|
1301 { |
|
1302 // pack instance ids of the marked instancesS |
|
1303 TRAPD( error, |
|
1304 instanceId = TCalenInstanceId::CreateL( *iMarkedInstances[ index ] ) ); |
|
1305 if( error != KErrNone ) |
|
1306 { |
|
1307 // Do nothing to avoid warning |
|
1308 } |
|
1309 multipleContextIds.Append( instanceId ); |
|
1310 } |
|
1311 |
|
1312 // set the multiple contexts |
|
1313 iServices.Context().SetMutlipleContextIds( multipleContextIds ); |
|
1314 } |
|
1315 |
|
1316 TRACE_EXIT_POINT; |
|
1317 } |
|
1318 |
|
1319 // ---------------------------------------------------------------------------- |
|
1320 // CCalenTodoView::SetMarkedToDoItems |
|
1321 // Set marked to do items |
|
1322 // ---------------------------------------------------------------------------- |
|
1323 // |
|
1324 void CCalenTodoView::SetMarkedToDoItems( |
|
1325 CListBoxView::CSelectionIndexArray* aMarkedTodoItems) |
|
1326 { |
|
1327 TRACE_ENTRY_POINT; |
|
1328 |
|
1329 if( iMarkedTodoItems ) |
|
1330 { |
|
1331 delete iMarkedTodoItems; |
|
1332 iMarkedTodoItems = NULL; |
|
1333 } |
|
1334 iMarkedTodoItems = aMarkedTodoItems; |
|
1335 |
|
1336 TRACE_EXIT_POINT; |
|
1337 } |
|
1338 |
|
1339 // ---------------------------------------------------------------------------- |
|
1340 // CCalenTodoView::GetMarkedToDoItems |
|
1341 // Get marked to do items |
|
1342 // ---------------------------------------------------------------------------- |
|
1343 // |
|
1344 CListBoxView::CSelectionIndexArray* CCalenTodoView::GetMarkedToDoItems() |
|
1345 { |
|
1346 TRACE_ENTRY_POINT; |
|
1347 |
|
1348 TRACE_EXIT_POINT; |
|
1349 |
|
1350 return iMarkedTodoItems; |
|
1351 } |
|
1352 |
|
1353 // ---------------------------------------------------------------------------- |
|
1354 // CCalenTodoView::ClearMarkedToDoItems |
|
1355 // Clear all marked todo items |
|
1356 // (other items were commented in a header) |
|
1357 // ---------------------------------------------------------------------------- |
|
1358 // |
|
1359 void CCalenTodoView::ClearMarkedToDoItems() |
|
1360 { |
|
1361 TRACE_ENTRY_POINT; |
|
1362 |
|
1363 if( iMarkedTodoItems ) |
|
1364 { |
|
1365 delete iMarkedTodoItems; |
|
1366 iMarkedTodoItems = NULL; |
|
1367 } |
|
1368 |
|
1369 TRACE_EXIT_POINT; |
|
1370 } |
|
1371 |
|
1372 // ---------------------------------------------------------------------------- |
|
1373 // CCalenTodoView::NotifyMarkedEntryCompletedL |
|
1374 // (other items were commented in a header) |
|
1375 // ---------------------------------------------------------------------------- |
|
1376 // |
|
1377 void CCalenTodoView::NotifyMarkedEntryCompletedL() |
|
1378 { |
|
1379 TRACE_ENTRY_POINT; |
|
1380 |
|
1381 Container()->MarkAllL( EFalse ); |
|
1382 |
|
1383 TRACE_EXIT_POINT; |
|
1384 } |
|
1385 |
|
1386 // ---------------------------------------------------------------------------- |
|
1387 // CCalenTodoView::CheckMarkedItemCompletedL |
|
1388 // (other items were commented in a header) |
|
1389 // ---------------------------------------------------------------------------- |
|
1390 // |
|
1391 TBool CCalenTodoView::CheckMarkedItemCompletedL() |
|
1392 { |
|
1393 TRACE_ENTRY_POINT; |
|
1394 |
|
1395 CEikColumnListBox* listbox = Container()->ListBox(); |
|
1396 const CListBoxView::CSelectionIndexArray& selectedItems = |
|
1397 *( listbox->SelectionIndexes() ); |
|
1398 return Container()->Controller()->IsCrossOutL( selectedItems[ 0 ] ); |
|
1399 |
|
1400 TRACE_EXIT_POINT; |
|
1401 } |
|
1402 |
|
1403 // End of File |