31 #include <HbAbstractViewItem> |
31 #include <HbAbstractViewItem> |
32 #include <HbAbstractItemView> |
32 #include <HbAbstractItemView> |
33 #include <QGraphicsLinearLayout> |
33 #include <QGraphicsLinearLayout> |
34 #include <QDate> |
34 #include <QDate> |
35 #include <QTime> |
35 #include <QTime> |
|
36 #include <xqaiwrequest.h> |
|
37 #include <xqappmgr.h> |
36 |
38 |
37 //LI related headers |
39 //LI related headers |
38 #include "qlocationpickeritem.h" |
40 #include "qlocationpickeritem.h" |
39 #include <xqaiwrequest.h> |
|
40 #include <xqappmgr.h> |
|
41 |
41 |
42 // User includes |
42 // User includes |
43 #include "caleneditorcustomitem.h" |
43 #include "caleneditorcustomitem.h" |
44 #include "calendateutils.h" |
44 #include "calendateutils.h" |
45 #include "caleneditorcommon.h" |
45 #include "caleneditorcommon.h" |
59 Constructor. |
59 Constructor. |
60 \param parent The parent object. |
60 \param parent The parent object. |
61 */ |
61 */ |
62 CalenEditorCustomItem::CalenEditorCustomItem(QGraphicsItem *parent) |
62 CalenEditorCustomItem::CalenEditorCustomItem(QGraphicsItem *parent) |
63 :HbDataFormViewItem(parent), |
63 :HbDataFormViewItem(parent), |
|
64 mAppManager(0), |
|
65 mRequest(0), |
64 mPushButtonTime(0), |
66 mPushButtonTime(0), |
65 mPushButtonDate(0), |
67 mPushButtonDate(0), |
66 mRepeatUntilWidget(0), |
68 mRepeatUntilWidget(0), |
67 mReminderTimeWidget(0), |
69 mReminderTimeWidget(0), |
68 mDatePicker(0), |
70 mDatePicker(0), |
69 mTimePicker(0) |
71 mTimePicker(0), |
|
72 mRequestPending(false) |
70 { |
73 { |
71 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_CALENEDITORCUSTOMITEM_ENTRY ); |
74 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_CALENEDITORCUSTOMITEM_ENTRY ); |
72 mMinDate = CalenDateUtils::minTime().date(); |
75 mMinDate = CalenDateUtils::minTime().date(); |
73 mMaxDate = CalenDateUtils::maxTime().date(); |
76 mMaxDate = CalenDateUtils::maxTime().date(); |
74 mMinTime.setHMS(0,0,0,0); |
77 mMinTime.setHMS(0,0,0,0); |
84 CalenEditorCustomItem::~CalenEditorCustomItem() |
87 CalenEditorCustomItem::~CalenEditorCustomItem() |
85 { |
88 { |
86 OstTraceFunctionEntry0( DUP1_CALENEDITORCUSTOMITEM_CALENEDITORCUSTOMITEM_ENTRY ); |
89 OstTraceFunctionEntry0( DUP1_CALENEDITORCUSTOMITEM_CALENEDITORCUSTOMITEM_ENTRY ); |
87 // Nothing yet. |
90 // Nothing yet. |
88 OstTraceFunctionExit0( DUP1_CALENEDITORCUSTOMITEM_CALENEDITORCUSTOMITEM_EXIT ); |
91 OstTraceFunctionExit0( DUP1_CALENEDITORCUSTOMITEM_CALENEDITORCUSTOMITEM_EXIT ); |
|
92 |
|
93 delete mAppManager; |
|
94 delete mRequest; |
89 } |
95 } |
90 /*! |
96 /*! |
91 Creates a new CalenEditorCustomItem. |
97 Creates a new CalenEditorCustomItem. |
92 */ |
98 */ |
93 HbAbstractViewItem* CalenEditorCustomItem::createItem() |
99 HbAbstractViewItem* CalenEditorCustomItem::createItem() |
167 mLocationLineEdit = qobject_cast<HbLineEdit *>( |
173 mLocationLineEdit = qobject_cast<HbLineEdit *>( |
168 editorLocationDocLoader.findWidget( |
174 editorLocationDocLoader.findWidget( |
169 CALEN_EDITOR_LOCATION_LINEEDIT)); |
175 CALEN_EDITOR_LOCATION_LINEEDIT)); |
170 mLocationLineEdit->setObjectName("locationLineEdit"); |
176 mLocationLineEdit->setObjectName("locationLineEdit"); |
171 mLocationLineEdit->setMinRows(1); |
177 mLocationLineEdit->setMinRows(1); |
172 mLocationLineEdit->setMaxRows(4); |
178 mLocationLineEdit->setMaxRows(MaxRowsInTextItem); |
173 mLocationPushButton = qobject_cast<HbPushButton*>( |
179 mLocationPushButton = qobject_cast<HbPushButton*>( |
174 editorLocationDocLoader.findWidget( |
180 editorLocationDocLoader.findWidget( |
175 CALEN_EDITOR_LOCATION_PUSHBUTTON)); |
181 CALEN_EDITOR_LOCATION_PUSHBUTTON)); |
176 mLocationPushButton->setObjectName("locationIcon"); |
182 mLocationPushButton->setObjectName("locationIcon"); |
177 mLocationPushButton->setIcon( HbIcon("qtg_mono_location")); |
183 mLocationPushButton->setIcon( HbIcon("qtg_mono_location")); |
212 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 |
213 */ |
219 */ |
214 |
220 |
215 void CalenEditorCustomItem::launchLocationPicker() |
221 void CalenEditorCustomItem::launchLocationPicker() |
216 { |
222 { |
217 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_LAUNCHLOCATIONPICKER_ENTRY ); |
223 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_LAUNCHLOCATIONPICKER_ENTRY ); |
218 XQApplicationManager *appManager = new XQApplicationManager(); |
224 if(!mAppManager) |
219 |
225 { |
220 XQAiwRequest *request = appManager->create("com.nokia.symbian", "ILocationPick", "pick()", true); |
226 mAppManager = new XQApplicationManager(); |
221 if( request ) |
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) |
222 { |
235 { |
223 QVariant retValue; |
236 if( mRequest->send() ) |
224 if( request->send( retValue ) ) |
237 { |
225 { |
238 mRequestPending = true; |
226 setSelectedLocation(retValue); |
239 } |
227 } |
240 } |
228 } |
|
229 OstTraceFunctionExit0( CALENEDITORCUSTOMITEM_LAUNCHLOCATIONPICKER_EXIT ); |
241 OstTraceFunctionExit0( CALENEDITORCUSTOMITEM_LAUNCHLOCATIONPICKER_EXIT ); |
230 } |
242 } |
231 /*! |
243 /*! |
232 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 |
233 and notify the other observers. |
245 and notify the other observers. |
234 */ |
246 */ |
235 void CalenEditorCustomItem::setSelectedLocation( QVariant &aValue ) |
247 void CalenEditorCustomItem::setSelectedLocation( const QVariant &aValue ) |
236 { |
248 { |
237 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_SETSELECTEDLOCATION_ENTRY ); |
249 OstTraceFunctionEntry0( CALENEDITORCUSTOMITEM_SETSELECTEDLOCATION_ENTRY ); |
|
250 mRequestPending = false; |
238 QLocationPickerItem selectedLocation = aValue.value<QLocationPickerItem>(); |
251 QLocationPickerItem selectedLocation = aValue.value<QLocationPickerItem>(); |
239 if( selectedLocation.mIsValid ) |
252 if( selectedLocation.mIsValid ) |
240 { |
253 { |
241 QString locationString; |
254 QString locationString; |
242 if( selectedLocation.mStreet.size() ) |
255 if( selectedLocation.mStreet.size() ) |