tsrc/CenrepEditor/Src/cenrepeditorview1.cpp
changeset 22 496ad160a278
parent 0 f0cf47e981f9
equal deleted inserted replaced
15:ccd8e69b5392 22:496ad160a278
       
     1 /*
       
     2 * Copyright (c) 2005 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:
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <aknmessagequerydialog.h>
       
    20 #include <aknquerydialog.h>
       
    21 #include <aknnotewrappers.h>
       
    22 #include  <aknviewappui.h>
       
    23 #include  <avkon.hrh>
       
    24 #include  <cenrepeditor.rsg>
       
    25 #include "cenrepeditorappui.h"
       
    26 #include  "cenrepeditordocument.h"
       
    27 #include  "cenrepeditormodel.h"
       
    28 #include  "cenrepeditorview1.h"
       
    29 #include  "cenrepeditorview1container.h" 
       
    30 
       
    31 // ================= MEMBER FUNCTIONS =======================
       
    32 
       
    33 // ---------------------------------------------------------
       
    34 // CCenrepEditorView1::ConstructL(const TRect& aRect)
       
    35 // EPOC two-phased constructor
       
    36 // ---------------------------------------------------------
       
    37 //
       
    38 void CCenrepEditorView1::ConstructL()
       
    39     {
       
    40     BaseConstructL( R_CENREPEDITOR_VIEW1 );
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------
       
    44 // CCenrepEditorView1::~CCenrepEditorView1()
       
    45 // destructor
       
    46 // ---------------------------------------------------------
       
    47 //
       
    48 CCenrepEditorView1::~CCenrepEditorView1()
       
    49     {
       
    50     if ( iContainer )
       
    51         {
       
    52         AppUi()->RemoveFromViewStack( *this, iContainer );
       
    53         }
       
    54 
       
    55     delete iContainer;
       
    56     }
       
    57 
       
    58 // ---------------------------------------------------------
       
    59 // TUid CCenrepEditorView1::Id()
       
    60 //
       
    61 // ---------------------------------------------------------
       
    62 //
       
    63 TUid CCenrepEditorView1::Id() const
       
    64     {
       
    65     return KViewId1;
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------
       
    69 // CCenrepEditorView1::HandleCommandL(TInt aCommand)
       
    70 // takes care of view command handling
       
    71 // ---------------------------------------------------------
       
    72 //
       
    73 void CCenrepEditorView1::HandleCommandL(TInt aCommand)
       
    74     {      
       
    75     
       
    76             
       
    77      
       
    78         
       
    79        	iContainer->StoreSettingsL();
       
    80  
       
    81  	   CPhoneResources * phoneResources = static_cast<CCenrepEditorAppUi*>(AppUi())->PhoneResouces();
       
    82         TRAPD(err,phoneResources->SaveL());
       
    83         
       
    84         TBuf<50> buf;
       
    85        
       
    86         if(err)               
       
    87             {
       
    88             CAknErrorNote *dlg = new CAknErrorNote(ETrue); 
       
    89             buf.Copy(_L("Unable to Save "));
       
    90             buf.AppendNum(err);
       
    91             dlg->ExecuteLD(buf);                
       
    92             } 
       
    93         else
       
    94             {
       
    95         	CAknInformationNote *dlg = new CAknInformationNote(ETrue); 
       
    96             buf.Copy(_L("Saved"));
       
    97        		dlg->ExecuteLD(buf);   
       
    98             }                  
       
    99 
       
   100     
       
   101         AppUi()->HandleCommandL( aCommand );
       
   102            
       
   103     }
       
   104 
       
   105 // ---------------------------------------------------------
       
   106 // CCenrepEditorView1::HandleClientRectChange()
       
   107 // ---------------------------------------------------------
       
   108 //
       
   109 void CCenrepEditorView1::HandleClientRectChange()
       
   110     {
       
   111     if ( iContainer )
       
   112         {
       
   113         iContainer->SetRect( ClientRect() );
       
   114         }
       
   115     }
       
   116     
       
   117 CCenrepEditorView1Container * CCenrepEditorView1::Container()
       
   118 {
       
   119 	return iContainer;
       
   120 }
       
   121 // ---------------------------------------------------------
       
   122 // CCenrepEditorView1::DoActivateL(...)
       
   123 // 
       
   124 // ---------------------------------------------------------
       
   125 //
       
   126 void CCenrepEditorView1::DoActivateL(
       
   127    const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
       
   128    const TDesC8& /*aCustomMessage*/)
       
   129     {
       
   130     CCenrepEditorAppUi* appUI= static_cast<CCenrepEditorAppUi*>(iEikonEnv->EikAppUi());
       
   131     CPhoneResources* phoneResources=appUI->PhoneResouces();   
       
   132     if (!iContainer)
       
   133         {
       
   134         iContainer = new (ELeave) CCenrepEditorView1Container;
       
   135         iContainer->SetMopParent(this);
       
   136         iContainer->ConstructL( ClientRect(),R_PHONE_RESOURCE_DETAILS_SETTINGS_LIST, phoneResources);
       
   137         AppUi()->AddToViewStackL( *this, iContainer );        
       
   138         iContainer->MakeVisible( ETrue ); 
       
   139         }  
       
   140                  
       
   141     iContainer->DrawNow();
       
   142    }
       
   143 
       
   144 // ---------------------------------------------------------
       
   145 // CCenrepEditorView1::DoDeactivate()
       
   146 // 
       
   147 // ---------------------------------------------------------
       
   148 //
       
   149 void CCenrepEditorView1::DoDeactivate()
       
   150     {
       
   151     if ( iContainer )
       
   152         {
       
   153         AppUi()->RemoveFromViewStack( *this, iContainer );
       
   154         }
       
   155     
       
   156     delete iContainer;
       
   157     iContainer = NULL;
       
   158     }
       
   159 
       
   160 // End of File
       
   161