src/hbwidgets/dataform/hbdataformmodelitem.cpp
branchGCC_SURGE
changeset 15 f378acbc9cfb
parent 6 c3690ec91ef8
child 28 b7da29130b0e
equal deleted inserted replaced
9:730c025d4b77 15:f378acbc9cfb
    21 ** If you have questions regarding the use of this file, please contact
    21 ** If you have questions regarding the use of this file, please contact
    22 ** Nokia at developer.feedback@nokia.com.
    22 ** Nokia at developer.feedback@nokia.com.
    23 **
    23 **
    24 ****************************************************************************/
    24 ****************************************************************************/
    25 
    25 
       
    26 #include "hbdataformmodelitem_p.h"
       
    27 #include "hbdataformmodel_p.h"
       
    28 
       
    29 #include <hbdataformmodelitem.h>
       
    30 #include <hbdataformmodel.h>
       
    31 
    26 #include <QAbstractItemModel>
    32 #include <QAbstractItemModel>
    27 
       
    28 #include "hbdataformmodelitem_p.h"
       
    29 #include "hbdataformmodelitem.h"
       
    30 #include "hbdataformmodel.h"
       
    31 #include "hbdataformmodel_p.h"
       
    32 
       
    33 class QAbstractItemModel;
       
    34 
    33 
    35 
    34 
    36 HbDataFormModelItemPrivate::HbDataFormModelItemPrivate():
    35 HbDataFormModelItemPrivate::HbDataFormModelItemPrivate():
    37     mParentItem(0),
    36     mParentItem(0),
    38     mModel(0),
    37     mModel(0),
    61         HbDataFormModelItem* item = mChildItems.at(index);
    60         HbDataFormModelItem* item = mChildItems.at(index);
    62         HbDataFormModelItemPrivate::d_ptr(item)->setModel(model);         
    61         HbDataFormModelItemPrivate::d_ptr(item)->setModel(model);         
    63     }
    62     }
    64      
    63      
    65 }
    64 }
    66 
    65 void HbDataFormModelItemPrivate::setContentWidgetData(
       
    66     const QString& propertyName ,const QVariant &value)
       
    67 {
       
    68     mProperties.remove(propertyName);
       
    69     mProperties.insert(propertyName,value);
       
    70 }
    67 QAbstractItemModel* HbDataFormModelItemPrivate::model() const
    71 QAbstractItemModel* HbDataFormModelItemPrivate::model() const
    68 {   
    72 {   
    69     return mModel;
    73     return mModel;
    70 }
    74 }
    71 
    75 
    80     For Example if below is the model hierarchy for profiles application
    84     For Example if below is the model hierarchy for profiles application
    81     - general
    85     - general
    82         - ringtone_general
    86         - ringtone_general
    83             - unknowncaller_ringtone_general,
    87             - unknowncaller_ringtone_general,
    84 
    88 
    85     Then sample code to create above model and data it to dataForm  would be,
    89     Then sample code to create above model and data it to data form would be,
    86     
    90     
    87     \code
    91     \code
    88     HbDataForm* form = new HbDataForm();
    92     HbDataForm* form = new HbDataForm();
    89     form->setHeading(QString("Profiles"));
    93     form->setHeading(QString("Profiles"));
    90     form->setDescription(QString("With profiles you can define themes used in different profiles"));
    94     form->setDescription(QString("With profiles you can define themes used in different profiles"));
   102 */
   106 */
   103 
   107 
   104 /*!
   108 /*!
   105     \enum HbDataFormModelItem::Roles
   109     \enum HbDataFormModelItem::Roles
   106 
   110 
   107     This enum defines the Roles supported by dataForm.Any data from application 
   111     This enum defines the Roles supported by dataForm. Any data from application 
   108     can be added through these Roles.
   112     can be added through these Roles.
   109  */
   113  */
   110 
   114 
   111 /*!
   115 /*!
   112     \var HbDataFormModelItem::LabelRole
   116     \var HbDataFormModelItem::LabelRole
   113     LabelRole: This Role is used for data label of the DataFormViewItem
   117     LabelRole: This Role is used for data item label/heading of HbDataFormViewItem.
   114     
   118     
   115  */
   119  */
   116 
   120 
   117 
   121 
   118 /*!
   122 /*!
   119     \var HbDataFormModelItem::ItemTypeRole
   123     \var HbDataFormModelItem::ItemTypeRole
   120     ItemTypeRole: This Role is used for data itemType of the HbDataFormModelItem
   124     ItemTypeRole: This Role is used for data item type of the HbDataFormModelItem
   121     
   125     
   122  */
   126  */
   123 
   127 
   124 /*!
   128 /*!
   125     \var HbDataFormModelItem::PropertyRole
   129     \var HbDataFormModelItem::PropertyRole
   133     is valid only for GroupItem and data items ( > GroupPageItem ).
   137     is valid only for GroupItem and data items ( > GroupPageItem ).
   134     
   138     
   135  */
   139  */
   136 
   140 
   137 /*!
   141 /*!
   138     \var HbDataFormModelItem::DescriptionRole
       
   139     DescriptionRole: This Role will add a description text in model item visualization. This role
       
   140     is valid only for GroupItem and data items ( > GroupPageItem ).
       
   141     
       
   142  */
       
   143 
       
   144 /*!
       
   145     \enum HbDataFormModelItem::DataItemType
   142     \enum HbDataFormModelItem::DataItemType
   146 
   143 
   147     This enum defines itemtypes supported in dataform.
   144     This enum defines itemtypes supported in dataform.
   148     Enum also defines itemtype for custom types.
   145     Enum also defines itemtype for custom types.
   149  */
   146  */
   155     HbDataForm.
   152     HbDataForm.
   156  */
   153  */
   157 
   154 
   158 /*!
   155 /*!
   159     \var HbDataFormModelItem::GroupItem
   156     \var HbDataFormModelItem::GroupItem
   160     GroupItem is used for grouping diffrent group pages or grouping data items under one group
   157     GroupItem is used for grouping different group pages or grouping data items under one group
   161     heading.
   158     heading.
   162  */
   159  */
   163 
   160 
   164 /*!
   161 /*!
   165     \var HbDataFormModelItem::GroupPageItem
   162     \var HbDataFormModelItem::GroupPageItem
   174     SliderItem:  This itemType is for slider type of data item
   171     SliderItem:  This itemType is for slider type of data item
   175     
   172     
   176  */
   173  */
   177 
   174 
   178 /*!
   175 /*!
   179 
       
   180     \var HbDataFormModelItem::VolumeSliderItem
       
   181     VolumeSliderItem:  This itemType is for volume slider type of data item
       
   182     
       
   183  */
       
   184 
       
   185 /*!
       
   186     \var HbDataFormModelItem::CheckBoxItem
   176     \var HbDataFormModelItem::CheckBoxItem
   187     CheckBoxItem:  This itemType is for check box type of data item
   177     CheckBoxItem:  This itemType is for check box type of data item
   188     
   178     
   189  */
   179  */
   190 
   180 
   191 /*!
   181 /*!
   192     \var HbDataFormModelItem::TextItem
   182     \var HbDataFormModelItem::TextItem
   193     TextItem:  This itemType is for text type of data item
   183     TextItem:  This itemType is for text type of data item
   194                The TextItem by default has maximum 4 rows. 
   184                The TextItem by default has maximum 4 rows. 
   195                Application can configure thisvalue using HbLineEdit Property maxRows. 
   185                Application can configure this value using HbLineEdit Property maxRows. 
   196                This Property Value has to be set using SetContentWidgetData API.                
   186                This Property Value has to be set using setContentWidgetData() API.                
   197     
   187     
   198  */
   188  */
   199 
   189 
   200 /*!
   190 /*!
   201     \var HbDataFormModelItem::ToggleValueItem
   191     \var HbDataFormModelItem::ToggleValueItem
   247     \var HbDataFormModelItem::RadioButtonListItem
   237     \var HbDataFormModelItem::RadioButtonListItem
   248     RadioButtonListItem:  This itemType is for radio button list type of data item
   238     RadioButtonListItem:  This itemType is for radio button list type of data item
   249     
   239     
   250     RadioButtonListItem will appear in three display modes
   240     RadioButtonListItem will appear in three display modes
   251 
   241 
   252     automatic : radioButtonList item appear as embedded( inline) if it contains less than four items and 
   242     - Automatic : radioButtonList item appear as embedded( inline) if it contains less than four items and 
   253     if more than three items then selected items are displayed as text on a PushButton and when pushbutton 
   243     if more than three items then selected items are displayed as text on a PushButton and when pushbutton 
   254     clicked it lunches popup. Automatic mode is set as the default mode.
   244     clicked it lunches popup. Automatic mode is set as the default mode.
   255     
   245     
   256     embedded : Application can set these items as always embedded(inline) by setting the property "displayMode" 
   246     - Embedded : Application can set these items as always embedded(inline) by setting the property "displayMode" 
   257     with value of property as "embedded"
   247     with value of property as "embedded"
   258     
   248     
   259     popup : Application can set these items as always popup by setting the property "displayMode" 
   249     - Popup : Application can set these items as always popup by setting the property "displayMode" 
   260     with value of property as "popup"
   250     with value of property as "popup"
   261     HbDataFormModelItem *radioItem = model->appendDataItem(HbDataFormModelItem::RadioButtonListItem, 
   251     HbDataFormModelItem *radioItem = model->appendDataItem(HbDataFormModelItem::RadioButtonListItem, 
   262         QString("Caller Tone"));
   252         QString("Caller Tone"));
   263     radioItem->setContentWidgetData(QString("displayMode"),QString("embedded"));
   253     radioItem->setContentWidgetData(QString("displayMode"),QString("embedded"));
   264     radioItem->setContentWidgetData(QString("displayMode"),QString("automatic"));
   254     radioItem->setContentWidgetData(QString("displayMode"),QString("automatic"));
   270     \var HbDataFormModelItem::MultiselectionItem
   260     \var HbDataFormModelItem::MultiselectionItem
   271     MultiselectionItem:  This itemType is for multi selection type of data item.
   261     MultiselectionItem:  This itemType is for multi selection type of data item.
   272     
   262     
   273     MultiSelectionListItem will appear in three display modes
   263     MultiSelectionListItem will appear in three display modes
   274 
   264 
   275     automatic : radioButtonList item appear as embedded( inline) if it contains less than four items and 
   265     - Automatic : radioButtonList item appear as embedded( inline) if it contains less than four items and 
   276     if more than three items then selected items are displayed as text on a PushButton and when pushbutton 
   266     if more than three items then selected items are displayed as text on a PushButton and when pushbutton 
   277     clicked it lunches popup. Automatic mode is set as the default mode.
   267     clicked it lunches popup. Automatic mode is set as the default mode.
   278     
   268     
   279     embedded : Application can set these items as always embedded(inline) by setting the property "displayMode" 
   269     - Embedded : Application can set these items as always embedded(inline) by setting the property "displayMode" 
   280     with value of property as "embedded"
   270     with value of property as "embedded"
   281     
   271     
   282     popup : Application can set these items as always popup by setting the property "displayMode" 
   272     - Popup : Application can set these items as always popup by setting the property "displayMode" 
   283     with value of property as "popup"
   273     with value of property as "popup"
   284     HbDataFormModelItem *radioItem = model->appendDataItem(HbDataFormModelItem::MultiSelectionListItem, 
   274     HbDataFormModelItem *radioItem = model->appendDataItem(HbDataFormModelItem::MultiSelectionListItem, 
   285         QString("Caller Tone"));
   275         QString("Caller Tone"));
   286     radioItem->setContentWidgetData(QString("displayMode"),QString("embedded"));
   276     radioItem->setContentWidgetData(QString("displayMode"),QString("embedded"));
   287     radioItem->setContentWidgetData(QString("displayMode"),QString("automatic"));
   277     radioItem->setContentWidgetData(QString("displayMode"),QString("automatic"));
   329     HbDataFormModelItem::DataItemType type,const QString &label,
   319     HbDataFormModelItem::DataItemType type,const QString &label,
   330     const HbDataFormModelItem* parent):
   320     const HbDataFormModelItem* parent):
   331     d_ptr(new HbDataFormModelItemPrivate())
   321     d_ptr(new HbDataFormModelItemPrivate())
   332 {
   322 {
   333     Q_D(HbDataFormModelItem);
   323     Q_D(HbDataFormModelItem);
   334     d->q_ptr = this ;
   324     d->q_ptr = this ;  
   335     d->mParentItem = const_cast<HbDataFormModelItem*>(parent);
   325     if( parent ) {
       
   326           d->mParentItem = const_cast<HbDataFormModelItem*>(parent);
       
   327           d->mParentItem->appendChild(this);         
       
   328     }
   336     setData(ItemTypeRole, type);
   329     setData(ItemTypeRole, type);
   337     setData(LabelRole, label);
   330     setData(LabelRole, label);
   338 }
   331 }
   339 
   332 
   340 /*!
   333 /*!
   343 HbDataFormModelItem::HbDataFormModelItem(const HbDataFormModelItem* parent):
   336 HbDataFormModelItem::HbDataFormModelItem(const HbDataFormModelItem* parent):
   344     d_ptr(new HbDataFormModelItemPrivate())
   337     d_ptr(new HbDataFormModelItemPrivate())
   345 {
   338 {
   346     Q_D(HbDataFormModelItem);
   339     Q_D(HbDataFormModelItem);
   347     d->q_ptr = this ;
   340     d->q_ptr = this ;
   348     d->mParentItem = const_cast<HbDataFormModelItem*>(parent);
   341     if( parent ){
       
   342         d->mParentItem = const_cast<HbDataFormModelItem*>(parent);
       
   343         d->mParentItem->appendChild(this);  
       
   344     }
   349 }
   345 }
   350 
   346 
   351 /*!
   347 /*!
   352     Destructor
   348     Destructor
   353 */
   349 */
   365     delete d_ptr;
   361     delete d_ptr;
   366 }
   362 }
   367 
   363 
   368 /*!
   364 /*!
   369     @beta
   365     @beta
       
   366 
   370     Adds the given \a child to the children list of current item.
   367     Adds the given \a child to the children list of current item.
   371 
   368 
   372     \sa insertChild, insertChildren
   369     \sa insertChild, insertChildren
   373 */
   370 */
   374 void HbDataFormModelItem::appendChild(HbDataFormModelItem *child)
   371 void HbDataFormModelItem::appendChild(HbDataFormModelItem *child)
   384             d->mChildItems.append(child);
   381             d->mChildItems.append(child);
   385             model->d_func()->rowsInserted();
   382             model->d_func()->rowsInserted();
   386         }
   383         }
   387         else {
   384         else {
   388             d->mChildItems.append(child);
   385             d->mChildItems.append(child);
   389         }
   386         }        
       
   387 
   390     }
   388     }
   391 }
   389 }
   392 
   390 
   393 /*!
   391 /*!
   394     @beta
   392     @beta
   414     }
   412     }
   415 }
   413 }
   416 
   414 
   417 /*!
   415 /*!
   418     @beta
   416     @beta
       
   417 
   419     Inserts the given list of \a items starting from the given \a row.
   418     Inserts the given list of \a items starting from the given \a row.
   420 
   419 
   421     \sa insertChild, appendChild
   420     \sa insertChild, appendChild
   422 */
   421 */
   423 void HbDataFormModelItem::insertChildren(int row , int count ,
   422 void HbDataFormModelItem::insertChildren(int row , int count ,
   441 
   440 
   442 }
   441 }
   443 
   442 
   444 /*!
   443 /*!
   445     @beta
   444     @beta
       
   445 
   446     Removes the child item at the given \a index. The item at \a index is
   446     Removes the child item at the given \a index. The item at \a index is
   447     deleted.
   447     deleted.
   448 
   448 
   449     \sa removeChildren
   449     \sa removeChildren
   450 */
   450 */
   451 void HbDataFormModelItem::removeChild(int index)
   451 void HbDataFormModelItem::removeChild(int index)
   452 {
   452 {
   453     Q_D(HbDataFormModelItem);
   453     if( ( index < 0 ) || ( index >= childCount() ) ) {
   454 
   454         return;
       
   455     }
       
   456     Q_D(HbDataFormModelItem);
   455     HbDataFormModel* model = static_cast<HbDataFormModel*>(d->mModel);
   457     HbDataFormModel* model = static_cast<HbDataFormModel*>(d->mModel);
   456     if(model) {
   458 
   457         model->d_func()->rowsAboutToBeRemoved(this, index, index);
   459     HbDataFormModelItem *item = d->mChildItems.at(index);
       
   460     if( item ) {
       
   461         int childCount = item->childCount();
       
   462         for ( int childIndex = 0; childIndex < childCount ;childIndex++) {
       
   463             item->removeChild(0); 
       
   464         }
       
   465         if( model ) {
       
   466             model->d_func()->rowsAboutToBeRemoved(this, index, index);
       
   467         }
   458         HbDataFormModelItem *item = d->mChildItems.takeAt(index);
   468         HbDataFormModelItem *item = d->mChildItems.takeAt(index);
   459         if ( item ) {
   469         delete item;
   460             delete item;
   470         item = 0;
   461             item = 0;
   471         if( model ) {
   462         }
   472             model->d_func()->rowsRemoved();
   463         model->d_func()->rowsRemoved();
   473         }
   464     }
   474     }
   465     else {
   475 }
   466         HbDataFormModelItem *item = d->mChildItems.takeAt(index);
   476 
   467         if ( item ) {
   477 /*!
   468             delete item;
   478     @beta
   469             item = 0;
   479 
   470         }
       
   471     }
       
   472    
       
   473 }
       
   474 
       
   475 /*!
       
   476     @beta
       
   477     Removes the given no of \a count of childitems from the given \a startindex. The
   480     Removes the given no of \a count of childitems from the given \a startindex. The
   478     items are deleted.
   481     items are deleted.
   479 
   482 
   480     \sa removeChild
   483     \sa removeChild
   481 */
   484 */
   482 void HbDataFormModelItem::removeChildren(int startIndex, int count)
   485 void HbDataFormModelItem::removeChildren(int startIndex, int count)
   483 {
   486 {
   484      Q_D(HbDataFormModelItem);
   487     if( ( startIndex < 0 ) || ( startIndex > childCount() ) || ( count <= 0 )) {
   485 
   488         return;
   486      HbDataFormModel* model = static_cast<HbDataFormModel*>(d->mModel);
   489     }
   487      model->d_func()->rowsAboutToBeRemoved(this, startIndex, startIndex + count -1); 
   490     
   488      for(int index = 0; index < count ;index++) {
   491     if( startIndex + count > childCount() ) {
   489         HbDataFormModelItem *item = d->mChildItems.takeAt(0);
   492         return;
   490         if ( item ) {
   493     }   
   491             delete item;
   494 
   492             item = 0;
   495     for(int index = 0; index < count ;index++) {
   493         }
   496         removeChild(startIndex);
   494      }
   497     }   
   495      model->d_func()->rowsRemoved();
   498 }
   496 }
   499 
   497 
   500 /*!
   498 /*!
   501     @beta
   499     @beta
   502 
   500     Returns the child item at the given \a index. 
   503     Returns the child item at the given \a index. 
   501     Returns 0 if \a index passed in greater than count or less than 0.
   504     Returns 0 if \a index passed in greater than count or less than 0.
   502 
   505 
   503     \sa indexOf
   506     \sa indexOf
   504 */
   507 */
   511     return 0;
   514     return 0;
   512 }
   515 }
   513 
   516 
   514 /*!
   517 /*!
   515     @beta
   518     @beta
       
   519 
   516     Returns index of the given \a child.
   520     Returns index of the given \a child.
   517 
   521 
   518     \sa childAt
   522     \sa childAt
   519 */
   523 */
   520 int HbDataFormModelItem::indexOf(const HbDataFormModelItem* child) const 
   524 int HbDataFormModelItem::indexOf(const HbDataFormModelItem* child) const 
   534     return d->mChildItems.count();
   538     return d->mChildItems.count();
   535 }
   539 }
   536 
   540 
   537 /*!
   541 /*!
   538     @beta
   542     @beta
       
   543 
   539     Returns the data for the given \a role. Returns empty string if DescriptionRole is queried for
   544     Returns the data for the given \a role. Returns empty string if DescriptionRole is queried for
   540     items other then GroupItem and data item.
   545     items other then GroupItem and data item.
   541 */
   546 */
   542 QVariant HbDataFormModelItem::data(int role ) const
   547 QVariant HbDataFormModelItem::data(int role ) const
   543 {
   548 {
   563     }
   568     }
   564 }
   569 }
   565 
   570 
   566 /*!
   571 /*!
   567     @beta
   572     @beta
       
   573 
   568     Sets the given \a value of variant to the given \a role.
   574     Sets the given \a value of variant to the given \a role.
   569 */
   575 */
   570  void HbDataFormModelItem::setData(int role ,const QVariant &value)
   576  void HbDataFormModelItem::setData(int role ,const QVariant &value)
   571 {
   577 {
   572     Q_D(HbDataFormModelItem);
   578     Q_D(HbDataFormModelItem);
   611     - VolumeSliderItem: HbVolumeSlider property should be used
   617     - VolumeSliderItem: HbVolumeSlider property should be used
   612     - CheckBoxItem: HbCheckBox property should be used
   618     - CheckBoxItem: HbCheckBox property should be used
   613     - TextItem: HbLineEdit property should be used
   619     - TextItem: HbLineEdit property should be used
   614     - ToggleValueItem: HbPushButton(text and additionalText) property should be used
   620     - ToggleValueItem: HbPushButton(text and additionalText) property should be used
   615     - RadioButtonListItem: HbRadioButtonList property should be used
   621     - RadioButtonListItem: HbRadioButtonList property should be used
   616     - MultiselectionItem: HbListDialog property should be used
   622     - MultiselectionItem: HbListWidget property should be used
   617     - ComboBoxItem: HbComboBox property should be used
   623     - ComboBoxItem: HbComboBox property should be used
   618 */
   624 */
   619 void HbDataFormModelItem::setContentWidgetData(
   625 void HbDataFormModelItem::setContentWidgetData(
   620     const QString& propertyName ,const QVariant &value)
   626     const QString& propertyName ,const QVariant &value)
   621 {
   627 {
   622     Q_D(HbDataFormModelItem);
   628     Q_D(HbDataFormModelItem);
   623     d->mProperties.remove(propertyName);
   629     d->setContentWidgetData(propertyName, value);
   624     d->mProperties.insert(propertyName,value);
   630 
   625     d->mDirtyProperty = propertyName;
   631     d->mDirtyProperty = propertyName;
   626 
       
   627     HbDataFormModel *data_model = static_cast<HbDataFormModel*>(d->mModel);
   632     HbDataFormModel *data_model = static_cast<HbDataFormModel*>(d->mModel);
   628     if(data_model) {
   633     if(data_model) {
   629         QModelIndex index = data_model->indexFromItem(this);
   634         QModelIndex index = data_model->indexFromItem(this);
   630         emit data_model->dataChanged(index, index);
   635         emit data_model->dataChanged(index, index);
   631     }
   636     }
   632 }
   637 }
   633 
   638 
   634 /*!
   639 /*!
   635    @beta
   640    @beta
       
   641 
   636    Returns the property  \a value for the given \a propertyName.
   642    Returns the property  \a value for the given \a propertyName.
   637 */
   643 */
   638 QVariant HbDataFormModelItem::contentWidgetData(const QString& propertyName ) const
   644 QVariant HbDataFormModelItem::contentWidgetData(const QString& propertyName ) const
   639 {
   645 {
   640     Q_D(const HbDataFormModelItem);
   646     Q_D(const HbDataFormModelItem);
   641     return d->mProperties.value(propertyName);
   647     return d->mProperties.value(propertyName);
   642 }
   648 }
       
   649 
   643 /*!
   650 /*!
   644    @beta
   651    @beta
       
   652 
   645    Returns all properties with values which was set in HbDataFormModelItem.
   653    Returns all properties with values which was set in HbDataFormModelItem.
   646 */
   654 */
   647 QHash<QString, QVariant> HbDataFormModelItem::contentWidgetData() const
   655 QHash<QString, QVariant> HbDataFormModelItem::contentWidgetData() const
   648 {
   656 {
   649     Q_D(const HbDataFormModelItem);
   657     Q_D(const HbDataFormModelItem);
   650     return d->mProperties;
   658     return d->mProperties;
   651 }
   659 }
       
   660 
   652 /*!
   661 /*!
   653    @beta
   662    @beta
       
   663 
   654    Sets \a parent as a parent to this item.
   664    Sets \a parent as a parent to this item.
   655    It only sets the parent pointer. It doesnt put the item in the 
   665    It only sets the parent pointer. It does not put the item in the 
   656    hierarchy.
   666    hierarchy.
   657 */
   667 */
   658 void HbDataFormModelItem::setParent(HbDataFormModelItem* parent)
   668 void HbDataFormModelItem::setParent(HbDataFormModelItem* parent)
   659 {
   669 {
   660     Q_D(HbDataFormModelItem);
   670     Q_D(HbDataFormModelItem);
   661     d->mParentItem=parent;
   671     d->mParentItem=parent;
   662 }
   672 }
   663 
   673 
   664 /*!
   674 /*!
   665    @beta
   675    @beta
       
   676 
   666    Returns the parent of the this data item.
   677    Returns the parent of the this data item.
   667 */
   678 */
   668 HbDataFormModelItem* HbDataFormModelItem::parent() const
   679 HbDataFormModelItem* HbDataFormModelItem::parent() const
   669 {
   680 {
   670     Q_D(const HbDataFormModelItem);
   681     Q_D(const HbDataFormModelItem);
   671     return d->mParentItem;
   682     return d->mParentItem;
   672 }
   683 }
   673 
   684 
   674 /*!
   685 /*!
   675     @beta
   686     @beta
       
   687 
   676     Sets \a type as a DataItemType for this data item.
   688     Sets \a type as a DataItemType for this data item.
   677 */
   689 */
   678 void HbDataFormModelItem::setType(HbDataFormModelItem::DataItemType type)
   690 void HbDataFormModelItem::setType(HbDataFormModelItem::DataItemType type)
   679 {
   691 {
   680     setData(ItemTypeRole,type);
   692     setData(ItemTypeRole,type);
   681 }
   693 }
   682 
   694 
   683 /*!
   695 /*!
   684     @beta
   696     @beta
       
   697 
   685     Returns the DataItemType of the this item.
   698     Returns the DataItemType of the this item.
   686 */
   699 */
   687 HbDataFormModelItem::DataItemType HbDataFormModelItem::type() const
   700 HbDataFormModelItem::DataItemType HbDataFormModelItem::type() const
   688 {
   701 {
   689     return static_cast<HbDataFormModelItem::DataItemType>(data(ItemTypeRole).toInt());
   702     return static_cast<HbDataFormModelItem::DataItemType>(data(ItemTypeRole).toInt());
   690 }
   703 }
   691 
   704 
   692 /*!
   705 /*!
   693     @beta
   706     @beta
       
   707 
   694     Sets the \a label to the item. This is valid only if the type is other than FormPageItem,
   708     Sets the \a label to the item. This is valid only if the type is other than FormPageItem,
   695     GroupItem and GroupPageItem.
   709     GroupItem and GroupPageItem.
   696 */
   710 */
   697 void HbDataFormModelItem::setLabel(const QString& label)
   711 void HbDataFormModelItem::setLabel(const QString& label)
   698 {
   712 {
   699     setData(LabelRole,label);
   713     setData(LabelRole,label);
   700 }
   714 }
   701 
   715 
   702 /*!
   716 /*!
   703     @beta
   717     @beta
       
   718 
   704     Returns the label of the item.
   719     Returns the label of the item.
   705 */
   720 */
   706 QString HbDataFormModelItem::label() const
   721 QString HbDataFormModelItem::label() const
   707 {
   722 {
   708     return data(LabelRole).toString();
   723     return data(LabelRole).toString();
   709 }
   724 }
   710 
   725 
   711 /*!
   726 /*!
   712     @beta
   727     @beta
       
   728 
   713     Sets the \a icon to the item. This is valid only if the type is other than FormPageItem,
   729     Sets the \a icon to the item. This is valid only if the type is other than FormPageItem,
   714     GroupItem and GroupPageItem.
   730     GroupItem and GroupPageItem.
   715 */
   731 */
   716 void HbDataFormModelItem::setIcon(const QString& icon)
   732 void HbDataFormModelItem::setIcon(const QString& icon)
   717 {
   733 {
   718     setData(Qt::DecorationRole,icon);
   734     setData(Qt::DecorationRole,icon);
   719 }
   735 }
   720 
   736 
   721 /*!
   737 /*!
   722     @beta
   738     @beta
       
   739 
   723     Returns the icon of the item.
   740     Returns the icon of the item.
   724 */
   741 */
   725 QString HbDataFormModelItem::icon() const
   742 QString HbDataFormModelItem::icon() const
   726 {
   743 {
   727     return data(Qt::DecorationRole).toString();
   744     return data(Qt::DecorationRole).toString();
   728 }
   745 }
   729 
   746 
   730 /*
   747 /*!
   731 QHash<QString, QVariant> HbDataFormModelItem::getContentWidgetValues()
   748     @beta
   732 {
   749 
   733     Q_D(const HbDataFormModelItem);
       
   734     return d->mProperties;
       
   735 }*/
       
   736 
       
   737 /*!
       
   738     Sets whether the item is enabled. 
   750     Sets whether the item is enabled. 
   739     
   751     
   740     If enabled is true, the item is \a enabled, meaning that the user can interact with the item
   752     If enabled is true, the item is \a enabled, meaning that the user can interact with the item
   741     if \a enabled is false, the user cannot interact with the item.
   753     if \a enabled is false, the user cannot interact with the item.
   742 */
   754 */
   757         }
   769         }
   758     }
   770     }
   759 }
   771 }
   760 
   772 
   761 /*!
   773 /*!
   762     Returns true if the item is enabled; otherwise returns false.
   774     @beta
       
   775     Returns true if the item is enabled otherwise returns false.
   763 */
   776 */
   764 bool HbDataFormModelItem::isEnabled() const
   777 bool HbDataFormModelItem::isEnabled() const
   765 {
   778 {
   766     Q_D(const HbDataFormModelItem);
   779     Q_D(const HbDataFormModelItem);
   767     return d->mFlags & Qt::ItemIsEnabled;
   780     return d->mFlags & Qt::ItemIsEnabled;
   768 }
   781 }
   769 
   782 
   770 /*!
   783 /*!
       
   784     @beta
   771     Returns item flags for this item.
   785     Returns item flags for this item.
   772 */
   786 */
   773 Qt::ItemFlags HbDataFormModelItem::flags() const
   787 Qt::ItemFlags HbDataFormModelItem::flags() const
   774 {
   788 {
   775     Q_D(const HbDataFormModelItem);
   789     Q_D(const HbDataFormModelItem);
   776     return d->mFlags;
   790     return d->mFlags;
   777 }
   791 }
   778 
   792 
   779 /*!
   793 /*!
   780     @proto
   794     @beta
   781     Sets the \a description to the item. This is valid only if the type is GroupItem or 
   795     Sets the \a description to the item. This is valid only if the type is GroupItem or 
   782         DataItem. Its not valid for GroupPageItem and FormPageItem.
   796         DataItem. Its not valid for GroupPageItem and FormPageItem.
   783 */
   797 */
   784 void HbDataFormModelItem::setDescription(const QString& description)
   798 void HbDataFormModelItem::setDescription(const QString& description)
   785 {
   799 {
   786     setData(DescriptionRole , description);
   800     setData(DescriptionRole , description);
   787 }
   801 }
   788 
   802 
   789 /*!
   803 /*!
   790     @proto
   804     @beta
   791     Returns the description of the item.
   805     Returns the description of the item.
   792 */
   806 */
   793 QString HbDataFormModelItem::description() const
   807 QString HbDataFormModelItem::description() const
   794 {
   808 {
   795     return data(DescriptionRole).toString();
   809     return data(DescriptionRole).toString();