|
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: tr1cfwln#18 % |
|
21 */ |
|
22 |
|
23 #ifndef CPWEPUI_H |
|
24 #define CPWEPUI_H |
|
25 |
|
26 // System includes |
|
27 #include <cpsettingformitemdata.h> |
|
28 #include <QStringList> |
|
29 #include <HbMessageBox> |
|
30 #include <cpwlansecurityplugininterface.h> |
|
31 |
|
32 //User Includes |
|
33 |
|
34 // Forward declarations |
|
35 class CmConnectionMethodShim; |
|
36 class HbTranslator; |
|
37 class WepKeyValidator; |
|
38 |
|
39 //Constant declarations |
|
40 //!Maximum Number of Keys for WEP |
|
41 static const int KMaxNumberofKeys = 4; |
|
42 |
|
43 /*! |
|
44 * Implements WEP plugin for Wlan security control panel |
|
45 */ |
|
46 |
|
47 // Class declaration |
|
48 class CpWepUi : public QObject, public CpWlanSecurityPluginInterface |
|
49 { |
|
50 Q_OBJECT |
|
51 Q_INTERFACES(CpWlanSecurityPluginInterface) |
|
52 |
|
53 public: |
|
54 CpWepUi(); |
|
55 ~CpWepUi(); |
|
56 |
|
57 public: |
|
58 // from CpWlanSecurityPluginInterface |
|
59 |
|
60 CMManagerShim::WlanSecMode securityMode() const; |
|
61 |
|
62 QString securityModeTextId() const; |
|
63 |
|
64 void setReference(CmConnectionMethodShim *cmCm, uint id); |
|
65 |
|
66 int orderNumber() const; |
|
67 |
|
68 CpSettingFormItemData* uiInstance(CpItemDataHelper &dataHelper); |
|
69 |
|
70 bool validateSettings(); |
|
71 |
|
72 private: |
|
73 |
|
74 enum WEPKeyFormat |
|
75 { |
|
76 EFormatHex, EFormatAscii, |
|
77 }; |
|
78 |
|
79 private: |
|
80 |
|
81 void loadFieldsFromDataBase(); |
|
82 |
|
83 void wepKeyTextChanged(int index); |
|
84 |
|
85 bool tryUpdate(); |
|
86 |
|
87 void handleUpdateError(); |
|
88 |
|
89 void showMessageBox(HbMessageBox::MessageBoxType type, |
|
90 const QString &text); |
|
91 |
|
92 void updateWepSettings(); |
|
93 |
|
94 void commitWEPkeys(int index); |
|
95 |
|
96 void createWEPKeyOneGroup(CpItemDataHelper &dataHelpper); |
|
97 |
|
98 void createWEPKeyTwoGroup(CpItemDataHelper &dataHelpper); |
|
99 |
|
100 void createWEPKeyThreeGroup(CpItemDataHelper &dataHelpper); |
|
101 |
|
102 void createWEPKeyFourGroup(CpItemDataHelper &dataHelpper); |
|
103 |
|
104 void storeWEPKey(CMManagerShim::ConnectionMethodAttribute enumValue,QString& key); |
|
105 |
|
106 void setKeyFormat(QString& key,int index); |
|
107 |
|
108 CMManagerShim::ConnectionMethodAttribute getWEPKeyEnum(int index); |
|
109 |
|
110 void createWEPKeyGroup(int index); |
|
111 |
|
112 void addConnections(CpItemDataHelper &dataHelpper); |
|
113 |
|
114 private slots: |
|
115 |
|
116 void wepKeyInUseChanged(int index); |
|
117 |
|
118 void wepKeyOneChanged(); |
|
119 |
|
120 void wepKeyTwoChanged(); |
|
121 |
|
122 void wepKeyThreeChanged(); |
|
123 |
|
124 void wepKeyFourChanged(); |
|
125 |
|
126 void setEditorPreferences(const QModelIndex &modelIndex); |
|
127 |
|
128 private: |
|
129 |
|
130 Q_DISABLE_COPY(CpWepUi) |
|
131 |
|
132 //!WEP security group item |
|
133 CpSettingFormItemData* mUi; |
|
134 |
|
135 //! Store strings of WEP keys |
|
136 QStringList mKeyData; |
|
137 |
|
138 //! WEP keys item |
|
139 CpSettingFormItemData *mWepKey[KMaxNumberofKeys]; |
|
140 |
|
141 //! WEP keys text item |
|
142 CpSettingFormItemData *mWepKeyText[KMaxNumberofKeys]; |
|
143 |
|
144 //!Store the index of the current key in use |
|
145 int mNewKeySelected; |
|
146 |
|
147 //!Translator for all the localisation Text Id's |
|
148 HbTranslator* mTranslator; |
|
149 |
|
150 //!Connection Settings Shim connection method pointer |
|
151 CmConnectionMethodShim *mCmCM; |
|
152 |
|
153 //! Connection method Id |
|
154 int mCmId; |
|
155 |
|
156 //! Message box for info notes |
|
157 QSharedPointer<HbMessageBox> mMessageBox; |
|
158 |
|
159 //! Store Formats of WEP keys |
|
160 WEPKeyFormat mkeyFormat[KMaxNumberofKeys]; |
|
161 |
|
162 CpItemDataHelper* mItemDataHelper; |
|
163 |
|
164 |
|
165 |
|
166 }; |
|
167 |
|
168 /*! @} */ |
|
169 |
|
170 #endif //CPWEPUI_H |