equal
deleted
inserted
replaced
21 #include <HbMainWindow> |
21 #include <HbMainWindow> |
22 #include <HbAction> |
22 #include <HbAction> |
23 #include <HbDataForm> |
23 #include <HbDataForm> |
24 #include <HbDataFormModel> |
24 #include <HbDataFormModel> |
25 #include <HbDocumentLoader> |
25 #include <HbDocumentLoader> |
|
26 #include <HbLineEdit> |
|
27 #include <HbVkbHostBridge> |
26 |
28 |
27 #include "nmmailboxsettingview.h" |
29 #include "nmmailboxsettingview.h" |
28 #include "nmmailboxsettingsmanager.h" |
30 #include "nmmailboxsettingsmanager.h" |
29 #include "nmsettingsformcustomitems.h" |
31 #include "nmsettingsformcustomitems.h" |
30 |
32 |
78 } |
80 } |
79 |
81 |
80 if (mForm) { |
82 if (mForm) { |
81 |
83 |
82 qRegisterMetaType<QModelIndex>("QModelIndex"); |
84 qRegisterMetaType<QModelIndex>("QModelIndex"); |
|
85 |
83 connect(mForm, SIGNAL(activated(QModelIndex)), |
86 connect(mForm, SIGNAL(activated(QModelIndex)), |
84 this, SLOT(itemActivated(QModelIndex))); |
87 this, SLOT(itemActivated(QModelIndex))); |
85 connect(mForm, SIGNAL(itemShown(QModelIndex)), |
88 connect(mForm, SIGNAL(itemShown(QModelIndex)), |
86 this, SLOT(disablePredictiveText(QModelIndex))); |
89 this, SLOT(disablePredictiveText(QModelIndex))); |
|
90 |
87 |
91 |
88 // Fix for dataform item recycling. |
92 // Fix for dataform item recycling. |
89 mForm->setItemRecycling(false); |
93 mForm->setItemRecycling(false); |
90 |
94 |
91 // Set the form for the view. |
95 // Set the form for the view. |
180 void NmMailboxSettingView::itemActivated(const QModelIndex &index) |
184 void NmMailboxSettingView::itemActivated(const QModelIndex &index) |
181 { |
185 { |
182 NM_FUNCTION; |
186 NM_FUNCTION; |
183 |
187 |
184 int type(index.data(HbDataFormModelItem::ItemTypeRole).toInt()); |
188 int type(index.data(HbDataFormModelItem::ItemTypeRole).toInt()); |
|
189 |
185 |
190 |
186 if (type == HbDataFormModelItem::GroupItem) { |
191 if (type == HbDataFormModelItem::GroupItem) { |
187 |
192 |
188 // Scroll the groupitem to top. |
193 // Scroll the groupitem to top. |
189 if (!mForm->isExpanded(index)) { |
194 if (!mForm->isExpanded(index)) { |
218 // Turn off predictive input for line-edit. |
223 // Turn off predictive input for line-edit. |
219 HbDataFormViewItem *item = static_cast<HbDataFormViewItem *>(mForm->itemByIndex(index)); |
224 HbDataFormViewItem *item = static_cast<HbDataFormViewItem *>(mForm->itemByIndex(index)); |
220 HbWidget *widget = item->dataItemContentWidget(); |
225 HbWidget *widget = item->dataItemContentWidget(); |
221 if (widget) { |
226 if (widget) { |
222 widget->setInputMethodHints(Qt::ImhNoPredictiveText); |
227 widget->setInputMethodHints(Qt::ImhNoPredictiveText); |
|
228 widget->installEventFilter(this); |
223 } |
229 } |
224 } |
230 } |
225 } |
231 } |
226 |
232 |
227 /*! |
233 /*! |
233 { |
239 { |
234 NM_FUNCTION; |
240 NM_FUNCTION; |
235 |
241 |
236 mForm->scrollTo(index, HbAbstractItemView::PositionAtTop); |
242 mForm->scrollTo(index, HbAbstractItemView::PositionAtTop); |
237 } |
243 } |
|
244 |
|
245 /*! |
|
246 Forces HbLineEdit to emit editingFinished when focus has been removed from it, if VKB is open. |
|
247 NOTE: This can be removed when VKB handling is fixed by orbit so that editingFinished signal is |
|
248 emitted when group box is collapsed. |
|
249 |
|
250 \param watched object that eventFilter has installed to. |
|
251 \param event occured event. |
|
252 */ |
|
253 bool NmMailboxSettingView::eventFilter(QObject *watched, QEvent *event) |
|
254 { |
|
255 if (event->type() == QFocusEvent::FocusOut) { |
|
256 QGraphicsItem *item = qobject_cast<QGraphicsItem *>(watched); |
|
257 if (item && item->type() == Hb::ItemType_LineEdit) { |
|
258 HbVkbHostBridge *instance = HbVkbHostBridge::instance(); |
|
259 // Only force emit if VKB is open. |
|
260 if(instance && instance->keypadStatus() == HbVkbHost::HbVkbStatusOpened) { |
|
261 HbLineEdit *edit = static_cast<HbLineEdit *>(item); |
|
262 // Save settings. |
|
263 connect(this, SIGNAL(emitEditingFinished()), edit, SIGNAL(editingFinished())); |
|
264 emit emitEditingFinished(); |
|
265 disconnect(this, SIGNAL(emitEditingFinished()), edit, SIGNAL(editingFinished())); |
|
266 } |
|
267 } |
|
268 } |
|
269 // Event has not been consumed. |
|
270 return false; |
|
271 } |
|
272 |
238 // End of file. |
273 // End of file. |