58 mCustomRepeatUntilItem(NULL), |
63 mCustomRepeatUntilItem(NULL), |
59 mIsBiWeekly(false), |
64 mIsBiWeekly(false), |
60 mIsWorkdays(false), |
65 mIsWorkdays(false), |
61 mRepeatUntilItemAdded(false) |
66 mRepeatUntilItemAdded(false) |
62 { |
67 { |
|
68 OstTraceFunctionEntry0( CALENEDITORREPEATFIELD_CALENEDITORREPEATFIELD_ENTRY ); |
63 if (!mCalenEditor->editedEntry()->repeatRule().isNull()) { |
69 if (!mCalenEditor->editedEntry()->repeatRule().isNull()) { |
64 mRepeatRuleType = mCalenEditor->editedEntry()->repeatRule().type(); |
70 mRepeatRuleType = mCalenEditor->editedEntry()->repeatRule().type(); |
65 mRepeatUntilDate = mCalenEditor->editedEntry()->repeatRule().until().date(); |
71 mRepeatUntilDate = mCalenEditor->editedEntry()->repeatRule().until().date(); |
66 } |
72 } |
67 |
73 |
68 mRepeatItem = new HbDataFormModelItem(); |
74 mRepeatItem = new HbDataFormModelItem(); |
69 mRepeatItem->setType(HbDataFormModelItem::ComboBoxItem); |
75 mRepeatItem->setType(HbDataFormModelItem::ComboBoxItem); |
70 mRepeatItem->setData(HbDataFormModelItem::LabelRole, |
76 mRepeatItem->setData(HbDataFormModelItem::LabelRole, |
71 hbTrId("txt_calendar_setlabel_repeat")); |
77 hbTrId("txt_calendar_setlabel_repeat")); |
72 |
78 |
73 // Create the repeat choices |
79 // Create the repeat choices |
74 QStringList repeatChoices; |
80 QStringList repeatChoices; |
75 repeatChoices << hbTrId("txt_calendar_setlabel_repeat_val_only_once") |
81 repeatChoices << hbTrId("txt_calendar_setlabel_repeat_val_only_once") |
76 << hbTrId("txt_calendar_setlabel_repeat_val_daily") |
82 << hbTrId("txt_calendar_setlabel_repeat_val_daily") |
77 << hbTrId("txt_calendar_setlabel_repeat_val_workdays") |
83 << hbTrId("txt_calendar_setlabel_repeat_val_workdays") |
78 << hbTrId("txt_calendar_setlabel_repeat_val_weekly") |
84 << hbTrId("txt_calendar_setlabel_repeat_val_weekly") |
79 << hbTrId("txt_calendar_setlabel_repeat_val_fortnightly") |
85 << hbTrId("txt_calendar_setlabel_repeat_val_fortnightly") |
80 << hbTrId("txt_calendar_setlabel_repeat_val_monthly") |
86 << hbTrId("txt_calendar_setlabel_repeat_val_monthly") |
81 << hbTrId("txt_calendar_setlabel_repeat_val_yearly"); |
87 << hbTrId("txt_calendar_setlabel_repeat_val_yearly"); |
82 |
88 |
83 mRepeatItem->setContentWidgetData(QString("items"), repeatChoices); |
89 mRepeatItem->setContentWidgetData("items", repeatChoices); |
|
90 mRepeatItem->setContentWidgetData("objectName", "repeatItem"); |
84 mCalenEditorModel->appendDataFormItem( mRepeatItem, |
91 mCalenEditorModel->appendDataFormItem( mRepeatItem, |
85 mCalenEditorModel->invisibleRootItem()); |
92 mCalenEditorModel->invisibleRootItem()); |
|
93 OstTraceFunctionExit0( CALENEDITORREPEATFIELD_CALENEDITORREPEATFIELD_EXIT ); |
86 } |
94 } |
87 |
95 |
88 /*! |
96 /*! |
89 Destructor |
97 Destructor |
90 */ |
98 */ |
91 CalenEditorRepeatField::~CalenEditorRepeatField() |
99 CalenEditorRepeatField::~CalenEditorRepeatField() |
92 { |
100 { |
|
101 OstTraceFunctionEntry0( DUP1_CALENEDITORREPEATFIELD_CALENEDITORREPEATFIELD_ENTRY ); |
93 // Nothing Yet |
102 // Nothing Yet |
|
103 OstTraceFunctionExit0( DUP1_CALENEDITORREPEATFIELD_CALENEDITORREPEATFIELD_EXIT ); |
94 } |
104 } |
95 |
105 |
96 /*! |
106 /*! |
97 Adds repeat item to the model |
107 Adds repeat item to the model |
98 */ |
108 */ |
99 void CalenEditorRepeatField::addItemToModel() |
109 void CalenEditorRepeatField::addItemToModel() |
100 { |
110 { |
|
111 OstTraceFunctionEntry0( CALENEDITORREPEATFIELD_ADDITEMTOMODEL_ENTRY ); |
101 // Add reminder to the model |
112 // Add reminder to the model |
102 mCalenEditorModel->appendDataFormItem( mRepeatItem, |
113 mCalenEditorModel->appendDataFormItem( mRepeatItem, |
103 mCalenEditorModel->invisibleRootItem()); |
114 mCalenEditorModel->invisibleRootItem()); |
|
115 OstTraceFunctionExit0( CALENEDITORREPEATFIELD_ADDITEMTOMODEL_EXIT ); |
104 } |
116 } |
105 |
117 |
106 /*! |
118 /*! |
107 Removes the repeat item from the model |
119 Removes the repeat item from the model |
108 */ |
120 */ |
109 void CalenEditorRepeatField::removeItemFromModel() |
121 void CalenEditorRepeatField::removeItemFromModel() |
110 { |
122 { |
|
123 OstTraceFunctionEntry0( CALENEDITORREPEATFIELD_REMOVEITEMFROMMODEL_ENTRY ); |
111 mCalenEditorModel->removeItem(modelIndex()); |
124 mCalenEditorModel->removeItem(modelIndex()); |
|
125 OstTraceFunctionExit0( CALENEDITORREPEATFIELD_REMOVEITEMFROMMODEL_EXIT ); |
112 } |
126 } |
113 |
127 |
114 /*! |
128 /*! |
115 Populates repeat item with the options available |
129 Populates repeat item with the options available |
116 \param index index at which repeat item needs to be added |
130 \param index index at which repeat item needs to be added |
117 */ |
131 */ |
118 void CalenEditorRepeatField::populateRepeatItem(int index) |
132 void CalenEditorRepeatField::populateRepeatItem(int index) |
119 { |
133 { |
|
134 OstTraceFunctionEntry0( CALENEDITORREPEATFIELD_POPULATEREPEATITEM_ENTRY ); |
120 HbDataFormViewItem |
135 HbDataFormViewItem |
121 *item = |
136 *item = |
122 qobject_cast<HbDataFormViewItem *> ( |
137 qobject_cast<HbDataFormViewItem *> ( |
123 mEditorForm->itemByIndex( |
138 mEditorForm->itemByIndex( |
124 mCalenEditorModel->index( index, 0))); |
139 mCalenEditorModel->index( index, 0))); |
184 |
199 |
185 // Update the repeat choices depending upon the duration |
200 // Update the repeat choices depending upon the duration |
186 updateRepeatChoices(); |
201 updateRepeatChoices(); |
187 connect(mRepeatComboBox, SIGNAL(currentIndexChanged(int)), this, |
202 connect(mRepeatComboBox, SIGNAL(currentIndexChanged(int)), this, |
188 SLOT(handleRepeatIndexChanged(int))); |
203 SLOT(handleRepeatIndexChanged(int))); |
|
204 OstTraceFunctionExit0( CALENEDITORREPEATFIELD_POPULATEREPEATITEM_EXIT ); |
189 } |
205 } |
190 |
206 |
191 /*! |
207 /*! |
192 Triggerd from tapping on reminder item. |
208 Triggerd from tapping on reminder item. |
193 Handles the reminder time change and updates the same in the event. |
209 Handles the reminder time change and updates the same in the event. |
194 \param index The new index chosen in the reminder list. |
210 \param index The new index chosen in the reminder list. |
195 */ |
211 */ |
196 void CalenEditorRepeatField::handleRepeatIndexChanged(int index) |
212 void CalenEditorRepeatField::handleRepeatIndexChanged(int index) |
197 { |
213 { |
|
214 OstTraceFunctionEntry0( CALENEDITORREPEATFIELD_HANDLEREPEATINDEXCHANGED_ENTRY ); |
198 mIsBiWeekly = false; |
215 mIsBiWeekly = false; |
199 mIsWorkdays = false; |
216 mIsWorkdays = false; |
200 |
217 |
201 HbExtendedLocale locale = HbExtendedLocale::system(); |
218 HbExtendedLocale locale = HbExtendedLocale::system(); |
202 // Get the user role we have set for this index |
219 // Get the user role we have set for this index |
300 } |
317 } |
301 if(!mCalenEditor->isNewEntry()) { |
318 if(!mCalenEditor->isNewEntry()) { |
302 mCalenEditor->addDiscardAction(); |
319 mCalenEditor->addDiscardAction(); |
303 } |
320 } |
304 mCalenEditor->updateReminderChoices(); |
321 mCalenEditor->updateReminderChoices(); |
|
322 OstTraceFunctionExit0( CALENEDITORREPEATFIELD_HANDLEREPEATINDEXCHANGED_EXIT ); |
305 } |
323 } |
306 |
324 |
307 /*! |
325 /*! |
308 Returns model index of the repeat item |
326 Returns model index of the repeat item |
309 \return Model index of the repeat item |
327 \return Model index of the repeat item |
310 */ |
328 */ |
311 QModelIndex CalenEditorRepeatField::modelIndex() |
329 QModelIndex CalenEditorRepeatField::modelIndex() |
312 { |
330 { |
|
331 OstTraceFunctionEntry0( CALENEDITORREPEATFIELD_MODELINDEX_ENTRY ); |
313 return mCalenEditorModel->indexFromItem(mRepeatItem); |
332 return mCalenEditorModel->indexFromItem(mRepeatItem); |
314 } |
333 } |
315 |
334 |
316 /*! |
335 /*! |
317 Inserts the repeat until item to the dataform model |
336 Inserts the repeat until item to the dataform model |
318 */ |
337 */ |
319 void CalenEditorRepeatField::insertRepeatUntilItem() |
338 void CalenEditorRepeatField::insertRepeatUntilItem() |
320 { |
339 { |
|
340 OstTraceFunctionEntry0( CALENEDITORREPEATFIELD_INSERTREPEATUNTILITEM_ENTRY ); |
321 HbDataFormModelItem::DataItemType itemType = |
341 HbDataFormModelItem::DataItemType itemType = |
322 static_cast<HbDataFormModelItem::DataItemType> (RepeatUntilOffset); |
342 static_cast<HbDataFormModelItem::DataItemType> (RepeatUntilOffset); |
323 |
343 |
324 int index = CalenEditorPrivate::RepeatUntilItem; |
344 int index = CalenEditorPrivate::RepeatUntilItem; |
325 if (!mCalenEditor->isReminderTimeForAllDayAdded()) { |
345 if (!mCalenEditor->isReminderTimeForAllDayAdded()) { |
342 mCalenEditor->editedEntry()->repeatRule().until().date(), |
362 mCalenEditor->editedEntry()->repeatRule().until().date(), |
343 r_qtn_date_usual_with_zero); |
363 r_qtn_date_usual_with_zero); |
344 mCustomRepeatUntilItem->setContentWidgetData("text", dateString); |
364 mCustomRepeatUntilItem->setContentWidgetData("text", dateString); |
345 } |
365 } |
346 //TODO: Scroll to functionality has to be implemented |
366 //TODO: Scroll to functionality has to be implemented |
|
367 OstTraceFunctionExit0( CALENEDITORREPEATFIELD_INSERTREPEATUNTILITEM_EXIT ); |
347 } |
368 } |
348 |
369 |
349 /*! |
370 /*! |
350 Informs if repeat until item has been added or not |
371 Informs if repeat until item has been added or not |
351 \return true if repeat until item is added else false |
372 \return true if repeat until item is added else false |
352 */ |
373 */ |
353 bool CalenEditorRepeatField::isRepeatUntilItemAdded() |
374 bool CalenEditorRepeatField::isRepeatUntilItemAdded() |
354 { |
375 { |
|
376 OstTraceFunctionEntry0( CALENEDITORREPEATFIELD_ISREPEATUNTILITEMADDED_ENTRY ); |
|
377 OstTraceFunctionExit0( CALENEDITORREPEATFIELD_ISREPEATUNTILITEMADDED_EXIT ); |
355 return mRepeatUntilItemAdded; |
378 return mRepeatUntilItemAdded; |
356 } |
379 } |
357 |
380 |
358 /*! |
381 /*! |
359 Launches the date picker by tapping on the repaet until pushbutton |
382 Launches the date picker by tapping on the repaet until pushbutton |
360 */ |
383 */ |
361 void CalenEditorRepeatField::launchRepeatUntilDatePicker() |
384 void CalenEditorRepeatField::launchRepeatUntilDatePicker() |
362 { |
385 { |
|
386 OstTraceFunctionEntry0( CALENEDITORREPEATFIELD_LAUNCHREPEATUNTILDATEPICKER_ENTRY ); |
363 HbDialog *popUp = new HbDialog(); |
387 HbDialog *popUp = new HbDialog(); |
364 popUp->setDismissPolicy(HbDialog::NoDismiss); |
388 popUp->setDismissPolicy(HbDialog::NoDismiss); |
365 popUp->setTimeout(HbDialog::NoTimeout); |
389 popUp->setTimeout(HbDialog::NoTimeout); |
366 popUp->setHeadingWidget( new HbLabel( |
390 popUp->setHeadingWidget( new HbLabel( |
367 hbTrId("txt_calendar_title_repeat_until"))); |
391 hbTrId("txt_calendar_title_repeat_until"))); |
405 HbAction *okAction = new HbAction(hbTrId("txt_common_button_ok")); |
429 HbAction *okAction = new HbAction(hbTrId("txt_common_button_ok")); |
406 popUp->addAction(okAction); |
430 popUp->addAction(okAction); |
407 connect(okAction, SIGNAL(triggered()), this, SLOT(setRepeatUntilDate())); |
431 connect(okAction, SIGNAL(triggered()), this, SLOT(setRepeatUntilDate())); |
408 popUp->addAction(new HbAction(hbTrId("txt_common_button_cancel"), popUp)); |
432 popUp->addAction(new HbAction(hbTrId("txt_common_button_cancel"), popUp)); |
409 popUp->open(); |
433 popUp->open(); |
|
434 OstTraceFunctionExit0( CALENEDITORREPEATFIELD_LAUNCHREPEATUNTILDATEPICKER_EXIT ); |
410 } |
435 } |
411 |
436 |
412 /*! |
437 /*! |
413 Sets the repeat until date on the repeat until item |
438 Sets the repeat until date on the repeat until item |
414 */ |
439 */ |
415 void CalenEditorRepeatField::setRepeatUntilDate() |
440 void CalenEditorRepeatField::setRepeatUntilDate() |
416 { |
441 { |
|
442 OstTraceFunctionEntry0( CALENEDITORREPEATFIELD_SETREPEATUNTILDATE_ENTRY ); |
417 mRepeatUntilDate = mDatePicker->date(); |
443 mRepeatUntilDate = mDatePicker->date(); |
418 if (mRepeatUntilDate.isValid()) { |
444 if (mRepeatUntilDate.isValid()) { |
419 HbExtendedLocale locale = HbExtendedLocale::system(); |
445 HbExtendedLocale locale = HbExtendedLocale::system(); |
420 QString dateString = locale.format(mRepeatUntilDate, |
446 QString dateString = locale.format(mRepeatUntilDate, |
421 r_qtn_date_usual_with_zero); |
447 r_qtn_date_usual_with_zero); |
422 mCustomRepeatUntilItem->setContentWidgetData("text", dateString); |
448 mCustomRepeatUntilItem->setContentWidgetData("text", dateString); |
423 } |
449 } |
424 mCalenEditor->updateReminderChoices(); |
450 mCalenEditor->updateReminderChoices(); |
|
451 OstTraceFunctionExit0( CALENEDITORREPEATFIELD_SETREPEATUNTILDATE_EXIT ); |
425 } |
452 } |
426 |
453 |
427 /*! |
454 /*! |
428 Returns the repeatuntildate displayed. |
455 Returns the repeatuntildate displayed. |
429 */ |
456 */ |
430 QDate CalenEditorRepeatField::repeatUntilDate() |
457 QDate CalenEditorRepeatField::repeatUntilDate() |
431 { |
458 { |
|
459 OstTraceFunctionEntry0( CALENEDITORREPEATFIELD_REPEATUNTILDATE_ENTRY ); |
|
460 OstTraceFunctionExit0( CALENEDITORREPEATFIELD_REPEATUNTILDATE_EXIT ); |
432 return mRepeatUntilDate; |
461 return mRepeatUntilDate; |
433 } |
462 } |
434 |
463 |
435 /*! |
464 /*! |
436 Updates the repeat choices depending on the meeting duration |
465 Updates the repeat choices depending on the meeting duration |
437 */ |
466 */ |
438 void CalenEditorRepeatField::updateRepeatChoices() |
467 void CalenEditorRepeatField::updateRepeatChoices() |
439 { |
468 { |
|
469 OstTraceFunctionEntry0( CALENEDITORREPEATFIELD_UPDATEREPEATCHOICES_ENTRY ); |
440 if (!mRepeatComboBox) { |
470 if (!mRepeatComboBox) { |
|
471 OstTraceFunctionExit0( CALENEDITORREPEATFIELD_UPDATEREPEATCHOICES_EXIT ); |
441 return; |
472 return; |
442 } |
473 } |
443 // Clear all the choices and add it again. If we dont do it |
474 // Clear all the choices and add it again. If we dont do it |
444 // as user would have changed the end times many times and we would have |
475 // as user would have changed the end times many times and we would have |
445 // deleted repeat options depending upon that |
476 // deleted repeat options depending upon that |
545 if (choice >= count) { |
576 if (choice >= count) { |
546 choice = count - 1; |
577 choice = count - 1; |
547 } |
578 } |
548 // Set the previous user's choice |
579 // Set the previous user's choice |
549 mRepeatComboBox->setCurrentIndex(choice); |
580 mRepeatComboBox->setCurrentIndex(choice); |
|
581 OstTraceFunctionExit0( DUP1_CALENEDITORREPEATFIELD_UPDATEREPEATCHOICES_EXIT ); |
550 } |
582 } |
551 |
583 |
552 /*! |
584 /*! |
553 Save RepeatRule to the edited entry |
585 Save RepeatRule to the edited entry |
554 */ |
586 */ |
555 void CalenEditorRepeatField::saveRepeatRule() |
587 void CalenEditorRepeatField::saveRepeatRule() |
556 { |
588 { |
|
589 OstTraceFunctionEntry0( CALENEDITORREPEATFIELD_SAVEREPEATRULE_ENTRY ); |
557 // saves repeat type of entry. |
590 // saves repeat type of entry. |
558 if (mRepeatRuleType != AgendaRepeatRule::InvalidRule) { |
591 if (mRepeatRuleType != AgendaRepeatRule::InvalidRule) { |
559 AgendaRepeatRule repeatRule(mRepeatRuleType); |
592 AgendaRepeatRule repeatRule(mRepeatRuleType); |
560 |
593 |
561 //TODO : Set the repeat from and to dates |
594 //TODO : Set the repeat from and to dates |