[Konversation-devel] [Bug 207857] Build failure in UPnP code with KDE 4.1 / Qt 4.4
Michael Kreitzer
mrgrim at gr1m.org
Thu Jul 1 16:19:28 CEST 2010
https://bugs.kde.org/show_bug.cgi?id=207857
--- Comment #6 from Michael Kreitzer <mrgrim gr1m org> 2010-07-01 16:19:26 ---
commit 979fa6ab9b5236eb7a81399867bf6769cded919c
Author: Michael Kreitzer <mrgrim at gr1m.org>
Date: Sun Sep 20 19:45:09 2009 +0000
Use KIO::http_post instead of KIO::storedHttpPost to restore KDE 4.1
compatability.
BUG: 207857
svn path=/trunk/extragear/network/konversation/; revision=1026112
diff --git a/src/upnp/upnprouter.cpp b/src/upnp/upnprouter.cpp
index 4a8b5d6..cf247d5 100644
--- a/src/upnp/upnprouter.cpp
+++ b/src/upnp/upnprouter.cpp
@@ -21,6 +21,7 @@
#include <KLocale>
#include <KIO/Job>
#include <KIO/NetAccess>
+#include <kio/jobclasses.h>
#include <stdlib.h>
@@ -310,8 +311,6 @@ namespace Konversation
if (location.port()<=0)
location.setPort(80);
- QByteArray data = query.toAscii();
-
KUrl address;
address.setProtocol(QString("http"));
@@ -319,16 +318,34 @@ namespace Konversation
address.setPort(location.port());
address.setPath(controlurl);
- KIO::TransferJob *req = KIO::storedHttpPost( data, address,
KIO::HideProgressInfo );
+ KIO::TransferJob *req = KIO::http_post( address, query.toAscii(),
KIO::HideProgressInfo );
+
req->addMetaData("content-type", QString("text/xml"));
req->addMetaData("UserAgent", QString("Konversation UPnP"));
req->addMetaData("customHTTPHeader", QString("SOAPAction: ") +
soapact);
- connect(req,SIGNAL(result(KJob *)),this,SLOT(onRequestFinished(
KJob* )));
+ soap_data_out[req] = QByteArray();
+ soap_data_in[req] = QByteArray();
+
+ connect( req, SIGNAL(data( KIO::Job *, const QByteArray & )),
this, SLOT(recvSoapData( KIO::Job*, const QByteArray & )) );
+ connect( req, SIGNAL(dataReq( KIO::Job *, QByteArray & )), this,
SLOT(sendSoapData( KIO::Job*, QByteArray & )) );
+
+ connect( req, SIGNAL(result(KJob *)), this,
SLOT(onRequestFinished( KJob* )) );
return req;
}
+ void UPnPRouter::sendSoapData(KIO::Job *job, QByteArray &data)
+ {
+ data.append(soap_data_out[job]);
+ soap_data_out[job].clear();
+ }
+
+ void UPnPRouter::recvSoapData(KIO::Job *job, const QByteArray &data)
+ {
+ soap_data_in[job].append(data);
+ }
+
void UPnPRouter::onRequestFinished(KJob *r)
{
if (r->error())
@@ -356,8 +373,8 @@ namespace Konversation
}
else
{
- KIO::StoredTransferJob* st = (KIO::StoredTransferJob*)r;
- QString reply(st->data());
+ QString reply(soap_data_in[r]);
+ soap_data_in[r].clear();
kDebug() << "UPnPRouter : OK:" << endl;
@@ -388,6 +405,9 @@ namespace Konversation
pending_unforwards.remove(r);
}
}
+
+ soap_data_in.remove(r);
+ soap_data_out.remove(r);
}
}
}
diff --git a/src/upnp/upnprouter.h b/src/upnp/upnprouter.h
index 82b9e05..70b5312 100644
--- a/src/upnp/upnprouter.h
+++ b/src/upnp/upnprouter.h
@@ -17,6 +17,7 @@
#include <kurl.h>
#include <kjob.h>
+#include <kio/jobclasses.h>
namespace Konversation
{
@@ -110,6 +111,9 @@ namespace Konversation
QHash<KJob*, Forwarding*> pending_forwards;
QHash<KJob*, Forwarding*> pending_unforwards;
+ QHash<KJob*, QByteArray> soap_data_in;
+ QHash<KJob*, QByteArray> soap_data_out;
+
QString error;
public:
@@ -170,9 +174,10 @@ namespace Konversation
private slots:
void onRequestFinished(KJob *reply);
void downloadFinished(KJob* j);
-
-
-
+
+ void sendSoapData(KIO::Job *job, QByteArray &data);
+ void recvSoapData(KIO::Job *job, const QByteArray &data);
+
signals:
/**
* Signal which indicates that the XML was downloaded successfully
or not.
--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the Konversation-devel
mailing list