qtmobility/tests/bearerex/bearerex.cpp
changeset 0 cfcbf08528c4
child 11 06b8e2af4411
child 13 4203353e74ea
equal deleted inserted replaced
-1:000000000000 0:cfcbf08528c4
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the Qt Mobility Components.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 #include "bearerex.h"
       
    42 
       
    43 #include <QtNetwork>
       
    44 
       
    45 Q_DECLARE_METATYPE(QNetworkConfiguration)
       
    46 
       
    47 BearerEx::BearerEx(QWidget* parent)
       
    48      : QMainWindow(parent)
       
    49 {
       
    50     setupUi(this);
       
    51     
       
    52     createMenus();
       
    53     
       
    54     connect(&m_NetworkConfigurationManager, SIGNAL(updateCompleted()), this, SLOT(configurationsUpdateCompleted()));
       
    55     connect(&m_NetworkConfigurationManager, SIGNAL(configurationAdded(const QNetworkConfiguration&)),
       
    56             this, SLOT(configurationAdded(const QNetworkConfiguration&)));
       
    57     connect(&m_NetworkConfigurationManager, SIGNAL(configurationRemoved(const QNetworkConfiguration&)),
       
    58             this, SLOT(configurationRemoved(const QNetworkConfiguration&)));
       
    59     connect(&m_NetworkConfigurationManager, SIGNAL(onlineStateChanged(bool)),
       
    60             this, SLOT(onlineStateChanged(bool)));
       
    61     connect(&m_NetworkConfigurationManager, SIGNAL(configurationChanged(const QNetworkConfiguration&)),
       
    62             this, SLOT(configurationChanged(const QNetworkConfiguration&)));
       
    63     showConfigurations();
       
    64 }
       
    65 
       
    66 void BearerEx::createMenus()
       
    67 {
       
    68     QAction* act1 = new QAction(tr("Show Details"), this);
       
    69     menuBar()->addAction(act1);
       
    70     connect(act1, SIGNAL(triggered()), this, SLOT(on_showDetailsButton_clicked()));
       
    71 
       
    72     QAction* exitAct = new QAction(tr("Exit"), this);
       
    73     menuBar()->addAction(exitAct);
       
    74     connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
       
    75 }
       
    76 
       
    77 void BearerEx::showConfigurations()
       
    78 {
       
    79     listWidget->clear();
       
    80     QListWidgetItem* listItem;
       
    81     
       
    82     QNetworkConfiguration defaultConfig = m_NetworkConfigurationManager.defaultConfiguration();
       
    83     if (defaultConfig.type() == QNetworkConfiguration::UserChoice) {
       
    84         listItem = new QListWidgetItem();
       
    85         QFont font = listItem->font();
       
    86         font.setBold(true);
       
    87         font.setUnderline(true);
       
    88         listItem->setFont(font);        
       
    89         listItem->setText("       UserChoice");
       
    90         listItem->setData(Qt::UserRole, qVariantFromValue(defaultConfig));
       
    91         listWidget->addItem(listItem);
       
    92     }
       
    93     
       
    94     QList<QNetworkConfiguration> configurations = m_NetworkConfigurationManager.allConfigurations();
       
    95     for (int i=0; i<configurations.count(); i++)
       
    96     {
       
    97         listItem = new QListWidgetItem();
       
    98         QString text;
       
    99         if (configurations[i].type() == QNetworkConfiguration::InternetAccessPoint) {
       
   100             text.append("(IAP,");
       
   101         } else if (configurations[i].type() == QNetworkConfiguration::ServiceNetwork) {
       
   102             text.append("(SNAP,");
       
   103         }
       
   104         
       
   105         if ((configurations[i].state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
       
   106             text.append("Act) ");
       
   107         } else if ((configurations[i].state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) {
       
   108             text.append("Disc) ");
       
   109         } else {
       
   110             text.append("Def) ");
       
   111         }
       
   112         text.append(configurations[i].name());
       
   113         
       
   114         if (defaultConfig.isValid() && defaultConfig == configurations[i]) {
       
   115             QFont font = listItem->font();
       
   116             font.setBold(true);
       
   117             font.setUnderline(true);
       
   118             listItem->setFont(font);        
       
   119         }
       
   120         listItem->setText(text);
       
   121         listItem->setData(Qt::UserRole, qVariantFromValue(configurations[i]));
       
   122         listWidget->addItem(listItem);
       
   123     }
       
   124 }
       
   125 
       
   126 void BearerEx::on_updateConfigurationsButton_clicked()
       
   127 {
       
   128     m_NetworkConfigurationManager.updateConfigurations();
       
   129 }
       
   130 
       
   131 void BearerEx::on_updateListButton_clicked()
       
   132 {
       
   133     showConfigurations();
       
   134 }
       
   135 
       
   136 void BearerEx::on_showDetailsButton_clicked()
       
   137 {
       
   138     QListWidgetItem* item = listWidget->currentItem();
       
   139     if (!item) {
       
   140         return;
       
   141     }
       
   142 
       
   143 	QNetworkConfiguration networkConfiguration = qVariantValue<QNetworkConfiguration>(item->data(Qt::UserRole));
       
   144 	DetailedInfoDialog infoDialog(&networkConfiguration,this);
       
   145 	infoDialog.exec();
       
   146 }
       
   147 
       
   148 void BearerEx::on_createSessionButton_clicked()
       
   149 {
       
   150     QListWidgetItem* item = listWidget->currentItem();
       
   151     if (!item) {
       
   152         return;
       
   153     }    
       
   154     QNetworkConfiguration networkConfiguration = qVariantValue<QNetworkConfiguration>(item->data(Qt::UserRole));
       
   155     int newTabIndex = mainTabWidget->count();
       
   156     SessionTab* newTab = new SessionTab(&networkConfiguration,&m_NetworkConfigurationManager,eventListWidget,newTabIndex-1);
       
   157     QString label = QString("S")+QString::number(newTabIndex-1);
       
   158     mainTabWidget->insertTab(newTabIndex,newTab,label);
       
   159     mainTabWidget->setCurrentIndex(newTabIndex);
       
   160 }
       
   161 
       
   162 void BearerEx::on_clearEventListButton_clicked()
       
   163 {
       
   164     eventListWidget->clear();
       
   165 }
       
   166 
       
   167 void BearerEx::configurationAdded(const QNetworkConfiguration& config)
       
   168 {
       
   169     QListWidgetItem* listItem = new QListWidgetItem();
       
   170     listItem->setText(QString("Added: ")+config.name());
       
   171     eventListWidget->addItem(listItem);
       
   172 }
       
   173 
       
   174 void BearerEx::configurationRemoved(const QNetworkConfiguration& config)
       
   175 {
       
   176     QListWidgetItem* listItem = new QListWidgetItem();
       
   177     listItem->setText(QString("Removed: ")+config.name());
       
   178     eventListWidget->addItem(listItem);
       
   179 }
       
   180 
       
   181 void BearerEx::onlineStateChanged(bool isOnline)
       
   182 {
       
   183     QListWidgetItem* listItem = new QListWidgetItem();
       
   184     QFont font = listItem->font();
       
   185     font.setBold(true);
       
   186     listItem->setFont(font);        
       
   187     if (isOnline) {
       
   188         listItem->setText(QString("> Online"));
       
   189     } else {
       
   190         listItem->setText(QString("< Offline"));
       
   191     }
       
   192     eventListWidget->addItem(listItem);
       
   193 }
       
   194 
       
   195 void BearerEx::configurationChanged(const QNetworkConfiguration & config)
       
   196 {
       
   197     QListWidgetItem* listItem = new QListWidgetItem();
       
   198     QString state;
       
   199     switch (config.state())
       
   200     {
       
   201         case QNetworkConfiguration::Undefined:
       
   202             state = "Undef : ";
       
   203             break;
       
   204         case QNetworkConfiguration::Defined:
       
   205             state = "Def : ";
       
   206             break;
       
   207         case QNetworkConfiguration::Discovered:
       
   208             state = "Disc : ";
       
   209             break;
       
   210         case QNetworkConfiguration::Active:
       
   211             state = "Act : ";
       
   212             break;
       
   213     }
       
   214     listItem->setText(state+config.name());
       
   215     eventListWidget->addItem(listItem);
       
   216 }
       
   217 
       
   218 void BearerEx::configurationsUpdateCompleted()
       
   219 {
       
   220     QMessageBox msgBox;
       
   221     msgBox.setStandardButtons(QMessageBox::Close);
       
   222     msgBox.setText("Configurations update completed.");
       
   223     msgBox.exec();
       
   224 }
       
   225 
       
   226 DetailedInfoDialog::DetailedInfoDialog(QNetworkConfiguration* apNetworkConfiguration, QWidget * parent)
       
   227     : QDialog(parent)
       
   228 {
       
   229     setupUi(this);
       
   230 
       
   231     tableWidget->setColumnCount(2);
       
   232     int rowCount = 2;
       
   233     
       
   234     if (apNetworkConfiguration->type() == QNetworkConfiguration::ServiceNetwork) {
       
   235         rowCount = rowCount + apNetworkConfiguration->children().count();
       
   236     }
       
   237 
       
   238 	tableWidget->setRowCount(rowCount);
       
   239 	tableWidget->setColumnWidth(1,250);
       
   240 	tableWidget->setItem(0, 0, new QTableWidgetItem(tr("Name")));
       
   241 	tableWidget->setItem(0, 1, new QTableWidgetItem(apNetworkConfiguration->name()));
       
   242 	tableWidget->setItem(1, 0, new QTableWidgetItem(tr("Id")));
       
   243 	tableWidget->setItem(1, 1, new QTableWidgetItem(apNetworkConfiguration->identifier()));
       
   244     if (apNetworkConfiguration->type() == QNetworkConfiguration::ServiceNetwork) {
       
   245         for (int i=0; i<apNetworkConfiguration->children().count(); i++) {
       
   246             tableWidget->setItem(i+2, 0, new QTableWidgetItem(QString("IAP")+QString::number(i+1)));
       
   247             tableWidget->setItem(i+2, 1, new QTableWidgetItem(apNetworkConfiguration->children()[i].name()));
       
   248         }
       
   249     }
       
   250     
       
   251     tableWidget->setFocusPolicy(Qt::NoFocus);
       
   252 
       
   253 #ifdef Q_OS_SYMBIAN
       
   254     this->showMaximized();
       
   255 #endif
       
   256 }
       
   257 
       
   258 SessionTab::SessionTab(QNetworkConfiguration* apNetworkConfiguration,
       
   259                        QNetworkConfigurationManager* configManager,
       
   260                        QListWidget* eventListWidget,
       
   261                        int index,
       
   262                        BearerEx * parent)
       
   263     : QWidget(parent), m_http(0), m_eventListWidget(eventListWidget),
       
   264      m_index(index), m_httpRequestOngoing(false), m_alrEnabled (false)
       
   265 {
       
   266     setupUi(this);
       
   267 
       
   268     m_ConfigManager = configManager;
       
   269     m_NetworkSession = new QNetworkSession(*apNetworkConfiguration);
       
   270 
       
   271     // Update initial Session state to UI
       
   272     newState(m_NetworkSession->state());
       
   273 
       
   274     connect(m_NetworkSession, SIGNAL(newConfigurationActivated()), this, SLOT(newConfigurationActivated()));
       
   275     connect(m_NetworkSession, SIGNAL(stateChanged(QNetworkSession::State)),
       
   276             this, SLOT(stateChanged(QNetworkSession::State)));
       
   277     connect(m_NetworkSession, SIGNAL(opened()), this, SLOT(opened()));
       
   278     connect(m_NetworkSession, SIGNAL(closed()), this, SLOT(closed()));
       
   279     connect(m_NetworkSession, SIGNAL(error(QNetworkSession::SessionError)), this, SLOT(error(QNetworkSession::SessionError)));
       
   280     
       
   281     if (apNetworkConfiguration->type() == QNetworkConfiguration::InternetAccessPoint) {
       
   282         snapLabel->hide();
       
   283         snapLineEdit->hide();
       
   284         alrButton->hide();
       
   285         iapLineEdit->setText(apNetworkConfiguration->name()+" ("+apNetworkConfiguration->identifier()+")");
       
   286     } else if (apNetworkConfiguration->type() == QNetworkConfiguration::ServiceNetwork) {
       
   287         snapLineEdit->setText(apNetworkConfiguration->name()+" ("+apNetworkConfiguration->identifier()+")");
       
   288     }
       
   289     bearerLineEdit->setText(apNetworkConfiguration->bearerName());
       
   290     sentRecDataLineEdit->setText(QString::number(m_NetworkSession->bytesWritten())+
       
   291                                  QString(" / ")+
       
   292                                  QString::number(m_NetworkSession->bytesReceived()));
       
   293     snapLineEdit->setFocusPolicy(Qt::NoFocus);
       
   294     iapLineEdit->setFocusPolicy(Qt::NoFocus);
       
   295     bearerLineEdit->setFocusPolicy(Qt::NoFocus);
       
   296     sentRecDataLineEdit->setFocusPolicy(Qt::NoFocus);
       
   297     stateLineEdit->setFocusPolicy(Qt::NoFocus);
       
   298 }
       
   299 
       
   300 SessionTab::~SessionTab()
       
   301 {
       
   302     delete m_NetworkSession;
       
   303     delete m_http;
       
   304 }
       
   305 
       
   306 void SessionTab::on_createQHttpButton_clicked()
       
   307 {
       
   308     if (m_httpRequestOngoing) {
       
   309         return;
       
   310     }
       
   311 
       
   312     if (m_http) {
       
   313         disconnect(m_http, 0, 0, 0);
       
   314         delete m_http;
       
   315     }
       
   316     m_http = new QHttp(this);
       
   317     createQHttpButton->setText("Recreate QHttp");
       
   318     connect(m_http, SIGNAL(done(bool)), this, SLOT(done(bool)));    
       
   319 }
       
   320 
       
   321 void SessionTab::on_sendRequestButton_clicked()
       
   322 {
       
   323     if (m_http) {
       
   324         QString urlstring("http://www.google.com");
       
   325         QUrl url(urlstring);
       
   326         m_http->setHost(url.host(), QHttp::ConnectionModeHttp, url.port() == -1 ? 0 : url.port());
       
   327         m_http->get(urlstring);
       
   328         m_httpRequestOngoing = true;
       
   329     } else {
       
   330         QMessageBox msgBox;
       
   331         msgBox.setStandardButtons(QMessageBox::Close);
       
   332         msgBox.setText("QHttp not created.\nCreate QHttp First.");
       
   333         msgBox.exec();
       
   334     }
       
   335 }
       
   336 
       
   337 void SessionTab::on_openSessionButton_clicked()
       
   338 {
       
   339     m_NetworkSession->open();
       
   340     if (m_NetworkSession->isOpen()) {
       
   341         newState(m_NetworkSession->state()); 
       
   342     }
       
   343 }
       
   344 
       
   345 void SessionTab::on_closeSessionButton_clicked()
       
   346 {
       
   347     m_NetworkSession->close();
       
   348     if (!m_NetworkSession->isOpen()) {
       
   349         newState(m_NetworkSession->state()); 
       
   350     }
       
   351 }
       
   352 
       
   353 void SessionTab::on_stopConnectionButton_clicked()
       
   354 {
       
   355     m_NetworkSession->stop();
       
   356 }
       
   357 
       
   358 void SessionTab::on_alrButton_clicked()
       
   359 {
       
   360     if (!m_alrEnabled) {
       
   361         connect(m_NetworkSession, SIGNAL(preferredConfigurationChanged(const QNetworkConfiguration&, bool)),
       
   362                 this, SLOT(preferredConfigurationChanged(const QNetworkConfiguration&, bool)));
       
   363         alrButton->setText("Disable ALR");
       
   364         m_alrEnabled = true;
       
   365     } else {
       
   366         disconnect(m_NetworkSession, SIGNAL(preferredConfigurationChanged(const QNetworkConfiguration&, bool)), 0, 0);
       
   367         alrButton->setText("Enable ALR");
       
   368         m_alrEnabled = false;
       
   369     }
       
   370 }
       
   371 
       
   372 void SessionTab::on_deleteSessionButton_clicked()
       
   373 {
       
   374     setWindowTitle("Bearer Example");
       
   375     delete this;
       
   376 }
       
   377 
       
   378 void SessionTab::newConfigurationActivated()
       
   379 {
       
   380     QMessageBox msgBox;
       
   381     msgBox.setText("New configuration activated.");
       
   382     msgBox.setInformativeText("Do you want to accept new configuration?");
       
   383     msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
       
   384     msgBox.setDefaultButton(QMessageBox::Yes);
       
   385     if (msgBox.exec() == QMessageBox::Yes) {
       
   386         m_NetworkSession->accept();
       
   387         iapLineEdit->setText(m_config.name()+" ("+m_config.identifier()+")");
       
   388     } else {
       
   389         m_NetworkSession->reject();
       
   390     }
       
   391 }
       
   392 
       
   393 void SessionTab::preferredConfigurationChanged(const QNetworkConfiguration& config, bool /*isSeamless*/)
       
   394 {
       
   395     m_config =  config;
       
   396     QMessageBox msgBox;
       
   397     msgBox.setText("Roaming to new configuration.");
       
   398     msgBox.setInformativeText("Do you want to migrate to "+config.name()+"?");
       
   399     msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
       
   400     msgBox.setDefaultButton(QMessageBox::Yes);
       
   401     if (msgBox.exec() == QMessageBox::Yes) {
       
   402         m_NetworkSession->migrate();
       
   403     } else {
       
   404         m_NetworkSession->ignore();
       
   405     }
       
   406 }
       
   407 
       
   408 void SessionTab::opened()
       
   409 {
       
   410     QListWidgetItem* listItem = new QListWidgetItem();
       
   411     QFont font = listItem->font();
       
   412     font.setBold(true);
       
   413     listItem->setFont(font);        
       
   414     listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+QString("Opened"));
       
   415     m_eventListWidget->addItem(listItem);
       
   416     
       
   417     QVariant identifier = m_NetworkSession->property("ActiveConfiguration");
       
   418     if (!identifier.isNull()) {
       
   419         QString configId = identifier.toString();
       
   420         QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId);
       
   421         if (config.isValid()) {
       
   422             iapLineEdit->setText(config.name()+" ("+config.identifier()+")");
       
   423         }
       
   424     }
       
   425 
       
   426     if (m_NetworkSession->configuration().type() == QNetworkConfiguration::UserChoice) {
       
   427         QVariant identifier = m_NetworkSession->property("UserChoiceConfiguration");
       
   428         if (!identifier.isNull()) {
       
   429             QString configId = identifier.toString();
       
   430             QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId);
       
   431             if (config.isValid() && (config.type() == QNetworkConfiguration::ServiceNetwork)) {
       
   432                 snapLineEdit->setText(config.name());
       
   433             }
       
   434         }
       
   435     }
       
   436 }
       
   437 
       
   438 void SessionTab::closed()
       
   439 {
       
   440     QListWidgetItem* listItem = new QListWidgetItem();
       
   441     QFont font = listItem->font();
       
   442     font.setBold(true);
       
   443     listItem->setFont(font);        
       
   444     listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+QString("Closed"));
       
   445     m_eventListWidget->addItem(listItem);
       
   446 }
       
   447 
       
   448 QString SessionTab::stateString(QNetworkSession::State state)
       
   449 {
       
   450     QString stateString;
       
   451     switch (state)
       
   452     {
       
   453         case QNetworkSession::Invalid:
       
   454             stateString = "Invalid";
       
   455             break;
       
   456         case QNetworkSession::NotAvailable:
       
   457             stateString = "NotAvailable";
       
   458             break;
       
   459         case QNetworkSession::Connecting:
       
   460             stateString = "Connecting";
       
   461             break;
       
   462         case QNetworkSession::Connected:
       
   463             stateString = "Connected";
       
   464             break;
       
   465         case QNetworkSession::Closing:
       
   466             stateString = "Closing";
       
   467             break;
       
   468         case QNetworkSession::Disconnected:
       
   469             stateString = "Disconnected";
       
   470             break;
       
   471         case QNetworkSession::Roaming:
       
   472             stateString = "Roaming";
       
   473             break;
       
   474     }
       
   475     return stateString;
       
   476 }
       
   477 
       
   478 void SessionTab::stateChanged(QNetworkSession::State state)    
       
   479 {
       
   480     newState(state);
       
   481     
       
   482     QListWidgetItem* listItem = new QListWidgetItem();
       
   483     listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+stateString(state));
       
   484     m_eventListWidget->addItem(listItem);
       
   485 }
       
   486 
       
   487 void SessionTab::newState(QNetworkSession::State state)
       
   488 {
       
   489     QVariant identifier = m_NetworkSession->property("ActiveConfiguration");
       
   490     if (state == QNetworkSession::Connected && !identifier.isNull()) {
       
   491         QString configId = identifier.toString();
       
   492         QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId);
       
   493         if (config.isValid()) {
       
   494             iapLineEdit->setText(config.name()+" ("+config.identifier()+")");
       
   495             bearerLineEdit->setText(config.bearerName());
       
   496         }
       
   497     } else {
       
   498         bearerLineEdit->setText(m_NetworkSession->configuration().bearerName());
       
   499     }
       
   500 
       
   501     QString active;
       
   502     if (m_NetworkSession->isOpen()) {
       
   503         active = " (O)";
       
   504     }
       
   505     stateLineEdit->setText(stateString(state)+active);
       
   506 }
       
   507 
       
   508 void SessionTab::error(QNetworkSession::SessionError error)
       
   509 {
       
   510     QListWidgetItem* listItem = new QListWidgetItem();
       
   511     QMessageBox msgBox;
       
   512     msgBox.setStandardButtons(QMessageBox::Close);
       
   513     
       
   514     QString errorString;
       
   515     switch (error)
       
   516     {
       
   517         case QNetworkSession::UnknownSessionError:
       
   518             errorString = "UnknownSessionError";
       
   519             break;
       
   520         case QNetworkSession::SessionAbortedError:
       
   521             errorString = "SessionAbortedError";
       
   522             break;
       
   523         case QNetworkSession::RoamingError:
       
   524             errorString = "RoamingError";
       
   525             break;
       
   526         case QNetworkSession::OperationNotSupportedError:
       
   527             errorString = "OperationNotSupportedError";
       
   528             break;
       
   529         case QNetworkSession::InvalidConfigurationError:
       
   530             errorString = "InvalidConfigurationError";
       
   531             break;
       
   532     }
       
   533     listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+errorString);
       
   534     m_eventListWidget->addItem(listItem);
       
   535     
       
   536     msgBox.setText(errorString);
       
   537     msgBox.exec();
       
   538 }
       
   539 
       
   540 void SessionTab::done(bool error)
       
   541 {
       
   542     m_httpRequestOngoing = false;
       
   543 
       
   544     QMessageBox msgBox;
       
   545     msgBox.setStandardButtons(QMessageBox::Close);
       
   546     if (error) {
       
   547         msgBox.setText("HTTP request failed.");
       
   548     } else {
       
   549         QString result(m_http->readAll());
       
   550         msgBox.setText(QString("HTTP request finished successfully.\nReceived ")+QString::number(result.length())+QString(" bytes."));
       
   551     }
       
   552     msgBox.exec();
       
   553     
       
   554     sentRecDataLineEdit->setText(QString::number(m_NetworkSession->bytesWritten())+
       
   555                                  QString(" / ")+
       
   556                                  QString::number(m_NetworkSession->bytesReceived()));
       
   557 }
       
   558 
       
   559 // End of file
       
   560