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