deviceupdatesui/deviceupdates/src/settingsdataformcustomitem.cpp
changeset 33 7464c1e21dae
child 36 9eefb50e711a
equal deleted inserted replaced
2:a5fecba4b1e4 33:7464c1e21dae
       
     1 /*
       
     2  * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:  This class provides custom list item for the
       
    15  * DataForm
       
    16  *
       
    17  */
       
    18 
       
    19 #include <settingsdataformcustomitem.h>
       
    20 #include <hbdataformmodelitem.h>
       
    21 #include <hblineedit.h>
       
    22 #include <hbinputeditorinterface.h>
       
    23 #include <QGraphicsLinearLayout.h>
       
    24 #include <hblabel.h>
       
    25 SettingsDataFormCustomItem::SettingsDataFormCustomItem(QGraphicsItem *parent) :
       
    26 HbDataFormViewItem(parent)
       
    27 {
       
    28 }
       
    29 
       
    30 SettingsDataFormCustomItem::~SettingsDataFormCustomItem()
       
    31 {
       
    32 }
       
    33 
       
    34 HbAbstractViewItem* SettingsDataFormCustomItem::createItem()
       
    35 {
       
    36     return new SettingsDataFormCustomItem(*this);
       
    37 }
       
    38 
       
    39 HbWidget* SettingsDataFormCustomItem::createCustomWidget()
       
    40 {
       
    41     HbDataFormModelItem::DataItemType itemType =
       
    42     static_cast<HbDataFormModelItem::DataItemType> 
       
    43     ( modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt() );    
       
    44     switch (itemType)
       
    45     {
       
    46       case HbDataFormModelItem::CustomItemBase :
       
    47             {             
       
    48             HbLineEdit* mLineEdit = new HbLineEdit();
       
    49             mLineEdit->setText(QString("8080"));
       
    50             HbEditorInterface editorInterface(mLineEdit);
       
    51             editorInterface.setInputMode(HbInputModeNumeric); 
       
    52             editorInterface.setConstraints(HbEditorConstraintFixedInputMode);            
       
    53             return mLineEdit;            
       
    54             }                
       
    55         default:
       
    56             return 0;
       
    57     }
       
    58 }