|
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: CVtUiFeatureBase implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include "cvtuifeaturebase.h" |
|
22 #include "mvtuifeature.h" |
|
23 #include "cvtuicommandpolicymanager.h" |
|
24 #include <cvtlogger.h> |
|
25 #include "cvtuifeaturemanager.h" |
|
26 |
|
27 // ============================ MEMBER FUNCTIONS =============================== |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CVtUiFeatureBase::CVtUiFeatureBase |
|
31 // C++ constructor can NOT contain any code, that |
|
32 // might leave. |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 CVtUiFeatureBase::CVtUiFeatureBase( TVtUiFeatureId aId, |
|
36 CVtUiFeatureManager& aFeatureManager ) : iId( aId ), |
|
37 iFeatureManager ( aFeatureManager ), |
|
38 iFeatureState ( EUnprepared ) |
|
39 { |
|
40 __VTPRINTENTER( "CVtUiFeatureBase.CVtUiFeatureBase" ) |
|
41 __VTPRINTEXIT( "CVtUiFeatureBase.CVtUiFeatureBase" ) |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CVtUiFeatureBase::BaseConstructL |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 void CVtUiFeatureBase::StartL() |
|
49 { |
|
50 if ( iFeatureState == EUnprepared ) |
|
51 { |
|
52 iAsyncCallback->Cancel(); |
|
53 InitFeatureL(); |
|
54 } |
|
55 } |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CVtUiFeatureBase::BaseConstructL |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 void CVtUiFeatureBase::BaseConstructL() |
|
62 { |
|
63 __VTPRINTENTER( "CVtUiFeatureBase.BaseConstructL" ) |
|
64 iAsyncCallback = |
|
65 new ( ELeave ) CAsyncCallBack ( CActive::EPriorityLow ); |
|
66 iAsyncCallback->Set( TCallBack( &DoInitFeaturesL, this ) ); |
|
67 iAsyncCallback->CallBack(); |
|
68 __VTPRINTEXIT( "CVtUiFeatureBase.BaseConstructL" ) |
|
69 } |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // CVtUiFeatureBase::~CVtUiFeatureBase |
|
73 // Destructor. |
|
74 // ----------------------------------------------------------------------------- |
|
75 // |
|
76 CVtUiFeatureBase::~CVtUiFeatureBase() |
|
77 { |
|
78 __VTPRINTENTER( "CVtUiFeatureBase.~" ) |
|
79 delete iAsyncCallback; |
|
80 __VTPRINTEXIT( "CVtUiFeatureBase.~" ) |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // CVtUiFeatureBase::State |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 MVtUiFeature::TVtUiFeatureState CVtUiFeatureBase::State() const |
|
88 { |
|
89 __VTPRINTENTER( "CVtUiFeatureBase.State" ) |
|
90 __VTPRINTEXITR( "CVtUiFeatureBase.State. %d", (TInt)iFeatureState ) |
|
91 return iFeatureState; |
|
92 } |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // CVtUiFeatureBase::Id |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 TVtUiFeatureId CVtUiFeatureBase::Id() const |
|
99 { |
|
100 __VTPRINTENTER( "CVtUiFeatureBase.Id" ) |
|
101 __VTPRINTEXITR( "CVtUiFeatureBase.Id %d", iId ) |
|
102 return iId; |
|
103 } |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // CVtUiFeatureBase::DoInitFeaturesL |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 TInt CVtUiFeatureBase::DoInitFeaturesL( TAny* aAny ) |
|
110 { |
|
111 __VTPRINTENTER( "CVtUiFeatureBase.DoInitFeaturesL" ) |
|
112 CVtUiFeatureBase* self = static_cast< CVtUiFeatureBase* >( aAny ); |
|
113 self->InitFeatureL(); |
|
114 __VTPRINTEXIT( "CVtUiFeatureBase.DoInitFeaturesL" ) |
|
115 return KErrNone; |
|
116 } |