idlehomescreen/xmluicontroller/src/emptycontenttransactionelement.cpp
branchRCL_3
changeset 26 1b758917cafc
parent 18 d05a55b217df
equal deleted inserted replaced
25:137ebc85284b 26:1b758917cafc
    71     {
    71     {
    72     CXnType* type = Target().Type();
    72     CXnType* type = Target().Type();
    73 
    73 
    74     if ( type->Type() == XnImageInterface::MXnImageInterface::Type() )
    74     if ( type->Type() == XnImageInterface::MXnImageInterface::Type() )
    75         {
    75         {
    76         MXnImageInterface* imageIntr = NULL;
    76         MXnImageInterface* image( NULL );
    77         if ( !XnComponentInterface::MakeInterfaceL( imageIntr, Target() ) )
    77         XnComponentInterface::MakeInterfaceL( image, Target() );
    78             {
    78 
    79             User::Leave( KErrNotSupported );
    79         LeaveIfNull( image, KErrNotSupported );
    80             }
    80         
    81         // Clears the bitmaps from component
    81         // Clears the bitmaps from component
    82         imageIntr->SetContentBitmaps( NULL, NULL );
    82         image->SetContentBitmaps( NULL, NULL );
    83         }
    83         }
    84     else if ( type->Type() == XnTextInterface::MXnTextInterface::Type() ) // text element
    84     else if ( type->Type() == XnTextInterface::MXnTextInterface::Type() ) // text element
    85         {
    85         {
    86         // Get control interface
    86         // Get control interface
    87         XnTextInterface::MXnTextInterface* textControl = NULL;
    87         XnTextInterface::MXnTextInterface* text( NULL );
    88         XnComponentInterface::MakeInterfaceL( textControl, Target() );
    88         XnComponentInterface::MakeInterfaceL( text, Target() );
    89         LeaveIfNull( textControl, KErrNotSupported );
    89         
       
    90         LeaveIfNull( text, KErrNotSupported );
    90         
    91         
    91         // Clears the text from component
    92         // Clears the text from component
    92         textControl->SetTextL( KNullDesC );
    93         text->SetTextL( KNullDesC );
    93         }
    94         }
    94     else if ( type->Type() == XnTextEditorInterface::MXnTextEditorInterface::Type() ) // texteditor element
    95     else if ( type->Type() == XnTextEditorInterface::MXnTextEditorInterface::Type() ) // texteditor element
    95         {
    96         {
    96         // Get control interface
    97         // Get control interface
    97         XnTextEditorInterface::MXnTextEditorInterface* editorControl = NULL;
    98         XnTextEditorInterface::MXnTextEditorInterface* editor( NULL );
    98         XnComponentInterface::MakeInterfaceL( editorControl, Target() );
    99         XnComponentInterface::MakeInterfaceL( editor, Target() );
    99         LeaveIfNull( editorControl, KErrNotSupported );
   100         
       
   101         LeaveIfNull( editor, KErrNotSupported );
   100         
   102         
   101         // Clears the text from component
   103         // Clears the text from component
   102         editorControl->SetTextL( KNullDesC );
   104         editor->SetTextL( KNullDesC );
   103         }
   105         }
   104     else
   106     else
   105         {
   107         {
   106         CXnNodeAppIf* parent = Target().ParentL();
   108         CXnNodeAppIf* parent( Target().ParentL() );
   107         LeaveIfNull( parent, KErrNotSupported );
   109         LeaveIfNull( parent, KErrNotSupported );
   108         const TDesC8& type = LeaveIfNull( parent->Type(), KErrNotSupported )->Type();
   110         
       
   111         const TDesC8& parentType( parent->Type()->Type() );
   109             
   112             
   110         if ( type == XnNewstickerInterface::MXnNewstickerInterface::Type() )
   113         if ( parentType == XnNewstickerInterface::MXnNewstickerInterface::Type() )
   111             {
   114             {
   112             XnNewstickerInterface::MXnNewstickerInterface* newsticker = NULL;
   115             XnNewstickerInterface::MXnNewstickerInterface* newsticker( NULL );
   113             XnComponentInterface::MakeInterfaceL( newsticker, *parent );
   116             XnComponentInterface::MakeInterfaceL( newsticker, *parent );
   114             LeaveIfNull( newsticker, KErrGeneral );
   117             
   115             TInt titleIndexVal = -1;
   118             LeaveIfNull( newsticker, KErrNotSupported );
   116             CXnProperty* titleIndex = Target().GetPropertyL( XnPropertyNames::title::KTitleIndex );
   119             
   117             if ( titleIndex )
   120             CXnProperty* prop( Target().GetPropertyL( 
   118                 {
   121                 XnPropertyNames::title::KTitleIndex ) );
   119                 TLex8 lex( titleIndex->StringValue() );
   122     
   120                 TInt err = lex.Val( titleIndexVal );
   123             LeaveIfNull( prop, KErrNotSupported );
   121                 if ( err == KErrNone && titleIndexVal > -1 )
   124 
   122                     {
   125             TInt index( KErrNotFound );
   123                     newsticker->DeleteTitle( titleIndexVal );
   126             
   124                     }
   127             TLex8 lex( prop->StringValue() );
   125                 }
   128             lex.Val( index );
       
   129             
       
   130             newsticker->DeleteTitle( index );
   126             }
   131             }
   127         }
   132         }
       
   133     
   128     // Clear current content priority
   134     // Clear current content priority
   129     ClearContentPriorityL();
   135     ClearContentPriorityL();
   130     }
   136     }
       
   137 
       
   138 // End of file