|
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: Menu item dimmer action class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <cvtlogger.h> |
|
20 |
|
21 #include "cvtuicmdstatecheckaction.h" |
|
22 #include "tvtuicmdvalidatorcallback.h" |
|
23 #include "tvtuicmdcontexttype.h" |
|
24 |
|
25 // ======== MEMBER FUNCTIONS ======== |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // CVtUiCmdStateCheckAction::NewL |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 CVtUiCmdStateCheckAction* CVtUiCmdStateCheckAction::NewL() |
|
32 { |
|
33 __VTPRINTENTER( "CmdStChkAct.NewL" ) |
|
34 CVtUiCmdStateCheckAction* self = |
|
35 new ( ELeave ) CVtUiCmdStateCheckAction(); |
|
36 __VTPRINTEXIT( "CmdStChkAct.NewL" ) |
|
37 return self; |
|
38 } |
|
39 |
|
40 // --------------------------------------------------------------------------- |
|
41 // CVtUiCmdStateCheckAction::SetCommand |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 void CVtUiCmdStateCheckAction::SetCommand( TInt aCommandId ) |
|
45 { |
|
46 __VTPRINTENTER( "CmdStChkAct.SetCommand" ) |
|
47 iCommandId = aCommandId; |
|
48 iIsCommandAllowed = EFalse; |
|
49 __VTPRINTEXIT( "CmdStChkAct.SetCommand" ) |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // CVtUiCmdStateCheckAction::IsCommandAllowed |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 TBool CVtUiCmdStateCheckAction::IsCommandAllowed() const |
|
57 { |
|
58 return iIsCommandAllowed; |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // CVtUiCmdStateCheckAction::ProcessL |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 void CVtUiCmdStateCheckAction::ProcessL( |
|
66 const MVtUiCmdValidatorCallBack& aCallBack ) |
|
67 { |
|
68 __VTPRINTENTER( "CmdStChkAct.ProcessL" ) |
|
69 if ( !IsCommandHandled( iCommandId ) ) |
|
70 { |
|
71 if ( aCallBack.Call( iCommandId ) ) |
|
72 { |
|
73 CommandHandledL( iCommandId ); |
|
74 iIsCommandAllowed = ETrue; |
|
75 } |
|
76 } |
|
77 __VTPRINTEXIT( "CmdStChkAct.ProcessL" ) |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // CVtUiCmdStateCheckAction::CVtUiCmdStateCheckAction |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 CVtUiCmdStateCheckAction::CVtUiCmdStateCheckAction() |
|
85 : CVtUiCmdCustomValidationActionBase( EVtUiCmdContextTypeExecution ) |
|
86 { |
|
87 __VTPRINTENTER( "CmdStChkAct.ctor" ) |
|
88 __VTPRINTEXIT( "CmdStChkAct.ctor" ) |
|
89 } |