diff -r 578830873419 -r ecc8def7944a emailuis/nmsettingui/src/nmsettingsformcustomitems.cpp --- a/emailuis/nmsettingui/src/nmsettingsformcustomitems.cpp Fri Apr 16 14:51:52 2010 +0300 +++ b/emailuis/nmsettingui/src/nmsettingsformcustomitems.cpp Mon May 03 12:23:15 2010 +0300 @@ -15,9 +15,14 @@ * */ -#include "nmsettingsformcustomitems.h" +#include +#include +#include +#include +#include +#include -#include +#include "nmsettingsformcustomitems.h" /*! @@ -57,6 +62,29 @@ return type==NmButtonItem; } +/*! + Sets the custom widget's properties from the model item. +*/ +void NmSettingsFormCustomItems::restore() +{ + HbDataFormModelItem::DataItemType itemType = static_cast( + modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt()); + if (itemType==NmButtonItem) { + + HbDataFormModel* model = static_cast + (static_cast(this)->itemView()->model()); + HbDataFormModelItem* modelItem = model->itemFromIndex(modelIndex()); + QHash properties = + modelItem->data(HbDataFormModelItem::PropertyRole).toHash(); + QList propertyNames = properties.keys(); + + for (int index=0; index < propertyNames.count(); index++) { + QString propName = propertyNames.at(index); + dataItemContentWidget()->setProperty(propName.toAscii().data(), + properties.value(propName)); + } + } +} /*! From HbDataFormViewItem. @@ -72,8 +100,7 @@ switch (itemType) { case NmButtonItem: { // Push button. - QString text = modelIndex().data(HbDataFormModelItem::KeyRole).toString(); - widget = new HbPushButton(text); + widget = new HbPushButton(); } default: { break;