menufw/hierarchynavigator/hnpresentationmodel/src/hnsuitemodel.cpp
branchRCL_3
changeset 54 1b758917cafc
parent 0 f72a12da539e
equal deleted inserted replaced
50:137ebc85284b 54:1b758917cafc
    28 #include "hnsuiteobserver.h"
    28 #include "hnsuiteobserver.h"
    29 #include "hnattributebase.h"
    29 #include "hnattributebase.h"
    30 #include "hnattributetext.h"
    30 #include "hnattributetext.h"
    31 #include "hnitemsorder.h"
    31 #include "hnitemsorder.h"
    32 #include "hneventhandler.h"
    32 #include "hneventhandler.h"
    33 #include "hnitemfocushandler.h"
       
    34 
    33 
    35 // ============================ MEMBER FUNCTIONS =============================
    34 // ============================ MEMBER FUNCTIONS =============================
    36 
    35 
    37 
    36 
    38 // ---------------------------------------------------------------------------
    37 // ---------------------------------------------------------------------------
    71     for (TInt i(0) ; i < iSuiteObservers.Count(); i++)
    70     for (TInt i(0) ; i < iSuiteObservers.Count(); i++)
    72         {
    71         {
    73         TRAP_IGNORE( iSuiteObservers[i]->HandleSuiteEventL( ESuiteModelDestroyed, this ) );
    72         TRAP_IGNORE( iSuiteObservers[i]->HandleSuiteEventL( ESuiteModelDestroyed, this ) );
    74         }
    73         }
    75 
    74 
    76     if ( iIsVisible && iIsActive )
       
    77     	{
       
    78     	TRAP_IGNORE( HandleItemFocusL( iSuiteHighlight.iItemId, EFalse ) );
       
    79     	}
       
    80     delete iItemFocusHandler;
       
    81     TRAP_IGNORE( OfferHnEventL( KIdSuiteUnLoad, 
    75     TRAP_IGNORE( OfferHnEventL( KIdSuiteUnLoad, 
    82             GetItemsOrder()->GetSuiteId(), NULL ) );
    76             GetItemsOrder()->GetSuiteId(), NULL ) );
    83 
    77 
    84     DEBUG16(("\t_Mm_:KIdSuiteUnLoad - %S",iSuiteName));
    78     DEBUG16(("\t_Mm_:KIdSuiteUnLoad - %S",iSuiteName));
    85     
    79     
   695     if ( itemModel )
   689     if ( itemModel )
   696     	{
   690     	{
   697 	    newCustomId = itemModel->CustomId();
   691 	    newCustomId = itemModel->CustomId();
   698     	}
   692     	}
   699     
   693     
   700     if ( ( newCustomId != iSuiteHighlight.iCustomId ||
       
   701             newItemId != iSuiteHighlight.iItemId ) && ( iIsActive && iIsVisible ) )
       
   702         {
       
   703         HandleItemFocusL( iSuiteHighlight.iItemId, EFalse );
       
   704         HandleItemFocusL( newItemId, ETrue );
       
   705         }
       
   706     
       
   707     iSuiteHighlight.iCustomId = newCustomId;
   694     iSuiteHighlight.iCustomId = newCustomId;
   708     iSuiteHighlight.iItemId = newItemId;
   695     iSuiteHighlight.iItemId = newItemId;
   709     iSuiteHighlight.iWidgetIndex = aHighLight;
   696     iSuiteHighlight.iWidgetIndex = aHighLight;
   710     
   697     
   711     DEBUG(("_MM_:CHnSuiteModel::SetSuiteHighlight - OUT"));
   698     DEBUG(("_MM_:CHnSuiteModel::SetSuiteHighlight - OUT"));
   843 	}
   830 	}
   844 
   831 
   845 // ---------------------------------------------------------------------------
   832 // ---------------------------------------------------------------------------
   846 // 
   833 // 
   847 // ---------------------------------------------------------------------------
   834 // ---------------------------------------------------------------------------
   848 // 
       
   849 EXPORT_C void CHnSuiteModel::SetActiveL( TBool aActive )
       
   850     {
       
   851     DEBUG16(("_MM_:CHnSuiteModel::SetActiveL %S - IN",iSuiteName));
       
   852     DEBUG(("\t_MM_:aActive: %d",aActive));
       
   853     DEBUG(("\t_MM_:iIsActive: %d",iIsActive));
       
   854     
       
   855     if ( aActive != iIsActive )
       
   856         {
       
   857         iIsActive = aActive;
       
   858         if ( iIsVisible )
       
   859             {
       
   860             HandleItemFocusL( iSuiteHighlight.iItemId, aActive );
       
   861             }
       
   862         }
       
   863     
       
   864     DEBUG(("_MM_:CHnSuiteModel::SetActiveL - OUT"));
       
   865     }
       
   866 
       
   867 // ---------------------------------------------------------------------------
       
   868 // 
       
   869 // ---------------------------------------------------------------------------
       
   870 // 
       
   871 EXPORT_C TBool CHnSuiteModel::IsActive()
       
   872     {
       
   873     return iIsActive;
       
   874     }
       
   875 
       
   876 // ---------------------------------------------------------------------------
       
   877 // 
       
   878 // ---------------------------------------------------------------------------
       
   879 //
       
   880 EXPORT_C void CHnSuiteModel::SetVisibleL( TBool aVisible )
       
   881     {
       
   882     DEBUG16(("_MM_:CHnSuiteModel::SetVisible %S - IN",iSuiteName));
       
   883     DEBUG(("\t_MM_:aVisible: %d",aVisible));
       
   884     DEBUG(("\t_MM_:iIsVisible: %d",iIsVisible));
       
   885     
       
   886     if ( aVisible != iIsVisible )
       
   887         {
       
   888         iIsVisible = aVisible;
       
   889         if ( iIsActive )
       
   890             {
       
   891             HandleItemFocusL( iSuiteHighlight.iItemId, aVisible );
       
   892             }
       
   893         }
       
   894     
       
   895     DEBUG(("_MM_:CHnSuiteModel::SetVisible - OUT"));
       
   896     }
       
   897 
       
   898 // ---------------------------------------------------------------------------
       
   899 // 
       
   900 // ---------------------------------------------------------------------------
       
   901 //
       
   902 void CHnSuiteModel::HandleItemFocusL( TInt aItemId, TBool aFocused )
       
   903     {
       
   904     DEBUG16(("_MM_:CHnSuiteModel::HandleItemFocusL %S - IN",iSuiteName));
       
   905     DEBUG(("\t_MM_:aItemIndex: %d",aItemId));
       
   906     DEBUG(("\t_MM_:aFocused: %d",aFocused));
       
   907     
       
   908     if ( aItemId >= 0 )
       
   909         {
       
   910         if ( !iItemFocusHandler )
       
   911         	{
       
   912         	iItemFocusHandler = CHnItemFocusHandler::NewL( this );
       
   913         	}
       
   914         TInt eventId = aFocused ? KIdFocusGain : KIdFocusLost;
       
   915         iItemFocusHandler->SetFocusL( eventId, aItemId );
       
   916 //        TRAP_IGNORE( OfferHnEventL( eventId, aItemId, NULL ) );
       
   917         }
       
   918     
       
   919     DEBUG(("_MM_:CHnSuiteModel::HandleItemFocusL - OUT"));
       
   920     }
       
   921 
       
   922 // ---------------------------------------------------------------------------
       
   923 // 
       
   924 // ---------------------------------------------------------------------------
       
   925 //
   835 //
   926 EXPORT_C CHnItemModel* CHnSuiteModel::GetMatchingItemModelL( TInt64 aCustomId,
   836 EXPORT_C CHnItemModel* CHnSuiteModel::GetMatchingItemModelL( TInt64 aCustomId,
   927 		TInt& aIndex )
   837 		TInt& aIndex )
   928 	{
   838 	{
   929 	CHnItemModel* itemModel( NULL );
   839 	CHnItemModel* itemModel( NULL );