equal
deleted
inserted
replaced
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
|
17 |
|
18 #include <qinputcontext.h> |
17 |
19 |
18 #include <hbinstance.h> |
20 #include <hbinstance.h> |
19 #include <hbmainwindow.h> |
21 #include <hbmainwindow.h> |
20 #include <hbaction.h> |
22 #include <hbaction.h> |
21 #include <hbdataform.h> |
23 #include <hbdataform.h> |
74 mForm = qobject_cast<HbDataForm*>( |
76 mForm = qobject_cast<HbDataForm*>( |
75 documentLoader.findWidget(NMSETTINGUI_SETTING_VIEW_FORM)); |
77 documentLoader.findWidget(NMSETTINGUI_SETTING_VIEW_FORM)); |
76 } |
78 } |
77 |
79 |
78 if (mForm) { |
80 if (mForm) { |
|
81 |
|
82 connect(mForm, SIGNAL(pressed(QModelIndex)), |
|
83 this, SLOT(itemPress(QModelIndex))); |
|
84 |
79 // Fix for dataform item recycling. |
85 // Fix for dataform item recycling. |
80 mForm->setItemRecycling(false); |
86 mForm->setItemRecycling(false); |
81 |
87 |
82 // Set the form for the view. |
88 // Set the form for the view. |
83 setWidget(mForm); |
89 setWidget(mForm); |
161 NmId NmMailboxSettingView::mailboxId() |
167 NmId NmMailboxSettingView::mailboxId() |
162 { |
168 { |
163 return mMailboxId; |
169 return mMailboxId; |
164 } |
170 } |
165 |
171 |
|
172 /*! |
|
173 Called when item is pressed on the view. |
|
174 |
|
175 \param index Index to the pressed item. |
|
176 */ |
|
177 void NmMailboxSettingView::itemPress(const QModelIndex &index) |
|
178 { |
|
179 NM_FUNCTION; |
|
180 |
|
181 int type(index.data(HbDataFormModelItem::ItemTypeRole).toInt()); |
|
182 |
|
183 if (type == HbDataFormModelItem::GroupItem) { |
|
184 // Scroll the groupitem to top if needed. |
|
185 HbDataFormViewItem *item = static_cast<HbDataFormViewItem *>(mForm->itemByIndex(index)); |
|
186 |
|
187 if (!item->isExpanded()) { |
|
188 mForm->scrollTo(index, HbAbstractItemView::PositionAtTop); |
|
189 }else { |
|
190 // Hide the virtual keyboard |
|
191 QInputContext *ic = qApp->inputContext(); |
|
192 if (ic) { |
|
193 QEvent *closeEvent = new QEvent(QEvent::CloseSoftwareInputPanel); |
|
194 ic->filterEvent(closeEvent); |
|
195 delete closeEvent; |
|
196 } |
|
197 } |
|
198 } |
|
199 |
|
200 if (type == HbDataFormModelItem::TextItem) { |
|
201 // Turn off predictive input for line-edit. |
|
202 HbDataFormViewItem *item = static_cast<HbDataFormViewItem *>(mForm->itemByIndex(index)); |
|
203 HbWidget *widget = item->dataItemContentWidget(); |
|
204 widget->setInputMethodHints(Qt::ImhNoPredictiveText); |
|
205 } |
|
206 } |
166 // End of file. |
207 // End of file. |