voipplugins/accountcreationplugin/src/acpproviderspecificview.cpp
changeset 0 a4daefaec16c
equal deleted inserted replaced
-1:000000000000 0:a4daefaec16c
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  Implements CAcpProviderSpecificView methods
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <aknlists.h>
       
    20 #include <akntitle.h>
       
    21 #include <akncontext.h> 
       
    22 #include <aknViewAppUi.h>
       
    23 #include <StringLoader.h>
       
    24 #include <accountcreationplugin.rsg>
       
    25 // Help launcher
       
    26 #include <hlplch.h> 
       
    27 
       
    28 #include "acpdialog.h"
       
    29 #include "acpcontroller.h"
       
    30 #include "acpproviderlistview.h"
       
    31 #include "acpproviderspecificview.h"
       
    32 #include "acpproviderspecificcontainer.h"
       
    33 #include "accountcreationpluginlogger.h"
       
    34 #include "accountcreationplugin.hrh"
       
    35 
       
    36 // ---------------------------------------------------------------------------
       
    37 // AcpProviderSpecificView::CAcpProviderSpecificView
       
    38 // ---------------------------------------------------------------------------
       
    39 //
       
    40 CAcpProviderSpecificView::CAcpProviderSpecificView(
       
    41     CAcpController& aController, CAcpProviderListView& aProviderListView )
       
    42     : iController( aController ), iProviderListView( aProviderListView )
       
    43     {
       
    44     }
       
    45 
       
    46 // ---------------------------------------------------------------------------
       
    47 // CAcpProviderSpecificView::ConstructL
       
    48 // ---------------------------------------------------------------------------
       
    49 //
       
    50 void CAcpProviderSpecificView::ConstructL()
       
    51     {
       
    52     ACPLOG( "CAcpProviderSpecificView::ConstructL begin" );
       
    53 
       
    54     iUi = static_cast<CAknViewAppUi*>( static_cast<CAknAppUi*> 
       
    55         ( iCoeEnv->AppUi() ) );
       
    56 
       
    57     BaseConstructL( R_ACP_PROVIDER_SPECIFIC_VIEW );
       
    58 
       
    59     ACPLOG( "CAcpProviderSpecificView::ConstructL end" );
       
    60     }
       
    61 
       
    62 // ---------------------------------------------------------------------------
       
    63 // CAcpProviderSpecificView::NewL
       
    64 // ---------------------------------------------------------------------------
       
    65 //      
       
    66 CAcpProviderSpecificView* CAcpProviderSpecificView::NewL(
       
    67     CAcpController& aController, CAcpProviderListView& aProviderListView )
       
    68     {    
       
    69     CAcpProviderSpecificView* self = 
       
    70         CAcpProviderSpecificView::NewLC( aController, aProviderListView );
       
    71     CleanupStack::Pop( self );
       
    72     return self;
       
    73     }
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // CAcpProviderSpecificView::NewLC
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 CAcpProviderSpecificView* CAcpProviderSpecificView::NewLC(
       
    80     CAcpController& aController, CAcpProviderListView& aProviderListView )
       
    81     {    
       
    82     CAcpProviderSpecificView* self = 
       
    83         new ( ELeave ) CAcpProviderSpecificView( 
       
    84         aController, aProviderListView );
       
    85     CleanupStack::PushL( self );
       
    86     self->ConstructL();
       
    87     return self;
       
    88     }
       
    89 
       
    90 // ---------------------------------------------------------------------------
       
    91 // CAcpProviderSpecificView::~CAcpProviderSpecificView
       
    92 // ---------------------------------------------------------------------------
       
    93 //
       
    94 CAcpProviderSpecificView::~CAcpProviderSpecificView()
       
    95     {
       
    96     ACPLOG( "CAcpProviderSpecificView::~CAcpProviderSpecificView begin" );
       
    97 
       
    98     // Delete container when view is deactivated.
       
    99     if ( iContainer && iUi )
       
   100         {
       
   101         iUi->RemoveFromViewStack( *this, iContainer );
       
   102         delete iContainer;
       
   103         }
       
   104 
       
   105     ACPLOG( "CAcpProviderSpecificView::~CAcpProviderSpecificView end" );
       
   106     }         
       
   107 
       
   108 // ---------------------------------------------------------------------------
       
   109 // CAcpProviderSpecificView::SetTitlePaneTextL
       
   110 // For changing text to the title pane.
       
   111 // ---------------------------------------------------------------------------
       
   112 // 
       
   113 void CAcpProviderSpecificView::SetTitlePaneTextL( const TDesC& aText ) const
       
   114     {
       
   115     // Get handle to title pane.
       
   116     CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
       
   117 
       
   118     if ( statusPane )
       
   119         {
       
   120         CAknTitlePane* titlePane =
       
   121             static_cast<CAknTitlePane*> ( statusPane->ControlL(
       
   122                 TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
   123 
       
   124             titlePane->SetTextL( aText ); // Set text. 
       
   125         }
       
   126     }
       
   127 
       
   128 // ---------------------------------------------------------------------------
       
   129 // CAcpProviderSpecificView::Id
       
   130 // From CAknView.
       
   131 // ---------------------------------------------------------------------------
       
   132 //
       
   133 TUid CAcpProviderSpecificView::Id() const
       
   134     {
       
   135     return KProviderSpecificViewId;
       
   136     }
       
   137 
       
   138 // ---------------------------------------------------------------------------
       
   139 // CAcpProviderSpecificView::HandleCommandL
       
   140 // From CEikAppUi.
       
   141 // ---------------------------------------------------------------------------
       
   142 //
       
   143 void CAcpProviderSpecificView::HandleCommandL( TInt aCommand )
       
   144     {
       
   145     ACPLOG2( "CAcpProviderSpecificView::HandleCommandL: cmd=%d", aCommand );
       
   146 
       
   147     switch ( aCommand )
       
   148         {
       
   149         case EAknSoftkeySelect:
       
   150             { 
       
   151             iProviderListView.ProvisioningL();         
       
   152             }
       
   153             break;
       
   154         case EAcpDownload:
       
   155             {
       
   156             iProviderListView.ProvisioningL();  
       
   157             }
       
   158             break;
       
   159         case EAknSoftkeyCancel:
       
   160             iUi->ActivateLocalViewL( KProviderListViewId );
       
   161             break;
       
   162         case EEikCmdExit:
       
   163         case EAknSoftkeyExit:
       
   164             iUi->HandleCommandL( aCommand );
       
   165             break;
       
   166         default:
       
   167             break;
       
   168         }
       
   169     }
       
   170 
       
   171 // ---------------------------------------------------------------------------
       
   172 // CAcpProviderSpecificView::DoActivateL
       
   173 // From CAknView.
       
   174 // ---------------------------------------------------------------------------
       
   175 //
       
   176 void CAcpProviderSpecificView::DoActivateL( 
       
   177     const TVwsViewId& /*aPrevViewId*/, 
       
   178     TUid /*aCustomMessageId*/,
       
   179     const TDesC8& /*aCustomMessage*/ )
       
   180     {
       
   181     ACPLOG( "CAcpProviderSpecificView::DoActivateL begin" );
       
   182 
       
   183     // Create container when view is activated.
       
   184     if ( !iContainer )
       
   185         {
       
   186         iContainer = CAcpProviderSpecificContainer::NewL(
       
   187             iController, ClientRect() );
       
   188         iContainer->SetMopParent( this );
       
   189         iUi->AddToStackL( *this, iContainer );
       
   190         }
       
   191 
       
   192     // Set provider specific name to title pane.
       
   193     TInt index = iController.ActiveIndex();
       
   194     SetTitlePaneTextL( iController.ProviderNameFromIndexL( index ) );
       
   195 
       
   196     ACPLOG( "CAcpProviderSpecificView::DoActivateL end" );
       
   197     }
       
   198 
       
   199 // ---------------------------------------------------------------------------
       
   200 // CAcpProviderSpecificView::DoDeactivate()
       
   201 // From CAknView.
       
   202 // ---------------------------------------------------------------------------
       
   203 //
       
   204 void CAcpProviderSpecificView::DoDeactivate()
       
   205     {
       
   206     ACPLOG( "CAcpProviderSpecificView::DoDeactivate begin" );
       
   207 
       
   208     // Delete container when view is deactivated.
       
   209     if ( iContainer )
       
   210         {
       
   211         iUi->RemoveFromViewStack( *this, iContainer );
       
   212         delete iContainer;
       
   213         iContainer = NULL;
       
   214         }
       
   215 
       
   216     ACPLOG( "CAcpProviderSpecificView::DoDeactivate end" );
       
   217     }
       
   218 
       
   219 // End of file.