wvuing/wvuiave/AppSrc/CCAStatusPaneHandler.cpp
branchRCL_3
changeset 13 a941bc465d9f
parent 0 094583676ce7
equal deleted inserted replaced
12:6ca72c0fe49a 13:a941bc465d9f
       
     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:  Handles statuspane, context pane, navi pane
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include	"CCAStatusPaneHandler.h"
       
    21 #include	"CAExternalInterface.h"
       
    22 #include	"ChatDefinitions.h"
       
    23 #include	"CCAAppUi.h"
       
    24 #include	"CCAApp.h"				// A/H variation
       
    25 #include	"CCAVariantFactory.h"
       
    26 #include    "CCAIconLoader.h"
       
    27 #include	"MCAAHVariant.h"
       
    28 #include	"MCASkinVariant.h"
       
    29 #include    "CCAUISessionManager.h"
       
    30 
       
    31 #include    <chatNG.mbg>
       
    32 #include	<eikspane.h>
       
    33 #include	<akntitle.h>
       
    34 #include	<aknnavi.h>
       
    35 #include	<aknenv.h>
       
    36 #include	<akncontext.h>
       
    37 #include	<barsread.h>
       
    38 #include	<aknindicatorcontainer.h>
       
    39 #include	<gulicon.h>
       
    40 #include	<stringloader.h>
       
    41 
       
    42 #include	"MCAProcessManager.h"
       
    43 #include	"MCAOpenChatsPC.h"
       
    44 #include	"MCAMainViewArrayPC.h"
       
    45 #include	"MCAInvitationPC.h"
       
    46 #include	"CCAMainViewArrayPC.h"
       
    47 #include	"MCAStoredGroups.h"
       
    48 
       
    49 // The Settings have been moved to Cenrep (also retained in the Resource file),
       
    50 // so the enums for keys and central repository header is added here
       
    51 #include 	"VariantKeys.h"
       
    52 
       
    53 #include	<eikdef.h>
       
    54 #include    <chatNG.rsg>
       
    55 
       
    56 const TUint16 KNewMessageIcon( 0xF818 );
       
    57 
       
    58 // ================= MEMBER FUNCTIONS =======================
       
    59 
       
    60 // C++ default constructor can NOT contain any code, that
       
    61 // might leave.
       
    62 //
       
    63 CCAStatusPaneHandler::CCAStatusPaneHandler()
       
    64     {
       
    65     }
       
    66 
       
    67 // Symbian OS default constructor can leave.
       
    68 void CCAStatusPaneHandler::ConstructL()
       
    69     {
       
    70     iAppUi = static_cast<CCAAppUi*>( CEikonEnv::Static()->AppUi() );
       
    71 
       
    72     // Get pointer to status-pane
       
    73     CEikStatusPane* statusPane = CEikonEnv::Static()->AppUiFactory()->
       
    74                                  StatusPane();
       
    75 
       
    76     // Get pointer to navi-pane
       
    77     iNaviPane = static_cast<CAknNavigationControlContainer*>(
       
    78                     statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
       
    79 
       
    80     // Get pointer to title-pane
       
    81     iTitlePane = static_cast<CAknTitlePane*>( statusPane->ControlL(
       
    82                                                   TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
    83 
       
    84     iContextPane = static_cast<CAknContextPane*>( statusPane->ControlL(
       
    85                                                       TUid::Uid( EEikStatusPaneUidContext ) ) );
       
    86 
       
    87     iNewMsgIcon = HBufC::NewL( 1 );
       
    88 
       
    89     TPtr iconPtr( iNewMsgIcon->Des() );
       
    90     iconPtr.Append( TChar( KNewMessageIcon ) );
       
    91 
       
    92     iInvitationTabText = CEikonEnv::Static()->AllocReadResourceL( R_QTN_CHAT_INVITATION_TAB );
       
    93 
       
    94     //store the process components
       
    95     MCAMainViewArrayPC* mainViewArrayPC = iAppUi->GetProcessManager().GetArrayInterface();
       
    96 
       
    97     iOpenChatsPC = iAppUi->GetProcessManager().CreateOpenChatsPCL( mainViewArrayPC->GetOpenChatsArray() );
       
    98 
       
    99     iOpenChatsPC->SetInvitationIdentification( iInvitationTabText );
       
   100 
       
   101     }
       
   102 
       
   103 // Two-phased constructor.
       
   104 CCAStatusPaneHandler* CCAStatusPaneHandler::NewL()
       
   105     {
       
   106     CCAStatusPaneHandler* self = new ( ELeave ) CCAStatusPaneHandler;
       
   107 
       
   108     CleanupStack::PushL( self );
       
   109     self->ConstructL();
       
   110     CleanupStack::Pop( self );
       
   111 
       
   112     return self;
       
   113     }
       
   114 
       
   115 
       
   116 // Destructor
       
   117 CCAStatusPaneHandler::~CCAStatusPaneHandler()
       
   118     {
       
   119     if ( iAppUi )
       
   120         {
       
   121         MCAMainViewArrayPC* mainViewArrayPC = iAppUi->GetProcessManager().GetArrayInterface();
       
   122         if ( mainViewArrayPC )
       
   123             {
       
   124             mainViewArrayPC->RemoveObserver( this );
       
   125             }
       
   126         }
       
   127 
       
   128     iObserverList.Reset();
       
   129 
       
   130     delete iNewMsgIcon;
       
   131     delete iInvitationTabText;
       
   132     delete iNewDecoratedTabGroup;
       
   133     delete iNaviPaneText;
       
   134     delete iOpenChatsPC;
       
   135     }
       
   136 
       
   137 // -----------------------------------------------------------------------------
       
   138 // CCAStatusPaneHandler::SetPicture
       
   139 // (other items were commented in a header).
       
   140 // -----------------------------------------------------------------------------
       
   141 //
       
   142 void CCAStatusPaneHandler::SetPicture( const CFbsBitmap* aPicture ,
       
   143                                        const CFbsBitmap* aMask )
       
   144     {
       
   145     iContextPane->SetPicture( aPicture, aMask );
       
   146     }
       
   147 
       
   148 // ---------------------------------------------------------
       
   149 // CCAStatusPaneHandler::ShowTabGroupL
       
   150 // (other items were commented in a header).
       
   151 // ---------------------------------------------------------
       
   152 //
       
   153 TInt CCAStatusPaneHandler::ShowTabGroupL( const TEnumsPC::TItem aType, const TDesC& aId,
       
   154                                           const TBool noCreate /* = EFalse */ )
       
   155     {
       
   156 
       
   157     iPrevTabId = 0;
       
   158     iCurrentTabId = 0;
       
   159 
       
   160     if ( ! iProhibitTabGroup )
       
   161         {
       
   162 
       
   163         MCAMainViewArrayPC* mainViewArrayPC = iAppUi->GetProcessManager().GetArrayInterface();
       
   164 
       
   165         iCurrentTabId = mainViewArrayPC->FindIndexOfOpenChatsItem( aType, aId );
       
   166 
       
   167         mainViewArrayPC->AddObserverL( this );
       
   168 
       
   169         CreateTabsL( noCreate );
       
   170 
       
   171         if ( !noCreate )
       
   172             {
       
   173             TabGroup()->SetActiveTabById( iCurrentTabId );
       
   174 
       
   175             iOpenChatsPC->SetActiveItem( iCurrentTabId );
       
   176             }
       
   177 
       
   178         iNaviTabsActivated = ETrue;
       
   179         }
       
   180 
       
   181     return iCurrentTabId;
       
   182 
       
   183     }
       
   184 
       
   185 // ---------------------------------------------------------
       
   186 // CCAStatusPaneHandler::ShowTabGroupL
       
   187 // (other items were commented in a header).
       
   188 // ---------------------------------------------------------
       
   189 //
       
   190 void CCAStatusPaneHandler::ShowTabGroupL( const TUid /*aViewId*/ )
       
   191     {
       
   192     /*
       
   193         if ( ! iProhibitTabGroup )
       
   194             {
       
   195             LoadBitmapsL();
       
   196             iActiveViewId = aViewId;
       
   197 
       
   198             // Pushes new decorator object to top of the stack and draws it
       
   199             iNaviPane->PushL( *iNewDecoratedTabGroup );
       
   200             TabGroup()->SetActiveTabById( aViewId.iUid );
       
   201             iNaviTabsActivated = ETrue;
       
   202             }
       
   203     */
       
   204     }
       
   205 
       
   206 
       
   207 
       
   208 // ---------------------------------------------------------
       
   209 // CCAStatusPaneHandler::SynchroniseAndRemoveTabGroup
       
   210 // (other items were commented in a header).
       
   211 // ---------------------------------------------------------
       
   212 //
       
   213 void CCAStatusPaneHandler::SynchroniseAndRemoveTabGroup( )
       
   214     {
       
   215 
       
   216     iOpenChatsPC->SetActiveItem( -1 );
       
   217 
       
   218     MCAMainViewArrayPC* mainViewArrayPC = iAppUi->GetProcessManager().GetArrayInterface();
       
   219 
       
   220     mainViewArrayPC->RemoveObserver( this );
       
   221 
       
   222     if ( iOpenChatsPC->Count() > 1 )
       
   223         {
       
   224         //only pop this item if it is pushed
       
   225         //if there is more than 1 item in the tab, then  it is
       
   226         //pushed. Then only pop.
       
   227         PopNaviPane();
       
   228         }
       
   229 
       
   230     delete iNewDecoratedTabGroup;
       
   231     iNewDecoratedTabGroup = NULL;
       
   232 
       
   233 
       
   234     }
       
   235 // -----------------------------------------------------------------------------
       
   236 // CCAStatusPaneHandler::ClearNaviPaneL
       
   237 // (other items were commented in a header).
       
   238 // -----------------------------------------------------------------------------
       
   239 //
       
   240 void CCAStatusPaneHandler::ClearNaviPaneL( TBool aAllowDuplicates )
       
   241     {
       
   242     // Pushes default decorator object (empty one)
       
   243     // to top of the stack and draws it. if aAllowDuplicates is ETrue
       
   244     // the new empty decorator is created on top of the stack, rather than
       
   245     // raising the existing one.
       
   246     iNaviPane->PushDefaultL( aAllowDuplicates );
       
   247 
       
   248     iNaviTabsActivated = EFalse;
       
   249     }
       
   250 
       
   251 // -----------------------------------------------------------------------------
       
   252 // CCAStatusPaneHandler::RestoreNaviPane
       
   253 // (other items were commented in a header).
       
   254 // -----------------------------------------------------------------------------
       
   255 //
       
   256 void CCAStatusPaneHandler::RestoreNaviPane()
       
   257     {
       
   258     // Pushes decorator object (tabs)
       
   259     // to top of the stack and draws it
       
   260     iProhibitTabGroup = EFalse;
       
   261     iNaviTabsActivated = ETrue;
       
   262     if ( iNewDecoratedTabGroup )
       
   263         {
       
   264         TRAP_IGNORE( ShowTabL() );
       
   265         }
       
   266 
       
   267     }
       
   268 
       
   269 // -----------------------------------------------------------------------------
       
   270 // CCAStatusPaneHandler::SetTitleL
       
   271 // (other items were commented in a header).
       
   272 // -----------------------------------------------------------------------------
       
   273 //
       
   274 void CCAStatusPaneHandler::SetTitleL( const TDesC& aTitle )
       
   275     {
       
   276     iTitlePane->SetTextL( aTitle );
       
   277     }
       
   278 
       
   279 // -----------------------------------------------------------------------------
       
   280 // CCAStatusPaneHandler::SetTitleL
       
   281 // (other items were commented in a header).
       
   282 // -----------------------------------------------------------------------------
       
   283 //
       
   284 void CCAStatusPaneHandler::SetTitleL( CEikonEnv* aEikonEnv, TInt aResourceId )
       
   285     {
       
   286     if ( !aEikonEnv )
       
   287         {
       
   288         return;
       
   289         }
       
   290     HBufC* title = aEikonEnv->AllocReadResourceLC( aResourceId );
       
   291     SetTitleL( *title );
       
   292     CleanupStack::PopAndDestroy( title );
       
   293     }
       
   294 
       
   295 // -----------------------------------------------------------------------------
       
   296 // CCAStatusPaneHandler::SetTitleL
       
   297 // (other items were commented in a header).
       
   298 // -----------------------------------------------------------------------------
       
   299 //
       
   300 void CCAStatusPaneHandler::SetTitleL( TInt aResourceId,
       
   301                                       const TDesC& aSearchString )
       
   302     {
       
   303     HBufC* title = StringLoader::LoadLC( aResourceId, aSearchString );
       
   304     SetTitleL( *title );
       
   305     CleanupStack::PopAndDestroy( title );
       
   306     }
       
   307 
       
   308 // -----------------------------------------------------------------------------
       
   309 // CCAStatusPaneHandler::SetNaviLabelL
       
   310 // (other items were commented in a header).
       
   311 // -----------------------------------------------------------------------------
       
   312 //
       
   313 void CCAStatusPaneHandler::SetNaviLabelL( const TDesC& aText )
       
   314     {
       
   315     HBufC* newTitle = HBufC::NewLC( aText.Length() + KTab().Length() );
       
   316     TPtr titlePtr( newTitle->Des() );
       
   317 
       
   318     titlePtr.Copy( aText.Left( titlePtr.MaxLength() ) );
       
   319 
       
   320     CAknNavigationDecorator* tmpNaviPaneText =
       
   321         iNaviPane->CreateMessageLabelL( titlePtr );
       
   322     CleanupStack::PushL( tmpNaviPaneText );
       
   323     iNaviPane->PushL( *tmpNaviPaneText );
       
   324     CleanupStack::Pop( tmpNaviPaneText );
       
   325     delete iNaviPaneText;
       
   326     iNaviPaneText = tmpNaviPaneText;
       
   327 
       
   328     iNaviTabsActivated = EFalse;
       
   329 
       
   330     CleanupStack::PopAndDestroy( newTitle );
       
   331     }
       
   332 
       
   333 // -----------------------------------------------------------------------------
       
   334 // CCAStatusPaneHandler::TabGroup
       
   335 // (other items were commented in a header).
       
   336 // -----------------------------------------------------------------------------
       
   337 //
       
   338 CAknTabGroup* CCAStatusPaneHandler::TabGroup() const
       
   339     {
       
   340     // Returns pointer to topmost decorator's tabgroup
       
   341 	if ( iNewDecoratedTabGroup )
       
   342 		{
       
   343 	    return static_cast<CAknTabGroup*>( 
       
   344 	                        iNewDecoratedTabGroup->DecoratedControl() );
       
   345 		}
       
   346 	else
       
   347 		{
       
   348 	    return NULL;
       
   349 		}
       
   350     }
       
   351 
       
   352 
       
   353 // -----------------------------------------------------------------------------
       
   354 // CCAStatusPaneHandler::ActiveTabViewId
       
   355 // (other items were commented in a header).
       
   356 // -----------------------------------------------------------------------------
       
   357 //
       
   358 TUid CCAStatusPaneHandler::ActiveTabViewId()
       
   359     {
       
   360     return TUid::Uid( TabGroup()->TabIdFromIndex(
       
   361                           TabGroup()->ActiveTabIndex() ) );
       
   362     }
       
   363 
       
   364 // -----------------------------------------------------------------------------
       
   365 // CCAStatusPaneHandler::ActivateTab
       
   366 // (other items were commented in a header).
       
   367 // -----------------------------------------------------------------------------
       
   368 //
       
   369 void CCAStatusPaneHandler::ActivateTab( const TInt aIndex )
       
   370     {
       
   371     if ( iNaviTabsActivated )
       
   372         {
       
   373         TabGroup()->SetActiveTabByIndex( aIndex );
       
   374         iOpenChatsPC->SetActiveItem( aIndex );
       
   375         }
       
   376     }
       
   377 
       
   378 // -----------------------------------------------------------------------------
       
   379 // CCAStatusPaneHandler::RefreshTitlePaneTextL
       
   380 // (other items were commented in a header).
       
   381 // -----------------------------------------------------------------------------
       
   382 //
       
   383 void CCAStatusPaneHandler::RefreshTitlePaneTextL()
       
   384     {
       
   385     // seems that this is the only way that the title pane text color updates..
       
   386     if ( iTitlePane->Text() )
       
   387         {
       
   388         HBufC* origText = iTitlePane->Text()->AllocLC();
       
   389         HBufC* empty = HBufC::NewLC( 1 );
       
   390         iTitlePane->SetText( empty );
       
   391         iTitlePane->SetText( origText );
       
   392         CleanupStack::Pop( 2, origText ); // empty, origText
       
   393         }
       
   394     }
       
   395 
       
   396 // -----------------------------------------------------------------------------
       
   397 // CCAStatusPaneHandler::RefreshTitlePaneTextL
       
   398 // (other items were commented in a header).
       
   399 // -----------------------------------------------------------------------------
       
   400 //
       
   401 const TDesC* CCAStatusPaneHandler::Title()
       
   402     {
       
   403     return iTitlePane->Text();
       
   404     }
       
   405 
       
   406 // -----------------------------------------------------------------------------
       
   407 // CCAStatusPaneHandler::ProhibitTabGroup
       
   408 // (other items were commented in a header).
       
   409 // -----------------------------------------------------------------------------
       
   410 //
       
   411 void CCAStatusPaneHandler::ProhibitTabGroup( TBool aProhibit /* ETrue */ )
       
   412     {
       
   413     iProhibitTabGroup = aProhibit;
       
   414     iNaviTabsActivated = !aProhibit;
       
   415     }
       
   416 
       
   417 // -----------------------------------------------------------------------------
       
   418 // CCAStatusPaneHandler::CreateTabsL
       
   419 // (other items were commented in a header).
       
   420 // -----------------------------------------------------------------------------
       
   421 //
       
   422 void CCAStatusPaneHandler::CreateTabsL( const TBool noCreate )
       
   423     {
       
   424 
       
   425     MCAMainViewArrayPC* mainViewArrayPC = iAppUi->GetProcessManager().GetArrayInterface();
       
   426     iOpenChatArrayCount = iOpenChatsPC->Count();
       
   427     TInt openChatsCount = mainViewArrayPC->GetOpenChatsActiveIndex() + 1;
       
   428 
       
   429     if ( ( noCreate ) && ( iNewDecoratedTabGroup ) )
       
   430         {
       
   431 
       
   432         CAknTabGroup* origtabGroup =
       
   433             static_cast<CAknTabGroup*>( iNewDecoratedTabGroup->DecoratedControl() );
       
   434 
       
   435         if ( origtabGroup->TabCount() == ( openChatsCount - 1 ) )
       
   436             {
       
   437 
       
   438             for ( TInt index = 1; index < openChatsCount; index++ )
       
   439                 {
       
   440                 const TEnumsPC::TItem itemType = iOpenChatsPC->GetType( index );
       
   441                 const TPtrC itemId = iOpenChatsPC->GetId( index );
       
   442 
       
   443                 if ( ( mainViewArrayPC->IsOpenChatsMsgPending( itemType, itemId ) )
       
   444                      && ( index != iCurrentTabId ) )
       
   445                     {
       
   446                     origtabGroup->ReplaceTabTextL( index, iNewMsgIcon->Des() );
       
   447                     }
       
   448                 else
       
   449                     {
       
   450                     origtabGroup->ReplaceTabTextL( index, iOpenChatsPC->GetIdentification( index ) );
       
   451                     }
       
   452                 }
       
   453 
       
   454             return;
       
   455 
       
   456             }
       
   457 
       
   458         }
       
   459     CAknNavigationDecorator* tmpDecoration = iNaviPane->CreateTabGroupL();
       
   460 
       
   461     CleanupStack::PushL( tmpDecoration );
       
   462 
       
   463     CAknTabGroup* tabGroup =
       
   464         static_cast<CAknTabGroup*>( tmpDecoration->DecoratedControl() );
       
   465 
       
   466     tabGroup->SetTabFixedWidthL( KTabWidthWithTwoTabs );
       
   467 
       
   468     tabGroup->SetObserver  ( this );
       
   469 
       
   470 
       
   471     for ( TInt index = 1; index < openChatsCount; index++ )
       
   472         {
       
   473         const TEnumsPC::TItem itemType = iOpenChatsPC->GetType( index );
       
   474         const TPtrC itemId = iOpenChatsPC->GetId( index );
       
   475 
       
   476         if ( ( mainViewArrayPC->IsOpenChatsMsgPending( itemType, itemId ) )
       
   477              && ( index != iCurrentTabId ) )
       
   478             {
       
   479             tabGroup->AddTabL( index, iNewMsgIcon->Des() );
       
   480             }
       
   481         else
       
   482             {
       
   483             tabGroup->AddTabL( index, iOpenChatsPC->GetIdentification( index ) );
       
   484             }
       
   485         }
       
   486 
       
   487 
       
   488     CleanupStack::Pop( tmpDecoration );
       
   489 
       
   490     delete iNewDecoratedTabGroup;
       
   491     iNewDecoratedTabGroup = tmpDecoration;
       
   492 
       
   493     ShowTabL();
       
   494 
       
   495     RefreshTitlePaneTextL();
       
   496     }
       
   497 
       
   498 // -----------------------------------------------------------------------------
       
   499 // CCAStatusPaneHandler::PopNaviPane
       
   500 // (other items were commented in a header).
       
   501 // -----------------------------------------------------------------------------
       
   502 //
       
   503 void CCAStatusPaneHandler::PopNaviPane()
       
   504     {
       
   505     // Pops the topmost decorator out of decorator stack.
       
   506     iNaviPane->Pop();
       
   507 
       
   508     }
       
   509 
       
   510 
       
   511 // -----------------------------------------------------------------------------
       
   512 // CCAStatusPaneHandler::TabChangedL
       
   513 // (other items were commented in a header).
       
   514 // -----------------------------------------------------------------------------
       
   515 //
       
   516 void CCAStatusPaneHandler::TabChangedL( TInt aIndex )
       
   517     {
       
   518 
       
   519     TInt activechatitemindex;
       
   520     CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>(
       
   521                                  iNewDecoratedTabGroup->DecoratedControl() );
       
   522     if ( tabGroup )
       
   523         {
       
   524         if ( TEnumsPC::ERegister == iAppUi->RetForwardTo() ||
       
   525              TEnumsPC::EAlreadyRegistered == iAppUi->RetForwardTo() )
       
   526             {
       
   527             iAppUi->SetResetForwardTo( TEnumsPC::EToBeUnregistered );
       
   528             }
       
   529         tabGroup->SetActiveTabByIndex( aIndex );
       
   530         iOpenChatsPC->SetActiveItem( tabGroup->ActiveTabId() );
       
   531 
       
   532         iPrevTabId = iCurrentTabId;
       
   533         iCurrentTabId = tabGroup->ActiveTabId();
       
   534 
       
   535         if ( iOpenChatArrayCount > iOpenChatsPC->Count() )
       
   536             {
       
   537             activechatitemindex =  ( ( iPrevTabId < iCurrentTabId ) ? iPrevTabId : iCurrentTabId );
       
   538             }
       
   539         else
       
   540             {
       
   541             activechatitemindex =  iCurrentTabId ;
       
   542             }
       
   543 
       
   544         tabGroup->ReplaceTabTextL( iCurrentTabId, iOpenChatsPC->GetIdentification( activechatitemindex ) ); // replace of iCurrentTabId using activechatitemindex
       
   545 
       
   546         if ( iOpenChatsPC->GetType( iCurrentTabId ) == iOpenChatsPC->GetType( iPrevTabId ) )
       
   547             {
       
   548             for ( TInt index = 0; index < iObserverList.Count(); index++ )
       
   549                 {
       
   550                 iObserverList[index]->SwitchTabL( iOpenChatsPC->GetId( iCurrentTabId ), iCurrentTabId );
       
   551                 }
       
   552             }
       
   553         else
       
   554             {
       
   555 
       
   556             switch ( iOpenChatsPC->GetType( iCurrentTabId ) )
       
   557                 {
       
   558                 case TEnumsPC::EConversationItem:
       
   559                     {
       
   560                     TCADnlConvView dnlConView;
       
   561                     dnlConView.iWVID = iOpenChatsPC->GetId( iCurrentTabId );
       
   562                     dnlConView.iIsForwarded = EFalse;
       
   563                     dnlConView.iSAPChanged = EFalse;
       
   564                     dnlConView.iSwitchTab = ETrue;
       
   565                     dnlConView.iTabId = iCurrentTabId;
       
   566 
       
   567                     TCADnlConvViewBuf convMsgBuf( dnlConView );
       
   568 
       
   569                     iAppUi->ActivateLocalViewL( KUidConversationsView, KUidConvViewMsgId, convMsgBuf );
       
   570 
       
   571                     break;
       
   572                     }
       
   573                 case TEnumsPC::EInviteItem:
       
   574                     {
       
   575                     TCADnlInvView dnlInvView;
       
   576 
       
   577                     MCAInvitationPC& invitePC( *iAppUi->GetProcessManager().GetInvitationsInterface() );
       
   578 
       
   579                     dnlInvView.iInvitationIndex = invitePC.FindInvitationIndex(
       
   580                                                       iOpenChatsPC->GetId( iCurrentTabId ) );
       
   581                     dnlInvView.iInviteID = iOpenChatsPC->GetId( iCurrentTabId );
       
   582                     dnlInvView.iSwitchTab = ETrue;
       
   583                     dnlInvView.iTabId = iCurrentTabId;
       
   584 
       
   585                     TCADnlInvViewBuf invMsgBuf( dnlInvView );
       
   586 
       
   587                     iAppUi->ActivateLocalViewL( KUidInvitationView, KUidInvViewMsgId, invMsgBuf  );
       
   588                     break;
       
   589                     }
       
   590                 case TEnumsPC::EGroupItem:
       
   591                     {
       
   592                     TCADnlChatView viewDnl;
       
   593                     viewDnl.iIsForwarded = EFalse;
       
   594                     viewDnl.iSwitchTab = ETrue;
       
   595                     viewDnl.iGroupId = iOpenChatsPC->GetId( iCurrentTabId );
       
   596                     viewDnl.iGroupName = iOpenChatsPC->GetIdentification( iCurrentTabId );
       
   597                     viewDnl.iInviteQuery = EFalse;
       
   598                     viewDnl.iTabId = iCurrentTabId;
       
   599 
       
   600                     TCADnlChatViewBuf grpMsgBuf( viewDnl );
       
   601 
       
   602                     iAppUi->ActivateLocalViewL( KUidChatView, KUidChatViewMsgId, grpMsgBuf  );
       
   603                     break;
       
   604                     }
       
   605                 default:
       
   606                     break;
       
   607                 }
       
   608 
       
   609             }
       
   610         }
       
   611     }
       
   612 
       
   613 // -----------------------------------------------------------------------------
       
   614 // CCAStatusPaneHandler: AddObserver
       
   615 // -----------------------------------------------------------------------------
       
   616 //
       
   617 void CCAStatusPaneHandler::AddObserver(
       
   618     MCATabObserver* aObserver )
       
   619     {
       
   620 
       
   621     ASSERT( aObserver );
       
   622     TInt status( iObserverList.Find( aObserver ) );
       
   623     if ( status == KErrNotFound )
       
   624         {
       
   625         status = iObserverList.Append( aObserver ) ;
       
   626         if ( status != KErrNone )
       
   627             {
       
   628             CActiveScheduler::Current()->Error( status );
       
   629             }
       
   630         }
       
   631 
       
   632     }
       
   633 
       
   634 
       
   635 // -----------------------------------------------------------------------------
       
   636 // CCAStatusPaneHandler: RemoveObserver
       
   637 // -----------------------------------------------------------------------------
       
   638 //
       
   639 void CCAStatusPaneHandler::RemoveObserver(
       
   640     MCATabObserver* aObserver )
       
   641     {
       
   642 
       
   643     ASSERT( aObserver );
       
   644     const TInt status( iObserverList.Find( aObserver ) );
       
   645     if ( status != KErrNotFound )
       
   646         {
       
   647         iObserverList.Remove( status );
       
   648         iObserverList.Compress();
       
   649         }
       
   650 
       
   651 
       
   652     }
       
   653 
       
   654 
       
   655 // ---------------------------------------------------------
       
   656 // CCAStatusPaneHandler::ShowTabL
       
   657 // (other items were commented in a header).
       
   658 // ---------------------------------------------------------
       
   659 //
       
   660 void CCAStatusPaneHandler::ShowTabL()
       
   661     {
       
   662 
       
   663     MCAMainViewArrayPC* mainViewArrayPC = iAppUi->GetProcessManager().GetArrayInterface();
       
   664 
       
   665     if ( mainViewArrayPC->GetOpenChatsActiveIndex() <= 1 )
       
   666         {
       
   667         return;
       
   668         }
       
   669 
       
   670     CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>(
       
   671                                  iNewDecoratedTabGroup->DecoratedControl() );
       
   672 
       
   673     tabGroup->SetActiveTabById( iCurrentTabId );
       
   674     iOpenChatsPC->SetActiveItem( iCurrentTabId );
       
   675 
       
   676     /* Pushes new decorator object to top of the stack and draws it*/
       
   677 
       
   678     iNaviPane->PushL( *iNewDecoratedTabGroup );
       
   679 
       
   680     }
       
   681 
       
   682 
       
   683 // ---------------------------------------------------------
       
   684 // CCAStatusPaneHandler::HideTab
       
   685 // (other items were commented in a header).
       
   686 // ---------------------------------------------------------
       
   687 //
       
   688 void CCAStatusPaneHandler::HideTab()
       
   689     {
       
   690 
       
   691     MCAMainViewArrayPC* mainViewArrayPC = iAppUi->GetProcessManager().GetArrayInterface();
       
   692 
       
   693     if ( mainViewArrayPC->GetOpenChatsActiveIndex() <= 1 )
       
   694         {
       
   695         return;
       
   696         }
       
   697 
       
   698     /* Pops*/
       
   699     iNaviPane->Pop( iNewDecoratedTabGroup );
       
   700 
       
   701     }
       
   702 
       
   703 
       
   704 
       
   705 // ---------------------------------------------------------
       
   706 // CCAStatusPaneHandler::ResetAndShowCurrentTabL
       
   707 // (other items were commented in a header).
       
   708 // ---------------------------------------------------------
       
   709 //
       
   710 TInt CCAStatusPaneHandler::ResetAndShowCurrentTabL( const TEnumsPC::TItem aType,
       
   711                                                     const TDesC& aWvId )
       
   712     {
       
   713 
       
   714     HideTab();
       
   715     return ShowTabGroupL( aType, aWvId );
       
   716 
       
   717     }
       
   718 
       
   719 // ---------------------------------------------------------
       
   720 // CCAStatusPaneHandler::SetActiveTabByIndex
       
   721 // (other items were commented in a header).
       
   722 // ---------------------------------------------------------
       
   723 //
       
   724 void CCAStatusPaneHandler::SetActiveTabByIndex( const TInt aIndex )
       
   725     {
       
   726 
       
   727     CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>(
       
   728                                  iNewDecoratedTabGroup->DecoratedControl() );
       
   729 
       
   730     if ( !tabGroup )
       
   731         {
       
   732         return ;
       
   733         }
       
   734 
       
   735     iCurrentTabId = aIndex;
       
   736 
       
   737     TRAP_IGNORE( tabGroup->ReplaceTabL( iCurrentTabId,
       
   738                                         iOpenChatsPC->GetIdentification( iCurrentTabId ) ) );
       
   739 
       
   740     tabGroup->SetActiveTabById( iCurrentTabId );
       
   741 
       
   742     iOpenChatsPC->SetActiveItem( iCurrentTabId );
       
   743 
       
   744     }
       
   745 
       
   746 // ---------------------------------------------------------
       
   747 // CCAStatusPaneHandler::GetTabItemIdentification
       
   748 // (other items were commented in a header).
       
   749 // ---------------------------------------------------------
       
   750 //
       
   751 const TPtrC CCAStatusPaneHandler::GetTabItemIdentification( const TInt aIndex )
       
   752     {
       
   753     return iOpenChatsPC->GetIdentification( aIndex );
       
   754     }
       
   755 
       
   756 
       
   757 //callbacks
       
   758 // ---------------------------------------------------------
       
   759 // CCAStatusPaneHandler::HandleChange
       
   760 // (other items were commented in a header).
       
   761 // ---------------------------------------------------------
       
   762 //
       
   763 void CCAStatusPaneHandler::HandleChange( TEnumsPC::TItem aType, TInt /*aIndex*/, TEnumsPC::TChange aChangeType )
       
   764     {
       
   765 
       
   766     switch ( aType )
       
   767         {
       
   768             // first handle for own data if it has..
       
   769 
       
   770         case TEnumsPC::EOpenChatsListItem:
       
   771             {
       
   772             switch ( aChangeType )
       
   773                 {
       
   774                 case TEnumsPC::EChanged:
       
   775                 case TEnumsPC::EAddition:
       
   776                 case TEnumsPC::EDelete:
       
   777                     {
       
   778                     TDesC* iD = NULL;
       
   779                     TEnumsPC::TItem type;
       
   780 
       
   781                     MCAMainViewArrayPC* mainViewArrayPC = iAppUi->GetProcessManager().GetArrayInterface();
       
   782 
       
   783 
       
   784 
       
   785                     if ( mainViewArrayPC )
       
   786                         {
       
   787                         TRAP_IGNORE( mainViewArrayPC->PopulateGroupsListL() );
       
   788                         }
       
   789 
       
   790                     iOpenChatsPC->GetActiveItem( iD, type );
       
   791 
       
   792                     TRAP_IGNORE( ShowTabGroupL( type, *iD ) );
       
   793 
       
   794 
       
   795                     break;
       
   796                     }
       
   797                 case TEnumsPC::EUnReadCountChanged:
       
   798                     {
       
   799 
       
   800                     TDesC* iD = NULL;
       
   801                     TEnumsPC::TItem type;
       
   802 
       
   803                     iOpenChatsPC->GetActiveItem( iD, type );
       
   804 
       
   805                     TRAP_IGNORE( ShowTabGroupL( type, *iD, ETrue ) );
       
   806 
       
   807                     break;
       
   808                     }
       
   809                 default:
       
   810                     {
       
   811                     //should never be here.
       
   812                     break;
       
   813                     }
       
   814                 }
       
   815             break;
       
   816             }
       
   817 
       
   818         // default throw exception
       
   819         default:
       
   820             {
       
   821             break;
       
   822             }
       
   823         }
       
   824 
       
   825     }
       
   826 
       
   827 
       
   828 
       
   829 // ---------------------------------------------------------
       
   830 // CCAStatusPaneHandler::HandleDelete
       
   831 // (other items were commented in a header).
       
   832 // ---------------------------------------------------------
       
   833 //
       
   834 void CCAStatusPaneHandler::HandleDelete( const TDesC& /*aContactId*/ , TEnumsPC::TItem /*aType*/ )
       
   835     {
       
   836     //nothing to do
       
   837     }
       
   838 
       
   839 
       
   840 // ---------------------------------------------------------
       
   841 // CCAStatusPaneHandler::HandleAddition
       
   842 // (other items were commented in a header).
       
   843 // ---------------------------------------------------------
       
   844 //
       
   845 void CCAStatusPaneHandler::HandleAddition( TEnumsPC::TItem /*aType*/, TInt /*aIndex*/ )
       
   846     {
       
   847     //nothing to do
       
   848     }
       
   849 
       
   850 
       
   851 // ---------------------------------------------------------
       
   852 // CCAStatusPaneHandler::HandleWatcherEvent
       
   853 // (other items were commented in a header).
       
   854 // ---------------------------------------------------------
       
   855 //
       
   856 void CCAStatusPaneHandler::HandleWatcherEvent( const TDesC &  /*aString*/ , TEnumsPC::TOnlineStatus /*aOnlineStatus*/ )
       
   857     {
       
   858     //nothing to do
       
   859     }
       
   860 
       
   861 
       
   862 
       
   863 // ---------------------------------------------------------
       
   864 // CCAStatusPaneHandler::HandleInvitationEventL
       
   865 // (other items were commented in a header).
       
   866 // ---------------------------------------------------------
       
   867 //
       
   868 void CCAStatusPaneHandler::HandleInvitationEventL( TEnumsPC::TInviteType /*aInviteType*/,
       
   869                                                    const TDesC& /*aUserId*/,
       
   870                                                    const TDesC& /*aMessage*/ )
       
   871     {
       
   872     //nothing to do
       
   873     }
       
   874 
       
   875 
       
   876 // ---------------------------------------------------------
       
   877 // CCAStatusPaneHandler::HandleInvitationResponse
       
   878 // (other items were commented in a header).
       
   879 // ---------------------------------------------------------
       
   880 //
       
   881 void CCAStatusPaneHandler::HandleInvitationResponse( TBool /*aAcceptance*/,
       
   882                                                      const TDesC& /*aUserId*/,
       
   883                                                      const TDesC& /*aGroupName*/,
       
   884                                                      const TDesC& /*aResponse*/ )
       
   885     {
       
   886     //nothing to do
       
   887     }
       
   888 
       
   889 
       
   890 // ---------------------------------------------------------
       
   891 // CCAStatusPaneHandler::HandleSettingsChangeL
       
   892 // (other items were commented in a header).
       
   893 // ---------------------------------------------------------
       
   894 //
       
   895 void CCAStatusPaneHandler::HandleSettingsChangeL( TInt /*aChangedSettingEnum*/ )
       
   896     {
       
   897     //nothing to do
       
   898     }
       
   899 
       
   900 
       
   901 
       
   902 //End of file