uifw/AvKon/src/AknViewAppUi.cpp
changeset 0 2f259fa3e83a
child 5 aabf2c525e0f
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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 // INCLUDE FILES
       
    20 #include <eikbtgpc.h>
       
    21 #include <avkon.rsg>
       
    22 #include <avkon.hrh>
       
    23 #include <eikenv.h>
       
    24 #include <eikmenub.h>
       
    25 #include <eikcolib.h>
       
    26 #include <eikapp.h>
       
    27 #include <aknclearer.h>
       
    28 #include <AknUtils.h>
       
    29 #include <akntoolbar.h>
       
    30 #include "aknview.h"
       
    31 #include "aknshut.h"
       
    32 #include "aknenv.h"
       
    33 #include "AknPanic.h"
       
    34 #ifdef RD_SPLIT_VIEW
       
    35 #include "AknViewNavigator.h"
       
    36 #include <aknsutils.h>
       
    37 #include <aknsdrawutils.h>
       
    38 #include <AknLayoutScalable_Avkon.cdl.h>
       
    39 #include <LayoutMetaData.cdl.h>
       
    40 #endif // RD_SPLIT_VIEW
       
    41 #include "aknViewAppUi.h"
       
    42 
       
    43 // CONSTANTS
       
    44 const TInt KAknAppUiViewsGranularity = 1;
       
    45 const TInt KAknViewAsyncPriority = EActivePriorityRedrawEvents + 10;
       
    46 #ifdef RD_SPLIT_VIEW
       
    47 const TInt KAknSplitViewSize = 2;
       
    48 
       
    49 // MODULE DATA STRUCTURES
       
    50 enum TAknViewAppUiFlags
       
    51     {
       
    52     EAknViewAppUiButton1DownInRight = 0x00000001,
       
    53     EAknViewAppUiButton1DownInLeft  = 0x00000002,
       
    54     EAknViewAppUiFromSplitToSingle  = 0x00000004,
       
    55     EAknViewAppUiFromSingleToSplit  = 0x00000008,
       
    56     };
       
    57 #endif // RD_SPLIT_VIEW
       
    58 
       
    59 /**
       
    60 *  CAknViewAppUi extension class.
       
    61 *
       
    62 *  @lib avkon.lib
       
    63 */
       
    64 NONSHARABLE_CLASS(CAknViewAppUiExtension) : public CBase
       
    65     {
       
    66     public:
       
    67 		/**
       
    68 		* Two-phased constructor.
       
    69 		*/
       
    70         static CAknViewAppUiExtension* NewL();
       
    71 
       
    72         /**
       
    73         * Destructor.
       
    74         */
       
    75         ~CAknViewAppUiExtension();
       
    76         
       
    77     private:
       
    78 		/**
       
    79 		* C++ constructor.
       
    80 		*/
       
    81         CAknViewAppUiExtension();
       
    82 
       
    83 		/**
       
    84 		* Symbian 2nd-stage constructor.
       
    85 		*/
       
    86         void ConstructL();
       
    87 
       
    88     public:
       
    89         RPointerArray<CAknView> iActiveViews;
       
    90 #ifdef RD_SPLIT_VIEW
       
    91         RArray<CAknViewAppUi::TAknSplitViewContainer> iSplitViews;
       
    92         CAknViewNavigator* iNavigator;
       
    93         TInt iFlags;
       
    94 #endif // RD_SPLIT_VIEW
       
    95         TBool iUseDefaultScreenClearer;
       
    96     };
       
    97 
       
    98 // ============================ MEMBER FUNCTIONS ===============================
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 // CAknViewAppUiExtension::CAknViewAppUiExtension
       
   102 // C++ constructor.
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 CAknViewAppUiExtension::CAknViewAppUiExtension()
       
   106     {
       
   107     iUseDefaultScreenClearer = ETrue; // by default clear the screen automatically
       
   108     }
       
   109 
       
   110 // -----------------------------------------------------------------------------
       
   111 // CAknViewAppUiExtension::~CAknViewAppUiExtension
       
   112 // Destructor.
       
   113 // -----------------------------------------------------------------------------
       
   114 //
       
   115 CAknViewAppUiExtension::~CAknViewAppUiExtension()
       
   116     {
       
   117     iActiveViews.Close();
       
   118 #ifdef RD_SPLIT_VIEW
       
   119     delete iNavigator;
       
   120     iSplitViews.Close();
       
   121 #endif // RD_SPLIT_VIEW
       
   122     }
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // CAknViewAppUiExtension::NewL
       
   126 // Two-phased constructor.
       
   127 // -----------------------------------------------------------------------------
       
   128 //
       
   129 CAknViewAppUiExtension* CAknViewAppUiExtension::NewL()
       
   130     {
       
   131     CAknViewAppUiExtension* ext = new ( ELeave ) CAknViewAppUiExtension;
       
   132     CleanupStack::PushL( ext );
       
   133     ext->ConstructL();
       
   134     CleanupStack::Pop();
       
   135     return ext;
       
   136     }
       
   137 
       
   138 // -----------------------------------------------------------------------------
       
   139 // CAknViewAppUiExtension::NewL
       
   140 // Symbian 2nd-stage constructor.
       
   141 // -----------------------------------------------------------------------------
       
   142 //
       
   143 void CAknViewAppUiExtension::ConstructL()
       
   144     {
       
   145     }
       
   146     
       
   147 // -----------------------------------------------------------------------------
       
   148 // CAknViewAppUi::TAknSplitViewContainer::IsPartOf
       
   149 // Tests if a given view is part of the split view.
       
   150 // -----------------------------------------------------------------------------
       
   151 //
       
   152 #ifdef RD_SPLIT_VIEW
       
   153 TBool CAknViewAppUi::TAknSplitViewContainer::IsPartOf( const TUid aViewId )
       
   154     {
       
   155     if ( aViewId == iViewIds[0] || aViewId == iViewIds[1] )
       
   156         {
       
   157         return ETrue;
       
   158         }
       
   159         
       
   160     return EFalse;
       
   161     }
       
   162 #endif // RD_SPLIT_VIEW
       
   163     
       
   164 // -----------------------------------------------------------------------------
       
   165 // CAknViewAppUi::CViewActivationItem::NewLC
       
   166 // Two-phased constructor.
       
   167 // -----------------------------------------------------------------------------
       
   168 //
       
   169 CAknViewAppUi::CViewActivationItem* CAknViewAppUi::CViewActivationItem::NewLC( CAknView* aNewView, TUid aCustomMessageId, const TDesC8& aCustomMessage, const TVwsViewId& aPrevViewId )
       
   170 	{
       
   171 	CViewActivationItem* self = new ( ELeave ) CViewActivationItem( aNewView, aCustomMessageId, aPrevViewId );
       
   172 	CleanupStack::PushL( self );
       
   173 	self->ConstructL( aCustomMessage );
       
   174 	return self;
       
   175 	}
       
   176 
       
   177 // -----------------------------------------------------------------------------
       
   178 // CAknViewAppUi::CViewActivationItem::~CViewActivationItem
       
   179 // Destructor.
       
   180 // -----------------------------------------------------------------------------
       
   181 //
       
   182 CAknViewAppUi::CViewActivationItem::~CViewActivationItem()
       
   183 	{
       
   184 	delete iCustomMessage;
       
   185 	}
       
   186 
       
   187 // -----------------------------------------------------------------------------
       
   188 // CAknViewAppUi::CViewActivationItem::CViewActivationItem
       
   189 // C++ default constructor.
       
   190 // -----------------------------------------------------------------------------
       
   191 //
       
   192 CAknViewAppUi::CViewActivationItem::CViewActivationItem( CAknView* aNewView, TUid aCustomMessageId, const TVwsViewId& aPrevViewId )
       
   193 : iNewView( aNewView ), iCustomMessageId( aCustomMessageId ), iPrevViewId( aPrevViewId )
       
   194 	{
       
   195 	}
       
   196 
       
   197 // -----------------------------------------------------------------------------
       
   198 // CAknViewAppUi::CViewActivationItem::ConstructL
       
   199 // Symbian 2nd phase constructor.
       
   200 // -----------------------------------------------------------------------------
       
   201 //
       
   202 void CAknViewAppUi::CViewActivationItem::ConstructL( const TDesC8& aCustomMessage )
       
   203 	{
       
   204 	iCustomMessage = aCustomMessage.AllocL();
       
   205 	}
       
   206 
       
   207 // -----------------------------------------------------------------------------
       
   208 // CAknViewAppUi::BaseConstructL
       
   209 // Second-phase base class constructor.
       
   210 // -----------------------------------------------------------------------------
       
   211 //
       
   212 EXPORT_C void CAknViewAppUi::BaseConstructL( TInt aAppUiFlags )
       
   213 	{
       
   214 	CAknAppUi::BaseConstructL( aAppUiFlags );
       
   215 
       
   216 	iViews = new ( ELeave ) CAknViews( KAknAppUiViewsGranularity );
       
   217 	iActivationQueue = new ( ELeave ) CAknViewActivationQueue( KAknAppUiViewsGranularity );
       
   218 	iActivationTick = CIdle::NewL( KAknViewAsyncPriority );
       
   219 	iShutter = CAknViewShutter::NewL( *iEikonEnv, this );
       
   220 	
       
   221 	// Might be already constructed
       
   222     if ( !iExtension )
       
   223         {
       
   224         iExtension = CAknViewAppUiExtension::NewL();
       
   225         }
       
   226 	    
       
   227 #ifdef RD_SPLIT_VIEW
       
   228 	iExtension->iNavigator = new ( ELeave ) CAknViewNavigator( this );
       
   229 	AddToStackL( iExtension->iNavigator, ECoeStackPriorityDefault - 1, ECoeStackFlagRefusesFocus );
       
   230 #endif // RD_SPLIT_VIEW
       
   231 	
       
   232 	if ( iEikonEnv->RootWin().OrdinalPosition() == 0 && // only clear the window for foreground apps
       
   233 	     iExtension->iUseDefaultScreenClearer )
       
   234 		{
       
   235 		iClearer = CAknLocalScreenClearer::NewL( ETrue );
       
   236 		}
       
   237 	}
       
   238 
       
   239 // -----------------------------------------------------------------------------
       
   240 // CAknViewAppUi::~CAknViewAppUi
       
   241 // Destructor.
       
   242 // -----------------------------------------------------------------------------
       
   243 //
       
   244 EXPORT_C CAknViewAppUi::~CAknViewAppUi()
       
   245 	{
       
   246 #ifdef RD_SPLIT_VIEW
       
   247 	if (iExtension && iExtension->iNavigator )
       
   248 	    RemoveFromStack( iExtension->iNavigator );
       
   249 #endif // RD_SPLIT_VIEW
       
   250 	
       
   251     // Hide application toolbar to prevent it from showing 
       
   252     // after views are deleted
       
   253     if ( CAknAppUi::CurrentFixedToolbar() )
       
   254         {
       
   255         CAknAppUi::CurrentFixedToolbar()->SetToolbarVisibility( EFalse );   
       
   256         }
       
   257 
       
   258 	delete iClearer;
       
   259 	delete iShutter;
       
   260 	delete iActivationTick;
       
   261 	
       
   262 	if ( iActivationQueue )
       
   263 		{
       
   264 		iActivationQueue->ResetAndDestroy();
       
   265 		delete iActivationQueue;
       
   266 		}
       
   267 
       
   268 	if (iExtension)
       
   269 	    for ( TInt i = 0; i < iExtension->iActiveViews.Count(); i++ )
       
   270 	        {
       
   271     		iExtension->iActiveViews[i]->AknViewDeactivated();
       
   272 	        }
       
   273 
       
   274 	if ( iViews )
       
   275 		{
       
   276 		TInt count( iViews->Count() );
       
   277 		
       
   278 		for ( TInt i = 0; i < count; i++ )
       
   279 			{
       
   280 			CCoeAppUi::DeregisterView( *iViews->At( i ) );
       
   281 			}
       
   282 			
       
   283 		iViews->ResetAndDestroy();
       
   284 		}
       
   285 		
       
   286 	delete iViews;
       
   287 	delete iExtension;
       
   288 	}
       
   289 
       
   290 // -----------------------------------------------------------------------------
       
   291 // CAknViewAppUi::AddViewL
       
   292 // Registers a new view to the view server.
       
   293 // -----------------------------------------------------------------------------
       
   294 //
       
   295 EXPORT_C void CAknViewAppUi::AddViewL( CAknView* aView )
       
   296 	{
       
   297 	// this is here to assert that BaseConstructL has been called properly.
       
   298 	Extension();
       
   299 
       
   300 	CCoeAppUi::RegisterViewL( *aView );
       
   301 	iViews->AppendL( aView );
       
   302 	}
       
   303 
       
   304 // -----------------------------------------------------------------------------
       
   305 // CAknViewAppUi::RemoveView
       
   306 // Deregisters a new view from the view server.
       
   307 // -----------------------------------------------------------------------------
       
   308 //
       
   309 EXPORT_C void CAknViewAppUi::RemoveView( TUid aViewId )
       
   310 	{
       
   311 	const TInt count( iViews->Count() );
       
   312 	
       
   313 	for ( TInt i = 0; i < count; ++i )
       
   314 		{
       
   315 		CAknView* view( iViews->At( i ) );
       
   316 		
       
   317 		if ( view->Id() == aViewId )
       
   318 			{
       
   319 			iViews->Delete( i );
       
   320 			CCoeAppUi::DeregisterView( *view );
       
   321 			delete view;
       
   322 			return;
       
   323 			}
       
   324 		}
       
   325 	}
       
   326 
       
   327 // -----------------------------------------------------------------------------
       
   328 // CAknViewAppUi::View
       
   329 // Returns a view that has the given UID.
       
   330 // -----------------------------------------------------------------------------
       
   331 //
       
   332 EXPORT_C CAknView* CAknViewAppUi::View( TUid aView ) const
       
   333 	{
       
   334 	if ( iViews )
       
   335 	    {
       
   336     	const TInt count( iViews->Count() );
       
   337 	
       
   338     	for ( TInt i = 0; i < count; ++i )
       
   339 	    	{
       
   340     		CAknView* view( iViews->At( i ) );
       
   341 		
       
   342 	    	if ( view->Id() == aView )
       
   343 		        {
       
   344 			    return view;
       
   345     		    }
       
   346     		}
       
   347 	    }
       
   348 	return NULL;
       
   349 	}
       
   350 
       
   351 // -----------------------------------------------------------------------------
       
   352 // CAknViewAppUi::ProcessCommandL
       
   353 // Processes a command.
       
   354 // -----------------------------------------------------------------------------
       
   355 //
       
   356 EXPORT_C void CAknViewAppUi::ProcessCommandL( TInt aCommand )
       
   357 	{
       
   358 	MEikAppUiFactory* appUiFactory( iEikonEnv->AppUiFactory() );
       
   359 	ASSERT( appUiFactory );
       
   360 	
       
   361 	if ( appUiFactory->Popup() )
       
   362 	    {
       
   363 	    ClosePopup();
       
   364 	    }
       
   365     else if ( iView && iView->MenuBar() )
       
   366         {
       
   367         iView->MenuBar()->StopDisplayingMenuBar();
       
   368         }
       
   369     else if ( appUiFactory->MenuBar() )
       
   370         {
       
   371         StopDisplayingMenuBar();
       
   372         }
       
   373 	
       
   374 	if ( aCommand == EAknSoftkeyOptions )
       
   375 		{
       
   376 		if ( iView && iView->MenuBar() )
       
   377 		    {
       
   378 			iView->MenuBar()->TryDisplayMenuBarL();
       
   379 		    }
       
   380 		else if ( appUiFactory->MenuBar() )
       
   381 		    {
       
   382 			appUiFactory->MenuBar()->TryDisplayMenuBarL();
       
   383 		    }
       
   384 		    
       
   385 		return;
       
   386 		}
       
   387 	if ( aCommand == EAknSoftkeyContextOptions )
       
   388 		{
       
   389 		if ( iView && iView->MenuBar() )
       
   390 		    {
       
   391 			iView->MenuBar()->TryDisplayContextMenuBarL();
       
   392 		    }
       
   393 		else if ( appUiFactory->MenuBar() )
       
   394 		    {
       
   395 			appUiFactory->MenuBar()->TryDisplayContextMenuBarL();
       
   396 		    }
       
   397 		    
       
   398 		return;
       
   399 		}
       
   400 		
       
   401 	if ( aCommand == EAknCmdExit )
       
   402 		{
       
   403 		CAknEnv::RunAppShutter();
       
   404 		return;
       
   405 		}
       
   406 		
       
   407  	if ( iView )
       
   408  	    {
       
   409 		iView->ProcessCommandL( aCommand );
       
   410  	    }
       
   411  	    
       
   412 	if ( aCommand != EEikCmdCanceled )
       
   413 	    {
       
   414 	    HandleCommandL( aCommand );
       
   415 	    }
       
   416 	}
       
   417 
       
   418 // -----------------------------------------------------------------------------
       
   419 // CAknViewAppUi::ActivateLocalViewL
       
   420 // Activates a local view.
       
   421 // -----------------------------------------------------------------------------
       
   422 //
       
   423 EXPORT_C void CAknViewAppUi::ActivateLocalViewL( TUid aViewId )
       
   424 	{
       
   425 #ifdef RD_SPLIT_VIEW
       
   426     ActivateLocalViewL( aViewId, KNullUid, KNullDesC8 );
       
   427 #else
       
   428 	ActivateViewL( TVwsViewId( Application()->AppDllUid(), aViewId ) );
       
   429 #endif // RD_SPLIT_VIEW	    
       
   430 	}
       
   431 
       
   432 // -----------------------------------------------------------------------------
       
   433 // CAknViewAppUi::ActivateLocalViewL
       
   434 // Activates a local view.
       
   435 // -----------------------------------------------------------------------------
       
   436 //
       
   437 EXPORT_C void CAknViewAppUi::ActivateLocalViewL( TUid aViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage )
       
   438 	{
       
   439 	ActivateViewL( TVwsViewId( Application()->AppDllUid(), aViewId ), aCustomMessageId, aCustomMessage );
       
   440 
       
   441 #ifdef RD_SPLIT_VIEW
       
   442     const TAknSplitViewContainer* splitView( SplitView( aViewId ) );
       
   443 	if ( splitView )
       
   444 	    {
       
   445         CAknEnv::Static()->SplitViewActive( ETrue );
       
   446         
       
   447         if ( !ViewShown( splitView->iViewIds[0] ) || !ViewShown( splitView->iViewIds[1] ) )
       
   448             {
       
   449             iExtension->iFlags |= EAknViewAppUiFromSingleToSplit;
       
   450             }
       
   451 	    }
       
   452 #endif // RD_SPLIT_VIEW	    
       
   453 	}
       
   454 
       
   455 // -----------------------------------------------------------------------------
       
   456 // CAknViewAppUi::HandleStatusPaneSizeChange
       
   457 // Called by the framework when status pane's position or size changes.
       
   458 // -----------------------------------------------------------------------------
       
   459 //
       
   460 EXPORT_C void CAknViewAppUi::HandleStatusPaneSizeChange()
       
   461 	{
       
   462 	if (iClearer)
       
   463 		{
       
   464 		TRAP_IGNORE(iClearer->HandleStatusPaneSizeChangeL());
       
   465 		}
       
   466 	
       
   467 	const TInt count( iViews->Count() );
       
   468 	
       
   469 	for ( TInt i = 0; i < count; ++i )
       
   470 		{
       
   471 		iViews->At( i )->HandleStatusPaneSizeChange();
       
   472 		}
       
   473 	}
       
   474 
       
   475 // -----------------------------------------------------------------------------
       
   476 // CAknViewAppUi::ViewActivatedL
       
   477 // Adds a view to the activation queue. 
       
   478 // -----------------------------------------------------------------------------
       
   479 //
       
   480 void CAknViewAppUi::ViewActivatedL( CAknView* aView, const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage )
       
   481 	{
       
   482 	CViewActivationItem* activation( CViewActivationItem::NewLC( aView, aCustomMessageId, aCustomMessage, aPrevViewId ) );
       
   483 	iActivationQueue->AppendL( activation );
       
   484 	CleanupStack::Pop(); // activation
       
   485 	QueueActivationTick();
       
   486 	}
       
   487 
       
   488 // -----------------------------------------------------------------------------
       
   489 // CAknViewAppUi::ViewDeactivated
       
   490 // An empty implementation.
       
   491 // -----------------------------------------------------------------------------
       
   492 //
       
   493 void CAknViewAppUi::ViewDeactivated( CAknView* /*aView*/ )
       
   494 	{
       
   495 	// SERIES60 apps always have at least one active view.
       
   496 	}
       
   497 
       
   498 // -----------------------------------------------------------------------------
       
   499 // CAknViewAppUi::HandleForegroundEventL
       
   500 // Called by the framework when view's foreground status changes.
       
   501 // -----------------------------------------------------------------------------
       
   502 //
       
   503 EXPORT_C void CAknViewAppUi::HandleForegroundEventL( TBool aForeground )
       
   504 	{
       
   505 	CAknAppUi::HandleForegroundEventL( aForeground );
       
   506 	
       
   507 	if ( iView )
       
   508 	    {
       
   509 		iView->ProcessForegroundEventL( aForeground );
       
   510 	    }
       
   511 	}
       
   512 
       
   513 // -----------------------------------------------------------------------------
       
   514 // CAknViewAppUi::ActivationCallBack
       
   515 // Callback function of idle timer iActivationTick.
       
   516 // -----------------------------------------------------------------------------
       
   517 //
       
   518 TInt CAknViewAppUi::ActivationCallBack( TAny* aThis )
       
   519 	{
       
   520     static_cast<CAknViewAppUi*>( aThis )->ActivationTick();
       
   521     
       
   522 	return 0;
       
   523 	}
       
   524 
       
   525 // -----------------------------------------------------------------------------
       
   526 // CAknViewAppUi::ActivationTick
       
   527 // Handles asynchronous view activation / deactivation.
       
   528 // -----------------------------------------------------------------------------
       
   529 //
       
   530 void CAknViewAppUi::ActivationTick()
       
   531 	{
       
   532 	CViewActivationItem* item( iActivationQueue->At( 0 ) );
       
   533 #ifndef RD_SPLIT_VIEW	
       
   534 	iActivationQueue->Delete( 0 );
       
   535 #endif // !RD_SPLIT_VIEW
       
   536 	
       
   537 	TBool exit( EFalse );
       
   538 	
       
   539 #ifdef RD_SPLIT_VIEW
       
   540 	if ( !( iExtension->iFlags & EAknViewAppUiFromSplitToSingle ) &&
       
   541 	     !( iExtension->iFlags & EAknViewAppUiFromSingleToSplit ) &&
       
   542 	     item->iNewView == iView &&
       
   543 	     item->iCustomMessageId == KNullUid &&
       
   544 	     item->iCustomMessage->Length() == 0 )
       
   545 	    {
       
   546 	    // Still in the same app view with no new message.
       
   547 	    // No need for view switch.
       
   548 	    }
       
   549 	else
       
   550 	    {
       
   551 		TInt error( KErrNone );
       
   552 
       
   553         const TAknSplitViewContainer* splitView( SplitView( item->iNewView->Id() ) );
       
   554         
       
   555         if ( splitView )
       
   556             {
       
   557             TRAP( error, ActivateSplitViewL( item ) );
       
   558             }
       
   559         else if ( iExtension->iFlags & EAknViewAppUiFromSplitToSingle )
       
   560             {
       
   561             CAknEnv::Static()->SplitViewActive( EFalse );
       
   562             item->iNewView->HandleViewRectChange();
       
   563             item->iNewView->Redraw();
       
   564             }
       
   565         else
       
   566             {
       
   567             TRAP( error, item->iNewView->AknViewActivatedL( item->iPrevViewId, 
       
   568                                                             item->iCustomMessageId, 
       
   569                                                             *item->iCustomMessage ) );
       
   570             CAknEnv::Static()->SplitViewActive( EFalse );                                                            
       
   571             }
       
   572             
       
   573 		iExtension->iFlags &= ~( EAknViewAppUiFromSplitToSingle | EAknViewAppUiFromSingleToSplit );
       
   574 
       
   575         if ( error == KErrNone )
       
   576             {
       
   577             if ( iView )
       
   578                 {
       
   579                 // new view successfully activated, shut down the old one(s)
       
   580                 for ( TInt i = 0; i < iExtension->iActiveViews.Count(); i++ )
       
   581                     {
       
   582                     if ( splitView )
       
   583                         {
       
   584                         if ( iExtension->iSplitViews[i].IsPartOf( iExtension->iActiveViews[i]->Id() ) )                      
       
   585                             {
       
   586                             iExtension->iActiveViews.Remove( i );
       
   587                             --i;
       
   588                             }
       
   589                         }
       
   590                     else
       
   591                         {
       
   592                         if ( iExtension->iActiveViews[i] == item->iNewView )
       
   593                             {
       
   594                             iExtension->iActiveViews.Remove( i );
       
   595                             --i;
       
   596                             }
       
   597                         }
       
   598                     }
       
   599                     
       
   600                 iShutter->Start( iExtension->iActiveViews );
       
   601                 
       
   602                 if ( iExtension->iActiveViews.Count() == 0 )
       
   603                     {
       
   604                     iView->StopDisplayingMenuBar();
       
   605                     }
       
   606                 }
       
   607 
       
   608             iExtension->iActiveViews.Reset();
       
   609             
       
   610             // Number of views is always smaller than already reserved array 
       
   611             // (default granularity is 8) -> no memory allocation failures.
       
   612             if ( splitView )
       
   613                 {
       
   614                 iExtension->iActiveViews.Append( View( splitView->iViewIds[0] ) );
       
   615                 iExtension->iActiveViews.Append( View( splitView->iViewIds[1] ) );
       
   616                 }
       
   617             else
       
   618                 {
       
   619                 iExtension->iActiveViews.Append( item->iNewView );
       
   620                 }
       
   621 
       
   622             iView = item->iNewView;
       
   623             }
       
   624         else
       
   625             {
       
   626             // deactivate failed view(s) immediately
       
   627             if ( splitView )
       
   628                 {
       
   629                 CAknEnv::Static()->SplitViewActive( EFalse );
       
   630 
       
   631                 for ( TInt i = 0; i < KAknSplitViewSize; i++ )
       
   632                     {
       
   633                       if ( splitView->iFailed[i] )
       
   634                         {
       
   635                         CAknView* view( View( splitView->iViewIds[i] ) );
       
   636 
       
   637                         view->AknViewDeactivated();
       
   638 
       
   639                         TInt position( iExtension->iActiveViews.Find( view ) );
       
   640 
       
   641                         if ( position != KErrNotFound )
       
   642                             {
       
   643                             iExtension->iActiveViews.Remove( position );
       
   644                             }
       
   645                         }
       
   646                     }
       
   647                 }
       
   648             else
       
   649                 {
       
   650                 item->iNewView->AknViewDeactivated();
       
   651 
       
   652                 TInt position( iExtension->iActiveViews.Find( item->iNewView ) );
       
   653                         
       
   654                 if ( position != KErrNotFound )
       
   655                     {
       
   656                     iExtension->iActiveViews.Remove( position );
       
   657                     }
       
   658                 }
       
   659             
       
   660             // report error to the user
       
   661             iEikonEnv->HandleError( error );
       
   662             
       
   663             // recover the app as best possible
       
   664             if ( !iView )
       
   665                 {
       
   666                 // no view to fall back to -> exit
       
   667                 exit = ETrue;
       
   668                 }
       
   669             else if ( iView == item->iNewView )
       
   670                 {
       
   671                 // view reactivation failed -> forget current and try default
       
   672                 iView = NULL;
       
   673                 TVwsViewId viewId;
       
   674                 
       
   675                 if ( GetDefaultViewId( viewId ) == KErrNone )
       
   676                     {
       
   677                     TRAP_IGNORE( ActivateViewL( viewId ) );
       
   678                     }
       
   679                 else
       
   680                     {
       
   681                     exit = ETrue;
       
   682                     }
       
   683                 }
       
   684             else
       
   685                 {
       
   686                 // tell the view server that we're staying here
       
   687                 TRAP_IGNORE( ActivateLocalViewL( iView->Id() ) );
       
   688                 }
       
   689             
       
   690             // activation has failed, go back to the last view if in a different app
       
   691             if ( item->iPrevViewId.iAppUid != Application()->AppDllUid() )
       
   692                 {
       
   693                 TRAP_IGNORE( ActivateViewL( item->iPrevViewId ) );
       
   694                 }
       
   695 	        }
       
   696 	    }
       
   697 #else
       
   698 	if ( item->iNewView == iView && 
       
   699 	     item->iCustomMessageId == KNullUid && 
       
   700 	     item->iCustomMessage->Length() == 0 )
       
   701 		{
       
   702 		// Still on the same app view, with no new message. 
       
   703 		// No need for a app view switch.
       
   704 		}
       
   705 	else
       
   706 		{
       
   707         if ( iView && CurrentPopupToolbar() )
       
   708             {
       
   709             iView->SaveToolbarStatus(CurrentPopupToolbar()->IsShown(), !CurrentPopupToolbar()->IsNonFocusing() ); 
       
   710             }
       
   711 
       
   712 		TRAPD( error, item->iNewView->AknViewActivatedL( item->iPrevViewId, 
       
   713 		                                                 item->iCustomMessageId, 
       
   714 		                                                 *item->iCustomMessage ) );
       
   715 
       
   716 		if ( error == KErrNone )
       
   717 			{
       
   718 			// New view sucessfully activated. Shut down the old one.
       
   719 			if ( iView )
       
   720 				{
       
   721 				if ( iView != item->iNewView )	// Is this really a new view?
       
   722 					{
       
   723 					iExtension->iActiveViews.Reset();
       
   724 					iExtension->iActiveViews.Append( iView );
       
   725 					iShutter->Start( iExtension->iActiveViews ); // Deactivate iView
       
   726 					}
       
   727 				else
       
   728 					{
       
   729 					iExtension->iActiveViews.Reset();
       
   730 					iShutter->Start( iExtension->iActiveViews ); // Tidy up iView if it's not new
       
   731 					iView->StopDisplayingMenuBar();
       
   732 					}
       
   733 				}
       
   734 				
       
   735             iExtension->iActiveViews.Reset();
       
   736             iExtension->iActiveViews.Append( item->iNewView );
       
   737 			iView = item->iNewView;
       
   738 			}
       
   739 		else
       
   740 			{
       
   741 			// deactivate failed view immediately
       
   742 			item->iNewView->AknViewDeactivated();
       
   743 			
       
   744 			// report the error to the user
       
   745 			iEikonEnv->HandleError( error );
       
   746 
       
   747 			// recover the app as best possible
       
   748 			if ( !iView )
       
   749 				{
       
   750 				// no view to fall back to - exit
       
   751 				exit = ETrue;
       
   752 				}
       
   753 			else if ( iView == item->iNewView )
       
   754 				{
       
   755 				// Reactivation of view failed - forget current and try default view
       
   756 				iView = NULL;
       
   757 				TVwsViewId viewId;
       
   758 				
       
   759 				if ( GetDefaultViewId( viewId ) == KErrNone )
       
   760 					{
       
   761 					TRAP_IGNORE( ActivateViewL( viewId ) );
       
   762 					}
       
   763 				else
       
   764 					{
       
   765 					// no default view - exit
       
   766 					exit = ETrue;
       
   767 					}
       
   768 				}
       
   769 			else
       
   770 				{
       
   771 				// Tell view server that we're staying here
       
   772 				TRAP_IGNORE( ActivateLocalViewL( iView->Id() ) );
       
   773 				}
       
   774 			
       
   775 			// This activation has failed, so go back to the last view if in a different app.
       
   776 			if ( item->iPrevViewId.iAppUid != Application()->AppDllUid() )
       
   777 				{
       
   778 				TRAP_IGNORE( ActivateViewL( item->iPrevViewId ) );
       
   779 				}
       
   780 			}
       
   781 		}
       
   782 #endif // RD_SPLIT_VIEW
       
   783 	    
       
   784 	delete iClearer;
       
   785 	iClearer = NULL;
       
   786 	
       
   787 #ifdef RD_SPLIT_VIEW	
       
   788 	iActivationQueue->Delete( 0 );
       
   789 #endif // RD_SPLIT_VIEW
       
   790 	delete item;
       
   791 	
       
   792 	if ( exit )
       
   793 	    {
       
   794 	    TRAP_IGNORE( HandleForegroundEventL( EFalse ) );
       
   795 	    RunAppShutter();
       
   796 	    }
       
   797 	else
       
   798 	    {
       
   799 	    QueueActivationTick();
       
   800 	    }
       
   801 	}
       
   802 
       
   803 // -----------------------------------------------------------------------------
       
   804 // CAknViewAppUi::QueueActivationTick
       
   805 // Starts the activation idle timer.
       
   806 // -----------------------------------------------------------------------------
       
   807 //
       
   808 void CAknViewAppUi::QueueActivationTick()
       
   809 	{
       
   810 	if ( iActivationQueue->Count() && !iActivationTick->IsActive() )
       
   811 	    {
       
   812 		iActivationTick->Start( TCallBack( ActivationCallBack, this ) );
       
   813 	    }
       
   814 	}
       
   815 
       
   816 // -----------------------------------------------------------------------------
       
   817 // CAknViewAppUi::StopDisplayingMenuBar
       
   818 // Called by the framework when a possible menu bar should be dismissed.
       
   819 // -----------------------------------------------------------------------------
       
   820 //
       
   821 EXPORT_C void CAknViewAppUi::StopDisplayingMenuBar()
       
   822 	{
       
   823 	CAknAppUi::StopDisplayingMenuBar();
       
   824 	
       
   825 	if ( iView )
       
   826 	    {
       
   827 		iView->StopDisplayingMenuBar();
       
   828 	    }
       
   829 	}
       
   830 
       
   831 // -----------------------------------------------------------------------------
       
   832 // CAknViewAppUi::Extension
       
   833 // Asserts that extension object has been created.
       
   834 // -----------------------------------------------------------------------------
       
   835 //
       
   836 CAknViewAppUiExtension* CAknViewAppUi::Extension() const
       
   837     {
       
   838     __ASSERT_ALWAYS( iExtension, Panic( EAknPanicObjectNotFullyConstructed ) );
       
   839     return iExtension;
       
   840     }
       
   841 
       
   842 // -----------------------------------------------------------------------------
       
   843 // CAknViewAppUi::SetSplitViewL
       
   844 // Combines two views.
       
   845 // -----------------------------------------------------------------------------
       
   846 //
       
   847 #ifdef RD_SPLIT_VIEW
       
   848 EXPORT_C void CAknViewAppUi::SetSplitViewL( const TUid aView1Id, 
       
   849                                             const TUid aView2Id, 
       
   850                                             const TInt aLeftViewSize )
       
   851     {
       
   852     // a view can belong to one split view only
       
   853     RemoveSplitViewL( aView1Id );
       
   854     RemoveSplitViewL( aView2Id );
       
   855         
       
   856     TAknSplitViewContainer splitView;
       
   857     splitView.iViewIds[0] = aView1Id;
       
   858     splitView.iViewIds[1] = aView2Id;
       
   859     splitView.iLeftViewSize = aLeftViewSize;
       
   860     
       
   861     iExtension->iSplitViews.AppendL( splitView );
       
   862     }
       
   863 #else
       
   864 EXPORT_C void CAknViewAppUi::SetSplitViewL( const TUid /*aView1Id*/, 
       
   865                                             const TUid /*aView2Id*/, 
       
   866                                             const TInt /*aLeftViewSize*/ )
       
   867     {
       
   868     }
       
   869 #endif // RD_SPLIT_VIEW
       
   870     
       
   871 // -----------------------------------------------------------------------------
       
   872 // CAknViewAppUi::RemoveSplitViewL
       
   873 // Removes a view combination containing the given view UID.
       
   874 // -----------------------------------------------------------------------------
       
   875 //
       
   876 #ifdef RD_SPLIT_VIEW
       
   877 EXPORT_C void CAknViewAppUi::RemoveSplitViewL( const TUid aViewId )
       
   878     {
       
   879     for ( TInt i = 0; i < iExtension->iSplitViews.Count(); i++ )
       
   880         {
       
   881           if ( iExtension->iSplitViews[i].IsPartOf( aViewId ) )
       
   882             {
       
   883             iExtension->iSplitViews.Remove( i );
       
   884             
       
   885             if ( ViewShown( aViewId ) )
       
   886                 {
       
   887                 iExtension->iFlags |= EAknViewAppUiFromSplitToSingle;
       
   888                 ActivateLocalViewL( aViewId );
       
   889                 }
       
   890                 
       
   891             return;
       
   892             }
       
   893         }
       
   894     }
       
   895 #else
       
   896 EXPORT_C void CAknViewAppUi::RemoveSplitViewL( const TUid /*aViewId*/ )
       
   897     {
       
   898     }
       
   899 #endif // RD_SPLIT_VIEW
       
   900 
       
   901 // -----------------------------------------------------------------------------
       
   902 // CAknViewAppUi::SplitViewActive
       
   903 // Checks if split view is in use.
       
   904 // -----------------------------------------------------------------------------
       
   905 //
       
   906 #ifdef RD_SPLIT_VIEW
       
   907 EXPORT_C TBool CAknViewAppUi::SplitViewActive() const
       
   908     {
       
   909     if ( iActivationQueue->Count() > 0 )
       
   910         {
       
   911     	if ( SplitView( iActivationQueue->At( 0 )->iNewView->Id() ) )
       
   912     	    {
       
   913             return ETrue;    	    
       
   914     	    }
       
   915         }
       
   916         
       
   917     if ( iExtension->iFlags & EAknViewAppUiFromSplitToSingle )
       
   918         {
       
   919         return EFalse;
       
   920         }
       
   921         
       
   922     return iExtension->iActiveViews.Count() > 1;
       
   923     }
       
   924 #else
       
   925 EXPORT_C TBool CAknViewAppUi::SplitViewActive() const
       
   926     {
       
   927     return EFalse;
       
   928     }
       
   929 #endif // RD_SPLIT_VIEW
       
   930 
       
   931 // -----------------------------------------------------------------------------
       
   932 // CAknViewAppUi::FocusedView
       
   933 // Returns the currently focused view.
       
   934 // -----------------------------------------------------------------------------
       
   935 //
       
   936 #ifdef RD_SPLIT_VIEW
       
   937 EXPORT_C TUid CAknViewAppUi::FocusedView() const
       
   938     {
       
   939     if ( iView )
       
   940         {
       
   941         return iView->Id();
       
   942         }
       
   943         
       
   944     return KNullUid;
       
   945     }
       
   946 #else    
       
   947 EXPORT_C TUid CAknViewAppUi::FocusedView() const
       
   948     {
       
   949     return KNullUid;
       
   950     }
       
   951 #endif // RD_SPLIT_VIEW
       
   952 
       
   953 // -----------------------------------------------------------------------------
       
   954 // CAknViewAppUi::ViewShown
       
   955 // Checks if the given view is visible on the screen.
       
   956 // -----------------------------------------------------------------------------
       
   957 //    
       
   958 #ifdef RD_SPLIT_VIEW
       
   959 EXPORT_C TBool CAknViewAppUi::ViewShown( const TUid aViewId ) const
       
   960     {
       
   961     for ( TInt i = 0; i < iExtension->iActiveViews.Count(); i++ )
       
   962         {
       
   963         if ( iExtension->iActiveViews[i]->Id() == aViewId )
       
   964             {
       
   965             return ETrue;
       
   966             }
       
   967         }
       
   968         
       
   969     return EFalse;
       
   970     }
       
   971 #else
       
   972 EXPORT_C TBool CAknViewAppUi::ViewShown( const TUid /*aViewId*/ ) const
       
   973     {
       
   974     return EFalse;
       
   975     }
       
   976 #endif // RD_SPLIT_VIEW
       
   977     
       
   978    
       
   979 // -----------------------------------------------------------------------------
       
   980 // CAknViewAppUi::EnableLocalScreenClearer
       
   981 // Enables/disables local screen clearer.
       
   982 // -----------------------------------------------------------------------------
       
   983 //  
       
   984 EXPORT_C void CAknViewAppUi::EnableLocalScreenClearer( TBool aEnable )
       
   985     {
       
   986     // Make sure iExtension exists (can be called before BaseConstructL)
       
   987     if ( !iExtension )
       
   988         {
       
   989         TRAP_IGNORE( iExtension = CAknViewAppUiExtension::NewL() );
       
   990         }
       
   991     
       
   992     // Update flag
       
   993     if ( iExtension )
       
   994         {
       
   995         iExtension->iUseDefaultScreenClearer = aEnable;
       
   996         }
       
   997 
       
   998     // Create/delete iClearer if required
       
   999     if ( aEnable && !iClearer )
       
  1000         {
       
  1001         TRAP_IGNORE( iClearer = CAknLocalScreenClearer::NewL( EFalse ) );
       
  1002         }
       
  1003     else if ( !aEnable && iClearer )
       
  1004         {
       
  1005         delete iClearer;
       
  1006         iClearer = NULL;
       
  1007         }
       
  1008     }
       
  1009     
       
  1010 // -----------------------------------------------------------------------------
       
  1011 // CAknViewAppUi::ViewRect
       
  1012 // Returns view's rectangle.
       
  1013 // -----------------------------------------------------------------------------
       
  1014 //
       
  1015 #ifdef RD_SPLIT_VIEW
       
  1016 TRect CAknViewAppUi::ViewRect( const TUid aViewId ) const
       
  1017     {
       
  1018     // Following code is used until layout data is available. Eventually it
       
  1019     // will be replaced by the commented code.
       
  1020     TRect rect( ClientRect() );
       
  1021     const TAknSplitViewContainer* splitView( SplitView( aViewId ) );
       
  1022     
       
  1023     if ( splitView )
       
  1024         {
       
  1025         TInt leftWidth( rect.Width() * splitView->iLeftViewSize / 100 );
       
  1026         
       
  1027         if ( splitView->iViewIds[0] == aViewId )
       
  1028             {
       
  1029             rect.SetWidth( leftWidth );
       
  1030             }
       
  1031         else
       
  1032             {
       
  1033             rect.SetWidth( rect.Width() - leftWidth );
       
  1034             rect.Move( leftWidth, 0 );
       
  1035             }
       
  1036         }
       
  1037         
       
  1038     return rect;
       
  1039     
       
  1040 /*    const TAknSplitViewContainer* splitView( SplitView( aViewId ) );
       
  1041     
       
  1042     if ( splitView)
       
  1043         {
       
  1044         TAknLayoutRect viewRect;
       
  1045         
       
  1046         if ( splitView->iViewIds[0] == aViewId ) // left view
       
  1047             {
       
  1048             viewRect.LayoutRect( ApplicationRect(), AknLayoutScalable_Avkon::main_pane( 8 ) );
       
  1049             }
       
  1050         else // right view
       
  1051             {
       
  1052             viewRect.LayoutRect( ApplicationRect(), AknLayoutScalable_Avkon::main_pane_cp() );
       
  1053             }
       
  1054             
       
  1055         return viewRect.Rect();
       
  1056         }
       
  1057     
       
  1058     return ClientRect();*/
       
  1059     }
       
  1060 #endif // RD_SPLIT_VIEW
       
  1061     
       
  1062 // -----------------------------------------------------------------------------
       
  1063 // CAknViewAppUi::SplitView
       
  1064 // If the given view is part of a split view then returns that split view.
       
  1065 // -----------------------------------------------------------------------------
       
  1066 //    
       
  1067 #ifdef RD_SPLIT_VIEW
       
  1068 CAknViewAppUi::TAknSplitViewContainer* CAknViewAppUi::SplitView( const TUid aViewId ) const
       
  1069     {
       
  1070     for ( TInt i = 0; i < iExtension->iSplitViews.Count(); i++ )
       
  1071         {
       
  1072           if ( iExtension->iSplitViews[i].IsPartOf( aViewId ) )
       
  1073             {
       
  1074             return &iExtension->iSplitViews[i];
       
  1075             }
       
  1076         }
       
  1077         
       
  1078     return NULL;
       
  1079     }
       
  1080 #endif // RD_SPLIT_VIEW
       
  1081     
       
  1082 // -----------------------------------------------------------------------------
       
  1083 // CAknViewAppUi::ActivateSplitViewL
       
  1084 // Activates views in split view.
       
  1085 // -----------------------------------------------------------------------------
       
  1086 //
       
  1087 #ifdef RD_SPLIT_VIEW
       
  1088 void CAknViewAppUi::ActivateSplitViewL( CViewActivationItem* aItem )
       
  1089     {
       
  1090     TAknSplitViewContainer* splitView( SplitView( aItem->iNewView->Id() ) );
       
  1091     
       
  1092     splitView->iFailed[0] = ETrue;
       
  1093     splitView->iFailed[1] = ETrue;
       
  1094     
       
  1095     for ( TInt i = 0; i < KAknSplitViewSize; i++ )
       
  1096         {
       
  1097         TRect viewRect( ViewRect( splitView->iViewIds[i] ) );
       
  1098         
       
  1099         if ( ViewShown( splitView->iViewIds[i] ) )
       
  1100             {
       
  1101             if ( splitView->iViewRect[i] != viewRect )
       
  1102                 {
       
  1103                 splitView->iViewRect[i] = viewRect;
       
  1104                 View( splitView->iViewIds[i] )->HandleViewRectChange();
       
  1105                 }
       
  1106 
       
  1107             View( splitView->iViewIds[i] )->Redraw();
       
  1108             }
       
  1109         else
       
  1110             {
       
  1111             View( splitView->iViewIds[i] )->AknViewActivatedL( aItem->iPrevViewId, 
       
  1112                                                                aItem->iCustomMessageId, 
       
  1113                                                                *aItem->iCustomMessage );
       
  1114             splitView->iViewRect[i] = viewRect;
       
  1115             }
       
  1116             
       
  1117         splitView->iFailed[i] = EFalse;
       
  1118         }
       
  1119     }
       
  1120 #endif // RD_SPLIT_VIEW
       
  1121 
       
  1122 // -----------------------------------------------------------------------------
       
  1123 // CAknViewAppUi::HandleViewNavigationL
       
  1124 // Handles navigation between visible split views.
       
  1125 // -----------------------------------------------------------------------------
       
  1126 //
       
  1127 #ifdef RD_SPLIT_VIEW
       
  1128 TKeyResponse CAknViewAppUi::HandleViewNavigationL( const TKeyEvent& aKeyEvent )
       
  1129     {
       
  1130     if ( SplitViewActive() )
       
  1131         {
       
  1132         switch ( aKeyEvent.iCode )
       
  1133             {
       
  1134             case EKeyLeftArrow:
       
  1135             case EKeyRightArrow:
       
  1136             case EKeyTab:
       
  1137                 if ( iView == iExtension->iActiveViews[0] )
       
  1138                     {
       
  1139                     ActivateLocalViewL( iExtension->iActiveViews[1]->Id() );
       
  1140                     }
       
  1141                 else
       
  1142                     {
       
  1143                     ActivateLocalViewL( iExtension->iActiveViews[0]->Id() );
       
  1144                     }
       
  1145 
       
  1146                 return EKeyWasConsumed;
       
  1147                 
       
  1148             default:
       
  1149                 break;
       
  1150             }
       
  1151         }
       
  1152 
       
  1153     return EKeyWasNotConsumed;
       
  1154     }
       
  1155 #endif // RD_SPLIT_VIEW
       
  1156     
       
  1157 // -----------------------------------------------------------------------------
       
  1158 // CAknViewAppUi::HandleWsEventL
       
  1159 // Handles pointer-initiated view switch.
       
  1160 // -----------------------------------------------------------------------------
       
  1161 //
       
  1162 EXPORT_C void CAknViewAppUi::HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination )
       
  1163     {
       
  1164 #ifdef RD_SPLIT_VIEW
       
  1165     if ( AknLayoutUtils::PenEnabled() )
       
  1166         {
       
  1167         if ( SplitViewActive() && aEvent.Type() == EEventPointer && !IsDisplayingMenuOrDialog() )
       
  1168             {
       
  1169             switch ( aEvent.Pointer()->iType )
       
  1170                 {
       
  1171                 case TPointerEvent::EButton1Down:
       
  1172                     for ( TInt i = 0; i < iExtension->iActiveViews.Count(); i++ )
       
  1173                         {
       
  1174                         if ( iView == iExtension->iActiveViews[i] )
       
  1175                             {
       
  1176                             if ( iExtension->iActiveViews[i^1]->ClientRect().Contains( aEvent.Pointer()->iParentPosition ) )
       
  1177                                 {
       
  1178                                 iExtension->iFlags |= i + 1;
       
  1179                                 break;
       
  1180                                 }
       
  1181                             }
       
  1182                         }
       
  1183                     break;
       
  1184                     
       
  1185                 case TPointerEvent::EButton1Up:
       
  1186                     for ( TInt i = 0; i < iExtension->iActiveViews.Count(); i++ )
       
  1187                         {
       
  1188                         if ( iView == iExtension->iActiveViews[i] )
       
  1189                             {
       
  1190                             if ( iExtension->iActiveViews[i^1]->ClientRect().Contains( aEvent.Pointer()->iParentPosition ) &&
       
  1191                                  iExtension->iFlags & i + 1 )
       
  1192                                 {
       
  1193                                 ActivateLocalViewL( iExtension->iActiveViews[i^1]->Id() );
       
  1194                                 break;
       
  1195                                 }
       
  1196                             }
       
  1197                         }
       
  1198                 
       
  1199                     iExtension->iFlags &= ~( EAknViewAppUiButton1DownInLeft | EAknViewAppUiButton1DownInRight );
       
  1200                     break;
       
  1201                     
       
  1202                 default:
       
  1203                     break;
       
  1204                 }
       
  1205             }
       
  1206         }
       
  1207 #endif // RD_SPLIT_VIEW
       
  1208     CAknAppUi::HandleWsEventL( aEvent, aDestination );
       
  1209     }
       
  1210 
       
  1211 // End of File