|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0"" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Control Panel "Network Settings" view implementation. |
|
16 * |
|
17 */ |
|
18 |
|
19 // System includes |
|
20 #include <QtCore> |
|
21 #include <HbDataForm> |
|
22 #include <HbDataFormModel> |
|
23 #include <cpplugininterface.h> |
|
24 #include <cppluginutility.h> |
|
25 #include <cpsettingformitemdata.h> |
|
26 #include <cpitemdatahelper.h> |
|
27 |
|
28 // User includes |
|
29 #include "cpipsettingsview.h" |
|
30 |
|
31 /*! |
|
32 \class CpIpSettingsView |
|
33 \brief Class implements the "Network Settings" Control Panel view. |
|
34 */ |
|
35 |
|
36 // External function prototypes |
|
37 |
|
38 // Local constants |
|
39 static const QString ipSettingsPlugins[] = { |
|
40 "cpwlansettingsplugin.qtplugin", |
|
41 "cpdestinationplugin.qtplugin", |
|
42 "videosettingsplugin.qtplugin", |
|
43 "cpvpnmanagementplugin.qtplugin", |
|
44 "" // empty item terminates the list |
|
45 }; |
|
46 |
|
47 // ======== LOCAL FUNCTIONS ======== |
|
48 |
|
49 // ======== MEMBER FUNCTIONS ======== |
|
50 |
|
51 /*! |
|
52 Constructor. |
|
53 */ |
|
54 CpIpSettingsView::CpIpSettingsView(QGraphicsItem *parent) : |
|
55 CpBaseSettingView(0, parent) |
|
56 { |
|
57 HbDataForm *form = new HbDataForm(); |
|
58 this->setWidget(form); |
|
59 form->setHeading(hbTrId("txt_occ_subhead_network_settings")); |
|
60 CpPluginUtility::addCpItemPrototype(form); |
|
61 HbDataFormModel *model = new HbDataFormModel(form); |
|
62 |
|
63 // The parameter given as 0 is a HbDataForm pointer, not parent |
|
64 mItemDataHelper = new CpItemDataHelper(0); |
|
65 mItemDataHelper->setParent(this); |
|
66 |
|
67 HbDataFormModelItem *modelItem; |
|
68 CpPluginInterface *plugin = NULL; |
|
69 QDir pluginsDir("\\resource\\qt\\plugins\\controlpanel"); |
|
70 QPluginLoader pluginLoader; |
|
71 |
|
72 // Load listed child plugins |
|
73 for (int i = 0; !ipSettingsPlugins[i].isEmpty(); i++) { |
|
74 pluginLoader.setFileName(pluginsDir.absoluteFilePath(ipSettingsPlugins[i])); |
|
75 plugin = qobject_cast<CpPluginInterface *>(pluginLoader.instance()); |
|
76 if (plugin) { |
|
77 QList<CpSettingFormItemData*> formDataItemList = |
|
78 plugin->createSettingFormItemData(*mItemDataHelper); |
|
79 for (int j = 0; j < formDataItemList.count(); j++) { |
|
80 modelItem = formDataItemList.at(j); |
|
81 if (modelItem) { |
|
82 model->appendDataFormItem(modelItem); |
|
83 } |
|
84 } |
|
85 } |
|
86 } |
|
87 |
|
88 mItemDataHelper->bindToForm(form); |
|
89 form->setModel(model); |
|
90 } |
|
91 |
|
92 /*! |
|
93 Destructor. |
|
94 */ |
|
95 CpIpSettingsView::~CpIpSettingsView() |
|
96 { |
|
97 } |