deviceupdatesui/deviceupdates/src/dmadvancedview.cpp
branchRCL_3
changeset 57 6757f1e2efd2
equal deleted inserted replaced
55:c4687ff85147 57:6757f1e2efd2
       
     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 #include <hbnamespace.h>
       
    19 #include "dmadvancedview.h"
       
    20 #include "dmfotaview.h"
       
    21 #include "serversettingsview.h"
       
    22 #include "customviewitem.h"
       
    23 
       
    24 DmAdvancedView::DmAdvancedView(HbMainWindow *mainWindow,DMFotaView *mainView, DmInfo *info, QGraphicsItem *parent):HbView(parent),
       
    25     bluetooth(":/icons/qgn_prop_sml_bt.svg"),
       
    26     internet(":/icons/qgn_prop_sml_http.svg"), 
       
    27     defaultprofileicon(":/icons/qtg_large_avatar.svg")                
       
    28     {
       
    29     qDebug("omadm DeviceManagerUi::DmAdvancedView >>");
       
    30     iMainWindow = mainWindow;
       
    31     serverSetView = NULL;
       
    32     iMainView = mainView;
       
    33     if(info==NULL)
       
    34         {
       
    35         dminfo = new DmInfo(this);
       
    36         }
       
    37     else 
       
    38         dminfo = info;
       
    39     currentdefaultprofile = -1;
       
    40     currentview = 0;
       
    41     connectionRequested = false;    
       
    42     backbehaviorset = false;
       
    43     currentselecteditem = -1;
       
    44     qDebug("omadm DeviceManagerUi::DmAdvancedView >>");
       
    45     }
       
    46 
       
    47 DmAdvancedView::~DmAdvancedView()
       
    48     {
       
    49     qDebug("omadm DmAdvancedView::~DmAdvancedView");
       
    50     if(docmlLoader)
       
    51         delete docmlLoader;  
       
    52     if(dminfo)
       
    53         delete dminfo;
       
    54     qDebug("omadm DmAdvancedView::~DmAdvancedView end"); 
       
    55     }
       
    56 
       
    57 void DmAdvancedView::handleLongPress(HbAbstractViewItem* item , QPointF coOrdinates)
       
    58     {
       
    59     qDebug("omadm DeviceManagerUi::handleLongPress >>");
       
    60     if(connectionRequested)
       
    61         return;
       
    62     if (item)
       
    63         {
       
    64         modelItem = model->itemFromIndex(item->modelIndex());
       
    65         currentselecteditem = modelItem->row();
       
    66         if(currentselecteditem == dminfo->profilescount())//Button item pressed
       
    67             return;
       
    68         HbMenu *csmenu = new HbMenu();
       
    69         csmenu->setAttribute( Qt::WA_DeleteOnClose);
       
    70         HbAction *defaultprofileAction = 0;
       
    71         HbAction *deleteaction = 0;
       
    72         HbAction *connectaction = 0;
       
    73         if (!dminfo->Isdefaultprofile(currentselecteditem))
       
    74             {
       
    75             defaultprofileAction = csmenu->addAction(hbTrId(
       
    76                     "txt_device_update_menu_set_as_default"));
       
    77             connect(defaultprofileAction, SIGNAL(triggered()), this,
       
    78                     SLOT(defaultMenuItemSelected()));
       
    79             }
       
    80         if (!dminfo->Isprofilelocked(currentselecteditem) && 
       
    81                      dminfo->isProfileDeleteAllowed(currentselecteditem) )
       
    82             {
       
    83             deleteaction = csmenu->addAction(hbTrId(
       
    84                     "txt_device_update_menu_delete"));
       
    85             connect(deleteaction, SIGNAL(triggered()), this,
       
    86                     SLOT(deleteMenuItemSelected()));
       
    87             }
       
    88         connectaction = csmenu->addAction(hbTrId(
       
    89                 "txt_device_update_menu_connect"));
       
    90         connect(connectaction, SIGNAL(triggered()), this,
       
    91                 SLOT(connectMenuItemSelected()));
       
    92         csmenu->setPreferredPos(coOrdinates);
       
    93         csmenu->open();
       
    94         }
       
    95     qDebug("omadm DeviceManagerUi::handleLongPress >>");
       
    96     }
       
    97 
       
    98 
       
    99 void DmAdvancedView::handleClicked(QModelIndex index)
       
   100     {
       
   101     qDebug("omadm DeviceManagerUi::handleClicked >>");
       
   102     if(connectionRequested)
       
   103         return;
       
   104 	int itemnum = 0;
       
   105     QStandardItem *selectedItem = model->itemFromIndex(index);
       
   106     itemnum = selectedItem->row();	        
       
   107      if(itemnum == dminfo->profilescount())//Button item pressed
       
   108         {
       
   109     qDebug("omadm create new server profile button clicked");
       
   110         return;
       
   111         }
       
   112   //Stop listening DB events for profile addition
       
   113     dminfo->DisableDbNotifications(true);                
       
   114     if(itemnum >= 0 && !dminfo->Isprofilelocked(itemnum))
       
   115         {        
       
   116         //read profile items
       
   117         QStringList itemdata;
       
   118         bool sessmode = 0;
       
   119         QStringList iaplist;
       
   120         int curriap = 0;
       
   121         int portnum = 0;
       
   122         bool nwauth = false ;
       
   123         dminfo->getProfiledata(itemnum, itemdata, sessmode,iaplist,curriap,portnum, nwauth);	
       
   124         QString editserverprof(itemdata[0]);
       
   125         if(!serverSetView)
       
   126             {
       
   127             serverSetView = new ServerSettingsView(iMainWindow, this , editserverprof);
       
   128             }
       
   129         else // view already created
       
   130             {
       
   131             //Just update the setting items as per this profile            
       
   132             serverSetView->makeviewItemsVisible(editserverprof);		  
       
   133             }        
       
   134         serverSetView->setProfileValues(itemdata,sessmode,iaplist,curriap,portnum,nwauth);
       
   135         iMainWindow->setCurrentView(serverSetView);
       
   136   
       
   137         }
       
   138     qDebug("omadm DeviceManagerUi::handleClicked >>");
       
   139     }
       
   140 
       
   141 bool DmAdvancedView::displayItems()
       
   142     {    	
       
   143     qDebug("omadm DeviceManagerUi::displayItems >>");
       
   144     docmlLoader = new HbDocumentLoader;
       
   145     bool ok ;    
       
   146     docmlLoader->load( DOCML_FILE_NAME,  &ok  );
       
   147     if(ok)
       
   148     	{
       
   149         if(iMainWindow->orientation() == Qt::Vertical)
       
   150             docmlLoader->load( DOCML_FILE_NAME,  PORTRAIT,&ok  );
       
   151         else
       
   152             docmlLoader->load( DOCML_FILE_NAME, LANDSCAPE,&ok  );            
       
   153     	}
       
   154     else
       
   155     	{
       
   156     	 qDebug("omadm docml loading failed");
       
   157     	 return ok;
       
   158     	}
       
   159     if(ok)
       
   160         {        	
       
   161         connect(iMainWindow, SIGNAL(orientationChanged(Qt::Orientation)),
       
   162                 this,  SLOT(reLayout(Qt::Orientation)));    
       
   163         viewwidget = qobject_cast<HbView *>(docmlLoader->findWidget( VIEW_NAME ) );    
       
   164         Q_ASSERT_X(viewwidget != 0, "OMADM View not found","Not found");        
       
   165         viewspecificmenu = new HbMenu();    
       
   166         help = viewspecificmenu->addAction(hbTrId("txt_common_menu_help")); 
       
   167         exit = viewspecificmenu->addAction(hbTrId("txt_common_menu_exit"));
       
   168         connect(exit, SIGNAL(triggered()), QCoreApplication::instance(), SLOT(quit()));
       
   169         setMenu(viewspecificmenu);            
       
   170         serversListGroup = qobject_cast<HbGroupBox *>(docmlLoader->findWidget( GROUP ) );
       
   171         serversListGroup->setHeading(hbTrId("txt_device_update_setlabel_device_update_services"));
       
   172         serversListGroup->setCollapsable( true );        
       
   173         connect(serversListGroup, SIGNAL(toggled(bool)), this, SLOT(serversListGroupClicked(bool)));
       
   174         otherDetailsGroup = qobject_cast<HbGroupBox *>(docmlLoader->findWidget( OTHERDETAILSGROUP ) );
       
   175         connect(otherDetailsGroup, SIGNAL(toggled(bool)), this, SLOT(otherDetailsGroupClicked(bool)));        
       
   176         otherDetailsGroup->setHeading(hbTrId("txt_device_update_setlabel_other_details"));
       
   177         otherDetailsGroup->setCollapsable( true );
       
   178         otherDetailsGroup->setCollapsed( true );                            
       
   179         list = qobject_cast<HbListView *>(docmlLoader->findWidget( LIST_NAME ) );
       
   180 
       
   181         list->listItemPrototype()->setGraphicsSize(HbListViewItem::LargeIcon);
       
   182         list->listItemPrototype()->setSecondaryTextRowCount(1,2);
       
   183         list->listItemPrototype()->setStretchingStyle(HbListViewItem::StretchLandscape);
       
   184 
       
   185         dminfo->refreshProfileList();    
       
   186         int IndicatorCount =dminfo->profilescount();
       
   187         model = new QStandardItemModel();   
       
   188         QList<HbAbstractViewItem *> prototypes ;
       
   189         prototypes.append(list->listItemPrototype());
       
   190         CustomViewItem *prototype2 = new CustomViewItem(this,list);
       
   191         prototypes.append(prototype2);
       
   192         list->setItemPrototypes(prototypes);
       
   193         list->setModel(model);
       
   194         int i;
       
   195         for (i = 0; IndicatorCount > 0 && i < IndicatorCount; ++i) {        
       
   196         QStringList liststr;
       
   197         bool lock = false;
       
   198         int icon = 0;
       
   199         int ret = dminfo->profileinfo(i,liststr,icon, lock);
       
   200         if(ret <= 0)
       
   201             {
       
   202             break;
       
   203             }
       
   204         QStandardItem* item ;    
       
   205         item = new QStandardItem();    
       
   206         HbIcon icon1;
       
   207         icon1.setIconName(":/icons/qgn_prop_sml_http.svg");
       
   208         HbIcon icon2;
       
   209         icon2.setIconName(":/icons/qgn_prop_sml_bt.svg");
       
   210         HbIcon icon3;
       
   211         icon3.setIconName(":/icons/qgn_indi_sett_protected_add.svg");   
       
   212         HbIcon defaultprofile;
       
   213         defaultprofile.setIconName(":/icons/qtg_large_avatar.svg");            
       
   214         QList<QVariant> Iconl;    
       
   215         if(icon == 0)//Internet
       
   216             Iconl.insert(0,icon1);
       
   217         else if(icon == 1)//Bluetooth
       
   218             Iconl.insert(0,icon2); 
       
   219         else 
       
   220             {
       
   221             Iconl.insert(0,defaultprofile);
       
   222             currentdefaultprofile = i;
       
   223             }
       
   224         icon = 0;
       
   225         if(lock)
       
   226             {
       
   227             Iconl.insert(1,icon3);
       
   228             lock = false; 
       
   229             }
       
   230         QVariant iconlist(Iconl);
       
   231         iconlist.setValue(Iconl);
       
   232         item->setData(liststr , Qt::DisplayRole);
       
   233         item->setData(iconlist , Qt::DecorationRole);
       
   234         model->setItem(i, item);    
       
   235         }        
       
   236         list->setItemRecycling(false);
       
   237         QStandardItem* customitem = new QStandardItem();
       
   238         customitem->setData(Hb::ItemType_Last + 1001,Hb::ItemTypeRole);
       
   239         model->setItem(i, customitem);
       
   240         connect(list, SIGNAL(longPressed(HbAbstractViewItem*,QPointF)),
       
   241                 this,  SLOT(handleLongPress(HbAbstractViewItem*,QPointF)));
       
   242     
       
   243         connect(list, SIGNAL(activated(QModelIndex)), this, SLOT(handleClicked(QModelIndex)));            
       
   244         
       
   245         qDebug("omadm launching other details list");
       
   246         otherdetailslist = qobject_cast<HbListView *>(docmlLoader->findWidget( LISTOTHERDETAILS ) );    
       
   247         otherdetailslist->listItemPrototype()->setStretchingStyle(HbListViewItem::StretchLandscape);
       
   248 		otherdetailslist->setLongPressEnabled(EFalse);
       
   249         qDebug("omadm launching other details list done");    
       
   250         mainCalltoUpdateView();                             
       
   251         label = qobject_cast<HbLabel *>(docmlLoader->findWidget(LABEL));        
       
   252         label->setPlainText(hbTrId("txt_device_update_subhead_advanced_device_updates"));        
       
   253         
       
   254         setWidget(viewwidget);        
       
   255         }
       
   256     else 
       
   257         {
       
   258         qDebug("omadm docml section loading failed");
       
   259         }    
       
   260     qDebug("omadm DeviceManagerUi::displayItems >>");
       
   261     return ok;
       
   262     }
       
   263 
       
   264 void DmAdvancedView::updateEarlierdefaultProfileIcon()
       
   265     {
       
   266     qDebug("omadm DeviceManagerUi::updateEarlierdefaultProfileIcon >>");
       
   267     if(currentdefaultprofile >= 0)
       
   268         {
       
   269         QStandardItem *earlierDefaultProfile = model->item(currentdefaultprofile);
       
   270         //Find the transport type & set the icon
       
   271         int transporttype = 0;
       
   272         dminfo->profileTransport(currentdefaultprofile,transporttype);
       
   273         if(transporttype == 0)//Internet
       
   274             {
       
   275             earlierDefaultProfile->setIcon(internet);
       
   276             }
       
   277         else
       
   278             {
       
   279             earlierDefaultProfile->setIcon(bluetooth);
       
   280             }        
       
   281         }
       
   282     qDebug("omadm DeviceManagerUi::updateEarlierdefaultProfileIcon >>");
       
   283     }
       
   284 
       
   285 void DmAdvancedView::createNewProfile()
       
   286     {
       
   287     qDebug("omadm DeviceManagerUi::createNewProfile >>");
       
   288     if(dminfo->createNewprofile())
       
   289         {
       
   290         //Open server settings view    
       
   291         QString newserverprof(hbTrId("txt_device_update_setlabel_new_server_profile"));    
       
   292         if(!serverSetView)
       
   293             {
       
   294             serverSetView = new ServerSettingsView(iMainWindow, this, newserverprof);        
       
   295             }
       
   296         else // view already created
       
   297             {
       
   298             //Just update the setting items as per this profile                
       
   299             serverSetView->makeviewItemsVisible(newserverprof);       
       
   300             }
       
   301         QStringList serveritems;    
       
   302         serveritems<< "" <<"" <<"" <<"" <<""<<""<<""<<"";
       
   303         bool sessmode = true;
       
   304         bool nauth = true;
       
   305         QStringList apdata;        
       
   306         int currap =-1;
       
   307         int destap = 0;
       
   308         dminfo->getIaplist(apdata,currap,destap);    
       
   309         int portnum = 8080;    
       
   310         serverSetView->setProfileValues(serveritems,sessmode,apdata,currap,portnum,nauth);
       
   311         iMainWindow->setCurrentView(serverSetView);        
       
   312         }
       
   313     else // profile not getting created
       
   314         {
       
   315         qDebug("OMADM New server profile creation failed");
       
   316         }
       
   317     qDebug("omadm DeviceManagerUi::createNewProfile >>");
       
   318     }
       
   319 
       
   320 void DmAdvancedView::saveProfile(QStringList& itemdata, bool& sessmode, QString& currap,unsigned int& portnum, bool& nauth )
       
   321     {
       
   322     qDebug("omadm DeviceManagerUi::saveProfile >>");
       
   323     dminfo->DisableDbNotifications(true);
       
   324     dminfo->saveProfile(itemdata,sessmode,currap,portnum,nauth);
       
   325     updateListview();
       
   326     dminfo->DisableDbNotifications(false);
       
   327     qDebug("omadm DeviceManagerUi::saveProfile >>");
       
   328     }
       
   329 
       
   330 void DmAdvancedView::updateListview()
       
   331     {
       
   332     qDebug("omadm DeviceManagerUi::updateListview >>");
       
   333     model->clear();
       
   334     int IndicatorCount =dminfo->profilescount();    
       
   335     int i;
       
   336     for ( i = 0; IndicatorCount > 0 && i < IndicatorCount; ++i) {    
       
   337     QStringList liststr;
       
   338     bool lock = false;
       
   339     int icon = 0;
       
   340     int ret = dminfo->profileinfo(i,liststr,icon, lock);
       
   341     if(ret <= 0)
       
   342         {
       
   343         break;
       
   344         }    
       
   345     QStandardItem* item ;
       
   346     item = new QStandardItem();
       
   347     HbIcon icon1;
       
   348     icon1.setIconName(":/icons/qgn_prop_sml_http.svg");
       
   349     HbIcon icon2;
       
   350     icon2.setIconName(":/icons/qgn_prop_sml_bt.svg");
       
   351     HbIcon icon3;
       
   352     icon3.setIconName(":/icons/qgn_indi_sett_protected_add.svg");   
       
   353     HbIcon defaultprofile;
       
   354     defaultprofile.setIconName(":/icons/qtg_large_avatar.svg");    
       
   355     QList<QVariant> Iconl;
       
   356     if(icon == 0)//Internet
       
   357         Iconl.insert(0,icon1);
       
   358     else if(icon == 1)//Bluetooth
       
   359         Iconl.insert(0,icon2); 
       
   360     else //Default profile
       
   361         {
       
   362         Iconl.insert(0,defaultprofile);
       
   363         currentdefaultprofile = i;
       
   364         }
       
   365     icon = 0;
       
   366     if(lock)
       
   367         {
       
   368         Iconl.insert(1,icon3);
       
   369         lock = false; 
       
   370         }
       
   371     QVariant iconlist(Iconl);
       
   372     iconlist.setValue(Iconl);
       
   373     item->setData(liststr , Qt::DisplayRole);
       
   374     item->setData(iconlist , Qt::DecorationRole);
       
   375     model->setItem(i, item);    
       
   376     }    
       
   377     QStandardItem* item = new QStandardItem();
       
   378     item->setData(Hb::ItemType_Last + 1001,Hb::ItemTypeRole);
       
   379     model->setItem(i, item);
       
   380     }
       
   381 
       
   382 void DmAdvancedView::serversListGroupClicked(bool state)
       
   383     {
       
   384     qDebug("omadm DeviceManagerUi::serversListGroupClicked >>");
       
   385     Q_UNUSED(state);
       
   386     if(serversListGroup->isCollapsed())
       
   387         otherDetailsGroup->setCollapsed(false);
       
   388     else
       
   389         otherDetailsGroup->setCollapsed(true);
       
   390     qDebug("omadm DeviceManagerUi::serversListGroupClicked >>");
       
   391     }
       
   392 
       
   393 void DmAdvancedView::otherDetailsGroupClicked(bool state)
       
   394     {
       
   395     qDebug("omadm DeviceManagerUi::otherDetailsGroupClicked >>");
       
   396     Q_UNUSED(state);
       
   397     if(otherDetailsGroup->isCollapsed())
       
   398         serversListGroup->setCollapsed(false);
       
   399     else
       
   400         serversListGroup->setCollapsed(true);
       
   401     qDebug("omadm DeviceManagerUi::otherDetailsGroupClicked >>");
       
   402     }
       
   403 
       
   404 bool DmAdvancedView::checkServerId(QString& serverid)
       
   405     {
       
   406     qDebug("omadm DeviceManagerUi::CheckforUpdate >>");
       
   407     return dminfo->checksrvid(serverid);
       
   408     qDebug("omadm DeviceManagerUi::CheckforUpdate >>");
       
   409     }
       
   410 
       
   411 void DmAdvancedView::reLayout(Qt::Orientation orientation)
       
   412     {   
       
   413     qDebug("OMADM servers view DmAdvancedView::reLayout <<");
       
   414     if(orientation == Qt::Horizontal)
       
   415         {
       
   416         qDebug("OMADM servers view landscape");
       
   417         docmlLoader->load(DOCML_FILE_NAME,LANDSCAPE); 
       
   418         }
       
   419     else
       
   420         {
       
   421         qDebug("OMADM servers view portrait");	        
       
   422         bool ok;
       
   423         docmlLoader->load( DOCML_FILE_NAME,  PORTRAIT, &ok  );
       
   424         }
       
   425     qDebug("OMADM servers view DmAdvancedView::reLayout >>");
       
   426     }
       
   427 
       
   428 void DmAdvancedView::setBackBehavior()
       
   429     {
       
   430     qDebug("OMADM servers view DmAdvancedView::setBackBehavior <<");
       
   431     if (!backbehaviorset)
       
   432         {
       
   433         qDebug("OMADM servers view back behavior setting");
       
   434         backaction = new HbAction(Hb::BackNaviAction, this);
       
   435         connect(backaction, SIGNAL(triggered()), this,
       
   436                 SLOT(backButtonClicked()));
       
   437         setNavigationAction(backaction);
       
   438         backbehaviorset = true;
       
   439         }
       
   440     qDebug("OMADM servers view back behavior setting done setBackBehavior >>");
       
   441     }
       
   442 
       
   443 void DmAdvancedView::backButtonClicked()
       
   444     {    
       
   445     qDebug("OMADM servers view DmAdvancedView::backButtonClicked <<");
       
   446     QList <HbView*> views = iMainWindow->views();    
       
   447     if(iMainWindow->orientation()==Qt::Vertical)
       
   448             {
       
   449             iMainWindow->setCurrentView(views[0]);
       
   450             }
       
   451         else
       
   452             {
       
   453             iMainWindow->setCurrentView(views[1]);
       
   454             }    
       
   455     qDebug("OMADM servers view DmAdvancedView::backButtonClicked >>");
       
   456     }
       
   457 
       
   458 void DmAdvancedView::addVersionInfo()
       
   459     {
       
   460     qDebug("OMADM servers view DmAdvancedView::addVersionInfo <<");
       
   461     QStringList liststr;
       
   462     QStandardItem* item;
       
   463     QString val;
       
   464     QString str;
       
   465     TInt runtimesupport(0);
       
   466         CRepository* cenrep = NULL;
       
   467         TRAPD( error, cenrep = CRepository::NewL( KCRUidNSmlDMSyncApp ) );  
       
   468         if(error)
       
   469            {     
       
   470            FLOG( "[OMADM] CNSmlDMFotaContainer::FormatListboxL() cenrep problem" );
       
   471            }    
       
   472         if ( cenrep )
       
   473            {
       
   474            cenrep->Get( KNsmlDmRuntimeVerSupport, runtimesupport );
       
   475            delete cenrep; cenrep = NULL;
       
   476            }
       
   477         //Browser version
       
   478         Swi::RSisRegistrySession sisses ;
       
   479         TInt r( sisses.Connect() );
       
   480         CleanupClosePushL( sisses );
       
   481         if (r== KErrNone && runtimesupport)
       
   482             {           
       
   483              Swi::RSisRegistryEntry sientry;
       
   484              TInt oerr = sientry.Open(sisses, browseruid);
       
   485              TVersion bversion;
       
   486              TBuf <255> browserversion;
       
   487              if(oerr == KErrNone)
       
   488                  {
       
   489                  TRAPD(err2,bversion= sientry.VersionL());     
       
   490                  if (err2 == KErrNone)
       
   491                      {
       
   492                      browserversion.AppendNum(bversion.iMajor);
       
   493                      browserversion.Append(_L("."));
       
   494                      browserversion.AppendNum(bversion.iMinor);
       
   495                      if( browserversion.Length()>0 )
       
   496                          {                                
       
   497                          str = QString::fromUtf16(browserversion.Ptr(), browserversion.Length());
       
   498                          item = new QStandardItem();
       
   499                          val = hbTrId("txt_device_update_dblist_browser_version");
       
   500                          liststr.clear();
       
   501                          liststr << val;
       
   502                          liststr << str;
       
   503                          item->setData(liststr , Qt::DisplayRole);
       
   504                          //m_otherdetailsmodel->setItem(i++, item);
       
   505                          m_otherdetailsmodel->appendRow(item);
       
   506                          }
       
   507                      }
       
   508                  }
       
   509             }
       
   510         
       
   511         //flash version
       
   512         if (r== KErrNone&& runtimesupport)
       
   513             {           
       
   514               Swi::RSisRegistryEntry sientry;
       
   515               TInt oerr = sientry.Open(sisses, flashuid);
       
   516               TVersion fversion;
       
   517               TBuf <255> flashversion;
       
   518               if(oerr == KErrNone)
       
   519                   {
       
   520                   TRAPD(err2,fversion= sientry.VersionL());         
       
   521                   if (err2 == KErrNone)
       
   522                       {
       
   523                       flashversion.AppendNum(fversion.iMajor);
       
   524                       flashversion.Append(_L("."));
       
   525                       flashversion.AppendNum(fversion.iMinor); 
       
   526                       if( flashversion.Length()>0 )
       
   527                           {                               
       
   528                           str = QString::fromUtf16(flashversion.Ptr(), flashversion.Length());
       
   529                           item = new QStandardItem();
       
   530                           val = hbTrId("txt_device_update_dblist_flash_version");
       
   531                           liststr.clear();
       
   532                           liststr << val;
       
   533                           liststr << str;
       
   534                           item->setData(liststr , Qt::DisplayRole);
       
   535                           //m_otherdetailsmodel->setItem(i++, item);
       
   536                           m_otherdetailsmodel->appendRow(item);
       
   537                           }                                   
       
   538                       }      
       
   539                   }
       
   540             }
       
   541                
       
   542          if (r== KErrNone&& runtimesupport)
       
   543              {            
       
   544               Swi::RSisRegistryEntry sientry;
       
   545               TInt oerr = sientry.Open(sisses, javauid);
       
   546               TVersion jversion;
       
   547               TBuf <255> javaversion;
       
   548               if(oerr == KErrNone)
       
   549                   {       
       
   550                   TRAPD(err2,jversion= sientry.VersionL());     
       
   551                   if (err2 == KErrNone)
       
   552                       {
       
   553                       javaversion.AppendNum(jversion.iMajor);
       
   554                       javaversion.Append(_L("."));
       
   555                       javaversion.AppendNum(jversion.iMinor);  
       
   556                       if( javaversion.Length()>0 )
       
   557                           { 
       
   558                           str = QString::fromUtf16(javaversion.Ptr(), javaversion.Length());
       
   559                           item = new QStandardItem();
       
   560                           val = hbTrId("txt_device_update_dblist_java_version");
       
   561                           liststr.clear();
       
   562                           liststr << val;
       
   563                           liststr << str;
       
   564                           item->setData(liststr , Qt::DisplayRole);
       
   565                           m_otherdetailsmodel->appendRow(item);
       
   566                           } 
       
   567                       }            
       
   568                   }            
       
   569              } 
       
   570         CleanupStack::PopAndDestroy(1);
       
   571         qDebug("OMADM servers view DmAdvancedView::addVersionInfo >>");
       
   572     }
       
   573 
       
   574 void DmAdvancedView::addOtherDetails()
       
   575     {
       
   576         qDebug("OMADM servers view DmAdvancedView::addOtherDetails >>");
       
   577         TRequestStatus status;
       
   578         QStringList liststr;
       
   579         QStandardItem* item;
       
   580         QString val;
       
   581         QString str;
       
   582         TInt error(iServer.Connect());
       
   583         if ( error != KErrNone )
       
   584         	return;
       
   585         iServer.GetPhoneInfo(0, info);
       
   586         error = imobPhone.Open(iServer, info.iName);
       
   587         if ( error != KErrNone )
       
   588         {
       
   589         	iServer.Close();
       
   590         	return;
       
   591         }
       
   592         //Bands supported
       
   593         
       
   594         RMobilePhone::TMobilePhoneNetworkInfoV1 nwInfov1;
       
   595         RMobilePhone::TMobilePhoneNetworkInfoV1Pckg nwInfov1Pckg(nwInfov1);                     
       
   596         imobPhone.GetCurrentNetwork(status, nwInfov1Pckg);
       
   597         User::WaitForRequest( status );
       
   598         status = KRequestPending;
       
   599         nwInfov1 = nwInfov1Pckg();
       
   600         NetworkBand(nwInfov1.iBandInfo, str);
       
   601         item = new QStandardItem();
       
   602         val = hbTrId("txt_device_update_dblist_gsm_bands");
       
   603         liststr.clear();
       
   604         liststr << val;
       
   605         liststr << str;
       
   606         item->setData(liststr , Qt::DisplayRole);
       
   607         m_otherdetailsmodel->appendRow(item);
       
   608         
       
   609         //Packet Service
       
   610         
       
   611         TInt packetsrvc =0;
       
   612         RMobilePhone::TMobilePhoneNetworkInfoV5 nwInfov5;
       
   613         RMobilePhone::TMobilePhoneNetworkInfoV5Pckg nwInfov5Pckg(nwInfov5);
       
   614         imobPhone.GetCurrentNetwork( status, nwInfov5Pckg );
       
   615         User::WaitForRequest( status );
       
   616         status = KRequestPending;
       
   617         nwInfov5 = nwInfov5Pckg();
       
   618         
       
   619         if(nwInfov5.iHsdpaAvailableIndicator) packetsrvc =1;
       
   620         
       
   621         if(nwInfov5.iEgprsAvailableIndicator) packetsrvc =2;
       
   622         
       
   623         if(!packetsrvc)
       
   624         {
       
   625             RMobilePhone::TMobilePhoneNetworkInfoV8 nwInfov8;
       
   626             RMobilePhone::TMobilePhoneNetworkInfoV8Pckg nwInfov8Pckg(nwInfov8);
       
   627             imobPhone.GetCurrentNetwork( status, nwInfov8Pckg );
       
   628             User::WaitForRequest( status );
       
   629             status = KRequestPending;
       
   630             nwInfov8 = nwInfov8Pckg();
       
   631             if(nwInfov8.iHsupaAvailableIndicator) packetsrvc =3;
       
   632         }     
       
   633         liststr.clear();
       
   634         val = hbTrId("txt_device_update_dblist_wcdma_uldl_data_rates");
       
   635         liststr << val;
       
   636         item = new QStandardItem();
       
   637         PacketService(packetsrvc, str);
       
   638         liststr << str;
       
   639         item->setData(liststr , Qt::DisplayRole);
       
   640         m_otherdetailsmodel->appendRow(item);
       
   641                     
       
   642         // Ciphering
       
   643         
       
   644         liststr.clear();
       
   645         item = new QStandardItem();
       
   646         val = hbTrId("txt_device_update_dblist_gsm_cipherings");
       
   647         liststr << val;
       
   648         imobPhone.GetNetworkSecurityLevel(status,idispSecurity);
       
   649         User::WaitForRequest( status );
       
   650         NetworkCiphering(idispSecurity, str);
       
   651         liststr << str;
       
   652         item->setData(liststr, Qt::DisplayRole);
       
   653         m_otherdetailsmodel->appendRow(item);
       
   654         
       
   655         // WLAN MAC
       
   656         
       
   657         TUint KPhoneWlanSeparator (':');
       
   658         _LIT( KWLanMACDataFormat, "%02x");  
       
   659         // Fetch WLAN MAC address
       
   660         TBuf<KWlanMacAddrLength> address;
       
   661         RProperty::Get( KPSUidWlan, KPSWlanMacAddress, address );   
       
   662         // Format fetched address
       
   663         TBuf<KWlanMacAddrLength> wlanMACAddress;        
       
   664         for ( TInt i( 0 ); i < address.Length(); i++ )
       
   665             {
       
   666             // Set separator
       
   667             if( i > 0 )
       
   668                 {
       
   669                 wlanMACAddress.Append( KPhoneWlanSeparator );
       
   670                 }
       
   671             // Set data
       
   672             TBuf<50> tmp;
       
   673             tmp.Format( KWLanMACDataFormat, address[i] );
       
   674             wlanMACAddress.Append( tmp );
       
   675             } 
       
   676         liststr.clear();
       
   677         item = new QStandardItem();
       
   678         val = hbTrId("txt_device_update_dblist_wlan_mac_address");
       
   679         liststr << val;
       
   680         str = QString::fromUtf16(wlanMACAddress.Ptr(), wlanMACAddress.Length());
       
   681         liststr << str;
       
   682         item->setData(liststr, Qt::DisplayRole);
       
   683         m_otherdetailsmodel->appendRow(item);
       
   684           
       
   685         // BT MAC
       
   686           
       
   687         TBuf<KBTAddrLength> addressBuffer;
       
   688         // Fetch from Cenrep
       
   689         CRepository* repository = NULL;
       
   690         TRAPD( err, repository = CRepository::NewL( KCRUidBluetoothLocalDeviceAddress ) );
       
   691         if ( err == KErrNone )
       
   692             {
       
   693             qDebug("KCRUidBluetoothLocalDeviceAddress errnone");
       
   694             err = repository->Get( KBTLocalDeviceAddress, addressBuffer );
       
   695             
       
   696             if (err == KErrNone)
       
   697                 qDebug("KBTLocalDeviceAddress errnone");
       
   698             else
       
   699                 qDebug("KBTLocalDeviceAddress Error");
       
   700                 
       
   701             delete repository;
       
   702             }
       
   703         else
       
   704             {
       
   705                 qDebug("KCRUidBluetoothLocalDeviceAddress Error openin cenrep");
       
   706             }
       
   707         liststr.clear();
       
   708         val = hbTrId("txt_device_update_dblist_bt_mac_address");
       
   709         liststr << val;
       
   710         item = new QStandardItem();
       
   711         str = QString::fromUtf16(addressBuffer.Ptr(), addressBuffer.Length());
       
   712         liststr << str;
       
   713         item->setData(liststr , Qt::DisplayRole);
       
   714         m_otherdetailsmodel->appendRow(item);
       
   715         
       
   716         imobPhone.Close();
       
   717         iServer.Close();
       
   718 
       
   719     }
       
   720 void DmAdvancedView::mainCalltoUpdateView()
       
   721 {   
       
   722     qDebug("OMADM servers view DmAdvancedView::mainCalltoUpdateView >>");
       
   723     m_otherdetailsmodel = new QStandardItemModel();
       
   724     TInt i=0;
       
   725     
       
   726     QStringList liststr;
       
   727     QStandardItem* item;
       
   728     QString val;
       
   729     QString str;
       
   730     //1. Device Updated
       
   731 
       
   732     
       
   733     addVersionInfo();
       
   734     
       
   735     addOtherDetails();
       
   736 
       
   737     //sw version date
       
   738     TBuf< KSysUtilVersionTextLength > swversiondate;
       
   739     TBuf< KSysUtilVersionTextLength > version;
       
   740     version.Zero();
       
   741     swversiondate.Zero();
       
   742     if( SysUtil::GetSWVersion(version)==KErrNone)
       
   743         {
       
   744         TInt len= version.Length();
       
   745         TInt pos1 = version.Find(KSmlEOL);
       
   746              if( pos1 != KErrNotFound && len > pos1 )
       
   747                 {
       
   748                  TBuf<KSysUtilVersionTextLength> version1;
       
   749                  version1.Zero();
       
   750                  version1.Append( version.Right( len-pos1-1 ));
       
   751                  len= version1.Length();
       
   752                  pos1 = version1.Find(KSmlEOL);
       
   753                  if( pos1 != KErrNotFound  && len > pos1 )
       
   754                      {
       
   755                      swversiondate.Append(version1.Left( pos1 ));
       
   756                      }
       
   757                 }
       
   758             val = hbTrId("txt_device_update_dblist_sw_version_date");
       
   759             item = new QStandardItem();
       
   760             str = QString::fromUtf16(swversiondate.Ptr(), swversiondate.Length());
       
   761             liststr.clear();
       
   762             liststr << val;
       
   763             liststr << str;
       
   764             item->setData(liststr , Qt::DisplayRole);
       
   765             m_otherdetailsmodel->appendRow(item);
       
   766             }
       
   767             
       
   768     //Custom version and date
       
   769     //SysVersionInfo::TVersionInfoType x = SysVersionInfo::EOPVersion;
       
   770     TBuf< KNSmlMaxTextLength64 >  customsw;
       
   771     TBuf< KNSmlMaxTextLength64 >  customswdate;
       
   772     version.Zero();
       
   773     if( SysVersionInfo::GetVersionInfo(SysVersionInfo::EOPVersion,version) == KErrNone )
       
   774       {
       
   775          TInt len= version.Length();
       
   776          TInt pos1 = version.Find(KSmlEOL);
       
   777          if( pos1 != KErrNotFound  && len > pos1 )
       
   778           {        
       
   779           customsw.Append( version.Left(pos1));
       
   780           customswdate.Append( version.Right( len-pos1-1 ));         
       
   781           }
       
   782       } 
       
   783     
       
   784     if(customsw.Length()>0)
       
   785         {
       
   786         str = QString::fromUtf16(customsw.Ptr(), customsw.Length());
       
   787         item = new QStandardItem();
       
   788         val = hbTrId("txt_device_update_dblist_custom_version");
       
   789         liststr.clear();
       
   790         liststr << val;
       
   791         liststr << str;
       
   792         item->setData(liststr , Qt::DisplayRole);
       
   793         m_otherdetailsmodel->appendRow(item);
       
   794         }
       
   795     if(customswdate.Length()>0)
       
   796         {
       
   797         str = QString::fromUtf16(customswdate.Ptr(), customswdate.Length());
       
   798         item = new QStandardItem();
       
   799         val = hbTrId("txt_device_update_dblist_custom_version_date");
       
   800         liststr.clear();
       
   801         liststr << val;
       
   802         liststr << str;
       
   803         item->setData(liststr , Qt::DisplayRole);
       
   804         m_otherdetailsmodel->appendRow(item);
       
   805         }
       
   806     
       
   807     TBuf<KSysUtilVersionTextLength> Langversion; 
       
   808     TBuf<KSysUtilVersionTextLength> lversion;
       
   809     if( SysUtil::GetLangVersion(Langversion ) == KErrNone )
       
   810       {
       
   811         str = QString::fromUtf16(Langversion.Ptr(), Langversion.Length());
       
   812         item = new QStandardItem();
       
   813         val = hbTrId("txt_device_update_dblist_language_set");
       
   814         liststr.clear();
       
   815         liststr << val;
       
   816         liststr << str;
       
   817         item->setData(liststr , Qt::DisplayRole);
       
   818         m_otherdetailsmodel->appendRow(item);
       
   819       }
       
   820     
       
   821 
       
   822     //lang variant version
       
   823     Langversion.Zero();
       
   824     if( SysUtil::GetLangSWVersion(Langversion ) == KErrNone )
       
   825         {
       
   826         int len = Langversion.Length();
       
   827         TInt pos1 = Langversion.Find( KSmlEOL );
       
   828         if( pos1 != KErrNotFound && len > pos1 )
       
   829             {
       
   830             lversion.Zero();
       
   831             lversion.Append( Langversion.Left( pos1 ) );
       
   832             }
       
   833          str = QString::fromUtf16(lversion.Ptr(), lversion.Length());
       
   834          item = new QStandardItem();
       
   835          val = hbTrId("txt_device_update_dblist_language_variant_version");
       
   836          liststr.clear();
       
   837          liststr << val;
       
   838          liststr << str;
       
   839          item->setData(liststr , Qt::DisplayRole);
       
   840          m_otherdetailsmodel->appendRow(item);
       
   841         }
       
   842      
       
   843     otherdetailslist->setModel(m_otherdetailsmodel);
       
   844     qDebug("OMADM servers view DmAdvancedView::mainCalltoUpdateView <<");
       
   845 		
       
   846 }
       
   847 
       
   848 void DmAdvancedView::PacketService(TInt val, QString& string)
       
   849     {
       
   850     qDebug("OMADM servers view DmAdvancedView::PacketService >>");
       
   851      switch (val)
       
   852          {
       
   853          case (0):
       
   854                  string = hbTrId("txt_device_update_dblist_wcdma_uldl_data_val_l1");
       
   855                  break;
       
   856          case (1):
       
   857                  string = hbTrId("txt_device_update_dblist_wcdma_uldl_data_val_l2");
       
   858                  break;
       
   859          case (2):
       
   860                  string = hbTrId("txt_device_update_dblist_wcdma_uldl_data_val_l3");
       
   861                  break;
       
   862          case (3):
       
   863                  string = hbTrId("txt_device_update_dblist_wcdma_uldl_data_val_l4");
       
   864                  break;
       
   865          case (4):
       
   866                  string = hbTrId("txt_device_update_dblist_gsm_cipherings_val_l4");
       
   867                  break;
       
   868          case (5):
       
   869          default :
       
   870                  string = hbTrId("txt_device_update_dblist_wcdma_uldl_data_val_l5");
       
   871                  break;
       
   872          }
       
   873      qDebug("OMADM servers view DmAdvancedView::PacketService <<");
       
   874      }
       
   875 
       
   876 
       
   877 void DmAdvancedView::NetworkCiphering(RMobilePhone::TMobilePhoneNetworkSecurity val, QString& string)
       
   878     {
       
   879     qDebug("OMADM servers view DmAdvancedView::NetworkCiphering >>");
       
   880      switch (val)
       
   881          {
       
   882          case (RMobilePhone::ECipheringGSM):
       
   883                  string = hbTrId("txt_device_update_dblist_gsm_cipherings_val_l2");
       
   884                  break;
       
   885          case (RMobilePhone::ECipheringWCDMA):
       
   886                  string = hbTrId("txt_device_update_dblist_gsm_cipherings_val_l3");
       
   887                  break;
       
   888          case (RMobilePhone::ECipheringCDMA):
       
   889                  string = hbTrId("txt_device_update_dblist_gsm_cipherings_val_l4");
       
   890                  break;
       
   891          case (RMobilePhone::ECipheringOff):
       
   892          default :
       
   893                  string = hbTrId("txt_device_update_dblist_gsm_cipherings_val_l1");
       
   894                  break;
       
   895          }
       
   896      qDebug("OMADM servers view DmAdvancedView::NetworkCiphering <<");
       
   897     }
       
   898     
       
   899 void DmAdvancedView::NetworkBand(RMobilePhone::TMobilePhoneNetworkBandInfo val, QString& string)
       
   900     {
       
   901     qDebug("OMADM servers view DmAdvancedView::NetworkBand >>");
       
   902     switch (val)
       
   903         {
       
   904         case (RMobilePhone::E800BandA):
       
   905                 string = hbTrId("txt_device_update_dblist_gsm_bands_val_l2");
       
   906                 break;
       
   907         case (RMobilePhone::E800BandB):
       
   908                 string = hbTrId("txt_device_update_dblist_gsm_bands_val_l3");
       
   909                 break;
       
   910         case (RMobilePhone::E800BandC):
       
   911                 string = hbTrId("txt_device_update_dblist_gsm_bands_val_l4");
       
   912                 break;
       
   913         case (RMobilePhone::E1900BandA):
       
   914                 string = hbTrId("txt_device_update_dblist_gsm_bands_val_l5");
       
   915                 break;
       
   916         case (RMobilePhone::E1900BandB):
       
   917                 string = hbTrId("txt_device_update_dblist_gsm_bands_val_l6");
       
   918                 break;
       
   919         case (RMobilePhone::E1900BandC):
       
   920                 string = hbTrId("txt_device_update_dblist_gsm_bands_val_l7");
       
   921                 break;
       
   922         case (RMobilePhone::E1900BandD):
       
   923                 string = hbTrId("txt_device_update_dblist_gsm_bands_val_l8");
       
   924                 break;
       
   925         case (RMobilePhone::E1900BandE):
       
   926                 string = hbTrId("txt_device_update_dblist_gsm_bands_val_l9");
       
   927                 break;
       
   928         case (RMobilePhone::E1900BandF):
       
   929                 string = hbTrId("txt_device_update_dblist_gsm_bands_val_l10");
       
   930                 break;
       
   931         case (RMobilePhone::EBandUnknown):
       
   932         default :
       
   933                 string = hbTrId("txt_device_update_dblist_gsm_bands_val_l1");
       
   934                 break;
       
   935         }   
       
   936     qDebug("OMADM servers view DmAdvancedView::NetworkBand <<");
       
   937     }
       
   938 
       
   939 void DmAdvancedView::syncCompleted(int jobstatus)
       
   940     {
       
   941     qDebug("OMADM servers view DmAdvancedView::syncCompleted >>");
       
   942     Q_UNUSED(jobstatus);
       
   943     connectionRequested = false;    
       
   944     updateListview();
       
   945     iMainView->enableButtons();
       
   946     qDebug("OMADM servers view DmAdvancedView::syncCompleted <<");
       
   947     }
       
   948 	
       
   949 void DmAdvancedView::defaultMenuItemSelected()
       
   950     {
       
   951     qDebug("OMADM servers view DmAdvancedView::defaultMenuItemSelected >>");
       
   952     dminfo->setDefaultProfile(currentselecteditem);
       
   953     updateEarlierdefaultProfileIcon();
       
   954     modelItem->setIcon(defaultprofileicon);
       
   955     currentdefaultprofile = currentselecteditem;
       
   956     qDebug("OMADM servers view DmAdvancedView::defaultMenuItemSelected <<");
       
   957     }
       
   958 
       
   959 void DmAdvancedView::deleteMenuItemSelected()
       
   960     {
       
   961     qDebug("OMADM servers view DmAdvancedView::deleteMenuItemSelected >>");
       
   962     dminfo->DisableDbNotifications(true);
       
   963     //check currentdefaultprofile is current item
       
   964     if(currentselecteditem == currentdefaultprofile) // deleting default profile
       
   965         currentdefaultprofile = -1;
       
   966     if(dminfo->DeleteProfile(currentselecteditem) >=0 )
       
   967         {
       
   968     //Update the profile list
       
   969     model->removeRow(currentselecteditem);
       
   970         }
       
   971     dminfo->DisableDbNotifications(false);
       
   972     qDebug("OMADM servers view DmAdvancedView::deleteMenuItemSelected <<");
       
   973     }
       
   974 
       
   975 void DmAdvancedView::connectMenuItemSelected()
       
   976     {
       
   977     qDebug("OMADM servers view DmAdvancedView::connectMenuItemSelected >>");
       
   978     iMainView->displayNoteAndDisableButtons();
       
   979     backButtonClicked();
       
   980     dminfo->synchronize(currentselecteditem);    
       
   981     connectionRequested = true;
       
   982     qDebug("OMADM servers view DmAdvancedView::connectMenuItemSelected <<");
       
   983     }
       
   984