controlpanel/src/cpframework/src/cpdataformbuttonentryviewitem.cpp
changeset 23 7e4c5a2ff1a2
parent 21 851e19007849
child 52 58cebe0861a8
equal deleted inserted replaced
21:851e19007849 23:7e4c5a2ff1a2
   119     
   119     
   120     return 0;
   120     return 0;
   121 }
   121 }
   122 
   122 
   123 /*!
   123 /*!
       
   124     Deprecated. Be instead of HbDataFormViewItem::restore()
   124 	Inherit from HbDataForm. This function is called by hbdataform's framework, 
   125 	Inherit from HbDataForm. This function is called by hbdataform's framework, 
   125 	for supporting to load entry item's text, icon and additional text dynamically.
   126 	for supporting to load entry item's text, icon and additional text dynamically.
   126 	It is not recommanded to call this function mannually.
   127 	It is not recommended to call this function manually.
   127  */
   128  */
   128 void CpDataFormButtonEntryViewItem::load()
   129 void CpDataFormButtonEntryViewItem::load()
   129 {
   130 {
   130 	HbDataFormViewItem::load();
   131 	//HbDataFormViewItem::load();
   131 
   132 
   132 	if (d_ptr->mWidget) {
   133 	if (d_ptr->mWidget) {
   133 		HbDataFormModelItem::DataItemType itemType = static_cast<HbDataFormModelItem::DataItemType>(
   134 		HbDataFormModelItem::DataItemType itemType = static_cast<HbDataFormModelItem::DataItemType>(
   134 			modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt());
   135 			modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt());
   135 
   136 
   150 
   151 
   151 			}
   152 			}
   152 		}
   153 		}
   153 	}
   154 	}
   154 }
   155 }
       
   156 /*!
       
   157     Inherit from HbDataForm. This function is called by hbdataform's framework, 
       
   158     for supporting to load entry item's text, icon and additional text dynamically.
       
   159     It is not recommended to call this function manually.
       
   160  */
       
   161 void CpDataFormButtonEntryViewItem::restore()
       
   162 {
       
   163     HbDataFormViewItem::restore();
       
   164 
       
   165     if (d_ptr->mWidget) {
       
   166         HbDataFormModelItem::DataItemType itemType = static_cast<HbDataFormModelItem::DataItemType>(
       
   167             modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt());
       
   168 
       
   169         if(itemType == CpSettingFormEntryItemData::ButtonEntryItem) {
       
   170 
       
   171             QModelIndex itemIndex = modelIndex();
       
   172             HbDataFormModel *model = static_cast<HbDataFormModel*>(itemView()->model());;
       
   173             HbDataFormModelItem *modelItem = static_cast<HbDataFormModelItem*>(
       
   174                 model->itemFromIndex(itemIndex));
       
   175 
       
   176             const QMetaObject *metaObj = d_ptr->mWidget->metaObject();
       
   177             int count = metaObj->propertyCount();
       
   178             for (int i = 0; i < count; i++) {
       
   179                 QMetaProperty metaProperty = metaObj->property(i);
       
   180                 if (metaProperty.isValid() && metaProperty.isWritable()) {
       
   181                     metaProperty.write(d_ptr->mWidget,modelItem->contentWidgetData(metaProperty.name()));
       
   182                 }
       
   183 
       
   184             }
       
   185         }
       
   186     }
       
   187 }
   155 
   188 
   156 //End of File
   189 //End of File