52 Default Constructor. |
53 Default Constructor. |
53 |
54 |
54 \param parent The parent. |
55 \param parent The parent. |
55 */ |
56 */ |
56 |
57 |
57 SettingsCustomItem::SettingsCustomItem(QGraphicsItem *parent) |
58 SettingsCustomItem::SettingsCustomItem(QGraphicsItem *parent, bool launchedByClock) |
58 :HbDataFormViewItem(parent) |
59 :HbDataFormViewItem(parent), mLaunchedByClock(launchedByClock) |
59 { |
60 { |
60 OstTraceFunctionEntry0( SETTINGSCUSTOMITEM_SETTINGSCUSTOMITEM_ENTRY ); |
61 OstTraceFunctionEntry0( SETTINGSCUSTOMITEM_SETTINGSCUSTOMITEM_ENTRY ); |
61 // Construct the settignsutility. |
62 // Construct the settignsutility. |
62 mSettingsUtility = new SettingsUtility(); |
63 mSettingsUtility = new SettingsUtility(); |
63 // Construct the timezone client. |
64 // Construct the timezone client. |
64 mTimezoneClient = TimezoneClient::getInstance(); |
65 mTimezoneClient = TimezoneClient::getInstance(); |
|
66 // Register for the css. |
|
67 HbStyleLoader::registerFilePath(":/style/settingscustomitem.css"); |
65 OstTraceFunctionExit0( SETTINGSCUSTOMITEM_SETTINGSCUSTOMITEM_EXIT ); |
68 OstTraceFunctionExit0( SETTINGSCUSTOMITEM_SETTINGSCUSTOMITEM_EXIT ); |
66 } |
69 } |
67 |
70 |
68 /*! |
71 /*! |
69 Destructor. |
72 Destructor. |
70 */ |
73 */ |
71 SettingsCustomItem::~SettingsCustomItem() |
74 SettingsCustomItem::~SettingsCustomItem() |
72 { |
75 { |
73 OstTraceFunctionEntry0( DUP1_SETTINGSCUSTOMITEM_SETTINGSCUSTOMITEM_ENTRY ); |
76 OstTraceFunctionEntry0( DUP1_SETTINGSCUSTOMITEM_SETTINGSCUSTOMITEM_ENTRY ); |
74 // Nothing yet. |
77 // Unregister the css. |
|
78 HbStyleLoader::unregisterFilePath(":/style/settingscustomitem.css"); |
75 OstTraceFunctionExit0( DUP1_SETTINGSCUSTOMITEM_SETTINGSCUSTOMITEM_EXIT ); |
79 OstTraceFunctionExit0( DUP1_SETTINGSCUSTOMITEM_SETTINGSCUSTOMITEM_EXIT ); |
76 } |
80 } |
77 |
81 |
78 /*! |
82 /*! |
79 \reimp |
83 \reimp |
183 .data(HbDataFormModelItem::ItemTypeRole).toInt()); |
187 .data(HbDataFormModelItem::ItemTypeRole).toInt()); |
184 |
188 |
185 switch (itemType) { |
189 switch (itemType) { |
186 case (TimeItemOffset + HbDataFormModelItem::CustomItemBase): |
190 case (TimeItemOffset + HbDataFormModelItem::CustomItemBase): |
187 { |
191 { |
|
192 setProperty("expandItem", false); |
188 mTimeWidget = new HbPushButton(this); |
193 mTimeWidget = new HbPushButton(this); |
189 connect( |
194 connect( |
190 mTimeWidget, SIGNAL(clicked()), |
195 mTimeWidget, SIGNAL(clicked()), |
191 this, SLOT(launchTimePicker())); |
196 this, SLOT(launchTimePicker())); |
192 OstTraceFunctionExit0( SETTINGSCUSTOMITEM_CREATECUSTOMWIDGET_EXIT ); |
197 OstTraceFunctionExit0( SETTINGSCUSTOMITEM_CREATECUSTOMWIDGET_EXIT ); |
193 return mTimeWidget; |
198 return mTimeWidget; |
194 } |
199 } |
195 |
200 |
196 case (DateItemOffset + HbDataFormModelItem::CustomItemBase): |
201 case (DateItemOffset + HbDataFormModelItem::CustomItemBase): |
197 { |
202 { |
|
203 setProperty("expandItem", false); |
198 mDateWidget = new HbPushButton(this); |
204 mDateWidget = new HbPushButton(this); |
199 connect( |
205 connect( |
200 mDateWidget, SIGNAL(clicked()), |
206 mDateWidget, SIGNAL(clicked()), |
201 this, SLOT(launchDatePicker())); |
207 this, SLOT(launchDatePicker())); |
202 OstTraceFunctionExit0( DUP1_SETTINGSCUSTOMITEM_CREATECUSTOMWIDGET_EXIT ); |
208 OstTraceFunctionExit0( DUP1_SETTINGSCUSTOMITEM_CREATECUSTOMWIDGET_EXIT ); |
203 return mDateWidget; |
209 return mDateWidget; |
204 } |
210 } |
205 |
211 |
206 case (PlaceItemOffset + HbDataFormModelItem::CustomItemBase): |
212 case (PlaceItemOffset + HbDataFormModelItem::CustomItemBase): |
207 { |
213 { |
|
214 setProperty("expandItem", false); |
208 mPlaceWidget = new HbPushButton(this); |
215 mPlaceWidget = new HbPushButton(this); |
209 connect( |
216 connect( |
210 mPlaceWidget, SIGNAL(clicked()), |
217 mPlaceWidget, SIGNAL(clicked()), |
211 this, SLOT(launchCitySelectionList())); |
218 this, SLOT(launchCitySelectionList())); |
212 OstTraceFunctionExit0( DUP2_SETTINGSCUSTOMITEM_CREATECUSTOMWIDGET_EXIT ); |
219 OstTraceFunctionExit0( DUP2_SETTINGSCUSTOMITEM_CREATECUSTOMWIDGET_EXIT ); |
213 return mPlaceWidget; |
220 return mPlaceWidget; |
214 } |
221 } |
215 |
222 |
216 case (RegionalItemOffset + HbDataFormModelItem::CustomItemBase): |
223 case (RegionalItemOffset + HbDataFormModelItem::CustomItemBase): |
217 { |
224 { |
|
225 setProperty("expandItem", false); |
218 mRegSettingsWidget = new HbPushButton(this); |
226 mRegSettingsWidget = new HbPushButton(this); |
219 connect( |
227 connect( |
220 mRegSettingsWidget, SIGNAL(clicked()), |
228 mRegSettingsWidget, SIGNAL(clicked()), |
221 this, SLOT(launchRegSettingsView())); |
229 this, SLOT(launchRegSettingsView())); |
222 OstTraceFunctionExit0( DUP3_SETTINGSCUSTOMITEM_CREATECUSTOMWIDGET_EXIT ); |
230 OstTraceFunctionExit0( DUP3_SETTINGSCUSTOMITEM_CREATECUSTOMWIDGET_EXIT ); |
223 return mRegSettingsWidget; |
231 return mRegSettingsWidget; |
224 } |
232 } |
225 |
233 |
226 case (50 + HbDataFormModelItem::CustomItemBase): |
234 case (WorkdaysItemOffset + HbDataFormModelItem::CustomItemBase): |
227 { |
235 { |
|
236 // Set the property so that the custom item layout |
|
237 // will be the same for both portrait and landscape |
|
238 setProperty("expandItem", true); |
228 mWorkdaysWidget = new HbListWidget(this); |
239 mWorkdaysWidget = new HbListWidget(this); |
229 mWorkdaysWidget->setSelectionMode(HbAbstractItemView::MultiSelection); |
240 mWorkdaysWidget->setSelectionMode(HbAbstractItemView::MultiSelection); |
230 mWorkdaysWidget->setScrollDirections(0); |
241 mWorkdaysWidget->setScrollDirections(0); |
231 mWorkdaysWidget->ungrabGesture(Qt::PanGesture); |
242 mWorkdaysWidget->ungrabGesture(Qt::PanGesture); |
232 |
243 |
422 */ |
433 */ |
423 void SettingsCustomItem::launchRegSettingsView() |
434 void SettingsCustomItem::launchRegSettingsView() |
424 { |
435 { |
425 OstTraceFunctionEntry0( SETTINGSCUSTOMITEM_LAUNCHREGSETTINGSVIEW_ENTRY ); |
436 OstTraceFunctionEntry0( SETTINGSCUSTOMITEM_LAUNCHREGSETTINGSVIEW_ENTRY ); |
426 ClockRegionalSettingsView *view = |
437 ClockRegionalSettingsView *view = |
427 new ClockRegionalSettingsView(); |
438 new ClockRegionalSettingsView(0, mLaunchedByClock); |
|
439 |
428 connect(mTimezoneClient, SIGNAL(timechanged()), |
440 connect(mTimezoneClient, SIGNAL(timechanged()), |
429 view, SLOT(updateWeekStartOn())); |
441 view, SLOT(updateWeekStartOn())); |
430 view->showView(); |
442 view->showView(); |
431 |
443 |
432 OstTraceFunctionExit0( SETTINGSCUSTOMITEM_LAUNCHREGSETTINGSVIEW_EXIT ); |
444 OstTraceFunctionExit0( SETTINGSCUSTOMITEM_LAUNCHREGSETTINGSVIEW_EXIT ); |