summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordeva <deva>2009-11-12 12:25:28 +0000
committerdeva <deva>2009-11-12 12:25:28 +0000
commit90fe99277f0300eb7f0b80545d6a21f94198d45f (patch)
tree5fa0d5e16a3aae2c20e334921a10b955d3811c49
parentef8ca720c38d91e9892eb3ed85f4b7d459d43b83 (diff)
Improved (fixed) http communication.
-rw-r--r--client/netcom.cc16
-rw-r--r--client/netcom.h4
2 files changed, 15 insertions, 5 deletions
diff --git a/client/netcom.cc b/client/netcom.cc
index 5cbcd22..be240e2 100644
--- a/client/netcom.cc
+++ b/client/netcom.cc
@@ -51,7 +51,9 @@ NetCom::NetCom(QString host, quint16 port, QString user, QString cpr)
this->user = user;
this->cpr = cpr;
- connect(&http, SIGNAL(done(bool)), this, SLOT(done(bool)));
+ connect(&http, SIGNAL(readyRead(const QHttpResponseHeader &)),
+ this, SLOT(readyRead(const QHttpResponseHeader &)));
+ connect(&http, SIGNAL(stateChanged(int)), this, SLOT(stateChanged(int)));
#ifdef USE_SSL
connect(&http, SIGNAL(sslErrors(const QList<QSslError> &)),
@@ -161,10 +163,16 @@ void NetCom::send(QVector< Widget* > widgets, QString templ, QString macro, QStr
if(qApp->activeWindow()) qApp->activeWindow()->setEnabled(true);
}
-void NetCom::done(bool)
+void NetCom::readyRead(const QHttpResponseHeader &)
{
- buffer = http.readAll();
- transfering = false;
+ // printf("STATE: readyRead\n");
+ buffer += http.readAll();
+}
+
+void NetCom::stateChanged(int state)
+{
+ // printf("STATE: %d\n", state);
+ if(transfering && state == QHttp::Connected) transfering = false;
}
#ifdef USE_SSL
diff --git a/client/netcom.h b/client/netcom.h
index c40f85c..f1a8766 100644
--- a/client/netcom.h
+++ b/client/netcom.h
@@ -48,7 +48,9 @@ public:
void send(QVector< Widget* > widgets, QString templ, QString macro, QString version);
public slots:
- void done(bool);
+ void stateChanged(int state);
+ void readyRead(const QHttpResponseHeader &resp);
+
#ifdef USE_SSL
void sslError(const QList<QSslError> &errlst);
#endif