wlanutilities/wlansniffer/mainapplication/src/wsfconnecteddetailsdialog.cpp
changeset 0 56b72877c1cb
child 10 dff6ebfd236f
equal deleted inserted replaced
-1:000000000000 0:56b72877c1cb
       
     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:  Implementation of CWsfConnectedDetailsDialog.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <avkon.hrh>
       
    21 #include <aknlists.h>
       
    22 #include <StringLoader.h>
       
    23 #include <wlansniffer.rsg>
       
    24 #include "wsfconnecteddetailsdialog.h"
       
    25 #include "wsfconnecteddetailsmodel.h"
       
    26 #include "wsfconnecteddetailscontroller.h"
       
    27 #include "wsfactivetimeupdater.h"
       
    28 
       
    29 #include "wsflogger.h"
       
    30 
       
    31 // CONSTANTS
       
    32 LOCAL_D const TInt KUpdateInterval = 1000000; // in micro seconds (1 sec)
       
    33 // Time item's place in the listbox.
       
    34 LOCAL_D const TInt  KActiveTimeItem = 1;
       
    35 // Transferred data item's place in the listbox.
       
    36 LOCAL_D const TInt  KTransferredAmountItem = 2;
       
    37 
       
    38     
       
    39 // ================= MEMBER FUNCTIONS =======================
       
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 // CWsfConnectedDetailsDialog::ConstructL
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 void CWsfConnectedDetailsDialog::ConstructL()
       
    46     {
       
    47     LOG_ENTERFN( "CWsfConnectedDetailsDialog::ConstructL" );    
       
    48     iController.SetDialog( this );
       
    49     // Create and start Active Object 'Active Updater'
       
    50     iActiveUpdater = CWsfActiveTimeUpdater::NewL( &iController );
       
    51     iActiveUpdater->Start( KUpdateInterval );
       
    52     }
       
    53 
       
    54 
       
    55 // ---------------------------------------------------------------------------
       
    56 // CWsfConnectedDetailsDialog::NewL
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 CWsfConnectedDetailsDialog* CWsfConnectedDetailsDialog::NewL()
       
    60     {
       
    61     LOG_ENTERFN( "CWsfConnectedDetailsDialog::NewL" );    
       
    62     CWsfConnectedDetailsDialog* self = CWsfConnectedDetailsDialog::NewLC();
       
    63     CleanupStack::Pop( self );
       
    64     return self;
       
    65     }
       
    66 
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // CWsfConnectedDetailsDialog::NewLC
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 CWsfConnectedDetailsDialog* CWsfConnectedDetailsDialog::NewLC()
       
    73     {
       
    74     LOG_ENTERFN( "CWsfConnectedDetailsDialog::NewLC" );
       
    75     CWsfConnectedDetailsDialog* self = 
       
    76                             new( ELeave ) CWsfConnectedDetailsDialog( NULL );
       
    77     CleanupStack::PushL( self );
       
    78     self->ConstructL();
       
    79     return self;
       
    80     }
       
    81 
       
    82 
       
    83 // ---------------------------------------------------------------------------
       
    84 // CWsfConnectedDetailsDialog::CWsfConnectedDetailsDialog
       
    85 // ---------------------------------------------------------------------------
       
    86 //
       
    87 CWsfConnectedDetailsDialog::CWsfConnectedDetailsDialog( 
       
    88             CListBoxView::CSelectionIndexArray* aSelectionIndexArray )
       
    89     : CAknListQueryDialog( aSelectionIndexArray ),
       
    90     iList( NULL ),
       
    91     iModel( NULL )
       
    92     {
       
    93     }
       
    94 
       
    95 
       
    96 // ---------------------------------------------------------------------------
       
    97 // CWsfConnectedDetailsDialog::~CWsfConnectedDetailsDialog
       
    98 // ---------------------------------------------------------------------------
       
    99 //
       
   100 CWsfConnectedDetailsDialog::~CWsfConnectedDetailsDialog()
       
   101     {
       
   102     LOG_ENTERFN( "CWsfConnectedDetailsDialog::~CWsfConnectedDetailsDialog" );
       
   103     iController.SetModel(NULL);
       
   104     iController.SetDialog(NULL);
       
   105     if( iActiveUpdater )
       
   106         {
       
   107         iActiveUpdater->Stop();
       
   108         }
       
   109     delete iActiveUpdater;
       
   110     // iListModel is deleted in WSFAppui::StartConnectedDetailsL
       
   111     }
       
   112 
       
   113 // ---------------------------------------------------------------------------
       
   114 // CWsfConnectedDetailsDialog::SetListModel
       
   115 // ---------------------------------------------------------------------------
       
   116 //
       
   117 void CWsfConnectedDetailsDialog::SetListModel( CWsfConnectedDetailsModel* aModel)
       
   118     {
       
   119     LOG_ENTERFN( "CWsfConnectedDetailsDialog::SetListModel" );
       
   120     iListModel = aModel;
       
   121     iController.SetModel(iListModel);
       
   122     }
       
   123 
       
   124 
       
   125 // ---------------------------------------------------------
       
   126 // CWsfConnectedDetailsDialog::PreLayoutDynInitL
       
   127 // called by framework before dialog is shown
       
   128 // ---------------------------------------------------------
       
   129 //
       
   130 void CWsfConnectedDetailsDialog::PreLayoutDynInitL()
       
   131     {
       
   132     LOG_ENTERFN( "CWsfConnectedDetailsDialog::PreLayoutDynInitL" );
       
   133     // parent creates the private listbox
       
   134     CAknListQueryDialog::PreLayoutDynInitL();
       
   135     // and now we get access to it...
       
   136     CAknListQueryControl *control = 
       
   137             ( CAknListQueryControl* )Control( EListQueryControl );
       
   138     iList = control->Listbox();
       
   139     iModel = ( CTextListBoxModel* )iList->Model();
       
   140     
       
   141     // 1st Refresh of the listbox
       
   142     iController.RefreshL();
       
   143     ActivateL();
       
   144     }
       
   145     
       
   146 // ---------------------------------------------------------
       
   147 // CWsfConnectedDetailsContainer::UpdateListBox
       
   148 // ---------------------------------------------------------
       
   149 //
       
   150 void CWsfConnectedDetailsDialog::UpdateListBox( MDesCArray* aItemTextArray )
       
   151     {
       
   152     LOG_ENTERFN( "CWsfConnectedDetailsDialog::UpdateListBox" );
       
   153     for( TInt i = 0; i < aItemTextArray->MdcaCount(); i++)
       
   154         {
       
   155         TPtrC temp = aItemTextArray->MdcaPoint( i );
       
   156         TBuf<100> tempElement = temp;
       
   157         LOG_WRITEF( "aItemTextArray[0]: %S", &tempElement );
       
   158         }
       
   159 
       
   160     if ( iList && aItemTextArray->MdcaCount() )
       
   161         {
       
   162         iList->Reset();
       
   163         iModel->SetItemTextArray( aItemTextArray );
       
   164         iModel->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   165         // draw updated items
       
   166         iList->DrawItem( KActiveTimeItem );
       
   167         iList->DrawItem( KTransferredAmountItem );
       
   168         
       
   169         DrawNow();
       
   170         }
       
   171     }
       
   172     
       
   173 // ---------------------------------------------------------
       
   174 // CWsfConnectedDetailsContainer::Controller
       
   175 // ---------------------------------------------------------
       
   176 //
       
   177 MWsfDetailsViewControllerIf& CWsfConnectedDetailsDialog::Controller()
       
   178     {
       
   179     return iController;     
       
   180     }    
       
   181 
       
   182 //  End of File
       
   183