qtmobility/examples/bearermonitor/bearermonitor.cpp
branchRCL_3
changeset 13 4203353e74ea
parent 6 eb34711bcc75
equal deleted inserted replaced
10:4ea83c148e84 13:4203353e74ea
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the Qt Mobility Components.
     7 ** This file is part of the Qt Mobility Components.
     8 **
     8 **
    78             treeWidget->setCurrentItem(item);
    78             treeWidget->setCurrentItem(item);
    79             showConfigurationFor(item);
    79             showConfigurationFor(item);
    80             break;
    80             break;
    81         }
    81         }
    82     }
    82     }
    83 
    83     connect(&manager, SIGNAL(onlineStateChanged(bool)), this ,SLOT(onlineStateChanged(bool)));
    84     connect(&manager, SIGNAL(configurationAdded(const QNetworkConfiguration&)),
    84     connect(&manager, SIGNAL(configurationAdded(const QNetworkConfiguration&)),
    85             this, SLOT(configurationAdded(const QNetworkConfiguration&)));
    85             this, SLOT(configurationAdded(const QNetworkConfiguration&)));
    86     connect(&manager, SIGNAL(configurationRemoved(const QNetworkConfiguration&)),
    86     connect(&manager, SIGNAL(configurationRemoved(const QNetworkConfiguration&)),
    87             this, SLOT(configurationRemoved(const QNetworkConfiguration&)));
    87             this, SLOT(configurationRemoved(const QNetworkConfiguration&)));
    88     connect(&manager, SIGNAL(configurationChanged(const QNetworkConfiguration&)),
    88     connect(&manager, SIGNAL(configurationChanged(const QNetworkConfiguration&)),
    89             this, SLOT(configurationChanged(const QNetworkConfiguration)));
    89             this, SLOT(configurationChanged(const QNetworkConfiguration)));
    90     connect(&manager, SIGNAL(updateCompleted()), this, SLOT(updateConfigurations()));
    90     connect(&manager, SIGNAL(updateCompleted()), this, SLOT(updateConfigurations()));
    91     connect(&manager, SIGNAL(onlineStateChanged(bool)), this ,SLOT(onlineStateChanged(bool)));
       
    92 
    91 
    93 #ifdef Q_OS_WIN
    92 #ifdef Q_OS_WIN
    94     connect(registerButton, SIGNAL(clicked()), this, SLOT(registerNetwork()));
    93     connect(registerButton, SIGNAL(clicked()), this, SLOT(registerNetwork()));
    95     connect(unregisterButton, SIGNAL(clicked()), this, SLOT(unregisterNetwork()));
    94     connect(unregisterButton, SIGNAL(clicked()), this, SLOT(unregisterNetwork()));
    96 #else
    95 #else
   109     connect(deleteSessionButton, SIGNAL(clicked()),
   108     connect(deleteSessionButton, SIGNAL(clicked()),
   110             this, SLOT(deleteSession()));
   109             this, SLOT(deleteSession()));
   111 #endif
   110 #endif
   112     connect(scanButton, SIGNAL(clicked()),
   111     connect(scanButton, SIGNAL(clicked()),
   113             this, SLOT(performScan()));
   112             this, SLOT(performScan()));
       
   113 
       
   114     // Just in case update all configurations so that all
       
   115     // configurations are up to date.
       
   116     manager.updateConfigurations();
   114 }
   117 }
   115 
   118 
   116 BearerMonitor::~BearerMonitor()
   119 BearerMonitor::~BearerMonitor()
   117 {
   120 {
   118 }
   121 }
   206 
   209 
   207 void BearerMonitor::updateConfigurations()
   210 void BearerMonitor::updateConfigurations()
   208 {
   211 {
   209     progressBar->hide();
   212     progressBar->hide();
   210     scanButton->show();
   213     scanButton->show();
       
   214 
       
   215     // Just in case update online state, on Symbian platform
       
   216     // WLAN scan needs to be triggered initially to have their true state.
       
   217     onlineStateChanged(manager.isOnline());
   211 
   218 
   212     QList<QTreeWidgetItem *> items = treeWidget->findItems(QLatin1String("*"), Qt::MatchWildcard);
   219     QList<QTreeWidgetItem *> items = treeWidget->findItems(QLatin1String("*"), Qt::MatchWildcard);
   213     QMap<QString, QTreeWidgetItem *> itemMap;
   220     QMap<QString, QTreeWidgetItem *> itemMap;
   214     while (!items.isEmpty()) {
   221     while (!items.isEmpty()) {
   215         QTreeWidgetItem *item = items.takeFirst();
   222         QTreeWidgetItem *item = items.takeFirst();