85 // Register the custom docml and css to provide our own style to the list items |
92 // Register the custom docml and css to provide our own style to the list items |
86 HbStyleLoader::registerFilePath(":/"); |
93 HbStyleLoader::registerFilePath(":/"); |
87 |
94 |
88 //Create the setting manager |
95 //Create the setting manager |
89 mSettingsManager = new XQSettingsManager(this); |
96 mSettingsManager = new XQSettingsManager(this); |
|
97 |
|
98 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_CALENAGENDAVIEWWIDGET_EXIT ); |
90 } |
99 } |
91 |
100 |
92 // ---------------------------------------------------------------------------- |
101 // ---------------------------------------------------------------------------- |
93 // CalenAgendaViewWidget::~CalenAgendaViewWidget |
102 // CalenAgendaViewWidget::~CalenAgendaViewWidget |
94 // Rest of the details are commented in the header |
103 // Rest of the details are commented in the header |
95 // ---------------------------------------------------------------------------- |
104 // ---------------------------------------------------------------------------- |
96 // |
105 // |
97 EXPORT_C CalenAgendaViewWidget::~CalenAgendaViewWidget() |
106 EXPORT_C CalenAgendaViewWidget::~CalenAgendaViewWidget() |
98 { |
107 { |
|
108 OstTraceFunctionEntry0( DUP1_CALENAGENDAVIEWWIDGET_CALENAGENDAVIEWWIDGET_ENTRY ); |
|
109 |
99 // Unload notes editor if loaded. |
110 // Unload notes editor if loaded. |
100 if (mNotesEditorPluginLoader) { |
111 if (mNotesEditorPluginLoader) { |
101 mNotesEditorPluginLoader->unload(); |
112 mNotesEditorPluginLoader->unload(); |
102 delete mNotesEditorPluginLoader; |
113 delete mNotesEditorPluginLoader; |
103 mNotesEditorPluginLoader = 0; |
114 mNotesEditorPluginLoader = 0; |
104 } |
115 } |
105 |
116 |
106 if (mListViewPrototype) { |
|
107 delete mListViewPrototype; |
|
108 mListViewPrototype = NULL; |
|
109 } |
|
110 if (mListModel) { |
|
111 // Do not delete the model since its owned by the view |
|
112 mListModel->clear(); |
|
113 } |
|
114 if (mSettingsManager) { |
117 if (mSettingsManager) { |
115 delete mSettingsManager; |
118 delete mSettingsManager; |
116 mSettingsManager = NULL; |
119 mSettingsManager = NULL; |
117 } |
120 } |
|
121 |
|
122 OstTraceFunctionExit0( DUP1_CALENAGENDAVIEWWIDGET_CALENAGENDAVIEWWIDGET_EXIT ); |
118 } |
123 } |
119 |
124 |
120 // ---------------------------------------------------------------------------- |
125 // ---------------------------------------------------------------------------- |
121 // CalenAgendaViewWidget::setupWidget |
126 // CalenAgendaViewWidget::setupWidget |
122 // Rest of the details are commented in the header |
127 // Rest of the details are commented in the header |
123 // ---------------------------------------------------------------------------- |
128 // ---------------------------------------------------------------------------- |
124 // |
129 // |
125 void CalenAgendaViewWidget::setupWidget(CalenAgendaView *view) |
130 void CalenAgendaViewWidget::setupWidget(CalenAgendaView *view) |
126 { |
131 { |
|
132 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_SETUPWIDGET_ENTRY ); |
|
133 |
127 // Store the view for future reference |
134 // Store the view for future reference |
128 mView = view; |
135 mView = view; |
129 |
136 |
130 if (!mDocLoader) { |
137 if (!mDocLoader) { |
131 // Nothing much can be done. Simply return |
138 // Nothing much can be done. Simply return |
|
139 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_SETUPWIDGET_EXIT ); |
132 return; |
140 return; |
133 } |
141 } |
134 |
142 |
135 // Initialize the child widgets |
143 // Initialize the child widgets |
136 initChildWidgets(); |
144 initChildWidgets(); |
|
145 OstTraceFunctionExit0( DUP1_CALENAGENDAVIEWWIDGET_SETUPWIDGET_EXIT ); |
137 } |
146 } |
138 |
147 |
139 // ---------------------------------------------------------------------------- |
148 // ---------------------------------------------------------------------------- |
140 // CalenAgendaViewWidget::showWidget |
149 // CalenAgendaViewWidget::showWidget |
141 // Rest of the details are commented in the header |
150 // Rest of the details are commented in the header |
142 // ---------------------------------------------------------------------------- |
151 // ---------------------------------------------------------------------------- |
143 // |
152 // |
144 void CalenAgendaViewWidget::showWidget() |
153 void CalenAgendaViewWidget::showWidget() |
145 { |
154 { |
|
155 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_SHOWWIDGET_ENTRY ); |
|
156 |
146 // Get the date for which this view has been launched |
157 // Get the date for which this view has been launched |
147 mDate = mServices.Context().focusDateAndTime(); |
158 mDate = mServices.Context().focusDateAndTime(); |
148 |
159 |
149 // Set the heading text |
160 // Set the heading text |
150 setHeadingText(); |
161 setHeadingText(); |
192 qFatal("calenagendaviewwidget.cpp : Unable to load non-empty list section"); |
203 qFatal("calenagendaviewwidget.cpp : Unable to load non-empty list section"); |
193 } |
204 } |
194 // Now populate the list with the events |
205 // Now populate the list with the events |
195 populateListWidget(); |
206 populateListWidget(); |
196 } |
207 } |
|
208 |
|
209 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_SHOWWIDGET_EXIT ); |
197 } |
210 } |
198 |
211 |
199 // ---------------------------------------------------------------------------- |
212 // ---------------------------------------------------------------------------- |
200 // CalenAgendaViewWidget::orientationChanged |
213 // CalenAgendaViewWidget::orientationChanged |
201 // Rest of the details are commented in the header |
214 // Rest of the details are commented in the header |
202 // ---------------------------------------------------------------------------- |
215 // ---------------------------------------------------------------------------- |
203 // |
216 // |
204 void CalenAgendaViewWidget::orientationChanged(Qt::Orientation orientation) |
217 void CalenAgendaViewWidget::orientationChanged(Qt::Orientation orientation) |
205 { |
218 { |
|
219 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_ORIENTATIONCHANGED_ENTRY ); |
|
220 |
206 // Load the appropriate section based on the number of events for the day |
221 // Load the appropriate section based on the number of events for the day |
207 if (0 == mInstanceArray.count()) { |
222 if (0 == mInstanceArray.count()) { |
208 // There are no entries for the day |
223 // There are no entries for the day |
209 // Load and show the empty list section |
224 // Load and show the empty list section |
210 bool loadSuccess = false; |
225 bool loadSuccess = false; |
236 if (!loadSuccess) { |
251 if (!loadSuccess) { |
237 qFatal("calenagendaviewwidget.cpp : Unable to load non-empty list section"); |
252 qFatal("calenagendaviewwidget.cpp : Unable to load non-empty list section"); |
238 } |
253 } |
239 handleListItemStretching(orientation); |
254 handleListItemStretching(orientation); |
240 } |
255 } |
|
256 |
|
257 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_ORIENTATIONCHANGED_EXIT ); |
241 } |
258 } |
242 |
259 |
243 // ---------------------------------------------------------------------------- |
260 // ---------------------------------------------------------------------------- |
244 // CalenAgendaViewWidget::handleLocaleChange |
261 // CalenAgendaViewWidget::handleLocaleChange |
245 // Rest of the details are commented in the header |
262 // Rest of the details are commented in the header |
246 // ---------------------------------------------------------------------------- |
263 // ---------------------------------------------------------------------------- |
247 // |
264 // |
248 void CalenAgendaViewWidget::handleLocaleChange() |
265 void CalenAgendaViewWidget::handleLocaleChange() |
249 { |
266 { |
250 |
267 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_HANDLELOCALECHANGE_ENTRY ); |
|
268 |
|
269 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_HANDLELOCALECHANGE_EXIT ); |
251 } |
270 } |
252 |
271 |
253 // ---------------------------------------------------------------------------- |
272 // ---------------------------------------------------------------------------- |
254 // CalenAgendaViewWidget::setContextFromHighlight |
273 // CalenAgendaViewWidget::setContextFromHighlight |
255 // Rest of the details are commented in the header |
274 // Rest of the details are commented in the header |
256 // ---------------------------------------------------------------------------- |
275 // ---------------------------------------------------------------------------- |
257 // |
276 // |
258 void CalenAgendaViewWidget::setContextFromHighlight(AgendaEntry entry) |
277 void CalenAgendaViewWidget::setContextFromHighlight(AgendaEntry entry) |
259 { |
278 { |
|
279 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_SETCONTEXTFROMHIGHLIGHT_ENTRY ); |
|
280 |
260 if (entry.isTimedEntry()) { |
281 if (entry.isTimedEntry()) { |
261 // Timed entry. |
282 // Timed entry. |
262 QDateTime start = entry.startTime(); |
283 QDateTime start = entry.startTime(); |
263 // start.setDate(mDate.date()); |
284 // start.setDate(mDate.date()); |
264 mServices.Context().setFocusDateAndTimeAndInstance(start, |
285 mServices.Context().setFocusDateAndTimeAndInstance(start, |
273 // Focus on the instance and set the focus time to the highlighted day. |
294 // Focus on the instance and set the focus time to the highlighted day. |
274 mServices.Context().setFocusDateAndTimeAndInstance(mDate, |
295 mServices.Context().setFocusDateAndTimeAndInstance(mDate, |
275 TCalenInstanceId::create(entry)); |
296 TCalenInstanceId::create(entry)); |
276 } |
297 } |
277 } |
298 } |
|
299 |
|
300 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_SETCONTEXTFROMHIGHLIGHT_EXIT ); |
278 } |
301 } |
279 |
302 |
280 // ---------------------------------------------------------------------------- |
303 // ---------------------------------------------------------------------------- |
281 // CalenAgendaViewWidget::initChildWidgets |
304 // CalenAgendaViewWidget::initChildWidgets |
282 // Rest of the details are commented in the header |
305 // Rest of the details are commented in the header |
283 // ---------------------------------------------------------------------------- |
306 // ---------------------------------------------------------------------------- |
284 // |
307 // |
285 void CalenAgendaViewWidget::initChildWidgets() |
308 void CalenAgendaViewWidget::initChildWidgets() |
286 { |
309 { |
|
310 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_INITCHILDWIDGETS_ENTRY ); |
|
311 |
287 // Get the pointer to the events list |
312 // Get the pointer to the events list |
288 mEventsList = static_cast<HbListView*> (mDocLoader->findWidget(CALEN_AGENDAVIEW_LISTWIDGET)); |
313 mEventsList = static_cast<HbListView*> (mDocLoader->findWidget(CALEN_AGENDAVIEW_LISTWIDGET)); |
289 if (!mEventsList) { |
314 if (!mEventsList) { |
290 qFatal("calenagendaviewwidget.cpp : Unable to find the events list"); |
315 qFatal("calenagendaviewwidget.cpp : Unable to find the events list"); |
291 } |
316 } |
315 HbWidget *headingPluginWidget = |
340 HbWidget *headingPluginWidget = |
316 qobject_cast<HbWidget*> (mDocLoader->findWidget(CALEN_AGENDAVIEW_HEADING_REGIONALPLUGIN_WIDGET)); |
341 qobject_cast<HbWidget*> (mDocLoader->findWidget(CALEN_AGENDAVIEW_HEADING_REGIONALPLUGIN_WIDGET)); |
317 |
342 |
318 mRegionalPluginLayout = static_cast<QGraphicsLinearLayout*>(headingPluginWidget->layout()); |
343 mRegionalPluginLayout = static_cast<QGraphicsLinearLayout*>(headingPluginWidget->layout()); |
319 |
344 |
|
345 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_INITCHILDWIDGETS_EXIT ); |
320 } |
346 } |
321 |
347 |
322 // ---------------------------------------------------------------------------- |
348 // ---------------------------------------------------------------------------- |
323 // CalenAgendaViewWidget::populateListWidget |
349 // CalenAgendaViewWidget::populateListWidget |
324 // Rest of the details are commented in the header |
350 // Rest of the details are commented in the header |
325 // ---------------------------------------------------------------------------- |
351 // ---------------------------------------------------------------------------- |
326 // |
352 // |
327 void CalenAgendaViewWidget::populateListWidget() |
353 void CalenAgendaViewWidget::populateListWidget() |
328 { |
354 { |
|
355 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_POPULATELISTWIDGET_ENTRY ); |
|
356 |
329 // Recycle the list items so that only needed rows |
357 // Recycle the list items so that only needed rows |
330 // are added or removed |
358 // are added or removed |
331 if (mInstanceArray.count() == 0) { |
359 if (mInstanceArray.count() == 0) { |
332 // Reset the list |
360 // Reset the list |
333 mEventsList->reset(); |
361 mEventsList->reset(); |
334 // Clear the model to ensure it does not have any old items |
362 // Clear the model to ensure it does not have any old items |
335 mListModel->clear(); |
363 mListModel->clear(); |
|
364 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_POPULATELISTWIDGET_EXIT ); |
336 return; |
365 return; |
337 } else if (mInstanceArray.count() > mListModel->rowCount()) { |
366 } else if (mInstanceArray.count() > mListModel->rowCount()) { |
338 // There are more events than the number of items |
367 // There are more events than the number of items |
339 // in the list. Add more rows |
368 // in the list. Add more rows |
340 mListModel->insertRows(0, mInstanceArray.count() - mListModel->rowCount()); |
369 mListModel->insertRows(0, mInstanceArray.count() - mListModel->rowCount()); |
359 int scrollToIndex = getIndexToScrollTo(); |
388 int scrollToIndex = getIndexToScrollTo(); |
360 if (mListModel->rowCount() > 0) { |
389 if (mListModel->rowCount() > 0) { |
361 // Scroll to the index only if index is valid |
390 // Scroll to the index only if index is valid |
362 mEventsList->scrollTo(mListModel->index(scrollToIndex, 0)); |
391 mEventsList->scrollTo(mListModel->index(scrollToIndex, 0)); |
363 } |
392 } |
|
393 |
|
394 OstTraceFunctionExit0( DUP1_CALENAGENDAVIEWWIDGET_POPULATELISTWIDGET_EXIT ); |
364 } |
395 } |
365 |
396 |
366 // ---------------------------------------------------------------------------- |
397 // ---------------------------------------------------------------------------- |
367 // CalenAgendaViewWidget::getInstanceList |
398 // CalenAgendaViewWidget::getInstanceList |
368 // Rest of the details are commented in the header |
399 // Rest of the details are commented in the header |
369 // ---------------------------------------------------------------------------- |
400 // ---------------------------------------------------------------------------- |
370 // |
401 // |
371 void CalenAgendaViewWidget::getInstanceList() |
402 void CalenAgendaViewWidget::getInstanceList() |
372 { |
403 { |
|
404 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_GETINSTANCELIST_ENTRY ); |
|
405 |
373 // Clear the previous instance list |
406 // Clear the previous instance list |
374 mInstanceArray.clear(); |
407 mInstanceArray.clear(); |
375 |
408 |
376 // Check if the date is valid |
409 // Check if the date is valid |
377 if (!CalenDateUtils::isValidDay(mDate)) { |
410 if (!CalenDateUtils::isValidDay(mDate)) { |
386 AgendaUtil::IncludeIncompletedTodos); |
419 AgendaUtil::IncludeIncompletedTodos); |
387 |
420 |
388 // Fetch the instance list from the agenda interface |
421 // Fetch the instance list from the agenda interface |
389 mInstanceArray = mServices.agendaInterface()->createEntryIdListForDay(mDate, filter); |
422 mInstanceArray = mServices.agendaInterface()->createEntryIdListForDay(mDate, filter); |
390 |
423 |
|
424 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_GETINSTANCELIST_EXIT ); |
391 } |
425 } |
392 |
426 |
393 // ---------------------------------------------------------------------------- |
427 // ---------------------------------------------------------------------------- |
394 // CalenAgendaViewWidget::setDateToLabel |
428 // CalenAgendaViewWidget::setDateToLabel |
395 // Rest of the details are commented in the header |
429 // Rest of the details are commented in the header |
396 // ---------------------------------------------------------------------------- |
430 // ---------------------------------------------------------------------------- |
397 // |
431 // |
398 void CalenAgendaViewWidget::setHeadingText() |
432 void CalenAgendaViewWidget::setHeadingText() |
399 { |
433 { |
|
434 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_SETHEADINGTEXT_ENTRY ); |
|
435 |
400 // Format the date as per the device locale settings |
436 // Format the date as per the device locale settings |
401 HbExtendedLocale systemLocale = HbExtendedLocale::system(); |
437 HbExtendedLocale systemLocale = HbExtendedLocale::system(); |
402 |
438 |
403 // Get localised name of the day from locale |
439 // Get localised name of the day from locale |
404 QString dayString = systemLocale.dayName(mDate.date().dayOfWeek()); |
440 QString dayString = systemLocale.dayName(mDate.date().dayOfWeek()); |
407 // Set the heading |
443 // Set the heading |
408 // Append the date which is formatted as per the locale |
444 // Append the date which is formatted as per the locale |
409 mHeadingLabel->setHeading(hbTrId( |
445 mHeadingLabel->setHeading(hbTrId( |
410 "txt_calendar_subhead_1_2").arg(dayString).arg( |
446 "txt_calendar_subhead_1_2").arg(dayString).arg( |
411 systemLocale.format(mDate.date(), r_qtn_date_usual_with_zero))); |
447 systemLocale.format(mDate.date(), r_qtn_date_usual_with_zero))); |
|
448 |
|
449 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_SETHEADINGTEXT_EXIT ); |
412 } |
450 } |
413 |
451 |
414 // ---------------------------------------------------------------------------- |
452 // ---------------------------------------------------------------------------- |
415 // CalenAgendaViewWidget::createListItem |
453 // CalenAgendaViewWidget::createListItem |
416 // Rest of the details are commented in the header |
454 // Rest of the details are commented in the header |
417 // ---------------------------------------------------------------------------- |
455 // ---------------------------------------------------------------------------- |
418 // |
456 // |
419 void CalenAgendaViewWidget::createListItem(int index, AgendaEntry entry) |
457 void CalenAgendaViewWidget::createListItem(int index, AgendaEntry entry) |
420 { |
458 { |
|
459 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_CREATELISTITEM_ENTRY ); |
|
460 |
421 if (index < 0 || entry.isNull()) { |
461 if (index < 0 || entry.isNull()) { |
422 // Not a valid index or entry. Dont do anything |
462 // Not a valid index or entry. Dont do anything |
|
463 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_CREATELISTITEM_EXIT ); |
423 return; |
464 return; |
424 } |
465 } |
425 // Check if the entry is a timed entry |
466 // Check if the entry is a timed entry |
426 // TODO: Right now, only appointment/meeting type is being handled |
467 // TODO: Right now, only appointment/meeting type is being handled |
427 // Handle other timed entry types like reminder etc |
468 // Handle other timed entry types like reminder etc |
429 // Get the text and icon data for the entry |
470 // Get the text and icon data for the entry |
430 addTimedEventToList(index, entry); |
471 addTimedEventToList(index, entry); |
431 } else { |
472 } else { |
432 addNonTimedEventToList(index, entry); |
473 addNonTimedEventToList(index, entry); |
433 } |
474 } |
|
475 |
|
476 OstTraceFunctionExit0( DUP1_CALENAGENDAVIEWWIDGET_CREATELISTITEM_EXIT ); |
434 } |
477 } |
435 |
478 |
436 // ---------------------------------------------------------------------------- |
479 // ---------------------------------------------------------------------------- |
437 // CalenAgendaViewWidget::addTimedEventToList |
480 // CalenAgendaViewWidget::addTimedEventToList |
438 // Rest of the details are commented in the header |
481 // Rest of the details are commented in the header |
439 // ---------------------------------------------------------------------------- |
482 // ---------------------------------------------------------------------------- |
440 // |
483 // |
441 void CalenAgendaViewWidget::addTimedEventToList(int index, AgendaEntry entry) |
484 void CalenAgendaViewWidget::addTimedEventToList(int index, AgendaEntry entry) |
442 { |
485 { |
|
486 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_ADDTIMEDEVENTTOLIST_ENTRY ); |
|
487 |
443 // Create text and icon list to set to the model |
488 // Create text and icon list to set to the model |
444 QVariantList textData; |
489 QVariantList textData; |
445 QVariantList iconData; |
490 QVariantList iconData; |
446 bool twoLines = false; |
491 bool twoLines = false; |
447 |
492 |
588 HbListViewItem *listViewItem = static_cast<HbListViewItem*> |
633 HbListViewItem *listViewItem = static_cast<HbListViewItem*> |
589 (mEventsList->itemByIndex(mListModel->index(index, 0))); |
634 (mEventsList->itemByIndex(mListModel->index(index, 0))); |
590 if (listViewItem) { |
635 if (listViewItem) { |
591 listViewItem->setProperty(stretchLayout, false); |
636 listViewItem->setProperty(stretchLayout, false); |
592 } |
637 } |
|
638 |
|
639 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_ADDTIMEDEVENTTOLIST_EXIT ); |
593 } |
640 } |
594 |
641 |
595 // ---------------------------------------------------------------------------- |
642 // ---------------------------------------------------------------------------- |
596 // CalenAgendaViewWidget::addNonTimedEventToList |
643 // CalenAgendaViewWidget::addNonTimedEventToList |
597 // Rest of the details are commented in the header |
644 // Rest of the details are commented in the header |
598 // ---------------------------------------------------------------------------- |
645 // ---------------------------------------------------------------------------- |
599 // |
646 // |
600 void CalenAgendaViewWidget::addNonTimedEventToList(int index, AgendaEntry entry) |
647 void CalenAgendaViewWidget::addNonTimedEventToList(int index, AgendaEntry entry) |
601 { |
648 { |
|
649 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_ADDNONTIMEDEVENTTOLIST_ENTRY ); |
|
650 |
602 QVariantList textData; |
651 QVariantList textData; |
603 QVariantList iconData; |
652 QVariantList iconData; |
604 |
653 |
605 /** |
654 /** |
606 * IMPORTANT NOTE: All the text and icon items must be |
655 * IMPORTANT NOTE: All the text and icon items must be |
751 listViewItem->setProperty(stretchLayout, true); |
800 listViewItem->setProperty(stretchLayout, true); |
752 } else { |
801 } else { |
753 listViewItem->setProperty(stretchLayout, false); |
802 listViewItem->setProperty(stretchLayout, false); |
754 } |
803 } |
755 } |
804 } |
|
805 |
|
806 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_ADDNONTIMEDEVENTTOLIST_EXIT ); |
756 } |
807 } |
757 |
808 |
758 // ---------------------------------------------------------------------------- |
809 // ---------------------------------------------------------------------------- |
759 // CalenAgendaViewWidget::handleListItemStretching |
810 // CalenAgendaViewWidget::handleListItemStretching |
760 // Rest of the details are commented in the header |
811 // Rest of the details are commented in the header |
761 // ---------------------------------------------------------------------------- |
812 // ---------------------------------------------------------------------------- |
762 // |
813 // |
763 void CalenAgendaViewWidget::handleListItemStretching(Qt::Orientation orientation) |
814 void CalenAgendaViewWidget::handleListItemStretching(Qt::Orientation orientation) |
764 { |
815 { |
|
816 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_HANDLELISTITEMSTRETCHING_ENTRY ); |
|
817 |
765 if (mInstanceArray.count() == 0) { |
818 if (mInstanceArray.count() == 0) { |
766 // Nothing much to do. Simply return |
819 // Nothing much to do. Simply return |
|
820 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_HANDLELISTITEMSTRETCHING_EXIT ); |
767 return; |
821 return; |
768 } |
822 } |
769 for(int index = 0; index < mInstanceArray.count() ; index ++) { |
823 for(int index = 0; index < mInstanceArray.count() ; index ++) { |
770 AgendaEntry entry = mInstanceArray[index]; |
824 AgendaEntry entry = mInstanceArray[index]; |
771 if (!entry.isNull()) { |
825 if (!entry.isNull()) { |
801 break; |
855 break; |
802 } |
856 } |
803 } |
857 } |
804 } |
858 } |
805 } |
859 } |
|
860 |
|
861 OstTraceFunctionExit0( DUP1_CALENAGENDAVIEWWIDGET_HANDLELISTITEMSTRETCHING_EXIT ); |
806 } |
862 } |
807 |
863 |
808 // ---------------------------------------------------------------------------- |
864 // ---------------------------------------------------------------------------- |
809 // CalenAgendaViewWidget::getIndexToScrollTo |
865 // CalenAgendaViewWidget::getIndexToScrollTo |
810 // Rest of the details are commented in the header |
866 // Rest of the details are commented in the header |
811 // ---------------------------------------------------------------------------- |
867 // ---------------------------------------------------------------------------- |
812 // |
868 // |
813 int CalenAgendaViewWidget::getIndexToScrollTo() |
869 int CalenAgendaViewWidget::getIndexToScrollTo() |
814 { |
870 { |
|
871 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_GETINDEXTOSCROLLTO_ENTRY ); |
|
872 |
815 int scrollIndex = 0; |
873 int scrollIndex = 0; |
816 TCalenInstanceId instanceId = mServices.Context().instanceId(); |
874 TCalenInstanceId instanceId = mServices.Context().instanceId(); |
817 if (instanceId == TCalenInstanceId::nullInstanceId()) { |
875 if (instanceId == TCalenInstanceId::nullInstanceId()) { |
818 // If the instance is not set, then scroll to zero index |
876 // If the instance is not set, then scroll to zero index |
|
877 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_GETINDEXTOSCROLLTO_EXIT ); |
819 return scrollIndex; |
878 return scrollIndex; |
820 } |
879 } |
821 |
880 |
822 for (int index = 0 ; index < mInstanceArray.count() ; index++) { |
881 for (int index = 0 ; index < mInstanceArray.count() ; index++) { |
823 AgendaEntry entry = mInstanceArray[index]; |
882 AgendaEntry entry = mInstanceArray[index]; |
825 // Match found. |
884 // Match found. |
826 scrollIndex = index; |
885 scrollIndex = index; |
827 break; |
886 break; |
828 } |
887 } |
829 } |
888 } |
|
889 OstTraceFunctionExit0( DUP1_CALENAGENDAVIEWWIDGET_GETINDEXTOSCROLLTO_EXIT ); |
830 return scrollIndex; |
890 return scrollIndex; |
831 } |
891 } |
832 |
892 |
833 // ---------------------------------------------------------------------------- |
893 // ---------------------------------------------------------------------------- |
834 // CalenAgendaViewWidget::showHideRegionalInformation |
894 // CalenAgendaViewWidget::showHideRegionalInformation |
835 // To Show and hide regional plugin label depends upon settings |
895 // To Show and hide regional plugin label depends upon settings |
836 // ---------------------------------------------------------------------------- |
896 // ---------------------------------------------------------------------------- |
837 // |
897 // |
838 void CalenAgendaViewWidget::showHideRegionalInformation() |
898 void CalenAgendaViewWidget::showHideRegionalInformation() |
839 { |
899 { |
|
900 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_SHOWHIDEREGIONALINFORMATION_ENTRY ); |
|
901 |
840 if (mView->pluginEnabled()) { |
902 if (mView->pluginEnabled()) { |
841 XQSettingsKey regionalInfo(XQSettingsKey::TargetCentralRepository, |
903 XQSettingsKey regionalInfo(XQSettingsKey::TargetCentralRepository, |
842 KCRUidCalendar, KCalendarShowRegionalInfo); |
904 KCRUidCalendar, KCalendarShowRegionalInfo); |
843 |
905 |
844 int showRegionalInfo = |
906 int showRegionalInfo = |
863 mRegionalPluginLayout->removeItem(mRegionalInfoGroupBox); |
925 mRegionalPluginLayout->removeItem(mRegionalInfoGroupBox); |
864 delete mRegionalInfoGroupBox; |
926 delete mRegionalInfoGroupBox; |
865 mRegionalInfoGroupBox = NULL; |
927 mRegionalInfoGroupBox = NULL; |
866 } |
928 } |
867 } |
929 } |
|
930 |
|
931 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_SHOWHIDEREGIONALINFORMATION_EXIT ); |
868 } |
932 } |
869 |
933 |
870 // ---------------------------------------------------------------------------- |
934 // ---------------------------------------------------------------------------- |
871 // CalenAgendaViewWidget::createNewEvent |
935 // CalenAgendaViewWidget::createNewEvent |
872 // Rest of the details are commented in the header |
936 // Rest of the details are commented in the header |
873 // ---------------------------------------------------------------------------- |
937 // ---------------------------------------------------------------------------- |
874 // |
938 // |
875 void CalenAgendaViewWidget::createNewEvent() |
939 void CalenAgendaViewWidget::createNewEvent() |
876 { |
940 { |
|
941 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_CREATENEWEVENT_ENTRY ); |
|
942 |
877 // Issue a command to launch editor to create |
943 // Issue a command to launch editor to create |
878 // a new event |
944 // a new event |
879 mServices.IssueCommandL(ECalenNewMeeting); |
945 mServices.IssueCommandL(ECalenNewMeeting); |
|
946 |
|
947 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_CREATENEWEVENT_EXIT ); |
880 } |
948 } |
881 |
949 |
882 // ---------------------------------------------------------------------------- |
950 // ---------------------------------------------------------------------------- |
883 // CalenAgendaViewWidget::editEntry |
951 // CalenAgendaViewWidget::editEntry |
884 // Rest of the details are commented in the header |
952 // Rest of the details are commented in the header |
885 // ---------------------------------------------------------------------------- |
953 // ---------------------------------------------------------------------------- |
886 // |
954 // |
887 void CalenAgendaViewWidget::editEntry() |
955 void CalenAgendaViewWidget::editEntry() |
888 { |
956 { |
|
957 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_EDITENTRY_ENTRY ); |
|
958 |
889 // Check if the selected index is valid |
959 // Check if the selected index is valid |
890 if (mSelectedIndex < 0 || mSelectedIndex > mInstanceArray.count()) { |
960 if (mSelectedIndex < 0 || mSelectedIndex > mInstanceArray.count()) { |
|
961 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_EDITENTRY_EXIT ); |
891 return; |
962 return; |
892 } |
963 } |
893 |
964 |
894 // Get the entry details first |
965 // Get the entry details first |
895 AgendaEntry entry = mInstanceArray[mSelectedIndex]; |
966 AgendaEntry entry = mInstanceArray[mSelectedIndex]; |
922 // Set the context |
993 // Set the context |
923 setContextFromHighlight(entry); |
994 setContextFromHighlight(entry); |
924 // Issue a command to launch the editor to edit this entry |
995 // Issue a command to launch the editor to edit this entry |
925 mServices.IssueCommandL(ECalenEditCurrentEntry); |
996 mServices.IssueCommandL(ECalenEditCurrentEntry); |
926 } |
997 } |
|
998 |
|
999 OstTraceFunctionExit0( DUP1_CALENAGENDAVIEWWIDGET_EDITENTRY_EXIT ); |
927 } |
1000 } |
928 |
1001 |
929 // ---------------------------------------------------------------------------- |
1002 // ---------------------------------------------------------------------------- |
930 // CalenAgendaViewWidget::viewEntry |
1003 // CalenAgendaViewWidget::viewEntry |
931 // Rest of the details are commented in the header |
1004 // Rest of the details are commented in the header |
932 // ---------------------------------------------------------------------------- |
1005 // ---------------------------------------------------------------------------- |
933 // |
1006 // |
934 void CalenAgendaViewWidget::viewEntry() |
1007 void CalenAgendaViewWidget::viewEntry() |
935 { |
1008 { |
|
1009 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_VIEWENTRY_ENTRY ); |
|
1010 |
936 // Get the entry details first |
1011 // Get the entry details first |
937 AgendaEntry entry = mInstanceArray[mSelectedIndex]; |
1012 AgendaEntry entry = mInstanceArray[mSelectedIndex]; |
938 |
1013 |
939 // Set the context |
1014 // Set the context |
940 setContextFromHighlight(entry); |
1015 setContextFromHighlight(entry); |
941 |
1016 |
942 // Launch the event viewer. |
1017 // Launch the event viewer. |
943 mServices.IssueCommandL(ECalenEventView); |
1018 mServices.IssueCommandL(ECalenEventView); |
|
1019 |
|
1020 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_VIEWENTRY_EXIT ); |
944 } |
1021 } |
945 |
1022 |
946 |
1023 |
947 // ---------------------------------------------------------------------------- |
1024 // ---------------------------------------------------------------------------- |
948 // CalenAgendaViewWidget::deleteEntry |
1025 // CalenAgendaViewWidget::deleteEntry |
949 // Rest of the details are commented in the header |
1026 // Rest of the details are commented in the header |
950 // ---------------------------------------------------------------------------- |
1027 // ---------------------------------------------------------------------------- |
951 // |
1028 // |
952 void CalenAgendaViewWidget::deleteEntry() |
1029 void CalenAgendaViewWidget::deleteEntry() |
953 { |
1030 { |
|
1031 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_DELETEENTRY_ENTRY ); |
|
1032 |
954 // Check if the selected index is valid |
1033 // Check if the selected index is valid |
955 if (mSelectedIndex < 0 || mSelectedIndex > mInstanceArray.count()) { |
1034 if (mSelectedIndex < 0 || mSelectedIndex > mInstanceArray.count()) { |
|
1035 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_DELETEENTRY_EXIT ); |
956 return; |
1036 return; |
957 } |
1037 } |
958 |
1038 |
959 // Get the entry details |
1039 // Get the entry details |
960 AgendaEntry entry = mInstanceArray[mSelectedIndex]; |
1040 AgendaEntry entry = mInstanceArray[mSelectedIndex]; |
961 // Set the context |
1041 // Set the context |
962 setContextFromHighlight(entry); |
1042 setContextFromHighlight(entry); |
963 // Issue the command to delete the entry |
1043 // Issue the command to delete the entry |
964 mServices.IssueCommandL(ECalenDeleteCurrentEntry); |
1044 mServices.IssueCommandL(ECalenDeleteCurrentEntry); |
|
1045 |
|
1046 OstTraceFunctionExit0( DUP1_CALENAGENDAVIEWWIDGET_DELETEENTRY_EXIT ); |
965 } |
1047 } |
966 |
1048 |
967 // ---------------------------------------------------------------------------- |
1049 // ---------------------------------------------------------------------------- |
968 // CalenAgendaViewWidget::markAsDone |
1050 // CalenAgendaViewWidget::markAsDone |
969 // Rest of the details are commented in the header |
1051 // Rest of the details are commented in the header |
970 // ---------------------------------------------------------------------------- |
1052 // ---------------------------------------------------------------------------- |
971 // |
1053 // |
972 void CalenAgendaViewWidget::markAsDone() |
1054 void CalenAgendaViewWidget::markAsDone() |
973 { |
1055 { |
|
1056 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_MARKASDONE_ENTRY ); |
|
1057 |
974 // Check if the selected index is valid |
1058 // Check if the selected index is valid |
975 if (mSelectedIndex < 0 || mSelectedIndex > mInstanceArray.count()) { |
1059 if (mSelectedIndex < 0 || mSelectedIndex > mInstanceArray.count()) { |
|
1060 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_MARKASDONE_EXIT ); |
976 return; |
1061 return; |
977 } |
1062 } |
978 |
1063 |
979 // Get the entry details |
1064 // Get the entry details |
980 AgendaEntry entry = mInstanceArray[mSelectedIndex]; |
1065 AgendaEntry entry = mInstanceArray[mSelectedIndex]; |
988 |
1073 |
989 // Update the entry in the database |
1074 // Update the entry in the database |
990 mServices.agendaInterface()->setCompleted(entry, true, mDate); |
1075 mServices.agendaInterface()->setCompleted(entry, true, mDate); |
991 mServices.IssueCommandL(ECalenStartActiveStep); |
1076 mServices.IssueCommandL(ECalenStartActiveStep); |
992 } |
1077 } |
|
1078 |
|
1079 OstTraceFunctionExit0( DUP1_CALENAGENDAVIEWWIDGET_MARKASDONE_EXIT ); |
993 } |
1080 } |
994 |
1081 |
995 // ---------------------------------------------------------------------------- |
1082 // ---------------------------------------------------------------------------- |
996 // CalenAgendaViewWidget::itemLongPressed |
1083 // CalenAgendaViewWidget::itemLongPressed |
997 // Rest of the details are commented in the header |
1084 // Rest of the details are commented in the header |
998 // ---------------------------------------------------------------------------- |
1085 // ---------------------------------------------------------------------------- |
999 // |
1086 // |
1000 void CalenAgendaViewWidget::itemLongPressed(HbAbstractViewItem* listViewItem, |
1087 void CalenAgendaViewWidget::itemLongPressed(HbAbstractViewItem* listViewItem, |
1001 const QPointF& coords) |
1088 const QPointF& coords) |
1002 { |
1089 { |
|
1090 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_ITEMLONGPRESSED_ENTRY ); |
|
1091 |
1003 mLongTapEventFlag = true; |
1092 mLongTapEventFlag = true; |
1004 // Update the selection index first |
1093 // Update the selection index first |
1005 mSelectedIndex = listViewItem->modelIndex().row(); |
1094 mSelectedIndex = listViewItem->modelIndex().row(); |
1006 |
1095 |
1007 if (mSelectedIndex < 0 || mSelectedIndex > mInstanceArray.count()) { |
1096 if (mSelectedIndex < 0 || mSelectedIndex > mInstanceArray.count()) { |
1008 // Invalid index |
1097 // Invalid index |
|
1098 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_ITEMLONGPRESSED_EXIT ); |
1009 return; |
1099 return; |
1010 } |
1100 } |
1011 |
1101 |
1012 AgendaEntry entry = mInstanceArray[mSelectedIndex]; |
1102 AgendaEntry entry = mInstanceArray[mSelectedIndex]; |
1013 |
1103 |
1041 connect(contextMenu, SIGNAL(aboutToClose()), |
1131 connect(contextMenu, SIGNAL(aboutToClose()), |
1042 this, |
1132 this, |
1043 SLOT(contextMenuClosed())); |
1133 SLOT(contextMenuClosed())); |
1044 |
1134 |
1045 contextMenu->open(this, SLOT(contextManuTriggered(HbAction *))); |
1135 contextMenu->open(this, SLOT(contextManuTriggered(HbAction *))); |
|
1136 |
|
1137 OstTraceFunctionExit0( DUP1_CALENAGENDAVIEWWIDGET_ITEMLONGPRESSED_EXIT ); |
1046 } |
1138 } |
1047 |
1139 |
1048 // ---------------------------------------------------------------------------- |
1140 // ---------------------------------------------------------------------------- |
1049 // CalenAgendaViewWidget::itemActivated |
1141 // CalenAgendaViewWidget::itemActivated |
1050 // Rest of the details are commented in the header |
1142 // Rest of the details are commented in the header |
1051 // ---------------------------------------------------------------------------- |
1143 // ---------------------------------------------------------------------------- |
1052 // |
1144 // |
1053 void CalenAgendaViewWidget::itemActivated(const QModelIndex &index) |
1145 void CalenAgendaViewWidget::itemActivated(const QModelIndex &index) |
1054 { |
1146 { |
|
1147 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_ITEMACTIVATED_ENTRY ); |
|
1148 |
1055 // Update the selection index first |
1149 // Update the selection index first |
1056 mSelectedIndex = index.row(); |
1150 mSelectedIndex = index.row(); |
1057 |
1151 |
1058 // Check if the selected index is valid |
1152 // Check if the selected index is valid |
1059 if (mSelectedIndex < 0 || mSelectedIndex > mInstanceArray.count()) { |
1153 if (mSelectedIndex < 0 || mSelectedIndex > mInstanceArray.count()) { |
|
1154 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_ITEMACTIVATED_EXIT ); |
1060 return; |
1155 return; |
1061 } |
1156 } |
1062 if( !mLongTapEventFlag ) { |
1157 if( !mLongTapEventFlag ) { |
1063 // Open the event for viewing |
1158 // Open the event for viewing |
1064 viewEntry(); |
1159 viewEntry(); |
1065 } |
1160 } |
|
1161 |
|
1162 OstTraceFunctionExit0( DUP1_CALENAGENDAVIEWWIDGET_ITEMACTIVATED_EXIT ); |
1066 } |
1163 } |
1067 |
1164 |
1068 // ---------------------------------------------------------------------------- |
1165 // ---------------------------------------------------------------------------- |
1069 // CalenAgendaViewWidget::itemActivated |
1166 // CalenAgendaViewWidget::itemActivated |
1070 // Rest of the details are commented in the header |
1167 // Rest of the details are commented in the header |
1071 // ---------------------------------------------------------------------------- |
1168 // ---------------------------------------------------------------------------- |
1072 // |
1169 // |
1073 void CalenAgendaViewWidget::noteEditingCompleted(bool status) |
1170 void CalenAgendaViewWidget::noteEditingCompleted(bool status) |
1074 { |
1171 { |
|
1172 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_NOTEEDITINGCOMPLETED_ENTRY ); |
|
1173 |
1075 // We need to refresh the list since user |
1174 // We need to refresh the list since user |
1076 // might have marked the to-do as complete or |
1175 // might have marked the to-do as complete or |
1077 // edited it or deleted it. So get the instance |
1176 // edited it or deleted it. So get the instance |
1078 // list again |
1177 // list again |
1079 if (status) { |
1178 if (status) { |
1080 mServices.IssueCommandL(ECalenStartActiveStep); |
1179 mServices.IssueCommandL(ECalenStartActiveStep); |
1081 } |
1180 } |
|
1181 |
|
1182 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_NOTEEDITINGCOMPLETED_EXIT ); |
1082 } |
1183 } |
1083 |
1184 |
1084 // ---------------------------------------------------------------------------- |
1185 // ---------------------------------------------------------------------------- |
1085 // CalenAgendaViewWidget::goToToday |
1186 // CalenAgendaViewWidget::goToToday |
1086 // Rest of the details are commented in the header |
1187 // Rest of the details are commented in the header |
1087 // ---------------------------------------------------------------------------- |
1188 // ---------------------------------------------------------------------------- |
1088 // |
1189 // |
1089 void CalenAgendaViewWidget::goToToday() |
1190 void CalenAgendaViewWidget::goToToday() |
1090 { |
1191 { |
|
1192 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_GOTOTODAY_ENTRY ); |
|
1193 |
1091 // First check if we are not already |
1194 // First check if we are not already |
1092 // showing today's agenda |
1195 // showing today's agenda |
1093 if (mDate == CalenDateUtils::today()) { |
1196 if (mDate == CalenDateUtils::today()) { |
|
1197 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_GOTOTODAY_EXIT ); |
1094 return; |
1198 return; |
1095 } |
1199 } |
1096 |
1200 |
1097 // Set the context for the current day |
1201 // Set the context for the current day |
1098 mServices.Context().setFocusDate(CalenDateUtils::today()); |
1202 mServices.Context().setFocusDate(CalenDateUtils::today()); |
1099 |
1203 |
1100 mView->refreshViewOnGoToDate(); |
1204 mView->refreshViewOnGoToDate(); |
|
1205 |
|
1206 OstTraceFunctionExit0( DUP1_CALENAGENDAVIEWWIDGET_GOTOTODAY_EXIT ); |
1101 } |
1207 } |
1102 |
1208 |
1103 // ---------------------------------------------------------------------------- |
1209 // ---------------------------------------------------------------------------- |
1104 // CalenAgendaViewWidget::contextMenuClosed |
1210 // CalenAgendaViewWidget::contextMenuClosed |
1105 // Rest of the details are commented in the header |
1211 // Rest of the details are commented in the header |
1106 // ---------------------------------------------------------------------------- |
1212 // ---------------------------------------------------------------------------- |
1107 // |
1213 // |
1108 void CalenAgendaViewWidget::contextMenuClosed() |
1214 void CalenAgendaViewWidget::contextMenuClosed() |
1109 { |
1215 { |
|
1216 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_CONTEXTMENUCLOSED_ENTRY ); |
|
1217 |
1110 mLongTapEventFlag = false; |
1218 mLongTapEventFlag = false; |
|
1219 |
|
1220 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_CONTEXTMENUCLOSED_EXIT ); |
1111 } |
1221 } |
1112 |
1222 |
1113 // ---------------------------------------------------------------------------- |
1223 // ---------------------------------------------------------------------------- |
1114 // CalenAgendaViewWidget::contextManuTriggered |
1224 // CalenAgendaViewWidget::contextManuTriggered |
1115 // Rest of the details are commented in the header |
1225 // Rest of the details are commented in the header |
1116 // ---------------------------------------------------------------------------- |
1226 // ---------------------------------------------------------------------------- |
1117 // |
1227 // |
1118 void CalenAgendaViewWidget::contextManuTriggered(HbAction *action) |
1228 void CalenAgendaViewWidget::contextManuTriggered(HbAction *action) |
1119 { |
1229 { |
|
1230 OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_CONTEXTMANUTRIGGERED_ENTRY ); |
|
1231 |
1120 if (action->text() == hbTrId("txt_common_menu_open")) { |
1232 if (action->text() == hbTrId("txt_common_menu_open")) { |
1121 viewEntry(); |
1233 viewEntry(); |
1122 } else if (action->text() == hbTrId("txt_calendar_menu_mark_as_done")) { |
1234 } else if (action->text() == hbTrId("txt_calendar_menu_mark_as_done")) { |
1123 markAsDone(); |
1235 markAsDone(); |
1124 } else if (action->text() == hbTrId("txt_common_menu_edit")) { |
1236 } else if (action->text() == hbTrId("txt_common_menu_edit")) { |