void DCOPDispatcher::endTransaction( DCOPClientTransaction *_transaction, QCString &replyType, QByteArray &replyData )
{
    InternalDCOPClientTransaction *transaction = (InternalDCOPClientTransaction *)_transaction;

    assert( m_transactions.findRef( transaction ) != -1 );

    QByteArray reply;
#ifndef QT_NO_DATASTREAM
    QDataStream replyStream( reply, IO_WriteOnly );
    replyStream << replyType << replyData;
#endif

    transaction->m_client->m_connection->send( 0, reply );

    m_transactions.removeRef( transaction );
}
void DCOPDispatcher::dispatchClient( Client *client )
{
    int cmd;
    QByteArray data;
    int res = client->m_connection->read( &cmd, data );

    if ( res == -1 )
    {
        kdDebug() << "error reading from dcop client!" << endl;
        // ### FIXME
        disconnectClient( client->m_owner );
        return;
    }

    Client *oldClient = s_currentClient;
    s_currentClient = client;
    bool oldTransactionAdded = m_transactionAdded;
    m_transactionAdded = false;

    QCString remApp, remObj, remFun;
    QByteArray callData;
#ifndef QT_NO_DATASTREAM
    QDataStream stream(data, IO_ReadOnly);

    stream >> remApp >> remObj >> remFun >> callData;
#endif
    QCString replyType;
    QByteArray replyData;

    // ### return value!
    process( remObj, remFun, callData, replyType, replyData );

    if ( cmd == DCOPClient::Call && !m_transactionAdded )
    {
        // send back reply

        QByteArray reply;
#ifndef QT_NO_DATASTREAM
        QDataStream replyStream( reply, IO_WriteOnly );
        replyStream << replyType << replyData;
#endif
        client->m_connection->send( 0, reply );
    }

    s_currentClient = oldClient;
    m_transactionAdded = oldTransactionAdded;
}
Esempio n. 3
0
QString FeedIconManager::iconLocation(const KURL &url) const
{
    QByteArray data, reply;
    QCString replyType;
    QDataStream ds(data, IO_WriteOnly);

    ds << url;

    kapp->dcopClient()->call("kded", "favicons", "iconForURL(KURL)", data,
                             replyType, reply);

    if(replyType == "QString")
    {
        QDataStream replyStream(reply, IO_ReadOnly);
        QString result;
        replyStream >> result;
        return result;
    }