Bug 207857 - Build failure in UPnP code with KDE 4.1 / Qt 4.4
Summary: Build failure in UPnP code with KDE 4.1 / Qt 4.4
Status: RESOLVED FIXED
Alias: None
Product: konversation
Classification: Applications
Component: upnp (show other bugs)
Version: Git
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Michael Kreitzer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-19 07:30 UTC by Eike Hein
Modified: 2010-07-01 16:19 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eike Hein 2009-09-19 07:30:33 UTC
Build error log:

[ 21%] Building CXX object src/CMakeFiles/konversation.dir/upnp/upnprouter.o
/home/sho/kdevel/4/src/konversation/src/upnp/upnprouter.cpp: In member function ‘KJob* Konversation::UPnP::UPnPRouter::sendSoapQuery(const QString&, const QString&, const QString&)’:
/home/sho/kdevel/4/src/konversation/src/upnp/upnprouter.cpp:322: error: ‘storedHttpPost’ is not a member of ‘KIO’
make[2]: *** [src/CMakeFiles/konversation.dir/upnp/upnprouter.o] Error 1
make[1]: *** [src/CMakeFiles/konversation.dir/all] Error 2
make: *** [all] Error 2
Comment 1 FiNeX 2009-09-20 15:44:15 UTC
I think you should update to a newer revision and use Qt 4.5.
Comment 2 FiNeX 2009-09-20 15:45:31 UTC
I mean that Qt 4.4 and KDE 4.1 are quite old (looking at the evolution on this last year) :-)
Comment 3 Eike Hein 2009-09-20 18:00:27 UTC
FiNeX, I appreciate your enthusiasm, but I'm the maintainer of the app, and we happen to support KDE 4.1 and Qt 4.4 -- I know what I'm doing when I file a report.
Comment 4 FiNeX 2009-09-20 18:45:13 UTC
Ok, don't worry :-)
Comment 5 Michael Kreitzer 2009-09-20 21:45:14 UTC
SVN commit 1026112 by mkreitzer:

Use KIO::http_post instead of KIO::storedHttpPost to restore KDE 4.1 compatability.

BUG: 207857



 M  +26 -6     upnprouter.cpp  
 M  +8 -3      upnprouter.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1026112
Comment 6 Michael Kreitzer 2010-07-01 16:19:26 UTC
commit 979fa6ab9b5236eb7a81399867bf6769cded919c
Author: Michael Kreitzer <mrgrim@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.