examples/SFExamples/RecipeEx/src/DeviceCapsView.cpp

00001 // Symbian Foundation Example Code
00002 // 
00003 // This software is in the public domain. No copyright is claimed, and you 
00004 // may use it for any purpose without license from the Symbian Foundation.
00005 // No warranty for any purpose is expressed or implied by the authors or
00006 // the Symbian Foundation. 
00007 
00008 
00009 // Includes
00010 #include <aknviewappui.h>
00011 #include <avkon.hrh>
00012 #include <RecipeEx_0xE8FAA390.rsg>
00013 #include "DeviceCapsView.h"
00014 #include "LogContainer.h" 
00015 #include "RecipeEx.hrh"
00016 #include "MainView.h" // KMainViewId
00017 #include "DeviceCapabilitiesScan.h"
00018 
00019 
00020 // ================= MEMBER FUNCTIONS =======================
00021 
00023 CDeviceCapsView* CDeviceCapsView::NewL()
00024         {
00025         CDeviceCapsView* self = CDeviceCapsView::NewLC();
00026         CleanupStack::Pop( self );
00027         return self;
00028         }
00029 
00031 CDeviceCapsView* CDeviceCapsView::NewLC()
00032         {
00033         CDeviceCapsView* self = new ( ELeave ) CDeviceCapsView;
00034         CleanupStack::PushL( self );
00035         self->ConstructL();
00036         return self;
00037         }
00038 
00040 void CDeviceCapsView::ConstructL()
00041     {
00042     BaseConstructL( R_DEVICE_CAPS_VIEW );
00043     }
00044 
00046 CDeviceCapsView::~CDeviceCapsView()
00047     {
00048         if (iDeviceCapabilitiesScan)
00049                 {
00050                 delete iDeviceCapabilitiesScan;
00051                 }
00052         
00053     if (iLogContainer)
00054         {
00055         AppUi()->RemoveFromViewStack(*this, iLogContainer);
00056         }
00057 
00058     delete iLogContainer;
00059     }
00060 
00062 TUid CDeviceCapsView::Id() const
00063     {
00064     return KDeviceCapsViewId;
00065     }
00066 
00073 void CDeviceCapsView::HandleCommandL(TInt aCommand)
00074     {   
00075     switch ( aCommand )
00076         {
00077         case EStartDeviceCapsRetrieval:
00078                 {
00079             if (iDeviceCapabilitiesScan)
00080                 {
00081                         iDeviceCapabilitiesScan->Start();
00082                 }
00083                 break;
00084                 }       
00085         case EAknSoftkeyBack:
00086                 {
00087             AppUi()->ActivateLocalViewL(KMainViewId);
00088                 break;
00089                 }       
00090         default:
00091             {
00092             AppUi()->HandleCommandL( aCommand );
00093             break;
00094             }
00095         }
00096     }
00097 
00108 void CDeviceCapsView::DoActivateL(
00109    const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
00110    const TDesC8& /*aCustomMessage*/)
00111         {
00112     if (!iLogContainer)
00113         {
00114         iLogContainer = CLogContainer::NewL(ClientRect());
00115         iLogContainer->SetMopParent(this);
00116         AppUi()->AddToStackL( *this, iLogContainer );
00117 
00119         _LIT(KProgress, "Options Start to continue...");
00120         iLogContainer->LogEntryL(KProgress);        
00121         } 
00122     if (!iDeviceCapabilitiesScan)
00123         {
00124                 iDeviceCapabilitiesScan = CDeviceCapabilitiesScan::NewL(iLogContainer);
00125         }
00126         }
00127 
00133 void CDeviceCapsView::DoDeactivate()
00134     {
00135     if ( iLogContainer )
00136         {
00137         AppUi()->RemoveFromViewStack( *this, iLogContainer );
00138         }
00139     
00140     delete iLogContainer;
00141     iLogContainer = NULL;
00142     
00143     delete iDeviceCapabilitiesScan;
00144     iDeviceCapabilitiesScan = NULL;
00145     }
00146 
00147 
00148 // End of File
00149 

Generated by  doxygen 1.6.2