33
|
1 |
|
|
2 |
/*
|
|
3 |
* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
|
|
4 |
* All rights reserved.
|
|
5 |
* This component and the accompanying materials are made available
|
|
6 |
* under the terms of "Eclipse Public License v1.0"
|
|
7 |
* which accompanies this distribution, and is available
|
|
8 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
9 |
*
|
|
10 |
* Initial Contributors:
|
|
11 |
* Nokia Corporation - initial contribution.
|
|
12 |
*
|
|
13 |
* Contributors:
|
|
14 |
*
|
|
15 |
* Description: Methods for DmAdvancedView.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
#include "dmadvancedview.h"
|
|
20 |
#include "ServerSettingsView.h"
|
|
21 |
|
|
22 |
DmAdvancedView::DmAdvancedView(HbMainWindow *mainWindow, HbView *mainView, QGraphicsItem *parent):HbView(parent),
|
|
23 |
bluetooth(":/icons/qgn_prop_sml_bt.svg"),
|
|
24 |
internet(":/icons/qgn_prop_sml_http.svg"),
|
|
25 |
defaultprofileicon(":/icons/qtg_large_avatar.svg")
|
|
26 |
{
|
|
27 |
iMainWindow = mainWindow;
|
|
28 |
serverSetView = NULL;
|
|
29 |
iMainView = mainView;
|
|
30 |
dminfo = new DmInfo(this);
|
|
31 |
currentdefaultprofile = -1;
|
|
32 |
currentview = 0;
|
|
33 |
connectionRequested = false;
|
|
34 |
backbehaviorset = false;
|
|
35 |
}
|
|
36 |
|
|
37 |
DmAdvancedView::~DmAdvancedView()
|
|
38 |
{
|
|
39 |
qDebug("omadm DmAdvancedView::~DmAdvancedView");
|
|
40 |
if(docmlLoader)
|
|
41 |
delete docmlLoader;
|
|
42 |
if(dminfo)
|
|
43 |
delete dminfo;
|
|
44 |
qDebug("omadm DmAdvancedView::~DmAdvancedView end");
|
|
45 |
}
|
|
46 |
|
|
47 |
void DmAdvancedView::handleLongPress(HbAbstractViewItem* item , QPointF coOrdinates)
|
|
48 |
{
|
|
49 |
if(connectionRequested)
|
|
50 |
return;
|
|
51 |
int itemnum = 0;
|
|
52 |
if (item)
|
|
53 |
{
|
|
54 |
QStandardItem *modelItem = model->itemFromIndex(item->modelIndex());
|
|
55 |
itemnum = modelItem->row();
|
|
56 |
|
|
57 |
|
|
58 |
csmenu = new HbMenu();
|
|
59 |
HbAction *defaultprofileAction = 0;
|
|
60 |
HbAction *deleteaction= 0;
|
|
61 |
HbAction *connectaction= 0;
|
|
62 |
if(!dminfo->Isdefaultprofile(itemnum))
|
|
63 |
{
|
|
64 |
defaultprofileAction = csmenu->addAction(hbTrId("txt_device_update_menu_set_as_default"));
|
|
65 |
}
|
|
66 |
if(!dminfo->Isprofilelocked(itemnum))
|
|
67 |
{
|
|
68 |
deleteaction = csmenu->addAction(hbTrId("txt_device_update_menu_delete"));
|
|
69 |
}
|
|
70 |
connectaction = csmenu->addAction(hbTrId("txt_device_update_menu_connect"));
|
|
71 |
HbAction *selectedAction = csmenu->exec(coOrdinates);
|
|
72 |
if(selectedAction)
|
|
73 |
{
|
|
74 |
if(selectedAction == defaultprofileAction )
|
|
75 |
{
|
|
76 |
dminfo->setDefaultProfile(itemnum);
|
|
77 |
updateEarlierdefaultProfileIcon();
|
|
78 |
modelItem->setIcon(defaultprofileicon);
|
|
79 |
currentdefaultprofile = itemnum;
|
|
80 |
}
|
|
81 |
else if (selectedAction == deleteaction )
|
|
82 |
{
|
|
83 |
dminfo->DisableDbNotifications(true);
|
|
84 |
//check currentdefaultprofile is current item
|
|
85 |
if(itemnum == currentdefaultprofile) // deleting default profile
|
|
86 |
currentdefaultprofile = -1;
|
|
87 |
if(dminfo->DeleteProfile(itemnum) >=0 )
|
|
88 |
{
|
|
89 |
//Update the profile list
|
|
90 |
model->removeRow(itemnum);
|
|
91 |
}
|
|
92 |
dminfo->DisableDbNotifications(false);
|
|
93 |
}
|
|
94 |
else if( selectedAction == connectaction )
|
|
95 |
{
|
|
96 |
dminfo->synchronize(itemnum);
|
|
97 |
connectionRequested = true;
|
|
98 |
}
|
|
99 |
else
|
|
100 |
{
|
|
101 |
}
|
|
102 |
}
|
|
103 |
delete csmenu;
|
|
104 |
}
|
|
105 |
}
|
|
106 |
|
|
107 |
|
|
108 |
void DmAdvancedView::handleClicked(QModelIndex index)
|
|
109 |
{
|
|
110 |
if(connectionRequested)
|
|
111 |
return;
|
|
112 |
//Stop listening DB events for profile addition
|
|
113 |
dminfo->DisableDbNotifications(true);
|
|
114 |
//If profile is not locked then take to edit server view
|
|
115 |
int itemnum = 0;
|
|
116 |
QStandardItem *modelItem = model->itemFromIndex(index);
|
|
117 |
itemnum = modelItem->row();
|
|
118 |
if(itemnum >= 0 && !dminfo->Isprofilelocked(itemnum))
|
|
119 |
{
|
|
120 |
//read profile items
|
|
121 |
QStringList itemdata;
|
|
122 |
bool sessmode = 0;
|
|
123 |
QStringList iaplist;
|
|
124 |
int curriap = 0;
|
|
125 |
int portnum = 0;
|
|
126 |
bool nwauth = false ;
|
|
127 |
dminfo->getProfiledata(itemnum, itemdata, sessmode,iaplist,curriap,portnum, nwauth);
|
|
128 |
QString editserverprof(itemdata[0]);
|
|
129 |
if(!serverSetView)
|
|
130 |
{
|
|
131 |
serverSetView = new ServerSettingsView(iMainWindow, this , editserverprof);
|
|
132 |
}
|
|
133 |
else // view already created
|
|
134 |
{
|
|
135 |
//Just update the setting items as per this profile
|
|
136 |
serverSetView->makeviewItemsVisible(editserverprof);
|
|
137 |
}
|
|
138 |
serverSetView->setProfileValues(itemdata,sessmode,iaplist,curriap,portnum,nwauth);
|
|
139 |
iMainWindow->setCurrentView(serverSetView);
|
|
140 |
|
|
141 |
}
|
|
142 |
}
|
|
143 |
|
|
144 |
bool DmAdvancedView::displayItems()
|
|
145 |
{
|
|
146 |
docmlLoader = new HbDocumentLoader;
|
|
147 |
bool ok ;
|
|
148 |
docmlLoader->load( DOCML_FILE_NAME, &ok );
|
|
149 |
if(ok)
|
|
150 |
{
|
|
151 |
if(iMainWindow->orientation() == Qt::Vertical)
|
|
152 |
docmlLoader->load( DOCML_FILE_NAME, PORTRAIT,&ok );
|
|
153 |
else
|
|
154 |
docmlLoader->load( DOCML_FILE_NAME, LANDSCAPE,&ok );
|
|
155 |
}
|
|
156 |
else
|
|
157 |
{
|
|
158 |
qDebug("omadm docml loading failed");
|
|
159 |
return ok;
|
|
160 |
}
|
|
161 |
if(ok)
|
|
162 |
{
|
|
163 |
connect(iMainWindow, SIGNAL(orientationChanged(Qt::Orientation)),
|
|
164 |
this, SLOT(reLayout(Qt::Orientation)));
|
|
165 |
viewwidget = qobject_cast<HbView *>(docmlLoader->findWidget( VIEW_NAME ) );
|
|
166 |
Q_ASSERT_X(viewwidget != 0, "OMADM View not found","Not found");
|
|
167 |
viewspecificmenu = new HbMenu();
|
|
168 |
help = viewspecificmenu->addAction(hbTrId("txt_common_menu_help"));
|
|
169 |
exit = viewspecificmenu->addAction(hbTrId("txt_common_menu_exit"));
|
|
170 |
connect(exit, SIGNAL(triggered()), QCoreApplication::instance(), SLOT(quit()));
|
|
171 |
setMenu(viewspecificmenu);
|
|
172 |
serversListGroup = qobject_cast<HbGroupBox *>(docmlLoader->findWidget( GROUP ) );
|
|
173 |
serversListGroup->setHeading(hbTrId("txt_device_update_setlabel_device_update_services"));
|
|
174 |
serversListGroup->setCollapsable( true );
|
|
175 |
connect(serversListGroup, SIGNAL(toggled(bool)), this, SLOT(serversListGroupClicked(bool)));
|
|
176 |
otherDetailsGroup = qobject_cast<HbGroupBox *>(docmlLoader->findWidget( OTHERDETAILSGROUP ) );
|
|
177 |
connect(otherDetailsGroup, SIGNAL(toggled(bool)), this, SLOT(otherDetailsGroupClicked(bool)));
|
|
178 |
otherDetailsGroup->setHeading(hbTrId("txt_device_update_setlabel_other_details"));
|
|
179 |
otherDetailsGroup->setCollapsable( true );
|
|
180 |
otherDetailsGroup->setCollapsed( true );
|
|
181 |
list = qobject_cast<HbListView *>(docmlLoader->findWidget( LIST_NAME ) );
|
|
182 |
HbListViewItem *prototype = list->listItemPrototype();
|
|
183 |
prototype->setGraphicsSize(HbListViewItem::LargeIcon);
|
|
184 |
prototype->setSecondaryTextRowCount(1,2);
|
|
185 |
prototype->setStretchingStyle(HbListViewItem::StretchLandscape);
|
|
186 |
dminfo->refreshProfileList();
|
|
187 |
int IndicatorCount =dminfo->profilescount();
|
|
188 |
model = new QStandardItemModel();
|
|
189 |
for (int i = 0; IndicatorCount > 0 && i < IndicatorCount; ++i) {
|
|
190 |
QStringList liststr;
|
|
191 |
bool lock = false;
|
|
192 |
int icon = 0;
|
|
193 |
int ret = dminfo->profileinfo(i,liststr,icon, lock);
|
|
194 |
if(ret <= 0)
|
|
195 |
{
|
|
196 |
break;
|
|
197 |
}
|
|
198 |
QStandardItem* item ;
|
|
199 |
item = new QStandardItem();
|
|
200 |
HbIcon icon1;
|
|
201 |
icon1.setIconName(":/icons/qgn_prop_sml_http.svg");
|
|
202 |
HbIcon icon2;
|
|
203 |
icon2.setIconName(":/icons/qgn_prop_sml_bt.svg");
|
|
204 |
HbIcon icon3;
|
|
205 |
icon3.setIconName(":/icons/qgn_indi_sett_protected_add.svg");
|
|
206 |
HbIcon defaultprofile;
|
|
207 |
defaultprofile.setIconName(":/icons/qtg_large_avatar.svg");
|
|
208 |
QList<QVariant> Iconl;
|
|
209 |
if(icon == 0)//Internet
|
|
210 |
Iconl.insert(0,icon1);
|
|
211 |
else if(icon == 1)//Bluetooth
|
|
212 |
Iconl.insert(0,icon2);
|
|
213 |
else
|
|
214 |
{
|
|
215 |
Iconl.insert(0,defaultprofile);
|
|
216 |
currentdefaultprofile = i;
|
|
217 |
}
|
|
218 |
icon = 0;
|
|
219 |
if(lock)
|
|
220 |
{
|
|
221 |
Iconl.insert(1,icon3);
|
|
222 |
lock = false;
|
|
223 |
}
|
|
224 |
QVariant iconlist(Iconl);
|
|
225 |
iconlist.setValue(Iconl);
|
|
226 |
item->setData(liststr , Qt::DisplayRole);
|
|
227 |
item->setData(iconlist , Qt::DecorationRole);
|
|
228 |
model->setItem(i, item);
|
|
229 |
}
|
|
230 |
list->setModel(model,prototype);
|
|
231 |
list->setItemRecycling(false);
|
|
232 |
connect(list, SIGNAL(longPressed(HbAbstractViewItem*,QPointF)),
|
|
233 |
this, SLOT(handleLongPress(HbAbstractViewItem*,QPointF)));
|
|
234 |
|
|
235 |
connect(list, SIGNAL(activated(QModelIndex)), this, SLOT(handleClicked(QModelIndex)));
|
|
236 |
|
|
237 |
qDebug("omadm launching other details list");
|
|
238 |
otherdetailslist = qobject_cast<HbListView *>(docmlLoader->findWidget( LISTOTHERDETAILS ) );
|
|
239 |
otherdetailslist->listItemPrototype()->setStretchingStyle(HbListViewItem::StretchLandscape);
|
|
240 |
otherdetailslist->setLongPressEnabled(EFalse);
|
|
241 |
qDebug("omadm launching other details list done");
|
|
242 |
mainCalltoUpdateView();
|
|
243 |
|
|
244 |
|
|
245 |
newserverprofile = qobject_cast<HbPushButton *>(docmlLoader->findWidget(NEWSERVERBUTTON));
|
|
246 |
newserverprofile->setText(hbTrId("txt_device_update_button_new_server_profile"));
|
|
247 |
connect(newserverprofile, SIGNAL(clicked()),this, SLOT(createNewProfile()));
|
|
248 |
|
|
249 |
label = qobject_cast<HbLabel *>(docmlLoader->findWidget(LABEL));
|
|
250 |
label->setPlainText(hbTrId("txt_device_update_subhead_advanced_device_updates"));
|
|
251 |
|
|
252 |
setWidget(viewwidget);
|
|
253 |
}
|
|
254 |
else
|
|
255 |
{
|
|
256 |
qDebug("omadm docml section loading failed");
|
|
257 |
}
|
|
258 |
return ok;
|
|
259 |
}
|
|
260 |
|
|
261 |
void DmAdvancedView::updateEarlierdefaultProfileIcon()
|
|
262 |
{
|
|
263 |
if(currentdefaultprofile >= 0)
|
|
264 |
{
|
|
265 |
QStandardItem *modelItem = model->item(currentdefaultprofile);
|
|
266 |
//Find the transport type & set the icon
|
|
267 |
int transporttype = 0;
|
|
268 |
dminfo->profileTransport(currentdefaultprofile,transporttype);
|
|
269 |
if(transporttype == 0)//Internet
|
|
270 |
{
|
|
271 |
modelItem->setIcon(internet);
|
|
272 |
}
|
|
273 |
else
|
|
274 |
{
|
|
275 |
modelItem->setIcon(bluetooth);
|
|
276 |
}
|
|
277 |
}
|
|
278 |
}
|
|
279 |
|
|
280 |
void DmAdvancedView::createNewProfile()
|
|
281 |
{
|
|
282 |
if(dminfo->createNewprofile())
|
|
283 |
{
|
|
284 |
//Open server settings view
|
|
285 |
QString newserverprof(hbTrId("txt_device_update_setlabel_new_server_profile"));
|
|
286 |
if(!serverSetView)
|
|
287 |
{
|
|
288 |
serverSetView = new ServerSettingsView(iMainWindow, this, newserverprof);
|
|
289 |
}
|
|
290 |
else // view already created
|
|
291 |
{
|
|
292 |
//Just update the setting items as per this profile
|
|
293 |
serverSetView->makeviewItemsVisible(newserverprof);
|
|
294 |
}
|
|
295 |
QStringList serveritems;
|
|
296 |
serveritems<< "" <<"" <<"" <<"" <<""<<""<<""<<"";
|
|
297 |
bool sessmode = true;
|
|
298 |
bool nauth = true;
|
|
299 |
QStringList apdata;
|
|
300 |
int currap =-1;
|
|
301 |
int destap = 0;
|
|
302 |
dminfo->getIaplist(apdata,currap,destap);
|
|
303 |
int portnum = 8080;
|
|
304 |
serverSetView->setProfileValues(serveritems,sessmode,apdata,currap,portnum,nauth);
|
|
305 |
iMainWindow->setCurrentView(serverSetView);
|
|
306 |
}
|
|
307 |
else // profile not getting created
|
|
308 |
{
|
|
309 |
qDebug("OMADM New server profile creation failed");
|
|
310 |
}
|
|
311 |
}
|
|
312 |
|
|
313 |
void DmAdvancedView::saveProfile(QStringList& itemdata, bool& sessmode, QString& currap,unsigned int& portnum, bool& nauth )
|
|
314 |
{
|
|
315 |
dminfo->DisableDbNotifications(true);
|
|
316 |
dminfo->saveProfile(itemdata,sessmode,currap,portnum,nauth);
|
|
317 |
updateListview();
|
|
318 |
dminfo->DisableDbNotifications(false);
|
|
319 |
}
|
|
320 |
|
|
321 |
void DmAdvancedView::updateListview()
|
|
322 |
{
|
|
323 |
model->clear();
|
|
324 |
int IndicatorCount =dminfo->profilescount();
|
|
325 |
for (int i = 0; IndicatorCount > 0 && i < IndicatorCount; ++i) {
|
|
326 |
QStringList liststr;
|
|
327 |
bool lock = false;
|
|
328 |
int icon = 0;
|
|
329 |
int ret = dminfo->profileinfo(i,liststr,icon, lock);
|
|
330 |
if(ret <= 0)
|
|
331 |
{
|
|
332 |
break;
|
|
333 |
}
|
|
334 |
QStandardItem* item ;
|
|
335 |
item = new QStandardItem();
|
|
336 |
HbIcon icon1;
|
|
337 |
icon1.setIconName(":/icons/qgn_prop_sml_http.svg");
|
|
338 |
HbIcon icon2;
|
|
339 |
icon2.setIconName(":/icons/qgn_prop_sml_bt.svg");
|
|
340 |
HbIcon icon3;
|
|
341 |
icon3.setIconName(":/icons/qgn_indi_sett_protected_add.svg");
|
|
342 |
HbIcon defaultprofile;
|
|
343 |
defaultprofile.setIconName(":/icons/qtg_large_avatar.svg");
|
|
344 |
QList<QVariant> Iconl;
|
|
345 |
if(icon == 0)//Internet
|
|
346 |
Iconl.insert(0,icon1);
|
|
347 |
else if(icon == 1)//Bluetooth
|
|
348 |
Iconl.insert(0,icon2);
|
|
349 |
else //Default profile
|
|
350 |
{
|
|
351 |
Iconl.insert(0,defaultprofile);
|
|
352 |
currentdefaultprofile = i;
|
|
353 |
}
|
|
354 |
icon = 0;
|
|
355 |
if(lock)
|
|
356 |
{
|
|
357 |
Iconl.insert(1,icon3);
|
|
358 |
lock = false;
|
|
359 |
}
|
|
360 |
QVariant iconlist(Iconl);
|
|
361 |
iconlist.setValue(Iconl);
|
|
362 |
item->setData(liststr , Qt::DisplayRole);
|
|
363 |
item->setData(iconlist , Qt::DecorationRole);
|
|
364 |
model->setItem(i, item);
|
|
365 |
}
|
|
366 |
model->sort(0);
|
|
367 |
}
|
|
368 |
|
|
369 |
void DmAdvancedView::serversListGroupClicked(bool state)
|
|
370 |
{
|
|
371 |
Q_UNUSED(state);
|
|
372 |
if(serversListGroup->isCollapsed())
|
|
373 |
otherDetailsGroup->setCollapsed(false);
|
|
374 |
else
|
|
375 |
otherDetailsGroup->setCollapsed(true);
|
|
376 |
}
|
|
377 |
|
|
378 |
void DmAdvancedView::otherDetailsGroupClicked(bool state)
|
|
379 |
{
|
|
380 |
Q_UNUSED(state);
|
|
381 |
if(otherDetailsGroup->isCollapsed())
|
|
382 |
serversListGroup->setCollapsed(false);
|
|
383 |
else
|
|
384 |
serversListGroup->setCollapsed(true);
|
|
385 |
}
|
|
386 |
|
|
387 |
bool DmAdvancedView::checkServerId(QString& serverid)
|
|
388 |
{
|
|
389 |
return dminfo->checksrvid(serverid);
|
|
390 |
}
|
|
391 |
|
|
392 |
void DmAdvancedView::reLayout(Qt::Orientation orientation)
|
|
393 |
{
|
|
394 |
qDebug("OMADM servers view DmAdvancedView::reLayout");
|
|
395 |
if(orientation == Qt::Horizontal)
|
|
396 |
{
|
|
397 |
qDebug("OMADM servers view landscape");
|
|
398 |
docmlLoader->load(DOCML_FILE_NAME,LANDSCAPE);
|
|
399 |
}
|
|
400 |
else
|
|
401 |
{
|
|
402 |
qDebug("OMADM servers view portrait");
|
|
403 |
bool ok;
|
|
404 |
docmlLoader->load( DOCML_FILE_NAME, PORTRAIT, &ok );
|
|
405 |
}
|
|
406 |
|
|
407 |
|
|
408 |
}
|
|
409 |
|
|
410 |
void DmAdvancedView::setBackBehavior()
|
|
411 |
{
|
|
412 |
if (!backbehaviorset)
|
|
413 |
{
|
|
414 |
qDebug("OMADM servers view back behavior setting");
|
|
415 |
backaction = new HbAction(Hb::BackNaviAction, this);
|
|
416 |
connect(backaction, SIGNAL(triggered()), this,
|
|
417 |
SLOT(backButtonClicked()));
|
|
418 |
setNavigationAction(backaction);
|
|
419 |
backbehaviorset = true;
|
|
420 |
}
|
|
421 |
qDebug("OMADM servers view back behavior setting done");
|
|
422 |
}
|
|
423 |
|
|
424 |
void DmAdvancedView::backButtonClicked()
|
|
425 |
{
|
|
426 |
QList <HbView*> views = iMainWindow->views();
|
|
427 |
if(iMainWindow->orientation()==Qt::Vertical)
|
|
428 |
{
|
|
429 |
iMainWindow->setCurrentView(views[0]);
|
|
430 |
}
|
|
431 |
else
|
|
432 |
{
|
|
433 |
iMainWindow->setCurrentView(views[1]);
|
|
434 |
}
|
|
435 |
}
|
|
436 |
|
|
437 |
|
|
438 |
void DmAdvancedView::mainCalltoUpdateView()
|
|
439 |
{
|
|
440 |
int IndicatorCount =6;
|
|
441 |
otherdetailsmodel = new QStandardItemModel(IndicatorCount,0);
|
|
442 |
TInt i=0;
|
|
443 |
TRequestStatus status;
|
|
444 |
QStringList liststr;
|
|
445 |
QStandardItem* item;
|
|
446 |
QString val;
|
|
447 |
QString str;
|
|
448 |
|
|
449 |
iServer.Connect();
|
|
450 |
iServer.GetPhoneInfo(0, info);
|
|
451 |
imobPhone.Open(iServer, info.iName);
|
|
452 |
//Bands supported
|
|
453 |
|
|
454 |
RMobilePhone::TMobilePhoneNetworkInfoV1 nwInfov1;
|
|
455 |
RMobilePhone::TMobilePhoneNetworkInfoV1Pckg nwInfov1Pckg(nwInfov1);
|
|
456 |
imobPhone.GetCurrentNetwork(status, nwInfov1Pckg);
|
|
457 |
User::WaitForRequest( status );
|
|
458 |
status = KRequestPending;
|
|
459 |
nwInfov1 = nwInfov1Pckg();
|
|
460 |
NetworkBand(nwInfov1.iBandInfo, str);
|
|
461 |
item = new QStandardItem();
|
|
462 |
val = hbTrId("txt_device_update_dblist_gsm_bands");
|
|
463 |
liststr << val;
|
|
464 |
liststr << str;
|
|
465 |
item->setData(liststr , Qt::DisplayRole);
|
|
466 |
otherdetailsmodel->setItem(i++, item);
|
|
467 |
|
|
468 |
//Packet Service
|
|
469 |
|
|
470 |
TInt packetsrvc =0;
|
|
471 |
RMobilePhone::TMobilePhoneNetworkInfoV5 nwInfov5;
|
|
472 |
RMobilePhone::TMobilePhoneNetworkInfoV5Pckg nwInfov5Pckg(nwInfov5);
|
|
473 |
imobPhone.GetCurrentNetwork( status, nwInfov5Pckg );
|
|
474 |
User::WaitForRequest( status );
|
|
475 |
status = KRequestPending;
|
|
476 |
nwInfov5 = nwInfov5Pckg();
|
|
477 |
|
|
478 |
if(nwInfov5.iHsdpaAvailableIndicator) packetsrvc =1;
|
|
479 |
|
|
480 |
if(nwInfov5.iEgprsAvailableIndicator) packetsrvc =2;
|
|
481 |
|
|
482 |
if(!packetsrvc)
|
|
483 |
{
|
|
484 |
RMobilePhone::TMobilePhoneNetworkInfoV8 nwInfov8;
|
|
485 |
RMobilePhone::TMobilePhoneNetworkInfoV8Pckg nwInfov8Pckg(nwInfov8);
|
|
486 |
imobPhone.GetCurrentNetwork( status, nwInfov8Pckg );
|
|
487 |
User::WaitForRequest( status );
|
|
488 |
status = KRequestPending;
|
|
489 |
nwInfov8 = nwInfov8Pckg();
|
|
490 |
if(nwInfov8.iHsupaAvailableIndicator) packetsrvc =3;
|
|
491 |
}
|
|
492 |
liststr.clear();
|
|
493 |
val = hbTrId("txt_device_update_dblist_wcdma_uldl_data_rates");
|
|
494 |
liststr << val;
|
|
495 |
item = new QStandardItem();
|
|
496 |
PacketService(packetsrvc, str);
|
|
497 |
liststr << str;
|
|
498 |
item->setData(liststr , Qt::DisplayRole);
|
|
499 |
otherdetailsmodel->setItem(i++, item);
|
|
500 |
|
|
501 |
// Ciphering
|
|
502 |
|
|
503 |
liststr.clear();
|
|
504 |
item = new QStandardItem();
|
|
505 |
val = hbTrId("txt_device_update_dblist_gsm_cipherings");
|
|
506 |
liststr << val;
|
|
507 |
imobPhone.GetNetworkSecurityLevel(status,idispSecurity);
|
|
508 |
User::WaitForRequest( status );
|
|
509 |
NetworkCiphering(idispSecurity, str);
|
|
510 |
liststr << str;
|
|
511 |
item->setData(liststr, Qt::DisplayRole);
|
|
512 |
otherdetailsmodel->setItem(i++, item);
|
|
513 |
|
|
514 |
// WLAN MAC
|
|
515 |
|
|
516 |
TUint KPhoneWlanSeparator (':');
|
|
517 |
_LIT( KWLanMACDataFormat, "%02x");
|
|
518 |
// Fetch WLAN MAC address
|
|
519 |
TBuf<KWlanMacAddrLength> address;
|
|
520 |
RProperty::Get( KPSUidWlan, KPSWlanMacAddress, address );
|
|
521 |
// Format fetched address
|
|
522 |
TBuf<KWlanMacAddrLength> wlanMACAddress;
|
|
523 |
for ( TInt i( 0 ); i < address.Length(); i++ )
|
|
524 |
{
|
|
525 |
// Set separator
|
|
526 |
if( i > 0 )
|
|
527 |
{
|
|
528 |
wlanMACAddress.Append( KPhoneWlanSeparator );
|
|
529 |
}
|
|
530 |
// Set data
|
|
531 |
TBuf<50> tmp;
|
|
532 |
tmp.Format( KWLanMACDataFormat, address[i] );
|
|
533 |
wlanMACAddress.Append( tmp );
|
|
534 |
}
|
|
535 |
liststr.clear();
|
|
536 |
item = new QStandardItem();
|
|
537 |
val = hbTrId("txt_device_update_dblist_wlan_mac_address");
|
|
538 |
liststr << val;
|
|
539 |
str = QString::fromUtf16(wlanMACAddress.Ptr(), wlanMACAddress.Length());
|
|
540 |
liststr << str;
|
|
541 |
item->setData(liststr, Qt::DisplayRole);
|
|
542 |
otherdetailsmodel->setItem(i++, item);
|
|
543 |
|
|
544 |
// BT MAC
|
|
545 |
|
|
546 |
TBuf<KBTAddrLength> addressBuffer;
|
|
547 |
// Fetch from Cenrep
|
|
548 |
CRepository* repository = NULL;
|
|
549 |
TRAPD( err, repository = CRepository::NewL( KCRUidBluetoothLocalDeviceAddress ) );
|
|
550 |
if ( err == KErrNone )
|
|
551 |
{
|
|
552 |
qDebug("KCRUidBluetoothLocalDeviceAddress errnone");
|
|
553 |
err = repository->Get( KBTLocalDeviceAddress, addressBuffer );
|
|
554 |
|
|
555 |
if (err == KErrNone)
|
|
556 |
qDebug("KBTLocalDeviceAddress errnone");
|
|
557 |
else
|
|
558 |
qDebug("KBTLocalDeviceAddress Error");
|
|
559 |
|
|
560 |
delete repository;
|
|
561 |
}
|
|
562 |
else
|
|
563 |
{
|
|
564 |
qDebug("KCRUidBluetoothLocalDeviceAddress Error openin cenrep");
|
|
565 |
}
|
|
566 |
liststr.clear();
|
|
567 |
val = hbTrId("txt_device_update_dblist_bt_mac_address");
|
|
568 |
liststr << val;
|
|
569 |
item = new QStandardItem();
|
|
570 |
str = QString::fromUtf16(addressBuffer.Ptr(), addressBuffer.Length());
|
|
571 |
liststr << str;
|
|
572 |
item->setData(liststr , Qt::DisplayRole);
|
|
573 |
otherdetailsmodel->setItem(i++, item);
|
|
574 |
|
|
575 |
otherdetailslist->setModel(otherdetailsmodel);
|
|
576 |
|
|
577 |
}
|
|
578 |
|
|
579 |
void DmAdvancedView::PacketService(TInt val, QString& string)
|
|
580 |
{
|
|
581 |
switch (val)
|
|
582 |
{
|
|
583 |
case (0):
|
|
584 |
string = hbTrId("txt_device_update_dblist_wcdma_uldl_data_val_l1");
|
|
585 |
break;
|
|
586 |
case (1):
|
|
587 |
string = hbTrId("txt_device_update_dblist_wcdma_uldl_data_val_l2");
|
|
588 |
break;
|
|
589 |
case (2):
|
|
590 |
string = hbTrId("txt_device_update_dblist_wcdma_uldl_data_val_l3");
|
|
591 |
break;
|
|
592 |
case (3):
|
|
593 |
string = hbTrId("txt_device_update_dblist_wcdma_uldl_data_val_l4");
|
|
594 |
break;
|
|
595 |
case (4):
|
|
596 |
string = hbTrId("txt_device_update_dblist_gsm_cipherings_val_l4");
|
|
597 |
break;
|
|
598 |
case (5):
|
|
599 |
default :
|
|
600 |
string = hbTrId("txt_device_update_dblist_wcdma_uldl_data_val_l5");
|
|
601 |
break;
|
|
602 |
}
|
|
603 |
}
|
|
604 |
|
|
605 |
|
|
606 |
void DmAdvancedView::NetworkCiphering(RMobilePhone::TMobilePhoneNetworkSecurity val, QString& string)
|
|
607 |
{
|
|
608 |
switch (val)
|
|
609 |
{
|
|
610 |
case (RMobilePhone::ECipheringGSM):
|
|
611 |
string = hbTrId("txt_device_update_dblist_gsm_cipherings_val_l2");
|
|
612 |
break;
|
|
613 |
case (RMobilePhone::ECipheringWCDMA):
|
|
614 |
string = hbTrId("txt_device_update_dblist_gsm_cipherings_val_l3");
|
|
615 |
break;
|
|
616 |
case (RMobilePhone::ECipheringCDMA):
|
|
617 |
string = hbTrId("txt_device_update_dblist_gsm_cipherings_val_l4");
|
|
618 |
break;
|
|
619 |
case (RMobilePhone::ECipheringOff):
|
|
620 |
default :
|
|
621 |
string = hbTrId("txt_device_update_dblist_gsm_cipherings_val_l1");
|
|
622 |
break;
|
|
623 |
}
|
|
624 |
}
|
|
625 |
|
|
626 |
void DmAdvancedView::NetworkBand(RMobilePhone::TMobilePhoneNetworkBandInfo val, QString& string)
|
|
627 |
{
|
|
628 |
switch (val)
|
|
629 |
{
|
|
630 |
case (RMobilePhone::E800BandA):
|
|
631 |
string = hbTrId("txt_device_update_dblist_gsm_bands_val_l2");
|
|
632 |
break;
|
|
633 |
case (RMobilePhone::E800BandB):
|
|
634 |
string = hbTrId("txt_device_update_dblist_gsm_bands_val_l3");
|
|
635 |
break;
|
|
636 |
case (RMobilePhone::E800BandC):
|
|
637 |
string = hbTrId("txt_device_update_dblist_gsm_bands_val_l4");
|
|
638 |
break;
|
|
639 |
case (RMobilePhone::E1900BandA):
|
|
640 |
string = hbTrId("txt_device_update_dblist_gsm_bands_val_l5");
|
|
641 |
break;
|
|
642 |
case (RMobilePhone::E1900BandB):
|
|
643 |
string = hbTrId("txt_device_update_dblist_gsm_bands_val_l6");
|
|
644 |
break;
|
|
645 |
case (RMobilePhone::E1900BandC):
|
|
646 |
string = hbTrId("txt_device_update_dblist_gsm_bands_val_l7");
|
|
647 |
break;
|
|
648 |
case (RMobilePhone::E1900BandD):
|
|
649 |
string = hbTrId("txt_device_update_dblist_gsm_bands_val_l8");
|
|
650 |
break;
|
|
651 |
case (RMobilePhone::E1900BandE):
|
|
652 |
string = hbTrId("txt_device_update_dblist_gsm_bands_val_l9");
|
|
653 |
break;
|
|
654 |
case (RMobilePhone::E1900BandF):
|
|
655 |
string = hbTrId("txt_device_update_dblist_gsm_bands_val_l10");
|
|
656 |
break;
|
|
657 |
case (RMobilePhone::EBandUnknown):
|
|
658 |
default :
|
|
659 |
string = hbTrId("txt_device_update_dblist_gsm_bands_val_l1");
|
|
660 |
break;
|
|
661 |
}
|
|
662 |
}
|
|
663 |
|
|
664 |
void DmAdvancedView::syncCompleted(int jobstatus)
|
|
665 |
{
|
|
666 |
Q_UNUSED(jobstatus);
|
|
667 |
connectionRequested = false;
|
|
668 |
updateListview();
|
|
669 |
}
|
|
670 |
|