browsercore/core/network/WebNetworkSession.cpp
changeset 10 232fbd5a2dcb
parent 6 1c3b8676e58c
equal deleted inserted replaced
6:1c3b8676e58c 10:232fbd5a2dcb
    18 * Description:
    18 * Description:
    19 *
    19 *
    20 */
    20 */
    21 
    21 
    22 #include "WebNetworkSession.h"
    22 #include "WebNetworkSession.h"
       
    23 #include "webpagecontroller.h"
    23 
    24 
    24 namespace WRT {
    25 namespace WRT {
    25 	
    26 	
    26 /*!
    27 /*!
    27     Constructs a Web Network Session based on \a QNetworkConfiguration with the given \a parent.
    28     Constructs a Web Network Session based on \a QNetworkConfiguration with the given \a parent.
    62     
    63     
    63     It emits networkNameChnaged signal if it migrates to the new QNetworkConfiguration.
    64     It emits networkNameChnaged signal if it migrates to the new QNetworkConfiguration.
    64 */
    65 */
    65 void WebNetworkSession::handlePreferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless)
    66 void WebNetworkSession::handlePreferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless)
    66 {
    67 {
    67     bool isSelected = TRUE;
    68     bool isSelected = true;
       
    69     QNetworkConfiguration activeConfig = activeConfiguration();
    68     
    70     
    69     if (isSeamless)
    71     if (isSeamless)
    70     {
    72     {
    71         m_NetworkSession->migrate();
    73         m_NetworkSession->migrate();
    72         qDebug() << "Migrate to new Network Connection: " << config.name();
    74         qDebug() << "Migrate to new Network Connection: " << config.name();
    73         emit sessionConfigurationChanged(config); 
    75         emit sessionConfigurationChanged(config); 
    74     }
    76     }
    75     else
    77     else
    76     {
    78     {
    77         // Dialog Box to select
    79     	  qDebug() << "active: " << activeConfig.bearerName() << "new: " <<  config.bearerName();
       
    80     	  // Is it upgrade ? Upgrade is defined as the cellular -> wireless LAN 
       
    81     	  if (((activeConfig.bearerName() == "2G") || (activeConfig.bearerName() == "CDMA2000")
       
    82     	  	  || (activeConfig.bearerName() == "WCDMA") || (activeConfig.bearerName() == "HSPA"))
       
    83     	  	  && (config.bearerName() == "WLAN"))
       
    84     	  {
       
    85     	  	  if (WebPageController::getSingleton()->secureState()) 
       
    86     	  	      isSelected = false;
       
    87     	  	      
       
    88     	  	  qDebug() << "secureState: " << WebPageController::getSingleton()->secureState();
       
    89     	  }
       
    90     	  	  
    78         if (isSelected)
    91         if (isSelected)
    79         {
    92         {
    80             m_NetworkSession->migrate();
    93             m_NetworkSession->migrate();
    81             qDebug() << "Migrate to new Network Connection: " << config.name();
    94             qDebug() << "Migrate to new Network Connection: " << config.name();
    82             emit sessionConfigurationChanged(config); 
    95             emit sessionConfigurationChanged(config); 
    83         }
    96         }
    84         else
    97         else
    85         {
    98         {
    86             m_NetworkSession->ignore();
    99             m_NetworkSession->ignore();
    87             qDebug() << "Ignore new Network Connection: " << config.name();
   100             qDebug() << "Ignore new Network Connection: " << config.name();
       
   101             emit sessionRoamingRejected();
    88         }
   102         }
    89     }
   103     }
    90 }
   104 }
    91 
   105 
    92 /*! 
   106 /*! 
    95     It emits networknameChanged signal with current QNetworkConfiguration.
   109     It emits networknameChanged signal with current QNetworkConfiguration.
    96     
   110     
    97 */
   111 */
    98 void WebNetworkSession::handleNewConfigurationActivated()
   112 void WebNetworkSession::handleNewConfigurationActivated()
    99 {
   113 {
   100     bool isConnected = TRUE;
   114     bool isConnected = true;
   101     
   115     
   102     // isConnectionGood = testConnection();
   116     // isConnectionGood = testConnection();
   103     if (isConnected)
   117     if (isConnected)
   104     {
   118     {
   105         m_NetworkSession->accept();
   119         m_NetworkSession->accept();