コード例 #1
0
ファイル: qdllink.cpp プロジェクト: muromec/qtopia-ezx
/*!
    Constructs a QDLLink from the data in \a dataObject
*/
QDLLink::QDLLink( const QDSData& dataObject )
:   d( 0 )
{
    d = new QDLLinkPrivate();
    if ( dataObject.type().id() == mimeType().id() ) {
        QByteArray array = dataObject.data();
        {
            QDataStream ds( &array, QIODevice::ReadOnly );
            ds >> *this;
        }
    }
コード例 #2
0
ファイル: qdsactionrequest.cpp プロジェクト: Camelek/qtmoko
/*!
    Constructs an action request for a service with \a requestData. The service
    responding to the request is provided in \a serviceInfo and the channel
    for responding to the client is provided in \a channel. \a auxiliary data
    can also be attached to the request. The request is attached to \a parent.
*/
QDSActionRequest::QDSActionRequest( const QDSServiceInfo& serviceInfo,
                                    const QDSData& requestData,
                                    const QString& channel,
                                    const QByteArray& auxiliary,
                                    QObject* parent )
:   QObject( parent ),
    d( 0 )
{
    d = new QDSActionRequestPrivate( serviceInfo, requestData, auxiliary, channel );

    if ( !d->mServiceInfo.supportsRequestDataType( requestData.type() ) )
        respond( QString( tr( "request contained unexpected data" ) ) );
}
コード例 #3
0
ファイル: qdsactionrequest.cpp プロジェクト: Camelek/qtmoko
/*!
    Sends \a responseData back to the client to indicate that the request has
    been processed correctly. This method is to be used for services which
    have response data.

    Returns false if a response has already been sent or the service doesn't require
    response data; otherwise returns true.
*/
bool QDSActionRequest::respond( const QDSData &responseData )
{
    if ( d->mComplete )
        return false;

    if ( !d->mServiceInfo.supportsResponseDataType( responseData.type() ) )
        return false;

    d->mResponseData = responseData;
    d->mComplete = true;
    d->emitResponse();

    return true;
}