logsui/AppSrc/CCtView.cpp
changeset 0 e686773b3f54
child 68 9da50d567e3c
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     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: 
       
    15 *     Call Timers view
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 //  INCLUDE FILES
       
    21 #include <eikmenub.h>
       
    22 
       
    23 #include <Logs.rsg>
       
    24 
       
    25 #include "CCtView.h"
       
    26 #include "CCtControlContainer.h"
       
    27 #include "CLogsAppUi.h"
       
    28 #include "CLogsEngine.h"
       
    29 #include "MLogsSharedData.h"
       
    30 #include "MLogsSystemAgent.h"
       
    31 #include "MLogsCallStatus.h"
       
    32 #include "MLogsAocUtil.h"
       
    33 
       
    34 // CONSTANTS
       
    35 
       
    36 // ================= MEMBER FUNCTIONS =======================
       
    37 
       
    38 // ----------------------------------------------------------------------------
       
    39 // CCtView::CCtView
       
    40 // ----------------------------------------------------------------------------
       
    41 //
       
    42 CCtView::CCtView() :
       
    43         iTimersAls( EAllLines )
       
    44     {
       
    45     }
       
    46 
       
    47 // ----------------------------------------------------------------------------
       
    48 // CCtView::NewL
       
    49 // ----------------------------------------------------------------------------
       
    50 //
       
    51 CCtView* CCtView::NewL()
       
    52     {
       
    53     CCtView* self = new( ELeave ) CCtView;
       
    54     CleanupStack::PushL( self );
       
    55     self->ConstructL();
       
    56     CleanupStack::Pop();  // self
       
    57     return self;
       
    58     }
       
    59 
       
    60 // ----------------------------------------------------------------------------
       
    61 // CCtView::~CCtView
       
    62 // ----------------------------------------------------------------------------
       
    63 //
       
    64 CCtView::~CCtView()
       
    65     {
       
    66     if( iContainer )
       
    67         {
       
    68         AppUi()->RemoveFromViewStack( *this, iContainer );
       
    69         delete iContainer;
       
    70         }
       
    71     }
       
    72 
       
    73 // ----------------------------------------------------------------------------
       
    74 // CCtView::ProcessPointerEventL
       
    75 //
       
    76 // Handler for pointer events, when the current focused item is tapped
       
    77 // ----------------------------------------------------------------------------
       
    78 // 
       
    79 void CCtView::ProcessPointerEventL( TInt /* aIndex */)
       
    80 	{
       
    81 	// Open the context sensitive menu
       
    82 	ProcessCommandL( EAknSoftkeyContextOptions );    
       
    83 	}
       
    84 	
       
    85 // ----------------------------------------------------------------------------
       
    86 // CCtView::HandleCommandL
       
    87 // ----------------------------------------------------------------------------
       
    88 //
       
    89 void CCtView::HandleCommandL( TInt aCommandId )
       
    90     {
       
    91     TBool activeCall( EFalse );
       
    92 
       
    93     switch ( aCommandId )
       
    94         {
       
    95         case EAocCtCmdMenuClear:            
       
    96             iContainer->CallStatus().CallIsActive( activeCall );
       
    97             if( !activeCall )
       
    98                 {              
       
    99                 TInt ret = KErrNotFound;
       
   100                 
       
   101                 SetInputBlockerL();
       
   102                 TRAPD(err, ret = iContainer->AocUtil().AskSecCodeL() );
       
   103                 RemoveInputBlocker();
       
   104                 
       
   105                 User::LeaveIfError(err);
       
   106                  
       
   107                 if( ret == KErrNone)
       
   108                     {          
       
   109                     Engine()->SharedDataL()->ClearCallTimers();
       
   110                     iContainer->UpdateListBoxContentL();    
       
   111                     }                 
       
   112                 }
       
   113             else
       
   114                 {
       
   115                 LogsAppUi()->HandleCommandL( ELogsCmdFailedDueActiveCall );
       
   116                 }
       
   117             break;
       
   118 
       
   119         case EAocCtCmdMenuFilterAls:
       
   120             if( CmdSetAlsFilterL() )
       
   121                 {
       
   122                 iContainer->UpdateListBoxContentL();
       
   123                 }
       
   124             break;
       
   125 
       
   126         case EAocCtCmdMenuDetailsVoip:
       
   127         case EAocCtCmdMenuDetailsCs:        
       
   128             iContainer->ShowDurationDetailsL( aCommandId );            
       
   129             break; 
       
   130             
       
   131         case ELogsCmdHandleMSK:
       
   132             OkOptionCtMenuL();        
       
   133             break;            
       
   134 
       
   135         default:
       
   136             CLogsBaseView::HandleCommandL( aCommandId );
       
   137         }
       
   138     }
       
   139 
       
   140 // ----------------------------------------------------------------------------
       
   141 // CCtView::DynInitMenuPaneL
       
   142 // ----------------------------------------------------------------------------
       
   143 //
       
   144 void CCtView::DynInitMenuPaneL( 
       
   145     TInt aResourceId, 
       
   146     CEikMenuPane* aMenuPane )
       
   147     {
       
   148     CLogsBaseView::DynInitMenuPaneL( aResourceId, aMenuPane );
       
   149 
       
   150     if( aResourceId == R_AOCCT_CT_MENU_TOP )
       
   151         {
       
   152         // 1. If no ALS support, remove FilterAls support from the menu
       
   153         if( ! Engine()->SystemAgentL()->AlsSupport() )
       
   154             {
       
   155             aMenuPane->DeleteMenuItem( EAocCtCmdMenuFilterAls );
       
   156             }
       
   157 
       
   158         // 2. If no VOIP support, remove duration details support from the menu        
       
   159         if ( !Engine()->SharedDataL()->IsVoIPEnabledInPlatform() ) 
       
   160             {
       
   161             aMenuPane->DeleteMenuItem( EAocCtCmdMenuDetails );
       
   162             }
       
   163         }
       
   164     }
       
   165 
       
   166 // ----------------------------------------------------------------------------
       
   167 // CCtView::Id
       
   168 // ----------------------------------------------------------------------------
       
   169 //
       
   170 TUid CCtView::Id() const
       
   171     {
       
   172     return TUid::Uid( ECtViewId );
       
   173     }
       
   174 
       
   175 // ----------------------------------------------------------------------------
       
   176 // CCtView::HandleClientRectChange
       
   177 // ----------------------------------------------------------------------------
       
   178 //
       
   179 void CCtView::HandleClientRectChange()
       
   180     {
       
   181     if (iContainer)
       
   182         {
       
   183         iContainer->SetRect( ClientRect() );  
       
   184         }
       
   185     }
       
   186 
       
   187 // ----------------------------------------------------------------------------
       
   188 // CCtView::DoActivateL
       
   189 // ----------------------------------------------------------------------------
       
   190 //
       
   191 void CCtView::DoActivateL( 
       
   192     const TVwsViewId& aPrevViewId,
       
   193     TUid /*aCustomMessageId*/,
       
   194     const TDesC8& /*aCustomMessage*/ )
       
   195     {
       
   196     if( iContainer == NULL )
       
   197         {
       
   198         iContainer = CCtControlContainer::NewL( this, ClientRect() );
       
   199         AppUi()->AddToViewStackL( *this, iContainer );
       
   200         }
       
   201     
       
   202     Engine()->SharedDataL()->SetObserver( this );
       
   203     iContainer->ListBox()->SetListBoxObserver( this );
       
   204 
       
   205     LogsAppUi()->SetPreviousViewId( aPrevViewId.iViewUid );
       
   206     LogsAppUi()->SetCurrentViewId( Id() );
       
   207     
       
   208     // Just to make sure the inputblocker is not on
       
   209     RemoveInputBlocker();
       
   210     }
       
   211 
       
   212 // ----------------------------------------------------------------------------
       
   213 // CCtView::StateChangedL
       
   214 // ----------------------------------------------------------------------------
       
   215 //
       
   216 void CCtView::StateChangedL( MLogsStateHolder* /*aHolder*/ )
       
   217     {
       
   218     if( iContainer )
       
   219         {
       
   220         iContainer->UpdateListBoxContentL();
       
   221         }
       
   222     }
       
   223 
       
   224 // ----------------------------------------------------------------------------
       
   225 // CCtView::DoDeactivate
       
   226 // ----------------------------------------------------------------------------
       
   227 //
       
   228 void CCtView::DoDeactivate()
       
   229     {
       
   230     if( iContainer )
       
   231         {
       
   232         AppUi()->RemoveFromViewStack( *this, iContainer );
       
   233         delete iContainer;
       
   234         iContainer = NULL;
       
   235         }
       
   236     }
       
   237 
       
   238 // ----------------------------------------------------------------------------
       
   239 // CCtView::ConstructL
       
   240 // ----------------------------------------------------------------------------
       
   241 //
       
   242 void CCtView::ConstructL()
       
   243     {
       
   244     BaseConstructL( R_AOCCT_CT_VIEW );
       
   245     }
       
   246 
       
   247 // ----------------------------------------------------------------------------
       
   248 // CCtView::OkOptionCtMenuL
       
   249 // ----------------------------------------------------------------------------
       
   250 //
       
   251 void CCtView::OkOptionCtMenuL()
       
   252     {
       
   253     LaunchPopupMenuL( R_AOCCT_CT_OK_MENUBAR );
       
   254     }
       
   255 
       
   256 // ----------------------------------------------------------------------------
       
   257 // CCtView::CmdSetAlsFilterL
       
   258 // ----------------------------------------------------------------------------
       
   259 //
       
   260 TBool CCtView::CmdSetAlsFilterL()
       
   261     {
       
   262     return iContainer->AlsSettingQueryL( iTimersAls );
       
   263     }
       
   264 
       
   265 // ----------------------------------------------------------------------------
       
   266 // CCtView::AlsLine
       
   267 // ----------------------------------------------------------------------------
       
   268 //
       
   269 const TAlsEnum& CCtView::AlsLine() const
       
   270     {
       
   271     return iTimersAls;
       
   272     }
       
   273     
       
   274 // ----------------------------------------------------------------------------
       
   275 // CCtView::SetAlsLine
       
   276 // ----------------------------------------------------------------------------
       
   277 //
       
   278 void CCtView::SetAlsLine( TAlsEnum aTimerAls ) 
       
   279     {
       
   280     iTimersAls = aTimerAls;
       
   281     }
       
   282     
       
   283     
       
   284 
       
   285 //  End of File