30 this->setHeading(tr("Restore Factory Settings")); |
30 this->setHeading(tr("Restore Factory Settings")); |
31 |
31 |
32 //initialize the form model |
32 //initialize the form model |
33 initRfsSettingModel(); |
33 initRfsSettingModel(); |
34 |
34 |
35 connect(this, SIGNAL(activated(QModelIndex)),this, SLOT(onItemActivated(QModelIndex))); |
35 connect(this, SIGNAL(itemShown(QModelIndex)),this, SLOT(onItemActivated(QModelIndex))); |
36 } |
36 } |
37 |
37 |
38 CpRfsSettingsForm::~CpRfsSettingsForm() |
38 CpRfsSettingsForm::~CpRfsSettingsForm() |
39 { |
39 { |
40 } |
40 } |
42 void CpRfsSettingsForm::initRfsSettingModel() |
42 void CpRfsSettingsForm::initRfsSettingModel() |
43 { |
43 { |
44 HbDataFormModel *model = new HbDataFormModel(0); |
44 HbDataFormModel *model = new HbDataFormModel(0); |
45 |
45 |
46 // Create the custom items because HbPushButton cannot be added to the HbDataFormModelItem |
46 // Create the custom items because HbPushButton cannot be added to the HbDataFormModelItem |
47 HbDataFormModelItem::DataItemType customItem = static_cast<HbDataFormModelItem::DataItemType>(HbDataFormModelItem::CustomItemBase + 1); |
|
48 |
|
49 mNormalRfs = model->appendDataFormItem(customItem, QString(), model->invisibleRootItem()); |
|
50 mNormalRfs->setData(HbDataFormModelItem::KeyRole, tr("Restore")); |
|
51 |
|
52 HbDataFormModelItem::DataItemType customItem1 = static_cast<HbDataFormModelItem::DataItemType>(HbDataFormModelItem::CustomItemBase + 1); |
47 HbDataFormModelItem::DataItemType customItem1 = static_cast<HbDataFormModelItem::DataItemType>(HbDataFormModelItem::CustomItemBase + 1); |
53 |
48 |
54 mDeepRfs = model->appendDataFormItem(customItem1, QString(), model->invisibleRootItem()); |
49 mNormalRfs = model->appendDataFormItem(customItem1, QString(), model->invisibleRootItem()); |
55 mDeepRfs->setData(HbDataFormModelItem::KeyRole,tr("Delete Data and Restore")); |
50 HbDataFormModelItem::DataItemType customItem2 = static_cast<HbDataFormModelItem::DataItemType>(HbDataFormModelItem::CustomItemBase + 2); |
56 |
51 |
|
52 mDeepRfs = model->appendDataFormItem(customItem2, QString(), model->invisibleRootItem()); |
57 this->setModel(model); |
53 this->setModel(model); |
58 } |
54 } |
59 |
55 |
60 // On Item activated |
56 // On Item activated |
61 void CpRfsSettingsForm::onItemActivated(const QModelIndex &index) |
57 void CpRfsSettingsForm::onItemActivated(const QModelIndex &index) |
63 HbDataFormModelItem *itemData = static_cast<HbDataFormModelItem *> (index.internalPointer()); |
59 HbDataFormModelItem *itemData = static_cast<HbDataFormModelItem *> (index.internalPointer()); |
64 // to deal with orbit change temparialy |
60 // to deal with orbit change temparialy |
65 if (itemData->type() > HbDataFormModelItem::GroupPageItem) |
61 if (itemData->type() > HbDataFormModelItem::GroupPageItem) |
66 { |
62 { |
67 //get the widget of setting item |
63 //get the widget of setting item |
68 HbWidget* widget = this->dataFormViewItem(index)->dataItemContentWidget(); |
64 HbAbstractViewItem* viewitem = static_cast<HbAbstractItemView*>(this)->itemByIndex(index); |
69 |
65 HbWidget* widget =static_cast<HbDataFormViewItem*>(viewitem)->dataItemContentWidget(); |
70 if (itemData == mNormalRfs) |
66 if (itemData == mNormalRfs) |
71 { |
67 { |
72 activateNormalRfs(widget); |
68 activateNormalRfs(widget); |
73 } |
69 } |
74 if (itemData == mDeepRfs) |
70 if (itemData == mDeepRfs) |