basiclocationinfodisplay/blid/ui/src/CBlidSatelliteView.cpp
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  Provides blid main satellite view class methods.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // SYSTEM INCLUDE FILES
       
    20 #include <aknViewAppUi.h>
       
    21 #include <blid.rsg>
       
    22 #include <alf/alfenv.h>
       
    23 #include <alf/alfcontrolgroup.h>
       
    24 #include <alf/alfdisplay.h>
       
    25 #include <alf/alftransformation.h>
       
    26 #include <alf/alfroster.h>
       
    27 // USER INCLUDE FILES
       
    28 #include "CBlidSatelliteView.h"
       
    29 #include "Blid.hrh"
       
    30 #include "CBlidSatelliteControl.h"
       
    31 #include "MBlidLocation.h"
       
    32 #include "CBlidAppUi.h"
       
    33 #include "bliduiconsts.h"
       
    34 #include "BlidNotes.h"
       
    35 #include "Debug.h"
       
    36 
       
    37 //CONSTANTS
       
    38 enum TPanicCode
       
    39     {
       
    40     KBlidNullPointer = 1
       
    41     };
       
    42 
       
    43 // ================= MEMBER FUNCTIONS =======================
       
    44 // ----------------------------------------------------------------------------
       
    45 // CBlidSatelliteView::NewLC( MKeyProcessor& aKeyProcessor )
       
    46 // Two-phased constructor.
       
    47 // ----------------------------------------------------------------------------
       
    48 //
       
    49 CBlidSatelliteView* CBlidSatelliteView::NewLC( MKeyProcessor& aKeyProcessor,
       
    50 									 		   CAlfEnv& aEnv  )
       
    51     {
       
    52     CBlidSatelliteView* self = new (ELeave) CBlidSatelliteView( aKeyProcessor,aEnv );
       
    53     CleanupStack::PushL( self );
       
    54     self->ConstructL();
       
    55     return self;
       
    56     }
       
    57 // ----------------------------------------------------------------------------
       
    58 // CBlidSatelliteView::CBlidSatelliteView
       
    59 // C++ default constructor can NOT contain any code, that
       
    60 // might leave.
       
    61 // ----------------------------------------------------------------------------
       
    62 //
       
    63 CBlidSatelliteView::CBlidSatelliteView( MKeyProcessor& aKeyProcessor ,
       
    64 							  CAlfEnv& aEnv ):
       
    65     CBlidBaseView( aKeyProcessor ),
       
    66     iEnv(aEnv)
       
    67     {
       
    68     }
       
    69 
       
    70 // ----------------------------------------------------------------------------
       
    71 // CBlidSatelliteView::ConstructL
       
    72 // Symbian 2nd phase constructor can leave.
       
    73 // ----------------------------------------------------------------------------
       
    74 //
       
    75 void CBlidSatelliteView::ConstructL()
       
    76     {
       
    77     // Modify the Main view option key
       
    78     BaseConstructL( R_BLID_MAINSAT_VIEW );
       
    79 
       
    80 	// Create an instance of our list control.
       
    81 	iMainSatelliteCtrl = CBlidSatelliteControl::NewL(iEnv, ClientRect(), *this );
       
    82 
       
    83 
       
    84 	// Create a control group.
       
    85 	iMainSatelliteCtrlGroup = &( iEnv.NewControlGroupL( KBlidMainSatelliteGroup ) );
       
    86 
       
    87 	// pass ownership of the list control to the control group
       
    88 	iMainSatelliteCtrlGroup->AppendL( iMainSatelliteCtrl );
       
    89     }
       
    90 
       
    91 // ----------------------------------------------------------------------------
       
    92 // CBlidSatelliteView::~CBlidSatelliteView
       
    93 // Destructor, frees allocated resources
       
    94 // ----------------------------------------------------------------------------
       
    95 //
       
    96 CBlidSatelliteView::~CBlidSatelliteView()
       
    97     {
       
    98     }
       
    99 
       
   100 // ----------------------------------------------------------------------------
       
   101 // CBlidSatelliteView::ProcessKeyEventL
       
   102 // Processes key event
       
   103 // ----------------------------------------------------------------------------
       
   104 //
       
   105 TBool CBlidSatelliteView::ProcessKeyEventL( const TKeyEvent& aKeyEvent,
       
   106     TEventCode aType )
       
   107     {
       
   108     return CBlidBaseView::ProcessKeyEventL( aKeyEvent,aType );
       
   109     }
       
   110 
       
   111 // ----------------------------------------------------------------------------
       
   112 // TUid CBlidSatelliteView::Id
       
   113 // Returns the id of satellite view
       
   114 // ----------------------------------------------------------------------------
       
   115 //
       
   116 TUid CBlidSatelliteView::Id() const
       
   117     {
       
   118     return TUid::Uid( EBlidMainSatelliteView );
       
   119     }
       
   120 
       
   121 // ----------------------------------------------------------------------------
       
   122 // CBlidSatelliteView::HandleCommandL
       
   123 // Handles the option menu commands in satellite view
       
   124 // ----------------------------------------------------------------------------
       
   125 //
       
   126 void CBlidSatelliteView::HandleCommandL(TInt aCommand)
       
   127     {
       
   128     switch ( aCommand )
       
   129         {
       
   130         case EBlidSoftkeyInfo:
       
   131 	        {
       
   132 	        BlidNotes::PoorGPSDataNoteL();
       
   133 	        break;	        	
       
   134 	        }
       
   135         default:
       
   136             {
       
   137             (static_cast<CBlidAppUi*>(AppUi()))->HandleCommandL( aCommand );
       
   138             break;
       
   139             }
       
   140         }
       
   141     }
       
   142 
       
   143 // ----------------------------------------------------------------------------
       
   144 // CBlidSatelliteView::DoActivateL
       
   145 // Called when Satellite view is activated
       
   146 // ----------------------------------------------------------------------------
       
   147 //
       
   148 void CBlidSatelliteView::DoActivateL(
       
   149    const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
       
   150    const TDesC8& /*aCustomMessage*/)
       
   151     {
       
   152     #ifdef _DEBUG
       
   153     RDebug::Print(_L("CBlidSatelliteView::DoActivateL() called"));
       
   154     #endif
       
   155     CAlfDisplay& ctrlDisplay = iEnv.NewDisplayL( ClientRect(), CAlfEnv::ENewDisplayAsCoeControl );
       
   156 	// Use the Avkon skin background as the display background.
       
   157 	ctrlDisplay.SetClearBackgroundL(CAlfDisplay::EClearWithSkinBackground);
       
   158 
       
   159     iLocation->SetObserver( *this, EBlidMainSatelliteView ); 
       
   160     
       
   161     (static_cast<CBlidAppUi*>(AppUi()))->SetSatelliteViewActive( ETrue );
       
   162     
       
   163     iMainSatelliteCtrl->MakeTitleL( R_BLID_TITLE_MAIN );
       
   164 	
       
   165 	ctrlDisplay.Roster().Hide( iEnv.ControlGroup( KBlidMainGroup ) );
       
   166 	
       
   167 	// Show the control group on the display.
       
   168 	ctrlDisplay.Roster().ShowL( *iMainSatelliteCtrlGroup );    
       
   169    }
       
   170 
       
   171 // ----------------------------------------------------------------------------
       
   172 // CBlidSatelliteView::DoDeactivate
       
   173 // Called when satellite view is deactivated
       
   174 // ----------------------------------------------------------------------------
       
   175 //
       
   176 void CBlidSatelliteView::DoDeactivate()
       
   177     {
       
   178 	(static_cast<CBlidAppUi*>(AppUi()))->SetSatelliteViewActive( EFalse );
       
   179     }
       
   180 
       
   181 // ----------------------------------------------------------------------------
       
   182 // CBlidSatelliteView::NotifyL
       
   183 // Called by location model to notify about changes in current location
       
   184 // ----------------------------------------------------------------------------
       
   185 //
       
   186 void CBlidSatelliteView::NotifyL( const TBool aOnlineMode )
       
   187     {
       
   188     DEBUG1(" CBlidSatelliteView::NotifyL called ::%d", aOnlineMode );          
       
   189     if( iMainSatelliteCtrl &&  aOnlineMode )
       
   190         {
       
   191         iMainSatelliteCtrl->UpdateL();
       
   192         iMainSatelliteCtrl->SetOnlineMode( aOnlineMode );
       
   193         }
       
   194     CBlidBaseView::NotifyL( aOnlineMode );
       
   195     }
       
   196 
       
   197 // ----------------------------------------------------------------------------
       
   198 // CBlidSatelliteView::NotifyError
       
   199 // Called by location model to notify about error in current location
       
   200 // ----------------------------------------------------------------------------
       
   201 //
       
   202 void CBlidSatelliteView::NotifyErrorL( TInt aErrorCode )
       
   203     {
       
   204     CBlidBaseView::NotifyErrorL( aErrorCode );    
       
   205     DEBUG1(" CBlidSatelliteView::NotifyErrorL errorcode ::%d", aErrorCode );
       
   206     if( iMainSatelliteCtrl )
       
   207         {
       
   208         iMainSatelliteCtrl->UpdateL();
       
   209         iMainSatelliteCtrl->SetErrorCode( aErrorCode );
       
   210         }
       
   211     }
       
   212 
       
   213 // ----------------------------------------------------------
       
   214 // CBlidSatelliteView::HandleResourceChangeL
       
   215 // Handle Resource Change Events: Display orientation switch
       
   216 // ----------------------------------------------------------
       
   217 //
       
   218 void CBlidSatelliteView::HandleResourceChangeL( TInt aType )
       
   219     {
       
   220     if(aType == KEikDynamicLayoutVariantSwitch)
       
   221         {
       
   222         TRect rect;
       
   223         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
       
   224         
       
   225         iMainSatelliteCtrl->UpdateDisplayLayoutL();
       
   226         // Notify skin of changed display size.
       
   227         iEnv.PrimaryDisplay().SetVisibleArea(rect);
       
   228         }
       
   229     }
       
   230 
       
   231 /**
       
   232  * 
       
   233  */
       
   234 CBlidSatelliteControl* CBlidSatelliteView::GetControl()
       
   235     {
       
   236     return iMainSatelliteCtrl;
       
   237     }
       
   238         
       
   239 #ifdef RD_SCALABLE_UI_V2
       
   240 // ---------------------------------------------------------------------------
       
   241 // CBlidNavigationView::HandleListBoxSelectionL
       
   242 // Handles the listbox selection
       
   243 // ---------------------------------------------------------------------------
       
   244 //
       
   245 void CBlidSatelliteView::HandleListBoxSelectionL()
       
   246     {
       
   247     //Do something if needed
       
   248     }
       
   249 #endif //RD_SCALABLE_UI_V2    
       
   250 // End of File
       
   251 
       
   252