61 mRepeatUntilWidget(NULL), |
66 mRepeatUntilWidget(NULL), |
62 mReminderTimeWidget(NULL), |
67 mReminderTimeWidget(NULL), |
63 mDatePicker(NULL), |
68 mDatePicker(NULL), |
64 mTimePicker(NULL) |
69 mTimePicker(NULL) |
65 { |
70 { |
|
71 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_CALENEDITORCUSTOMITEM_ENTRY ); |
66 mMinDate = CalenDateUtils::minTime().date(); |
72 mMinDate = CalenDateUtils::minTime().date(); |
67 mMaxDate = CalenDateUtils::maxTime().date(); |
73 mMaxDate = CalenDateUtils::maxTime().date(); |
68 mMinTime.setHMS(0,0,0,0); |
74 mMinTime.setHMS(0,0,0,0); |
69 mMaxTime.setHMS(23,59,59,999); |
75 mMaxTime.setHMS(23,59,59,999); |
70 mLocale = HbExtendedLocale::system(); |
76 mLocale = HbExtendedLocale::system(); |
71 mLocationLineEdit = NULL; |
77 mLocationLineEdit = NULL; |
72 mLocationPushButton = NULL; |
78 mLocationPushButton = NULL; |
|
79 OstTraceFunctionExit0( CALENEDITORCUSTOMITEM_CALENEDITORCUSTOMITEM_EXIT ); |
73 } |
80 } |
74 /*! |
81 /*! |
75 Destructor. |
82 Destructor. |
76 */ |
83 */ |
77 CalenEditorCustomItem::~CalenEditorCustomItem() |
84 CalenEditorCustomItem::~CalenEditorCustomItem() |
78 { |
85 { |
|
86 OstTraceFunctionEntry0( DUP1_CALENEDITORCUSTOMITEM_CALENEDITORCUSTOMITEM_ENTRY ); |
79 // Nothing yet. |
87 // Nothing yet. |
|
88 OstTraceFunctionExit0( DUP1_CALENEDITORCUSTOMITEM_CALENEDITORCUSTOMITEM_EXIT ); |
80 } |
89 } |
81 /*! |
90 /*! |
82 Creates a new CalenEditorCustomItem. |
91 Creates a new CalenEditorCustomItem. |
83 */ |
92 */ |
84 HbAbstractViewItem* CalenEditorCustomItem::createItem() |
93 HbAbstractViewItem* CalenEditorCustomItem::createItem() |
85 { |
94 { |
|
95 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_CREATEITEM_ENTRY ); |
86 return new CalenEditorCustomItem(*this); |
96 return new CalenEditorCustomItem(*this); |
87 } |
97 } |
88 /*! |
98 /*! |
89 Creates the custom widget. |
99 Creates the custom widget. |
90 */ |
100 */ |
91 HbWidget* CalenEditorCustomItem::createCustomWidget() |
101 HbWidget* CalenEditorCustomItem::createCustomWidget() |
92 { |
102 { |
|
103 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_CREATECUSTOMWIDGET_ENTRY ); |
93 HbDataFormModelItem::DataItemType itemType = |
104 HbDataFormModelItem::DataItemType itemType = |
94 static_cast<HbDataFormModelItem::DataItemType> (modelIndex() .data( |
105 static_cast<HbDataFormModelItem::DataItemType> (modelIndex() .data( |
95 HbDataFormModelItem::ItemTypeRole).toInt()); |
106 HbDataFormModelItem::ItemTypeRole).toInt()); |
96 |
107 |
97 switch (itemType) { |
108 switch (itemType) { |
101 QGraphicsLinearLayout *layoutTop = |
112 QGraphicsLinearLayout *layoutTop = |
102 new QGraphicsLinearLayout(Qt::Horizontal); |
113 new QGraphicsLinearLayout(Qt::Horizontal); |
103 widgetTop->setLayout(layoutTop); |
114 widgetTop->setLayout(layoutTop); |
104 |
115 |
105 mPushButtonTime = new HbPushButton(); |
116 mPushButtonTime = new HbPushButton(); |
|
117 mPushButtonTime->setObjectName("startTime"); |
106 connect(mPushButtonTime, SIGNAL(clicked()), |
118 connect(mPushButtonTime, SIGNAL(clicked()), |
107 this, SLOT(handleTime())); |
119 this, SLOT(handleTime())); |
108 layoutTop->addItem(mPushButtonTime); |
120 layoutTop->addItem(mPushButtonTime); |
109 |
121 |
110 mPushButtonDate = |
122 mPushButtonDate = |
111 new HbPushButton(); |
123 new HbPushButton(); |
|
124 mPushButtonDate->setObjectName("startDate"); |
112 connect(mPushButtonDate, SIGNAL(clicked()), |
125 connect(mPushButtonDate, SIGNAL(clicked()), |
113 this, SLOT(handleDate())); |
126 this, SLOT(handleDate())); |
114 layoutTop->addItem(mPushButtonDate); |
127 layoutTop->addItem(mPushButtonDate); |
|
128 OstTraceFunctionExit0( CALENEDITORCUSTOMITEM_CREATECUSTOMWIDGET_EXIT ); |
115 return widgetTop; |
129 return widgetTop; |
116 } |
130 } |
117 |
131 |
118 |
132 |
119 case CustomWidgetTo: |
133 case CustomWidgetTo: |
122 QGraphicsLinearLayout *layoutBottom = |
136 QGraphicsLinearLayout *layoutBottom = |
123 new QGraphicsLinearLayout(Qt::Horizontal); |
137 new QGraphicsLinearLayout(Qt::Horizontal); |
124 widgetBottom->setLayout(layoutBottom); |
138 widgetBottom->setLayout(layoutBottom); |
125 |
139 |
126 mPushButtonTime = new HbPushButton(this); |
140 mPushButtonTime = new HbPushButton(this); |
|
141 mPushButtonTime->setObjectName("endTime"); |
127 connect(mPushButtonTime, SIGNAL(clicked()), |
142 connect(mPushButtonTime, SIGNAL(clicked()), |
128 this, SLOT(handleTime())); |
143 this, SLOT(handleTime())); |
129 layoutBottom->addItem(mPushButtonTime); |
144 layoutBottom->addItem(mPushButtonTime); |
130 |
145 |
131 mPushButtonDate = new HbPushButton(this); |
146 mPushButtonDate = new HbPushButton(this); |
|
147 mPushButtonDate->setObjectName("endDate"); |
132 connect(mPushButtonDate, SIGNAL(clicked()), |
148 connect(mPushButtonDate, SIGNAL(clicked()), |
133 this, SLOT(handleDate())); |
149 this, SLOT(handleDate())); |
134 layoutBottom->addItem(mPushButtonDate); |
150 layoutBottom->addItem(mPushButtonDate); |
|
151 OstTraceFunctionExit0( DUP1_CALENEDITORCUSTOMITEM_CREATECUSTOMWIDGET_EXIT ); |
135 return widgetBottom; |
152 return widgetBottom; |
136 } |
153 } |
137 |
154 |
138 case CustomWidgetLocation: |
155 case CustomWidgetLocation: |
139 { |
156 { |
148 editorLocationDocLoader.findWidget(CALEN_EDITOR_LOCATION)); |
165 editorLocationDocLoader.findWidget(CALEN_EDITOR_LOCATION)); |
149 |
166 |
150 mLocationLineEdit = qobject_cast<HbLineEdit *>( |
167 mLocationLineEdit = qobject_cast<HbLineEdit *>( |
151 editorLocationDocLoader.findWidget( |
168 editorLocationDocLoader.findWidget( |
152 CALEN_EDITOR_LOCATION_LINEEDIT)); |
169 CALEN_EDITOR_LOCATION_LINEEDIT)); |
|
170 mLocationLineEdit->setObjectName("locationLineEdit"); |
153 mLocationLineEdit->setMinRows(1); |
171 mLocationLineEdit->setMinRows(1); |
154 mLocationLineEdit->setMaxRows(4); |
172 mLocationLineEdit->setMaxRows(4); |
155 mLocationPushButton = qobject_cast<HbPushButton*>( |
173 mLocationPushButton = qobject_cast<HbPushButton*>( |
156 editorLocationDocLoader.findWidget( |
174 editorLocationDocLoader.findWidget( |
157 CALEN_EDITOR_LOCATION_PUSHBUTTON)); |
175 CALEN_EDITOR_LOCATION_PUSHBUTTON)); |
|
176 mLocationPushButton->setObjectName("locationIcon"); |
158 mLocationPushButton->setIcon( HbIcon("qtg_mono_location")); |
177 mLocationPushButton->setIcon( HbIcon("qtg_mono_location")); |
159 |
178 |
160 connect(mLocationPushButton, SIGNAL(clicked()), this, |
179 connect(mLocationPushButton, SIGNAL(clicked()), this, |
161 SLOT(launchLocationPicker())); |
180 SLOT(launchLocationPicker())); |
162 connect(mLocationLineEdit, SIGNAL(textChanged(const QString)), |
181 connect(mLocationLineEdit, SIGNAL(textChanged(const QString)), |
163 this, SLOT(handleLocationTextChange(const QString))); |
182 this, SLOT(handleLocationTextChange(const QString))); |
164 |
183 |
165 connect(mLocationLineEdit, SIGNAL(editingFinished()), |
184 connect(mLocationLineEdit, SIGNAL(editingFinished()), |
166 this, SLOT(handleEditingFinished())); |
185 this, SLOT(handleEditingFinished())); |
167 |
186 |
|
187 OstTraceFunctionExit0( DUP2_CALENEDITORCUSTOMITEM_CREATECUSTOMWIDGET_EXIT ); |
168 return widgetLocation; |
188 return widgetLocation; |
169 } |
189 } |
170 |
190 |
171 case RepeatUntilOffset: |
191 case RepeatUntilOffset: |
172 { |
192 { |
173 mRepeatUntilWidget = new HbPushButton(this); |
193 mRepeatUntilWidget = new HbPushButton(this); |
|
194 mRepeatUntilWidget->setObjectName("repeatUntilItem"); |
|
195 OstTraceFunctionExit0( DUP3_CALENEDITORCUSTOMITEM_CREATECUSTOMWIDGET_EXIT ); |
174 return mRepeatUntilWidget; |
196 return mRepeatUntilWidget; |
175 } |
197 } |
176 |
198 |
177 case ReminderTimeOffset: |
199 case ReminderTimeOffset: |
178 { |
200 { |
179 mReminderTimeWidget = new HbPushButton(this); |
201 mReminderTimeWidget = new HbPushButton(this); |
|
202 mReminderTimeWidget->setObjectName("remainderTimeItem"); |
|
203 OstTraceFunctionExit0( DUP4_CALENEDITORCUSTOMITEM_CREATECUSTOMWIDGET_EXIT ); |
180 return mReminderTimeWidget; |
204 return mReminderTimeWidget; |
181 } |
205 } |
182 |
206 |
183 default: |
207 default: |
184 return 0; |
208 return 0; |
224 } |
251 } |
225 locationString.append(selectedLocation.mCountry); |
252 locationString.append(selectedLocation.mCountry); |
226 emit locationTextChanged(locationString, selectedLocation.mLatitude, selectedLocation.mLongitude); |
253 emit locationTextChanged(locationString, selectedLocation.mLatitude, selectedLocation.mLongitude); |
227 mLocationLineEdit->setText(locationString ); |
254 mLocationLineEdit->setText(locationString ); |
228 } |
255 } |
|
256 OstTraceFunctionExit0( CALENEDITORCUSTOMITEM_SETSELECTEDLOCATION_EXIT ); |
229 } |
257 } |
230 |
258 |
231 /*! |
259 /*! |
232 Populates the date and time in proper formats on the buttons |
260 Populates the date and time in proper formats on the buttons |
233 */ |
261 */ |
234 void CalenEditorCustomItem::populateDateTime(QDateTime defaultDateTime, bool isFromItem) |
262 void CalenEditorCustomItem::populateDateTime(QDateTime defaultDateTime, bool isFromItem) |
235 { |
263 { |
|
264 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_POPULATEDATETIME_ENTRY ); |
236 // Store the date and time to be shown |
265 // Store the date and time to be shown |
237 mDate = defaultDateTime.date(); |
266 mDate = defaultDateTime.date(); |
238 mTime = defaultDateTime.time(); |
267 mTime = defaultDateTime.time(); |
239 |
268 |
240 mIsFromItem = isFromItem; |
269 mIsFromItem = isFromItem; |
241 |
270 |
242 mPushButtonDate->setText(mLocale.format(defaultDateTime.date(), |
271 mPushButtonDate->setText(mLocale.format(defaultDateTime.date(), |
243 r_qtn_date_usual_with_zero)); |
272 r_qtn_date_usual_with_zero)); |
244 mPushButtonTime->setText(mLocale.format(defaultDateTime.time(), |
273 mPushButtonTime->setText(mLocale.format(defaultDateTime.time(), |
245 r_qtn_time_usual_with_zero)); |
274 r_qtn_time_usual_with_zero)); |
|
275 OstTraceFunctionExit0( CALENEDITORCUSTOMITEM_POPULATEDATETIME_EXIT ); |
246 } |
276 } |
247 |
277 |
248 /*! |
278 /*! |
249 Sets the location on the button |
279 Sets the location on the button |
250 */ |
280 */ |
251 void CalenEditorCustomItem::populateLocation(QString location ) |
281 void CalenEditorCustomItem::populateLocation(QString location ) |
252 { |
282 { |
|
283 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_POPULATELOCATION_ENTRY ); |
253 mLocationLineEdit->setText( location ); |
284 mLocationLineEdit->setText( location ); |
|
285 OstTraceFunctionExit0( CALENEDITORCUSTOMITEM_POPULATELOCATION_EXIT ); |
254 } |
286 } |
255 |
287 |
256 /*! |
288 /*! |
257 Sets the date range |
289 Sets the date range |
258 */ |
290 */ |
259 void CalenEditorCustomItem::setDateRange(QDate start, QDate end) |
291 void CalenEditorCustomItem::setDateRange(QDate start, QDate end) |
260 { |
292 { |
|
293 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_SETDATERANGE_ENTRY ); |
261 mMaxDate = end; |
294 mMaxDate = end; |
262 mMinDate = start; |
295 mMinDate = start; |
263 // Check if both are falling on same day |
296 // Check if both are falling on same day |
264 // If yea, the disable the button |
297 // If yea, the disable the button |
265 if (mMaxDate.year() == mMinDate.year() && |
298 if (mMaxDate.year() == mMinDate.year() && |
266 (mMaxDate.day() == mMinDate.day())) { |
299 (mMaxDate.day() == mMinDate.day())) { |
267 enableDateButton(false); |
300 enableDateButton(false); |
268 } |
301 } |
|
302 OstTraceFunctionExit0( CALENEDITORCUSTOMITEM_SETDATERANGE_EXIT ); |
269 } |
303 } |
270 |
304 |
271 /*! |
305 /*! |
272 Sets the time range |
306 Sets the time range |
273 */ |
307 */ |
274 void CalenEditorCustomItem::setTimeRange(QTime start, QTime end) |
308 void CalenEditorCustomItem::setTimeRange(QTime start, QTime end) |
275 { |
309 { |
|
310 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_SETTIMERANGE_ENTRY ); |
276 mMaxTime = start; |
311 mMaxTime = start; |
277 mMinTime = end; |
312 mMinTime = end; |
|
313 OstTraceFunctionExit0( CALENEDITORCUSTOMITEM_SETTIMERANGE_EXIT ); |
278 } |
314 } |
279 |
315 |
280 /*! |
316 /*! |
281 Enables the date button |
317 Enables the date button |
282 */ |
318 */ |
283 void CalenEditorCustomItem::enableDateButton(bool value) |
319 void CalenEditorCustomItem::enableDateButton(bool value) |
284 { |
320 { |
|
321 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_ENABLEDATEBUTTON_ENTRY ); |
285 mPushButtonDate->setEnabled(value); |
322 mPushButtonDate->setEnabled(value); |
|
323 OstTraceFunctionExit0( CALENEDITORCUSTOMITEM_ENABLEDATEBUTTON_EXIT ); |
286 } |
324 } |
287 |
325 |
288 /*! |
326 /*! |
289 Handles the location change |
327 Handles the location change |
290 */ |
328 */ |
291 void CalenEditorCustomItem::handleLocationTextChange(QString location) |
329 void CalenEditorCustomItem::handleLocationTextChange(QString location) |
292 { |
330 { |
|
331 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_HANDLELOCATIONTEXTCHANGE_ENTRY ); |
293 emit locationTextChanged(location); |
332 emit locationTextChanged(location); |
|
333 OstTraceFunctionExit0( CALENEDITORCUSTOMITEM_HANDLELOCATIONTEXTCHANGE_EXIT ); |
294 } |
334 } |
295 |
335 |
296 /*! |
336 /*! |
297 Handles the location editing finished |
337 Handles the location editing finished |
298 */ |
338 */ |
299 void CalenEditorCustomItem::handleEditingFinished() |
339 void CalenEditorCustomItem::handleEditingFinished() |
300 { |
340 { |
|
341 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_HANDLEEDITINGFINISHED_ENTRY ); |
301 emit locationEditingFinished(); |
342 emit locationEditingFinished(); |
|
343 OstTraceFunctionExit0( CALENEDITORCUSTOMITEM_HANDLEEDITINGFINISHED_EXIT ); |
302 } |
344 } |
303 |
345 |
304 /*! |
346 /*! |
305 Launches the date picker |
347 Launches the date picker |
306 */ |
348 */ |
307 void CalenEditorCustomItem::handleDate() |
349 void CalenEditorCustomItem::handleDate() |
308 { |
350 { |
|
351 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_HANDLEDATE_ENTRY ); |
309 // Create a popup with datepicker for the user to select date. |
352 // Create a popup with datepicker for the user to select date. |
310 HbDialog *popUp = new HbDialog(); |
353 HbDialog *popUp = new HbDialog(); |
311 popUp->setDismissPolicy(HbDialog::NoDismiss); |
354 popUp->setDismissPolicy(HbDialog::NoDismiss); |
312 popUp->setTimeout(HbDialog::NoTimeout); |
355 popUp->setTimeout(HbDialog::NoTimeout); |
313 popUp->setAttribute( Qt::WA_DeleteOnClose, true ); |
356 popUp->setAttribute( Qt::WA_DeleteOnClose, true ); |
332 HbAction *okAction = new HbAction(hbTrId("txt_common_button_ok"), popUp); |
375 HbAction *okAction = new HbAction(hbTrId("txt_common_button_ok"), popUp); |
333 popUp->addAction(okAction); |
376 popUp->addAction(okAction); |
334 connect(okAction, SIGNAL(triggered()), this, SLOT(saveDate())); |
377 connect(okAction, SIGNAL(triggered()), this, SLOT(saveDate())); |
335 popUp->addAction(new HbAction(hbTrId("txt_common_button_cancel"), popUp)); |
378 popUp->addAction(new HbAction(hbTrId("txt_common_button_cancel"), popUp)); |
336 popUp->open(); |
379 popUp->open(); |
|
380 OstTraceFunctionExit0( CALENEDITORCUSTOMITEM_HANDLEDATE_EXIT ); |
337 } |
381 } |
338 |
382 |
339 /*! |
383 /*! |
340 Launches the time picker |
384 Launches the time picker |
341 */ |
385 */ |
342 void CalenEditorCustomItem::handleTime() |
386 void CalenEditorCustomItem::handleTime() |
343 { |
387 { |
|
388 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_HANDLETIME_ENTRY ); |
344 // Create a popup with time picker for the user to select time. |
389 // Create a popup with time picker for the user to select time. |
345 HbDialog *popUp = new HbDialog(); |
390 HbDialog *popUp = new HbDialog(); |
346 popUp->setDismissPolicy(HbDialog::NoDismiss); |
391 popUp->setDismissPolicy(HbDialog::NoDismiss); |
347 popUp->setTimeout(HbDialog::NoTimeout); |
392 popUp->setTimeout(HbDialog::NoTimeout); |
348 popUp->setAttribute( Qt::WA_DeleteOnClose, true ); |
393 popUp->setAttribute( Qt::WA_DeleteOnClose, true ); |
372 HbAction *okAction = new HbAction(hbTrId("txt_common_button_ok"), popUp); |
417 HbAction *okAction = new HbAction(hbTrId("txt_common_button_ok"), popUp); |
373 popUp->addAction(okAction); |
418 popUp->addAction(okAction); |
374 connect(okAction, SIGNAL(triggered()), this, SLOT(saveTime())); |
419 connect(okAction, SIGNAL(triggered()), this, SLOT(saveTime())); |
375 popUp->addAction(new HbAction(hbTrId("txt_common_button_cancel"), popUp)); |
420 popUp->addAction(new HbAction(hbTrId("txt_common_button_cancel"), popUp)); |
376 popUp->open(); |
421 popUp->open(); |
|
422 OstTraceFunctionExit0( CALENEDITORCUSTOMITEM_HANDLETIME_EXIT ); |
377 } |
423 } |
378 |
424 |
379 /*! |
425 /*! |
380 Save the start date of the event. |
426 Save the start date of the event. |
381 */ |
427 */ |
382 void CalenEditorCustomItem::saveDate() |
428 void CalenEditorCustomItem::saveDate() |
383 { |
429 { |
|
430 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_SAVEDATE_ENTRY ); |
384 mDate = mDatePicker->date(); |
431 mDate = mDatePicker->date(); |
385 if (mDate.isValid()) { |
432 if (mDate.isValid()) { |
386 mPushButtonDate->setText(mLocale.format(mDate, |
433 mPushButtonDate->setText(mLocale.format(mDate, |
387 r_qtn_date_usual_with_zero)); |
434 r_qtn_date_usual_with_zero)); |
388 QDateTime dateTime(mDate,mTime); |
435 QDateTime dateTime(mDate,mTime); |
389 emit dateTimeUpdated(dateTime); |
436 emit dateTimeUpdated(dateTime); |
390 } |
437 } |
|
438 OstTraceFunctionExit0( CALENEDITORCUSTOMITEM_SAVEDATE_EXIT ); |
391 } |
439 } |
392 |
440 |
393 /*! |
441 /*! |
394 Save the start time of the event. |
442 Save the start time of the event. |
395 */ |
443 */ |
396 void CalenEditorCustomItem::saveTime() |
444 void CalenEditorCustomItem::saveTime() |
397 { |
445 { |
|
446 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_SAVETIME_ENTRY ); |
398 mTime = mTimePicker->time(); |
447 mTime = mTimePicker->time(); |
399 if (mTime.isValid()) { |
448 if (mTime.isValid()) { |
400 mPushButtonTime->setText(mLocale.format(mTime, |
449 mPushButtonTime->setText(mLocale.format(mTime, |
401 r_qtn_time_usual_with_zero)); |
450 r_qtn_time_usual_with_zero)); |
402 |
451 |
403 QDateTime dateTime(mDate,mTime); |
452 QDateTime dateTime(mDate,mTime); |
404 emit dateTimeUpdated(dateTime); |
453 emit dateTimeUpdated(dateTime); |
405 } |
454 } |
|
455 OstTraceFunctionExit0( CALENEDITORCUSTOMITEM_SAVETIME_EXIT ); |
406 } |
456 } |
407 |
457 |
408 /*! |
458 /*! |
409 Enable/Desable FromTime filed and update time value |
459 Enable/Desable FromTime filed and update time value |
410 */ |
460 */ |
411 void CalenEditorCustomItem::enableFromTimeFieldAndSetTime(bool enableTimeFiles, QDateTime fromDateTime) |
461 void CalenEditorCustomItem::enableFromTimeFieldAndSetTime(bool enableTimeFiles, QDateTime fromDateTime) |
412 { |
462 { |
|
463 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_ENABLEFROMTIMEFIELDANDSETTIME_ENTRY ); |
413 // Set FromTime filed Read-Only/Editable |
464 // Set FromTime filed Read-Only/Editable |
414 mPushButtonTime->setEnabled(enableTimeFiles); |
465 mPushButtonTime->setEnabled(enableTimeFiles); |
415 |
466 |
416 // Set FromTime in Editor |
467 // Set FromTime in Editor |
417 mPushButtonTime->setText(mLocale.format(fromDateTime.time(),r_qtn_time_usual_with_zero)); |
468 mPushButtonTime->setText(mLocale.format(fromDateTime.time(),r_qtn_time_usual_with_zero)); |
418 |
469 |
419 // Store the time |
470 // Store the time |
420 mTime = fromDateTime.time(); |
471 mTime = fromDateTime.time(); |
|
472 OstTraceFunctionExit0( CALENEDITORCUSTOMITEM_ENABLEFROMTIMEFIELDANDSETTIME_EXIT ); |
421 } |
473 } |
422 |
474 |
423 /*! |
475 /*! |
424 Disable Date field. |
476 Disable Date field. |
425 */ |
477 */ |
426 void CalenEditorCustomItem::disableFromToDateField() |
478 void CalenEditorCustomItem::disableFromToDateField() |
427 { |
479 { |
|
480 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_DISABLEFROMTODATEFIELD_ENTRY ); |
428 // disable the date field. |
481 // disable the date field. |
429 mPushButtonDate->setEnabled(false); |
482 mPushButtonDate->setEnabled(false); |
|
483 OstTraceFunctionExit0( CALENEDITORCUSTOMITEM_DISABLEFROMTODATEFIELD_EXIT ); |
430 } |
484 } |
431 |
485 |
432 /*! |
486 /*! |
433 Enable/Desable ToTime filed and update time value |
487 Enable/Desable ToTime filed and update time value |
434 */ |
488 */ |
435 void CalenEditorCustomItem::enableToTimeFieldAndSetTime(bool enableTimeFiles, QDateTime toDateTime) |
489 void CalenEditorCustomItem::enableToTimeFieldAndSetTime(bool enableTimeFiles, QDateTime toDateTime) |
436 { |
490 { |
|
491 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_ENABLETOTIMEFIELDANDSETTIME_ENTRY ); |
437 // Set ToTime filed Read-Only/Editable |
492 // Set ToTime filed Read-Only/Editable |
438 mPushButtonTime->setEnabled(enableTimeFiles); |
493 mPushButtonTime->setEnabled(enableTimeFiles); |
439 |
494 |
440 // Set ToTime in Editor |
495 // Set ToTime in Editor |
441 mPushButtonTime->setText(mLocale.format( |
496 mPushButtonTime->setText(mLocale.format( |
442 toDateTime.time(),r_qtn_time_usual_with_zero)); |
497 toDateTime.time(),r_qtn_time_usual_with_zero)); |
443 |
498 |
444 // Store the time |
499 // Store the time |
445 mTime = toDateTime.time(); |
500 mTime = toDateTime.time(); |
|
501 OstTraceFunctionExit0( CALENEDITORCUSTOMITEM_ENABLETOTIMEFIELDANDSETTIME_EXIT ); |
446 } |
502 } |
447 |
503 |
448 /*! |
504 /*! |
449 OverRide from DataFrom |
505 OverRide from DataFrom |
450 */ |
506 */ |
451 bool CalenEditorCustomItem::canSetModelIndex(const QModelIndex &index) const |
507 bool CalenEditorCustomItem::canSetModelIndex(const QModelIndex &index) const |
452 { |
508 { |
|
509 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_CANSETMODELINDEX_ENTRY ); |
453 HbDataFormModelItem::DataItemType itemType = |
510 HbDataFormModelItem::DataItemType itemType = |
454 static_cast<HbDataFormModelItem::DataItemType>( |
511 static_cast<HbDataFormModelItem::DataItemType>( |
455 index.data(HbDataFormModelItem::ItemTypeRole).toInt()); |
512 index.data(HbDataFormModelItem::ItemTypeRole).toInt()); |
456 |
513 |
457 if(itemType == CustomWidgetFrom || itemType == CustomWidgetTo || itemType == RepeatUntilOffset |
514 if(itemType == CustomWidgetFrom || itemType == CustomWidgetTo || itemType == RepeatUntilOffset |
458 || itemType == CustomWidgetLocation || itemType == ReminderTimeOffset ) { |
515 || itemType == CustomWidgetLocation || itemType == ReminderTimeOffset ) { |
|
516 OstTraceFunctionExit0( CALENEDITORCUSTOMITEM_CANSETMODELINDEX_EXIT ); |
459 return true; |
517 return true; |
460 } else { |
518 } else { |
|
519 OstTraceFunctionExit0( DUP1_CALENEDITORCUSTOMITEM_CANSETMODELINDEX_EXIT ); |
461 return false; |
520 return false; |
462 } |
521 } |
463 } |
522 } |
464 |
523 |
465 void CalenEditorCustomItem::restore() |
524 void CalenEditorCustomItem::restore() |
466 { |
525 { |
|
526 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_RESTORE_ENTRY ); |
467 HbDataFormModelItem::DataItemType itemType = |
527 HbDataFormModelItem::DataItemType itemType = |
468 static_cast<HbDataFormModelItem::DataItemType>( |
528 static_cast<HbDataFormModelItem::DataItemType>( |
469 modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt()); |
529 modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt()); |
470 |
530 |
471 HbDataFormModel *model = |
531 HbDataFormModel *model = |