mediasettings/mediasettingsapp/src/MPSettingsStreamingView.cpp
branchRCL_3
changeset 10 ce5ada96ab30
parent 1 6711b85517b7
equal deleted inserted replaced
6:7d91903f795f 10:ce5ada96ab30
    13 *
    13 *
    14 * Description:   View class for Streaming list view.*
    14 * Description:   View class for Streaming list view.*
    15 */
    15 */
    16 
    16 
    17 
    17 
    18 // Version : %version: 7 %
    18 // Version : %version: 8 %
    19 
    19 
    20 
    20 
    21 
    21 
    22 // INCLUDE FILES
    22 // INCLUDE FILES
    23 #include    <aknViewAppUi.h>
    23 #include    <aknViewAppUi.h>
    24 #include    <MediaSettings.rsg>
    24 #include    <MediaSettings.rsg>
    25 #include    <calslbs.h>
    25 #include    <calslbs.h>
    26 #include    <featmgr.h>
    26 #include    <featmgr.h>
    27 #include    <hlplch.h>             // For HlpLauncher
    27 #include    <hlplch.h>             // For HlpLauncher
    28 #include    "mediasettings.hrh"
    28 #include    "mediasettings.hrh"
       
    29 #include    "MPSettingsAppUi.h"
    29 #include    "MPSettingsNaviPaneController.h"
    30 #include    "MPSettingsNaviPaneController.h"
    30 #include    "MPSettingsStreamingView.h"
    31 #include    "MPSettingsStreamingView.h"
    31 #include    "MPSettingsStreamingContainer.h"
    32 #include    "MPSettingsStreamingContainer.h"
    32 #include    "MPSettingsConstants.h" 
    33 #include    "MPSettingsConstants.h" 
    33 #include    "mpxlog.h"
    34 #include    "mpxlog.h"
    34 
    35 
    35 class CMPSettingsModelForROP;
    36 class CMPSettingsModelForROP;
    36 
    37 
    37 // CONSTANTS
       
    38 
       
    39 const   TInt    KMPSettProxyViewListItemId  =   0;
       
    40 const   TInt    KMPSettNetworkViewListItemId  =   1;
       
    41 
    38 
    42 // ================= MEMBER FUNCTIONS =======================
    39 // ================= MEMBER FUNCTIONS =======================
    43 
    40 
    44 // -----------------------------------------------------------------------------
    41 // -----------------------------------------------------------------------------
    45 // CMPSettingsStreamingView::CMPSettingsStreamingView
    42 // CMPSettingsStreamingView::CMPSettingsStreamingView
    46 // C++ default constructor can NOT contain any code, that
    43 // C++ default constructor can NOT contain any code, that
    47 // might leave.
    44 // might leave.
    48 // -----------------------------------------------------------------------------
    45 // -----------------------------------------------------------------------------
    49 //
    46 //
    50 CMPSettingsStreamingView::CMPSettingsStreamingView(CMPSettingsModelForROP* aModel) : iModel( aModel)
    47 CMPSettingsStreamingView::CMPSettingsStreamingView(CMPSettingsModelForROP* aModel) 
       
    48     : iModel( aModel)
    51     {
    49     {
    52         MPX_FUNC("#MS# CMPSettingsStreamingView::CMPSettingsStreamingView()");
    50     MPX_FUNC("#MS# CMPSettingsStreamingView::CMPSettingsStreamingView()");
    53         iNaviPaneContext = iNaviCntrl->MPTabGroup();
    51     iNaviPaneContext = iNaviCntrl->MPTabGroup();
    54     }
    52     }
    55 
    53 
    56 // ---------------------------------------------------------
    54 // ---------------------------------------------------------
    57 // CMPSettingsStreamingView::ConstructL(const TRect& aRect)
    55 // CMPSettingsStreamingView::ConstructL(const TRect& aRect)
    58 // Symbian OS two-phased constructor
    56 // Symbian OS two-phased constructor
   107 void CMPSettingsStreamingView::HandleCommandL(TInt aCommand)
   105 void CMPSettingsStreamingView::HandleCommandL(TInt aCommand)
   108     {   
   106     {   
   109     MPX_DEBUG2(_L("#MS# CMPSettingsStreamingView::HandleCommandL(%d)"),aCommand);
   107     MPX_DEBUG2(_L("#MS# CMPSettingsStreamingView::HandleCommandL(%d)"),aCommand);
   110     switch (aCommand)
   108     switch (aCommand)
   111         {
   109         {
       
   110         case EMPSettCmdChange:
       
   111             static_cast<CMPSettingsStreamingContainer*>(iContainer)->EditCurrentItemFromMenuL(ETrue);
       
   112             break;
       
   113         case EMPMiddleSoftKeyChange:
       
   114             static_cast<CMPSettingsStreamingContainer*>(iContainer)->EditCurrentItemFromMenuL(EFalse);
       
   115             break;  
       
   116         case EMPSettCmdAdvancedSett:
       
   117             AppUi()->ActivateLocalViewL( KMPSettAdvancedBwViewId );
       
   118             break;            
   112         case EMPSettCmdOpen:
   119         case EMPSettCmdOpen:
   113             HandleListBoxSelectionL();
       
   114             break;
   120             break;
   115         case EAknSoftkeyBack:
   121         case EAknSoftkeyBack:
   116             AppUi()->ActivateLocalViewL(KMPSettMainViewId);
   122             {
       
   123             // If video view is empty, then exit Settings
       
   124             CMPSettingsAppUi* appUi = static_cast<CMPSettingsAppUi*>(AppUi());
       
   125             appUi->ActivateLocalViewL( KMPSettMainViewId );
       
   126             }
   117             break;
   127             break;
   118         case EMPSettCmdHelp:
   128         case EMPSettCmdHelp:
   119             if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
   129             if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
   120             {
   130                 {
   121                 HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), AppUi()->AppHelpContextL() );
   131                 HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), AppUi()->AppHelpContextL() );
   122             }
   132                 }
   123             break;
   133             break;
   124         default:
   134         default:
   125             AppUi()->HandleCommandL(aCommand);
   135             AppUi()->HandleCommandL(aCommand);
   126             break;
   136             break;
   127         }
   137         }
   135     {
   145     {
   136     MPX_FUNC("#MS# CMPSettingsStreamingView::NewContainerL()");
   146     MPX_FUNC("#MS# CMPSettingsStreamingView::NewContainerL()");
   137     return new(ELeave) CMPSettingsStreamingContainer(iModel);
   147     return new(ELeave) CMPSettingsStreamingContainer(iModel);
   138     }  
   148     }  
   139 
   149 
   140 // ---------------------------------------------------------------------------
       
   141 // CMPSettingsStreamingView::HandleListBoxEventL
       
   142 // ---------------------------------------------------------------------------
       
   143 
       
   144 void CMPSettingsStreamingView::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
       
   145     {
       
   146     MPX_FUNC("#MS# CMPSettingsStreamingView::HandleListBoxEventL()");
       
   147     switch (aEventType)
       
   148         {
       
   149         case EEventEnterKeyPressed:
       
   150         case EEventItemSingleClicked:
       
   151         case EEventItemDoubleClicked:
       
   152             HandleListBoxSelectionL();
       
   153             break;
       
   154         default:
       
   155            break;
       
   156         }
       
   157     }
       
   158 
   150 
   159 // ---------------------------------------------------------------------------
   151 // ---------------------------------------------------------------------------
   160 // CMPSettingsStreamingView::DynInitContainerL
   152 // CMPSettingsStreamingView::DynInitContainerL
   161 // ---------------------------------------------------------------------------
   153 // ---------------------------------------------------------------------------
   162 //
   154 //
   163 void CMPSettingsStreamingView::DynInitContainerL()
   155 void CMPSettingsStreamingView::DynInitContainerL()
   164     {
   156     {
   165     MPX_FUNC("#MS# CMPSettingsStreamingView::DynInitContainerL()");
   157     MPX_FUNC("#MS# CMPSettingsStreamingView::DynInitContainerL()");
   166     CEikTextListBox* listbox = iContainer->ListBox();
   158     CEikTextListBox* listbox = iContainer->ListBox();
   167 
   159 
   168     listbox->SetListBoxObserver(this);
       
   169     listbox->SetTopItemIndex(iTopItemIndex);
   160     listbox->SetTopItemIndex(iTopItemIndex);
   170 
   161 
   171     if (iCurrentItem >= 0 && iCurrentItem < listbox->Model()->NumberOfItems()) // magic
   162     if (iCurrentItem >= 0 && iCurrentItem < listbox->Model()->NumberOfItems()) // magic
   172         {
   163         {
   173         listbox->SetCurrentItemIndexAndDraw(iCurrentItem);
   164         listbox->SetCurrentItemIndexAndDraw(iCurrentItem);
   174         }
   165         }
   175     CMPSettingsBaseView::SetMiddleSoftKeyLabelL(R_MEDIASETTING_MSK_OPEN,EMPSettCmdOpen);
   166     CMPSettingsBaseView::SetMiddleSoftKeyLabelL(R_MEDIASETTING_MSK_OPEN,EMPSettCmdOpen);
   176     }
   167     }
   177 
   168 
   178 // ---------------------------------------------------------------------------
       
   179 // CMPSettingsStreamingView::HandleListBoxSelectionL()
       
   180 // Handles listbox selection.
       
   181 // ---------------------------------------------------------------------------
       
   182 //
       
   183 void CMPSettingsStreamingView::HandleListBoxSelectionL() 
       
   184     {
       
   185     iCurrentItem = iContainer->ListBox()->CurrentItemIndex();
       
   186     iTopItemIndex = iContainer->ListBox()->TopItemIndex();
       
   187     MPX_DEBUG3(_L("#MS# CMPSettingsStreamingView::HandleListBoxSelectionL() iCurrentItem(%d) iTopItemIndex(%d)"),iCurrentItem,iTopItemIndex);
       
   188 
       
   189     switch (iCurrentItem)
       
   190         {
       
   191         case KMPSettProxyViewListItemId:
       
   192         if (!FeatureManager::FeatureSupported(KFeatureIdProtocolCdma))
       
   193             {
       
   194             // If KFeatureIdProtocolCdma is not supported then show the 
       
   195             // Proxy view. Otherwise, fall through to show Network view because
       
   196             // only Network setting is available.
       
   197             AppUi()->ActivateLocalViewL(KMPSettProxyViewId);
       
   198             break;
       
   199             }
       
   200         case KMPSettNetworkViewListItemId:
       
   201             AppUi()->ActivateLocalViewL(KMPSettNetworkViewId);
       
   202             break;
       
   203         default:
       
   204             break;
       
   205         }
       
   206     }
       
   207 
   169 
   208 // End of File
   170 // End of File
   209 
   171