43 #include "notestodoeditor.h" |
43 #include "notestodoeditor.h" |
44 #include "notestodoeditorcustomitem.h" |
44 #include "notestodoeditorcustomitem.h" |
45 #include "noteseditor_p.h" |
45 #include "noteseditor_p.h" |
46 #include "noteseditorcommon.h" |
46 #include "noteseditorcommon.h" |
47 #include "noteseditordocloader.h" |
47 #include "noteseditordocloader.h" |
48 #include "agendaentry.h" |
48 #include <agendaentry.h> |
|
49 #include "OstTraceDefinitions.h" |
|
50 #ifdef OST_TRACE_COMPILER_IN_USE |
|
51 #include "notestodoeditorTraces.h" |
|
52 #endif |
|
53 |
49 |
54 |
50 /*! |
55 /*! |
51 \class NotesTodoEditor |
56 \class NotesTodoEditor |
52 |
57 |
53 This class is responsible for editing to-dos. This is friend of |
58 This class is responsible for editing to-dos. This is friend of |
99 NotesTodoEditorCustomItem *customItem = |
105 NotesTodoEditorCustomItem *customItem = |
100 new NotesTodoEditorCustomItem(mOwner, mDataForm); |
106 new NotesTodoEditorCustomItem(mOwner, mDataForm); |
101 QList <HbAbstractViewItem*> prototypes = mDataForm->itemPrototypes(); |
107 QList <HbAbstractViewItem*> prototypes = mDataForm->itemPrototypes(); |
102 prototypes.append(customItem); |
108 prototypes.append(customItem); |
103 mDataForm->setItemPrototypes(prototypes); |
109 mDataForm->setItemPrototypes(prototypes); |
|
110 OstTraceFunctionExit0( NOTESTODOEDITOR_NOTESTODOEDITOR_EXIT ); |
104 } |
111 } |
105 |
112 |
106 /*! |
113 /*! |
107 Destructor. |
114 Destructor. |
108 */ |
115 */ |
109 NotesTodoEditor::~NotesTodoEditor() |
116 NotesTodoEditor::~NotesTodoEditor() |
110 { |
117 { |
|
118 OstTraceFunctionEntry0( DUP1_NOTESTODOEDITOR_NOTESTODOEDITOR_ENTRY ); |
111 if (mFormModel) { |
119 if (mFormModel) { |
112 delete mFormModel; |
120 delete mFormModel; |
113 } |
121 } |
114 |
122 |
115 mDocLoader->reset(); |
123 mDocLoader->reset(); |
116 delete mDocLoader; |
124 delete mDocLoader; |
|
125 OstTraceFunctionExit0( DUP1_NOTESTODOEDITOR_NOTESTODOEDITOR_EXIT ); |
117 } |
126 } |
118 |
127 |
119 /*! |
128 /*! |
120 Updates the summary text, as entered by the user. |
129 Updates the summary text, as entered by the user. |
121 */ |
130 */ |
122 void NotesTodoEditor::updateSummaryText(const QString &text) |
131 void NotesTodoEditor::updateSummaryText(const QString &text) |
123 { |
132 { |
|
133 OstTraceFunctionEntry0( NOTESTODOEDITOR_UPDATESUMMARYTEXT_ENTRY ); |
124 mOwner->mModifiedNote.setSummary(text); |
134 mOwner->mModifiedNote.setSummary(text); |
125 addDiscardChangesAction(); |
135 addDiscardChangesAction(); |
|
136 OstTraceFunctionExit0( NOTESTODOEDITOR_UPDATESUMMARYTEXT_EXIT ); |
126 } |
137 } |
127 |
138 |
128 /*! |
139 /*! |
129 updates the priority of the to-do entry |
140 updates the priority of the to-do entry |
130 |
141 |
131 \param index The index of the priority item selected by the user |
142 \param index The index of the priority item selected by the user |
132 */ |
143 */ |
133 void NotesTodoEditor::updatePriority(int index) |
144 void NotesTodoEditor::updatePriority(int index) |
134 { |
145 { |
|
146 OstTraceFunctionEntry0( NOTESTODOEDITOR_UPDATEPRIORITY_ENTRY ); |
135 mOwner->mModifiedNote.setPriority(index + 1); |
147 mOwner->mModifiedNote.setPriority(index + 1); |
136 addDiscardChangesAction(); |
148 addDiscardChangesAction(); |
|
149 OstTraceFunctionExit0( NOTESTODOEDITOR_UPDATEPRIORITY_EXIT ); |
137 } |
150 } |
138 |
151 |
139 /*! |
152 /*! |
140 Updates the description of the to-do entry. |
153 Updates the description of the to-do entry. |
141 |
154 |
142 \param text The description entered by the user. |
155 \param text The description entered by the user. |
143 */ |
156 */ |
144 void NotesTodoEditor::updateDescription(const QString &text) |
157 void NotesTodoEditor::updateDescription(const QString &text) |
145 { |
158 { |
|
159 OstTraceFunctionEntry0( NOTESTODOEDITOR_UPDATEDESCRIPTION_ENTRY ); |
146 mOwner->mModifiedNote.setDescription(text); |
160 mOwner->mModifiedNote.setDescription(text); |
147 addDiscardChangesAction(); |
161 addDiscardChangesAction(); |
|
162 OstTraceFunctionExit0( NOTESTODOEDITOR_UPDATEDESCRIPTION_EXIT ); |
148 } |
163 } |
149 |
164 |
150 /*! |
165 /*! |
151 Check for the reminder field entered by the user. |
166 Check for the reminder field entered by the user. |
152 If reminder is not enabled it simply returns with true value. |
167 If reminder is not enabled it simply returns with true value. |
153 |
168 |
154 \return bool Sends the value after validation of alarm vlaue. |
169 \return bool Sends the value after validation of alarm vlaue. |
155 */ |
170 */ |
156 bool NotesTodoEditor::validAlarmSet() |
171 bool NotesTodoEditor::validAlarmSet() |
157 { |
172 { |
|
173 OstTraceFunctionEntry0( NOTESTODOEDITOR_VALIDALARMSET_ENTRY ); |
158 bool alarmSet(true); |
174 bool alarmSet(true); |
159 |
175 |
160 // Sanity Check. |
176 // Sanity Check. |
161 if (mReminderItem) { |
177 if (mReminderItem) { |
162 // Get the reminder dateandtime set by user from date and time picker. |
178 // Get the reminder dateandtime set by user from date and time picker. |
227 alarmSet = true; |
245 alarmSet = true; |
228 } |
246 } |
229 } else { |
247 } else { |
230 AgendaAlarm dummyAlarm; |
248 AgendaAlarm dummyAlarm; |
231 mOwner->mModifiedNote.setAlarm(dummyAlarm); |
249 mOwner->mModifiedNote.setAlarm(dummyAlarm); |
|
250 OstTraceFunctionExit0( DUP2_NOTESTODOEDITOR_VALIDALARMSET_EXIT ); |
232 return alarmSet; |
251 return alarmSet; |
233 } |
252 } |
|
253 OstTraceFunctionExit0( DUP3_NOTESTODOEDITOR_VALIDALARMSET_EXIT ); |
234 return alarmSet; |
254 return alarmSet; |
235 } |
255 } |
236 |
256 |
237 /*! |
257 /*! |
238 Adds discard changes option item to the menu |
258 Adds discard changes option item to the menu |
239 */ |
259 */ |
240 void NotesTodoEditor::addDiscardChangesAction() |
260 void NotesTodoEditor::addDiscardChangesAction() |
241 { |
261 { |
|
262 OstTraceFunctionEntry0( NOTESTODOEDITOR_ADDDISCARDCHANGESACTION_ENTRY ); |
242 if(!mDiscardChangesActive) { |
263 if(!mDiscardChangesActive) { |
243 mDiscardAction = new HbAction(hbTrId("txt_notes_opt_discard_changes")); |
264 mDiscardAction = new HbAction(hbTrId("txt_notes_opt_discard_changes")); |
244 |
265 |
245 mEditor->menu()->addAction(mDiscardAction); |
266 mEditor->menu()->addAction(mDiscardAction); |
246 |
267 |
248 mDiscardAction, SIGNAL(triggered()), |
269 mDiscardAction, SIGNAL(triggered()), |
249 this, SLOT(handleDiscardChangesAction())); |
270 this, SLOT(handleDiscardChangesAction())); |
250 |
271 |
251 mDiscardChangesActive = true; |
272 mDiscardChangesActive = true; |
252 } |
273 } |
|
274 OstTraceFunctionExit0( NOTESTODOEDITOR_ADDDISCARDCHANGESACTION_EXIT ); |
253 } |
275 } |
254 |
276 |
255 /*! |
277 /*! |
256 Displays the to-do editor and populates the data with the given AgendaEntry. |
278 Displays the to-do editor and populates the data with the given AgendaEntry. |
257 |
279 |
258 \param entry The entry from which data has to be read. |
280 \param entry The entry from which data has to be read. |
259 */ |
281 */ |
260 void NotesTodoEditor::execute(AgendaEntry entry) |
282 void NotesTodoEditor::execute(AgendaEntry entry) |
261 { |
283 { |
262 Q_UNUSED(entry) |
284 OstTraceFunctionEntry0( NOTESTODOEDITOR_EXECUTE_ENTRY ); |
|
285 |
263 |
286 |
264 HbMenu *viewMenu = mEditor->menu(); |
287 HbMenu *viewMenu = mEditor->menu(); |
265 if (!mDescriptionAction) { |
288 if (!mDescriptionAction) { |
266 mDescriptionAction = new HbAction; |
289 mDescriptionAction = new HbAction; |
267 } |
290 } |
300 connect( |
323 connect( |
301 action, SIGNAL(triggered()), |
324 action, SIGNAL(triggered()), |
302 this, SLOT(saveTodo())); |
325 this, SLOT(saveTodo())); |
303 window->addView(mEditor); |
326 window->addView(mEditor); |
304 window->setCurrentView(mEditor); |
327 window->setCurrentView(mEditor); |
|
328 OstTraceFunctionExit0( NOTESTODOEDITOR_EXECUTE_EXIT ); |
305 } |
329 } |
306 |
330 |
307 /*! |
331 /*! |
308 Displays the to-do editor for creating new to-do entry |
332 Displays the to-do editor for creating new to-do entry |
309 |
333 |
310 \param entry The entry from which data has to be read. |
334 \param entry The entry from which data has to be read. |
311 */ |
335 */ |
312 void NotesTodoEditor::create(AgendaEntry entry) |
336 void NotesTodoEditor::create(AgendaEntry entry) |
313 { |
337 { |
|
338 OstTraceFunctionEntry0( NOTESTODOEDITOR_CREATE_ENTRY ); |
314 Q_UNUSED(entry) |
339 Q_UNUSED(entry) |
315 |
340 |
|
341 OstTraceFunctionExit0( NOTESTODOEDITOR_CREATE_EXIT ); |
316 } |
342 } |
317 /*! |
343 /*! |
318 Initializes the data form model. |
344 Initializes the data form model. |
319 */ |
345 */ |
320 void NotesTodoEditor::initFormModel() |
346 void NotesTodoEditor::initFormModel() |
321 { |
347 { |
|
348 OstTraceFunctionEntry0( NOTESTODOEDITOR_INITFORMMODEL_ENTRY ); |
322 // Delete the model if already there. |
349 // Delete the model if already there. |
323 if (mFormModel) { |
350 if (mFormModel) { |
324 delete mFormModel; |
351 delete mFormModel; |
325 mDataForm->setModel(0); |
352 mDataForm->setModel(0); |
326 } |
353 } |
338 } |
365 } |
339 insertPriorityItem(); |
366 insertPriorityItem(); |
340 |
367 |
341 // Set the model to the form. |
368 // Set the model to the form. |
342 mDataForm->setModel(mFormModel); |
369 mDataForm->setModel(mFormModel); |
|
370 OstTraceFunctionExit0( NOTESTODOEDITOR_INITFORMMODEL_EXIT ); |
343 } |
371 } |
344 |
372 |
345 /*! |
373 /*! |
346 Inserts the subject item into the model. |
374 Inserts the subject item into the model. |
347 */ |
375 */ |
348 void NotesTodoEditor::insertSubjectItem() |
376 void NotesTodoEditor::insertSubjectItem() |
349 { |
377 { |
|
378 OstTraceFunctionEntry0( NOTESTODOEDITOR_INSERTSUBJECTITEM_ENTRY ); |
350 mSubjectItem = mFormModel->appendDataFormItem( |
379 mSubjectItem = mFormModel->appendDataFormItem( |
351 HbDataFormModelItem::TextItem, |
380 HbDataFormModelItem::TextItem, |
352 QString(""), mFormModel->invisibleRootItem()); |
381 QString(""), mFormModel->invisibleRootItem()); |
353 |
382 |
354 mSubjectItem->setContentWidgetData("text", mOwner->mModifiedNote.summary()); |
383 mSubjectItem->setContentWidgetData("text", mOwner->mModifiedNote.summary()); |
355 mSubjectItem->setContentWidgetData("objectName", "subjectItem"); |
384 mSubjectItem->setContentWidgetData("objectName", "subjectItem"); |
356 |
385 |
357 mDataForm->addConnection( |
386 mDataForm->addConnection( |
358 mSubjectItem , SIGNAL(textChanged(const QString &)), |
387 mSubjectItem , SIGNAL(textChanged(const QString &)), |
359 this, SLOT(updateSummaryText(const QString &))); |
388 this, SLOT(updateSummaryText(const QString &))); |
|
389 OstTraceFunctionExit0( NOTESTODOEDITOR_INSERTSUBJECTITEM_EXIT ); |
360 } |
390 } |
361 |
391 |
362 /*! |
392 /*! |
363 Inserts the due date item into the model. |
393 Inserts the due date item into the model. |
364 */ |
394 */ |
365 void NotesTodoEditor::insertDueDateItem() |
395 void NotesTodoEditor::insertDueDateItem() |
366 { |
396 { |
|
397 OstTraceFunctionEntry0( NOTESTODOEDITOR_INSERTDUEDATEITEM_ENTRY ); |
367 HbDataFormModelItem::DataItemType itemType = |
398 HbDataFormModelItem::DataItemType itemType = |
368 static_cast<HbDataFormModelItem::DataItemType> |
399 static_cast<HbDataFormModelItem::DataItemType> |
369 (HbDataFormModelItem::CustomItemBase + DueDateItemOffset); |
400 (HbDataFormModelItem::CustomItemBase + DueDateItemOffset); |
370 |
401 |
371 mDueDateItem = mFormModel->appendDataFormItem( |
402 mDueDateItem = mFormModel->appendDataFormItem( |
384 mOwner->mModifiedNote.endTime().date().toString( |
415 mOwner->mModifiedNote.endTime().date().toString( |
385 mOwner->dateFormatString()); |
416 mOwner->dateFormatString()); |
386 } |
417 } |
387 mDueDateItem->setContentWidgetData("text",dueDateText); |
418 mDueDateItem->setContentWidgetData("text",dueDateText); |
388 |
419 |
|
420 OstTraceFunctionExit0( NOTESTODOEDITOR_INSERTDUEDATEITEM_EXIT ); |
389 } |
421 } |
390 /*! |
422 /*! |
391 Inserts the reminder enabler item into the model. |
423 Inserts the reminder enabler item into the model. |
392 */ |
424 */ |
393 void NotesTodoEditor::insertReminderToggle() |
425 void NotesTodoEditor::insertReminderToggle() |
394 { |
426 { |
|
427 OstTraceFunctionEntry0( NOTESTODOEDITOR_INSERTREMINDERTOGGLE_ENTRY ); |
395 mReminderEnabler = mFormModel->appendDataFormItem( |
428 mReminderEnabler = mFormModel->appendDataFormItem( |
396 HbDataFormModelItem::CheckBoxItem, |
429 HbDataFormModelItem::CheckBoxItem, |
397 tr(""), mFormModel->invisibleRootItem()); |
430 tr(""), mFormModel->invisibleRootItem()); |
398 |
431 |
399 mReminderEnabler->setContentWidgetData( |
432 mReminderEnabler->setContentWidgetData( |
406 } |
439 } |
407 mReminderEnabler->setContentWidgetData("objectName", "remainderToggleItem"); |
440 mReminderEnabler->setContentWidgetData("objectName", "remainderToggleItem"); |
408 mDataForm->addConnection( |
441 mDataForm->addConnection( |
409 mReminderEnabler, SIGNAL(stateChanged(int)), |
442 mReminderEnabler, SIGNAL(stateChanged(int)), |
410 this, SLOT(handleReminderItem(int))); |
443 this, SLOT(handleReminderItem(int))); |
|
444 OstTraceFunctionExit0( NOTESTODOEDITOR_INSERTREMINDERTOGGLE_EXIT ); |
411 } |
445 } |
412 |
446 |
413 /*! |
447 /*! |
414 Handle insertion/deletion of reminder item in todo editor. |
448 Handle insertion/deletion of reminder item in todo editor. |
415 */ |
449 */ |
416 void NotesTodoEditor::handleReminderItem(int checked) |
450 void NotesTodoEditor::handleReminderItem(int checked) |
417 { |
451 { |
|
452 OstTraceFunctionEntry0( NOTESTODOEDITOR_HANDLEREMINDERITEM_ENTRY ); |
418 if (Qt::Checked == checked) { |
453 if (Qt::Checked == checked) { |
419 HbDataFormModelItem::DataItemType itemType = |
454 HbDataFormModelItem::DataItemType itemType = |
420 static_cast<HbDataFormModelItem::DataItemType> |
455 static_cast<HbDataFormModelItem::DataItemType> |
421 (HbDataFormModelItem::CustomItemBase + AlarmDateItemOffset); |
456 (HbDataFormModelItem::CustomItemBase + AlarmDateItemOffset); |
422 |
457 |
482 mOwner->mModifiedNote.setAlarm(noAlarm); |
517 mOwner->mModifiedNote.setAlarm(noAlarm); |
483 |
518 |
484 mReminderItem = 0; |
519 mReminderItem = 0; |
485 } |
520 } |
486 } |
521 } |
|
522 OstTraceFunctionExit0( NOTESTODOEDITOR_HANDLEREMINDERITEM_EXIT ); |
487 } |
523 } |
488 |
524 |
489 /*! |
525 /*! |
490 Inserts the priority item in to the model |
526 Inserts the priority item in to the model |
491 */ |
527 */ |
492 void NotesTodoEditor::insertPriorityItem() |
528 void NotesTodoEditor::insertPriorityItem() |
493 { |
529 { |
|
530 OstTraceFunctionEntry0( NOTESTODOEDITOR_INSERTPRIORITYITEM_ENTRY ); |
494 mPriorityItem = mFormModel->appendDataFormItem( |
531 mPriorityItem = mFormModel->appendDataFormItem( |
495 HbDataFormModelItem::ComboBoxItem, |
532 HbDataFormModelItem::ComboBoxItem, |
496 hbTrId("txt_notes_setlabel_priority"), |
533 hbTrId("txt_notes_setlabel_priority"), |
497 mFormModel->invisibleRootItem()); |
534 mFormModel->invisibleRootItem()); |
498 |
535 |
511 QString("currentIndex"), priority-1); |
548 QString("currentIndex"), priority-1); |
512 |
549 |
513 mDataForm->addConnection( |
550 mDataForm->addConnection( |
514 mPriorityItem, SIGNAL(currentIndexChanged(int)), |
551 mPriorityItem, SIGNAL(currentIndexChanged(int)), |
515 this, SLOT(updatePriority(int))); |
552 this, SLOT(updatePriority(int))); |
|
553 OstTraceFunctionExit0( NOTESTODOEDITOR_INSERTPRIORITYITEM_EXIT ); |
516 } |
554 } |
517 |
555 |
518 /*! |
556 /*! |
519 Inserts the description item to the model |
557 Inserts the description item to the model |
520 */ |
558 */ |
521 void NotesTodoEditor::insertDescriptionItem() |
559 void NotesTodoEditor::insertDescriptionItem() |
522 { |
560 { |
|
561 OstTraceFunctionEntry0( NOTESTODOEDITOR_INSERTDESCRIPTIONITEM_ENTRY ); |
523 mDescriptionItem = mFormModel->appendDataFormItem( |
562 mDescriptionItem = mFormModel->appendDataFormItem( |
524 HbDataFormModelItem::TextItem, |
563 HbDataFormModelItem::TextItem, |
525 hbTrId("txt_notes_formlabel_val_description"), |
564 hbTrId("txt_notes_formlabel_val_description"), |
526 mFormModel->invisibleRootItem()); |
565 mFormModel->invisibleRootItem()); |
527 |
566 |
532 QString("text"), mOwner->mModifiedNote.description()); |
571 QString("text"), mOwner->mModifiedNote.description()); |
533 |
572 |
534 mDataForm->addConnection( |
573 mDataForm->addConnection( |
535 mDescriptionItem, SIGNAL(textChanged(const QString)), |
574 mDescriptionItem, SIGNAL(textChanged(const QString)), |
536 this, SLOT(updateDescription(const QString))); |
575 this, SLOT(updateDescription(const QString))); |
|
576 OstTraceFunctionExit0( NOTESTODOEDITOR_INSERTDESCRIPTIONITEM_EXIT ); |
537 } |
577 } |
538 |
578 |
539 /*! |
579 /*! |
540 Inserts actions to the view menu. |
580 Inserts actions to the view menu. |
541 */ |
581 */ |
542 void NotesTodoEditor::addMenu() |
582 void NotesTodoEditor::addMenu() |
543 { |
583 { |
|
584 OstTraceFunctionEntry0( NOTESTODOEDITOR_ADDMENU_ENTRY ); |
544 mDeleteAction = mEditor->menu()->addAction(hbTrId("txt_common_opt_delete")); |
585 mDeleteAction = mEditor->menu()->addAction(hbTrId("txt_common_opt_delete")); |
545 connect( |
586 connect( |
546 mDeleteAction, SIGNAL(triggered()), |
587 mDeleteAction, SIGNAL(triggered()), |
547 this, SLOT(handleDeleteAction())); |
588 this, SLOT(handleDeleteAction())); |
|
589 OstTraceFunctionExit0( NOTESTODOEDITOR_ADDMENU_EXIT ); |
548 } |
590 } |
549 |
591 |
550 /*! |
592 /*! |
551 Saves a to-do entry |
593 Saves a to-do entry |
552 */ |
594 */ |
553 void NotesTodoEditor::saveTodo() |
595 void NotesTodoEditor::saveTodo() |
554 { |
596 { |
|
597 OstTraceFunctionEntry0( NOTESTODOEDITOR_SAVETODO_ENTRY ); |
555 // Here we check if the user has set the appropriate alarm time. |
598 // Here we check if the user has set the appropriate alarm time. |
556 // And save only if its fine to do so. Else we note a discrete notification |
599 // And save only if its fine to do so. Else we note a discrete notification |
557 // asking the user to check for the alarm time. |
600 // asking the user to check for the alarm time. |
558 bool status = false; |
601 bool status = false; |
559 if (validAlarmSet()) { |
602 if (validAlarmSet()) { |
569 action, SIGNAL(triggered()), |
612 action, SIGNAL(triggered()), |
570 this, SLOT(saveTodo())); |
613 this, SLOT(saveTodo())); |
571 |
614 |
572 mOwner->editingCompleted(status); |
615 mOwner->editingCompleted(status); |
573 } |
616 } |
|
617 OstTraceFunctionExit0( NOTESTODOEDITOR_SAVETODO_EXIT ); |
574 } |
618 } |
575 |
619 |
576 /*! |
620 /*! |
577 Closes the to-do editor and does nothing else. It removes the view off the |
621 Closes the to-do editor and does nothing else. It removes the view off the |
578 main window's list of views. |
622 main window's list of views. |
579 */ |
623 */ |
580 void NotesTodoEditor::close() |
624 void NotesTodoEditor::close() |
581 { |
625 { |
|
626 OstTraceFunctionEntry0( NOTESTODOEDITOR_CLOSE_ENTRY ); |
582 HbMainWindow *window = hbInstance->allMainWindows().first(); |
627 HbMainWindow *window = hbInstance->allMainWindows().first(); |
583 // Now close the editor. |
628 // Now close the editor. |
584 window->removeView(mEditor); |
629 window->removeView(mEditor); |
585 |
630 |
|
631 OstTraceFunctionExit0( NOTESTODOEDITOR_CLOSE_EXIT ); |
586 } |
632 } |
587 |
633 |
588 /*! |
634 /*! |
589 Handles the case when "Add description" action is triggered from the |
635 Handles the case when "Add description" action is triggered from the |
590 menu. |
636 menu. |
591 */ |
637 */ |
592 void NotesTodoEditor::handleAddDescriptionAction() |
638 void NotesTodoEditor::handleAddDescriptionAction() |
593 { |
639 { |
|
640 OstTraceFunctionEntry0( NOTESTODOEDITOR_HANDLEADDDESCRIPTIONACTION_ENTRY ); |
594 // Now we add the description item here. |
641 // Now we add the description item here. |
595 insertDescriptionItem(); |
642 insertDescriptionItem(); |
596 |
643 |
597 // Update the text in the menu action. |
644 // Update the text in the menu action. |
598 mDescriptionAction->setText(hbTrId("txt_notes_opt_remove_description")); |
645 mDescriptionAction->setText(hbTrId("txt_notes_opt_remove_description")); |
602 this, SLOT(handleAddDescriptionAction())); |
649 this, SLOT(handleAddDescriptionAction())); |
603 |
650 |
604 connect( |
651 connect( |
605 mDescriptionAction, SIGNAL(triggered()), |
652 mDescriptionAction, SIGNAL(triggered()), |
606 this, SLOT(handleRemoveDescriptionAction())); |
653 this, SLOT(handleRemoveDescriptionAction())); |
|
654 OstTraceFunctionExit0( NOTESTODOEDITOR_HANDLEADDDESCRIPTIONACTION_EXIT ); |
607 } |
655 } |
608 |
656 |
609 /*! |
657 /*! |
610 Handles the case when "Remove description" action is triggered |
658 Handles the case when "Remove description" action is triggered |
611 from the menu. |
659 from the menu. |
612 */ |
660 */ |
613 void NotesTodoEditor::handleRemoveDescriptionAction() |
661 void NotesTodoEditor::handleRemoveDescriptionAction() |
614 { |
662 { |
|
663 OstTraceFunctionEntry0( NOTESTODOEDITOR_HANDLEREMOVEDESCRIPTIONACTION_ENTRY ); |
615 // Here we firstset the description text in the entry to empty. |
664 // Here we firstset the description text in the entry to empty. |
616 mOwner->mModifiedNote.setDescription(""); |
665 mOwner->mModifiedNote.setDescription(""); |
617 |
666 |
618 // Now we remove the Description data form item. |
667 // Now we remove the Description data form item. |
619 mFormModel->removeItem(mFormModel->item(mDescriptionItemIndex)); |
668 mFormModel->removeItem(mFormModel->item(mDescriptionItemIndex)); |
627 |
676 |
628 connect( |
677 connect( |
629 mDescriptionAction, SIGNAL(triggered()), |
678 mDescriptionAction, SIGNAL(triggered()), |
630 this, SLOT(handleAddDescriptionAction())); |
679 this, SLOT(handleAddDescriptionAction())); |
631 |
680 |
|
681 OstTraceFunctionExit0( NOTESTODOEDITOR_HANDLEREMOVEDESCRIPTIONACTION_EXIT ); |
632 } |
682 } |
633 |
683 |
634 /*! |
684 /*! |
635 Handles "Delete" action when triggered from menu |
685 Handles "Delete" action when triggered from menu |
636 */ |
686 */ |
637 void NotesTodoEditor::handleDeleteAction() |
687 void NotesTodoEditor::handleDeleteAction() |
638 { |
688 { |
|
689 OstTraceFunctionEntry0( NOTESTODOEDITOR_HANDLEDELETEACTION_ENTRY ); |
639 HbMessageBox *confirmationQuery = new HbMessageBox( |
690 HbMessageBox *confirmationQuery = new HbMessageBox( |
640 HbMessageBox::MessageTypeQuestion); |
691 HbMessageBox::MessageTypeQuestion); |
641 confirmationQuery->setDismissPolicy(HbDialog::NoDismiss); |
692 confirmationQuery->setDismissPolicy(HbDialog::NoDismiss); |
642 confirmationQuery->setTimeout(HbDialog::NoTimeout); |
693 confirmationQuery->setTimeout(HbDialog::NoTimeout); |
643 confirmationQuery->setIconVisible(true); |
694 confirmationQuery->setIconVisible(true); |
661 hbTrId("txt_common_button_cancel")); |
712 hbTrId("txt_common_button_cancel")); |
662 confirmationQuery->addAction(mDeleteTodoAction); |
713 confirmationQuery->addAction(mDeleteTodoAction); |
663 confirmationQuery->addAction((mCancelDeleteAction)); |
714 confirmationQuery->addAction((mCancelDeleteAction)); |
664 |
715 |
665 confirmationQuery->open(this, SLOT(selectedAction(HbAction*))); |
716 confirmationQuery->open(this, SLOT(selectedAction(HbAction*))); |
|
717 OstTraceFunctionExit0( NOTESTODOEDITOR_HANDLEDELETEACTION_EXIT ); |
666 } |
718 } |
667 |
719 |
668 /*! |
720 /*! |
669 Handles "Discard changes" action when triggered from menu |
721 Handles "Discard changes" action when triggered from menu |
670 */ |
722 */ |
671 void NotesTodoEditor::handleDiscardChangesAction() |
723 void NotesTodoEditor::handleDiscardChangesAction() |
672 { |
724 { |
|
725 OstTraceFunctionEntry0( NOTESTODOEDITOR_HANDLEDISCARDCHANGESACTION_ENTRY ); |
673 // Close the to-do editor |
726 // Close the to-do editor |
674 close(); |
727 close(); |
|
728 OstTraceFunctionExit0( NOTESTODOEDITOR_HANDLEDISCARDCHANGESACTION_EXIT ); |
675 } |
729 } |
676 |
730 |
677 /*! |
731 /*! |
678 Slot to handle selected action in delete confirmation note. |
732 Slot to handle selected action in delete confirmation note. |
679 */ |
733 */ |
680 void NotesTodoEditor::selectedAction(HbAction *action) |
734 void NotesTodoEditor::selectedAction(HbAction *action) |
681 { |
735 { |
|
736 OstTraceFunctionEntry0( NOTESTODOEDITOR_SELECTEDACTION_ENTRY ); |
682 if (action==mDeleteTodoAction) { |
737 if (action==mDeleteTodoAction) { |
683 // Delete the to-do entry. |
738 // Delete the to-do entry. |
684 mOwner->deleteNote(); |
739 mOwner->deleteNote(); |
685 |
740 |
686 // Close the to-do editor. |
741 // Close the to-do editor. |
687 close(); |
742 close(); |
688 } |
743 } |
|
744 OstTraceFunctionExit0( NOTESTODOEDITOR_SELECTEDACTION_EXIT ); |
689 } |
745 } |
690 |
746 |
691 // End of file --Don't remove this. |
747 // End of file --Don't remove this. |