author | hgs |
Fri, 06 Aug 2010 19:11:03 +0300 | |
changeset 52 | bbe4544dfd31 |
parent 44 | a0c4ceac30d0 |
permissions | -rw-r--r-- |
20
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0"" |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* Control Panel packet data AP advanced settings view implementation. |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
* |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
*/ |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
|
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
// System includes |
30 | 20 |
#include <QHostAddress> |
21 |
#include <HbCheckBox> |
|
22 |
#include <HbLineEdit> |
|
23 |
#include <HbDataFormViewItem> |
|
24 |
#include <HbWidget> |
|
25 |
#include <HbEditorInterface> |
|
26 |
#include <HbUrlFilter> |
|
27 |
#include <HbInputDialog> |
|
20
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
#include <HbDataForm> |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
29 |
#include <HbDataFormModel> |
30 | 30 |
#include <cmconnectionmethod_shim.h> |
31 |
#include <cmmanagerdefines_shim.h> |
|
20
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
32 |
#include <cpsettingformitemdata.h> |
30 | 33 |
#include <etelpckt.h> |
20
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
34 |
|
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
35 |
// User includes |
30 | 36 |
#include "cpipv4filter.h" |
37 |
#include "cpipv6filter.h" |
|
20
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
38 |
#include "cppacketdataapadvancedview.h" |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
39 |
|
30 | 40 |
#include "OstTraceDefinitions.h" |
41 |
#ifdef OST_TRACE_COMPILER_IN_USE |
|
42 |
#include "cppacketdataapadvancedviewTraces.h" |
|
43 |
#endif |
|
44 |
||
20
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
45 |
/*! |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
46 |
\class CpPacketDataApAdvancedView |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
47 |
\brief Implements the advanced settings view for packet data bearer |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
48 |
access points. |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
49 |
*/ |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
50 |
|
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
51 |
// External function prototypes |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
52 |
|
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
53 |
// Local constants |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
54 |
|
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
55 |
// ======== LOCAL FUNCTIONS ======== |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
56 |
|
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
57 |
// ======== MEMBER FUNCTIONS ======== |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
58 |
|
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
59 |
/*! |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
60 |
Constructor. |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
61 |
*/ |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
62 |
CpPacketDataApAdvancedView::CpPacketDataApAdvancedView( |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
63 |
CmConnectionMethodShim *cmConnectionMethod, |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
64 |
QGraphicsItem *parent) : |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
65 |
CpBaseSettingView(0, parent), |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
66 |
mForm(0), |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
67 |
mModel(0), |
30 | 68 |
mCmConnectionMethod(cmConnectionMethod), |
69 |
mIpGroup(0), |
|
70 |
mNetworkType(0), |
|
71 |
mIpv4Automatic(0), |
|
72 |
mIpv4Address(0), |
|
73 |
mIpv4DnsAutomatic(0), |
|
74 |
mIpv4DnsAddress1(0), |
|
75 |
mIpv4DnsAddress2(0), |
|
76 |
mIpv6DnsAutomatic(0), |
|
77 |
mIpv6DnsAddress1(0), |
|
78 |
mIpv6DnsAddress2(0), |
|
79 |
mProxyGroup(0), |
|
80 |
mProxyServer(0), |
|
81 |
mProxyPort(0), |
|
82 |
mMessageBox(0), |
|
83 |
mIpv6Supported(false), |
|
84 |
mCurrentNetworkType(NetworkTypeIpv4) |
|
20
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
85 |
{ |
30 | 86 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CPPACKETDATAAPADVANCEDVIEW_ENTRY); |
87 |
||
88 |
// Construct packet data AP advanced settings UI |
|
28 | 89 |
mForm = new HbDataForm(); |
90 |
this->setWidget(mForm); |
|
91 |
mModel = new HbDataFormModel(mForm); |
|
92 |
mForm->setModel(mModel); |
|
30 | 93 |
|
94 |
mIpv6Supported = mCmConnectionMethod->getBoolAttribute( |
|
95 |
CMManagerShim::CmIPv6Supported); |
|
96 |
||
28 | 97 |
// Add advanced settings groups |
98 |
createAdvancedSettings(); |
|
30 | 99 |
|
100 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CPPACKETDATAAPADVANCEDVIEW_EXIT); |
|
20
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
101 |
} |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
102 |
|
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
103 |
/*! |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
104 |
Destructor. |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
105 |
*/ |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
106 |
CpPacketDataApAdvancedView::~CpPacketDataApAdvancedView() |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
107 |
{ |
30 | 108 |
OstTraceFunctionEntry0(DUP1_CPPACKETDATAAPADVANCEDVIEW_CPPACKETDATAAPADVANCEDVIEW_ENTRY); |
109 |
||
110 |
OstTraceFunctionExit0(DUP1_CPPACKETDATAAPADVANCEDVIEW_CPPACKETDATAAPADVANCEDVIEW_EXIT); |
|
111 |
} |
|
112 |
||
113 |
/*! |
|
114 |
Creates all advanced settings groups. |
|
115 |
*/ |
|
116 |
void CpPacketDataApAdvancedView::createAdvancedSettings() |
|
117 |
{ |
|
118 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CREATEADVANCEDSETTINGS_ENTRY); |
|
119 |
||
120 |
// Create settings groups |
|
121 |
createIpGroup(); |
|
122 |
createProxyGroup(); |
|
123 |
||
124 |
// Read values and update UI |
|
125 |
updateIpGroup(); |
|
126 |
updateProxyGroup(); |
|
127 |
||
128 |
// Connect signal to initialize settings item widgets |
|
129 |
bool status = connect( |
|
130 |
mForm, |
|
131 |
SIGNAL(itemShown(const QModelIndex)), |
|
132 |
this, |
|
133 |
SLOT(setEditorPreferences(const QModelIndex))); |
|
134 |
Q_ASSERT(status); |
|
135 |
||
136 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CREATEADVANCEDSETTINGS_EXIT); |
|
137 |
} |
|
138 |
||
139 |
/*! |
|
140 |
Creates the IP settings group. |
|
141 |
*/ |
|
142 |
void CpPacketDataApAdvancedView::createIpGroup() |
|
143 |
{ |
|
144 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CREATEIPGROUP_ENTRY); |
|
145 |
||
146 |
// IP settings group |
|
147 |
mIpGroup = new CpSettingFormItemData( |
|
148 |
HbDataFormModelItem::GroupItem, |
|
149 |
hbTrId("txt_occ_subhead_ip_settings")); |
|
150 |
mModel->appendDataFormItem(mIpGroup); |
|
151 |
||
152 |
if (mIpv6Supported) { |
|
153 |
// IPv6 supported |
|
154 |
// Network type |
|
155 |
mNetworkType = new CpSettingFormItemData( |
|
156 |
HbDataFormModelItem::ComboBoxItem, |
|
157 |
hbTrId("txt_occ_setlabel_network_type")); |
|
158 |
QStringList networkTypeList; |
|
159 |
networkTypeList |
|
160 |
<< hbTrId("txt_occ_setlabel_network_type_val_ipv4") |
|
161 |
<< hbTrId("txt_occ_setlabel_network_type_val_ipv6"); |
|
162 |
mNetworkType->setContentWidgetData("items", networkTypeList); |
|
163 |
mForm->addConnection( |
|
164 |
mNetworkType, |
|
165 |
SIGNAL(currentIndexChanged(int)), |
|
166 |
this, |
|
167 |
SLOT(changeNetworkType(int))); |
|
44 | 168 |
mNetworkType->setContentWidgetData("objectName", "networkTypeCB"); |
30 | 169 |
mIpGroup->appendChild(mNetworkType); |
170 |
||
171 |
mCurrentNetworkType = getNetworkType(); |
|
172 |
if (mCurrentNetworkType == NetworkTypeIpv4) { |
|
173 |
// IPv4 |
|
174 |
createIpv4SettingItems(); |
|
175 |
} else { |
|
176 |
// IPv6 |
|
177 |
createIpv6SettingItems(); |
|
178 |
} |
|
179 |
} else { |
|
180 |
// IPv6 not supported, create IPv4 settings items |
|
181 |
createIpv4SettingItems(); |
|
182 |
} |
|
183 |
||
184 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CREATEIPGROUP_EXIT); |
|
185 |
} |
|
186 |
||
187 |
/*! |
|
188 |
Reads attribute values and updates the IP settings group. |
|
189 |
*/ |
|
190 |
void CpPacketDataApAdvancedView::updateIpGroup() |
|
191 |
{ |
|
192 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_UPDATEIPGROUP_ENTRY); |
|
193 |
||
194 |
// Network type |
|
195 |
if (mNetworkType) { |
|
196 |
// Every time update is called we check if network type (IPv4/IPv6) |
|
197 |
// has changed and update items on UI if necessary. |
|
198 |
||
199 |
// Get network type from CommsDat |
|
200 |
NetworkType newNetworkType = getNetworkType(); |
|
201 |
if (newNetworkType != mCurrentNetworkType) { |
|
202 |
// Network type has changed, update UI |
|
203 |
if (newNetworkType == NetworkTypeIpv6) { |
|
204 |
// IPv4 -> IPv6 |
|
205 |
deleteIpv4SettingItems(); |
|
206 |
createIpv6SettingItems(); |
|
207 |
} else { |
|
208 |
// IPv6 -> IPv4 |
|
209 |
deleteIpv6SettingItems(); |
|
210 |
createIpv4SettingItems(); |
|
211 |
} |
|
212 |
mCurrentNetworkType = newNetworkType; |
|
213 |
} |
|
214 |
mNetworkType->setContentWidgetData("currentIndex", newNetworkType); |
|
215 |
} |
|
216 |
||
217 |
// Phone IP address (IPv4) |
|
218 |
// "Automatic" checkbox |
|
219 |
if (mIpv4Automatic) { |
|
220 |
bool ipAddressFromServer = mCmConnectionMethod->getBoolAttribute( |
|
221 |
CMManagerShim::PacketDataIPAddrFromServer); |
|
222 |
Qt::CheckState state = Qt::Unchecked; |
|
223 |
if (ipAddressFromServer) { |
|
224 |
state = Qt::Checked; |
|
225 |
} |
|
226 |
mIpv4Automatic->setContentWidgetData("checkState", state); |
|
227 |
||
228 |
// Enable/disable user defined IP address fields |
|
229 |
enableIpv4AddressFields(state); |
|
230 |
} |
|
231 |
||
232 |
// Phone IP address (IPv4) |
|
233 |
if (mIpv4Address) { |
|
234 |
QString string = getIpAddress(CMManagerShim::CmIPAddress); |
|
235 |
mIpv4Address->setContentWidgetData("text", string); |
|
236 |
} |
|
237 |
||
238 |
// IPv4 DNS addresses |
|
239 |
// "Automatic" checkbox |
|
240 |
if (mIpv4DnsAutomatic) { |
|
241 |
Qt::CheckState state = Qt::Unchecked; |
|
242 |
if (mCmConnectionMethod->getBoolAttribute( |
|
243 |
CMManagerShim::CmIPDNSAddrFromServer)) { |
|
244 |
state = Qt::Checked; |
|
245 |
} |
|
246 |
mIpv4DnsAutomatic->setContentWidgetData("checkState", state); |
|
247 |
||
248 |
// Enable/disable user defined DNS address fields |
|
249 |
enableIpv4DnsFields(state); |
|
250 |
} |
|
251 |
||
252 |
// IPv4 primary DNS address |
|
253 |
if (mIpv4DnsAddress1) { |
|
254 |
QString string = getIpAddress(CMManagerShim::CmIPNameServer1); |
|
255 |
mIpv4DnsAddress1->setContentWidgetData("text", string); |
|
256 |
} |
|
257 |
||
258 |
// IPv4 secondary DNS address |
|
259 |
if (mIpv4DnsAddress2) { |
|
260 |
QString string = getIpAddress(CMManagerShim::CmIPNameServer2); |
|
261 |
mIpv4DnsAddress2->setContentWidgetData("text", string); |
|
262 |
} |
|
263 |
||
264 |
// IPv6 DNS addresses |
|
265 |
// Automatic/well-known/user defined combobox |
|
266 |
if (mIpv6DnsAutomatic) { |
|
267 |
uint type = getIpv6DnsType(); |
|
268 |
mIpv6DnsAutomatic->setContentWidgetData("currentIndex", type); |
|
269 |
||
270 |
// Enable/disable user defined DNS address fields |
|
271 |
enableIpv6DnsFields(type); |
|
272 |
} |
|
273 |
||
274 |
// IPv6 primary DNS address |
|
275 |
if (mIpv6DnsAddress1) { |
|
276 |
QString string = getIpAddress(CMManagerShim::CmIP6NameServer1); |
|
277 |
mIpv6DnsAddress1->setContentWidgetData("text", string); |
|
278 |
} |
|
279 |
||
280 |
// IPv6 secondary DNS address |
|
281 |
if (mIpv6DnsAddress2) { |
|
282 |
QString string = getIpAddress(CMManagerShim::CmIP6NameServer2); |
|
283 |
mIpv6DnsAddress2->setContentWidgetData("text", string); |
|
284 |
} |
|
285 |
||
286 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_UPDATEIPGROUP_EXIT); |
|
287 |
} |
|
288 |
||
289 |
/*! |
|
290 |
Creates the IPv4 setting items. |
|
291 |
*/ |
|
292 |
void CpPacketDataApAdvancedView::createIpv4SettingItems() |
|
293 |
{ |
|
294 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CREATEIPV4SETTINGITEMS_ENTRY); |
|
295 |
||
296 |
// Phone IP address |
|
297 |
// "Automatic" checkbox |
|
298 |
mIpv4Automatic = new CpSettingFormItemData( |
|
299 |
HbDataFormModelItem::CheckBoxItem, |
|
300 |
hbTrId("txt_occ_setlabel_phone_ip_address")); |
|
301 |
mIpv4Automatic->setContentWidgetData( |
|
302 |
"text", |
|
303 |
hbTrId("txt_occ_setlabel_val_automatic")); |
|
304 |
mForm->addConnection( |
|
305 |
mIpv4Automatic, |
|
306 |
SIGNAL(stateChanged(int)), |
|
307 |
this, |
|
308 |
SLOT(changeIpv4AddressMode(int))); |
|
44 | 309 |
mIpv4Automatic->setContentWidgetData("objectName", "ipv4AutomaticCB"); |
30 | 310 |
mIpGroup->appendChild(mIpv4Automatic); |
311 |
||
312 |
// Phone IP address |
|
313 |
mIpv4Address = new CpSettingFormItemData( |
|
314 |
HbDataFormModelItem::TextItem, |
|
315 |
hbTrId("txt_occ_setlabel_phone_ip_address")); |
|
316 |
mForm->addConnection( |
|
317 |
mIpv4Address, |
|
318 |
SIGNAL(editingFinished()), |
|
319 |
this, |
|
320 |
SLOT(changeIpv4Address())); |
|
44 | 321 |
mIpv4Address->setContentWidgetData("objectName", "ipv4AddressEdit"); |
30 | 322 |
mIpGroup->appendChild(mIpv4Address); |
323 |
||
324 |
// DNS addresses |
|
325 |
// "Automatic" checkbox |
|
326 |
mIpv4DnsAutomatic = new CpSettingFormItemData( |
|
327 |
HbDataFormModelItem::CheckBoxItem, |
|
328 |
hbTrId("txt_occ_setlabel_dns_addresses")); |
|
329 |
mIpv4DnsAutomatic->setContentWidgetData( |
|
330 |
"text", |
|
331 |
hbTrId("txt_occ_setlabel_val_automatic")); |
|
332 |
mForm->addConnection( |
|
333 |
mIpv4DnsAutomatic, |
|
334 |
SIGNAL(stateChanged(int)), |
|
335 |
this, |
|
336 |
SLOT(changeIpv4DnsMode(int))); |
|
44 | 337 |
mIpv4DnsAutomatic->setContentWidgetData("objectName", "ipv4DnsAutomaticCB"); |
30 | 338 |
mIpGroup->appendChild(mIpv4DnsAutomatic); |
339 |
||
340 |
// Primary DNS address |
|
341 |
mIpv4DnsAddress1 = new CpSettingFormItemData( |
|
342 |
HbDataFormModelItem::TextItem, |
|
343 |
hbTrId("txt_occ_setlabel_primary_name_server")); |
|
344 |
mForm->addConnection( |
|
345 |
mIpv4DnsAddress1, |
|
346 |
SIGNAL(editingFinished()), |
|
347 |
this, |
|
348 |
SLOT(changeIpv4PrimaryDnsAddress())); |
|
44 | 349 |
mIpv4DnsAddress1->setContentWidgetData("objectName", "ipv4DnsAddress1Edit"); |
30 | 350 |
mIpGroup->appendChild(mIpv4DnsAddress1); |
351 |
||
352 |
// Secondary DNS address |
|
353 |
mIpv4DnsAddress2 = new CpSettingFormItemData( |
|
354 |
HbDataFormModelItem::TextItem, |
|
355 |
hbTrId("txt_occ_setlabel_secondary_name_server")); |
|
356 |
mForm->addConnection( |
|
357 |
mIpv4DnsAddress2, |
|
358 |
SIGNAL(editingFinished()), |
|
359 |
this, |
|
360 |
SLOT(changeIpv4SecondaryDnsAddress())); |
|
44 | 361 |
mIpv4DnsAddress2->setContentWidgetData("objectName", "ipv4DnsAddress2Edit"); |
30 | 362 |
mIpGroup->appendChild(mIpv4DnsAddress2); |
363 |
||
364 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CREATEIPV4SETTINGITEMS_EXIT); |
|
365 |
} |
|
366 |
||
367 |
/*! |
|
368 |
Deletes the IPv4 setting items. |
|
369 |
*/ |
|
370 |
void CpPacketDataApAdvancedView::deleteIpv4SettingItems() |
|
371 |
{ |
|
372 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_DELETEIPV4SETTINGITEMS_ENTRY); |
|
373 |
||
374 |
// Phone IP address |
|
375 |
// "Automatic" checkbox |
|
376 |
if (mIpv4Automatic) { |
|
377 |
mIpGroup->removeChild(mIpGroup->indexOf(mIpv4Automatic)); |
|
378 |
mIpv4Automatic = NULL; |
|
379 |
} |
|
380 |
||
381 |
// Phone IP address |
|
382 |
if (mIpv4Address) { |
|
383 |
mIpGroup->removeChild(mIpGroup->indexOf(mIpv4Address)); |
|
384 |
mIpv4Address = NULL; |
|
385 |
} |
|
386 |
||
387 |
// DNS addresses |
|
388 |
// "Automatic" checkbox |
|
389 |
if (mIpv4DnsAutomatic) { |
|
390 |
mIpGroup->removeChild(mIpGroup->indexOf(mIpv4DnsAutomatic)); |
|
391 |
mIpv4DnsAutomatic = NULL; |
|
392 |
} |
|
393 |
||
394 |
// Primary DNS address |
|
395 |
if (mIpv4DnsAddress1) { |
|
396 |
mIpGroup->removeChild(mIpGroup->indexOf(mIpv4DnsAddress1)); |
|
397 |
mIpv4DnsAddress1 = NULL; |
|
398 |
} |
|
399 |
||
400 |
// Secondary DNS address |
|
401 |
if (mIpv4DnsAddress2) { |
|
402 |
mIpGroup->removeChild(mIpGroup->indexOf(mIpv4DnsAddress2)); |
|
403 |
mIpv4DnsAddress2 = NULL; |
|
404 |
} |
|
405 |
||
406 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_DELETEIPV4SETTINGITEMS_EXIT); |
|
407 |
} |
|
408 |
||
409 |
/*! |
|
410 |
Creates the IPv6 setting items. |
|
411 |
*/ |
|
412 |
void CpPacketDataApAdvancedView::createIpv6SettingItems() |
|
413 |
{ |
|
414 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CREATEIPV6SETTINGITEMS_ENTRY); |
|
415 |
||
416 |
// DNS addresses |
|
417 |
// Automatic/well-known/user defined combobox |
|
418 |
mIpv6DnsAutomatic = new CpSettingFormItemData( |
|
419 |
HbDataFormModelItem::ComboBoxItem, |
|
420 |
hbTrId("txt_occ_setlabel_dns_addresses")); |
|
421 |
QStringList dnsModeList; |
|
422 |
// Order of the list must match the Ipv6DnsType enum |
|
423 |
dnsModeList |
|
424 |
<< hbTrId("txt_occ_setlabel_val_automatic") |
|
425 |
<< hbTrId("txt_occ_setlabel_dns_addresses_val_wellknown") |
|
426 |
<< hbTrId("txt_occ_setlabel_dns_addresses_val_user_defined"); |
|
427 |
mIpv6DnsAutomatic->setContentWidgetData("items", dnsModeList); |
|
428 |
mForm->addConnection( |
|
429 |
mIpv6DnsAutomatic, |
|
430 |
SIGNAL(currentIndexChanged(int)), |
|
431 |
this, |
|
432 |
SLOT(changeIpv6DnsMode(int))); |
|
44 | 433 |
mIpv6DnsAutomatic->setContentWidgetData("objectName", "ipv6DnsAutomaticCB"); |
30 | 434 |
mIpGroup->appendChild(mIpv6DnsAutomatic); |
435 |
||
436 |
// Primary DNS address |
|
437 |
mIpv6DnsAddress1 = new CpSettingFormItemData( |
|
438 |
HbDataFormModelItem::TextItem, |
|
439 |
hbTrId("txt_occ_setlabel_primary_name_server")); |
|
440 |
mForm->addConnection( |
|
441 |
mIpv6DnsAddress1, |
|
442 |
SIGNAL(editingFinished()), |
|
443 |
this, |
|
444 |
SLOT(changeIpv6PrimaryDnsAddress())); |
|
44 | 445 |
mIpv6DnsAddress1->setContentWidgetData("objectName", "ipv6DnsAddress1Edit"); |
30 | 446 |
mIpGroup->appendChild(mIpv6DnsAddress1); |
447 |
||
448 |
// Secondary DNS address |
|
449 |
mIpv6DnsAddress2 = new CpSettingFormItemData( |
|
450 |
HbDataFormModelItem::TextItem, |
|
451 |
hbTrId("txt_occ_setlabel_secondary_name_server")); |
|
452 |
mForm->addConnection( |
|
453 |
mIpv6DnsAddress2, |
|
454 |
SIGNAL(editingFinished()), |
|
455 |
this, |
|
44 | 456 |
SLOT(changeIpv6SecondaryDnsAddress())); |
457 |
mIpv6DnsAddress2->setContentWidgetData("objectName", "ipv6DnsAddress2Edit"); |
|
30 | 458 |
mIpGroup->appendChild(mIpv6DnsAddress2); |
459 |
||
460 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CREATEIPV6SETTINGITEMS_EXIT); |
|
461 |
} |
|
462 |
||
463 |
/*! |
|
464 |
Deletes the IPv6 setting items. |
|
465 |
*/ |
|
466 |
void CpPacketDataApAdvancedView::deleteIpv6SettingItems() |
|
467 |
{ |
|
468 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_DELETEIPV6SETTINGITEMS_ENTRY); |
|
469 |
||
470 |
// DNS addresses |
|
471 |
// Automatic/well-known/user defined combobox |
|
472 |
if (mIpv6DnsAutomatic) { |
|
473 |
mIpGroup->removeChild(mIpGroup->indexOf(mIpv6DnsAutomatic)); |
|
474 |
mIpv6DnsAutomatic = NULL; |
|
475 |
} |
|
476 |
||
477 |
// Primary DNS address |
|
478 |
if (mIpv6DnsAddress1) { |
|
479 |
mIpGroup->removeChild(mIpGroup->indexOf(mIpv6DnsAddress1)); |
|
480 |
mIpv6DnsAddress1 = NULL; |
|
481 |
} |
|
482 |
||
483 |
// Secondary DNS address |
|
484 |
if (mIpv6DnsAddress2) { |
|
485 |
mIpGroup->removeChild(mIpGroup->indexOf(mIpv6DnsAddress2)); |
|
486 |
mIpv6DnsAddress2 = NULL; |
|
487 |
} |
|
488 |
||
489 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_DELETEIPV6SETTINGITEMS_EXIT); |
|
490 |
} |
|
491 |
||
492 |
/*! |
|
493 |
Creates the proxy settings group. |
|
494 |
*/ |
|
495 |
void CpPacketDataApAdvancedView::createProxyGroup() |
|
496 |
{ |
|
497 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CREATEPROXYGROUP_ENTRY); |
|
498 |
||
499 |
// Proxy settings group |
|
500 |
mProxyGroup = new CpSettingFormItemData( |
|
501 |
HbDataFormModelItem::GroupItem, |
|
502 |
hbTrId("txt_occ_subhead_proxy_settings")); |
|
503 |
mModel->appendDataFormItem(mProxyGroup); |
|
504 |
||
505 |
// Proxy server address |
|
506 |
mProxyServer = new CpSettingFormItemData( |
|
507 |
HbDataFormModelItem::TextItem, |
|
508 |
hbTrId("txt_occ_setlabel_proxy_server_address")); |
|
509 |
mForm->addConnection( |
|
510 |
mProxyServer, |
|
511 |
SIGNAL(editingFinished()), |
|
512 |
this, |
|
513 |
SLOT(changeProxyServer())); |
|
44 | 514 |
mProxyServer->setContentWidgetData("objectName", "proxyServerEdit"); |
30 | 515 |
mProxyGroup->appendChild(mProxyServer); |
516 |
||
517 |
// Proxy port number |
|
518 |
mProxyPort = new CpSettingFormItemData( |
|
519 |
HbDataFormModelItem::TextItem, |
|
520 |
hbTrId("txt_occ_setlabel_proxy_port_number")); |
|
521 |
mForm->addConnection( |
|
522 |
mProxyPort, |
|
523 |
SIGNAL(editingFinished()), |
|
524 |
this, |
|
525 |
SLOT(changeProxyPort())); |
|
44 | 526 |
mProxyPort->setContentWidgetData("objectName", "proxyPortEdit"); |
30 | 527 |
mProxyGroup->appendChild(mProxyPort); |
528 |
||
529 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CREATEPROXYGROUP_EXIT); |
|
530 |
} |
|
531 |
||
532 |
/*! |
|
533 |
Reads attribute values and updates the proxy settings group. |
|
534 |
*/ |
|
535 |
void CpPacketDataApAdvancedView::updateProxyGroup() |
|
536 |
{ |
|
537 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_UPDATEPROXYGROUP_ENTRY); |
|
538 |
||
539 |
// Proxy server address |
|
540 |
QString serverAddress = mCmConnectionMethod->getStringAttribute( |
|
541 |
CMManagerShim::CmProxyServerName); |
|
542 |
mProxyServer->setContentWidgetData("text", serverAddress); |
|
543 |
||
544 |
// Proxy port number |
|
545 |
uint portNumber = mCmConnectionMethod->getIntAttribute( |
|
546 |
CMManagerShim::CmProxyPortNumber); |
|
547 |
if (portNumber > 0) { |
|
548 |
mProxyPort->setContentWidgetData("text", QVariant(portNumber)); |
|
549 |
} else { |
|
550 |
mProxyPort->setContentWidgetData("text", ""); |
|
551 |
} |
|
552 |
||
553 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_UPDATEPROXYGROUP_EXIT); |
|
554 |
} |
|
555 |
||
556 |
/*! |
|
557 |
Reads network type (IPv4/IPv6) from CommsDat. |
|
558 |
*/ |
|
559 |
CpPacketDataApAdvancedView::NetworkType CpPacketDataApAdvancedView::getNetworkType() |
|
560 |
{ |
|
561 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_GETNETWORKTYPE_ENTRY); |
|
562 |
||
563 |
uint networkType = mCmConnectionMethod->getIntAttribute( |
|
564 |
CMManagerShim::PacketDataPDPType); |
|
565 |
||
566 |
if (networkType == RPacketContext::EPdpTypeIPv6) { |
|
567 |
OstTraceFunctionExit0(DUP1_CPPACKETDATAAPADVANCEDVIEW_GETNETWORKTYPE_EXIT); |
|
568 |
return NetworkTypeIpv6; |
|
569 |
} |
|
570 |
||
571 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_GETNETWORKTYPE_EXIT); |
|
572 |
return NetworkTypeIpv4; |
|
573 |
} |
|
574 |
||
575 |
/*! |
|
576 |
Reads an IP address from CommsDat with given attribute. If string is |
|
577 |
empty, a zero address (0.0.0.0 or 0:0:0:0:0:0:0:0) is returned. |
|
578 |
*/ |
|
579 |
QString CpPacketDataApAdvancedView::getIpAddress( |
|
580 |
CMManagerShim::ConnectionMethodAttribute attribute) |
|
581 |
{ |
|
582 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_GETIPADDRESS_ENTRY); |
|
583 |
||
584 |
QString ipAddress = mCmConnectionMethod->getStringAttribute(attribute); |
|
585 |
||
586 |
if (ipAddress.isEmpty()) { |
|
587 |
// String is empty, return a zero address instead |
|
588 |
switch (attribute) { |
|
589 |
case CMManagerShim::CmIPAddress: |
|
590 |
case CMManagerShim::CmIPNameServer1: |
|
591 |
case CMManagerShim::CmIPNameServer2: |
|
592 |
// IPv4 address |
|
593 |
ipAddress = CMManagerShim::UnspecifiedIpv4Address; |
|
594 |
break; |
|
595 |
||
596 |
case CMManagerShim::CmIP6NameServer1: |
|
597 |
case CMManagerShim::CmIP6NameServer2: |
|
598 |
// IPv6 address |
|
599 |
ipAddress = CMManagerShim::DynamicIpv6Address; |
|
600 |
break; |
|
601 |
} |
|
602 |
} |
|
603 |
||
604 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_GETIPADDRESS_EXIT); |
|
605 |
return ipAddress; |
|
606 |
} |
|
607 |
||
608 |
/*! |
|
609 |
Resolves IPv6 DNS address type. |
|
610 |
*/ |
|
611 |
CpPacketDataApAdvancedView::Ipv6DnsType CpPacketDataApAdvancedView::getIpv6DnsType() |
|
612 |
{ |
|
613 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_GETIPV6DNSTYPE_ENTRY); |
|
614 |
||
615 |
// Read "DNS address from server" flag |
|
616 |
bool dnsAddressFromServer = mCmConnectionMethod->getBoolAttribute( |
|
617 |
CMManagerShim::CmIP6DNSAddrFromServer); |
|
618 |
||
619 |
// Read IPv6 DNS addresses from CommsDat |
|
620 |
QString primaryAddress = mCmConnectionMethod->getStringAttribute( |
|
621 |
CMManagerShim::CmIP6NameServer1); |
|
622 |
QString secondaryAddress = mCmConnectionMethod->getStringAttribute( |
|
623 |
CMManagerShim::CmIP6NameServer2); |
|
624 |
||
625 |
// Resolve IPv6 DNS address type |
|
626 |
Ipv6DnsType type = Ipv6DnsTypeUserDefined; |
|
627 |
if (dnsAddressFromServer) { |
|
628 |
// Automatic |
|
629 |
type = Ipv6DnsTypeAutomatic; |
|
630 |
} else if (primaryAddress.toLower() == CMManagerShim::KnownIpv6NameServer1 |
|
631 |
&& secondaryAddress.toLower() == CMManagerShim::KnownIpv6NameServer2) { |
|
632 |
// Well-known IPv6 DNS addresses |
|
633 |
type = Ipv6DnsTypeWellKnown; |
|
634 |
} |
|
635 |
||
636 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_GETIPV6DNSTYPE_EXIT); |
|
637 |
return type; |
|
638 |
} |
|
639 |
||
640 |
/*! |
|
641 |
Sets IPv4 address field enabled/disabled. |
|
642 |
*/ |
|
643 |
void CpPacketDataApAdvancedView::enableIpv4AddressFields(int state) |
|
644 |
{ |
|
645 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_ENABLEIPV4ADDRESSFIELDS_ENTRY); |
|
646 |
||
647 |
if (state == Qt::Checked) { |
|
648 |
// Automatic, disable text field |
|
649 |
if (mIpv4Address) { |
|
650 |
mIpv4Address->setEnabled(false); |
|
651 |
} |
|
652 |
} else { |
|
653 |
// User defined, enable text field |
|
654 |
if (mIpv4Address) { |
|
655 |
mIpv4Address->setEnabled(true); |
|
656 |
} |
|
657 |
} |
|
658 |
||
659 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_ENABLEIPV4ADDRESSFIELDS_EXIT); |
|
20
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
660 |
} |
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
661 |
|
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
662 |
/*! |
30 | 663 |
Sets IPv4 DNS address fields enabled/disabled. |
664 |
*/ |
|
665 |
void CpPacketDataApAdvancedView::enableIpv4DnsFields(int state) |
|
666 |
{ |
|
667 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_ENABLEIPV4DNSFIELDS_ENTRY); |
|
668 |
||
669 |
if (state == Qt::Checked) { |
|
670 |
// Automatic, disable text fields |
|
671 |
if (mIpv4DnsAddress1) { |
|
672 |
mIpv4DnsAddress1->setEnabled(false); |
|
673 |
} |
|
674 |
if (mIpv4DnsAddress2) { |
|
675 |
mIpv4DnsAddress2->setEnabled(false); |
|
676 |
} |
|
677 |
} else { |
|
678 |
// User defined, enable text fields |
|
679 |
if (mIpv4DnsAddress1) { |
|
680 |
mIpv4DnsAddress1->setEnabled(true); |
|
681 |
} |
|
682 |
if (mIpv4DnsAddress2) { |
|
683 |
mIpv4DnsAddress2->setEnabled(true); |
|
684 |
} |
|
685 |
} |
|
686 |
||
687 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_ENABLEIPV4DNSFIELDS_EXIT); |
|
688 |
} |
|
689 |
||
690 |
/*! |
|
691 |
Sets IPv6 DNS address fields enabled/disabled. |
|
692 |
*/ |
|
693 |
void CpPacketDataApAdvancedView::enableIpv6DnsFields(int selectionIndex) |
|
694 |
{ |
|
695 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_ENABLEIPV6DNSFIELDS_ENTRY); |
|
696 |
||
697 |
// Check combobox value |
|
698 |
if (selectionIndex == Ipv6DnsTypeUserDefined) { |
|
699 |
// User-defined, enable text fields |
|
700 |
if (mIpv6DnsAddress1) { |
|
701 |
mIpv6DnsAddress1->setEnabled(true); |
|
702 |
} |
|
703 |
if (mIpv6DnsAddress2) { |
|
704 |
mIpv6DnsAddress2->setEnabled(true); |
|
705 |
} |
|
706 |
} else { |
|
707 |
// Automatic or well-known, disable text fields |
|
708 |
if (mIpv6DnsAddress1) { |
|
709 |
mIpv6DnsAddress1->setEnabled(false); |
|
710 |
} |
|
711 |
if (mIpv6DnsAddress2) { |
|
712 |
mIpv6DnsAddress2->setEnabled(false); |
|
713 |
} |
|
714 |
} |
|
715 |
||
716 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_ENABLEIPV6DNSFIELDS_EXIT); |
|
717 |
} |
|
718 |
||
719 |
/*! |
|
720 |
Validates an IP address and saves it to CommsDat in case it was a valid |
|
721 |
address or an empty string. In case the address is not valid, an error |
|
722 |
note is shown to the user and previous setting is restored to the UI. |
|
723 |
*/ |
|
724 |
bool CpPacketDataApAdvancedView::validateAndSaveIpAddress( |
|
725 |
HbDataFormModelItem *item, |
|
726 |
CMManagerShim::ConnectionMethodAttribute attribute, |
|
727 |
QAbstractSocket::NetworkLayerProtocol protocol) |
|
728 |
{ |
|
729 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_VALIDATEANDSAVEIPADDRESS_ENTRY); |
|
730 |
||
731 |
bool success = false; |
|
732 |
||
733 |
// Check address |
|
734 |
QString address = item->contentWidgetData("text").toString(); |
|
735 |
QHostAddress hostAddress; |
|
736 |
if (hostAddress.setAddress(address) |
|
737 |
&& hostAddress.protocol() == protocol) { |
|
738 |
// Proper address, convert to lower case (IPv6) |
|
739 |
address = hostAddress.toString().toLower(); |
|
740 |
} else if (address.isEmpty()) { |
|
741 |
// Empty string, replace with 0.0.0.0 or 0:0:0:0:0:0:0:0 |
|
742 |
if (protocol == QAbstractSocket::IPv4Protocol) { |
|
743 |
address = CMManagerShim::UnspecifiedIpv4Address; |
|
744 |
} else { |
|
745 |
address = CMManagerShim::DynamicIpv6Address; |
|
746 |
} |
|
747 |
} else { |
|
748 |
// Invalid address |
|
749 |
address.clear(); |
|
750 |
} |
|
751 |
||
752 |
if (!address.isEmpty()) { |
|
753 |
// Save to CommsDat |
|
754 |
mCmConnectionMethod->setStringAttribute(attribute, address); |
|
755 |
if (tryUpdate()) { |
|
756 |
success = true; |
|
757 |
item->setContentWidgetData("text", address); |
|
758 |
} |
|
759 |
} else { |
|
760 |
// Inform user of invalid name |
|
761 |
showMessageBox( |
|
762 |
HbMessageBox::MessageTypeInformation, |
|
763 |
hbTrId("txt_occ_info_invalid_input")); |
|
764 |
// Restore previous setting |
|
765 |
address = getIpAddress(attribute); |
|
766 |
item->setContentWidgetData("text", address); |
|
767 |
} |
|
768 |
||
769 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_VALIDATEANDSAVEIPADDRESS_EXIT); |
|
770 |
return success; |
|
771 |
} |
|
772 |
||
773 |
/*! |
|
774 |
Shows message box with "OK" button using given text. |
|
775 |
*/ |
|
776 |
void CpPacketDataApAdvancedView::showMessageBox( |
|
777 |
HbMessageBox::MessageBoxType type, |
|
778 |
const QString &text) |
|
779 |
{ |
|
780 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_SHOWMESSAGEBOX_ENTRY); |
|
781 |
||
782 |
// Create a message box |
|
783 |
mMessageBox = QSharedPointer<HbMessageBox>(new HbMessageBox(type)); |
|
784 |
mMessageBox->setText(text); |
|
785 |
mMessageBox->setModal(true); |
|
786 |
mMessageBox->setTimeout(HbPopup::NoTimeout); |
|
787 |
mMessageBox->open(); |
|
788 |
||
789 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_SHOWMESSAGEBOX_EXIT); |
|
790 |
} |
|
791 |
||
792 |
/*! |
|
793 |
Tries to update connection method changes to CommsDat. |
|
794 |
Returns "true" if success, "false" if some error happened. |
|
795 |
*/ |
|
796 |
bool CpPacketDataApAdvancedView::tryUpdate() |
|
797 |
{ |
|
798 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_TRYUPDATE_ENTRY); |
|
799 |
||
800 |
// Try update |
|
801 |
try { |
|
802 |
mCmConnectionMethod->update(); |
|
803 |
} |
|
804 |
catch (const std::exception&) { |
|
805 |
// Handle error |
|
806 |
handleUpdateError(); |
|
807 |
||
808 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_TRYUPDATE_EXIT); |
|
809 |
return false; |
|
810 |
} |
|
811 |
||
812 |
OstTraceFunctionExit0(DUP1_CPPACKETDATAAPADVANCEDVIEW_TRYUPDATE_EXIT); |
|
813 |
return true; |
|
814 |
} |
|
815 |
||
816 |
/*! |
|
817 |
Handles failed CommsDat update. |
|
818 |
*/ |
|
819 |
void CpPacketDataApAdvancedView::handleUpdateError() |
|
820 |
{ |
|
821 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_HANDLEUPDATEERROR_ENTRY); |
|
822 |
||
823 |
// Show error note to user |
|
824 |
showMessageBox( |
|
825 |
HbMessageBox::MessageTypeWarning, |
|
826 |
hbTrId("txt_occ_info_unable_to_save_setting")); |
|
827 |
// Reload settings from CommsDat and update UI |
|
828 |
try { |
|
829 |
mCmConnectionMethod->refresh(); |
|
830 |
} |
|
831 |
catch (const std::exception&) { |
|
832 |
// Ignore error from refresh. Most likely this will not happen, but |
|
833 |
// if it does, there isn't very much we can do. |
|
834 |
OstTrace0( |
|
835 |
TRACE_ERROR, |
|
836 |
CPPACKETDATAAPPADVANCEDVIEW_HANDLEUPDATEERROR, |
|
837 |
"Refresh failed"); |
|
838 |
}; |
|
839 |
updateIpGroup(); |
|
840 |
updateProxyGroup(); |
|
841 |
||
842 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_HANDLEUPDATEERROR_EXIT); |
|
843 |
} |
|
844 |
||
845 |
/*! |
|
846 |
Initializes all settings groups. |
|
847 |
*/ |
|
848 |
void CpPacketDataApAdvancedView::setEditorPreferences(const QModelIndex index) |
|
849 |
{ |
|
850 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_SETEDITORPREFERENCES_ENTRY); |
|
851 |
||
852 |
HbDataFormViewItem *viewItem = qobject_cast<HbDataFormViewItem *> |
|
853 |
(mForm->itemByIndex(index)); |
|
854 |
HbDataFormModelItem *modelItem = mModel->itemFromIndex(index); |
|
855 |
||
856 |
if (modelItem == mIpv4Address |
|
857 |
|| modelItem == mIpv4DnsAddress1 |
|
858 |
|| modelItem == mIpv4DnsAddress2 |
|
859 |
|| modelItem == mIpv6DnsAddress1 |
|
860 |
|| modelItem == mIpv6DnsAddress2 |
|
861 |
|| modelItem == mProxyServer |
|
862 |
|| modelItem == mProxyPort) { |
|
863 |
// HbLineEdit items, get editor and editor interface |
|
864 |
HbLineEdit *edit = qobject_cast<HbLineEdit *> |
|
865 |
(viewItem->dataItemContentWidget()); |
|
866 |
HbEditorInterface editorInterface(edit); |
|
867 |
||
868 |
if (modelItem == mIpv4Address |
|
869 |
|| modelItem == mIpv4DnsAddress1 |
|
870 |
|| modelItem == mIpv4DnsAddress2) { |
|
871 |
// IPv4 IP address |
|
872 |
editorInterface.setMode(HbInputModeNumeric); |
|
873 |
editorInterface.setFilter(CpIpv4Filter::instance()); |
|
874 |
edit->setMaxLength(CMManagerShim::CmIP4AddressLength); |
|
875 |
} else if (modelItem == mIpv6DnsAddress1 |
|
876 |
|| modelItem == mIpv6DnsAddress2) { |
|
877 |
// IPv6 IP address |
|
878 |
editorInterface.setInputConstraints( |
|
879 |
HbEditorConstraintLatinAlphabetOnly); |
|
880 |
editorInterface.setFilter(CpIpv6Filter::instance()); |
|
881 |
edit->setInputMethodHints( |
|
882 |
Qt::ImhNoPredictiveText |
|
883 |
| Qt::ImhPreferLowercase); |
|
884 |
edit->setMaxLength(CMManagerShim::CmIP6NameServerLength); |
|
885 |
} else if (modelItem == mProxyServer) { |
|
886 |
// Proxy server address |
|
887 |
editorInterface.setMode(HbInputModeNone); |
|
888 |
editorInterface.setInputConstraints( |
|
889 |
HbEditorConstraintLatinAlphabetOnly); |
|
890 |
editorInterface.setFilter(HbUrlFilter::instance()); |
|
891 |
editorInterface.setEditorClass(HbInputEditorClassUrl); |
|
892 |
editorInterface.setDigitType(HbDigitTypeNone); |
|
893 |
edit->setInputMethodHints( |
|
894 |
Qt::ImhNoPredictiveText |
|
895 |
| Qt::ImhPreferLowercase); |
|
896 |
edit->setMaxLength(CMManagerShim::CmProxyServerNameLength); |
|
897 |
} else { /* mProxyPort */ |
|
898 |
// Proxy port number |
|
899 |
editorInterface.setMode(HbInputModeNumeric); |
|
900 |
edit->setInputMethodHints(Qt::ImhDigitsOnly); |
|
901 |
edit->setMaxLength(CMManagerShim::CmProxyPortNumberLength); |
|
902 |
} |
|
903 |
} |
|
904 |
||
905 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_SETEDITORPREFERENCES_EXIT); |
|
906 |
} |
|
907 |
||
908 |
/*! |
|
909 |
Handles change to network type (IPv4/IPv6). |
|
910 |
*/ |
|
911 |
void CpPacketDataApAdvancedView::changeNetworkType(int type) |
|
912 |
{ |
|
913 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGENETWORKTYPE_ENTRY); |
|
914 |
||
915 |
// Save network type to CommsDat |
|
916 |
int pdpType; |
|
917 |
if (type == NetworkTypeIpv6) { |
|
918 |
pdpType = RPacketContext::EPdpTypeIPv6; |
|
919 |
} else { |
|
920 |
pdpType = RPacketContext::EPdpTypeIPv4; |
|
921 |
} |
|
922 |
mCmConnectionMethod->setIntAttribute( |
|
923 |
CMManagerShim::PacketDataPDPType, |
|
924 |
pdpType); |
|
925 |
if (tryUpdate()) |
|
926 |
{ |
|
927 |
// This will handle updating the UI with correct setting items |
|
928 |
updateIpGroup(); |
|
929 |
} |
|
930 |
||
931 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGENETWORKTYPE_EXIT); |
|
932 |
} |
|
933 |
||
934 |
/*! |
|
935 |
Handles change to IPv4 address mode (automatic/user defined). |
|
20
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
936 |
*/ |
30 | 937 |
void CpPacketDataApAdvancedView::changeIpv4AddressMode(int state) |
938 |
{ |
|
939 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV4ADDRESSMODE_ENTRY); |
|
940 |
||
941 |
bool ipv4AddressFromServer; |
|
942 |
if (state == Qt::Checked) { |
|
943 |
ipv4AddressFromServer = true; |
|
944 |
} else { |
|
945 |
ipv4AddressFromServer = false; |
|
946 |
} |
|
947 |
||
948 |
if (!ipv4AddressFromServer |
|
949 |
&& getIpAddress(CMManagerShim::CmIPAddress) == |
|
950 |
CMManagerShim::UnspecifiedIpv4Address) { |
|
951 |
// User defined IP address selected, but no valid address is stored. |
|
952 |
// Just enable the UI IP editors, because CMManager will update the |
|
953 |
// "IP address from server" flag by itself when a valid IP address |
|
954 |
// is stored. |
|
955 |
enableIpv4AddressFields(state); |
|
956 |
} else { |
|
957 |
// Save setting to CommsDat |
|
958 |
mCmConnectionMethod->setBoolAttribute( |
|
959 |
CMManagerShim::CmIPAddrFromServer, |
|
960 |
ipv4AddressFromServer); |
|
961 |
if (tryUpdate()) { |
|
962 |
enableIpv4AddressFields(state); |
|
963 |
} |
|
964 |
} |
|
965 |
||
966 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV4ADDRESSMODE_EXIT); |
|
967 |
} |
|
968 |
||
969 |
/*! |
|
970 |
Saves IPv4 address to CommsDat. |
|
971 |
*/ |
|
972 |
void CpPacketDataApAdvancedView::changeIpv4Address() |
|
973 |
{ |
|
974 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV4ADDRESS_ENTRY); |
|
975 |
||
976 |
if (validateAndSaveIpAddress( |
|
977 |
mIpv4Address, |
|
978 |
CMManagerShim::CmIPAddress, |
|
979 |
QAbstractSocket::IPv4Protocol)) { |
|
980 |
// In case the IP address is empty or 0.0.0.0, CMManager changes the |
|
981 |
// "IP address from server" flag to true. We need to refresh the UI to |
|
982 |
// make sure we are in sync. |
|
983 |
updateIpGroup(); |
|
984 |
} |
|
985 |
||
986 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV4ADDRESS_EXIT); |
|
987 |
} |
|
988 |
||
989 |
/*! |
|
990 |
Handles change to IPv4 DNS mode (automatic/user defined). |
|
991 |
*/ |
|
992 |
void CpPacketDataApAdvancedView::changeIpv4DnsMode(int state) |
|
993 |
{ |
|
994 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV4DNSMODE_ENTRY); |
|
995 |
||
996 |
bool dnsAddressFromServer; |
|
997 |
if (state == Qt::Checked) { |
|
998 |
dnsAddressFromServer = true; |
|
999 |
} else { |
|
1000 |
dnsAddressFromServer = false; |
|
1001 |
} |
|
1002 |
// Save setting to CommsDat |
|
1003 |
mCmConnectionMethod->setBoolAttribute( |
|
1004 |
CMManagerShim::CmIPDNSAddrFromServer, |
|
1005 |
dnsAddressFromServer); |
|
1006 |
if (tryUpdate()) { |
|
1007 |
enableIpv4DnsFields(state); |
|
1008 |
} |
|
1009 |
||
1010 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV4DNSMODE_EXIT); |
|
1011 |
} |
|
1012 |
||
1013 |
/*! |
|
1014 |
Saves IPv4 primary DNS address to CommsDat. |
|
1015 |
*/ |
|
1016 |
void CpPacketDataApAdvancedView::changeIpv4PrimaryDnsAddress() |
|
1017 |
{ |
|
1018 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV4PRIMARYDNSADDRESS_ENTRY); |
|
1019 |
||
1020 |
if (validateAndSaveIpAddress( |
|
1021 |
mIpv4DnsAddress1, |
|
1022 |
CMManagerShim::CmIPNameServer1, |
|
1023 |
QAbstractSocket::IPv4Protocol)) { |
|
1024 |
// Address saved successfully, update "DNS address from server" flag |
|
1025 |
mCmConnectionMethod->setBoolAttribute( |
|
1026 |
CMManagerShim::CmIPDNSAddrFromServer, |
|
1027 |
false); |
|
1028 |
if (tryUpdate()) { |
|
1029 |
// In case primary DNS address is empty or 0.0.0.0, CMManager will |
|
1030 |
// check secondary DNS address and in case it is a valid address, |
|
1031 |
// move it to the primary DNS address. We need to refresh the |
|
1032 |
// UI to make sure we are in sync. If tryUpdate() fails it does |
|
1033 |
// the refresh automatically, so only success case is handled |
|
1034 |
// here. |
|
1035 |
updateIpGroup(); |
|
1036 |
} |
|
1037 |
} |
|
1038 |
||
1039 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV4PRIMARYDNSADDRESS_EXIT); |
|
1040 |
} |
|
1041 |
||
1042 |
/*! |
|
1043 |
Saves IPv4 secondary DNS address to CommsDat. |
|
1044 |
*/ |
|
1045 |
void CpPacketDataApAdvancedView::changeIpv4SecondaryDnsAddress() |
|
1046 |
{ |
|
1047 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV4SECONDARYDNSADDRESS_ENTRY); |
|
1048 |
||
1049 |
if (validateAndSaveIpAddress( |
|
1050 |
mIpv4DnsAddress2, |
|
1051 |
CMManagerShim::CmIPNameServer2, |
|
1052 |
QAbstractSocket::IPv4Protocol)) { |
|
1053 |
// Address saved successfully, update "DNS address from server" flag |
|
1054 |
mCmConnectionMethod->setBoolAttribute( |
|
1055 |
CMManagerShim::CmIPDNSAddrFromServer, |
|
1056 |
false); |
|
1057 |
if (tryUpdate()) { |
|
1058 |
// In case primary DNS address is empty or 0.0.0.0, CMManager will |
|
1059 |
// write the address there instead of secondary DNS address, so we |
|
1060 |
// need to refresh the UI to make sure we are in sync. If |
|
1061 |
// tryUpdate() fails it does the refresh automatically, so only |
|
1062 |
// success case is handled here. |
|
1063 |
updateIpGroup(); |
|
1064 |
} |
|
1065 |
} |
|
1066 |
||
1067 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV4SECONDARYDNSADDRESS_EXIT); |
|
1068 |
} |
|
1069 |
||
1070 |
/*! |
|
1071 |
Handles change to IPv6 DNS mode (automatic/well-known/user defined). |
|
1072 |
*/ |
|
1073 |
void CpPacketDataApAdvancedView::changeIpv6DnsMode(int state) |
|
20
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1074 |
{ |
30 | 1075 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV6DNSMODE_ENTRY); |
1076 |
||
1077 |
// Update "DNS address from server" flag |
|
1078 |
if (state == Ipv6DnsTypeAutomatic) { |
|
1079 |
// Automatic |
|
1080 |
mCmConnectionMethod->setBoolAttribute( |
|
1081 |
CMManagerShim::CmIP6DNSAddrFromServer, |
|
1082 |
true); |
|
1083 |
} else { |
|
1084 |
// User defined or well-known address |
|
1085 |
mCmConnectionMethod->setBoolAttribute( |
|
1086 |
CMManagerShim::CmIP6DNSAddrFromServer, |
|
1087 |
false); |
|
1088 |
||
1089 |
if (state == Ipv6DnsTypeWellKnown) { |
|
1090 |
// Well-known address, set DNS addresses and update UI |
|
1091 |
mCmConnectionMethod->setStringAttribute( |
|
1092 |
CMManagerShim::CmIP6NameServer1, |
|
1093 |
CMManagerShim::KnownIpv6NameServer1); |
|
1094 |
mIpv6DnsAddress1->setContentWidgetData( |
|
1095 |
"text", |
|
1096 |
CMManagerShim::KnownIpv6NameServer1); |
|
1097 |
mCmConnectionMethod->setStringAttribute( |
|
1098 |
CMManagerShim::CmIP6NameServer2, |
|
1099 |
CMManagerShim::KnownIpv6NameServer2); |
|
1100 |
mIpv6DnsAddress2->setContentWidgetData( |
|
1101 |
"text", |
|
1102 |
CMManagerShim::KnownIpv6NameServer2); |
|
1103 |
} |
|
1104 |
} |
|
1105 |
||
1106 |
if (tryUpdate()) { |
|
1107 |
enableIpv6DnsFields(state); |
|
1108 |
} |
|
1109 |
||
1110 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV6DNSMODE_EXIT); |
|
1111 |
} |
|
1112 |
||
1113 |
/*! |
|
1114 |
Saves IPv6 primary DNS address to CommsDat. |
|
1115 |
*/ |
|
1116 |
void CpPacketDataApAdvancedView::changeIpv6PrimaryDnsAddress() |
|
1117 |
{ |
|
1118 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV6PRIMARYDNSADDRESS_ENTRY); |
|
1119 |
||
1120 |
if (validateAndSaveIpAddress( |
|
1121 |
mIpv6DnsAddress1, |
|
1122 |
CMManagerShim::CmIP6NameServer1, |
|
1123 |
QAbstractSocket::IPv6Protocol)) { |
|
1124 |
// Address saved successfully, update "DNS address from server" flag |
|
1125 |
mCmConnectionMethod->setBoolAttribute( |
|
1126 |
CMManagerShim::CmIP6DNSAddrFromServer, |
|
1127 |
false); |
|
1128 |
if (tryUpdate()) { |
|
1129 |
// In case primary DNS address is empty or 0:0:0:0:0:0:0:0, |
|
1130 |
// CMManager will check secondary DNS address and in case it is a |
|
1131 |
// valid address, move it to the primary DNS address. We need to |
|
1132 |
// refresh the UI to make sure we are in sync. If tryUpdate() |
|
1133 |
// fails it does the refresh automatically, so only success case |
|
1134 |
// is handled here. |
|
1135 |
updateIpGroup(); |
|
1136 |
} |
|
1137 |
} |
|
1138 |
||
1139 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV6PRIMARYDNSADDRESS_EXIT); |
|
20
9c97ad6591ae
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1140 |
} |
30 | 1141 |
|
1142 |
/*! |
|
1143 |
Saves IPv6 secondary DNS address to CommsDat. |
|
1144 |
*/ |
|
1145 |
void CpPacketDataApAdvancedView::changeIpv6SecondaryDnsAddress() |
|
1146 |
{ |
|
1147 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV6SECONDARYDNSADDRESS_ENTRY); |
|
1148 |
||
1149 |
if (validateAndSaveIpAddress( |
|
1150 |
mIpv6DnsAddress2, |
|
1151 |
CMManagerShim::CmIP6NameServer2, |
|
1152 |
QAbstractSocket::IPv6Protocol)) { |
|
1153 |
// Address saved successfully, update "DNS address from server" flag |
|
1154 |
mCmConnectionMethod->setBoolAttribute( |
|
1155 |
CMManagerShim::CmIP6DNSAddrFromServer, |
|
1156 |
false); |
|
1157 |
if (tryUpdate()) { |
|
1158 |
// In case primary DNS address is empty or 0:0:0:0:0:0:0:0, |
|
1159 |
// CMManager will write the address there instead of secondary DNS |
|
1160 |
// address, so we need to refresh the UI to make sure we are in |
|
1161 |
// sync. If tryUpdate() fails it does the refresh automatically, |
|
1162 |
// so only success case is handled here. |
|
1163 |
updateIpGroup(); |
|
1164 |
} |
|
1165 |
} |
|
1166 |
||
1167 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGEIPV6SECONDARYDNSADDRESS_EXIT); |
|
1168 |
} |
|
1169 |
||
1170 |
/*! |
|
1171 |
Saves proxy server address to CommsDat. |
|
1172 |
*/ |
|
1173 |
void CpPacketDataApAdvancedView::changeProxyServer() |
|
1174 |
{ |
|
1175 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGEPROXYSERVER_ENTRY); |
|
1176 |
||
1177 |
QString proxyServer = mProxyServer->contentWidgetData("text").toString(); |
|
1178 |
mCmConnectionMethod->setStringAttribute( |
|
1179 |
CMManagerShim::CmProxyServerName, |
|
1180 |
proxyServer); |
|
1181 |
(void)tryUpdate(); |
|
1182 |
||
1183 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGEPROXYSERVER_EXIT); |
|
1184 |
} |
|
1185 |
||
1186 |
/*! |
|
1187 |
Saves proxy port to CommsDat. |
|
1188 |
*/ |
|
1189 |
void CpPacketDataApAdvancedView::changeProxyPort() |
|
1190 |
{ |
|
1191 |
OstTraceFunctionEntry0(CPPACKETDATAAPADVANCEDVIEW_CHANGEPROXYPORT_ENTRY); |
|
1192 |
||
1193 |
uint proxyPort = mProxyPort->contentWidgetData("text").toInt(); |
|
1194 |
if (proxyPort <= 65535) { |
|
1195 |
if (proxyPort == 0) { |
|
1196 |
// Don't show zero |
|
1197 |
mProxyPort->setContentWidgetData("text", ""); |
|
1198 |
} |
|
1199 |
mCmConnectionMethod->setIntAttribute( |
|
1200 |
CMManagerShim::CmProxyPortNumber, |
|
1201 |
proxyPort); |
|
1202 |
(void)tryUpdate(); |
|
1203 |
} else { |
|
1204 |
// Inform user of invalid value |
|
1205 |
showMessageBox( |
|
1206 |
HbMessageBox::MessageTypeInformation, |
|
1207 |
hbTrId("txt_occ_info_invalid_input")); |
|
1208 |
// Restore previous setting |
|
1209 |
proxyPort = mCmConnectionMethod->getIntAttribute( |
|
1210 |
CMManagerShim::CmProxyPortNumber); |
|
1211 |
if (proxyPort > 0) { |
|
1212 |
mProxyPort->setContentWidgetData("text", QVariant(proxyPort)); |
|
1213 |
} else { |
|
1214 |
mProxyPort->setContentWidgetData("text", ""); |
|
1215 |
} |
|
1216 |
} |
|
1217 |
||
1218 |
OstTraceFunctionExit0(CPPACKETDATAAPADVANCEDVIEW_CHANGEPROXYPORT_EXIT); |
|
1219 |
} |