emailuis/nmsettingui/src/nmsettingsformcustomitems.cpp
changeset 43 99bcbff212ad
parent 20 ecc8def7944a
child 68 83cc6bae1de8
equal deleted inserted replaced
42:139d4b7b2938 43:99bcbff212ad
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:
    14 * Description:
    15 *
    15 *
    16 */
    16 */
       
    17 
       
    18 #include "emailtrace.h"
    17 
    19 
    18 #include <QModelIndex>
    20 #include <QModelIndex>
    19 #include <HbPushButton>
    21 #include <HbPushButton>
    20 #include <HbAbstractViewItem>
    22 #include <HbAbstractViewItem>
    21 #include <HbDataFormModel>
    23 #include <HbDataFormModel>
    35     Class constructor.
    37     Class constructor.
    36 */
    38 */
    37 NmSettingsFormCustomItems::NmSettingsFormCustomItems(QGraphicsItem *parent)
    39 NmSettingsFormCustomItems::NmSettingsFormCustomItems(QGraphicsItem *parent)
    38 : HbDataFormViewItem(parent)
    40 : HbDataFormViewItem(parent)
    39 {
    41 {
       
    42     NM_FUNCTION;
    40 }
    43 }
    41 
    44 
    42 
    45 
    43 /*!
    46 /*!
    44     Class destructor.
    47     Class destructor.
    45 */
    48 */
    46 NmSettingsFormCustomItems::~NmSettingsFormCustomItems()
    49 NmSettingsFormCustomItems::~NmSettingsFormCustomItems()
    47 {
    50 {
       
    51     NM_FUNCTION;
    48 }
    52 }
    49 
    53 
    50 
    54 
    51 /*!
    55 /*!
    52     From HbDataFormViewItem.
    56     From HbDataFormViewItem.
    53 */
    57 */
    54 HbAbstractViewItem *NmSettingsFormCustomItems::createItem()
    58 HbAbstractViewItem *NmSettingsFormCustomItems::createItem()
    55 {
    59 {
       
    60     NM_FUNCTION;
       
    61     
    56     return new NmSettingsFormCustomItems(*this);
    62     return new NmSettingsFormCustomItems(*this);
    57 }
    63 }
    58 
    64 
    59 bool NmSettingsFormCustomItems::canSetModelIndex(const QModelIndex &index) const
    65 bool NmSettingsFormCustomItems::canSetModelIndex(const QModelIndex &index) const
    60 {
    66 {
       
    67     NM_FUNCTION;
       
    68     
    61     int type(index.data(HbDataFormModelItem::ItemTypeRole).toInt());
    69     int type(index.data(HbDataFormModelItem::ItemTypeRole).toInt());
    62     return type==NmButtonItem;
    70     return type==NmButtonItem;
    63 }
    71 }
    64 
    72 
    65 /*!
    73 /*!
    66     Sets the custom widget's properties from the model item.
    74     Sets the custom widget's properties from the model item.
    67 */
    75 */
    68 void NmSettingsFormCustomItems::restore()
    76 void NmSettingsFormCustomItems::restore()
    69 {
    77 {
       
    78     NM_FUNCTION;
       
    79     
    70     HbDataFormModelItem::DataItemType itemType = static_cast<HbDataFormModelItem::DataItemType>(
    80     HbDataFormModelItem::DataItemType itemType = static_cast<HbDataFormModelItem::DataItemType>(
    71         modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt());
    81         modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt());
    72      if (itemType==NmButtonItem) {
    82      if (itemType==NmButtonItem) {
    73 
    83 
    74          HbDataFormModel* model = static_cast<HbDataFormModel*>
    84          HbDataFormModel* model = static_cast<HbDataFormModel*>
    89 /*!
    99 /*!
    90     From HbDataFormViewItem.
   100     From HbDataFormViewItem.
    91 */
   101 */
    92 HbWidget *NmSettingsFormCustomItems::createCustomWidget()
   102 HbWidget *NmSettingsFormCustomItems::createCustomWidget()
    93 {
   103 {
       
   104     NM_FUNCTION;
       
   105     
    94     HbDataFormModelItem::DataItemType itemType =
   106     HbDataFormModelItem::DataItemType itemType =
    95         static_cast<HbDataFormModelItem::DataItemType>(
   107         static_cast<HbDataFormModelItem::DataItemType>(
    96             modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt());
   108             modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt());
    97 
   109 
    98     HbWidget *widget = 0;
   110     HbWidget *widget = 0;