emailuis/nmsettingui/src/nmmailboxsettingview.cpp
changeset 59 16ed8d08d0b1
parent 54 997a02608b3a
child 68 83cc6bae1de8
--- a/emailuis/nmsettingui/src/nmmailboxsettingview.cpp	Tue Jul 06 14:04:34 2010 +0300
+++ b/emailuis/nmsettingui/src/nmmailboxsettingview.cpp	Wed Aug 18 09:37:47 2010 +0300
@@ -15,6 +15,8 @@
 *
 */
 
+#include <qinputcontext.h>
+
 #include <hbinstance.h>
 #include <hbmainwindow.h>
 #include <hbaction.h>
@@ -76,6 +78,10 @@
     }
 
     if (mForm) {
+        
+        connect(mForm, SIGNAL(pressed(QModelIndex)),
+                this, SLOT(itemPress(QModelIndex)));
+        
         // Fix for dataform item recycling.
         mForm->setItemRecycling(false);
 
@@ -163,4 +169,39 @@
     return mMailboxId;
 }
 
+/*!
+    Called when item is pressed on the view.
+
+    \param index Index to the pressed item.
+*/
+void NmMailboxSettingView::itemPress(const QModelIndex &index)
+{
+    NM_FUNCTION;
+    
+    int type(index.data(HbDataFormModelItem::ItemTypeRole).toInt());
+    
+    if (type == HbDataFormModelItem::GroupItem) {
+        // Scroll the groupitem to top if needed.
+        HbDataFormViewItem *item = static_cast<HbDataFormViewItem *>(mForm->itemByIndex(index));
+        
+        if (!item->isExpanded()) {
+            mForm->scrollTo(index, HbAbstractItemView::PositionAtTop);
+        }else {
+            // Hide the virtual keyboard
+            QInputContext *ic = qApp->inputContext();
+            if (ic) {
+                QEvent *closeEvent = new QEvent(QEvent::CloseSoftwareInputPanel);
+                ic->filterEvent(closeEvent);
+                delete closeEvent;
+            }
+        }
+    }
+    
+    if (type == HbDataFormModelItem::TextItem) {
+        // Turn off predictive input for line-edit.
+        HbDataFormViewItem *item = static_cast<HbDataFormViewItem *>(mForm->itemByIndex(index));
+        HbWidget *widget = item->dataItemContentWidget();
+        widget->setInputMethodHints(Qt::ImhNoPredictiveText);
+    }
+}
 // End of file.