controlpanelui/src/cpplugins/volumeplugin/src/cppersonalizationcustomviewitem.cpp
equal
deleted
inserted
replaced
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include "cppersonalizationcustomviewitem.h" |
18 #include "cppersonalizationcustomviewitem.h" |
19 #include "cpmastervolumeslider.h" |
|
20 #include <hbdataformmodelitem.h> |
19 #include <hbdataformmodelitem.h> |
21 #include <hbdataformmodel.h> |
20 #include <hbdataformmodel.h> |
22 #include <hbabstractitemview.h> |
21 #include <hbabstractitemview.h> |
23 #include <QMetaProperty> |
22 #include <QMetaProperty> |
24 #include <hbpushbutton.h> |
23 #include <hbpushbutton.h> |
70 } |
69 } |
71 } |
70 } |
72 |
71 |
73 void CpPersonalizationCustomViewItem::load() |
72 void CpPersonalizationCustomViewItem::load() |
74 { |
73 { |
75 HbDataFormViewItem::load(); |
74 //HbDataFormViewItem::load(); |
76 |
75 |
77 CpVolumeCustomItemType itemType = static_cast<CpVolumeCustomItemType>( |
76 CpVolumeCustomItemType itemType = static_cast<CpVolumeCustomItemType>( |
78 modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt()); |
77 modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt()); |
79 |
78 |
80 if(itemType == SilenceIndicatorItem) { |
79 if(itemType == SilenceIndicatorItem) { |
96 } |
95 } |
97 } |
96 } |
98 } |
97 } |
99 } |
98 } |
100 |
99 |
|
100 void CpPersonalizationCustomViewItem::restore() |
|
101 { |
|
102 HbDataFormViewItem::restore(); |
|
103 |
|
104 CpVolumeCustomItemType itemType = static_cast<CpVolumeCustomItemType>( |
|
105 modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt()); |
|
106 |
|
107 if(itemType == SilenceIndicatorItem) { |
|
108 |
|
109 QModelIndex itemIndex = modelIndex(); |
|
110 HbDataFormModel *model = static_cast<HbDataFormModel*>(itemView()->model());; |
|
111 HbDataFormModelItem *modelItem = static_cast<HbDataFormModelItem*>( |
|
112 model->itemFromIndex(itemIndex)); |
|
113 |
|
114 |
|
115 if (mWidget != 0) { |
|
116 const QMetaObject *metaObj = mWidget->metaObject(); |
|
117 int count = metaObj->propertyCount(); |
|
118 for (int i = 0; i < count; i++) { |
|
119 QMetaProperty metaProperty = metaObj->property(i); |
|
120 if (metaProperty.isValid() && metaProperty.isWritable()) { |
|
121 metaProperty.write(mWidget,modelItem->contentWidgetData(metaProperty.name())); |
|
122 } |
|
123 } |
|
124 } |
|
125 } |
|
126 } |
|
127 |
101 |
128 |
102 void CpPersonalizationCustomViewItem::store() |
129 void CpPersonalizationCustomViewItem::store() |
103 { |
130 { |
104 HbDataFormViewItem::store(); |
131 //HbDataFormViewItem::store(); |
105 |
132 |
106 CpVolumeCustomItemType itemType = static_cast<CpVolumeCustomItemType>( |
133 CpVolumeCustomItemType itemType = static_cast<CpVolumeCustomItemType>( |
107 modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt()); |
134 modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt()); |
108 |
135 |
109 if(itemType == SilenceIndicatorItem) { |
136 if(itemType == SilenceIndicatorItem) { |