internetradio2.0/uisrc/ircostwarningview.cpp
changeset 0 09774dfdd46b
equal deleted inserted replaced
-1:000000000000 0:09774dfdd46b
       
     1 /*
       
     2 * Copyright (c) 2004 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:  view class for cost warning view
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include <akntitle.h>
       
    22 #include <stringloader.h>
       
    23 #include <internetradio.rsg>
       
    24 
       
    25 
       
    26 #include "irui.h"
       
    27 #include "ir.hrh"
       
    28 #include "ircommon.h"
       
    29 #include "irdebug.h"
       
    30 #include "irbaseview.h"
       
    31 #include "ircostwarningview.h"
       
    32 #include "ircostwarningcontainer.h"
       
    33 #include "irapplication.h"
       
    34 #include "irnetworkcontroller.h"
       
    35 #include "irsettings.h"
       
    36 
       
    37 
       
    38 // ---------------------------------------------------------------------------
       
    39 // C++ default constructor can NOT contain any code, that might leave.
       
    40 // ---------------------------------------------------------------------------
       
    41 //
       
    42 CIRCostWarningView::CIRCostWarningView():iContainer(NULL) 
       
    43     {
       
    44     IRLOG_DEBUG("CIRCostWarningView::CIRCostWarningView" );
       
    45     // Nothing here 
       
    46     }
       
    47 
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 // EPOC default constructor can leave.
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 void CIRCostWarningView::ConstructL(const TRect & /*aRect*/)
       
    54     {
       
    55     IRLOG_DEBUG("CIRCostWarningView::ConstructL - Entering" );
       
    56     BaseConstructL(R_IR_TANDCVIEW);
       
    57     IRLOG_DEBUG("CIRCostWarningView::ConstructL - Exiting" );
       
    58     }
       
    59 // ---------------------------------------------------------------------------
       
    60 // Two-phased constructor.
       
    61 // CIRCostWarningView::NewL
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 CIRCostWarningView* CIRCostWarningView::NewL(const TRect& aRect)
       
    65     {
       
    66     IRLOG_DEBUG("CIRCostWarningView::NewL - Entering" );
       
    67     CIRCostWarningView* self = CIRCostWarningView::NewLC(aRect);
       
    68     CleanupStack::Pop(self);
       
    69     IRLOG_DEBUG( "CIRCostWarningView::NewL - Exiting." );
       
    70     return self;
       
    71     }
       
    72 // ---------------------------------------------------------------------------
       
    73 // Two-phased constructor.
       
    74 // CIRCostWarningView::NewLC
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 CIRCostWarningView* CIRCostWarningView::NewLC(const TRect & aRect)
       
    78     {
       
    79        
       
    80     IRLOG_DEBUG( "CIRCostWarningView::NewLC - Entering" );
       
    81     CIRCostWarningView* self = new (ELeave) CIRCostWarningView();
       
    82     CleanupStack::PushL(self);
       
    83     self->ConstructL(aRect);
       
    84     IRLOG_DEBUG( "CIRCostWarningView::NewLC - Exiting." );
       
    85     return self;
       
    86     }
       
    87 
       
    88     
       
    89 // ---------------------------------------------------------------------------
       
    90 // Destructor
       
    91 // ---------------------------------------------------------------------------
       
    92 //
       
    93 CIRCostWarningView::~CIRCostWarningView()
       
    94     {
       
    95     IRLOG_DEBUG( "CIRCostWarningView::~CIRCostWarningView - Entering" );
       
    96     if ( iContainer )
       
    97         {
       
    98         AppUi()->RemoveFromViewStack( *this, iContainer );
       
    99         delete iContainer;
       
   100         iContainer=NULL;
       
   101         }
       
   102     IRLOG_DEBUG( "CIRCostWarningView::~CIRCostWarningView - Exiting" );
       
   103     }
       
   104 
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 // From class CAknView.
       
   108 // Returns view id.
       
   109 // ---------------------------------------------------------------------------
       
   110 //
       
   111 TUid CIRCostWarningView::Id() const
       
   112     {
       
   113     IRLOG_DEBUG( "CIRCostWarningView::Id" );
       
   114     return KIRCostWarningViewId;
       
   115     }
       
   116 
       
   117 
       
   118 // ---------------------------------------------------------------------------
       
   119 // From class CAknView.
       
   120 // Handles view activation.
       
   121 // ---------------------------------------------------------------------------
       
   122 //
       
   123 void CIRCostWarningView::DoActivateL( const TVwsViewId& /*aPrevViewId*/, 
       
   124         TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/ )
       
   125     {
       
   126     IRLOG_DEBUG( "CIRCostWarningView::DoActivateL - Entering" );
       
   127     //Create the instance of the container
       
   128     CIRUi* ui = reinterpret_cast<CIRUi*>( AppUi() );
       
   129 	ui->iPresentViewID = KIRCostWarningViewId;
       
   130     iContainer = CIRCostWarningContainer::NewL(ClientRect(),*this);
       
   131     HBufC* stringholder = StringLoader::LoadLC( R_IRAPP_COST_WARNING_TITLE );
       
   132     static_cast<CAknTitlePane*>( StatusPane()->
       
   133                                  ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) )->
       
   134                                  SetTextL( *stringholder );
       
   135     CleanupStack::PopAndDestroy(stringholder);
       
   136     iContainer->SetMopParent(this);
       
   137     AppUi()->AddToStackL( *this, iContainer ); 
       
   138     IRLOG_DEBUG( "CIRCostWarningView::DoActivateL - Exiting" );
       
   139     }
       
   140 
       
   141 
       
   142 // ---------------------------------------------------------------------------
       
   143 // From class CAknView.
       
   144 // Handles view deactivation.
       
   145 // ---------------------------------------------------------------------------
       
   146 //
       
   147 void CIRCostWarningView::DoDeactivate()
       
   148     {
       
   149     IRLOG_DEBUG( "CIRCostWarningView::DoDeactivate - Exiting" );
       
   150     CIRUi* appUi = static_cast<CIRUi*>( AppUi() );
       
   151    
       
   152     if ( iContainer )
       
   153         {
       
   154         appUi->RemoveFromViewStack( *this, iContainer );
       
   155         iContainer->MakeVisible( EFalse );
       
   156         delete iContainer;
       
   157         iContainer = NULL;
       
   158         }
       
   159     IRLOG_DEBUG( "CIRCostWarningView::DoDeactivate - Exiting" );
       
   160     }
       
   161 
       
   162 
       
   163 // ---------------------------------------------------------------------------
       
   164 // From class CAknView.
       
   165 // Command handling function.
       
   166 // ---------------------------------------------------------------------------
       
   167 //
       
   168 void CIRCostWarningView::HandleCommandL( TInt aCommand )
       
   169 {
       
   170 IRLOG_DEBUG( "CIRCostWarningView::HandleCommandL - Entering" );
       
   171   	switch(aCommand)
       
   172 	{
       
   173 	case EIRAccept:
       
   174      	{   
       
   175 	    iContainer->TandCAcceptL();
       
   176         break;        
       
   177 	    }
       
   178     case EIRContinue:
       
   179 		{
       
   180 		iContainer->CostWarningContinueL();
       
   181 		break;		
       
   182 		}
       
   183     default: 
       
   184 		{
       
   185 		AppUi()->HandleCommandL(aCommand);
       
   186 		break;
       
   187 		}
       
   188 	}
       
   189   	IRLOG_DEBUG( "CIRCostWarningView::HandleCommandL - Exiting" );
       
   190 }
       
   191 
       
   192 
       
   193 // ---------------------------------------------------------------------------
       
   194 // From class CAknView.
       
   195 // Event handler for status pane size changes.
       
   196 // ---------------------------------------------------------------------------
       
   197 //
       
   198 void CIRCostWarningView::HandleStatusPaneSizeChange()
       
   199     {
       
   200     IRLOG_DEBUG( "CIRCostWarningView::HandleStatusPaneSizeChange - Entering" );
       
   201     // the client rect is also set here after screen orientation change
       
   202     CAknView::HandleStatusPaneSizeChange();
       
   203     if ( iContainer )
       
   204         {
       
   205         iContainer->SetRect( ClientRect() );
       
   206         }
       
   207     IRLOG_DEBUG( "CIRCostWarningView::HandleStatusPaneSizeChange - Exiting" );
       
   208     }
       
   209