deviceupdatesui/deviceupdates/src/dmadvancedview.cpp
changeset 42 aa33c2cb9a50
parent 27 516a867811c3
child 53 1273bf2c520c
equal deleted inserted replaced
41:c742e1129640 42:aa33c2cb9a50
    15 * Description:  Methods for DmAdvancedView.
    15 * Description:  Methods for DmAdvancedView.
    16 *
    16 *
    17 */
    17 */
    18 #include <hbnamespace.h>
    18 #include <hbnamespace.h>
    19 #include "dmadvancedview.h"
    19 #include "dmadvancedview.h"
       
    20 #include "dmfotaview.h"
    20 #include "serversettingsview.h"
    21 #include "serversettingsview.h"
    21 
    22 
    22 DmAdvancedView::DmAdvancedView(HbMainWindow *mainWindow, HbView *mainView, QGraphicsItem *parent):HbView(parent),
    23 DmAdvancedView::DmAdvancedView(HbMainWindow *mainWindow,DMFotaView *mainView, DmInfo *info, QGraphicsItem *parent):HbView(parent),
    23     bluetooth(":/icons/qgn_prop_sml_bt.svg"),
    24     bluetooth(":/icons/qgn_prop_sml_bt.svg"),
    24     internet(":/icons/qgn_prop_sml_http.svg"), 
    25     internet(":/icons/qgn_prop_sml_http.svg"), 
    25     defaultprofileicon(":/icons/qtg_large_avatar.svg")                
    26     defaultprofileicon(":/icons/qtg_large_avatar.svg")                
    26     {
    27     {
       
    28     qDebug("omadm DeviceManagerUi::DmAdvancedView >>");
    27     iMainWindow = mainWindow;
    29     iMainWindow = mainWindow;
    28     serverSetView = NULL;
    30     serverSetView = NULL;
    29     iMainView = mainView;
    31     iMainView = mainView;
    30     dminfo = new DmInfo(this);
    32     if(info==NULL)
       
    33         {
       
    34         dminfo = new DmInfo(this);
       
    35         }
       
    36     else 
       
    37         dminfo = info;
    31     currentdefaultprofile = -1;
    38     currentdefaultprofile = -1;
    32     currentview = 0;
    39     currentview = 0;
    33     connectionRequested = false;    
    40     connectionRequested = false;    
    34     backbehaviorset = false;
    41     backbehaviorset = false;
    35     currentselecteditem = -1;
    42     currentselecteditem = -1;
       
    43     qDebug("omadm DeviceManagerUi::DmAdvancedView >>");
    36     }
    44     }
    37 
    45 
    38 DmAdvancedView::~DmAdvancedView()
    46 DmAdvancedView::~DmAdvancedView()
    39     {
    47     {
    40     qDebug("omadm DmAdvancedView::~DmAdvancedView");
    48     qDebug("omadm DmAdvancedView::~DmAdvancedView");
    45     qDebug("omadm DmAdvancedView::~DmAdvancedView end"); 
    53     qDebug("omadm DmAdvancedView::~DmAdvancedView end"); 
    46     }
    54     }
    47 
    55 
    48 void DmAdvancedView::handleLongPress(HbAbstractViewItem* item , QPointF coOrdinates)
    56 void DmAdvancedView::handleLongPress(HbAbstractViewItem* item , QPointF coOrdinates)
    49     {
    57     {
    50     if (connectionRequested)
    58     qDebug("omadm DeviceManagerUi::handleLongPress >>");
       
    59     if(connectionRequested)
    51         return;
    60         return;
    52     if (item)
    61     if (item)
    53         {
    62         {
    54         modelItem = model->itemFromIndex(item->modelIndex());
    63         modelItem = model->itemFromIndex(item->modelIndex());
    55         currentselecteditem = modelItem->row();
    64         currentselecteditem = modelItem->row();
    78         connect(connectaction, SIGNAL(triggered()), this,
    87         connect(connectaction, SIGNAL(triggered()), this,
    79                 SLOT(connectMenuItemSelected()));
    88                 SLOT(connectMenuItemSelected()));
    80         csmenu->setPreferredPos(coOrdinates);
    89         csmenu->setPreferredPos(coOrdinates);
    81         csmenu->open();
    90         csmenu->open();
    82         }
    91         }
       
    92     qDebug("omadm DeviceManagerUi::handleLongPress >>");
    83     }
    93     }
    84 
    94 
    85 
    95 
    86 void DmAdvancedView::handleClicked(QModelIndex index)
    96 void DmAdvancedView::handleClicked(QModelIndex index)
    87     {
    97     {
       
    98     qDebug("omadm DeviceManagerUi::handleClicked >>");
    88     if(connectionRequested)
    99     if(connectionRequested)
    89         return;
   100         return;
    90     //Stop listening DB events for profile addition
   101     //Stop listening DB events for profile addition
    91     dminfo->DisableDbNotifications(true);
   102     dminfo->DisableDbNotifications(true);
    92     //If profile is not locked then take to edit server view
   103     //If profile is not locked then take to edit server view
   115             }        
   126             }        
   116         serverSetView->setProfileValues(itemdata,sessmode,iaplist,curriap,portnum,nwauth);
   127         serverSetView->setProfileValues(itemdata,sessmode,iaplist,curriap,portnum,nwauth);
   117         iMainWindow->setCurrentView(serverSetView);
   128         iMainWindow->setCurrentView(serverSetView);
   118   
   129   
   119         }
   130         }
       
   131     qDebug("omadm DeviceManagerUi::handleClicked >>");
   120     }
   132     }
   121 
   133 
   122 bool DmAdvancedView::displayItems()
   134 bool DmAdvancedView::displayItems()
   123     {    	
   135     {    	
       
   136     qDebug("omadm DeviceManagerUi::displayItems >>");
   124     docmlLoader = new HbDocumentLoader;
   137     docmlLoader = new HbDocumentLoader;
   125     bool ok ;    
   138     bool ok ;    
   126     docmlLoader->load( DOCML_FILE_NAME,  &ok  );
   139     docmlLoader->load( DOCML_FILE_NAME,  &ok  );
   127     if(ok)
   140     if(ok)
   128     	{
   141     	{
   231         }
   244         }
   232     else 
   245     else 
   233         {
   246         {
   234         qDebug("omadm docml section loading failed");
   247         qDebug("omadm docml section loading failed");
   235         }    
   248         }    
       
   249     qDebug("omadm DeviceManagerUi::displayItems >>");
   236     return ok;
   250     return ok;
   237     }
   251     }
   238 
   252 
   239 void DmAdvancedView::updateEarlierdefaultProfileIcon()
   253 void DmAdvancedView::updateEarlierdefaultProfileIcon()
   240     {
   254     {
       
   255     qDebug("omadm DeviceManagerUi::updateEarlierdefaultProfileIcon >>");
   241     if(currentdefaultprofile >= 0)
   256     if(currentdefaultprofile >= 0)
   242         {
   257         {
   243         QStandardItem *earlierDefaultProfile = model->item(currentdefaultprofile);
   258         QStandardItem *earlierDefaultProfile = model->item(currentdefaultprofile);
   244         //Find the transport type & set the icon
   259         //Find the transport type & set the icon
   245         int transporttype = 0;
   260         int transporttype = 0;
   251         else
   266         else
   252             {
   267             {
   253             earlierDefaultProfile->setIcon(bluetooth);
   268             earlierDefaultProfile->setIcon(bluetooth);
   254             }        
   269             }        
   255         }
   270         }
       
   271     qDebug("omadm DeviceManagerUi::updateEarlierdefaultProfileIcon >>");
   256     }
   272     }
   257 
   273 
   258 void DmAdvancedView::createNewProfile()
   274 void DmAdvancedView::createNewProfile()
   259     {
   275     {
       
   276     qDebug("omadm DeviceManagerUi::createNewProfile >>");
   260     if(dminfo->createNewprofile())
   277     if(dminfo->createNewprofile())
   261         {
   278         {
   262         //Open server settings view    
   279         //Open server settings view    
   263         QString newserverprof(hbTrId("txt_device_update_setlabel_new_server_profile"));    
   280         QString newserverprof(hbTrId("txt_device_update_setlabel_new_server_profile"));    
   264         if(!serverSetView)
   281         if(!serverSetView)
   284         }
   301         }
   285     else // profile not getting created
   302     else // profile not getting created
   286         {
   303         {
   287         qDebug("OMADM New server profile creation failed");
   304         qDebug("OMADM New server profile creation failed");
   288         }
   305         }
       
   306     qDebug("omadm DeviceManagerUi::createNewProfile >>");
   289     }
   307     }
   290 
   308 
   291 void DmAdvancedView::saveProfile(QStringList& itemdata, bool& sessmode, QString& currap,unsigned int& portnum, bool& nauth )
   309 void DmAdvancedView::saveProfile(QStringList& itemdata, bool& sessmode, QString& currap,unsigned int& portnum, bool& nauth )
   292     {
   310     {
       
   311     qDebug("omadm DeviceManagerUi::saveProfile >>");
   293     dminfo->DisableDbNotifications(true);
   312     dminfo->DisableDbNotifications(true);
   294     dminfo->saveProfile(itemdata,sessmode,currap,portnum,nauth);
   313     dminfo->saveProfile(itemdata,sessmode,currap,portnum,nauth);
   295     updateListview();
   314     updateListview();
   296     dminfo->DisableDbNotifications(false);
   315     dminfo->DisableDbNotifications(false);
       
   316     qDebug("omadm DeviceManagerUi::saveProfile >>");
   297     }
   317     }
   298 
   318 
   299 void DmAdvancedView::updateListview()
   319 void DmAdvancedView::updateListview()
   300     {
   320     {
       
   321     qDebug("omadm DeviceManagerUi::updateListview >>");
   301     model->clear();
   322     model->clear();
   302     int IndicatorCount =dminfo->profilescount();    
   323     int IndicatorCount =dminfo->profilescount();    
   303     for (int i = 0; IndicatorCount > 0 && i < IndicatorCount; ++i) {    
   324     for (int i = 0; IndicatorCount > 0 && i < IndicatorCount; ++i) {    
   304     QStringList liststr;
   325     QStringList liststr;
   305     bool lock = false;
   326     bool lock = false;
   340     item->setData(liststr , Qt::DisplayRole);
   361     item->setData(liststr , Qt::DisplayRole);
   341     item->setData(iconlist , Qt::DecorationRole);
   362     item->setData(iconlist , Qt::DecorationRole);
   342     model->setItem(i, item);    
   363     model->setItem(i, item);    
   343     }    
   364     }    
   344     model->sort(0);
   365     model->sort(0);
       
   366     qDebug("omadm DeviceManagerUi::updateListview >>");
   345     }
   367     }
   346 
   368 
   347 void DmAdvancedView::serversListGroupClicked(bool state)
   369 void DmAdvancedView::serversListGroupClicked(bool state)
   348     {
   370     {
       
   371     qDebug("omadm DeviceManagerUi::serversListGroupClicked >>");
   349     Q_UNUSED(state);
   372     Q_UNUSED(state);
   350     if(serversListGroup->isCollapsed())
   373     if(serversListGroup->isCollapsed())
   351         otherDetailsGroup->setCollapsed(false);
   374         otherDetailsGroup->setCollapsed(false);
   352     else
   375     else
   353         otherDetailsGroup->setCollapsed(true);
   376         otherDetailsGroup->setCollapsed(true);
       
   377     qDebug("omadm DeviceManagerUi::serversListGroupClicked >>");
   354     }
   378     }
   355 
   379 
   356 void DmAdvancedView::otherDetailsGroupClicked(bool state)
   380 void DmAdvancedView::otherDetailsGroupClicked(bool state)
   357     {
   381     {
       
   382     qDebug("omadm DeviceManagerUi::otherDetailsGroupClicked >>");
   358     Q_UNUSED(state);
   383     Q_UNUSED(state);
   359     if(otherDetailsGroup->isCollapsed())
   384     if(otherDetailsGroup->isCollapsed())
   360         serversListGroup->setCollapsed(false);
   385         serversListGroup->setCollapsed(false);
   361     else
   386     else
   362         serversListGroup->setCollapsed(true);
   387         serversListGroup->setCollapsed(true);
       
   388     qDebug("omadm DeviceManagerUi::otherDetailsGroupClicked >>");
   363     }
   389     }
   364 
   390 
   365 bool DmAdvancedView::checkServerId(QString& serverid)
   391 bool DmAdvancedView::checkServerId(QString& serverid)
   366     {
   392     {
       
   393     qDebug("omadm DeviceManagerUi::CheckforUpdate >>");
   367     return dminfo->checksrvid(serverid);
   394     return dminfo->checksrvid(serverid);
       
   395     qDebug("omadm DeviceManagerUi::CheckforUpdate >>");
   368     }
   396     }
   369 
   397 
   370 void DmAdvancedView::reLayout(Qt::Orientation orientation)
   398 void DmAdvancedView::reLayout(Qt::Orientation orientation)
   371     {
   399     {   
   372     qDebug("OMADM servers view DmAdvancedView::reLayout");
   400     qDebug("OMADM servers view DmAdvancedView::reLayout <<");
   373     if(orientation == Qt::Horizontal)
   401     if(orientation == Qt::Horizontal)
   374         {
   402         {
   375         qDebug("OMADM servers view landscape");
   403         qDebug("OMADM servers view landscape");
   376         docmlLoader->load(DOCML_FILE_NAME,LANDSCAPE); 
   404         docmlLoader->load(DOCML_FILE_NAME,LANDSCAPE); 
   377         }
   405         }
   379         {
   407         {
   380         qDebug("OMADM servers view portrait");	        
   408         qDebug("OMADM servers view portrait");	        
   381         bool ok;
   409         bool ok;
   382         docmlLoader->load( DOCML_FILE_NAME,  PORTRAIT, &ok  );
   410         docmlLoader->load( DOCML_FILE_NAME,  PORTRAIT, &ok  );
   383         }
   411         }
   384     
   412     qDebug("OMADM servers view DmAdvancedView::reLayout >>");
   385     
       
   386     }
   413     }
   387 
   414 
   388 void DmAdvancedView::setBackBehavior()
   415 void DmAdvancedView::setBackBehavior()
   389     {
   416     {
       
   417     qDebug("OMADM servers view DmAdvancedView::setBackBehavior <<");
   390     if (!backbehaviorset)
   418     if (!backbehaviorset)
   391         {
   419         {
   392         qDebug("OMADM servers view back behavior setting");
   420         qDebug("OMADM servers view back behavior setting");
   393         backaction = new HbAction(Hb::BackNaviAction, this);
   421         backaction = new HbAction(Hb::BackNaviAction, this);
   394         connect(backaction, SIGNAL(triggered()), this,
   422         connect(backaction, SIGNAL(triggered()), this,
   395                 SLOT(backButtonClicked()));
   423                 SLOT(backButtonClicked()));
   396         setNavigationAction(backaction);
   424         setNavigationAction(backaction);
   397         backbehaviorset = true;
   425         backbehaviorset = true;
   398         }
   426         }
   399     qDebug("OMADM servers view back behavior setting done");
   427     qDebug("OMADM servers view back behavior setting done setBackBehavior >>");
   400     }
   428     }
   401 
   429 
   402 void DmAdvancedView::backButtonClicked()
   430 void DmAdvancedView::backButtonClicked()
   403     {    
   431     {    
       
   432     qDebug("OMADM servers view DmAdvancedView::backButtonClicked <<");
   404     QList <HbView*> views = iMainWindow->views();    
   433     QList <HbView*> views = iMainWindow->views();    
   405     if(iMainWindow->orientation()==Qt::Vertical)
   434     if(iMainWindow->orientation()==Qt::Vertical)
   406             {
   435             {
   407             iMainWindow->setCurrentView(views[0]);
   436             iMainWindow->setCurrentView(views[0]);
   408             }
   437             }
   409         else
   438         else
   410             {
   439             {
   411             iMainWindow->setCurrentView(views[1]);
   440             iMainWindow->setCurrentView(views[1]);
   412             }    
   441             }    
   413     }
   442     qDebug("OMADM servers view DmAdvancedView::backButtonClicked >>");
   414 
   443     }
   415 
   444 
   416 void DmAdvancedView::mainCalltoUpdateView()
   445 void DmAdvancedView::addVersionInfo()
   417 {   
   446     {
   418     int IndicatorCount =6;
   447     qDebug("OMADM servers view DmAdvancedView::addVersionInfo <<");
   419     otherdetailsmodel = new QStandardItemModel();
       
   420     TInt i=0;
       
   421     TRequestStatus status;
       
   422     QStringList liststr;
   448     QStringList liststr;
   423     QStandardItem* item;
   449     QStandardItem* item;
   424     QString val;
   450     QString val;
   425     QString str;
   451     QString str;
   426     
   452     TInt runtimesupport(0);
   427     iServer.Connect();
   453         CRepository* cenrep = NULL;
   428     iServer.GetPhoneInfo(0, info);
   454         TRAPD( error, cenrep = CRepository::NewL( KCRUidNSmlDMSyncApp ) );  
   429     imobPhone.Open(iServer, info.iName);
   455         if(error)
   430     //Bands supported
   456            {     
   431     
   457            FLOG( "[OMADM] CNSmlDMFotaContainer::FormatListboxL() cenrep problem" );
   432     RMobilePhone::TMobilePhoneNetworkInfoV1 nwInfov1;
   458            }    
   433     RMobilePhone::TMobilePhoneNetworkInfoV1Pckg nwInfov1Pckg(nwInfov1);						
   459         if ( cenrep )
   434     imobPhone.GetCurrentNetwork(status, nwInfov1Pckg);
   460            {
   435     User::WaitForRequest( status );
   461            cenrep->Get( KNsmlDmRuntimeVerSupport, runtimesupport );
   436     status = KRequestPending;
   462            delete cenrep; cenrep = NULL;
   437     nwInfov1 = nwInfov1Pckg();
   463            }
   438     NetworkBand(nwInfov1.iBandInfo, str);
   464         //Browser version
   439     item = new QStandardItem();
   465         Swi::RSisRegistrySession sisses ;
   440     val = hbTrId("txt_device_update_dblist_gsm_bands");
   466         TInt r( sisses.Connect() );
   441     liststr << val;
   467         CleanupClosePushL( sisses );
   442     liststr << str;
   468         if (r== KErrNone && runtimesupport)
   443     item->setData(liststr , Qt::DisplayRole);
   469             {           
   444     otherdetailsmodel->setItem(i++, item);
   470              Swi::RSisRegistryEntry sientry;
   445     
   471              TInt oerr = sientry.Open(sisses, browseruid);
   446     //Packet Service
   472              TVersion bversion;
   447     
   473              TBuf <255> browserversion;
   448     TInt packetsrvc =0;
   474              if(oerr == KErrNone)
   449     RMobilePhone::TMobilePhoneNetworkInfoV5 nwInfov5;
   475                  {
   450     RMobilePhone::TMobilePhoneNetworkInfoV5Pckg nwInfov5Pckg(nwInfov5);
   476                  TRAPD(err2,bversion= sientry.VersionL());     
   451     imobPhone.GetCurrentNetwork( status, nwInfov5Pckg );
   477                  if (err2 == KErrNone)
   452     User::WaitForRequest( status );
   478                      {
   453     status = KRequestPending;
   479                      browserversion.AppendNum(bversion.iMajor);
   454     nwInfov5 = nwInfov5Pckg();
   480                      browserversion.Append(_L("."));
   455     
   481                      browserversion.AppendNum(bversion.iMinor);
   456     if(nwInfov5.iHsdpaAvailableIndicator) packetsrvc =1;
   482                      if( browserversion.Length()>0 )
   457     
   483                          {                                
   458     if(nwInfov5.iEgprsAvailableIndicator) packetsrvc =2;
   484                          str = QString::fromUtf16(browserversion.Ptr(), browserversion.Length());
   459     
   485                          item = new QStandardItem();
   460     if(!packetsrvc)
   486                          val = hbTrId("txt_device_update_dblist_browser_version");
   461     {
   487                          liststr.clear();
   462         RMobilePhone::TMobilePhoneNetworkInfoV8 nwInfov8;
   488                          liststr << val;
   463         RMobilePhone::TMobilePhoneNetworkInfoV8Pckg nwInfov8Pckg(nwInfov8);
   489                          liststr << str;
   464         imobPhone.GetCurrentNetwork( status, nwInfov8Pckg );
   490                          item->setData(liststr , Qt::DisplayRole);
       
   491                          //m_otherdetailsmodel->setItem(i++, item);
       
   492                          m_otherdetailsmodel->appendRow(item);
       
   493                          }
       
   494                      }
       
   495                  }
       
   496             }
       
   497         
       
   498         //flash version
       
   499         if (r== KErrNone&& runtimesupport)
       
   500             {           
       
   501               Swi::RSisRegistryEntry sientry;
       
   502               TInt oerr = sientry.Open(sisses, flashuid);
       
   503               TVersion fversion;
       
   504               TBuf <255> flashversion;
       
   505               if(oerr == KErrNone)
       
   506                   {
       
   507                   TRAPD(err2,fversion= sientry.VersionL());         
       
   508                   if (err2 == KErrNone)
       
   509                       {
       
   510                       flashversion.AppendNum(fversion.iMajor);
       
   511                       flashversion.Append(_L("."));
       
   512                       flashversion.AppendNum(fversion.iMinor); 
       
   513                       if( flashversion.Length()>0 )
       
   514                           {                               
       
   515                           str = QString::fromUtf16(flashversion.Ptr(), flashversion.Length());
       
   516                           item = new QStandardItem();
       
   517                           val = hbTrId("txt_device_update_dblist_flash_version");
       
   518                           liststr.clear();
       
   519                           liststr << val;
       
   520                           liststr << str;
       
   521                           item->setData(liststr , Qt::DisplayRole);
       
   522                           //m_otherdetailsmodel->setItem(i++, item);
       
   523                           m_otherdetailsmodel->appendRow(item);
       
   524                           }                                   
       
   525                       }      
       
   526                   }
       
   527             }
       
   528                
       
   529          if (r== KErrNone&& runtimesupport)
       
   530              {            
       
   531               Swi::RSisRegistryEntry sientry;
       
   532               TInt oerr = sientry.Open(sisses, javauid);
       
   533               TVersion jversion;
       
   534               TBuf <255> javaversion;
       
   535               if(oerr == KErrNone)
       
   536                   {       
       
   537                   TRAPD(err2,jversion= sientry.VersionL());     
       
   538                   if (err2 == KErrNone)
       
   539                       {
       
   540                       javaversion.AppendNum(jversion.iMajor);
       
   541                       javaversion.Append(_L("."));
       
   542                       javaversion.AppendNum(jversion.iMinor);  
       
   543                       if( javaversion.Length()>0 )
       
   544                           { 
       
   545                           str = QString::fromUtf16(javaversion.Ptr(), javaversion.Length());
       
   546                           item = new QStandardItem();
       
   547                           val = hbTrId("txt_device_update_dblist_java_version");
       
   548                           liststr.clear();
       
   549                           liststr << val;
       
   550                           liststr << str;
       
   551                           item->setData(liststr , Qt::DisplayRole);
       
   552                           m_otherdetailsmodel->appendRow(item);
       
   553                           } 
       
   554                       }            
       
   555                   }            
       
   556              } 
       
   557         CleanupStack::PopAndDestroy(1);
       
   558         qDebug("OMADM servers view DmAdvancedView::addVersionInfo >>");
       
   559     }
       
   560 
       
   561 void DmAdvancedView::addOtherDetails()
       
   562     {
       
   563         qDebug("OMADM servers view DmAdvancedView::addOtherDetails >>");
       
   564         TRequestStatus status;
       
   565         QStringList liststr;
       
   566         QStandardItem* item;
       
   567         QString val;
       
   568         QString str;
       
   569         TInt error(iServer.Connect());
       
   570         if ( error != KErrNone )
       
   571         	return;
       
   572         iServer.GetPhoneInfo(0, info);
       
   573         error = imobPhone.Open(iServer, info.iName);
       
   574         if ( error != KErrNone )
       
   575         {
       
   576         	iServer.Close();
       
   577         	return;
       
   578         }
       
   579         //Bands supported
       
   580         
       
   581         RMobilePhone::TMobilePhoneNetworkInfoV1 nwInfov1;
       
   582         RMobilePhone::TMobilePhoneNetworkInfoV1Pckg nwInfov1Pckg(nwInfov1);                     
       
   583         imobPhone.GetCurrentNetwork(status, nwInfov1Pckg);
   465         User::WaitForRequest( status );
   584         User::WaitForRequest( status );
   466         status = KRequestPending;
   585         status = KRequestPending;
   467         nwInfov8 = nwInfov8Pckg();
   586         nwInfov1 = nwInfov1Pckg();
   468         if(nwInfov8.iHsupaAvailableIndicator) packetsrvc =3;
   587         NetworkBand(nwInfov1.iBandInfo, str);
   469     }	  
   588         item = new QStandardItem();
   470     liststr.clear();
   589         val = hbTrId("txt_device_update_dblist_gsm_bands");
   471     val = hbTrId("txt_device_update_dblist_wcdma_uldl_data_rates");
   590         liststr.clear();
   472     liststr << val;
   591         liststr << val;
   473     item = new QStandardItem();
   592         liststr << str;
   474     PacketService(packetsrvc, str);
   593         item->setData(liststr , Qt::DisplayRole);
   475     liststr << str;
   594         m_otherdetailsmodel->appendRow(item);
   476     item->setData(liststr , Qt::DisplayRole);
   595         
   477     otherdetailsmodel->setItem(i++, item);
   596         //Packet Service
   478 				
   597         
   479     // Ciphering
   598         TInt packetsrvc =0;
       
   599         RMobilePhone::TMobilePhoneNetworkInfoV5 nwInfov5;
       
   600         RMobilePhone::TMobilePhoneNetworkInfoV5Pckg nwInfov5Pckg(nwInfov5);
       
   601         imobPhone.GetCurrentNetwork( status, nwInfov5Pckg );
       
   602         User::WaitForRequest( status );
       
   603         status = KRequestPending;
       
   604         nwInfov5 = nwInfov5Pckg();
       
   605         
       
   606         if(nwInfov5.iHsdpaAvailableIndicator) packetsrvc =1;
       
   607         
       
   608         if(nwInfov5.iEgprsAvailableIndicator) packetsrvc =2;
       
   609         
       
   610         if(!packetsrvc)
       
   611         {
       
   612             RMobilePhone::TMobilePhoneNetworkInfoV8 nwInfov8;
       
   613             RMobilePhone::TMobilePhoneNetworkInfoV8Pckg nwInfov8Pckg(nwInfov8);
       
   614             imobPhone.GetCurrentNetwork( status, nwInfov8Pckg );
       
   615             User::WaitForRequest( status );
       
   616             status = KRequestPending;
       
   617             nwInfov8 = nwInfov8Pckg();
       
   618             if(nwInfov8.iHsupaAvailableIndicator) packetsrvc =3;
       
   619         }     
       
   620         liststr.clear();
       
   621         val = hbTrId("txt_device_update_dblist_wcdma_uldl_data_rates");
       
   622         liststr << val;
       
   623         item = new QStandardItem();
       
   624         PacketService(packetsrvc, str);
       
   625         liststr << str;
       
   626         item->setData(liststr , Qt::DisplayRole);
       
   627         m_otherdetailsmodel->appendRow(item);
       
   628                     
       
   629         // Ciphering
       
   630         
       
   631         liststr.clear();
       
   632         item = new QStandardItem();
       
   633         val = hbTrId("txt_device_update_dblist_gsm_cipherings");
       
   634         liststr << val;
       
   635         imobPhone.GetNetworkSecurityLevel(status,idispSecurity);
       
   636         User::WaitForRequest( status );
       
   637         NetworkCiphering(idispSecurity, str);
       
   638         liststr << str;
       
   639         item->setData(liststr, Qt::DisplayRole);
       
   640         m_otherdetailsmodel->appendRow(item);
       
   641         
       
   642         // WLAN MAC
       
   643         
       
   644         TUint KPhoneWlanSeparator (':');
       
   645         _LIT( KWLanMACDataFormat, "%02x");  
       
   646         // Fetch WLAN MAC address
       
   647         TBuf<KWlanMacAddrLength> address;
       
   648         RProperty::Get( KPSUidWlan, KPSWlanMacAddress, address );   
       
   649         // Format fetched address
       
   650         TBuf<KWlanMacAddrLength> wlanMACAddress;        
       
   651         for ( TInt i( 0 ); i < address.Length(); i++ )
       
   652             {
       
   653             // Set separator
       
   654             if( i > 0 )
       
   655                 {
       
   656                 wlanMACAddress.Append( KPhoneWlanSeparator );
       
   657                 }
       
   658             // Set data
       
   659             TBuf<50> tmp;
       
   660             tmp.Format( KWLanMACDataFormat, address[i] );
       
   661             wlanMACAddress.Append( tmp );
       
   662             } 
       
   663         liststr.clear();
       
   664         item = new QStandardItem();
       
   665         val = hbTrId("txt_device_update_dblist_wlan_mac_address");
       
   666         liststr << val;
       
   667         str = QString::fromUtf16(wlanMACAddress.Ptr(), wlanMACAddress.Length());
       
   668         liststr << str;
       
   669         item->setData(liststr, Qt::DisplayRole);
       
   670         m_otherdetailsmodel->appendRow(item);
       
   671           
       
   672         // BT MAC
       
   673           
       
   674         TBuf<KBTAddrLength> addressBuffer;
       
   675         // Fetch from Cenrep
       
   676         CRepository* repository = NULL;
       
   677         TRAPD( err, repository = CRepository::NewL( KCRUidBluetoothLocalDeviceAddress ) );
       
   678         if ( err == KErrNone )
       
   679             {
       
   680             qDebug("KCRUidBluetoothLocalDeviceAddress errnone");
       
   681             err = repository->Get( KBTLocalDeviceAddress, addressBuffer );
       
   682             
       
   683             if (err == KErrNone)
       
   684                 qDebug("KBTLocalDeviceAddress errnone");
       
   685             else
       
   686                 qDebug("KBTLocalDeviceAddress Error");
       
   687                 
       
   688             delete repository;
       
   689             }
       
   690         else
       
   691             {
       
   692                 qDebug("KCRUidBluetoothLocalDeviceAddress Error openin cenrep");
       
   693             }
       
   694         liststr.clear();
       
   695         val = hbTrId("txt_device_update_dblist_bt_mac_address");
       
   696         liststr << val;
       
   697         item = new QStandardItem();
       
   698         str = QString::fromUtf16(addressBuffer.Ptr(), addressBuffer.Length());
       
   699         liststr << str;
       
   700         item->setData(liststr , Qt::DisplayRole);
       
   701         m_otherdetailsmodel->appendRow(item);
       
   702         
       
   703         imobPhone.Close();
       
   704         iServer.Close();
       
   705 
       
   706     }
       
   707 void DmAdvancedView::mainCalltoUpdateView()
       
   708 {   
       
   709     qDebug("OMADM servers view DmAdvancedView::mainCalltoUpdateView >>");
       
   710     m_otherdetailsmodel = new QStandardItemModel();
       
   711     TInt i=0;
   480     
   712     
   481     liststr.clear();
   713     QStringList liststr;
   482     item = new QStandardItem();
   714     QStandardItem* item;
   483     val = hbTrId("txt_device_update_dblist_gsm_cipherings");
   715     QString val;
   484     liststr << val;
   716     QString str;
   485     imobPhone.GetNetworkSecurityLevel(status,idispSecurity);
   717     //1. Device Updated
   486     User::WaitForRequest( status );
   718 
   487     NetworkCiphering(idispSecurity, str);
       
   488     liststr << str;
       
   489     item->setData(liststr, Qt::DisplayRole);
       
   490     otherdetailsmodel->setItem(i++, item);
       
   491     
   719     
   492     // WLAN MAC
   720     addVersionInfo();
   493     
   721     
   494     TUint KPhoneWlanSeparator (':');
   722     addOtherDetails();
   495     _LIT( KWLanMACDataFormat, "%02x");  
   723 
   496     // Fetch WLAN MAC address
   724     //sw version date
   497     TBuf<KWlanMacAddrLength> address;
   725     TBuf< KSysUtilVersionTextLength > swversiondate;
   498     RProperty::Get( KPSUidWlan, KPSWlanMacAddress, address );   
   726     TBuf< KSysUtilVersionTextLength > version;
   499     // Format fetched address
   727     version.Zero();
   500     TBuf<KWlanMacAddrLength> wlanMACAddress;        
   728     swversiondate.Zero();
   501     for ( TInt i( 0 ); i < address.Length(); i++ )
   729     if( SysUtil::GetSWVersion(version)==KErrNone)
   502         {
   730         {
   503         // Set separator
   731         TInt len= version.Length();
   504         if( i > 0 )
   732         TInt pos1 = version.Find(KSmlEOL);
   505             {
   733              if( pos1 != KErrNotFound && len > pos1 )
   506             wlanMACAddress.Append( KPhoneWlanSeparator );
   734                 {
   507             }
   735                  TBuf<KSysUtilVersionTextLength> version1;
   508         // Set data
   736                  version1.Zero();
   509         TBuf<50> tmp;
   737                  version1.Append( version.Right( len-pos1-1 ));
   510         tmp.Format( KWLanMACDataFormat, address[i] );
   738                  len= version1.Length();
   511         wlanMACAddress.Append( tmp );
   739                  pos1 = version1.Find(KSmlEOL);
   512         } 
   740                  if( pos1 != KErrNotFound  && len > pos1 )
   513     liststr.clear();
   741                      {
   514     item = new QStandardItem();
   742                      swversiondate.Append(version1.Left( pos1 ));
   515     val = hbTrId("txt_device_update_dblist_wlan_mac_address");
   743                      }
   516     liststr << val;
   744                 }
   517     str = QString::fromUtf16(wlanMACAddress.Ptr(), wlanMACAddress.Length());
   745             val = hbTrId("txt_device_update_dblist_sw_version_date");
   518     liststr << str;
   746             item = new QStandardItem();
   519     item->setData(liststr, Qt::DisplayRole);
   747             str = QString::fromUtf16(swversiondate.Ptr(), swversiondate.Length());
   520     otherdetailsmodel->setItem(i++, item);
   748             liststr.clear();
   521       
   749             liststr << val;
   522     // BT MAC
   750             liststr << str;
   523       
   751             item->setData(liststr , Qt::DisplayRole);
   524     TBuf<KBTAddrLength> addressBuffer;
   752             m_otherdetailsmodel->appendRow(item);
   525     // Fetch from Cenrep
   753             }
   526     CRepository* repository = NULL;
   754             
   527     TRAPD( err, repository = CRepository::NewL( KCRUidBluetoothLocalDeviceAddress ) );
   755     //Custom version and date
   528     if ( err == KErrNone )
   756     //SysVersionInfo::TVersionInfoType x = SysVersionInfo::EOPVersion;
   529         {
   757     TBuf< KNSmlMaxTextLength64 >  customsw;
   530         qDebug("KCRUidBluetoothLocalDeviceAddress errnone");
   758     TBuf< KNSmlMaxTextLength64 >  customswdate;
   531         err = repository->Get( KBTLocalDeviceAddress, addressBuffer );
   759     version.Zero();
   532         
   760     if( SysVersionInfo::GetVersionInfo(SysVersionInfo::EOPVersion,version) == KErrNone )
   533         if (err == KErrNone)
   761       {
   534         	qDebug("KBTLocalDeviceAddress errnone");
   762          TInt len= version.Length();
   535         else
   763          TInt pos1 = version.Find(KSmlEOL);
   536         	qDebug("KBTLocalDeviceAddress Error");
   764          if( pos1 != KErrNotFound  && len > pos1 )
   537         	
   765           {        
   538         delete repository;
   766           customsw.Append( version.Left(pos1));
   539         }
   767           customswdate.Append( version.Right( len-pos1-1 ));         
   540     else
   768           }
   541     	{
   769       } 
   542     		qDebug("KCRUidBluetoothLocalDeviceAddress Error openin cenrep");
   770     
   543     	}
   771     if(customsw.Length()>0)
   544     liststr.clear();
   772         {
   545     val = hbTrId("txt_device_update_dblist_bt_mac_address");
   773         str = QString::fromUtf16(customsw.Ptr(), customsw.Length());
   546     liststr << val;
   774         item = new QStandardItem();
   547     item = new QStandardItem();
   775         val = hbTrId("txt_device_update_dblist_custom_version");
   548     str = QString::fromUtf16(addressBuffer.Ptr(), addressBuffer.Length());
   776         liststr.clear();
   549     liststr << str;
   777         liststr << val;
   550     item->setData(liststr , Qt::DisplayRole);
   778         liststr << str;
   551     otherdetailsmodel->setItem(i++, item);
   779         item->setData(liststr , Qt::DisplayRole);
   552 	
   780         m_otherdetailsmodel->appendRow(item);
   553 	    
   781         }
       
   782     if(customswdate.Length()>0)
       
   783         {
       
   784         str = QString::fromUtf16(customswdate.Ptr(), customswdate.Length());
       
   785         item = new QStandardItem();
       
   786         val = hbTrId("txt_device_update_dblist_custom_version_date");
       
   787         liststr.clear();
       
   788         liststr << val;
       
   789         liststr << str;
       
   790         item->setData(liststr , Qt::DisplayRole);
       
   791         m_otherdetailsmodel->appendRow(item);
       
   792         }
       
   793     
   554     TBuf<KSysUtilVersionTextLength> Langversion; 
   794     TBuf<KSysUtilVersionTextLength> Langversion; 
   555     TBuf<KSysUtilVersionTextLength> lversion;
   795     TBuf<KSysUtilVersionTextLength> lversion;
   556 
   796     if( SysUtil::GetLangVersion(Langversion ) == KErrNone )
   557 	    //lang variant version
   797       {
       
   798         str = QString::fromUtf16(Langversion.Ptr(), Langversion.Length());
       
   799         item = new QStandardItem();
       
   800         val = hbTrId("txt_device_update_dblist_language_set");
       
   801         liststr.clear();
       
   802         liststr << val;
       
   803         liststr << str;
       
   804         item->setData(liststr , Qt::DisplayRole);
       
   805         m_otherdetailsmodel->appendRow(item);
       
   806       }
       
   807     
       
   808 
       
   809     //lang variant version
   558     Langversion.Zero();
   810     Langversion.Zero();
   559     if( SysUtil::GetLangSWVersion(Langversion ) == KErrNone )
   811     if( SysUtil::GetLangSWVersion(Langversion ) == KErrNone )
   560         {
   812         {
   561         int len = Langversion.Length();
   813         int len = Langversion.Length();
   562         TInt pos1 = Langversion.Find( KSmlEOL );
   814         TInt pos1 = Langversion.Find( KSmlEOL );
   570          val = hbTrId("txt_device_update_dblist_language_variant_version");
   822          val = hbTrId("txt_device_update_dblist_language_variant_version");
   571          liststr.clear();
   823          liststr.clear();
   572          liststr << val;
   824          liststr << val;
   573          liststr << str;
   825          liststr << str;
   574          item->setData(liststr , Qt::DisplayRole);
   826          item->setData(liststr , Qt::DisplayRole);
   575          otherdetailsmodel->appendRow(item);
   827          m_otherdetailsmodel->appendRow(item);
   576         }
   828         }
   577     
   829      
   578     otherdetailslist->setModel(otherdetailsmodel);
   830     otherdetailslist->setModel(m_otherdetailsmodel);
       
   831     qDebug("OMADM servers view DmAdvancedView::mainCalltoUpdateView <<");
   579 		
   832 		
   580 }
   833 }
   581 
   834 
   582 void DmAdvancedView::PacketService(TInt val, QString& string)
   835 void DmAdvancedView::PacketService(TInt val, QString& string)
   583     {
   836     {
       
   837     qDebug("OMADM servers view DmAdvancedView::PacketService >>");
   584      switch (val)
   838      switch (val)
   585          {
   839          {
   586          case (0):
   840          case (0):
   587                  string = hbTrId("txt_device_update_dblist_wcdma_uldl_data_val_l1");
   841                  string = hbTrId("txt_device_update_dblist_wcdma_uldl_data_val_l1");
   588                  break;
   842                  break;
   601          case (5):
   855          case (5):
   602          default :
   856          default :
   603                  string = hbTrId("txt_device_update_dblist_wcdma_uldl_data_val_l5");
   857                  string = hbTrId("txt_device_update_dblist_wcdma_uldl_data_val_l5");
   604                  break;
   858                  break;
   605          }
   859          }
       
   860      qDebug("OMADM servers view DmAdvancedView::PacketService <<");
   606      }
   861      }
   607 
   862 
   608 
   863 
   609 void DmAdvancedView::NetworkCiphering(RMobilePhone::TMobilePhoneNetworkSecurity val, QString& string)
   864 void DmAdvancedView::NetworkCiphering(RMobilePhone::TMobilePhoneNetworkSecurity val, QString& string)
   610     {
   865     {
       
   866     qDebug("OMADM servers view DmAdvancedView::NetworkCiphering >>");
   611      switch (val)
   867      switch (val)
   612          {
   868          {
   613          case (RMobilePhone::ECipheringGSM):
   869          case (RMobilePhone::ECipheringGSM):
   614                  string = hbTrId("txt_device_update_dblist_gsm_cipherings_val_l2");
   870                  string = hbTrId("txt_device_update_dblist_gsm_cipherings_val_l2");
   615                  break;
   871                  break;
   622          case (RMobilePhone::ECipheringOff):
   878          case (RMobilePhone::ECipheringOff):
   623          default :
   879          default :
   624                  string = hbTrId("txt_device_update_dblist_gsm_cipherings_val_l1");
   880                  string = hbTrId("txt_device_update_dblist_gsm_cipherings_val_l1");
   625                  break;
   881                  break;
   626          }
   882          }
       
   883      qDebug("OMADM servers view DmAdvancedView::NetworkCiphering <<");
   627     }
   884     }
   628     
   885     
   629 void DmAdvancedView::NetworkBand(RMobilePhone::TMobilePhoneNetworkBandInfo val, QString& string)
   886 void DmAdvancedView::NetworkBand(RMobilePhone::TMobilePhoneNetworkBandInfo val, QString& string)
   630     {
   887     {
       
   888     qDebug("OMADM servers view DmAdvancedView::NetworkBand >>");
   631     switch (val)
   889     switch (val)
   632         {
   890         {
   633         case (RMobilePhone::E800BandA):
   891         case (RMobilePhone::E800BandA):
   634                 string = hbTrId("txt_device_update_dblist_gsm_bands_val_l2");
   892                 string = hbTrId("txt_device_update_dblist_gsm_bands_val_l2");
   635                 break;
   893                 break;
   660         case (RMobilePhone::EBandUnknown):
   918         case (RMobilePhone::EBandUnknown):
   661         default :
   919         default :
   662                 string = hbTrId("txt_device_update_dblist_gsm_bands_val_l1");
   920                 string = hbTrId("txt_device_update_dblist_gsm_bands_val_l1");
   663                 break;
   921                 break;
   664         }   
   922         }   
       
   923     qDebug("OMADM servers view DmAdvancedView::NetworkBand <<");
   665     }
   924     }
   666 
   925 
   667 void DmAdvancedView::syncCompleted(int jobstatus)
   926 void DmAdvancedView::syncCompleted(int jobstatus)
   668     {
   927     {
       
   928     qDebug("OMADM servers view DmAdvancedView::syncCompleted >>");
   669     Q_UNUSED(jobstatus);
   929     Q_UNUSED(jobstatus);
   670     connectionRequested = false;    
   930     connectionRequested = false;    
   671     updateListview();
   931     updateListview();
       
   932     iMainView->enableButtons();
       
   933     qDebug("OMADM servers view DmAdvancedView::syncCompleted <<");
   672     }
   934     }
   673 	
   935 	
   674 void DmAdvancedView::defaultMenuItemSelected()
   936 void DmAdvancedView::defaultMenuItemSelected()
   675     {
   937     {
       
   938     qDebug("OMADM servers view DmAdvancedView::defaultMenuItemSelected >>");
   676     dminfo->setDefaultProfile(currentselecteditem);
   939     dminfo->setDefaultProfile(currentselecteditem);
   677     updateEarlierdefaultProfileIcon();
   940     updateEarlierdefaultProfileIcon();
   678     modelItem->setIcon(defaultprofileicon);
   941     modelItem->setIcon(defaultprofileicon);
   679     currentdefaultprofile = currentselecteditem;
   942     currentdefaultprofile = currentselecteditem;
       
   943     qDebug("OMADM servers view DmAdvancedView::defaultMenuItemSelected <<");
   680     }
   944     }
   681 
   945 
   682 void DmAdvancedView::deleteMenuItemSelected()
   946 void DmAdvancedView::deleteMenuItemSelected()
   683     {
   947     {
       
   948     qDebug("OMADM servers view DmAdvancedView::deleteMenuItemSelected >>");
   684     dminfo->DisableDbNotifications(true);
   949     dminfo->DisableDbNotifications(true);
   685     //check currentdefaultprofile is current item
   950     //check currentdefaultprofile is current item
   686     if(currentselecteditem == currentdefaultprofile) // deleting default profile
   951     if(currentselecteditem == currentdefaultprofile) // deleting default profile
   687         currentdefaultprofile = -1;
   952         currentdefaultprofile = -1;
   688     if(dminfo->DeleteProfile(currentselecteditem) >=0 )
   953     if(dminfo->DeleteProfile(currentselecteditem) >=0 )
   689         {
   954         {
   690     //Update the profile list
   955     //Update the profile list
   691     model->removeRow(currentselecteditem);
   956     model->removeRow(currentselecteditem);
   692         }
   957         }
   693     dminfo->DisableDbNotifications(false);
   958     dminfo->DisableDbNotifications(false);
       
   959     qDebug("OMADM servers view DmAdvancedView::deleteMenuItemSelected <<");
   694     }
   960     }
   695 
   961 
   696 void DmAdvancedView::connectMenuItemSelected()
   962 void DmAdvancedView::connectMenuItemSelected()
   697     {
   963     {
   698     dminfo->synchronize(currentselecteditem);
   964     qDebug("OMADM servers view DmAdvancedView::connectMenuItemSelected >>");
       
   965     iMainView->displayNoteAndDisableButtons();
       
   966     backButtonClicked();
       
   967     dminfo->synchronize(currentselecteditem);    
   699     connectionRequested = true;
   968     connectionRequested = true;
       
   969     qDebug("OMADM servers view DmAdvancedView::connectMenuItemSelected <<");
   700     }
   970     }
   701 	
   971