|
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: Handles statuspane, context pane, navi pane |
|
15 <<<<<<< C:\DOCUME~1\mbn\LOCALS~1\Temp\cimcvappstatuspanehandler-3_GAA.cpp |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "cimcvappstatuspanehandler.h" |
|
22 #include "mimcvtabobserver.h" |
|
23 |
|
24 |
|
25 // for logs |
|
26 #include "imcvlogger.h" |
|
27 //#include <aknindicatorcontainer.h> |
|
28 #include <eikenv.h> |
|
29 #include <aknenv.h> |
|
30 #include <aknnavi.h> |
|
31 #include <aknnavide.h> |
|
32 #include <aknEditStateIndicator.h> |
|
33 #include <AknIndicatorContainer.h> |
|
34 #include <featmgr.h> |
|
35 #include <hlplch.h> |
|
36 #include <e32property.h> |
|
37 |
|
38 // system includes |
|
39 #include <layoutmetadata.cdl.h> |
|
40 #include <aknlayoutscalable_avkon.cdl.h> |
|
41 #include <imconnectionproviderconsts.h> |
|
42 #include "cimcvenginefactory.h" |
|
43 #include "mimcvenginefactory.h" |
|
44 const TUint16 KNewMessageIcon( 0xF818 ); |
|
45 |
|
46 // ================= MEMBER FUNCTIONS ======================= |
|
47 // ----------------------------------------------------------------------------- |
|
48 // CIMCVAppStatusPaneHandler::ConstructL |
|
49 // (other items were commented in a header). |
|
50 // C++ default constructor can NOT contain any code, that |
|
51 // might leave. |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 CIMCVAppStatusPaneHandler::CIMCVAppStatusPaneHandler(MIMCVEngineFactory& aEngineFactory): |
|
55 iEngineFactory( aEngineFactory ) |
|
56 { |
|
57 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::CIMCVAppStatusPaneHandler()" )); |
|
58 } |
|
59 // ----------------------------------------------------------------------------- |
|
60 // CIMCVAppStatusPaneHandler::ConstructL |
|
61 // (other items were commented in a header). |
|
62 // Symbian OS default constructor can leave. |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 void CIMCVAppStatusPaneHandler::ConstructL() |
|
66 { |
|
67 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::ConstructL() start" )); |
|
68 // Get pointer to status-pane |
|
69 CEikStatusPane* statusPane = CEikonEnv::Static()->AppUiFactory()-> |
|
70 StatusPane(); |
|
71 |
|
72 iNaviPane = static_cast<CAknNavigationControlContainer*>( |
|
73 statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
74 |
|
75 // Get pointer to title-pane |
|
76 iTitlePane = static_cast<CAknTitlePane*>( statusPane->ControlL( |
|
77 TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
78 |
|
79 iContextPane = static_cast<CAknContextPane*>( statusPane->ControlL( |
|
80 TUid::Uid( EEikStatusPaneUidContext ) ) ); |
|
81 |
|
82 iNewMsgIcon = HBufC::NewL( 1 ); |
|
83 |
|
84 TPtr iconPtr( iNewMsgIcon->Des() ); |
|
85 iconPtr.Append( TChar( KNewMessageIcon ) ); |
|
86 |
|
87 InitMessageIndicatorL(); |
|
88 |
|
89 //Get the service id - this property is published by imcvlauncher |
|
90 TInt error = RProperty::Get( KMeCoPropertyUid, KMeCoConvViewServiceIdKey, iServiceId ); |
|
91 User::LeaveIfError(error); |
|
92 |
|
93 iEngineFactory.RegisterOpenChatObserver(this); |
|
94 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::ConstructL() end" )); |
|
95 } |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // CIMCVAppStatusPaneHandler::NewL |
|
99 // (other items were commented in a header). |
|
100 // Two-phased constructor. |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 CIMCVAppStatusPaneHandler* CIMCVAppStatusPaneHandler::NewL(MIMCVEngineFactory& aEngineFactory) |
|
104 { |
|
105 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::NewL() start" )); |
|
106 CIMCVAppStatusPaneHandler* self = new ( ELeave ) CIMCVAppStatusPaneHandler( aEngineFactory ); |
|
107 |
|
108 CleanupStack::PushL( self ); |
|
109 self->ConstructL(); |
|
110 CleanupStack::Pop( self ); |
|
111 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::NewL() end" )); |
|
112 return self; |
|
113 } |
|
114 |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CIMCVAppStatusPaneHandler::~CIMCVAppStatusPaneHandler |
|
118 // (other items were commented in a header). |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 CIMCVAppStatusPaneHandler::~CIMCVAppStatusPaneHandler() |
|
122 { |
|
123 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::~CIMCVAppStatusPaneHandler() start" )); |
|
124 |
|
125 if (iLastTitle) |
|
126 { |
|
127 delete iLastTitle; |
|
128 iLastTitle = NULL; |
|
129 } |
|
130 DestroyMessageIndicator(); |
|
131 |
|
132 iObserverList.Reset(); |
|
133 |
|
134 delete iNewMsgIcon; |
|
135 delete iNewDecoratedTabGroup; |
|
136 |
|
137 iEngineFactory.UnRegisterOpenChatObserver(); |
|
138 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::~CIMCVAppStatusPaneHandler() end" )); |
|
139 } |
|
140 |
|
141 // ----------------------------------------------------------------------------- |
|
142 // CIMCVAppStatusPaneHandler::SetPicture |
|
143 // (other items were commented in a header). |
|
144 // ----------------------------------------------------------------------------- |
|
145 // |
|
146 void CIMCVAppStatusPaneHandler::SetPicture( const CFbsBitmap* aPicture , |
|
147 const CFbsBitmap* aMask ) |
|
148 { |
|
149 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::SetPicture() start" )); |
|
150 TBool landscape( Layout_Meta_Data::IsLandscapeOrientation() ); |
|
151 |
|
152 TBool cpVisible( iContextPane ? iContextPane->IsVisible() : EFalse ); |
|
153 TBool useTitle( !cpVisible || landscape ); |
|
154 if( useTitle ) |
|
155 { |
|
156 iTitlePane->SetSmallPicture(aPicture, aMask ,useTitle ); |
|
157 } |
|
158 else |
|
159 { |
|
160 iContextPane->SetPicture( aPicture, aMask ); |
|
161 } |
|
162 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::SetPicture() end" )); |
|
163 } |
|
164 |
|
165 // ----------------------------------------------------------------------------- |
|
166 // CIMCVAppStatusPaneHandler::SetTitleL |
|
167 // (other items were commented in a header). |
|
168 // ----------------------------------------------------------------------------- |
|
169 // |
|
170 void CIMCVAppStatusPaneHandler::SetTitleL( const TDesC& aTitle ) |
|
171 { |
|
172 |
|
173 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::SetTitleL() start %S" ), &aTitle); |
|
174 iTitlePane->SetTextL( aTitle ); |
|
175 if (iLastTitle) |
|
176 { |
|
177 delete iLastTitle; |
|
178 iLastTitle = NULL; |
|
179 } |
|
180 iLastTitle = aTitle.AllocL(); |
|
181 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::SetTitleL() end" )); |
|
182 } |
|
183 |
|
184 |
|
185 |
|
186 // --------------------------------------------------------- |
|
187 // CIMCVAppStatusPaneHandler::ShowTabGroupL |
|
188 // (other items were commented in a header). |
|
189 // --------------------------------------------------------- |
|
190 // |
|
191 TInt CIMCVAppStatusPaneHandler::ShowTabGroupL( const TDesC& aId, |
|
192 const TBool noCreate /* = EFalse */ ) |
|
193 { |
|
194 |
|
195 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::ShowTabGroupL() start %S" ), &aId); |
|
196 iPrevTabId = 0; |
|
197 iCurrentTabId =0; |
|
198 |
|
199 iCurrentTabId = iEngineFactory.FindIndexL(aId); |
|
200 |
|
201 CreateTabsL(noCreate); |
|
202 |
|
203 |
|
204 return iCurrentTabId; |
|
205 } |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 // ----------------------------------------------------------------------------- |
|
211 // CIMCVAppStatusPaneHandler::CreateTabsL |
|
212 // (other items were commented in a header). |
|
213 // ----------------------------------------------------------------------------- |
|
214 // |
|
215 void CIMCVAppStatusPaneHandler::CreateTabsL(const TBool noCreate) |
|
216 { |
|
217 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::CreateTabs() start " )); |
|
218 iOpenChatArrayCount = iEngineFactory.Count(); |
|
219 |
|
220 |
|
221 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::CreateTabs() OPEN CHAT ARRAY COUNT %d" ), iOpenChatArrayCount); |
|
222 if ( (noCreate) && (iNewDecoratedTabGroup) ) |
|
223 { |
|
224 |
|
225 CAknTabGroup* origtabGroup = |
|
226 static_cast<CAknTabGroup*>( iNewDecoratedTabGroup->DecoratedControl() ); |
|
227 |
|
228 if ( origtabGroup->TabCount() == (iOpenChatArrayCount-1) ) |
|
229 { |
|
230 |
|
231 for (TInt index=0; index<iOpenChatArrayCount; index++) |
|
232 { |
|
233 if ( (iEngineFactory.IsMsgPendingL(index)) |
|
234 && ( index != iCurrentTabId ) ) |
|
235 { |
|
236 origtabGroup->ReplaceTabTextL(index, iNewMsgIcon->Des()); |
|
237 } |
|
238 else |
|
239 { |
|
240 origtabGroup->ReplaceTabTextL( index, iEngineFactory.GetDisplayNameL(index) ); |
|
241 } |
|
242 } |
|
243 |
|
244 return; |
|
245 |
|
246 } |
|
247 |
|
248 } |
|
249 |
|
250 |
|
251 CAknNavigationDecorator* tmpDecoration = iNaviPane->CreateTabGroupL(); |
|
252 |
|
253 CleanupStack::PushL( tmpDecoration ); |
|
254 |
|
255 CAknTabGroup* tabGroup = |
|
256 static_cast<CAknTabGroup*>( tmpDecoration->DecoratedControl() ); |
|
257 |
|
258 if( iOpenChatArrayCount > 2 ) |
|
259 { |
|
260 tabGroup->SetTabFixedWidthL( EAknTabWidthWithThreeTabs ); |
|
261 } |
|
262 else if ( iOpenChatArrayCount == 2 ) |
|
263 { |
|
264 tabGroup->SetTabFixedWidthL( EAknTabWidthWithTwoTabs ); |
|
265 } |
|
266 else |
|
267 { |
|
268 tabGroup->SetTabFixedWidthL( EAknTabWidthWithOneTab ); |
|
269 } |
|
270 |
|
271 |
|
272 tabGroup->SetObserver( this ); |
|
273 |
|
274 |
|
275 for (TInt index=0; index<iOpenChatArrayCount; index++) |
|
276 { |
|
277 |
|
278 if ( (iEngineFactory.IsMsgPendingL(index)) |
|
279 && ( index != iCurrentTabId ) ) |
|
280 { |
|
281 tabGroup->AddTabL(index, iNewMsgIcon->Des()); |
|
282 } |
|
283 else |
|
284 { |
|
285 if ( 1 == iOpenChatArrayCount ) |
|
286 { |
|
287 // When a single conversation exists , no need to display name on tab |
|
288 tabGroup->AddTabL( index, KNullDesC ); |
|
289 } |
|
290 else |
|
291 { |
|
292 // When more than one conversation exists , display names are displayed on the tabs |
|
293 tabGroup->AddTabL( index, iEngineFactory.GetDisplayNameL(index) ); |
|
294 } |
|
295 } |
|
296 } |
|
297 |
|
298 CleanupStack::Pop( tmpDecoration ); |
|
299 |
|
300 delete iNewDecoratedTabGroup; |
|
301 iNewDecoratedTabGroup = tmpDecoration; |
|
302 |
|
303 ShowTabL(); |
|
304 |
|
305 |
|
306 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::CreateTabs() end" )); |
|
307 |
|
308 } |
|
309 |
|
310 |
|
311 |
|
312 |
|
313 // ----------------------------------------------------------------------------- |
|
314 // CIMCVAppStatusPaneHandler::TabChangedL |
|
315 // (other items were commented in a header). |
|
316 // ----------------------------------------------------------------------------- |
|
317 // |
|
318 void CIMCVAppStatusPaneHandler::TabChangedL(TInt aIndex) |
|
319 { |
|
320 TInt activechatitemindex; |
|
321 CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>( |
|
322 iNewDecoratedTabGroup->DecoratedControl()); |
|
323 if ( tabGroup ) |
|
324 { |
|
325 tabGroup->SetActiveTabByIndex( aIndex ); |
|
326 iEngineFactory.SetActiveItemL(tabGroup->ActiveTabId()); |
|
327 iPrevTabId = iCurrentTabId; |
|
328 iCurrentTabId = tabGroup->ActiveTabId(); |
|
329 // Get the corrent position in open chat array using tab id |
|
330 if( iOpenChatArrayCount > iEngineFactory.Count() ) |
|
331 { |
|
332 activechatitemindex = (( iPrevTabId<iCurrentTabId )?iPrevTabId:iCurrentTabId); |
|
333 } |
|
334 else |
|
335 { |
|
336 activechatitemindex = iCurrentTabId ; |
|
337 } |
|
338 tabGroup->ReplaceTabTextL( iCurrentTabId, iEngineFactory.GetDisplayNameL(activechatitemindex) ); // replace of iCurrentTabId using activechatitemindex |
|
339 for (TInt index=0; index<iObserverList.Count(); index++) |
|
340 { |
|
341 iObserverList[index]->SwitchTabL( iEngineFactory.GetActiveServiceId(), iEngineFactory.GetTargetIdL(iCurrentTabId), iCurrentTabId ); |
|
342 } |
|
343 |
|
344 } |
|
345 } |
|
346 |
|
347 // ----------------------------------------------------------------------------- |
|
348 // CIMCVAppStatusPaneHandler: AddObserver |
|
349 // ----------------------------------------------------------------------------- |
|
350 // |
|
351 void CIMCVAppStatusPaneHandler::AddObserver( |
|
352 MIMCVTabObserver* aObserver) |
|
353 { |
|
354 |
|
355 ASSERT( aObserver); |
|
356 TInt status( iObserverList.Find( aObserver ) ); |
|
357 if ( status == KErrNotFound ) |
|
358 { |
|
359 status = iObserverList.Append( aObserver ) ; |
|
360 if( status != KErrNone) |
|
361 { |
|
362 CActiveScheduler::Current()->Error( status ); |
|
363 } |
|
364 } |
|
365 |
|
366 } |
|
367 |
|
368 |
|
369 // ----------------------------------------------------------------------------- |
|
370 // CIMCVAppStatusPaneHandler: RemoveObserver |
|
371 // ----------------------------------------------------------------------------- |
|
372 // |
|
373 void CIMCVAppStatusPaneHandler::RemoveObserver( |
|
374 MIMCVTabObserver* aObserver ) |
|
375 { |
|
376 |
|
377 ASSERT( aObserver); |
|
378 const TInt status( iObserverList.Find( aObserver ) ); |
|
379 if ( status != KErrNotFound ) |
|
380 { |
|
381 iObserverList.Remove( status ); |
|
382 iObserverList.Compress(); |
|
383 } |
|
384 |
|
385 |
|
386 } |
|
387 |
|
388 |
|
389 // --------------------------------------------------------- |
|
390 // CIMCVAppStatusPaneHandler::ShowTabL |
|
391 // (other items were commented in a header). |
|
392 // --------------------------------------------------------- |
|
393 // |
|
394 void CIMCVAppStatusPaneHandler::ShowTabL() |
|
395 { |
|
396 CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>( |
|
397 iNewDecoratedTabGroup->DecoratedControl()); |
|
398 |
|
399 tabGroup->SetActiveTabById( iCurrentTabId ); |
|
400 iEngineFactory.SetActiveItemL(iCurrentTabId); |
|
401 |
|
402 /* Pushes new decorator object to top of the stack and draws it*/ |
|
403 |
|
404 iNaviPane->PushL( *iNewDecoratedTabGroup ); |
|
405 |
|
406 } |
|
407 |
|
408 |
|
409 // --------------------------------------------------------- |
|
410 // CIMCVAppStatusPaneHandler::HideTab |
|
411 // (other items were commented in a header). |
|
412 // --------------------------------------------------------- |
|
413 // |
|
414 void CIMCVAppStatusPaneHandler::HideTab() |
|
415 { |
|
416 |
|
417 /* Pops*/ |
|
418 iNaviPane->Pop( iNewDecoratedTabGroup ); |
|
419 |
|
420 } |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 // --------------------------------------------------------- |
|
426 // CIMCVAppStatusPaneHandler::SetActiveTabByIndexL |
|
427 // (other items were commented in a header). |
|
428 // --------------------------------------------------------- |
|
429 // |
|
430 void CIMCVAppStatusPaneHandler::SetActiveTabByIndexL( const TInt aIndex ) |
|
431 { |
|
432 |
|
433 CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>( |
|
434 iNewDecoratedTabGroup->DecoratedControl()); |
|
435 |
|
436 if (!tabGroup) |
|
437 { |
|
438 return ; |
|
439 } |
|
440 |
|
441 iCurrentTabId = aIndex; |
|
442 |
|
443 TRAP_IGNORE( tabGroup->ReplaceTabL( iCurrentTabId, |
|
444 iEngineFactory.GetDisplayNameL(iCurrentTabId) ) ); |
|
445 |
|
446 tabGroup->SetActiveTabById( iCurrentTabId ); |
|
447 |
|
448 iEngineFactory.SetActiveItemL(iCurrentTabId); |
|
449 |
|
450 } |
|
451 |
|
452 // ----------------------------------------------------------------------------- |
|
453 // CIMCVAppStatusPaneHandler::RefreshTitlePaneTextL |
|
454 // (other items were commented in a header). |
|
455 // ----------------------------------------------------------------------------- |
|
456 // |
|
457 void CIMCVAppStatusPaneHandler::RefreshTitlePaneTextL() |
|
458 { |
|
459 // seems that this is the only way that the title pane text color updates.. |
|
460 if( iTitlePane->Text() ) |
|
461 { |
|
462 HBufC* origText = iTitlePane->Text()->AllocLC(); |
|
463 HBufC* empty = HBufC::NewLC( 1 ); |
|
464 iTitlePane->SetText( empty ); |
|
465 iTitlePane->SetText( origText); |
|
466 CleanupStack::Pop( 2, origText ); // empty, origText |
|
467 } |
|
468 } |
|
469 |
|
470 |
|
471 // ----------------------------------------------------------------------------- |
|
472 // CIMCVAppStatusPaneHandler::TabGroup |
|
473 // (other items were commented in a header). |
|
474 // ----------------------------------------------------------------------------- |
|
475 // |
|
476 CAknTabGroup* CIMCVAppStatusPaneHandler::TabGroup() const |
|
477 { |
|
478 // Returns pointer to topmost decorator's tabgroup |
|
479 return static_cast<CAknTabGroup*>( |
|
480 iNewDecoratedTabGroup->DecoratedControl() ); |
|
481 } |
|
482 |
|
483 |
|
484 |
|
485 // ----------------------------------------------------------------------------- |
|
486 // CIMCVAppStatusPaneHandler::PopNaviPane |
|
487 // (other items were commented in a header). |
|
488 // ----------------------------------------------------------------------------- |
|
489 // |
|
490 void CIMCVAppStatusPaneHandler::PopNaviPane() |
|
491 { |
|
492 // Pops the topmost decorator out of decorator stack. |
|
493 iNaviPane->Pop(); |
|
494 |
|
495 } |
|
496 |
|
497 |
|
498 // ----------------------------------------------------------------------------- |
|
499 // CIMCVAppStatusPaneHandler::ClearNaviPaneL |
|
500 // (other items were commented in a header). |
|
501 // ----------------------------------------------------------------------------- |
|
502 // |
|
503 void CIMCVAppStatusPaneHandler::ClearNaviPaneL( TBool aAllowDuplicates ) |
|
504 { |
|
505 // Pushes default decorator object (empty one) |
|
506 // to top of the stack and draws it. if aAllowDuplicates is ETrue |
|
507 // the new empty decorator is created on top of the stack, rather than |
|
508 // raising the existing one. |
|
509 iNaviPane->PushDefaultL( aAllowDuplicates ); |
|
510 } |
|
511 |
|
512 |
|
513 // --------------------------------------------------------- |
|
514 // CIMCVAppStatusPaneHandler::HandleChangeL |
|
515 // (other items were commented in a header). |
|
516 // --------------------------------------------------------- |
|
517 // |
|
518 void CIMCVAppStatusPaneHandler::HandleChangeL(TInt /*aServiceId*/, TInt aIndex, TOpenChatsEventType aChangeType) |
|
519 { |
|
520 switch( aChangeType ) |
|
521 { |
|
522 case ENewChat: |
|
523 { |
|
524 if( iCurrentTabId >= aIndex ) |
|
525 { |
|
526 iCurrentTabId = iCurrentTabId+1; |
|
527 iEngineFactory.SetActiveItemL( iCurrentTabId ); |
|
528 } |
|
529 const TDesC& chatId ( iEngineFactory.GetActiveItemL() ); |
|
530 TRAP_IGNORE( |
|
531 { |
|
532 if ( (iCurrentTabId == -1) || (!chatId.Length()) ) |
|
533 { |
|
534 ShowTabGroupL(iEngineFactory.GetTargetIdL(aIndex)); |
|
535 } |
|
536 else |
|
537 { |
|
538 ShowTabGroupL(chatId) ; |
|
539 } |
|
540 } |
|
541 ); |
|
542 break; |
|
543 } |
|
544 case EChatClosed: |
|
545 { |
|
546 if( aIndex == 0 ) |
|
547 { |
|
548 return; |
|
549 } |
|
550 iEngineFactory.SetActiveItemL( aIndex -1 ); |
|
551 |
|
552 const TDesC& chatId (iEngineFactory.GetActiveItemL()); |
|
553 |
|
554 TRAP_IGNORE( |
|
555 { |
|
556 if ( (iCurrentTabId == -1) || (!chatId.Length()) ) |
|
557 { |
|
558 ShowTabGroupL(iEngineFactory.GetTargetIdL(aIndex)); |
|
559 } |
|
560 else |
|
561 { |
|
562 ShowTabGroupL(chatId) ; |
|
563 } |
|
564 } |
|
565 ); |
|
566 |
|
567 break; |
|
568 } |
|
569 |
|
570 |
|
571 case EUnReadCountChanged: |
|
572 { |
|
573 |
|
574 const TDesC& chatId (iEngineFactory.GetActiveItemL()); |
|
575 |
|
576 if (!chatId.Length()) |
|
577 { |
|
578 break; |
|
579 } |
|
580 |
|
581 TRAP_IGNORE( |
|
582 { |
|
583 ShowTabGroupL(chatId, ETrue); |
|
584 PushFadeTextL(); |
|
585 ShowFadeText( *iStatusPaneText ); |
|
586 delete iStatusPaneText; |
|
587 iStatusPaneText = NULL; |
|
588 } |
|
589 ); |
|
590 |
|
591 break; |
|
592 } |
|
593 |
|
594 default: |
|
595 { |
|
596 //should never be here. |
|
597 break; |
|
598 } |
|
599 } |
|
600 |
|
601 |
|
602 } |
|
603 |
|
604 // --------------------------------------------------------- |
|
605 // CIMCVAppStatusPaneHandler::SetStatusMsgL() |
|
606 // (other items were commented in a header). |
|
607 // --------------------------------------------------------- |
|
608 // |
|
609 void CIMCVAppStatusPaneHandler::SetStatusMsgL(TInt /*aServiceId*/, TInt aIndex,const TDesC & aMsg) |
|
610 { |
|
611 if(aIndex>=0) |
|
612 { |
|
613 _LIT(KColun, ": "); |
|
614 iStatusPaneText = HBufC::NewL(iEngineFactory.GetTargetIdL(aIndex).Length() + |
|
615 aMsg.Length() + KColun().Length()); |
|
616 TPtr statusPanePtr(iStatusPaneText->Des()); |
|
617 |
|
618 statusPanePtr.Copy(iEngineFactory.GetTargetIdL(aIndex)); |
|
619 statusPanePtr.Append(KColun); |
|
620 statusPanePtr.Append(aMsg); |
|
621 } |
|
622 } |
|
623 |
|
624 |
|
625 |
|
626 // --------------------------------------------------------- |
|
627 // CIMCVAppStatusPaneHandler::RunFadeText() |
|
628 // (other items were commented in a header). |
|
629 // --------------------------------------------------------- |
|
630 // |
|
631 void CIMCVAppStatusPaneHandler::RunFadeText() |
|
632 { |
|
633 static_cast<CIMCVNewMsgFadeControl*>(iDecoratedFadeText->DecoratedControl())->Start(); |
|
634 } |
|
635 |
|
636 // ----------------------------------------------------------------------------- |
|
637 // CIMCVAppStatusPaneHandler::HideFadeText |
|
638 // (other items were commented in a header). |
|
639 // ----------------------------------------------------------------------------- |
|
640 // |
|
641 void CIMCVAppStatusPaneHandler::HideFadeText() |
|
642 { |
|
643 if ( iDecoratedFadeText ) |
|
644 { |
|
645 iNaviPane->Pop( iDecoratedFadeText ); |
|
646 } |
|
647 } |
|
648 |
|
649 // ----------------------------------------------------------------------------- |
|
650 // CIMCVAppStatusPaneHandler::ShowFadeText |
|
651 // (other items were commented in a header). |
|
652 // ----------------------------------------------------------------------------- |
|
653 // |
|
654 void CIMCVAppStatusPaneHandler::ShowFadeText( TDesC& aTextToFade ) |
|
655 { |
|
656 IMessageIndicator()->SetMessage( aTextToFade ); |
|
657 RunFadeText(); |
|
658 } |
|
659 |
|
660 // ----------------------------------------------------------------------------- |
|
661 // CIMCVAppStatusPaneHandler::ShowNavipaneIndicators |
|
662 // (other items were commented in a header). |
|
663 // ----------------------------------------------------------------------------- |
|
664 // |
|
665 void CIMCVAppStatusPaneHandler::ShowNavipaneIndicators() |
|
666 { |
|
667 MAknEditingStateIndicator* editStateIndicator = |
|
668 CAknEnv::Static()->EditingStateIndicator(); |
|
669 |
|
670 if ( editStateIndicator ) |
|
671 { |
|
672 CAknIndicatorContainer* indicatorContainer = editStateIndicator->IndicatorContainer(); |
|
673 |
|
674 if( indicatorContainer ) |
|
675 { |
|
676 indicatorContainer->SetIndicatorState( |
|
677 TUid::Uid( EAknNaviPaneEditorIndicatorMessageInfo ), |
|
678 EAknIndicatorStateOn ); |
|
679 } |
|
680 } |
|
681 } |
|
682 |
|
683 // --------------------------------------------------------- |
|
684 // CIMCVAppStatusPaneHandler::HideNavipaneIndicators() |
|
685 // (other items were commented in a header). |
|
686 // --------------------------------------------------------- |
|
687 // |
|
688 void CIMCVAppStatusPaneHandler::HideNavipaneIndicators() |
|
689 { |
|
690 MAknEditingStateIndicator* editStateIndicator = |
|
691 CAknEnv::Static()->EditingStateIndicator(); |
|
692 |
|
693 if ( editStateIndicator ) |
|
694 { |
|
695 CAknIndicatorContainer* indicatorContainer = editStateIndicator->IndicatorContainer(); |
|
696 |
|
697 if( indicatorContainer ) |
|
698 { |
|
699 indicatorContainer->SetIndicatorState( |
|
700 TUid::Uid( EAknNaviPaneEditorIndicatorMessageInfo ), |
|
701 EAknIndicatorStateOff ); |
|
702 } |
|
703 } |
|
704 } |
|
705 |
|
706 // ----------------------------------------------------------------------------- |
|
707 // CIMCVAppStatusPaneHandler::IMessageIndicator |
|
708 // (other items were commented in a header). |
|
709 // ----------------------------------------------------------------------------- |
|
710 // |
|
711 CIMCVNewMsgFadeControl* CIMCVAppStatusPaneHandler::IMessageIndicator() const |
|
712 { |
|
713 if( iDecoratedFadeText ) |
|
714 { |
|
715 return static_cast<CIMCVNewMsgFadeControl*>(iDecoratedFadeText->DecoratedControl()); |
|
716 } |
|
717 else |
|
718 { |
|
719 return NULL; |
|
720 } |
|
721 |
|
722 } |
|
723 |
|
724 // --------------------------------------------------------- |
|
725 // CIMCVAppStatusPaneHandler::PushFadeTextL() |
|
726 // (other items were commented in a header). |
|
727 // --------------------------------------------------------- |
|
728 // |
|
729 void CIMCVAppStatusPaneHandler::PushFadeTextL() |
|
730 { |
|
731 if ( iDecoratedFadeText ) |
|
732 { |
|
733 iNaviPane->PushL( *iDecoratedFadeText ); |
|
734 } |
|
735 } |
|
736 |
|
737 // --------------------------------------------------------- |
|
738 // CIMCVAppStatusPaneHandler::ResetFadeText() |
|
739 // (other items were commented in a header). |
|
740 // --------------------------------------------------------- |
|
741 // |
|
742 void CIMCVAppStatusPaneHandler::ResetFadeText() |
|
743 { |
|
744 IMessageIndicator()->Reset(); |
|
745 } |
|
746 |
|
747 |
|
748 // --------------------------------------------------------- |
|
749 // CIMCVAppStatusPaneHandler::InitMessageIndicatorL() |
|
750 // (other items were commented in a header). |
|
751 // --------------------------------------------------------- |
|
752 // |
|
753 void CIMCVAppStatusPaneHandler::InitMessageIndicatorL() |
|
754 { |
|
755 CAknNavigationDecorator* fade = CreateIMessageIndicatorL(); |
|
756 delete iDecoratedFadeText; |
|
757 iDecoratedFadeText = fade; |
|
758 } |
|
759 |
|
760 // --------------------------------------------------------- |
|
761 // CIMCVAppStatusPaneHandler::DestroyMessageIndicator() |
|
762 // (other items were commented in a header). |
|
763 // --------------------------------------------------------- |
|
764 // |
|
765 void CIMCVAppStatusPaneHandler::DestroyMessageIndicator() |
|
766 { |
|
767 delete iDecoratedFadeText; |
|
768 iDecoratedFadeText = NULL; |
|
769 } |
|
770 // --------------------------------------------------------- |
|
771 // CIMCVAppStatusPaneHandler::CreateIMessageIndicatorL() |
|
772 // (other items were commented in a header). |
|
773 // --------------------------------------------------------- |
|
774 // |
|
775 CAknNavigationDecorator* CIMCVAppStatusPaneHandler::CreateIMessageIndicatorL() |
|
776 { |
|
777 |
|
778 CEikStatusPane* statusPane = CEikonEnv::Static()->AppUiFactory()-> |
|
779 StatusPane(); |
|
780 |
|
781 CIMCVNewMsgFadeControl* fadetext = CIMCVNewMsgFadeControl::NewLC( |
|
782 statusPane->PaneRectL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
783 fadetext->SetContainerWindowL( *iNaviPane ); |
|
784 |
|
785 CAknNavigationDecorator* decoratedFadetext = |
|
786 CAknNavigationDecorator::NewL( iNaviPane, fadetext, |
|
787 CAknNavigationDecorator::EHintText ); |
|
788 |
|
789 CleanupStack::Pop( fadetext ); |
|
790 CleanupStack::PushL( decoratedFadetext ); |
|
791 decoratedFadetext->SetContainerWindowL( *iNaviPane ); |
|
792 decoratedFadetext->SetControlContext( iNaviPane ); |
|
793 decoratedFadetext->MakeScrollButtonVisible( EFalse ); |
|
794 |
|
795 CleanupStack::Pop( decoratedFadetext ); |
|
796 |
|
797 return decoratedFadetext; |
|
798 } |
|
799 |
|
800 // --------------------------------------------------------- |
|
801 // CIMCVAppStatusPaneHandler::ClearTitlePaneL() |
|
802 // (other items were commented in a header). |
|
803 // --------------------------------------------------------- |
|
804 // |
|
805 void CIMCVAppStatusPaneHandler::ClearTitlePaneL( ) |
|
806 { |
|
807 iTitlePane->SetTextL( _L(" ") ); |
|
808 iTitlePane->SetSmallPicture( NULL, NULL, EFalse ); |
|
809 } |
|
810 |
|
811 // ----------------------------------------------------------------------------- |
|
812 // CIMCVAppStatusPaneHandler::SetPreviousTitleL |
|
813 // (other items were commented in a header). |
|
814 // ----------------------------------------------------------------------------- |
|
815 // |
|
816 void CIMCVAppStatusPaneHandler::SetPreviousTitleL() |
|
817 { |
|
818 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::SetPreviousTitleL() start" )); |
|
819 |
|
820 HBufC* setTitle = NULL; |
|
821 if (iLastTitle) |
|
822 { |
|
823 setTitle = iLastTitle->AllocLC(); |
|
824 } |
|
825 else |
|
826 { |
|
827 setTitle = KNullDesC().AllocLC(); |
|
828 } |
|
829 SetTitleL(*setTitle); |
|
830 CleanupStack::PopAndDestroy(); |
|
831 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::SetPreviousTitleL() end" )); |
|
832 } |
|
833 |
|
834 |
|
835 // ----------------------------------------------------------------------------- |
|
836 // CIMCVAppStatusPaneHandler::SendBackGroundL |
|
837 // (other items were commented in a header). |
|
838 // ----------------------------------------------------------------------------- |
|
839 // |
|
840 void CIMCVAppStatusPaneHandler::SendBackGroundL() |
|
841 { |
|
842 ClearTitlePaneL(); |
|
843 ClearNaviPaneL(ETrue); |
|
844 } |
|
845 |
|
846 // ----------------------------------------------------------------------------- |
|
847 // CIMCVAppStatusPaneHandler::BringToForegroundL |
|
848 // (other items were commented in a header). |
|
849 // ----------------------------------------------------------------------------- |
|
850 // |
|
851 void CIMCVAppStatusPaneHandler::BringToForegroundL() |
|
852 { |
|
853 SetPreviousTitleL(); |
|
854 ShowTabL(); |
|
855 } |
|
856 |
|
857 // ----------------------------------------------------------------------------- |
|
858 // CVIMPSTProcessArray::RefreshTabL() |
|
859 // ----------------------------------------------------------------------------- |
|
860 // |
|
861 void CIMCVAppStatusPaneHandler::RefreshTabL(const TDesC& aUserId, const TDesC& aDisplayName) |
|
862 { |
|
863 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::RefreshTab() Start" )); |
|
864 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::RefreshTab()aUserId: %S " ), &aUserId); |
|
865 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::RefreshTab() aDisplayName : %S " ), &aDisplayName); |
|
866 // find if itsthe active conversation, only then the |
|
867 // the statuspane title and tab text should be updated. |
|
868 CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>( |
|
869 iNewDecoratedTabGroup->DecoratedControl()); |
|
870 if (tabGroup) |
|
871 { |
|
872 TInt index = iEngineFactory.FindIndexL(aUserId); |
|
873 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::RefreshTab() Get the index %d" ), index); |
|
874 if(KErrNotFound != index) |
|
875 { |
|
876 const TDesC& activeContversationName = iEngineFactory.GetTargetIdL(index); |
|
877 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::RefreshTab(): %S " ), &activeContversationName); |
|
878 |
|
879 if(activeContversationName.Compare(aUserId) == 0 ) |
|
880 { |
|
881 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::RefreshTab(): Inside if" )); |
|
882 SetTitleL(aDisplayName); |
|
883 } |
|
884 // only the tab text needs to be updated. |
|
885 tabGroup->ReplaceTabTextL( index, aDisplayName); |
|
886 } |
|
887 } |
|
888 IM_CV_LOGS(TXT("CIMCVAppStatusPaneHandler::RefreshTab() End" )); |
|
889 } |
|
890 //End of file |