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: Mini dialer feature |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <AknUtils.h> |
|
20 #include <peninputcmdparam.h> |
|
21 #include <cvtlogger.h> |
|
22 #include <akntoolbar.h> |
|
23 |
|
24 #include "cvtuidialer.h" |
|
25 #include "cvtuifeaturemanager.h" |
|
26 #include "mvtuicommandmanager.h" |
|
27 #include "mvtuicomponentmanager.h" |
|
28 #include "cvtuicmdopendialer.h" |
|
29 #include "cvtuicmdclosedialer.h" |
|
30 #include "cvtuidialercontainer.h" |
|
31 #include "cvtuidialervideocontrol.h" |
|
32 #include "CVtUiAppUi.h" |
|
33 #include "tvtuistates.h" |
|
34 #include "CVtUiContextControl.h" |
|
35 #include "CVtUiEndCallButtonPane.h" |
|
36 #include "CVtUiMainControl.h" |
|
37 #include "CVtUiRemoteVideoControl.h" |
|
38 #include "VtUiLayout.h" |
|
39 |
|
40 // Index of white color. |
|
41 const TInt KVtDialerRVCPriLow = -1; |
|
42 |
|
43 // ======== LOCAL FUNCTIONS ======== |
|
44 |
|
45 // Implementation of CVtUiDialer |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CVtUiDialer::NewL |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 CVtUiDialer* CVtUiDialer::NewL( CVtUiFeatureManager& aFeatureManager ) |
|
52 { |
|
53 __VTPRINTENTER( "Dial.NewL" ) |
|
54 CVtUiDialer* self = NULL; |
|
55 self = new ( ELeave ) CVtUiDialer( aFeatureManager ); |
|
56 CleanupStack::PushL( self ); |
|
57 self->ConstructL(); |
|
58 CleanupStack::Pop(); // self |
|
59 __VTPRINTEXIT( "Dial.NewL" ) |
|
60 return self; |
|
61 } |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // CVtUiDialer::~CVtUiDialer |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 CVtUiDialer::~CVtUiDialer() |
|
68 { |
|
69 __VTPRINTENTER( "Dial.~" ) |
|
70 delete iCmdOpen; |
|
71 delete iCmdClose; |
|
72 delete iDialerContainer; |
|
73 __VTPRINTEXIT( "Dial.~" ) |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // CVtUiDialer::VideoWindow |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 MVtUiVideoWindow& CVtUiDialer::VideoWindow() const |
|
81 { |
|
82 __VTPRINTENTER( "Dial.VideoWindow" ) |
|
83 __VTPRINTEXIT( "Dial.VideoWindow" ) |
|
84 return *iDialerContainer->ComponentAsVideoWindow(); |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------------------------- |
|
88 // CVtUiDialer::VideoControl |
|
89 // --------------------------------------------------------------------------- |
|
90 // |
|
91 CCoeControl& CVtUiDialer::VideoControl() const |
|
92 { |
|
93 __VTPRINTENTER( "Dial.VideoControl" ) |
|
94 __VTPRINTEXIT( "Dial.VideoControl" ) |
|
95 return *static_cast< MVtUiComponent* > |
|
96 ( iDialerContainer )->ComponentAsControl(); |
|
97 } |
|
98 |
|
99 // --------------------------------------------------------------------------- |
|
100 // CVtUiDialer::StartL |
|
101 // --------------------------------------------------------------------------- |
|
102 // |
|
103 void CVtUiDialer::StartL() |
|
104 { |
|
105 __VTPRINTENTER( "Dial.StartL" ) |
|
106 if ( State() == MVtUiFeature::EUnprepared ) |
|
107 { |
|
108 // Lower remote video control window priority |
|
109 TInt pos = |
|
110 iFeatureManager.AppUi().RemoteVideoControl().DrawableWindow()->OrdinalPosition(); |
|
111 iFeatureManager.AppUi().RemoteVideoControl().DrawableWindow()-> |
|
112 SetOrdinalPosition( pos, KVtDialerRVCPriLow ); |
|
113 // Make context control and end call button invisible |
|
114 iFeatureManager.AppUi().ContextControl().MakeVisible( EFalse ); |
|
115 iFeatureManager.AppUi().EndCallButtonPane().MakeVisible( EFalse ); |
|
116 iFeatureManager.UiStates().SetIsDialerActivating( ETrue ); |
|
117 // fixed toolbar is set to be hidden |
|
118 iFeatureManager.UiStates().SetIsFixedToolbarVisible( EFalse ); |
|
119 if ( !VtUiLayout::IsLandscapeOrientation() ) |
|
120 { |
|
121 iFeatureManager.AppUi().CurrentFixedToolbar()->MakeVisible( EFalse ); |
|
122 } |
|
123 iFeatureManager.CommandManager().RefreshL(); |
|
124 PrepareL(); |
|
125 iFeatureManager.ComponentManager().RequestActivationL( |
|
126 MVtUiComponent::EComponentIdDialer ); |
|
127 iFeatureState = EActive; |
|
128 iFeatureManager.AppUi().SwitchLayoutToFlatStatusPaneL( ETrue ); |
|
129 } |
|
130 __VTPRINTEXIT( "Dial.StartL" ) |
|
131 } |
|
132 |
|
133 // --------------------------------------------------------------------------- |
|
134 // CVtUiDialer::Stop |
|
135 // --------------------------------------------------------------------------- |
|
136 // |
|
137 void CVtUiDialer::Stop() |
|
138 { |
|
139 __VTPRINTENTER( "Dial.Stop" ) |
|
140 if ( State() == MVtUiFeature::EActive ) |
|
141 { |
|
142 // Lower remote video control window priority |
|
143 TInt pos = |
|
144 iFeatureManager.AppUi().RemoteVideoControl().DrawableWindow()->OrdinalPosition(); |
|
145 iFeatureManager.AppUi().RemoteVideoControl().DrawableWindow()-> |
|
146 SetOrdinalPosition( pos, KVtDialerRVCPriLow ); |
|
147 |
|
148 TInt error; |
|
149 TRAP( error, |
|
150 { |
|
151 iFeatureManager.AppUi().SwitchLayoutToFlatStatusPaneL( EFalse ); |
|
152 iFeatureManager.ComponentManager().DeActivateComponentL( |
|
153 MVtUiComponent::EComponentIdDialer ); |
|
154 } ); |
|
155 Unprepare(); |
|
156 iFeatureManager.AppUi().CurrentFixedToolbar()->MakeVisible( ETrue ); |
|
157 // Make these two control back to visible |
|
158 iFeatureManager.AppUi().EndCallButtonPane().MakeVisible( ETrue ); |
|
159 iFeatureManager.AppUi().ContextControl().MakeVisible( ETrue ); |
|
160 // Force a skin change event to appui then redraw main control |
|
161 // and end call button |
|
162 iFeatureManager.AppUi().HandleResourceChangeL( KAknsMessageSkinChange ); |
|
163 iFeatureManager.AppUi().MainControl().DrawNow(); |
|
164 iFeatureManager.AppUi().EndCallButtonPane().DrawNow(); |
|
165 } |
|
166 __VTPRINTEXIT( "Dial.Stop" ) |
|
167 } |
|
168 |
|
169 // --------------------------------------------------------------------------- |
|
170 // CVtUiDialer::InitFeatureL |
|
171 // --------------------------------------------------------------------------- |
|
172 // |
|
173 void CVtUiDialer::InitFeatureL() |
|
174 { |
|
175 __VTPRINTENTER( "Dial.InitFeatureL" ) |
|
176 iDialerContainer = |
|
177 CVtUiDialerContainer::NewL( iFeatureManager ); |
|
178 iCmdOpen = CVtUiCmdOpenDialer::NewL( iFeatureManager.CommandManager(), |
|
179 *this ); |
|
180 iCmdClose = CVtUiCmdCloseDialer::NewL( iFeatureManager.CommandManager(), |
|
181 *this ); |
|
182 __VTPRINTEXIT( "Dial.InitFeatureL" ) |
|
183 } |
|
184 |
|
185 // --------------------------------------------------------------------------- |
|
186 // CVtUiDialer::CVtUiDialer |
|
187 // --------------------------------------------------------------------------- |
|
188 // |
|
189 CVtUiDialer::CVtUiDialer( CVtUiFeatureManager& aFeatureManager ) |
|
190 : CVtUiFeatureBase( EVtUiFeatureIdDialer, aFeatureManager ) |
|
191 { |
|
192 __VTPRINTENTER( "Dial.ctor" ) |
|
193 __VTPRINTEXIT( "Dial.ctor" ) |
|
194 } |
|
195 |
|
196 // --------------------------------------------------------------------------- |
|
197 // CVtUiDialer::ConstructL |
|
198 // --------------------------------------------------------------------------- |
|
199 // |
|
200 void CVtUiDialer::ConstructL() |
|
201 { |
|
202 __VTPRINTENTER( "Dial.ConstructL" ) |
|
203 BaseConstructL(); |
|
204 __VTPRINTEXIT( "Dial.ConstructL" ) |
|
205 } |
|
206 |
|
207 // --------------------------------------------------------------------------- |
|
208 // CVtUiDialer::PrepareL |
|
209 // --------------------------------------------------------------------------- |
|
210 // |
|
211 void CVtUiDialer::PrepareL() |
|
212 { |
|
213 __VTPRINTENTER( "Dial.PrepareL" ) |
|
214 iDialerContainer->RegisterComponentL(); |
|
215 iFeatureState = EReady; |
|
216 __VTPRINTEXIT( "Dial.PrepareL" ) |
|
217 } |
|
218 |
|
219 // --------------------------------------------------------------------------- |
|
220 // CVtUiDialer::Unprepare |
|
221 // --------------------------------------------------------------------------- |
|
222 // |
|
223 void CVtUiDialer::Unprepare() |
|
224 { |
|
225 __VTPRINTENTER( "Dial.Unprepare" ) |
|
226 iDialerContainer->UnregisterComponent(); |
|
227 iFeatureState = EUnprepared; |
|
228 __VTPRINTEXIT( "Dial.Unprepare" ) |
|
229 } |
|