connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiDetailsView.cpp
branchRCL_3
changeset 57 05bc53fe583b
parent 55 fc7b30ed2058
child 58 83ca720e2b9a
equal deleted inserted replaced
55:fc7b30ed2058 57:05bc53fe583b
     1 /*
       
     2 * Copyright (c) 2002 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:  view class
       
    15 *     
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include  <ConnectionMonitorUi.rsg>
       
    22 #include  "ConnectionMonitorUiDetailsView.h"
       
    23 #include  "ConnectionMonitorUiDetailsContainer.h" 
       
    24 #include  "ConnectionMonitorUi.hrh"
       
    25 #include  "ConnectionArray.h"
       
    26 
       
    27 // ================= MEMBER FUNCTIONS =======================
       
    28 // ---------------------------------------------------------
       
    29 // ConnectionMonitorUiDetailsView::ConnectionMonitorUiDetailsView( 
       
    30 //                                 const CConnectionArray* aConnectionArray )
       
    31 // ---------------------------------------------------------
       
    32 //
       
    33 CConnectionMonitorUiDetailsView::CConnectionMonitorUiDetailsView( 
       
    34                              CConnectionArray* const aConnectionArray )
       
    35     : CAknView(), 
       
    36       iConnectionArray( aConnectionArray ), 
       
    37       iViewRefreshState( EFalse )
       
    38     {}
       
    39 
       
    40 // ---------------------------------------------------------
       
    41 // ConnectionMonitorUiDetailsView::ConstructL()
       
    42 // ---------------------------------------------------------
       
    43 //
       
    44 void CConnectionMonitorUiDetailsView::ConstructL()
       
    45     {
       
    46     BaseConstructL( R_CONNECTIONMONITORUI_DETAILSVIEW );
       
    47     }
       
    48 
       
    49 // ---------------------------------------------------------
       
    50 // CConnectionMonitorUiDetailsView::~CConnectionMonitorUiDetailsView()
       
    51 // ---------------------------------------------------------
       
    52 //
       
    53 CConnectionMonitorUiDetailsView::~CConnectionMonitorUiDetailsView()
       
    54     {
       
    55     delete iContainer;
       
    56     }
       
    57 
       
    58 // ---------------------------------------------------------
       
    59 // TUid CConnectionMonitorUiDetailsView::Id()
       
    60 // ?implementation_description
       
    61 // ---------------------------------------------------------
       
    62 //
       
    63 TUid CConnectionMonitorUiDetailsView::Id() const
       
    64     {
       
    65     return KDetailsViewId;
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------
       
    69 // CConnectionMonitorUiDetailsView::HandleCommandL( TInt aCommand )
       
    70 // ---------------------------------------------------------
       
    71 //
       
    72 void CConnectionMonitorUiDetailsView::HandleCommandL( TInt aCommand )
       
    73     {   
       
    74     switch ( aCommand )
       
    75         {
       
    76         case EAknSoftkeyOk:
       
    77             {
       
    78             CloseViewL();
       
    79             ActivateMainViewL();
       
    80             break;
       
    81             }
       
    82         default:
       
    83             {
       
    84             AppUi()->HandleCommandL( aCommand );
       
    85             break;
       
    86             }
       
    87         }
       
    88     }
       
    89 
       
    90 // ---------------------------------------------------------
       
    91 // CConnectionMonitorUiDetailsView::CloseViewL()
       
    92 // ---------------------------------------------------------
       
    93 //
       
    94 void CConnectionMonitorUiDetailsView::CloseViewL()
       
    95     {   
       
    96     CMUILOGGER_ENTERFN( "CConnectionMonitorUiDetailsView::CloseViewL" );    
       
    97     
       
    98     if ( GetViewRefreshState() )
       
    99         {
       
   100         // Now delete this view
       
   101         CConnectionMonitorUiAppUi* appUi =
       
   102             (CConnectionMonitorUiAppUi*)AppUi();
       
   103         appUi->StartTimerL();
       
   104         SetViewRefreshState( EFalse );
       
   105         }
       
   106     CMUILOGGER_LEAVEFN( "CConnectionMonitorUiDetailsView::CloseViewL" );
       
   107     }
       
   108 
       
   109 // ---------------------------------------------------------
       
   110 // CConnectionMonitorUiDetailsView::SetSelectedConnectionId
       
   111 // ---------------------------------------------------------
       
   112 //
       
   113 void CConnectionMonitorUiDetailsView::SetSelectedConnection( TUint aIndex )
       
   114     {
       
   115     iConnectionId = aIndex;
       
   116     }
       
   117     
       
   118 // ---------------------------------------------------------
       
   119 // CConnectionMonitorUiDetailsView::GetSelectedConnection
       
   120 // ---------------------------------------------------------
       
   121 //
       
   122 TUint CConnectionMonitorUiDetailsView::GetSelectedConnection()
       
   123 	{
       
   124 	TUint result( KErrNone );
       
   125 	if ( iContainer )
       
   126 		{
       
   127 		result = iContainer->GetIndexOfSelectedItem();	
       
   128 		}
       
   129 	return result;		
       
   130 	}
       
   131 
       
   132 
       
   133 // ---------------------------------------------------------
       
   134 // CConnectionMonitorUiDetailsView::DoActivateL(...)
       
   135 // ---------------------------------------------------------
       
   136 //
       
   137 void CConnectionMonitorUiDetailsView::DoActivateL(
       
   138    const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/,
       
   139    const TDesC8& /*aCustomMessage*/ )
       
   140     {
       
   141     CMUILOGGER_ENTERFN( "CConnectionMonitorUiDetailsView::DoActivateL" );
       
   142     
       
   143     if ( !iContainer )
       
   144         {
       
   145         iContainer = new ( ELeave ) CConnectionMonitorUiDetailsContainer( 
       
   146                                                             iConnectionArray );
       
   147         iContainer->SetMopParent( this );
       
   148         iContainer->ConstructL( ClientRect(), this );
       
   149         iContainer->SetSelectedConnectionL( iConnectionId );
       
   150         CConnectionMonitorUiAppUi::Static()->StartConnEventNotification( 
       
   151                                                                   iContainer );
       
   152         iContainer->DrawFirstAllListBoxItem();
       
   153 
       
   154         iContainer->PushAndRefreshNaviPaneL();
       
   155         iContainer->MakeVisible( ETrue );
       
   156         AppUi()->AddToViewStackL( *this, iContainer );
       
   157         }
       
   158     
       
   159     CMUILOGGER_LEAVEFN( "CConnectionMonitorUiDetailsView::DoActivateL" );
       
   160     
       
   161     }
       
   162 
       
   163 // ---------------------------------------------------------
       
   164 // CConnectionMonitorUiDetailsView::DoDeactivate
       
   165 // ---------------------------------------------------------
       
   166 //
       
   167 void CConnectionMonitorUiDetailsView::DoDeactivate()
       
   168     {
       
   169     CMUILOGGER_ENTERFN( "CConnectionMonitorUiDetailsView::DoDeactivate" );
       
   170     
       
   171     if ( iContainer )
       
   172         {
       
   173         AppUi()->RemoveFromViewStack( *this, iContainer );
       
   174         CConnectionMonitorUiAppUi::Static()->StopConnEventNotification( 
       
   175                                                              iContainer );
       
   176         iContainer->PopNaviPane();
       
   177         iContainer->MakeVisible( EFalse );
       
   178 
       
   179         delete iContainer;
       
   180         iContainer = NULL;
       
   181         }                
       
   182     }
       
   183 
       
   184 // ---------------------------------------------------------
       
   185 // CConnectionMonitorUiDetailsView::HandleListBoxEventL
       
   186 // ---------------------------------------------------------
       
   187 //
       
   188 void CConnectionMonitorUiDetailsView::HandleListBoxEventL( 
       
   189                                                     CEikListBox* /*aListBox*/,
       
   190                                                     TListBoxEvent aEventType )
       
   191     {
       
   192     switch ( aEventType )
       
   193         {
       
   194         case EEventEnterKeyPressed:
       
   195         //case EEventItemDoubleClicked:
       
   196         case EEventItemSingleClicked:
       
   197             {
       
   198             AppUi()->ActivateLocalViewL( 
       
   199                             TUid::Uid( EConnectionMonitorUiMainViewTab ) );
       
   200             }
       
   201             break;
       
   202 
       
   203         default:
       
   204             break;
       
   205         }
       
   206     }
       
   207 
       
   208 // ---------------------------------------------------------
       
   209 // CConnectionMonitorUiDetailsView::GetViewRefreshState
       
   210 // ---------------------------------------------------------
       
   211 //
       
   212 TBool CConnectionMonitorUiDetailsView::GetViewRefreshState()
       
   213     {
       
   214     return iViewRefreshState;	
       
   215     }
       
   216 
       
   217 // ---------------------------------------------------------
       
   218 // CConnectionMonitorUiDetailsView::SetViewRefreshState
       
   219 // ---------------------------------------------------------
       
   220 //
       
   221 void CConnectionMonitorUiDetailsView::SetViewRefreshState( 
       
   222                                                     TBool aViewRefreshState )
       
   223     {
       
   224     iViewRefreshState = aViewRefreshState;
       
   225     }
       
   226 
       
   227 // ---------------------------------------------------------
       
   228 // CConnectionMonitorUiDetailsView::ActivateMainViewL()
       
   229 // ---------------------------------------------------------
       
   230 //
       
   231 void CConnectionMonitorUiDetailsView::ActivateMainViewL()
       
   232     {   
       
   233     AppUi()->ActivateLocalViewL( TUid::Uid( EConnectionMonitorUiMainViewTab ) );
       
   234     }
       
   235 
       
   236 
       
   237 // End of File
       
   238