// ============================================================================
// CCwrtRegistryServerSession::OpGetWebAttributeL()
// Returns the attribute value for the widget
//
// ============================================================================
//
TInt CCwrtRegistryServerSession::OpGetWebAttributeL( const RMessage2& aMessage )
    {
    TInt l = aMessage.GetDesMaxLength( 0 );
    HBufC8* msgData = HBufC8::NewLC( l );
    TPtr8 readPtr( msgData->Des() );
    aMessage.ReadL( 0, readPtr );
    RDesReadStream stream( *msgData );
    CleanupClosePushL( stream );
    QString appId = DeserializeStringL( stream );
    QString attribute = DeserializeStringL( stream );
    QString defaultValue = DeserializeStringL( stream );
    CleanupStack::PopAndDestroy( 2 ); //stream, msgData,

    QVariant attrValue =  WebAppRegistry::instance()->getAttribute( appId, attribute, QVariant( defaultValue ) );

    TInt maxLength = aMessage.GetDesMaxLength( 1 );
    CBufFlat* buf = CBufFlat::NewL( maxLength );
    CleanupStack::PushL( buf );
    RBufWriteStream wstream( *buf ); // stream over the buffer
    CleanupClosePushL( wstream );
    SerializeStringL( wstream, attrValue.toString() );
    CleanupStack::PopAndDestroy( &wstream );
    aMessage.WriteL( 1, buf->Ptr(0) );
    CleanupStack::PopAndDestroy( buf ); // buf

    return KErrNone;
    }
// ============================================================================
// CCwrtRegistryServerSession::OpRegisterWidgetL()
// Registers the widget
//
// ============================================================================
//
bool CCwrtRegistryServerSession::OpRegisterWidgetL(
    const RMessage2& aMessage )
    {
    // ARGS: 0 -> descriptor to buf of serialized property values
    TInt l = aMessage.GetDesMaxLength( 0 );
    HBufC8* msgData = HBufC8::NewLC( l );
    TPtr8 readPtr( msgData->Des() );
    aMessage.ReadL( 0, readPtr );
    RDesReadStream stream( *msgData );
    CleanupClosePushL( stream );

    QString appId = DeserializeStringL( stream );
    QString appTitle = DeserializeStringL( stream );
    QString appPath = DeserializeStringL( stream );
    QString iconPath = DeserializeStringL( stream );
    AttributeMap attrMap;
    DeserializeMapL( stream, attrMap );
    QString type = DeserializeStringL( stream );
    int size = DeserializeIntL( stream );
    QString startPath = DeserializeStringL( stream );

    CleanupStack::PopAndDestroy( 2 ); //stream, msgData,

    bool ret = WebAppRegistry::instance()->registerApp( appId, appTitle, appPath, iconPath,
                                                        attrMap, type, size, startPath);
    return ret;
    }
// ============================================================================
// CCwrtRegistryServerSession::OpSetWebAttributeL()
// Sets the attribute value for the widget
//
// ============================================================================
//
bool CCwrtRegistryServerSession::OpSetWebAttributeL( const RMessage2& aMessage )
    {
    TInt l = aMessage.GetDesMaxLength( 0 );
    HBufC8* msgData = HBufC8::NewLC( l );
    TPtr8 readPtr( msgData->Des() );
    aMessage.ReadL( 0, readPtr );
    RDesReadStream stream( *msgData );
    CleanupClosePushL( stream );
    QString appId = DeserializeStringL( stream );
    QString attribute = DeserializeStringL( stream );
    QString value = DeserializeStringL( stream );
    CleanupStack::PopAndDestroy( 2 ); //stream, msgData,

    bool ret = WebAppRegistry::instance()->setWebAppAttribute( appId, attribute, QVariant( value ) );

    return ret;
    }
// ============================================================================
// CCwrtRegistryServerSession::OpDeRegisterWidgetL()
// Deregisters the widget
//
// ============================================================================
//
bool CCwrtRegistryServerSession::OpDeRegisterWidgetL( const RMessage2& aMessage )
    {
    TInt l = aMessage.GetDesMaxLength( 0 );
    HBufC8* msgData = HBufC8::NewLC( l );
    TPtr8 readPtr( msgData->Des() );
    aMessage.ReadL( 0, readPtr );
    RDesReadStream stream( *msgData );
    CleanupClosePushL( stream );

    QString appId = DeserializeStringL( stream );
    int update = DeserializeIntL( stream );

    CleanupStack::PopAndDestroy( 2 ); //stream, msgData,

    bool ret = WebAppRegistry::instance()->unregister( appId, (bool)update );
    return ret;
    }
Ejemplo n.º 5
0
 CHPFKP_BX::CHPFKP_BX( const U8* ptr )
 {
     clear();
     readPtr( ptr );
 }