|
1 /* |
|
2 * Copyright (c) 2006 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 class for applications views |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CCAView.h" |
|
22 #include "CCAAppUi.h" |
|
23 #include "MCAViewSwitcher.h" |
|
24 #include "CAExternalInterface.h" |
|
25 #include "CCAFadeControl.h" |
|
26 #include "chatngclient.hrh" |
|
27 #include "IMDialogUtils.h" |
|
28 |
|
29 #include <bldvariant.hrh> |
|
30 #include <chatNG.rsg> |
|
31 #include <eikenv.h> |
|
32 #include <aknenv.h> |
|
33 #include <aknnavi.h> |
|
34 #include <aknnavide.h> |
|
35 #include <akneditstateindicator.h> |
|
36 #include <aknindicatorcontainer.h> |
|
37 #include <featmgr.h> |
|
38 #include <hlplch.h> |
|
39 |
|
40 // The Settings have been moved to Cenrep (also retained in the Resource file), |
|
41 // so the enums for keys and central repository header is added here |
|
42 #include "VariantKeys.h" |
|
43 // ================= MEMBER FUNCTIONS ======================= |
|
44 |
|
45 // C++ default constructor can NOT contain any code, that |
|
46 // might leave. |
|
47 // |
|
48 CCAView::CCAView() |
|
49 { |
|
50 } |
|
51 |
|
52 // Symbian OS default constructor can leave. |
|
53 void CCAView::BaseConstructL( TInt aAvkonViewResourceId, TUid aViewId ) |
|
54 { |
|
55 iViewId = aViewId; |
|
56 CAknView::BaseConstructL( aAvkonViewResourceId ); |
|
57 } |
|
58 |
|
59 // Destructor |
|
60 CCAView::~CCAView() |
|
61 { |
|
62 delete iDecoratedFadeText; |
|
63 } |
|
64 |
|
65 // --------------------------------------------------------- |
|
66 // CCAView::Id() |
|
67 // (other items were commented in a header). |
|
68 // --------------------------------------------------------- |
|
69 // |
|
70 TUid CCAView::Id() const |
|
71 { |
|
72 return iViewId; |
|
73 } |
|
74 |
|
75 // --------------------------------------------------------- |
|
76 // CCAView::CAAppUi() |
|
77 // (other items were commented in a header). |
|
78 // --------------------------------------------------------- |
|
79 // |
|
80 CCAAppUi* CCAView::CAAppUi() const |
|
81 { |
|
82 return static_cast<CCAAppUi*>( iEikonEnv->AppUi() ); |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CCAView::CAViewSwitcher |
|
87 // (other items were commented in a header). |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 MCAViewSwitcher* CCAView::CAViewSwitcher() const |
|
91 { |
|
92 return static_cast<MCAViewSwitcher*>( CAAppUi() ); |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // CCAView::UISessionManager |
|
97 // (other items were commented in a header). |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 CCAUISessionManager& CCAView::UISessionManager() const |
|
101 { |
|
102 return CAAppUi()->UISessionManager(); |
|
103 } |
|
104 |
|
105 // --------------------------------------------------------- |
|
106 // CCAView::RunFadeText() |
|
107 // (other items were commented in a header). |
|
108 // --------------------------------------------------------- |
|
109 // |
|
110 void CCAView::RunFadeText() |
|
111 { |
|
112 static_cast<CCAFadeControl*>( iDecoratedFadeText->DecoratedControl() )->Start(); |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // CCAView::HideFadeText |
|
117 // (other items were commented in a header). |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 void CCAView::HideFadeText() |
|
121 { |
|
122 if ( iDecoratedFadeText ) |
|
123 { |
|
124 iNaviPane->Pop( iDecoratedFadeText ); |
|
125 } |
|
126 } |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // CCAView::ShowFadeText |
|
130 // (other items were commented in a header). |
|
131 // ----------------------------------------------------------------------------- |
|
132 // |
|
133 void CCAView::ShowFadeText( const TDesC& aTextToFade ) |
|
134 { |
|
135 IMessageIndicator()->SetMessage( aTextToFade ); |
|
136 RunFadeText(); |
|
137 } |
|
138 |
|
139 // ----------------------------------------------------------------------------- |
|
140 // CCAView::ShowNavipaneIndicators |
|
141 // (other items were commented in a header). |
|
142 // ----------------------------------------------------------------------------- |
|
143 // |
|
144 void CCAView::ShowNavipaneIndicators() |
|
145 { |
|
146 MAknEditingStateIndicator* editStateIndicator = |
|
147 CAknEnv::Static()->EditingStateIndicator(); |
|
148 |
|
149 if ( editStateIndicator ) |
|
150 { |
|
151 CAknIndicatorContainer* indicatorContainer = editStateIndicator->IndicatorContainer(); |
|
152 |
|
153 if ( indicatorContainer ) |
|
154 { |
|
155 indicatorContainer->SetIndicatorState( |
|
156 TUid::Uid( EAknNaviPaneEditorIndicatorMessageInfo ), |
|
157 EAknIndicatorStateOn ); |
|
158 } |
|
159 } |
|
160 } |
|
161 |
|
162 // --------------------------------------------------------- |
|
163 // CCAView::HideNavipaneIndicators() |
|
164 // (other items were commented in a header). |
|
165 // --------------------------------------------------------- |
|
166 // |
|
167 void CCAView::HideNavipaneIndicators() |
|
168 { |
|
169 MAknEditingStateIndicator* editStateIndicator = |
|
170 CAknEnv::Static()->EditingStateIndicator(); |
|
171 |
|
172 if ( editStateIndicator ) |
|
173 { |
|
174 CAknIndicatorContainer* indicatorContainer = editStateIndicator->IndicatorContainer(); |
|
175 |
|
176 if ( indicatorContainer ) |
|
177 { |
|
178 indicatorContainer->SetIndicatorState( |
|
179 TUid::Uid( EAknNaviPaneEditorIndicatorMessageInfo ), |
|
180 EAknIndicatorStateOff ); |
|
181 } |
|
182 } |
|
183 } |
|
184 |
|
185 // ----------------------------------------------------------------------------- |
|
186 // CCAView::IMessageIndicator |
|
187 // (other items were commented in a header). |
|
188 // ----------------------------------------------------------------------------- |
|
189 // |
|
190 CCAFadeControl* CCAView::IMessageIndicator() const |
|
191 { |
|
192 if ( iDecoratedFadeText ) |
|
193 { |
|
194 return static_cast<CCAFadeControl*>( iDecoratedFadeText->DecoratedControl() ); |
|
195 } |
|
196 else |
|
197 { |
|
198 return NULL; |
|
199 } |
|
200 |
|
201 } |
|
202 |
|
203 // --------------------------------------------------------- |
|
204 // CCAView::PushFadeTextL() |
|
205 // (other items were commented in a header). |
|
206 // --------------------------------------------------------- |
|
207 // |
|
208 void CCAView::PushFadeTextL() |
|
209 { |
|
210 if ( iDecoratedFadeText ) |
|
211 { |
|
212 iNaviPane->PushL( *iDecoratedFadeText ); |
|
213 } |
|
214 } |
|
215 |
|
216 // --------------------------------------------------------- |
|
217 // CCAView::ResetFadeText() |
|
218 // (other items were commented in a header). |
|
219 // --------------------------------------------------------- |
|
220 // |
|
221 void CCAView::ResetFadeText() |
|
222 { |
|
223 IMessageIndicator()->Reset(); |
|
224 } |
|
225 |
|
226 // --------------------------------------------------------- |
|
227 // CCAView::LaunchHelpL() |
|
228 // (other items were commented in a header). |
|
229 // --------------------------------------------------------- |
|
230 // |
|
231 void CCAView::LaunchHelpL() |
|
232 { |
|
233 if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
234 { |
|
235 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), |
|
236 AppUi()->AppHelpContextL() ); |
|
237 } |
|
238 } |
|
239 |
|
240 // --------------------------------------------------------- |
|
241 // CCAView::DynInitMenuPaneL |
|
242 // (other items were commented in a header). |
|
243 // --------------------------------------------------------- |
|
244 // |
|
245 void CCAView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
246 { |
|
247 if ( aResourceId == R_CHATCLIENT_GENERAL_MENU ) |
|
248 { |
|
249 if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
250 { |
|
251 aMenuPane->SetItemDimmed( EChatClientCmdHelp, ETrue ); |
|
252 } |
|
253 } |
|
254 } |
|
255 |
|
256 // --------------------------------------------------------- |
|
257 // CCAView::IsFunctionSupported |
|
258 // (other items were commented in a header). |
|
259 // --------------------------------------------------------- |
|
260 // |
|
261 TBool CCAView::IsFunctionSupported( CCAUISessionManager::TSupportedFeature aSupporterFeature ) |
|
262 { |
|
263 if ( UISessionManager().IsSupported( aSupporterFeature ) ) |
|
264 { |
|
265 return ETrue; |
|
266 } |
|
267 else |
|
268 { |
|
269 TRAPD( err, IMDialogUtils::DisplayNoteDialogL( R_CHAT_ERROR_NOT_SUP_FUNCTIONS ) ); |
|
270 if ( err != KErrNone ) |
|
271 { |
|
272 CActiveScheduler::Current()->Error( err ); |
|
273 } |
|
274 } |
|
275 return EFalse; |
|
276 } |
|
277 |
|
278 // --------------------------------------------------------- |
|
279 // CCAView::InitMessageIndicatorL() |
|
280 // (other items were commented in a header). |
|
281 // --------------------------------------------------------- |
|
282 // |
|
283 void CCAView::InitMessageIndicatorL() |
|
284 { |
|
285 CAknNavigationDecorator* fade = CreateIMessageIndicatorL(); |
|
286 delete iDecoratedFadeText; |
|
287 iDecoratedFadeText = fade; |
|
288 } |
|
289 |
|
290 // --------------------------------------------------------- |
|
291 // CCAView::DestroyMessageIndicator() |
|
292 // (other items were commented in a header). |
|
293 // --------------------------------------------------------- |
|
294 // |
|
295 void CCAView::DestroyMessageIndicator() |
|
296 { |
|
297 delete iDecoratedFadeText; |
|
298 iDecoratedFadeText = NULL; |
|
299 } |
|
300 // --------------------------------------------------------- |
|
301 // CCAView::CreateIMessageIndicatorL() |
|
302 // (other items were commented in a header). |
|
303 // --------------------------------------------------------- |
|
304 // |
|
305 CAknNavigationDecorator* CCAView::CreateIMessageIndicatorL() |
|
306 { |
|
307 iNaviPane = static_cast<CAknNavigationControlContainer*>( |
|
308 StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
309 |
|
310 CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()-> |
|
311 StatusPane(); |
|
312 |
|
313 CCAFadeControl* fadetext = CCAFadeControl::NewLC( |
|
314 statusPane->PaneRectL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
315 fadetext->SetContainerWindowL( *iNaviPane ); |
|
316 |
|
317 CAknNavigationDecorator* decoratedFadetext = |
|
318 CAknNavigationDecorator::NewL( iNaviPane, fadetext, |
|
319 CAknNavigationDecorator::EHintText ); |
|
320 |
|
321 CleanupStack::Pop( fadetext ); |
|
322 CleanupStack::PushL( decoratedFadetext ); |
|
323 decoratedFadetext->SetContainerWindowL( *iNaviPane ); |
|
324 decoratedFadetext->SetControlContext( iNaviPane ); |
|
325 decoratedFadetext->MakeScrollButtonVisible( EFalse ); |
|
326 |
|
327 CleanupStack::Pop( decoratedFadetext ); |
|
328 |
|
329 return decoratedFadetext; |
|
330 } |