deviceupdatesui/deviceupdates/src/settingsdataformcustomitem.cpp
changeset 18 7d11f9a6646f
child 21 c707676bf59f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deviceupdatesui/deviceupdates/src/settingsdataformcustomitem.cpp	Fri Apr 16 14:53:31 2010 +0300
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  This class provides custom list item for the
+ * DataForm
+ *
+ */
+
+#include <settingsdataformcustomitem.h>
+#include <hbdataformmodelitem.h>
+#include <hblineedit.h>
+#include <hbinputeditorinterface.h>
+#include <qgraphicslinearlayout.h>
+#include <hblabel.h>
+
+SettingsDataFormCustomItem::SettingsDataFormCustomItem(QGraphicsItem *parent) :
+HbDataFormViewItem(parent)
+{
+}
+
+SettingsDataFormCustomItem::~SettingsDataFormCustomItem()
+{
+}
+
+HbAbstractViewItem* SettingsDataFormCustomItem::createItem()
+{
+    return new SettingsDataFormCustomItem(*this);
+}
+
+HbWidget* SettingsDataFormCustomItem::createCustomWidget()
+{
+    HbDataFormModelItem::DataItemType itemType =
+    static_cast<HbDataFormModelItem::DataItemType> 
+    ( modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt() );    
+    switch (itemType)
+    {
+      case HbDataFormModelItem::CustomItemBase :
+            {             
+            HbLineEdit* mLineEdit = new HbLineEdit();
+            mLineEdit->setText(QString("8080"));
+            HbEditorInterface editorInterface(mLineEdit);
+            editorInterface.setInputMode(HbInputModeNumeric); 
+            editorInterface.setConstraints(HbEditorConstraintFixedInputMode);            
+            return mLineEdit;            
+            }                
+        default:
+            return 0;
+    }
+}