coreapplicationuis/Rfs/Plugins/cprfsplugin/src/cprfssettingsdataformcustomitem.cpp
equal
deleted
inserted
replaced
25 } |
25 } |
26 |
26 |
27 CpRfsSettingsDataFormCustomItem::~CpRfsSettingsDataFormCustomItem() |
27 CpRfsSettingsDataFormCustomItem::~CpRfsSettingsDataFormCustomItem() |
28 { |
28 { |
29 } |
29 } |
|
30 |
|
31 //overridden method which is required in case of customwidget |
|
32 bool CpRfsSettingsDataFormCustomItem::canSetModelIndex(const QModelIndex &index) const |
|
33 { |
|
34 HbDataFormModelItem::DataItemType itemType = |
|
35 static_cast<HbDataFormModelItem::DataItemType>( |
|
36 index.data(HbDataFormModelItem::ItemTypeRole).toInt()); |
|
37 //each custom item can be represented by customitembase+number and 10 is just in future if u have to add extra custom items |
|
38 if(itemType >= HbDataFormModelItem::CustomItemBase && |
|
39 itemType <= HbDataFormModelItem::CustomItemBase + 10 ) { |
|
40 return true; |
|
41 } |
|
42 return false; |
|
43 |
|
44 } |
|
45 //overridden method which is required in case of customwidget |
|
46 HbAbstractViewItem* CpRfsSettingsDataFormCustomItem::createItem() |
|
47 { |
|
48 return new CpRfsSettingsDataFormCustomItem(*this); |
|
49 } |
|
50 //overridden method which is required in case of customwidget |
|
51 HbWidget* CpRfsSettingsDataFormCustomItem::createCustomWidget() |
|
52 { |
|
53 HbDataFormModelItem::DataItemType itemType = static_cast<HbDataFormModelItem::DataItemType>( |
|
54 modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt()); |
|
55 switch(itemType) |
|
56 { |
|
57 case HbDataFormModelItem::CustomItemBase + 1: |
|
58 { |
|
59 //Create 1st button |
|
60 mButton = new HbPushButton(); |
|
61 mButton->setText(tr("Restore")); |
|
62 return mButton; |
|
63 } |
|
64 case HbDataFormModelItem::CustomItemBase + 2: |
|
65 { |
|
66 //Create 2nd button |
|
67 mButton = new HbPushButton(); |
|
68 mButton->setText(tr("Delete Data and Restore")); |
|
69 return mButton; |
|
70 } |
|
71 //Some other cases can also be added if there are more than 2 custom data item |
|
72 default: |
|
73 return 0; |
|
74 } |
|
75 } |