multimediacommsengine/tsrc/MCETestUI/src/CMCETestUIAppView.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2009 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include <eiklabel.h>
       
    22 #include <eikbctrl.h>
       
    23 #include <eiktxlbx.h>
       
    24 #include <eiktxlbm.h>
       
    25 #include <barsread.h>
       
    26 #include <coemain.h>
       
    27 #include <aknlists.h>
       
    28 #include <AknNoteWrappers.h>
       
    29 #include <eikgted.h>
       
    30 #include <avkon.hrh>
       
    31 #include "CMCETestUIAppView.h"
       
    32 //#include "FCAppUi.h"
       
    33 #include "MCETestUI.hrh"
       
    34 #include <MCETestUI.rsg>
       
    35 #include <eikrted.h>
       
    36 #include <aknviewappui.h>
       
    37 #include <aknglobalnote.h>
       
    38 #include <eikbtgpc.h>
       
    39 #include <akntitle.h>   // for CAknTitlePane
       
    40 
       
    41 //const TInt KMaxLineLength = 60; // Length of line in list
       
    42 //const TInt KGranularityOfArray = 6;
       
    43 
       
    44 // CONSTANTS
       
    45 
       
    46 _LIT( KMCETestUI, "MCETestUI" );
       
    47 
       
    48 
       
    49 CMCETestUIAppView* CMCETestUIAppView::NewL( CMCETestUIEngine& aEngine )
       
    50 	{
       
    51 	CMCETestUIAppView* self = new(ELeave) CMCETestUIAppView( aEngine );
       
    52 	CleanupStack::PushL(self);
       
    53 	self->ConstructL();
       
    54 	CleanupStack::Pop(self);
       
    55 	return self;
       
    56 	}
       
    57 
       
    58 CMCETestUIAppView::CMCETestUIAppView( CMCETestUIEngine& aEngine )
       
    59     : iEngine( aEngine )
       
    60 	{
       
    61 	}
       
    62 
       
    63 //
       
    64 // Destructor for the view.
       
    65 //
       
    66 CMCETestUIAppView::~CMCETestUIAppView()
       
    67 	{
       
    68 	if (iContainer)
       
    69 		{
       
    70 		AppUi()->RemoveFromViewStack( *this, iContainer );
       
    71 		//AppUi()->RemoveFromStack( iContainer );
       
    72 		delete iContainer;
       
    73 		iContainer = NULL;
       
    74 		}
       
    75 	}
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // CMCETestUIAppView::EngineStateChangedL()
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 void CMCETestUIAppView::EngineStateChangedL()
       
    82     {
       
    83     if ( iContainer )
       
    84         {
       
    85         iContainer->ConstructModelL();
       
    86         iContainer->DrawNow();
       
    87         }
       
    88     }
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CMCETestUIAppView::ChangeToSessionViewL()
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 void CMCETestUIAppView::ChangeToSessionViewL( TInt aSessionIndex )
       
    95     {
       
    96     TUid viewId = TUid::Uid( EMCETestUISessionViewId );
       
    97     TUid customMessageId = TUid::Uid( EMCETestUISessionId );
       
    98     
       
    99     TBuf8<10> sessionIndex; 
       
   100     sessionIndex.AppendNum( aSessionIndex );
       
   101     TRAPD( err, AppUi()->ActivateLocalViewL( viewId, 
       
   102                                              customMessageId, 
       
   103                                              sessionIndex ) );
       
   104     if ( err != KErrNone )
       
   105         {
       
   106         User::InfoPrint( _L("Error") );
       
   107         }
       
   108         
       
   109     }
       
   110 
       
   111 /**
       
   112 * Called by the framework
       
   113 * @return The Uid for this view
       
   114 */
       
   115 TUid CMCETestUIAppView::Id() const 
       
   116     {
       
   117     return TUid::Uid( EMCETestUIAppViewId );
       
   118     }
       
   119 
       
   120 
       
   121 /**
       
   122 * From CEikAppUi, takes care of command handling for this view.
       
   123 *
       
   124 * @param aCommand command to be handled
       
   125 */
       
   126 void CMCETestUIAppView::HandleCommandL( TInt aCommand )
       
   127     {
       
   128     switch ( aCommand )
       
   129         {
       
   130         case EAknSoftkeyBack:
       
   131             {
       
   132             AppUi()->HandleCommandL( EEikCmdExit );
       
   133             break;
       
   134             }
       
   135         case EAknSoftkeyOptions:
       
   136             {
       
   137             if ( iContainer ){
       
   138                 iContainer->DoShowMenuL();
       
   139                 }
       
   140             break;
       
   141             }
       
   142         default:
       
   143             {
       
   144             }
       
   145         }
       
   146 	}
       
   147 
       
   148 /**
       
   149 * Called by the framework when the view is activated.  Constructs the 
       
   150 * container if necessary, setting this view as its MOP parent, and 
       
   151 * adding it to the control stack.
       
   152 */
       
   153 void CMCETestUIAppView::DoActivateL(
       
   154         const TVwsViewId& /*aPrevViewId*/,
       
   155         TUid /*aCustomMessageId*/,
       
   156         const TDesC8& /*aCustomMessage*/ )
       
   157     {
       
   158 	if (!iContainer)
       
   159 		{
       
   160 		iContainer = CMCETestUIMainViewContainer::NewL(
       
   161 		    AppUi()->ClientRect(), *this, iEngine );
       
   162 		iContainer->SetMopParent(this);
       
   163 		//iContainer->ConstructL(AppUi()->ClientRect());
       
   164 		AppUi()->AddToViewStackL( *this, iContainer );
       
   165 		//AppUi()->AddToStackL(*this, iContainer);
       
   166 		}
       
   167     Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_EXIT );	
       
   168     Cba()->DrawNow();
       
   169      
       
   170     CEikStatusPane* statusPane = StatusPane();
       
   171     CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
       
   172         (StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ));
       
   173     titlePane->SetTextL( KMCETestUI );
       
   174         
       
   175     }
       
   176 
       
   177 /**
       
   178 * Called by the framework when the view is deactivated.  
       
   179 * Removes the container from the control stack and deletes it.
       
   180 */
       
   181 void CMCETestUIAppView::DoDeactivate()
       
   182     {
       
   183 	if (iContainer)
       
   184 		{
       
   185 		AppUi()->RemoveFromViewStack( *this, iContainer );
       
   186 		//AppUi()->RemoveFromStack(iContainer);
       
   187 		delete iContainer;
       
   188 		iContainer = NULL;
       
   189 		}
       
   190     }
       
   191 
       
   192 //
       
   193 // Second phase construction.
       
   194 //
       
   195 void CMCETestUIAppView::ConstructL()
       
   196     {
       
   197     BaseConstructL();
       
   198 	}
       
   199