Nokia N97 SDK
Example Applications Guide

datamobilityappui.cpp

00001 /*
00002 * ==============================================================================
00003 *  Name        : datamobilityappui.cpp
00004 *  Part of     : datamobility
00005 *  Description : CDataMobilityAppUi implementation
00006 *
00007 *  Copyright (c) 2007 Nokia Corporation.
00008 *  This material, including documentation and any related
00009 *  computer programs, is protected by copyright controlled by
00010 *  Nokia Corporation.
00011 * ==============================================================================
00012 */
00013 
00014 // INCLUDE FILES
00015 #include <avkon.hrh>
00016 #include <aknnotewrappers.h>
00017 #include <stringloader.h>
00018 #include <f32file.h>
00019 #include <s32file.h>
00020 
00021 #include "datamobility.pan"
00022 #include "datamobilityappui.h"
00023 #include "datamobilityappmenuview.h"
00024 #include "datamobilityappoutputview.h"
00025 #include "datamobility.hrh"
00026 
00027 // ============================ MEMBER FUNCTIONS ===============================
00028 
00029 
00030 // -----------------------------------------------------------------------------
00031 // CDataMobilityAppUi::ConstructL()
00032 // Symbian 2nd phase constructor can leave.
00033 // -----------------------------------------------------------------------------
00034 //
00035 void CDataMobilityAppUi::ConstructL()
00036     {
00037     // Initialise app UI with standard value.
00038     BaseConstructL();
00039 
00040     // Create view objects
00041     CDataMobilityAppMenuView* menuView = CDataMobilityAppMenuView::NewL();
00042     CleanupStack::PushL( menuView );
00043     AddViewL( menuView );      // transfer ownership to CAknViewAppUi
00044     CleanupStack::Pop( menuView );
00045 
00046     CDataMobilityAppOutputView* outputView = CDataMobilityAppOutputView::NewL();
00047     CleanupStack::PushL( outputView );
00048     AddViewL( outputView );      // transfer ownership to CAknViewAppUi
00049     CleanupStack::Pop( outputView );
00050 
00051     SetDefaultViewL( *menuView );
00052     }
00053 
00054 // -----------------------------------------------------------------------------
00055 // CDataMobilityAppUi::CDataMobilityAppUi()
00056 // C++ default constructor can NOT contain any code, that might leave.
00057 // -----------------------------------------------------------------------------
00058 //
00059 CDataMobilityAppUi::CDataMobilityAppUi()
00060     {
00061     // No implementation required
00062     }
00063 
00064 // -----------------------------------------------------------------------------
00065 // CDataMobilityAppUi::~CDataMobilityAppUi()
00066 // Destructor.
00067 // -----------------------------------------------------------------------------
00068 //
00069 CDataMobilityAppUi::~CDataMobilityAppUi()
00070     {
00071     }
00072 
00073 // -----------------------------------------------------------------------------
00074 // CDataMobilityAppUi::HandleCommandL()
00075 // Takes care of command handling.
00076 // -----------------------------------------------------------------------------
00077 //
00078 void CDataMobilityAppUi::HandleCommandL( TInt aCommand )
00079     {
00080     TInt currentView( 0 );
00081     TInt newView( 0 );
00082 
00083     currentView = ( iView->Id() ).iUid;
00084 
00085     switch( aCommand )
00086         {
00087         case EEikCmdExit:
00088         case EAknSoftkeyExit:
00089             {
00090             Exit();
00091             break;
00092             }
00093         case EAppUIGoBack:
00094         case EAppUIGoToMenu:
00095             {
00096             newView = EMenuViewId;
00097             break;
00098             }
00099         case EAppUIGoToStandardApplication:
00100         case EAppUIGoToApplicationUsingSnap:
00101         case EAppUIGoToTriggeringConnectionDialog:
00102         case EAppUIGoToALRApplication:
00103         case EAppUIGoToALRApplicationUsingDefaultConnection:
00104         case EAppUIGoToUsingConnectionSetting:
00105             {
00106             newView = EOutputViewId;
00107             break;
00108             }
00109         default:
00110             // let the framework handle it
00111             return;
00112         }
00113 
00114     if( newView != currentView )
00115         {
00116         TBufC8<1> aBuf;
00117         ActivateLocalViewL( TUid::Uid( newView ), TUid::Uid( aCommand ), aBuf );
00118         }
00119     }
00120 
00121 // End of File

© Nokia 2009

Back to top