messagingapp/msgsettings/msgsettingsplugin.deprecated/src/msgsettingsdataformcustomitem.cpp
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 27 e4592d119491
child 37 518b245aa84c
child 79 2981cb3aa489
equal deleted inserted replaced
23:238255e8b033 25:84d9eb65b26f
     1 /*
       
     2  * Copyright (c) 2009 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 <msgsettingsdataformcustomitem.h>
       
    20 #include <hbdataformmodelitem.h>
       
    21 #include <hbpushbutton.h>
       
    22 
       
    23 MsgSettingsDataFormCustomItem::MsgSettingsDataFormCustomItem(QGraphicsItem *parent) :
       
    24 HbDataFormViewItem(parent)
       
    25 {
       
    26 }
       
    27 
       
    28 MsgSettingsDataFormCustomItem::~MsgSettingsDataFormCustomItem()
       
    29 {
       
    30 }
       
    31 
       
    32 HbAbstractViewItem* MsgSettingsDataFormCustomItem::createItem()
       
    33 {
       
    34     return new MsgSettingsDataFormCustomItem(*this);
       
    35 }
       
    36 
       
    37 HbWidget* MsgSettingsDataFormCustomItem::createCustomWidget()
       
    38 {
       
    39     HbDataFormModelItem::DataItemType itemType =
       
    40     static_cast<HbDataFormModelItem::DataItemType> 
       
    41     ( modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt() );
       
    42     
       
    43     switch (itemType)
       
    44     {
       
    45       case HbDataFormModelItem::CustomItemBase + 1:
       
    46             { 
       
    47             //custom button
       
    48             QString str =
       
    49                     modelIndex().data(HbDataFormModelItem::KeyRole).toString();
       
    50             HbPushButton *button = new HbPushButton(str);
       
    51     
       
    52             return button;
       
    53             }
       
    54         default:
       
    55             return 0;
       
    56     }
       
    57 }