src/NPRBrowserAknView.cpp
changeset 0 0049171ecffb
equal deleted inserted replaced
-1:000000000000 0:0049171ecffb
       
     1 /*
       
     2  ===============================================================================
       
     3  Name	: NPRBrowserAknView.cpp
       
     4  Author	: Symsource
       
     5  
       
     6  Copyright (c) 2009 Symbian Foundation Ltd
       
     7  This component and the accompanying materials are made available
       
     8  under the terms of the License "Eclipse Public License v1.0"
       
     9  which accompanies this distribution, and is available
       
    10  at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    11 
       
    12  Initial Contributors:
       
    13  - Symsource
       
    14  
       
    15  Contributors:
       
    16  - Symsource
       
    17  
       
    18  Description : AknView for containing Nokia browser control to show NPR's Story 
       
    19  ================================================================================
       
    20  */
       
    21 
       
    22 #include <aknviewappui.h>
       
    23 #include <NPR_0xEEB0E481.rsg>
       
    24 #include "NPR.hrh"
       
    25 #include "NPRBrowserAknView.h"
       
    26 #include "NPRBrowserContainer.h"
       
    27 #include "NPRAppUi.h"
       
    28 
       
    29 
       
    30 CBrowserAknView* CBrowserAknView::NewL(CNPRAppEngine& aEngine)
       
    31 	{
       
    32 	CBrowserAknView* p = new (ELeave) CBrowserAknView(aEngine);
       
    33 	CleanupStack::PushL(p);
       
    34 	p->ConstructL();
       
    35 	CleanupStack::Pop(p);
       
    36 	return p;
       
    37 	}
       
    38 
       
    39 CBrowserAknView::CBrowserAknView(CNPRAppEngine& aEngine)
       
    40 	: iEngine(aEngine)
       
    41 	{
       
    42 	}
       
    43 
       
    44 CBrowserAknView::~CBrowserAknView()
       
    45 	{
       
    46 	delete iContainer;
       
    47 	}
       
    48 
       
    49 
       
    50 void CBrowserAknView::ConstructL()
       
    51 	{
       
    52 	BaseConstructL(R_AKN_BROWSER_VIEW);
       
    53 	iContainer = new (ELeave) CBrowserContainer();
       
    54 	iContainer->ConstructL(ClientRect());
       
    55 	iContainer->SetMopParent( this );
       
    56 	}
       
    57 
       
    58 TUid CBrowserAknView::Id() const
       
    59 	{
       
    60 	return TUid::Uid(ENPRBrowserViewId);
       
    61 	}
       
    62 
       
    63 void CBrowserAknView::HandleCommandL(TInt aCommand)
       
    64 	{
       
    65 	switch(aCommand)
       
    66 		{
       
    67 		case EListen:
       
    68 			{
       
    69 			iContainer->Listen();
       
    70 			break;
       
    71 			}
       
    72 		case EAknSoftkeyBack:
       
    73 			{
       
    74 			static_cast<CNPRAppUi*>(CEikonEnv::Static()->EikAppUi())->ActivateLocalViewL(TUid::Uid(ENPRStoryListBoxViewId));
       
    75 			break;
       
    76 			}
       
    77 		default:
       
    78 			{
       
    79 			iContainer->ProcessCommandL(aCommand);
       
    80 			break;
       
    81 			}
       
    82 		}
       
    83 	}
       
    84 
       
    85 
       
    86 void CBrowserAknView::DoActivateL(const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/,	const TDesC8& /*aCustomMessage*/)
       
    87 	{
       
    88 	AppUi()->AddToStackL(*this, iContainer);
       
    89 	iContainer->MakeVisible(ETrue);
       
    90 	iContainer->ActivateL();
       
    91 	iContainer->ProcessCommandL(ELoadPage);
       
    92 	}
       
    93 
       
    94 void CBrowserAknView::DoDeactivate()
       
    95 	{
       
    96 	iContainer->MakeVisible(EFalse);
       
    97 	AppUi()->RemoveFromViewStack(*this, iContainer);
       
    98 	}
       
    99 
       
   100 void CBrowserAknView::HandleStatusPaneSizeChange()
       
   101 	{
       
   102 	CAknView::HandleStatusPaneSizeChange();
       
   103 	}