author | hgs |
Fri, 09 Jul 2010 15:40:55 +0300 | |
changeset 50 | 377c906a8701 |
parent 46 | bc5a64e5bc3c |
child 60 | 1eef62f5c541 |
permissions | -rw-r--r-- |
37 | 1 |
/* |
2 |
* Copyright (c) 2009 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 |
* |
|
16 |
*/ |
|
17 |
#include <hbdataform.h> |
|
18 |
#include <hbdataformmodel.h> |
|
19 |
#include <hbdataformmodelitem.h> |
|
20 |
#include <hbdataformviewitem.h> |
|
21 |
#include <hbdialog.h> |
|
22 |
#include <hbaction.h> |
|
23 |
#include <hblistwidget.h> |
|
24 |
#include <hblistwidgetitem.h> |
|
25 |
#include <hblabel.h> |
|
26 |
#include <cpsettingformitemdata.h> |
|
27 |
#include <psetwrapper.h> |
|
50 | 28 |
#include <psuinotes.h> |
37 | 29 |
|
30 |
#include "cpnetworkpluginform.h" |
|
31 |
#include "cpplugincommon.h" |
|
32 |
#include "cppluginlogging.h" |
|
33 |
#include "cellulardatasettings.h" |
|
34 |
||
35 |
/*! |
|
36 |
CpNetworkPluginForm::CpNetworkPluginForm |
|
37 |
*/ |
|
38 |
CpNetworkPluginForm::CpNetworkPluginForm(QGraphicsItem *parent) : |
|
39 |
HbDataForm(parent), |
|
40 |
m_activeNoteId(0), |
|
41 |
m_activeProgressNoteId(0), |
|
42 |
m_pSetWrapper(NULL), |
|
43 |
m_cpSettingsWrapper(NULL), |
|
44 |
mCellularSettings(), |
|
45 |
m_dialog(NULL) |
|
46 |
{ |
|
47 |
DPRINT << ": IN"; |
|
48 |
||
49 |
setHeading(hbTrId("txt_cp_subhead_mobile_network")); |
|
50 |
||
51 |
QScopedPointer<PSetWrapper> pSetWrapperGuard(new PSetWrapper); |
|
52 |
m_psetNetworkWrapper = &pSetWrapperGuard->networkWrapper(); |
|
53 |
mCellularSettings = QSharedPointer<CellularDataSettings>(new CellularDataSettings); |
|
54 |
connectToNetworkWrapper(*m_psetNetworkWrapper); |
|
50 | 55 |
connectToPhoneNotes(*PsUiNotes::instance()); |
37 | 56 |
|
57 |
QScopedPointer<HbDataFormModel> model(new HbDataFormModel); |
|
58 |
QScopedPointer<CpSettingsWrapper> cpSettingsWrapperGuard(new CpSettingsWrapper); |
|
59 |
||
60 |
// #1 Read Network mode value from Cenrep |
|
61 |
model->appendDataFormItem(createNetworkModeItem()); |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
62 |
if(m_psetNetworkWrapper->isManualNetworkSelectionSupported()) { |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
63 |
// #2 Use phone settings for operator selection |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
64 |
model->appendDataFormItem(createOperatorSelectionItem()); |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
65 |
} |
37 | 66 |
// Home network cellular data usage |
67 |
model->appendDataFormItem(createHomeDataUsageItem()); |
|
68 |
// Cellular network data usage when roaming |
|
69 |
model->appendDataFormItem(createRoamDataUsageItem()); |
|
70 |
setModel(model.take()); |
|
71 |
m_pSetWrapper = pSetWrapperGuard.take(); |
|
72 |
m_cpSettingsWrapper = cpSettingsWrapperGuard.take(); |
|
73 |
||
74 |
DPRINT << ": OUT"; |
|
75 |
} |
|
76 |
||
77 |
||
78 |
/*! |
|
79 |
CpNetworkPluginForm::~CpNetworkPluginForm |
|
80 |
*/ |
|
81 |
CpNetworkPluginForm::~CpNetworkPluginForm() |
|
82 |
{ |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
83 |
DPRINT; |
37 | 84 |
delete m_pSetWrapper; |
85 |
delete m_cpSettingsWrapper; |
|
86 |
} |
|
87 |
||
88 |
||
89 |
/*! |
|
90 |
CpNetworkPluginForm::createNetworkModeItem |
|
91 |
*/ |
|
92 |
HbDataFormModelItem *CpNetworkPluginForm::createNetworkModeItem() |
|
93 |
{ |
|
94 |
// #1A Read network mode value from Cenrep |
|
95 |
DPRINT << ": IN"; |
|
96 |
||
97 |
m_NetworkModeOptionsItemData = new CpSettingFormItemData( |
|
98 |
HbDataFormModelItem::ComboBoxItem, |
|
99 |
hbTrId("txt_cp_setlabel_network_mode"), |
|
100 |
NULL ); |
|
101 |
QScopedPointer<CpSettingFormItemData> settingFormItemGuard( |
|
102 |
m_NetworkModeOptionsItemData); |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
103 |
m_NetworkModeOptionsItemData->setObjectName("networkModeItem"); |
37 | 104 |
|
105 |
mNetworkModeOptions << hbTrId("txt_cp_setlabel_network_mode_val_dual_mode") |
|
106 |
<< hbTrId("txt_cp_setlabel_network_mode_val_umts") |
|
107 |
<< hbTrId("txt_cp_setlabel_network_mode_val_gsm"); |
|
108 |
m_NetworkModeOptionsItemData->setContentWidgetData( |
|
109 |
"items", QVariant(mNetworkModeOptions)); |
|
110 |
||
111 |
QObject::connect( |
|
112 |
m_psetNetworkWrapper, |
|
113 |
SIGNAL(networkAccessModeGot(int)), |
|
114 |
this, |
|
115 |
SLOT(networkAccessModeGot(int))); |
|
116 |
QObject::connect( |
|
117 |
m_psetNetworkWrapper, |
|
118 |
SIGNAL(availableNetworksGot(QList<PSetNetworkWrapper::NetworkInfo*> &)), |
|
119 |
this, |
|
120 |
SLOT(availableNetworksGot(QList<PSetNetworkWrapper::NetworkInfo*> &))); |
|
121 |
||
122 |
m_psetNetworkWrapper->getNetworkAccessMode(); |
|
123 |
||
124 |
addConnection( |
|
125 |
m_NetworkModeOptionsItemData, |
|
126 |
SIGNAL(currentIndexChanged(int)), |
|
127 |
this, |
|
128 |
SLOT(networkModeStateChanged(int))); |
|
129 |
||
130 |
settingFormItemGuard.take(); |
|
131 |
DPRINT << ": OUT"; |
|
132 |
return m_NetworkModeOptionsItemData; |
|
133 |
} |
|
134 |
||
135 |
||
136 |
/*! |
|
137 |
CpNetworkPluginForm::createOperatorSelectionItem |
|
138 |
*/ |
|
139 |
HbDataFormModelItem *CpNetworkPluginForm::createOperatorSelectionItem() |
|
140 |
{ |
|
141 |
// #2A Use phone settings for operator selection |
|
142 |
DPRINT << ": IN"; |
|
143 |
||
144 |
m_NetworkOperatorSelectionItemData = new CpSettingFormItemData( |
|
145 |
HbDataFormModelItem::ToggleValueItem, |
|
146 |
hbTrId("txt_cp_setlabel_operator_selection"), |
|
147 |
NULL); |
|
148 |
QScopedPointer<CpSettingFormItemData> settingFormItemGuard( |
|
149 |
m_NetworkOperatorSelectionItemData); |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
150 |
m_NetworkOperatorSelectionItemData->setObjectName("operatorSelectionItem"); |
37 | 151 |
|
152 |
PSetNetworkWrapper::NetworkSelectionMode mode; |
|
153 |
PSetNetworkWrapper::ErrorCode err = |
|
154 |
m_psetNetworkWrapper->getNetworkSelectionMode(mode); |
|
155 |
if(err == PSetNetworkWrapper::ErrNoError) { |
|
156 |
switch (mode) { |
|
157 |
case PSetNetworkWrapper::SelectionModeAutomatic: |
|
158 |
m_NetworkOperatorSelectionItemData->setContentWidgetData( |
|
159 |
"text", QVariant(hbTrId("txt_cp_setlabel_operator_selection_val_automatic"))); |
|
160 |
break; |
|
161 |
case PSetNetworkWrapper::SelectionModeManual: |
|
162 |
m_NetworkOperatorSelectionItemData->setContentWidgetData( |
|
163 |
"text", QVariant(hbTrId("txt_cp_setlabel_operator_selection_val_manual"))); |
|
164 |
break; |
|
165 |
default: |
|
166 |
break; |
|
167 |
} |
|
168 |
} |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
169 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
170 |
addConnection( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
171 |
m_NetworkOperatorSelectionItemData, SIGNAL(valueChanged(QPersistentModelIndex, QVariant)), |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
172 |
this, SLOT(operatorSelectionStateChanged())); |
37 | 173 |
|
174 |
settingFormItemGuard.take(); |
|
175 |
DPRINT << ": OUT"; |
|
176 |
return m_NetworkOperatorSelectionItemData; |
|
177 |
} |
|
178 |
||
179 |
/*! |
|
180 |
CpNetworkPluginForm::createHomeDataUsageItem |
|
181 |
*/ |
|
182 |
HbDataFormModelItem *CpNetworkPluginForm::createHomeDataUsageItem() |
|
183 |
{ |
|
184 |
DPRINT << ": IN"; |
|
185 |
||
186 |
mCellularUseHomeSelectionItemData = new CpSettingFormItemData( |
|
187 |
HbDataFormModelItem::ComboBoxItem, |
|
188 |
hbTrId("txt_cp_setlabel_data_usage_in_home_network"), |
|
189 |
NULL); |
|
190 |
QScopedPointer<CpSettingFormItemData> settingFormItemGuard( |
|
191 |
mCellularUseHomeSelectionItemData); |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
192 |
mCellularUseHomeSelectionItemData->setObjectName("homeDataUsageItem"); |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
193 |
|
37 | 194 |
// Populate the dropdown with selection items |
195 |
mCellularUseHomeOptions |
|
196 |
<< hbTrId("txt_cp_setlabel_data_usage_in_val_automatic") |
|
197 |
<< hbTrId("txt_cp_setlabel_data_usage_in_val_confirm") |
|
198 |
<< hbTrId("txt_cp_setlabel_data_usage_in_val_disabled"); |
|
199 |
mCellularUseHomeSelectionItemData->setContentWidgetData( |
|
200 |
"items", |
|
201 |
QVariant(mCellularUseHomeOptions)); |
|
202 |
||
203 |
// Set initial selection based on current setting |
|
204 |
mCellularUseHomeSelectionItemData->setContentWidgetData( |
|
205 |
"currentIndex", |
|
206 |
mCellularSettings->dataUseHome()); // NOTE: Indexes must match! |
|
207 |
||
208 |
addConnection( |
|
209 |
mCellularUseHomeSelectionItemData, |
|
210 |
SIGNAL(currentIndexChanged(int)), |
|
211 |
this, |
|
212 |
SLOT(cellularDataUseHomeStateChanged(int))); |
|
213 |
||
214 |
settingFormItemGuard.take(); |
|
215 |
DPRINT << ": OUT"; |
|
216 |
return mCellularUseHomeSelectionItemData; |
|
217 |
} |
|
218 |
||
219 |
/*! |
|
220 |
CpNetworkPluginForm::cellularDataUseHomeStateChanged |
|
221 |
*/ |
|
222 |
void CpNetworkPluginForm::cellularDataUseHomeStateChanged(int index) |
|
223 |
{ |
|
224 |
DPRINT << ": IN : index: " << index; |
|
225 |
mCellularSettings->setDataUseHome(index); |
|
226 |
DPRINT << ": OUT"; |
|
227 |
} |
|
228 |
||
229 |
/*! |
|
230 |
CpNetworkPluginForm::createRoamDataUsageItem |
|
231 |
*/ |
|
232 |
HbDataFormModelItem *CpNetworkPluginForm::createRoamDataUsageItem() |
|
233 |
{ |
|
234 |
DPRINT << ": IN"; |
|
235 |
||
236 |
mCellularUseRoamSelectionItemData = new CpSettingFormItemData( |
|
237 |
HbDataFormModelItem::ComboBoxItem, |
|
238 |
hbTrId("txt_cp_setlabel_data_usage_when_roaming"), |
|
239 |
NULL); |
|
240 |
QScopedPointer<CpSettingFormItemData> settingFormItemGuard( |
|
241 |
mCellularUseRoamSelectionItemData); |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
242 |
mCellularUseRoamSelectionItemData->setObjectName("roamDataUsageItem"); |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
243 |
|
37 | 244 |
// Populate the dropdown with selection items |
245 |
mCellularUseRoamOptions |
|
246 |
<< hbTrId("txt_cp_setlabel_data_usage_when_val_automatic") |
|
247 |
<< hbTrId("txt_cp_setlabel_data_usage_when_val_confirm") |
|
248 |
<< hbTrId("txt_cp_setlabel_data_usage_when_val_disabled"); |
|
249 |
mCellularUseRoamSelectionItemData->setContentWidgetData( |
|
250 |
"items", |
|
251 |
QVariant(mCellularUseRoamOptions)); |
|
252 |
||
253 |
// Set initial selection based on current setting |
|
254 |
mCellularUseRoamSelectionItemData->setContentWidgetData( |
|
255 |
"currentIndex", |
|
256 |
mCellularSettings->dataUseRoam()); // NOTE: Indexes must match! |
|
257 |
||
258 |
addConnection( |
|
259 |
mCellularUseRoamSelectionItemData, |
|
260 |
SIGNAL(currentIndexChanged(int)), |
|
261 |
this, |
|
262 |
SLOT(cellularDataUseRoamStateChanged(int))); |
|
263 |
||
264 |
settingFormItemGuard.take(); |
|
265 |
DPRINT << ": OUT"; |
|
266 |
return mCellularUseRoamSelectionItemData; |
|
267 |
} |
|
268 |
||
269 |
/*! |
|
270 |
CpNetworkPluginForm::cellularDataUseRoamStateChanged |
|
271 |
*/ |
|
272 |
void CpNetworkPluginForm::cellularDataUseRoamStateChanged(int index) |
|
273 |
{ |
|
274 |
DPRINT << ": IN : index: " << index; |
|
275 |
||
276 |
mCellularSettings->setDataUseRoam(index); |
|
277 |
||
278 |
DPRINT << ": OUT"; |
|
279 |
} |
|
280 |
||
281 |
/*! |
|
282 |
CpNetworkPluginForm::networkModeStateChanged |
|
283 |
*/ |
|
284 |
void CpNetworkPluginForm::networkModeStateChanged(int index) |
|
285 |
{ |
|
286 |
// #1C network mode changed |
|
287 |
DPRINT << ": IN : index: " << index; |
|
288 |
||
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
289 |
if(m_cpSettingsWrapper->isPhoneOffline()) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
290 |
// offline mode. |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
291 |
m_psetNetworkWrapper->getNetworkAccessMode(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
292 |
emit showGlobalNote( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
293 |
m_activeNoteId, |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
294 |
emit hbTrId("Off-line, not allowed"), |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
295 |
HbMessageBox::MessageTypeInformation); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
296 |
} else if(m_cpSettingsWrapper->isOngoingCall()) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
297 |
// ongoing call. |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
298 |
m_psetNetworkWrapper->getNetworkAccessMode(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
299 |
emit showGlobalNote( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
300 |
m_activeNoteId, |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
301 |
emit hbTrId("txt_cp_info_active_calls_must_be_disconnected_befo"), |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
302 |
HbMessageBox::MessageTypeInformation); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
303 |
} else { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
304 |
// ok case |
37 | 305 |
if(index == 0) { |
306 |
dualModeSelection(); |
|
307 |
} else if(index == 1) { |
|
308 |
umtsSelection(); |
|
309 |
} else if(index == 2) { |
|
310 |
gsmSelection(); |
|
311 |
} |
|
312 |
} |
|
313 |
||
314 |
DPRINT << ": OUT"; |
|
315 |
} |
|
316 |
||
317 |
||
318 |
/*! |
|
319 |
CpNetworkPluginForm::operatorSelectionStateChanged |
|
320 |
*/ |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
321 |
void CpNetworkPluginForm::operatorSelectionStateChanged() |
37 | 322 |
{ |
323 |
// #2C operator selection mode changed |
|
324 |
DPRINT << ": IN "; |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
325 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
326 |
if (m_cpSettingsWrapper->isPhoneOffline()) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
327 |
// off line |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
328 |
restoreOperatorSelectionUi(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
329 |
emit showGlobalNote( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
330 |
m_activeNoteId, |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
331 |
emit hbTrId("txt_cp_info_operator_selection_is_not_possible_in"), |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
332 |
HbMessageBox::MessageTypeInformation); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
333 |
} else if(m_cpSettingsWrapper->isOngoingCall()) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
334 |
// ongoing call. |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
335 |
restoreOperatorSelectionUi(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
336 |
emit showGlobalNote( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
337 |
m_activeNoteId, |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
338 |
emit hbTrId("txt_cp_info_active_calls_must_be_disconnected_befo"), |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
339 |
HbMessageBox::MessageTypeInformation); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
340 |
} else { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
341 |
// ok case |
37 | 342 |
PSetNetworkWrapper::NetworkSelectionMode mode; |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
343 |
PSetNetworkWrapper::ErrorCode err = |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
344 |
m_psetNetworkWrapper->getNetworkSelectionMode(mode); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
345 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
346 |
if(err == PSetNetworkWrapper::ErrNoError) { |
37 | 347 |
switch (mode) { |
348 |
case PSetNetworkWrapper::SelectionModeAutomatic: |
|
349 |
manualOperatorSelection(); |
|
350 |
m_NetworkOperatorSelectionItemData->setContentWidgetData( |
|
351 |
"text", QVariant(hbTrId("txt_cp_setlabel_operator_selection_val_manual"))); |
|
352 |
break; |
|
353 |
case PSetNetworkWrapper::SelectionModeManual: |
|
354 |
automaticOperatorSelection(); |
|
355 |
m_NetworkOperatorSelectionItemData->setContentWidgetData( |
|
356 |
"text", QVariant(hbTrId("txt_cp_setlabel_operator_selection_val_automatic"))); |
|
357 |
break; |
|
358 |
default: |
|
359 |
break; |
|
360 |
} |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
361 |
} else { |
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
362 |
DWARNING << ": err: " << err; |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
363 |
} |
37 | 364 |
} |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
365 |
|
37 | 366 |
DPRINT << ": OUT"; |
367 |
} |
|
368 |
||
369 |
||
370 |
/*! |
|
371 |
CpNetworkPluginForm::automaticOperatorSelection |
|
372 |
*/ |
|
373 |
void CpNetworkPluginForm::automaticOperatorSelection() |
|
374 |
{ |
|
375 |
DPRINT << ": IN"; |
|
376 |
||
377 |
PSetNetworkWrapper::NetworkInfo info; |
|
378 |
info.m_mode = PSetNetworkWrapper::SelectionModeAutomatic; |
|
379 |
m_psetNetworkWrapper->selectNetwork(info); |
|
380 |
||
381 |
DPRINT << ": OUT"; |
|
382 |
} |
|
383 |
||
384 |
||
385 |
/*! |
|
386 |
CpNetworkPluginForm::manualOperatorSelection |
|
387 |
*/ |
|
388 |
void CpNetworkPluginForm::manualOperatorSelection() |
|
389 |
{ |
|
390 |
DPRINT << ": IN"; |
|
391 |
||
392 |
m_psetNetworkWrapper->getAvailableNetworks(); |
|
393 |
||
394 |
DPRINT << ": OUT"; |
|
395 |
} |
|
396 |
||
397 |
||
398 |
/*! |
|
399 |
CpNetworkPluginForm::dualModeSelection |
|
400 |
*/ |
|
401 |
void CpNetworkPluginForm::dualModeSelection() |
|
402 |
{ |
|
403 |
DPRINT << ": IN"; |
|
404 |
||
405 |
m_psetNetworkWrapper->setNetworkAccessMode( |
|
406 |
PSetNetworkWrapper::AccessModeDual); |
|
407 |
||
408 |
DPRINT << ": OUT"; |
|
409 |
} |
|
410 |
||
411 |
||
412 |
/*! |
|
413 |
CpNetworkPluginForm::umtsSelection |
|
414 |
*/ |
|
415 |
void CpNetworkPluginForm::umtsSelection() |
|
416 |
{ |
|
417 |
DPRINT << ": IN"; |
|
418 |
||
419 |
m_psetNetworkWrapper->setNetworkAccessMode( |
|
420 |
PSetNetworkWrapper::AccessModeUmts); |
|
421 |
||
422 |
DPRINT << ": OUT"; |
|
423 |
} |
|
424 |
||
425 |
||
426 |
/*! |
|
427 |
CpNetworkPluginForm::gsmSelection |
|
428 |
*/ |
|
429 |
void CpNetworkPluginForm::gsmSelection() |
|
430 |
{ |
|
431 |
DPRINT << ": IN"; |
|
432 |
||
433 |
m_psetNetworkWrapper->setNetworkAccessMode( |
|
434 |
PSetNetworkWrapper::AccessModeGsm); |
|
435 |
||
436 |
DPRINT << ": OUT"; |
|
437 |
} |
|
438 |
||
439 |
||
440 |
/*! |
|
441 |
CpNetworkPluginForm::networkAccessModeGot |
|
442 |
*/ |
|
443 |
void CpNetworkPluginForm::networkAccessModeGot( |
|
444 |
int mode) |
|
445 |
{ |
|
446 |
DPRINT << ": IN"; |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
447 |
removeConnection( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
448 |
m_NetworkModeOptionsItemData, |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
449 |
SIGNAL(currentIndexChanged(int)), |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
450 |
this, |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
451 |
SLOT(networkModeStateChanged(int))); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
452 |
|
37 | 453 |
switch (mode) { |
454 |
case PSetNetworkWrapper::AccessModeDual: |
|
455 |
m_NetworkModeOptionsItemData->setContentWidgetData( |
|
456 |
"currentIndex", 0); |
|
457 |
break; |
|
458 |
case PSetNetworkWrapper::AccessModeUmts: |
|
459 |
m_NetworkModeOptionsItemData->setContentWidgetData( |
|
460 |
"currentIndex", 1); |
|
461 |
break; |
|
462 |
case PSetNetworkWrapper::AccessModeGsm: |
|
463 |
m_NetworkModeOptionsItemData->setContentWidgetData( |
|
464 |
"currentIndex", 2); |
|
465 |
break; |
|
466 |
default: |
|
467 |
break; |
|
468 |
} |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
469 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
470 |
addConnection( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
471 |
m_NetworkModeOptionsItemData, |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
472 |
SIGNAL(currentIndexChanged(int)), |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
473 |
this, |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
474 |
SLOT(networkModeStateChanged(int))); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
475 |
|
37 | 476 |
DPRINT << ": OUT"; |
477 |
} |
|
478 |
||
479 |
||
480 |
/*! |
|
481 |
CpNetworkPluginForm::availableNetworksGot |
|
482 |
*/ |
|
483 |
void CpNetworkPluginForm::availableNetworksGot( |
|
484 |
QList<PSetNetworkWrapper::NetworkInfo*> &networkInfoList) |
|
485 |
{ |
|
486 |
DPRINT << ": IN"; |
|
487 |
||
488 |
m_networkInfoList = &networkInfoList; |
|
489 |
showManualSelectiondialog(); |
|
490 |
||
491 |
DPRINT << ": OUT"; |
|
492 |
} |
|
493 |
||
494 |
||
495 |
/*! |
|
496 |
CpNetworkPluginForm::createDialog |
|
497 |
*/ |
|
498 |
HbDialog* CpNetworkPluginForm::createDialog(const QString& heading) const |
|
499 |
{ |
|
500 |
DPRINT << ": IN"; |
|
501 |
||
502 |
HbDialog *dialog = new HbDialog(); |
|
503 |
dialog->setDismissPolicy(HbDialog::NoDismiss); |
|
504 |
dialog->setTimeout(HbDialog::NoTimeout); |
|
505 |
dialog->setHeadingWidget(new HbLabel(heading)); |
|
506 |
||
507 |
DPRINT << ": OUT"; |
|
508 |
return dialog; |
|
509 |
} |
|
510 |
||
511 |
||
512 |
/*! |
|
513 |
CpNetworkPluginForm::createDialog |
|
514 |
*/ |
|
515 |
void CpNetworkPluginForm::addItemToListWidget(HbListWidget* w, |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
516 |
const QString& item, const int& data, |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
517 |
const HbIcon& primaryIcon) const |
37 | 518 |
{ |
519 |
DPRINT << ": IN"; |
|
520 |
Q_ASSERT(w != 0); |
|
521 |
||
522 |
HbListWidgetItem* o = new HbListWidgetItem(); |
|
523 |
o->setText(item); |
|
524 |
o->setData(data); |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
525 |
if(!primaryIcon.isNull()) |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
526 |
o->setIcon(primaryIcon); |
37 | 527 |
w->addItem(o); |
528 |
||
529 |
DPRINT << ": OUT"; |
|
530 |
} |
|
531 |
||
532 |
||
533 |
/*! |
|
534 |
CpNetworkPluginForm::networkReqestFailed |
|
535 |
*/ |
|
536 |
void CpNetworkPluginForm::networkReqestFailed( |
|
537 |
PSetNetworkWrapper::ErrorCode error, |
|
538 |
PSetNetworkWrapper::RequestType type) |
|
539 |
{ |
|
540 |
DPRINT << ": IN"; |
|
541 |
||
542 |
QString text; |
|
543 |
switch(error) { |
|
544 |
case PSetNetworkWrapper::ErrCauseCallActive: |
|
545 |
text = hbTrId("txt_cp_info_active_calls_must_be_disconnected_befo"); |
|
546 |
break; |
|
547 |
case PSetNetworkWrapper::ErrNoNetworkService: |
|
548 |
text = hbTrId("txt_cp_info_no_operators_found"); |
|
549 |
break; |
|
550 |
case PSetNetworkWrapper::ErrOfflineOpNotAllowed: |
|
551 |
text = hbTrId("Off-line, not allowed"); |
|
552 |
break; |
|
553 |
case PSetNetworkWrapper::ErrNoNetworkAccess: |
|
554 |
text = hbTrId("txt_cp_info_no_access_to_selected_operators_netwo"); |
|
555 |
break; |
|
556 |
default: |
|
557 |
break; |
|
558 |
} |
|
559 |
emit showGlobalNote( |
|
560 |
m_activeNoteId, text, HbMessageBox::MessageTypeInformation); |
|
561 |
||
562 |
// Update UI |
|
563 |
if(type == PSetNetworkWrapper::RequestSetNetworkMode) { |
|
564 |
m_psetNetworkWrapper->getNetworkAccessMode(); |
|
565 |
} |
|
566 |
else if(type == PSetNetworkWrapper::RequestSetNetwork && |
|
567 |
error == PSetNetworkWrapper::ErrNoNetworkAccess) { |
|
568 |
showManualSelectiondialog(); |
|
569 |
} |
|
570 |
else if(type == PSetNetworkWrapper::RequestSetNetwork || |
|
571 |
type == PSetNetworkWrapper::RequestSetNetworkAutomatic || |
|
572 |
type == PSetNetworkWrapper::RequestGetNetworkInfo) { |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
573 |
restoreOperatorSelectionUi(); |
37 | 574 |
} |
575 |
||
576 |
DPRINT << ": OUT"; |
|
577 |
} |
|
578 |
||
579 |
||
580 |
/*! |
|
581 |
CpNetworkPluginForm::userCancel |
|
582 |
*/ |
|
583 |
void CpNetworkPluginForm::userCancel() |
|
584 |
{ |
|
585 |
DPRINT << ": IN"; |
|
586 |
||
587 |
m_psetNetworkWrapper->cancelRequest(); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
588 |
restoreOperatorSelectionUi(); |
37 | 589 |
|
590 |
DPRINT << ": OUT"; |
|
591 |
} |
|
592 |
||
593 |
||
594 |
/*! |
|
595 |
CpNetworkPluginForm::handleSearchingNetworks |
|
596 |
*/ |
|
597 |
void CpNetworkPluginForm::handleSearchingNetworks( |
|
598 |
PSetNetworkWrapper::RequestType &type) |
|
599 |
{ |
|
600 |
DPRINT << ": IN"; |
|
601 |
||
602 |
if (type != PSetNetworkWrapper::RequestNone) { |
|
603 |
QObject::connect( |
|
50 | 604 |
PsUiNotes::instance(), SIGNAL(progressNoteCanceled()), |
37 | 605 |
this, SLOT(userCancel())); |
606 |
emit showGlobalProgressNote(m_activeProgressNoteId, hbTrId("txt_cp_info_updating")); |
|
607 |
} else { |
|
608 |
QObject::disconnect( |
|
50 | 609 |
PsUiNotes::instance(), SIGNAL(progressNoteCanceled()), |
37 | 610 |
this, SLOT(userCancel())); |
611 |
emit cancelNote(m_activeProgressNoteId); |
|
612 |
m_activeProgressNoteId = 0; |
|
613 |
} |
|
614 |
||
615 |
DPRINT << ": OUT"; |
|
616 |
} |
|
617 |
||
618 |
||
619 |
/*! |
|
620 |
CpNetworkPluginForm::handleRequestingSelectedNetwork |
|
621 |
*/ |
|
622 |
void CpNetworkPluginForm::handleRequestingSelectedNetwork(bool ongoing) |
|
623 |
{ |
|
624 |
DPRINT << ": IN"; |
|
625 |
||
626 |
if (ongoing) { |
|
627 |
QObject::connect( |
|
50 | 628 |
PsUiNotes::instance(), SIGNAL(progressNoteCanceled()), |
37 | 629 |
this, SLOT(userCancel())); |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
630 |
emit showGlobalProgressNote(m_activeProgressNoteId, hbTrId("txt_common_info_requesting")); |
37 | 631 |
} else { |
632 |
QObject::disconnect( |
|
50 | 633 |
PsUiNotes::instance(), SIGNAL(progressNoteCanceled()), |
37 | 634 |
this, SLOT(userCancel())); |
635 |
emit cancelNote(m_activeProgressNoteId); |
|
636 |
m_activeProgressNoteId = 0; |
|
637 |
} |
|
638 |
||
639 |
DPRINT << ": OUT"; |
|
640 |
} |
|
641 |
||
642 |
||
643 |
/*! |
|
644 |
CpNetworkPluginForm::handleNetworkChanged |
|
645 |
*/ |
|
646 |
void CpNetworkPluginForm::handleNetworkChanged( |
|
647 |
PSetNetworkWrapper::NetworkInfo& currentInfo, |
|
648 |
PSetNetworkWrapper::RegistrationStatus& status) |
|
649 |
{ |
|
650 |
DPRINT << ": IN"; |
|
651 |
||
652 |
QString text; |
|
653 |
switch (status){ |
|
654 |
case PSetNetworkWrapper::RegisteredOnHomeNetwork: |
|
655 |
text = hbTrId("Home network selected"); |
|
656 |
break; |
|
657 |
case PSetNetworkWrapper::RegisteredRoaming: { |
|
658 |
text = hbTrId("Selected network: "); |
|
659 |
text.append(networkName(currentInfo)); |
|
660 |
} |
|
661 |
break; |
|
662 |
} |
|
663 |
||
664 |
emit showGlobalNote( |
|
665 |
m_activeNoteId, text, HbMessageBox::MessageTypeInformation); |
|
666 |
||
667 |
DPRINT << ": OUT"; |
|
668 |
} |
|
669 |
||
670 |
||
671 |
/*! |
|
672 |
CpNetworkPluginForm::showManualSelectiondialog |
|
673 |
*/ |
|
674 |
void CpNetworkPluginForm::showManualSelectiondialog() |
|
675 |
{ |
|
676 |
DPRINT << ": IN"; |
|
677 |
||
678 |
QScopedPointer<HbDialog> dialog( |
|
679 |
createDialog(hbTrId("txt_cp_title_select_operator"))); |
|
680 |
HbListWidget *list = new HbListWidget(dialog.data()); |
|
681 |
//then insert found networks |
|
682 |
int itemsCount = m_networkInfoList->count(); |
|
683 |
for (int i = 0; i < itemsCount; i++) { |
|
684 |
PSetNetworkWrapper::NetworkInfo *info = m_networkInfoList->at(i); |
|
685 |
QString text = networkName(*info); |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
686 |
addItemToListWidget(list, text, i, HbIcon(primaryIconForNetwork(*info))); |
37 | 687 |
DPRINT << ": " << info; |
688 |
} |
|
689 |
// Connect list item activation signal to close the popup |
|
690 |
connect( |
|
691 |
list, SIGNAL(activated(HbListWidgetItem*)), |
|
692 |
dialog.data(), SLOT(close())); |
|
693 |
// Sets the "Cancel"-action/button |
|
694 |
HbAction *cancelAction = new HbAction(hbTrId("txt_common_button_cancel")); |
|
695 |
dialog->addAction(cancelAction); |
|
696 |
dialog->setContentWidget(list); |
|
697 |
// Launch popup and handle the response |
|
698 |
dialog->open(this, SLOT(finishedManualSelectiondialog(HbAction*))); |
|
699 |
if (m_dialog) { |
|
700 |
m_dialog->deleteLater(); |
|
701 |
m_dialog = NULL; |
|
702 |
} |
|
703 |
m_dialog = dialog.take(); |
|
704 |
||
705 |
DPRINT << ": OUT"; |
|
706 |
} |
|
707 |
||
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
708 |
/*! |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
709 |
CpNetworkPluginForm::primaryIconForNetwork |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
710 |
*/ |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
711 |
QString CpNetworkPluginForm::primaryIconForNetwork(const PSetNetworkWrapper::NetworkInfo &info) |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
712 |
{ |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
713 |
DPRINT << ": IN"; |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
714 |
|
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
715 |
QString iconName; |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
716 |
bool isForbiddenIconSupported = m_cpSettingsWrapper->forbiddenIconSupported(); |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
717 |
if (isForbiddenIconSupported) { |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
718 |
if (info.m_access == PSetNetworkWrapper::AccessTypeGsm) { |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
719 |
if (info.m_status == PSetNetworkWrapper::StatusForbidden) { |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
720 |
iconName.append("qtg_small_network_off"); |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
721 |
} else { |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
722 |
iconName.append("qtg_small_network"); |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
723 |
} |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
724 |
} else if (info.m_access == PSetNetworkWrapper::AccessTypeWcdma) { |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
725 |
if (info.m_status == PSetNetworkWrapper::StatusForbidden) { |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
726 |
iconName.append("qtg_small_wcdma_off"); |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
727 |
} else { |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
728 |
iconName.append("qtg_small_wcdma"); |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
729 |
} |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
730 |
} |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
731 |
else if (info.m_access == PSetNetworkWrapper::AccessTypeGsmAndWcdma) { |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
732 |
if (info.m_status == PSetNetworkWrapper::StatusForbidden) { |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
733 |
iconName.append("qtg_small_pd_wcdma_off"); |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
734 |
} else { |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
735 |
iconName.append("qtg_small_pd_wcdma"); |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
736 |
} |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
737 |
} |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
738 |
} |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
739 |
|
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
740 |
DPRINT << ": OUT : " << iconName; |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
741 |
return iconName; |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
742 |
} |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
743 |
|
37 | 744 |
|
745 |
/*! |
|
746 |
CpNetworkPluginForm::finishedManualSelectiondialog. |
|
747 |
*/ |
|
748 |
void CpNetworkPluginForm::finishedManualSelectiondialog(HbAction* action) |
|
749 |
{ |
|
750 |
DPRINT << ": IN"; |
|
751 |
||
752 |
if (m_dialog) { |
|
753 |
QList<QAction *> actionList = m_dialog->actions(); |
|
754 |
bool cancelAction = actionList.contains(action); |
|
755 |
if (!cancelAction) { |
|
756 |
// Update the view with selected text |
|
757 |
QGraphicsWidget *contectWidget = m_dialog->contentWidget(); |
|
758 |
HbListWidget *list(NULL); |
|
759 |
if (contectWidget) { |
|
760 |
list = qobject_cast<HbListWidget *>(contectWidget); |
|
761 |
} |
|
762 |
if (list) { |
|
763 |
int seletion = 0; |
|
764 |
if(list->currentItem()) { |
|
765 |
seletion = list->currentItem()->data().toInt(); |
|
766 |
DPRINT << ": seletion : " << seletion; |
|
767 |
} |
|
768 |
PSetNetworkWrapper::NetworkInfo param; |
|
769 |
param.m_id.m_countryCode = |
|
770 |
m_networkInfoList->at(seletion)->m_id.m_countryCode; |
|
771 |
param.m_id.m_networkCode = |
|
772 |
m_networkInfoList->at(seletion)->m_id.m_networkCode; |
|
773 |
param.m_mode = PSetNetworkWrapper::SelectionModeManual; |
|
774 |
DPRINT << ": m_countryCode : " << param.m_id.m_countryCode; |
|
775 |
DPRINT << ": m_networkCode : " << param.m_id.m_networkCode; |
|
776 |
DPRINT << ": m_mode : " << param.m_mode; |
|
777 |
m_psetNetworkWrapper->selectNetwork(param); |
|
778 |
} |
|
779 |
} else { |
|
780 |
DPRINT << ": Cancel"; |
|
781 |
m_psetNetworkWrapper->cancelRequest(); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
782 |
restoreOperatorSelectionUi(); |
37 | 783 |
} |
784 |
m_dialog->deleteLater(); |
|
785 |
m_dialog = NULL; |
|
786 |
} |
|
787 |
||
788 |
DPRINT << ": OUT"; |
|
789 |
} |
|
790 |
||
791 |
/*! |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
792 |
CpNetworkPluginForm::restoreOperatorSelectionUi |
37 | 793 |
*/ |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
794 |
void CpNetworkPluginForm::restoreOperatorSelectionUi() |
37 | 795 |
{ |
796 |
DPRINT << ": IN"; |
|
797 |
||
798 |
removeConnection( |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
799 |
m_NetworkOperatorSelectionItemData, SIGNAL(valueChanged(QPersistentModelIndex, QVariant)), |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
800 |
this, SLOT(operatorSelectionStateChanged())); |
37 | 801 |
PSetNetworkWrapper::NetworkSelectionMode mode; |
802 |
PSetNetworkWrapper::ErrorCode err = |
|
803 |
m_psetNetworkWrapper->getNetworkSelectionMode(mode); |
|
804 |
if(err == PSetNetworkWrapper::ErrNoError) { |
|
805 |
switch (mode) { |
|
806 |
case PSetNetworkWrapper::SelectionModeAutomatic: |
|
807 |
m_NetworkOperatorSelectionItemData->setContentWidgetData( |
|
808 |
"text", QVariant(hbTrId("txt_cp_setlabel_operator_selection_val_automatic"))); |
|
809 |
break; |
|
810 |
case PSetNetworkWrapper::SelectionModeManual: |
|
811 |
m_NetworkOperatorSelectionItemData->setContentWidgetData( |
|
812 |
"text", QVariant(hbTrId("txt_cp_setlabel_operator_selection_val_manual"))); |
|
813 |
break; |
|
814 |
default: |
|
815 |
break; |
|
816 |
} |
|
817 |
} |
|
818 |
addConnection( |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
819 |
m_NetworkOperatorSelectionItemData, SIGNAL(valueChanged(QPersistentModelIndex, QVariant)), |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
820 |
this, SLOT(operatorSelectionStateChanged())); |
37 | 821 |
|
822 |
DPRINT << ": OUT"; |
|
823 |
} |
|
824 |
||
825 |
||
826 |
/*! |
|
827 |
CpNetworkPluginForm::networkName() |
|
828 |
*/ |
|
829 |
QString CpNetworkPluginForm::networkName( |
|
830 |
PSetNetworkWrapper::NetworkInfo &info) |
|
831 |
{ |
|
832 |
DPRINT << ": IN"; |
|
833 |
||
834 |
QString text; |
|
835 |
if (!info.m_longName.isEmpty()) |
|
836 |
{ |
|
837 |
text.append(info.m_longName); |
|
838 |
} |
|
839 |
else if (!info.m_shortName.isEmpty()) |
|
840 |
{ |
|
841 |
text.append(info.m_shortName); |
|
842 |
} |
|
843 |
else //network returned only ids |
|
844 |
{ |
|
845 |
text.append(info.m_id.m_countryCode); |
|
846 |
text.append(" "); |
|
847 |
text.append(info.m_id.m_networkCode); |
|
848 |
} |
|
849 |
||
850 |
DPRINT << ": OUT : " << text; |
|
851 |
return text; |
|
852 |
} |
|
853 |
||
854 |
||
855 |
/*! |
|
856 |
CpNetworkPluginForm::connectToNetworkWrapper |
|
857 |
*/ |
|
858 |
void CpNetworkPluginForm::connectToNetworkWrapper(PSetNetworkWrapper &wrapper) |
|
859 |
{ |
|
860 |
QObject::connect( |
|
861 |
&wrapper, |
|
862 |
SIGNAL(networkReqestFailed( |
|
863 |
PSetNetworkWrapper::ErrorCode,PSetNetworkWrapper::RequestType)), |
|
864 |
this, |
|
865 |
SLOT(networkReqestFailed( |
|
866 |
PSetNetworkWrapper::ErrorCode,PSetNetworkWrapper::RequestType))); |
|
867 |
||
868 |
QObject::connect( |
|
869 |
&wrapper, |
|
870 |
SIGNAL(searchingNetworks(PSetNetworkWrapper::RequestType &)), |
|
871 |
this, |
|
872 |
SLOT(handleSearchingNetworks(PSetNetworkWrapper::RequestType &))); |
|
873 |
||
874 |
QObject::connect( |
|
875 |
&wrapper, |
|
876 |
SIGNAL(requestingSelectedNetwork(bool)), |
|
877 |
this, |
|
878 |
SLOT(handleRequestingSelectedNetwork(bool))); |
|
879 |
||
880 |
QObject::connect( |
|
881 |
&wrapper, |
|
882 |
SIGNAL(networkChanged( |
|
883 |
PSetNetworkWrapper::NetworkInfo&, |
|
884 |
PSetNetworkWrapper::RegistrationStatus&)), |
|
885 |
this, |
|
886 |
SLOT(handleNetworkChanged( |
|
887 |
PSetNetworkWrapper::NetworkInfo&, |
|
888 |
PSetNetworkWrapper::RegistrationStatus&))); |
|
889 |
} |
|
890 |
||
891 |
||
892 |
/*! |
|
893 |
CpNetworkPluginForm::connectToPhoneNotes |
|
894 |
*/ |
|
50 | 895 |
void CpNetworkPluginForm::connectToPhoneNotes(PsUiNotes ¬es) |
37 | 896 |
{ |
897 |
QObject::connect( |
|
898 |
this, |
|
899 |
SIGNAL(showGlobalProgressNote(int &, const QString&)), |
|
900 |
¬es, |
|
901 |
SLOT(showGlobalProgressNote(int &, const QString&))); |
|
902 |
||
903 |
QObject::connect( |
|
904 |
this, |
|
905 |
SIGNAL(showGlobalNote( |
|
906 |
int &, const QString&, HbMessageBox::MessageBoxType)), |
|
907 |
¬es, |
|
908 |
SLOT(showGlobalNote( |
|
909 |
int &, const QString&, HbMessageBox::MessageBoxType))); |
|
910 |
||
911 |
QObject::connect( |
|
912 |
this, |
|
913 |
SIGNAL(cancelNote(int)), |
|
914 |
¬es, |
|
915 |
SLOT(cancelNote(int))); |
|
916 |
} |
|
917 |
||
918 |
/*! |
|
919 |
CpNetworkPluginForm::searchAvailableNetworks |
|
920 |
*/ |
|
921 |
void CpNetworkPluginForm::searchAvailableNetworks() |
|
922 |
{ |
|
923 |
DPRINT << ": IN"; |
|
924 |
||
925 |
m_psetNetworkWrapper->cancelRequest(); |
|
926 |
manualOperatorSelection(); |
|
927 |
||
928 |
DPRINT << ": OUT"; |
|
929 |
} |
|
930 |
||
931 |
// End of File. |