extras/calcsoft/src/CalcView.cpp
branchRCL_3
changeset 22 0f21a5ec0db7
parent 19 99b535de1dda
equal deleted inserted replaced
21:a7d8840c0b8c 22:0f21a5ec0db7
    73     BaseConstructL(R_CALC_VIEW_INFO);
    73     BaseConstructL(R_CALC_VIEW_INFO);
    74     
    74     
    75     iCalcDocument = STATIC_CAST(CCalcDocument*, AppUi()->Document());
    75     iCalcDocument = STATIC_CAST(CCalcDocument*, AppUi()->Document());
    76 
    76 
    77     iCalcDocument->SetCalcView( this );
    77     iCalcDocument->SetCalcView( this );
    78     CreateContainerL();
    78 
    79     iCalcDocument->LoadStateL();
    79     iCalcDocument->LoadStateL();
    80    
    80    
    81     /******** Initialize the ServiceHandler in the ConstructL *****/
    81     /******** Initialize the ServiceHandler in the ConstructL *****/
    82     
    82     
    83     iServiceHandler = CAiwServiceHandler::NewL();
    83     iServiceHandler = CAiwServiceHandler::NewL();
    90     }
    90     }
    91 
    91 
    92 // Destructor
    92 // Destructor
    93 CCalcView::~CCalcView()
    93 CCalcView::~CCalcView()
    94     {
    94     {
    95     delete iContainer;
    95     if ( iContainer )
    96       if(iServiceHandler)
    96         {
    97       {
    97         delete iContainer;
    98             delete iServiceHandler;
    98         iContainer = NULL;
    99             iServiceHandler = NULL;
    99         }
   100       }
   100 
       
   101     if( iServiceHandler )
       
   102         {
       
   103         delete iServiceHandler;
       
   104         iServiceHandler = NULL;
       
   105         }
   101      
   106      
   102      }
   107      }
   103 
   108 
   104 // ---------------------------------------------------------
   109 // ---------------------------------------------------------
   105 // CCalcView::State
   110 // CCalcView::State
  1037 void CCalcView::DoActivateL
  1042 void CCalcView::DoActivateL
  1038                 (const TVwsViewId& /* aPrevViewId */,
  1043                 (const TVwsViewId& /* aPrevViewId */,
  1039                  TUid /* aCustomMessageId */,
  1044                  TUid /* aCustomMessageId */,
  1040                  const TDesC8& /* aCustomMessage */)
  1045                  const TDesC8& /* aCustomMessage */)
  1041     {
  1046     {
  1042     AppUi()->AddToStackL(*this, iContainer);
  1047     if ( iContainer == NULL )
  1043     iContainer->ActivateL();
  1048         {
       
  1049         CreateContainerL();
       
  1050         AppUi()->AddToStackL( *this, iContainer );
       
  1051         iContainer->ActivateL();
       
  1052         } 
       
  1053     
  1044     }
  1054     }
  1045 
  1055 
  1046 // ----------------------------------------------------
  1056 // ----------------------------------------------------
  1047 // CCalcView::DoDeactivate
  1057 // CCalcView::DoDeactivate
  1048 // This is called when CCalcView becomes deactive.
  1058 // This is called when CCalcView becomes deactive.
  1049 // (other items were commented in a header).
  1059 // (other items were commented in a header).
  1050 // ----------------------------------------------------
  1060 // ----------------------------------------------------
  1051 //
  1061 //
  1052 void CCalcView::DoDeactivate()
  1062 void CCalcView::DoDeactivate()
  1053     {
  1063     {
  1054     if (iContainer)
  1064     if ( iContainer )
  1055         {
  1065         {
  1056         AppUi()->RemoveFromStack(iContainer);
  1066         AppUi()->RemoveFromStack( iContainer );
       
  1067         delete iContainer;
       
  1068         iContainer = NULL;
  1057         }
  1069         }
  1058     }
  1070     }
  1059 
  1071 
  1060 // ---------------------------------------------------------
  1072 // ---------------------------------------------------------
  1061 // CCalcView::Id
  1073 // CCalcView::Id