1 /* |
|
2 * Copyright (c) 2008-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: Base view from which other views are derived (with a few |
|
15 * exceptions). |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include <akntitle.h> |
|
21 #include <stringloader.h> |
|
22 #include <eikbtgpc.h> |
|
23 #include <avkon.rsg> |
|
24 #include <internetradio.rsg> |
|
25 |
|
26 #include "irui.h" |
|
27 #include "ir.hrh" |
|
28 #include "ircommon.h" |
|
29 #include "irdebug.h" |
|
30 #include "irbaseview.h" |
|
31 #include "irapplication.h" |
|
32 #include "IRIsdsWrapper.h" |
|
33 #include "irviewstack.h" |
|
34 #include "irsystemeventcollector.h" //For system events |
|
35 #include "irnowplayingwrapper.h" |
|
36 #include "irdialoglauncher.h" |
|
37 #include "irisdspreset.h" |
|
38 |
|
39 // --------------------------------------------------------- |
|
40 // CIRBaseView::CIRBaseView |
|
41 // C++ default constructor can NOT contain any code, that |
|
42 // might leave. |
|
43 // --------------------------------------------------------- |
|
44 // |
|
45 CIRBaseView::CIRBaseView() |
|
46 { |
|
47 IRLOG_DEBUG( "CIRBaseView::CIRBaseView" ); |
|
48 } |
|
49 |
|
50 // --------------------------------------------------------- |
|
51 // CIRBaseView::~CIRBaseView |
|
52 // Destructor |
|
53 // --------------------------------------------------------- |
|
54 // |
|
55 CIRBaseView::~CIRBaseView() |
|
56 { |
|
57 IRLOG_DEBUG( "CIRBaseView::~CIRBaseView - Entering" ); |
|
58 IRLOG_DEBUG( "CIRBaseView::~CIRBaseView - Exiting" ); |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------- |
|
62 // CIRBaseView::ConstructL |
|
63 // EPOC default constructor can leave. |
|
64 // --------------------------------------------------------- |
|
65 // |
|
66 void CIRBaseView::ConstructL( TInt aResourceId ) |
|
67 { |
|
68 IRLOG_DEBUG( "CIRBaseView::ConstructL - Entering" ); |
|
69 CIRUi* appUi = static_cast<CIRUi*>( AppUi() ); |
|
70 BaseConstructL( aResourceId ); |
|
71 iUi = REINTERPRET_CAST(CIRUi*,iEikonEnv->EikAppUi()); |
|
72 //get the instance of the Wrapper class from AppUi |
|
73 iIsdsWrapper = appUi->GetWrapperInstance(); |
|
74 iNowPlayingWrapper = appUi->GetNowPlayingWrapperInstance(); |
|
75 IRLOG_DEBUG( "CIRBaseView::ConstructL - Exiting" ); |
|
76 } |
|
77 |
|
78 // --------------------------------------------------------- |
|
79 // CIRBaseView::EnableObserverL |
|
80 // (other items were commented in a header). |
|
81 // --------------------------------------------------------- |
|
82 // |
|
83 void CIRBaseView::EnableObserverL( TInt aObservers ) |
|
84 { |
|
85 IRLOG_DEBUG( "CIRBaseView::EnableObserverL - Entering" ); |
|
86 CIRUi* appUi = static_cast<CIRUi*>( AppUi() ); |
|
87 if (aObservers & EIRSystemEventObserver ) |
|
88 { |
|
89 appUi->SystemEventCollector().AddObserverL( this ); |
|
90 iObserverEnabled |= EIRSystemEventObserver; |
|
91 } |
|
92 IRLOG_DEBUG( "CIRBaseView::EnableObserverL - Exiting" ); |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------- |
|
96 // CIRBaseView::DisableObserver |
|
97 // (other items were commented in a header). |
|
98 // --------------------------------------------------------- |
|
99 // |
|
100 void CIRBaseView::DisableObserver( TInt aObservers ) |
|
101 { |
|
102 IRLOG_DEBUG( "CIRBaseView::DisableObserver - Entering" ); |
|
103 CIRUi* appUi = static_cast<CIRUi*>( AppUi() ); |
|
104 if (aObservers & EIRSystemEventObserver ) |
|
105 { |
|
106 appUi->SystemEventCollector().RemoveObserver( this ); |
|
107 iObserverEnabled &= ~EIRSystemEventObserver; |
|
108 } |
|
109 IRLOG_DEBUG( "CIRBaseView::DisableObserver - Exiting" ); |
|
110 } |
|
111 // --------------------------------------------------------- |
|
112 // CIRBaseView::SetTitleL |
|
113 // (other items were commented in a header). |
|
114 // --------------------------------------------------------- |
|
115 // |
|
116 void CIRBaseView::SetTitleL( TInt aResourceId ) |
|
117 { |
|
118 IRLOG_DEBUG( "CIRBaseView::SetTitleL - Entering" ); |
|
119 HBufC* title = StringLoader::LoadLC(aResourceId); |
|
120 static_cast<CAknTitlePane*>( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) )-> |
|
121 SetTextL( *title ); |
|
122 CleanupStack::PopAndDestroy( title ); |
|
123 IRLOG_DEBUG( "CIRBaseView::SetTitleL - Exiting" ); |
|
124 } |
|
125 |
|
126 // --------------------------------------------------------- |
|
127 // CIRBaseView::SetTitleL |
|
128 // (other items were commented in a header). |
|
129 // --------------------------------------------------------- |
|
130 // |
|
131 void CIRBaseView::SetTitleL( const TDesC& aTitleText ) |
|
132 { |
|
133 IRLOG_DEBUG( "CIRBaseView::SetTitleL - Entering" ); |
|
134 static_cast<CAknTitlePane*>( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) )-> |
|
135 SetTextL( aTitleText ); |
|
136 IRLOG_DEBUG( "CIRBaseView::SetTitleL - Exiting" ); |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------- |
|
140 // CIRBaseView::DoActivateL |
|
141 // (other items were commented in a header). |
|
142 // --------------------------------------------------------- |
|
143 // |
|
144 void CIRBaseView::DoActivateL( const TVwsViewId& /*aPrevViewId*/, TUid aCustomMessageId, const TDesC8& /*aCustomMessage*/ ) |
|
145 { |
|
146 IRLOG_DEBUG( "CIRBaseView::DoActivateL - Entering" ); |
|
147 CEikStatusPane* statP = StatusPane(); |
|
148 if(iUi->IsLandscapeOrientation()) |
|
149 { |
|
150 statP->SwitchLayoutL(R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL); |
|
151 } |
|
152 else |
|
153 { |
|
154 statP->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT); |
|
155 } |
|
156 if(aCustomMessageId==TUid::Uid(1)) |
|
157 { |
|
158 return; |
|
159 } |
|
160 HandleViewStackL( aCustomMessageId); |
|
161 IRLOG_DEBUG( "CIRBaseView::DoActivateL - Exiting" ); |
|
162 } |
|
163 |
|
164 // --------------------------------------------------------- |
|
165 // CIRBaseView::DoDeactivate |
|
166 // (other items were commented in a header). |
|
167 // --------------------------------------------------------- |
|
168 // |
|
169 void CIRBaseView::DoDeactivate() |
|
170 { |
|
171 IRLOG_DEBUG( "CIRBaseView::DoDeactivate" ); |
|
172 // Nothing here at the moment |
|
173 } |
|
174 |
|
175 |
|
176 // --------------------------------------------------------- |
|
177 // CIRBaseView::HandleCommandL |
|
178 // --------------------------------------------------------- |
|
179 // |
|
180 void CIRBaseView::HandleCommandL( TInt aCommand ) |
|
181 { |
|
182 IRLOG_DEBUG( "CIRBaseView::HandleCommandL - Exiting" ); |
|
183 CIRUi* appUi = static_cast< CIRUi*>(AppUi()); |
|
184 CIRViewStack& viewStack = appUi->ViewStack(); |
|
185 switch ( aCommand ) |
|
186 { |
|
187 case EIRBack: |
|
188 case EAknSoftkeyBack: |
|
189 { |
|
190 // Check if Back Stepping Service consumes the command. |
|
191 if ( !static_cast< CIRUi* >( AppUi() )->ForwardBackCommandToBsWrapperL() ) |
|
192 { |
|
193 // Command not consumed by Back Stepping Service, handle here. |
|
194 appUi->ActivateLocalViewL( viewStack.Peek() ); |
|
195 } |
|
196 } |
|
197 break; |
|
198 default: |
|
199 appUi->HandleCommandL(aCommand); |
|
200 break; |
|
201 } |
|
202 IRLOG_DEBUG( "CIRBaseView::HandleCommandL - Exiting" ); |
|
203 } |
|
204 |
|
205 // --------------------------------------------------------- |
|
206 // CIRBaseView::HandleForegroundEventL |
|
207 // --------------------------------------------------------- |
|
208 // |
|
209 void CIRBaseView::HandleForegroundEventL( TBool aForeground ) |
|
210 { |
|
211 IRLOG_DEBUG( "CIRBaseView::HandleForegroundEventL - Entering" ); |
|
212 CAknView::HandleForegroundEventL(aForeground); |
|
213 IRLOG_DEBUG( "CIRBaseView::HandleForegroundEventL - Exiting" ); |
|
214 } |
|
215 |
|
216 |
|
217 // --------------------------------------------------------- |
|
218 // From class MIRSystemEventObserver. |
|
219 // CIRBaseView::HandleSystemEventL |
|
220 // --------------------------------------------------------- |
|
221 // |
|
222 void CIRBaseView::HandleSystemEventL(TIRSystemEventType /*aEventType*/) |
|
223 { |
|
224 IRLOG_DEBUG( "CIRBaseView::HandleSystemEventL" ); |
|
225 } |
|
226 |
|
227 // --------------------------------------------------------- |
|
228 // From class MIRSystemEventObserver. |
|
229 // CIRBaseView::HandleSystemEventL |
|
230 // --------------------------------------------------------- |
|
231 // |
|
232 void CIRBaseView::HandleViewStackL(TUid aCustomMessageId ) |
|
233 { |
|
234 IRLOG_DEBUG( "CIRBaseView::HandleViewStackL - Entering" ); |
|
235 CIRUi* appUi = static_cast<CIRUi*>( AppUi() ); |
|
236 CIRViewStack& viewStack = appUi->ViewStack(); |
|
237 |
|
238 if( viewStack.Peek() == Id() && !(aCustomMessageId==KHistoryLaunch ) |
|
239 && !(aCustomMessageId==KMainViewLaunch) |
|
240 && !(aCustomMessageId==KNowPlayingLaunch) |
|
241 && !(aCustomMessageId==KNowPlayingFrmMainView)) |
|
242 { |
|
243 viewStack.Pop(); |
|
244 } |
|
245 else if( appUi->ActiveView() != Id() ) |
|
246 { |
|
247 viewStack.PushL( appUi->ActiveView() ); |
|
248 } |
|
249 else |
|
250 { |
|
251 // DONE |
|
252 } |
|
253 IRLOG_DEBUG( "CIRBaseView::HandleViewStackL - Exiting" ); |
|
254 } |
|
255 |
|
256 // --------------------------------------------------------- |
|
257 // CIRBaseView::GetCurrentFocus |
|
258 // --------------------------------------------------------- |
|
259 // |
|
260 TInt CIRBaseView::GetCurrentFocus() |
|
261 { |
|
262 IRLOG_DEBUG( "CIRBaseView::GetCurrentFocus" ); |
|
263 return iCurrentFocus; |
|
264 } |
|
265 |
|
266 // --------------------------------------------------------- |
|
267 // CIRBaseView::GetCurrentTopItemInstance |
|
268 // --------------------------------------------------------- |
|
269 // |
|
270 TInt CIRBaseView::GetCurrentTopItem() |
|
271 { |
|
272 IRLOG_DEBUG( "CIRBaseView::GetCurrentTopItem" ); |
|
273 return iTopItemIndex; |
|
274 } |
|
275 |
|
276 // --------------------------------------------------------- |
|
277 // CIRBaseView::SetCurrentFocus |
|
278 // --------------------------------------------------------- |
|
279 // |
|
280 void CIRBaseView::SetCurrentFocus(TInt aCurrentFocus) |
|
281 { |
|
282 IRLOG_DEBUG( "CIRBaseView::SetCurrentFocus - Entering" ); |
|
283 iCurrentFocus = aCurrentFocus; |
|
284 IRLOG_DEBUG( "CIRBaseView::SetCurrentFocus - Exiting" ); |
|
285 } |
|
286 |
|
287 // --------------------------------------------------------- |
|
288 // CIRBaseView::SetCurrentTopItemInstance |
|
289 // --------------------------------------------------------- |
|
290 // |
|
291 void CIRBaseView::SetCurrentTopItem(TInt aTopItemIndex) |
|
292 { |
|
293 IRLOG_DEBUG( "CIRBaseView::SetCurrentTopItem - Entering" ); |
|
294 iTopItemIndex = aTopItemIndex; |
|
295 IRLOG_DEBUG( "CIRBaseView::SetCurrentTopItem - Exiting" ); |
|
296 } |
|
297 |
|
298 // End of file |
|