00001 /* 00002 * ============================================================================== 00003 * Name : cssyncappui.cpp 00004 * Part of : CSSync 00005 * Interface : 00006 * Description : 00007 * Version : 00008 * 00009 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 00010 * All rights reserved. 00011 * This component and the accompanying materials are made available 00012 * under the terms of "Eclipse Public License v1.0" 00013 * which accompanies this distribution, and is available 00014 * at the URL "http://www.eclipse.org/legal/epl-v10.html". 00015 * ============================================================================== 00016 */ 00017 00018 00019 // INCLUDE FILES 00020 #include <eikmenup.h> 00021 #include <avkon.hrh> 00022 00023 #include "CSSync.pan" 00024 #include "CSSyncAppUi.h" 00025 #include "CSSyncAppView.h" 00026 #include "CSSyncDocument.h" 00027 #include "CSSync.hrh" 00028 00029 00030 // ========================= MEMBER FUNCTIONS ================================== 00031 00032 // ----------------------------------------------------------------------------- 00033 // CCSSyncAppUi::CCSSyncAppUi() 00034 // C++ default constructor can NOT contain any code, that might leave. 00035 // ----------------------------------------------------------------------------- 00036 // 00037 CCSSyncAppUi::CCSSyncAppUi() 00038 { 00039 // No implementation required 00040 } 00041 00042 // ----------------------------------------------------------------------------- 00043 // CCSSyncAppUi::ConstructL() 00044 // Symbian 2nd phase constructor can leave. 00045 // ----------------------------------------------------------------------------- 00046 // 00047 void CCSSyncAppUi::ConstructL() 00048 { 00049 BaseConstructL(); 00050 00051 iAppView = CCSSyncAppView::NewL( ClientRect(), *SyncDocument() ); 00052 00053 AddToStackL( iAppView ); 00054 } 00055 00056 // ----------------------------------------------------------------------------- 00057 // CCSSyncAppUi::~CCSSyncAppUi() 00058 // Destructor. 00059 // ----------------------------------------------------------------------------- 00060 // 00061 CCSSyncAppUi::~CCSSyncAppUi() 00062 { 00063 if ( iAppView ) 00064 { 00065 iEikonEnv->RemoveFromStack( iAppView ); 00066 delete iAppView; 00067 iAppView = NULL; 00068 } 00069 } 00070 00071 // ----------------------------------------------------------------------------- 00072 // CCSSyncAppUi::SyncDocument() 00073 // Casts iDocument member from CAknAppUi to CCSSyncDocument. 00074 // ----------------------------------------------------------------------------- 00075 // 00076 CCSSyncDocument* CCSSyncAppUi::SyncDocument() const 00077 { 00078 return static_cast<CCSSyncDocument*>( iDocument ); 00079 } 00080 00081 // ----------------------------------------------------------------------------- 00082 // CCSSyncAppUi::HandleCommandL() 00083 // Handles user menu selections. 00084 // ----------------------------------------------------------------------------- 00085 // 00086 void CCSSyncAppUi::HandleCommandL( TInt aCommand ) 00087 { 00088 switch( aCommand ) 00089 { 00090 case EEikCmdExit: 00091 case EAknSoftkeyExit: 00092 Exit(); 00093 break; 00094 00095 case EDisplayTime: 00096 // Pull the time from the server 00097 SyncDocument()->UpdateTime(); 00098 00099 // Get view to display the new time 00100 iAppView->DrawNow(); 00101 break; 00102 00103 default: 00104 break; 00105 } 00106 } 00107 00108 // ----------------------------------------------------------------------------- 00109 // CCSSyncAppUi::HandleResourceChangeL( TInt aType ) 00110 // Called by framework when layout is changed. 00111 // ----------------------------------------------------------------------------- 00112 // 00113 void CCSSyncAppUi::HandleResourceChangeL( TInt aType ) 00114 { 00115 CAknAppUi::HandleResourceChangeL( aType ); 00116 00117 if ( aType==KEikDynamicLayoutVariantSwitch ) 00118 { 00119 iAppView->SetRect( ClientRect() ); 00120 } 00121 //Controls derived from CCoeControl, handled in container class 00122 iAppView->HandleResourceChange( aType ); 00123 } 00124 00125 // End of File