|
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 QT UI for WEP configuration |
|
16 * |
|
17 */ |
|
18 |
|
19 /* |
|
20 * %version: 2 % |
|
21 */ |
|
22 |
|
23 |
|
24 //User Includes |
|
25 #include "cpwepplugin.h" |
|
26 #include "cpwepui.h" |
|
27 |
|
28 // System includes |
|
29 #include <cpitemdatahelper.h> |
|
30 #include <cmconnectionmethod_shim.h> |
|
31 #include <cmmanagerdefines_shim.h> |
|
32 #include <HbTranslator> |
|
33 |
|
34 //Trace Definition |
|
35 #include "OstTraceDefinitions.h" |
|
36 #ifdef OST_TRACE_COMPILER_IN_USE |
|
37 #include "cpweppluginTraces.h" |
|
38 #endif |
|
39 |
|
40 /*! |
|
41 \class CpWepPlugin |
|
42 \brief CpWepPlugin implements the WEP Security Settings Control Panel Plugin |
|
43 which allows viewing/editing of WEP Security Settings. CpWepPlugin class |
|
44 implements only interface to Control Panel, while the actual viewing/editing |
|
45 is implemented by CpWepUi class. |
|
46 */ |
|
47 |
|
48 // External function prototypes |
|
49 |
|
50 // Local constants |
|
51 |
|
52 //The order in which WEP only mode appears in the list of available |
|
53 //security mode |
|
54 static const int UI_ORDER_WEP = 10; |
|
55 |
|
56 Q_EXPORT_PLUGIN2(CpWepUi, CpWepPlugin); |
|
57 |
|
58 |
|
59 // ======== LOCAL FUNCTIONS ======== |
|
60 |
|
61 |
|
62 // ======== MEMBER FUNCTIONS ======== |
|
63 |
|
64 /*! |
|
65 Contructs WEP plugin class |
|
66 */ |
|
67 CpWepPlugin::CpWepPlugin() : |
|
68 mTranslator(new HbTranslator("cpwlansecsettingsplugin")), |
|
69 mCmCM(NULL), |
|
70 mCmId(0) |
|
71 { |
|
72 OstTrace0( TRACE_BORDER, DUP1_CPWEPPLUGIN_CPWEPPLUGIN, "CpWepPlugin::CpWepPlugin - create CpWepPlugin" ); |
|
73 // Nothing is required |
|
74 } |
|
75 |
|
76 /*! |
|
77 Destructs WEP plugin class |
|
78 */ |
|
79 CpWepPlugin::~CpWepPlugin() |
|
80 { |
|
81 OstTrace0( TRACE_BORDER, CPWEPPLUGIN_CPWEPPLUGIN, "CpWepPlugin::~CpWepPlugin - destroy CpWepPlugin" ); |
|
82 |
|
83 // mCmCM is owned by CmManager and is not therefore |
|
84 // deleted. |
|
85 |
|
86 // mTranslator is protected by QScopedPointer and |
|
87 // is implicitly destroyed. |
|
88 } |
|
89 |
|
90 /*! |
|
91 Getter for security mode. |
|
92 |
|
93 \return Security mode identifier |
|
94 */ |
|
95 CMManagerShim::WlanSecMode CpWepPlugin::securityMode() const |
|
96 { |
|
97 OstTrace0( TRACE_BORDER, CPWEPPLUGIN_SECURITYMODE, "CpWepPlugin::securityMode - get security mode" ); |
|
98 |
|
99 //return security mode |
|
100 return CMManagerShim::WlanSecModeWep; |
|
101 } |
|
102 |
|
103 /*! |
|
104 Getter for localization text identifier for the security mode, |
|
105 f.ex. "txt_occ_setlabel_wlan_security_mode_val_wep". This localized |
|
106 text will be shown in the UI. |
|
107 |
|
108 \return Localization text ID |
|
109 */ |
|
110 QString CpWepPlugin::securityModeTextId() const |
|
111 { |
|
112 OstTrace0( TRACE_BORDER, CPWEPPLUGIN_SECURITYMODETEXTID, "CpWepPlugin::securityModeTextId - get security mode text" ); |
|
113 |
|
114 return "txt_occ_setlabel_wlan_security_mode_val_wep"; |
|
115 } |
|
116 |
|
117 /*! |
|
118 Sets the database reference. |
|
119 |
|
120 \param cmCM Handle to CM |
|
121 \param id Connection method ID |
|
122 */ |
|
123 void CpWepPlugin::setReference(CmConnectionMethodShim *cmCm, uint id) |
|
124 { |
|
125 OstTraceExt2( TRACE_BORDER, CPWEPPLUGIN_SETREFERENCE, "CpWepPlugin::setReference - set database reference;cmCm=%p;id=%u", cmCm, id ); |
|
126 |
|
127 mCmId = id; |
|
128 |
|
129 //mCmCM is not deleted assuming CmManager owns it. |
|
130 mCmCM = cmCm; |
|
131 } |
|
132 |
|
133 /*! |
|
134 Getter for order number. This order number is used by the client of |
|
135 this interface to put the security modes in correct order in the list. |
|
136 |
|
137 \return An order number |
|
138 */ |
|
139 int CpWepPlugin::orderNumber() const |
|
140 { |
|
141 OstTrace0( TRACE_BORDER, CPWEPPLUGIN_ORDERNUMBER, "CpWepPlugin::orderNumber - get order number" ); |
|
142 |
|
143 return UI_ORDER_WEP; |
|
144 } |
|
145 |
|
146 /*! |
|
147 Returns the fully constructed Ui Group , for WEP security plugin |
|
148 |
|
149 \param dataHelper for adding connections |
|
150 |
|
151 \return The WEP UI |
|
152 */ |
|
153 CpSettingFormItemData* CpWepPlugin::uiInstance(CpItemDataHelper &dataHelper) |
|
154 { |
|
155 OstTraceExt1( TRACE_BORDER, CPWEPPLUGIN_UIINSTANCE, "CpWepPlugin::uiInstance - entry;mCmCM=%p", mCmCM ); |
|
156 |
|
157 CpSettingFormItemData* ui = new CpWepUi(&dataHelper, mCmCM ); |
|
158 |
|
159 OstTraceExt1( TRACE_BORDER, DUP1_CPWEPPLUGIN_UIINSTANCE, "CpWepPlugin::uiInstance - exit;ui=%p", ui ); |
|
160 |
|
161 // Ownership of the ui moved to the caller |
|
162 return ui; |
|
163 } |
|
164 |
|
165 |