18 // System includes |
18 // System includes |
19 #include <QtCore> |
19 #include <QtCore> |
20 #include <HbDataForm> |
20 #include <HbDataForm> |
21 #include <HbDataFormModel> |
21 #include <HbDataFormModel> |
22 #include <cpplugininterface.h> |
22 #include <cpplugininterface.h> |
|
23 #include <cppluginutility.h> |
23 #include <cpsettingformitemdata.h> |
24 #include <cpsettingformitemdata.h> |
24 #include <cpitemdatahelper.h> |
25 #include <cpitemdatahelper.h> |
25 |
26 |
26 // User includes |
27 // User includes |
27 #include "cpipsettingsview.h" |
28 #include "cpipsettingsview.h" |
49 Constructor. |
50 Constructor. |
50 */ |
51 */ |
51 CpIpSettingsView::CpIpSettingsView(QGraphicsItem *parent) : |
52 CpIpSettingsView::CpIpSettingsView(QGraphicsItem *parent) : |
52 CpBaseSettingView(0, parent) |
53 CpBaseSettingView(0, parent) |
53 { |
54 { |
54 HbDataForm *form = settingForm(); |
55 HbDataForm *form = new HbDataForm(); |
55 if (form) { |
56 this->setWidget(form); |
56 HbDataFormModelItem *modelItem; |
57 CpPluginUtility::addCpItemPrototype(form); |
57 CpPluginInterface *plugin = NULL; |
58 HbDataFormModel *model = new HbDataFormModel(form); |
58 QDir pluginsDir("\\resource\\qt\\plugins\\controlpanel"); |
|
59 QPluginLoader pluginLoader; |
|
60 |
59 |
61 HbDataFormModel *model = new HbDataFormModel; |
60 // The parameter given as 0 is a HbDataForm pointer, not parent |
62 |
61 mItemDataHelper = new CpItemDataHelper(0); |
63 mItemDataHelper = new CpItemDataHelper(); |
62 mItemDataHelper->setParent(this); |
64 mItemDataHelper->setParent(this); |
63 |
|
64 HbDataFormModelItem *modelItem; |
|
65 CpPluginInterface *plugin = NULL; |
|
66 QDir pluginsDir("\\resource\\qt\\plugins\\controlpanel"); |
|
67 QPluginLoader pluginLoader; |
65 |
68 |
66 // Load listed child plugins |
69 // Load listed child plugins |
67 for (int i = 0; !ipSettingsPlugins[i].isEmpty(); i++) { |
70 for (int i = 0; !ipSettingsPlugins[i].isEmpty(); i++) { |
68 pluginLoader.setFileName(pluginsDir.absoluteFilePath(ipSettingsPlugins[i])); |
71 pluginLoader.setFileName(pluginsDir.absoluteFilePath(ipSettingsPlugins[i])); |
69 plugin = qobject_cast<CpPluginInterface *>(pluginLoader.instance()); |
72 plugin = qobject_cast<CpPluginInterface *>(pluginLoader.instance()); |
70 if (plugin) { |
73 if (plugin) { |
71 QList<CpSettingFormItemData*> formDataItemList = |
74 QList<CpSettingFormItemData*> formDataItemList = |
72 plugin->createSettingFormItemData(*mItemDataHelper); |
75 plugin->createSettingFormItemData(*mItemDataHelper); |
73 for (int j = 0; j < formDataItemList.count(); j++) { |
76 for (int j = 0; j < formDataItemList.count(); j++) { |
74 modelItem = formDataItemList.at(j); |
77 modelItem = formDataItemList.at(j); |
75 if (modelItem) { |
78 if (modelItem) { |
76 model->appendDataFormItem(modelItem); |
79 model->appendDataFormItem(modelItem); |
77 } |
|
78 } |
80 } |
79 } |
81 } |
80 } |
82 } |
|
83 } |
81 |
84 |
82 form->setModel(model); |
85 mItemDataHelper->bindToForm(form); |
83 model->setParent(form); |
86 form->setModel(model); |
84 mItemDataHelper->bindToForm(form); |
|
85 } |
|
86 } |
87 } |
87 |
88 |
88 /*! |
89 /*! |
89 Destructor. |
90 Destructor. |
90 */ |
91 */ |