connectionmonitoring/connectionview/src/connectionview.cpp
changeset 53 4af712113915
parent 47 cb7afde124a3
child 73 70ee5458c95d
equal deleted inserted replaced
47:cb7afde124a3 53:4af712113915
    39 #ifdef OST_TRACE_COMPILER_IN_USE
    39 #ifdef OST_TRACE_COMPILER_IN_USE
    40 #include "connectionviewTraces.h"
    40 #include "connectionviewTraces.h"
    41 #endif
    41 #endif
    42 
    42 
    43 
    43 
    44 
       
    45 QTM_USE_NAMESPACE
    44 QTM_USE_NAMESPACE
    46 
    45 
    47 
       
    48 const qreal typeLabelWidth = 18.0;
    46 const qreal typeLabelWidth = 18.0;
       
    47 const QString iapIdentifierPrefix = "I_";
    49 
    48 
    50 ConnectionView::ConnectionView():
    49 ConnectionView::ConnectionView():
    51     mNetConfigurationManager(new QNetworkConfigurationManager(this)),
    50     mNetConfigurationManager(new QNetworkConfigurationManager(this)),
    52     mSignalMapper(new QSignalMapper(this)),
    51     mSignalMapper(new QSignalMapper(this)),
    53     mConnectionCount(0),
    52     mConnectionCount(0),
    54     mClosingTimer(0)
    53     mClosingTimer(0)
    55 {
    54 {
    56     OstTraceFunctionEntry0( CONNECTIONVIEW_CONNECTIONVIEW_ENTRY );
    55     OstTraceFunctionEntry0( CONNECTIONVIEW_CONNECTIONVIEW_ENTRY );
    57     // Install localization
    56     // Install localization
    58     HbTranslator *translator(new HbTranslator("connectionview"));
    57     mTranslator = QSharedPointer<HbTranslator>(new HbTranslator("connectionview"));
    59     
    58    
    60     // Register custom layout location
    59     // Register custom layout location
    61     bool registerStatus = HbStyleLoader::registerFilePath(":/layout/");
    60     bool registerStatus = HbStyleLoader::registerFilePath(":/layout/");
    62     Q_ASSERT(registerStatus);
    61     Q_ASSERT(registerStatus);
    63     
    62     
    64     // Map the configurationChanged signal to a slot in order to get
    63     // Map the configurationChanged signal to a slot in order to get
   188         setCurrentView(mMainView);
   187         setCurrentView(mMainView);
   189 
   188 
   190         for (int i=0; i<mConnectionCount; i++) {
   189         for (int i=0; i<mConnectionCount; i++) {
   191             // Get the iap id and the iap name for the UI construction
   190             // Get the iap id and the iap name for the UI construction
   192             bool ok = true;
   191             bool ok = true;
   193             int iapId = activeConfigurations[i].identifier().toInt(&ok);
   192             int iapId = activeConfigurations[i].identifier().remove(iapIdentifierPrefix).toInt(&ok);
   194             QString iapName = activeConfigurations[i].name();
   193             QString iapName = activeConfigurations[i].name();
   195 
   194 
   196             if (ok) {
   195             if (ok) {
   197                 addGroupBox(iapId, iapName);
   196                 addGroupBox(iapId, iapName);
   198             }        
   197             }        
   377     getActiveCellularConnections(activeConfigurations);
   376     getActiveCellularConnections(activeConfigurations);
   378     int count = activeConfigurations.count();
   377     int count = activeConfigurations.count();
   379             
   378             
   380     for (int i=0; i < count; i++) {
   379     for (int i=0; i < count; i++) {
   381         bool ok = true;
   380         bool ok = true;
   382         int loopedIapId = activeConfigurations[i].identifier().toInt(&ok);
   381         int loopedIapId = activeConfigurations[i].identifier().remove(iapIdentifierPrefix).toInt(&ok);
   383         
   382         
   384         // if the looped iap matches the iap, stop the connection
   383         // if the looped iap matches the iap, stop the connection
   385         if (loopedIapId == iapId) {
   384         if (loopedIapId == iapId) {
   386             
   385             
   387             QNetworkSession *networkSession = new QNetworkSession(activeConfigurations[i], mMainView);
   386             QNetworkSession *networkSession = new QNetworkSession(activeConfigurations[i], mMainView);