phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccappviewpluginaknview.cpp
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 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:  CAknView tailored for the needs of CCApp plugins.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "ccapputilheaders.h"
       
    21 
       
    22 // ========================= MEMBER FUNCTIONS ================================
       
    23 
       
    24 // ---------------------------------------------------------------------------
       
    25 // CCCAppViewPluginAknView::CCCAppViewPluginAknView
       
    26 // ---------------------------------------------------------------------------
       
    27 //
       
    28 EXPORT_C CCCAppViewPluginAknView::CCCAppViewPluginAknView()
       
    29     : iResourceLoader( *iCoeEnv )
       
    30     {
       
    31     CCA_DP(KCCAppUtilLogFile, CCA_L("CCCAppViewPluginAknView::CCCAppViewPluginAknView()"));    
       
    32     }
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // CCCAppViewPluginAknView::~CCCAppViewPluginAknView
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 EXPORT_C CCCAppViewPluginAknView::~CCCAppViewPluginAknView()
       
    39     {
       
    40     CCA_DP(KCCAppUtilLogFile, CCA_L("CCCAppViewPluginAknView::~CCCAppViewPluginAknView()"));    
       
    41     iResourceLoader.Close(); 
       
    42     DeleteContainerIfExists();   
       
    43     }
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // CCCAppViewPluginAknView::DoActivateL
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 EXPORT_C void CCCAppViewPluginAknView::DoActivateL( const TVwsViewId& /*aPrevViewId*/,
       
    50                                         TUid /*aCustomMessageId*/,
       
    51                                         const TDesC8& /*aCustomMessage*/ )
       
    52     {
       
    53     CCA_DP(KCCAppUtilLogFile, CCA_L("->CCCAppViewPluginAknView::DoActivateL()"));    
       
    54     DeleteContainerIfExists();
       
    55     TRAPD( error, CreateContainerL());
       
    56     if( KErrNone != error )
       
    57         {// Creating of container failed, cleanup and try to recover
       
    58         CCA_DP(KCCAppUtilLogFile, CCA_L("::DoActivateL() - CreateContainerL failed: %d"), error);    
       
    59         delete iContainer;
       
    60         iContainer = NULL;
       
    61         static_cast<CCCAAppAppUi*>(AppUi())->RecoverFromBadPluginL(); 
       
    62         }
       
    63     else
       
    64         {// Container created ok
       
    65         AppUi()->AddToViewStackL( *this, iContainer );
       
    66         }
       
    67     CCA_DP(KCCAppUtilLogFile, CCA_L("<-CCCAppViewPluginAknView::DoActivateL()"));    
       
    68     }
       
    69 
       
    70 // ---------------------------------------------------------------------------
       
    71 // CCCAppViewPluginAknView::DoDeactivate
       
    72 // ---------------------------------------------------------------------------
       
    73 //
       
    74 EXPORT_C void CCCAppViewPluginAknView::DoDeactivate()
       
    75     {
       
    76     CCA_DP(KCCAppUtilLogFile, CCA_L("CCCAppViewPluginAknView::DoDeactivate()"));    
       
    77     DeleteContainerIfExists();
       
    78     }
       
    79 
       
    80 // ---------------------------------------------------------------------------
       
    81 // CCCAppViewPluginAknView::CreateContainerL
       
    82 // ---------------------------------------------------------------------------
       
    83 //
       
    84 void CCCAppViewPluginAknView::CreateContainerL()
       
    85     {
       
    86     CCA_DP(KCCAppUtilLogFile, CCA_L("->CCCAppViewPluginAknView::CreateContainerL()"));    
       
    87     
       
    88     //Ask container from the plugin
       
    89     NewContainerL();    
       
    90     CCA_DP(KCCAppUtilLogFile, CCA_L("::CreateContainerL() - iContainer available: %d"), iContainer ? 1 : 0 );    
       
    91     User::LeaveIfError( iContainer ? KErrNone : KErrArgument );
       
    92     
       
    93     //Setup container to FW
       
    94     iContainer->SetMopParent( this );
       
    95     CCA_DP(KCCAppUtilLogFile, CCA_L("::CreateContainerL() - iContainer BaseConstructL"));    
       
    96     iContainer->BaseConstructL( ClientRect(), *AppUi() );
       
    97 
       
    98     CCA_DP(KCCAppUtilLogFile, CCA_L("<-CCCAppViewPluginAknView::CreateContainerL()"));    
       
    99     }
       
   100 
       
   101 // ---------------------------------------------------------------------------
       
   102 // CCCAppViewPluginAknView::HandleCommandL
       
   103 // ---------------------------------------------------------------------------
       
   104 //    
       
   105 EXPORT_C void CCCAppViewPluginAknView::HandleCommandL( TInt aCommand )
       
   106     {
       
   107     CCA_DP(KCCAppUtilLogFile, CCA_L("CCCAppViewPluginAknView::HandleCommandL() - aCommand : %d"), aCommand );    
       
   108     AppUi()->HandleCommandL( aCommand );
       
   109     }    
       
   110 
       
   111 // ---------------------------------------------------------------------------
       
   112 // CCCAppViewPluginAknView::DeleteContainerIfExists
       
   113 // ---------------------------------------------------------------------------
       
   114 //
       
   115 void CCCAppViewPluginAknView::DeleteContainerIfExists()
       
   116     {
       
   117     CCA_DP(KCCAppUtilLogFile, CCA_L("->CCCAppViewPluginAknView::DeleteContainerIfExists()"));    
       
   118 
       
   119     if( iContainer )
       
   120         {
       
   121         AppUi()->RemoveFromViewStack( *this, iContainer );
       
   122         delete iContainer;
       
   123         iContainer = NULL;
       
   124         CCA_DP(KCCAppUtilLogFile, CCA_L("::DeleteContainerIfExists() - container deleted"));    
       
   125         }
       
   126 
       
   127     CCA_DP(KCCAppUtilLogFile, CCA_L("<-CCCAppViewPluginAknView::DeleteContainerIfExists()"));    
       
   128     }
       
   129 
       
   130 // ---------------------------------------------------------------------------
       
   131 // CCCAppViewPluginAknView::SetTitleL
       
   132 // ---------------------------------------------------------------------------
       
   133 //    
       
   134 EXPORT_C void CCCAppViewPluginAknView::SetTitleL( const TDesC& aTitle )
       
   135     {	
       
   136     CCA_DP(KCCAppUtilLogFile, CCA_L("CCCAppViewPluginAknView::SetTitleL() - aTitle : %S"), &aTitle );
       
   137     static_cast<CCCAAppAppUi*>( AppUi() )->SetTitleL( aTitle );	
       
   138     }  
       
   139 
       
   140 //End of File