Ejemplo n.º 1
0
void SignalTransition::connectTriggered()
{
    if (!m_complete || !m_cdata)
        return;

    QObject *target = senderObject();
    QQmlData *ddata = QQmlData::get(this);
    QQmlContextData *ctxtdata = ddata ? ddata->outerContext : 0;

    Q_ASSERT(m_bindings.count() == 1);
    const QV4::CompiledData::Binding *binding = m_bindings.at(0);
    Q_ASSERT(binding->type == QV4::CompiledData::Binding::Type_Script);

    QV4::ExecutionEngine *jsEngine = QV8Engine::getV4(QQmlEngine::contextForObject(this)->engine());
    QV4::Scope scope(jsEngine);
    QV4::Scoped<QV4::QObjectMethod> qobjectSignal(scope, QJSValuePrivate::convertedToValue(jsEngine, m_signal));
    Q_ASSERT(qobjectSignal);
    QMetaMethod metaMethod = target->metaObject()->method(qobjectSignal->methodIndex());
    int signalIndex = QMetaObjectPrivate::signalIndex(metaMethod);

    QQmlBoundSignalExpression *expression = ctxtdata ?
                new QQmlBoundSignalExpression(target, signalIndex,
                                              ctxtdata, this, m_cdata->compilationUnit->runtimeFunctions[binding->value.compiledScriptIndex]) : 0;
    if (expression)
        expression->setNotifyOnValueChanged(false);
    m_signalExpression = expression;
}
bool MaximizeToFocusTransition::eventTest(QEvent* event)
{
	if (!QSignalTransition::eventTest(event))
		return false;

	QStateMachine::SignalEvent* se = static_cast<QStateMachine::SignalEvent*>(event);
	CardWindow* win = se->arguments().at(0).value<CardWindow*>();
	CardWindowManager* wm = static_cast<CardWindowManager*>(senderObject());
	if (win == wm->activeWindow()) {
		// window is already focused
		SystemUiController::instance()->setCardWindowMaximized(true);
		return false;
	}

	return true;
}
Ejemplo n.º 3
0
int QSignalTransition::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QAbstractTransition::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    
#ifndef QT_NO_PROPERTIES
     if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QObject**>(_v) = senderObject(); break;
        case 1: *reinterpret_cast< QByteArray*>(_v) = signal(); break;
        }
        _id -= 2;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setSenderObject(*reinterpret_cast< QObject**>(_v)); break;
        case 1: setSignal(*reinterpret_cast< QByteArray*>(_v)); break;
        }
        _id -= 2;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 2;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
