Changeset 52:ea42773ea6c5 in SMSSender


Ignore:
Timestamp:
Jan 30, 2010 12:11:02 PM (8 years ago)
Author:
Sämy Zehnder <saemy.zehnder@…>
Branch:
3.0
Convert:
svn:3639001d-8e34-449c-bb86-3782b86c4877/branches/3.0@51
Message:
  • New request-waitfor-block-method
Location:
lib/libgateway/src/business
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lib/libgateway/src/business/HttpHelper.cpp

    r51 r52  
    44#include <QDebug>
    55#include <QSslError>
     6#include <QThread>
    67#include <QUrl>
    78
     
    8586
    8687    /* Create the request record */
    87     request_.method = method;
    88     request_.posts  = getParamStr(posts);
     88    request_.finished = false;
     89    request_.method   = method;
     90    request_.posts    = getParamStr(posts);
    8991
    9092    /* Do the request */
     
    149151    }
    150152
     153    qDebug() << "Waiting for the request to finish...";
     154    while (!request_.finished && thread()->isRunning()) {
     155        thread()->wait(100);
     156    }
     157    qDebug() << "The request finished -> continuing";
     158/*    while (!request_.finished) {
     159        qApp->processEvents(QEventLoop::WaitForMore | QEventLoop::ExcludeUserInput);
     160    }
    151161    qDebug() << "Starting request loop";
    152162    requestLoop_.exec();
    153     qDebug() << "Request loop quitted";
     163    qDebug() << "Request loop quitted";*/
    154164}
    155165
     
    196206     qDebug() << "Quitting request loop";
    197207     requestLoop_.quit();
     208     request_.finished = true;
    198209
    199210     if (error) {
  • lib/libgateway/src/business/HttpHelper.h

    r41 r52  
    1919#include <QHttpResponseHeader>
    2020
    21 class HttpRequest {
     21class HttpRequest: public QObject {
     22    Q_OBJECT
     23
    2224public:
    2325    int     httpRequestId;
     
    2729
    2830    QBuffer buffer;
     31
     32    bool    finished;
    2933};
    3034
Note: See TracChangeset for help on using the changeset viewer.