52 |
kio_kmdProtocol::kio_kmdProtocol(const QCString &pool_socket, const QCString &app_socket) |
kio_kmdProtocol::kio_kmdProtocol(const QCString &pool_socket, const QCString &app_socket) |
53 |
: QObject(), SlaveBase("kio_kmd", pool_socket, app_socket) |
: QObject(), SlaveBase("kio_kmd", pool_socket, app_socket) |
54 |
{ |
{ |
55 |
kdDebug() << "kio_kmdProtocol::kio_kmdProtocol()" << endl; |
//kdDebug() << "kio_kmdProtocol::kio_kmdProtocol()" << endl; |
56 |
} |
} |
57 |
/* ---------------------------------------------------------------------------------- */ |
/* ---------------------------------------------------------------------------------- */ |
58 |
|
|
67 |
{ |
{ |
68 |
isFinished = 0; |
isFinished = 0; |
69 |
|
|
70 |
kdDebug() << "kio_urn::get(const KURL& url)" << endl ; |
//kdDebug() << "kio_urn::get(const KURL& url)" << endl ; |
71 |
|
|
72 |
kdDebug() << "myURL: " << url.prettyURL() << endl; |
//kdDebug() << "myURL: " << url.prettyURL() << endl; |
73 |
|
|
74 |
if(url.prettyURL() == "kmd:wait") { mimeType("text/html"); finished(); return; } |
if(url.prettyURL() == "kmd:wait") { mimeType("text/html"); finished(); return; } |
75 |
|
|
76 |
mimeType("text/html"); |
mimeType("text/html"); |
77 |
|
|
78 |
kdDebug() << "0" << endl; |
//kdDebug() << "0" << endl; |
79 |
http = new QHttp(); |
http = new QHttp(); |
80 |
connect(http, SIGNAL(stateChanged(int)), |
connect(http, SIGNAL(stateChanged(int)), |
81 |
this, SLOT(slotStateChanged(int))); |
this, SLOT(slotStateChanged(int))); |
82 |
kdDebug() << "1" << endl; |
//kdDebug() << "1" << endl; |
83 |
connect(http, SIGNAL(readyRead(const QHttpResponseHeader &)), |
connect(http, SIGNAL(readyRead(const QHttpResponseHeader &)), |
84 |
this, SLOT(slotReadyRead())); |
this, SLOT(slotReadyRead())); |
85 |
connect(http, SIGNAL(requestFinished(int, bool)), |
connect(http, SIGNAL(requestFinished(int, bool)), |
86 |
this, SLOT(slotRequestFinished(int))); |
this, SLOT(slotRequestFinished(int))); |
87 |
kdDebug() << "2" << endl; |
//kdDebug() << "2" << endl; |
88 |
http->setHost("fishy.it.jyu.fi", 5555); |
http->setHost("fishy.it.jyu.fi", 5555); |
89 |
requestNr = http->get(url.prettyURL()); |
requestNr = http->get(url.prettyURL()); |
90 |
kdDebug() << "request id: " << requestNr << endl; |
//kdDebug() << "request id: " << requestNr << endl; |
91 |
while(!isFinished) { |
while(!isFinished) { |
92 |
//kdDebug() << "process events" << endl; |
////kdDebug() << "process events" << endl; |
93 |
app->processEvents(); |
app->processEvents(); |
94 |
} |
} |
95 |
kdDebug() << "done" << endl; |
//kdDebug() << "done" << endl; |
96 |
finished(); |
finished(); |
97 |
} |
} |
98 |
|
|
106 |
/* --------------------------------------------------------------------------- */ |
/* --------------------------------------------------------------------------- */ |
107 |
void kio_kmdProtocol::slotStateChanged(int state) |
void kio_kmdProtocol::slotStateChanged(int state) |
108 |
{ |
{ |
109 |
kdDebug() << "kio_urn -> state " << state << endl; |
//kdDebug() << "kio_urn -> state " << state << endl; |
110 |
} |
} |
111 |
|
|
112 |
void kio_kmdProtocol::slotReadyRead() |
void kio_kmdProtocol::slotReadyRead() |
113 |
{ |
{ |
114 |
kdDebug() << "kio_urn -> data received" << endl; |
//kdDebug() << "kio_urn -> data received" << endl; |
115 |
if(http->bytesAvailable() > 0) |
if(http->bytesAvailable() > 0) |
116 |
data(http->readAll()); |
data(http->readAll()); |
117 |
} |
} |
120 |
{ |
{ |
121 |
if(req == requestNr) |
if(req == requestNr) |
122 |
isFinished = true; |
isFinished = true; |
123 |
kdDebug() << "kio_urn -> reqfinished " << req << endl; |
//kdDebug() << "kio_urn -> reqfinished " << req << endl; |
124 |
} |
} |