vtuis/videotelui/src/features/softkey/cvtuisoftkeys.cpp
changeset 0 ed9695c8bcbe
equal deleted inserted replaced
-1:000000000000 0:ed9695c8bcbe
       
     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:  Softkey UI feature implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <cvtlogger.h>
       
    20 #include <eikbtgpc.h>
       
    21 #include "cvtuisoftkeys.h"
       
    22 #include "cvtuisoftkeysetting.h"
       
    23 #include "cvtuisoftkeyvalidationaction.h"
       
    24 #include "cvtuifeaturemanager.h"
       
    25 #include "mvtuicommandmanager.h"
       
    26 #include "cvtuisoftkeycontext.h"
       
    27 
       
    28 // ======== LOCAL FUNCTIONS ========
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // CVtUiSoftkeys::NewL
       
    32 // ---------------------------------------------------------------------------
       
    33 //
       
    34 CVtUiSoftkeys* CVtUiSoftkeys::NewL( CVtUiFeatureManager& aFeatureManager,
       
    35     CEikButtonGroupContainer& aButtonGroupContainer )
       
    36     {
       
    37     __VTPRINTENTER( "SKs.NewL" )
       
    38     CVtUiSoftkeys* self =
       
    39         new ( ELeave ) CVtUiSoftkeys( aFeatureManager, aButtonGroupContainer );
       
    40     CleanupStack::PushL( self );
       
    41     self->ConstructL();
       
    42     CleanupStack::Pop(); // self
       
    43     __VTPRINTEXIT( "SKs.NewL" )
       
    44     return self;
       
    45     }
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // CVtUiSoftkeys::~CVtUiSoftkeys
       
    49 // ---------------------------------------------------------------------------
       
    50 //
       
    51 CVtUiSoftkeys::~CVtUiSoftkeys()
       
    52     {
       
    53     __VTPRINTENTER( "SKs.~" )
       
    54     iFeatureManager.CommandManager().RemoveCommandUi( *this );
       
    55     delete iSoftkeyCommandContext;
       
    56     delete iSoftkeySetting;
       
    57     delete iSoftkeyValidationAction;
       
    58     __VTPRINTEXIT( "SKs.~" )
       
    59     }
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 // CVtUiSoftkeys::ButtonGroup
       
    63 // ---------------------------------------------------------------------------
       
    64 //
       
    65 CEikButtonGroupContainer& CVtUiSoftkeys::ButtonGroup()
       
    66     {
       
    67     __VTPRINTENTER( "SKs.ButtonGroup" )
       
    68     __VTPRINTEXIT( "SKs.ButtonGroup" )
       
    69     return iButtonGroupContainer;
       
    70     }
       
    71 
       
    72 // ---------------------------------------------------------------------------
       
    73 // CVtUiSoftkeys::StartL
       
    74 // ---------------------------------------------------------------------------
       
    75 //
       
    76 void CVtUiSoftkeys::StartL()
       
    77     {
       
    78     __VTPRINTENTER( "SKs.StartL" )
       
    79     __VTPRINTEXIT( "SKs.StartL" )
       
    80     }
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // CVtUiSoftkeys::Stop
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 void CVtUiSoftkeys::Stop()
       
    87     {
       
    88     __VTPRINTENTER( "SKs.Stop" )
       
    89     __VTPRINTEXIT( "SKs.Stop" )
       
    90     }
       
    91 
       
    92 // ---------------------------------------------------------------------------
       
    93 // CVtUiSoftkeys::InitFeatureL
       
    94 // ---------------------------------------------------------------------------
       
    95 //
       
    96 void CVtUiSoftkeys::InitFeatureL()
       
    97     {
       
    98     __VTPRINTENTER( "SKs.InitFeatureL" )
       
    99     __VTPRINTEXIT( "SKs.InitFeatureL" )
       
   100     }
       
   101 
       
   102 // ---------------------------------------------------------------------------
       
   103 // CVtUiSoftkeys::RefreshL
       
   104 // ---------------------------------------------------------------------------
       
   105 //
       
   106 void CVtUiSoftkeys::RefreshL()
       
   107     {
       
   108     __VTPRINTENTER( "SKs.RefreshL" )
       
   109     iFeatureManager.CommandManager().ValidateSoftkeyItemsL(
       
   110         *iSoftkeyValidationAction );
       
   111     iSoftkeySetting->DefineCommandsL( *iSoftkeyValidationAction );
       
   112     iButtonGroupContainer.DrawNow();
       
   113     __VTPRINTEXIT( "SKs.RefreshL" )
       
   114     }
       
   115 
       
   116 // ---------------------------------------------------------------------------
       
   117 // CVtUiSoftkeys::AddCommandModifierL
       
   118 // ---------------------------------------------------------------------------
       
   119 //
       
   120 TInt CVtUiSoftkeys::AddCommandModifier( CVtUiCommandModifyBase& aModifier )
       
   121     {
       
   122     __VTPRINTENTER( "SKs.AddCommandModifier" )
       
   123     TInt result( iSoftkeySetting->AddModifier( aModifier ) );
       
   124     __VTPRINTEXITR( "SKs.AddCommandModifier %d", result )
       
   125     return result;
       
   126     }
       
   127 
       
   128 // ---------------------------------------------------------------------------
       
   129 // CVtUiSoftkeys::RemoveCommandModifier
       
   130 // ---------------------------------------------------------------------------
       
   131 //
       
   132 void CVtUiSoftkeys::RemoveCommandModifier( CVtUiCommandModifyBase& aModifier )
       
   133     {
       
   134     __VTPRINTENTER( "SKs.RemoveCommandModifier" )
       
   135     iSoftkeySetting->RemoveModifier( aModifier );
       
   136     __VTPRINTEXIT( "SKs.RemoveCommandModifier" )
       
   137     }
       
   138 
       
   139 // ---------------------------------------------------------------------------
       
   140 // CVtUiSoftkeys::CVtUiSoftkeys
       
   141 // ---------------------------------------------------------------------------
       
   142 //
       
   143 CVtUiSoftkeys::CVtUiSoftkeys( CVtUiFeatureManager& aFeatureManager,
       
   144     CEikButtonGroupContainer& aButtonGroupContainer )
       
   145     : CVtUiFeatureBase( EVtUiFeatureIdSoftkey, aFeatureManager ),
       
   146     iButtonGroupContainer( aButtonGroupContainer )
       
   147     {
       
   148     __VTPRINTENTER( "SKs.ctor" )
       
   149     __VTPRINTEXIT( "SKs.ctor" )
       
   150     }
       
   151 
       
   152 // ---------------------------------------------------------------------------
       
   153 // CVtUiSoftkeys::ConstructL
       
   154 // ---------------------------------------------------------------------------
       
   155 //
       
   156 void CVtUiSoftkeys::ConstructL()
       
   157     {
       
   158     __VTPRINTENTER( "SKs.ConstructL" )
       
   159     iSoftkeyCommandContext = CVtUiSoftkeyContext::NewL(
       
   160         iFeatureManager.CommandManager() );
       
   161     iSoftkeySetting = new ( ELeave ) CVtUiSoftkeySetting( *this );
       
   162     iSoftkeyValidationAction = CVtUiSoftkeyValidationAction::NewL();
       
   163     User::LeaveIfError(
       
   164         iFeatureManager.CommandManager().AddCommandUi( *this ) );
       
   165     __VTPRINTEXIT( "SKs.ConstructL" )
       
   166     }
       
   167