|
1 /* |
|
2 * Copyright (c) 2002 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 the License "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: View class for Streaming list view.* |
|
15 */ |
|
16 |
|
17 |
|
18 // Version : %version: 5 % |
|
19 |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <aknViewAppUi.h> |
|
24 #include <MediaSettings.rsg> |
|
25 #include <calslbs.h> |
|
26 #include <featmgr.h> |
|
27 #include <hlplch.h> // For HlpLauncher |
|
28 #include "mediasettings.hrh" |
|
29 #include "MPSettingsNaviPaneController.h" |
|
30 #include "MPSettingsStreamingView.h" |
|
31 #include "MPSettingsStreamingContainer.h" |
|
32 #include "MPSettingsConstants.h" |
|
33 #include "mpxlog.h" |
|
34 |
|
35 class CMPSettingsModelForROP; |
|
36 |
|
37 // CONSTANTS |
|
38 |
|
39 const TInt KMPSettProxyViewListItemId = 0; |
|
40 const TInt KMPSettNetworkViewListItemId = 1; |
|
41 |
|
42 // ================= MEMBER FUNCTIONS ======================= |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CMPSettingsStreamingView::CMPSettingsStreamingView |
|
46 // C++ default constructor can NOT contain any code, that |
|
47 // might leave. |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 CMPSettingsStreamingView::CMPSettingsStreamingView(CMPSettingsModelForROP* aModel) : iModel( aModel) |
|
51 { |
|
52 MPX_FUNC("#MS# CMPSettingsStreamingView::CMPSettingsStreamingView()"); |
|
53 iNaviPaneContext = iNaviCntrl->MPTabGroup(); |
|
54 } |
|
55 |
|
56 // --------------------------------------------------------- |
|
57 // CMPSettingsStreamingView::ConstructL(const TRect& aRect) |
|
58 // Symbian OS two-phased constructor |
|
59 // --------------------------------------------------------- |
|
60 // |
|
61 void CMPSettingsStreamingView::ConstructL() |
|
62 { |
|
63 MPX_FUNC("#MS# CMPSettingsStreamingView::ConstructL()"); |
|
64 BaseConstructL(R_MPSETT_STREAMING_VIEW); |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CMPSettingsStreamingView::NewLC |
|
69 // Two-phased constructor. |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 CMPSettingsStreamingView* CMPSettingsStreamingView::NewLC(CMPSettingsModelForROP* aModel) |
|
73 { |
|
74 MPX_FUNC("#MS# CMPSettingsStreamingView::NewLC()"); |
|
75 CMPSettingsStreamingView* self = new(ELeave) CMPSettingsStreamingView(aModel); |
|
76 |
|
77 CleanupStack::PushL(self); |
|
78 self->ConstructL(); |
|
79 |
|
80 return self; |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------- |
|
84 // CMPSettingsStreamingView::~CMPSettingsStreamingView |
|
85 // Destructor |
|
86 // --------------------------------------------------------- |
|
87 // |
|
88 CMPSettingsStreamingView::~CMPSettingsStreamingView() |
|
89 { |
|
90 MPX_FUNC("#MS# CMPSettingsStreamingView::~CMPSettingsStreamingView()"); |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------- |
|
94 // TUid CMPSettingsStreamingView::Id |
|
95 // --------------------------------------------------------- |
|
96 // |
|
97 TUid CMPSettingsStreamingView::Id() const |
|
98 { |
|
99 MPX_FUNC("#MS# CMPSettingsStreamingView::Id()"); |
|
100 return KMPSettStreamingViewId; |
|
101 } |
|
102 |
|
103 // --------------------------------------------------------- |
|
104 // CMPSettingsStreamingView::HandleCommandL |
|
105 // --------------------------------------------------------- |
|
106 // |
|
107 void CMPSettingsStreamingView::HandleCommandL(TInt aCommand) |
|
108 { |
|
109 MPX_DEBUG2(_L("#MS# CMPSettingsStreamingView::HandleCommandL(%d)"),aCommand); |
|
110 switch (aCommand) |
|
111 { |
|
112 case EMPSettCmdOpen: |
|
113 HandleListBoxSelectionL(); |
|
114 break; |
|
115 case EAknSoftkeyBack: |
|
116 AppUi()->ActivateLocalViewL(KMPSettMainViewId); |
|
117 break; |
|
118 case EMPSettCmdHelp: |
|
119 if( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
120 { |
|
121 HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), AppUi()->AppHelpContextL() ); |
|
122 } |
|
123 break; |
|
124 default: |
|
125 AppUi()->HandleCommandL(aCommand); |
|
126 break; |
|
127 } |
|
128 } |
|
129 |
|
130 // --------------------------------------------------------------------------- |
|
131 // CMPSettingsStreamingView::NewContainerL |
|
132 // --------------------------------------------------------------------------- |
|
133 // |
|
134 CMPSettingsBaseContainer* CMPSettingsStreamingView::NewContainerL() |
|
135 { |
|
136 MPX_FUNC("#MS# CMPSettingsStreamingView::NewContainerL()"); |
|
137 return new(ELeave) CMPSettingsStreamingContainer(iModel); |
|
138 } |
|
139 |
|
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 |
|
159 // --------------------------------------------------------------------------- |
|
160 // CMPSettingsStreamingView::DynInitContainerL |
|
161 // --------------------------------------------------------------------------- |
|
162 // |
|
163 void CMPSettingsStreamingView::DynInitContainerL() |
|
164 { |
|
165 MPX_FUNC("#MS# CMPSettingsStreamingView::DynInitContainerL()"); |
|
166 CEikTextListBox* listbox = iContainer->ListBox(); |
|
167 |
|
168 listbox->SetListBoxObserver(this); |
|
169 listbox->SetTopItemIndex(iTopItemIndex); |
|
170 |
|
171 if (iCurrentItem >= 0 && iCurrentItem < listbox->Model()->NumberOfItems()) // magic |
|
172 { |
|
173 listbox->SetCurrentItemIndexAndDraw(iCurrentItem); |
|
174 } |
|
175 CMPSettingsBaseView::SetMiddleSoftKeyLabelL(R_MEDIASETTING_MSK_OPEN,EMPSettCmdOpen); |
|
176 } |
|
177 |
|
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 |
|
208 // End of File |
|
209 |