// ---------------------------------------------------------
// CDpMif::HandlePepCtrlReq
// Handles PepCtrlReq messages
// ---------------------------------------------------------
//
void CDpMif::HandlePepCtrlReq(
    TIsiReceiveC& aIsiMessage )
    {
    OstTrace0( TRACE_NORMAL, CDPMIF_HANDLEPEPCTRLREQ, "CDpMif::HandlePepCtrlReq" );
    LOGM(" CDpMif::HandlePepCtrlReq");

    // Transaction id
    TUint8 transactionId( aIsiMessage.Get8bit(
        ISI_HEADER_OFFSET_TRANSID ) );

    // Pipe Handle
    if ( PN_PIPE_INVALID_HANDLE == iPifDcs.PipeHandle() )
        {
        TUint8 pipeHandle( aIsiMessage.Get8bit(
            ISI_HEADER_SIZE + PNS_PEP_CTRL_REQ_OFFSET_PIPEHANDLE) );
        iPifDcs.SetPipeHandle( pipeHandle );
        }

    // PEP Type
    TUint8 pepType( aIsiMessage.Get8bit(
        ISI_HEADER_SIZE + PNS_PEP_CTRL_REQ_OFFSET_PEPTYPE ) );
    // PEP Control ID
    TUint8 ctrlId( aIsiMessage.Get8bit(
        ISI_HEADER_SIZE + PNS_PEP_CTRL_REQ_OFFSET_PEPCTRLID ) );
    // PEP Control Data
    TPtrC8 ctrlData;
    // Check if there is data (there is no data for all control id's)
    if ( ( ISI_HEADER_SIZE + SIZE_PNS_PEP_CTRL_REQ ) <=
         aIsiMessage.GetBuffer().Length() )
        {
        // Control Data length is 1 byte
        TInt ctrlDataLen( 1 );
        ctrlData.Set( aIsiMessage.GetData(
            ISI_HEADER_SIZE + PNS_PEP_CTRL_REQ_OFFSET_PEPCTRLDATA,
            ctrlDataLen ) );
        }
    // Get sender device
    TUint8 senderDevice( aIsiMessage.Get8bit(
        ISI_HEADER_OFFSET_SENDERDEVICE ) );
    // Get sender object
    TUint8 senderObject( aIsiMessage.Get8bit(
        ISI_HEADER_OFFSET_SENDEROBJECT ) );
#ifdef PIPECAMP_DATAPORT_PNS_PEP_STATUS_IND_PHONET_ADDRESS_FROM_PNS_PEP_CTRL_REQ
    iPifDcs.SetPipeControllerDeviceIdentifier( senderDevice );
    iPifDcs.SetPipeControllerObjectIdentifier( senderObject );
#endif
    // E32 return value
    TInt return_E32( KErrNone );
    // PN_PIPE return value
    TInt ret( KErrNone );

    switch ( pepType )
        {
        case PN_PEP_TYPE_COMM:
        case PN_PEP_TYPE_BT_ACC:
            {
            // comm_pep handles ctrl_req
            // Something can go wrong in here. Leaving is not the best case in here.
            // We can send an response message with error value to NOS side and
            // hope for the best.
            return_E32 = iCommPep.HandlePepCtrlReq( ctrlId, ctrlData );
            break;
            }

        default: // Not supported pepType
            {
            LOG1("  ERROR - Unsupported pep type: %d", pepType );
            OstTraceExt1( TRACE_NORMAL, DUP1_CDPMIF_HANDLEPEPCTRLREQ, "CDpMif:: ERROR - Unsupported pep type: %hhu", pepType );

            return_E32 = KErrArgument;
            break;
            }
        }

    // do mapping from E32 error codes => PN_PIPE error codes
    switch ( return_E32 )
        {
        case KErrNone:
            {
            ret = PN_PIPE_NO_ERROR;
            break;
            }
        case KErrNotSupported:
            {
            // this error code should NOT be used according to specification
            LOG("  ERROR - Unsupported config (KErrNotSupported)");
            OstTrace0( TRACE_NORMAL, DUP2_CDPMIF_HANDLEPEPCTRLREQ, "CDpMif:: ERROR - Unsupported config (KErrNotSupported)" );

            ret = PN_PIPE_ERR_NOT_SUPPORTED;
            break;
            }
        case KErrArgument:
            {
            // this error code should NOT be used according to specification
            LOG("  ERROR - Invalid argument (KErrArgument)");
            OstTrace0( TRACE_NORMAL, DUP3_CDPMIF_HANDLEPEPCTRLREQ, "CDpMif:: ERROR - Invalid argument (KErrArgument)" );

            ret = PN_PIPE_ERR_INVALID_PARAM;
            break;
            }
        case KErrGeneral:
            {
            LOG("  ERROR - Invalid parameter (KErrGeneral)");
            OstTrace0( TRACE_NORMAL, DUP4_CDPMIF_HANDLEPEPCTRLREQ, "CDpMif:: ERROR - Invalid parameter (KErrGeneral)" );

            ret = PN_PIPE_ERR_INVALID_CTRL_ID;
            break;
            }
        default:
            {
            // this error code should NOT be used according to specification
            LOG1("  ERROR - Other error: %d", return_E32 );
            OstTrace1( TRACE_NORMAL, DUP5_CDPMIF_HANDLEPEPCTRLREQ, "CDpMif:: ERROR - Other error: %d", return_E32 );

            ret = PN_PIPE_ERR_GENERAL;
            break;
            }
        }

    // Create PNS_PEP_CTRL_RESP response
    TBuf8<SIZE_PNS_PEP_CTRL_RESP> messageData;
    // Pipe Handle
    messageData.Append( iPifDcs.PipeHandle() );
    // PEP Control ID
    messageData.Append( ctrlId );
    // PEP Type
    messageData.Append( pepType );
    // Error Code
    messageData.Append( static_cast<TUint8>( ret  ) );
    // Filler bytes
    messageData.Append( KDpPadding );
    messageData.Append( KDpPadding );

    // Send message, respond to sender
    return_E32 = SendMessage(
        senderDevice,
        senderObject,
        PN_PIPE,
        transactionId,
        PNS_PEP_CTRL_RESP,
        messageData );

    LOG1("  <== PNS_PEP_CTRL_RESP resp sent, error code = %d", ret );
    OstTrace1( TRACE_NORMAL, DUP6_CDPMIF_HANDLEPEPCTRLREQ, "CDpMif:: <== PNS_PEP_CTRL_RESP resp sent, error code = %d", ret );

#if defined(_DEBUG)
    if (KErrNone != return_E32 )
        {
        LOG1("  Error isc api send %d", return_E32 );
        OstTrace1( TRACE_NORMAL, DUP7_CDPMIF_HANDLEPEPCTRLREQ, "CDpMif:: Error isc api send %d", return_E32 );
        }
    //no else
#endif

    }