qtmobility/tests/bearerex/bearerex.cpp
changeset 11 06b8e2af4411
parent 0 cfcbf08528c4
child 14 6fbed849b4f4
equal deleted inserted replaced
8:71781823f776 11:06b8e2af4411
     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 **
   297     stateLineEdit->setFocusPolicy(Qt::NoFocus);
   297     stateLineEdit->setFocusPolicy(Qt::NoFocus);
   298 }
   298 }
   299 
   299 
   300 SessionTab::~SessionTab()
   300 SessionTab::~SessionTab()
   301 {
   301 {
       
   302     // Need to be nulled, because modal dialogs may return after destruction of this object and
       
   303     // use already released resources.
   302     delete m_NetworkSession;
   304     delete m_NetworkSession;
       
   305     m_NetworkSession = NULL;
   303     delete m_http;
   306     delete m_http;
       
   307     m_http = NULL;
   304 }
   308 }
   305 
   309 
   306 void SessionTab::on_createQHttpButton_clicked()
   310 void SessionTab::on_createQHttpButton_clicked()
   307 {
   311 {
   308     if (m_httpRequestOngoing) {
   312     if (m_httpRequestOngoing) {
   548     } else {
   552     } else {
   549         QString result(m_http->readAll());
   553         QString result(m_http->readAll());
   550         msgBox.setText(QString("HTTP request finished successfully.\nReceived ")+QString::number(result.length())+QString(" bytes."));
   554         msgBox.setText(QString("HTTP request finished successfully.\nReceived ")+QString::number(result.length())+QString(" bytes."));
   551     }
   555     }
   552     msgBox.exec();
   556     msgBox.exec();
   553     
   557     // Check if the networksession still exists - it may have gone after returning from
   554     sentRecDataLineEdit->setText(QString::number(m_NetworkSession->bytesWritten())+
   558     // the modal dialog (in the case that app has been closed, and deleting QHttp will
   555                                  QString(" / ")+
   559     // trigger the done() invokation).
   556                                  QString::number(m_NetworkSession->bytesReceived()));
   560     if (m_NetworkSession) {
       
   561         sentRecDataLineEdit->setText(QString::number(m_NetworkSession->bytesWritten())+
       
   562                                      QString(" / ")+
       
   563                                      QString::number(m_NetworkSession->bytesReceived()));
       
   564     } else {
       
   565         sentRecDataLineEdit->setText("Data amounts not available.");
       
   566     }
   557 }
   567 }
   558 
   568 
   559 // End of file
   569 // End of file
   560 
   570