textinput/peninputhwrtrui/src/truiinfomessageview.cpp
changeset 40 2cb9bae34d17
parent 31 f1bdd6b078d1
child 49 37f5d84451bd
equal deleted inserted replaced
31:f1bdd6b078d1 40:2cb9bae34d17
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implement of class CTruiShortcutEditTextView
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <avkon.hrh>
       
    20 #include <trui.rsg>
       
    21 #include <eikcolib.h>
       
    22 #include <akntoolbar.h>
       
    23 
       
    24 #include "truiinfomessageview.h"
       
    25 #include "truiappui.h"
       
    26 #include "truiinfomessagecontainer.h"
       
    27 #include "truishortcutedittextview.h"
       
    28 #include "truishortcutsview.h"
       
    29 #include "truiengine.h"
       
    30 
       
    31 // ======== MEMBER FUNCTIONS ========
       
    32 
       
    33 CTruiInfoMessageView::CTruiInfoMessageView()
       
    34     {
       
    35     }
       
    36     
       
    37 void CTruiInfoMessageView::ConstructL()
       
    38     {
       
    39     BaseConstructL( R_TRUI_INFOMESSAGEVIEW );
       
    40     }    
       
    41     
       
    42 CTruiInfoMessageView* CTruiInfoMessageView::NewL()
       
    43     {
       
    44     CTruiInfoMessageView* self = CTruiInfoMessageView::NewLC();
       
    45     CleanupStack::Pop( self );
       
    46     return self;
       
    47     }
       
    48     
       
    49 CTruiInfoMessageView* CTruiInfoMessageView::NewLC()
       
    50     {
       
    51     CTruiInfoMessageView* self = new( ELeave ) CTruiInfoMessageView;
       
    52     CleanupStack::PushL( self );
       
    53     self->ConstructL();
       
    54     return self;
       
    55     }
       
    56     
       
    57 CTruiInfoMessageView::~CTruiInfoMessageView()
       
    58     {
       
    59     }
       
    60     
       
    61 // ---------------------------------------------------------------------------
       
    62 // From class CAknView.
       
    63 // Returns views id.
       
    64 // ---------------------------------------------------------------------------
       
    65 //
       
    66 TUid CTruiInfoMessageView::Id() const
       
    67     {
       
    68     return KTruiInfoMessageViewId;    
       
    69     }
       
    70     
       
    71 // ---------------------------------------------------------------------------
       
    72 // From class CAknView.
       
    73 // Command handling function.
       
    74 // ---------------------------------------------------------------------------
       
    75 //
       
    76 void CTruiInfoMessageView::HandleCommandL( TInt aCommand )
       
    77     {
       
    78     CTruiAppUi* appui = static_cast<CTruiAppUi*>( AppUi() );
       
    79     switch ( aCommand )
       
    80         {
       
    81         case EAknSoftkeyNext:
       
    82             {
       
    83             appui->HwrEngine()->SetShortcut( KNullDesC );
       
    84             iContainer->PrepareToExitL();
       
    85             appui->ActivateLocalViewL( KTruiShortcutEditTextViewId );
       
    86             break;
       
    87             }            
       
    88         case EAknSoftkeyCancel:
       
    89             {
       
    90             appui->ActivateLocalViewL( KTruiShortcutsViewId );
       
    91             break;            
       
    92             }
       
    93         }
       
    94     }
       
    95     
       
    96 // ---------------------------------------------------------------------------
       
    97 // From class CAknView.
       
    98 // Carried out when View is activated
       
    99 // ---------------------------------------------------------------------------
       
   100 //
       
   101 void CTruiInfoMessageView::DoActivateL( const TVwsViewId& /*aPrevViewId*/,
       
   102                   TUid /*aCustomMessageId*/,
       
   103                   const TDesC8& /*aCustomMessage*/ )
       
   104 	{
       
   105     CTruiAppUi* appui = static_cast<CTruiAppUi*>( AppUi() );
       
   106     // Set title pane
       
   107     HBufC* titleText = iEikonEnv->AllocReadResourceLC
       
   108                                 ( R_TRUI_INFOMESSAGEVIEW_TITLEPANE_TEXT );
       
   109     appui->ShowTitlePaneL( *titleText );
       
   110     CleanupStack::PopAndDestroy( titleText );
       
   111     
       
   112     // Close navi pane
       
   113     appui->CloseNaviPaneL();
       
   114 	
       
   115 	// Create container        
       
   116     iContainer = CTruiInfoMessageContainer::NewL( ClientRect() );
       
   117     iContainer->SetMopParent( this );
       
   118     iContainer->SetView( this );
       
   119     AppUi()->AddToStackL( *this, iContainer );
       
   120 	}
       
   121 
       
   122 // ---------------------------------------------------------------------------
       
   123 // From class CAknView.
       
   124 // Carried out when View is deactivated
       
   125 // ---------------------------------------------------------------------------
       
   126 //
       
   127 void CTruiInfoMessageView::DoDeactivate()
       
   128     {
       
   129     if ( iContainer )
       
   130         {
       
   131         AppUi()->RemoveFromStack( iContainer );
       
   132         delete iContainer;
       
   133         iContainer = NULL;
       
   134         }
       
   135     }