33
|
1 |
/*
|
|
2 |
* Copyright (c) 2005 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: The MUS application's UI class.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "musuireceivecontainer.h"
|
|
20 |
#include "musuieventcontroller.h"
|
|
21 |
#include "musuigeneralview.h"
|
|
22 |
#include "musuireceiveview.h"
|
|
23 |
#include "musuiinvitationquery.h"
|
|
24 |
#include "musuiinvitationqueryobserver.h"
|
|
25 |
#include "musuiappui.h"
|
|
26 |
#include "musuidialogutil.h"
|
|
27 |
#include "musuidefinitions.h"
|
|
28 |
#include "musui.hrh"
|
|
29 |
#include "muslogger.h" // debug logging
|
|
30 |
#include <musui.rsg>
|
|
31 |
|
|
32 |
#include <AknsControlContext.h>
|
|
33 |
#include <AknsBasicBackgroundControlContext.h>
|
|
34 |
#include <AknsDrawUtils.h>
|
|
35 |
#include <AknWaitDialog.h>
|
|
36 |
#include <AknDef.h>
|
|
37 |
|
|
38 |
|
|
39 |
// -----------------------------------------------------------------------------
|
|
40 |
//
|
|
41 |
// -----------------------------------------------------------------------------
|
|
42 |
//
|
|
43 |
CMusUiReceiveContainer* CMusUiReceiveContainer::NewL(
|
|
44 |
CMusUiReceiveView& aView,
|
|
45 |
const TRect aRect )
|
|
46 |
{
|
|
47 |
CMusUiReceiveContainer* self
|
|
48 |
= new( ELeave ) CMusUiReceiveContainer( aView );
|
|
49 |
|
|
50 |
CleanupStack::PushL( self );
|
|
51 |
self->ConstructL( aRect );
|
|
52 |
CleanupStack::Pop( self );
|
|
53 |
|
|
54 |
return self;
|
|
55 |
}
|
|
56 |
|
|
57 |
|
|
58 |
// -----------------------------------------------------------------------------
|
|
59 |
//
|
|
60 |
// -----------------------------------------------------------------------------
|
|
61 |
//
|
|
62 |
CMusUiReceiveContainer::~CMusUiReceiveContainer()
|
|
63 |
{
|
|
64 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveContainer::~CMusUiReceiveContainer" );
|
|
65 |
|
|
66 |
if ( iInvitationQuery )
|
|
67 |
{
|
|
68 |
iInvitationQuery->Cancel();
|
|
69 |
delete iInvitationQuery;
|
|
70 |
iInvitationQuery = NULL;
|
|
71 |
}
|
|
72 |
|
|
73 |
delete iBackGround;
|
|
74 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveContainer::~CMusUiReceiveContainer" );
|
|
75 |
}
|
|
76 |
|
|
77 |
|
|
78 |
// -----------------------------------------------------------------------------
|
|
79 |
//
|
|
80 |
// -----------------------------------------------------------------------------
|
|
81 |
//
|
|
82 |
CMusUiReceiveContainer::CMusUiReceiveContainer( CMusUiReceiveView& aView )
|
|
83 |
: iView( aView )
|
|
84 |
{
|
|
85 |
}
|
|
86 |
|
|
87 |
|
|
88 |
// -----------------------------------------------------------------------------
|
|
89 |
//
|
|
90 |
// -----------------------------------------------------------------------------
|
|
91 |
//
|
|
92 |
void CMusUiReceiveContainer::ConstructL( const TRect& aRect )
|
|
93 |
{
|
|
94 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveContainer::ConstructL" );
|
|
95 |
CreateWindowL();
|
|
96 |
iBackGround = CAknsBasicBackgroundControlContext::NewL(
|
|
97 |
KAknsIIDQsnBgAreaMain,
|
|
98 |
aRect,
|
|
99 |
EFalse );
|
|
100 |
iFullScreen = EFalse;
|
|
101 |
SetRect( aRect );
|
|
102 |
ActivateL();
|
|
103 |
|
|
104 |
iOperatorSpecificFunctionality = iView.OperatorSpecificFunctionality();
|
|
105 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveContainer::ConstructL" );
|
|
106 |
}
|
|
107 |
|
|
108 |
|
|
109 |
// -----------------------------------------------------------------------------
|
|
110 |
//
|
|
111 |
// -----------------------------------------------------------------------------
|
|
112 |
//
|
|
113 |
void CMusUiReceiveContainer::ShowInvitationQueryL(
|
|
114 |
const TDesC& aContact,
|
|
115 |
MMusUiInvitationQueryObserver& aObserver )
|
|
116 |
{
|
|
117 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveContainer::ShowInvitationQueryL" );
|
|
118 |
if ( !iInvitationQuery )
|
|
119 |
{
|
|
120 |
iInvitationQuery = CMusUiInvitationQuery::NewL( aObserver );
|
|
121 |
}
|
|
122 |
iInvitationQuery->ShowL( aContact );
|
|
123 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveContainer::ShowInvitationQueryL" );
|
|
124 |
}
|
|
125 |
|
|
126 |
|
|
127 |
// -----------------------------------------------------------------------------
|
|
128 |
//
|
|
129 |
// -----------------------------------------------------------------------------
|
|
130 |
//
|
|
131 |
void CMusUiReceiveContainer::DismissInvitationQuery( TBool aDelete )
|
|
132 |
{
|
|
133 |
if ( iInvitationQuery )
|
|
134 |
{
|
|
135 |
iInvitationQuery->Cancel();
|
|
136 |
if ( aDelete )
|
|
137 |
{
|
|
138 |
delete iInvitationQuery;
|
|
139 |
iInvitationQuery = NULL;
|
|
140 |
}
|
|
141 |
}
|
|
142 |
}
|
|
143 |
|
|
144 |
|
|
145 |
// -----------------------------------------------------------------------------
|
|
146 |
// Fetches a pointer to the view that owns this container.
|
|
147 |
// -----------------------------------------------------------------------------
|
|
148 |
//
|
|
149 |
CMusUiGeneralView* CMusUiReceiveContainer::MusUiView() const
|
|
150 |
{
|
|
151 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveContainer::MusUiView" );
|
|
152 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveContainer::MusUiView" );
|
|
153 |
return &iView;
|
|
154 |
}
|
|
155 |
|
|
156 |
|
|
157 |
// -----------------------------------------------------------------------------
|
|
158 |
//
|
|
159 |
// -----------------------------------------------------------------------------
|
|
160 |
//
|
|
161 |
void CMusUiReceiveContainer::SetFullScreen( TBool aFullScreen, TRect aRect )
|
|
162 |
{
|
|
163 |
MUS_LOG1( "mus: [MUSUI ] -> CMusUiReceiveContainer::SetFullScreen: %d",
|
|
164 |
aFullScreen );
|
|
165 |
iFullScreen = aFullScreen;
|
|
166 |
|
|
167 |
if ( aFullScreen )
|
|
168 |
{
|
|
169 |
// In order to capture pointer events this container must be visible.
|
|
170 |
// Thus we make it as small as possible.
|
|
171 |
SetRect( TRect( 0, 0, 0, 0) );
|
|
172 |
MakeVisible( ETrue );
|
|
173 |
SetGloballyCapturing( ETrue );
|
|
174 |
SetPointerCapture( ETrue );
|
|
175 |
}
|
|
176 |
else
|
|
177 |
{
|
|
178 |
SetRect( aRect );
|
|
179 |
SetPointerCapture( EFalse );
|
|
180 |
MakeVisible( EFalse );
|
|
181 |
}
|
|
182 |
|
|
183 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveContainer::SetFullScreen" );
|
|
184 |
}
|
|
185 |
|
|
186 |
|
|
187 |
// -----------------------------------------------------------------------------
|
|
188 |
// Called by framework when the view size is changed
|
|
189 |
// -----------------------------------------------------------------------------
|
|
190 |
//
|
|
191 |
void CMusUiReceiveContainer::SizeChanged()
|
|
192 |
{
|
|
193 |
TRect parentRect(Rect());
|
|
194 |
if (iBackGround)
|
|
195 |
{
|
|
196 |
(static_cast<CAknsBasicBackgroundControlContext*>(iBackGround))->SetRect(parentRect);
|
|
197 |
}
|
|
198 |
MakeVisible( EFalse );
|
|
199 |
}
|
|
200 |
|
|
201 |
|
|
202 |
// -----------------------------------------------------------------------------
|
|
203 |
// Called by framework when to retrieve the no. of controls.
|
|
204 |
// -----------------------------------------------------------------------------
|
|
205 |
//
|
|
206 |
TInt CMusUiReceiveContainer::CountComponentControls() const
|
|
207 |
{
|
|
208 |
return 0; // return nbr of controls inside this container
|
|
209 |
}
|
|
210 |
|
|
211 |
|
|
212 |
// -----------------------------------------------------------------------------
|
|
213 |
// Called by framework to retrieve the control specified by index.
|
|
214 |
// -----------------------------------------------------------------------------
|
|
215 |
//
|
|
216 |
CCoeControl* CMusUiReceiveContainer::ComponentControl( TInt aIndex ) const
|
|
217 |
{
|
|
218 |
switch ( aIndex )
|
|
219 |
{
|
|
220 |
default:
|
|
221 |
return NULL;
|
|
222 |
}
|
|
223 |
}
|
|
224 |
|
|
225 |
|
|
226 |
// -----------------------------------------------------------------------------
|
|
227 |
// Called by framework to redraw the screen area.
|
|
228 |
// -----------------------------------------------------------------------------
|
|
229 |
//
|
|
230 |
void CMusUiReceiveContainer::Draw( const TRect& aRect ) const
|
|
231 |
{
|
|
232 |
CWindowGc& gc = SystemGc();
|
|
233 |
|
|
234 |
gc.Clear( aRect );
|
|
235 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
|
|
236 |
MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
|
|
237 |
if(!AknsDrawUtils::Background( skin, cc,this,gc,aRect,KAknsDrawParamDefault ))
|
|
238 |
{
|
|
239 |
gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) );
|
|
240 |
gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
|
|
241 |
gc.Clear( aRect );
|
|
242 |
}
|
|
243 |
}
|
|
244 |
|
|
245 |
|
|
246 |
// -----------------------------------------------------------------------------
|
|
247 |
// Called by framework
|
|
248 |
// -----------------------------------------------------------------------------
|
|
249 |
//
|
|
250 |
TKeyResponse CMusUiReceiveContainer::OfferKeyEventL( const TKeyEvent& aEvent,
|
|
251 |
TEventCode aType )
|
|
252 |
{
|
|
253 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveContainer::OfferKeyEventL" );
|
|
254 |
|
|
255 |
if ( iFullScreen && aType == EEventKey )
|
|
256 |
{
|
|
257 |
// We respond to whatever key by returning from fullscreen
|
|
258 |
if( MUS_NO_TOOLBAR )
|
|
259 |
{
|
|
260 |
(static_cast <CMusUiReceiveView*>
|
|
261 |
(MusUiView()))->HandleCommandL( EMusuiCmdViewFullScreen );
|
|
262 |
}
|
|
263 |
else
|
|
264 |
{
|
|
265 |
(static_cast <CMusUiReceiveView*>
|
|
266 |
(MusUiView()))->HandleCommandL( EMusuiCmdToolbarFullScreen );
|
|
267 |
}
|
|
268 |
return EKeyWasConsumed;
|
|
269 |
}
|
|
270 |
|
|
271 |
switch ( aEvent.iCode )
|
|
272 |
{
|
|
273 |
// Volume Control
|
|
274 |
case EKeyLeftArrow:
|
|
275 |
{
|
|
276 |
(static_cast <CMusUiReceiveView*>
|
|
277 |
(MusUiView()))->HandleCommandL( EMusuiCmdViewVolumeDown );
|
|
278 |
return EKeyWasConsumed;
|
|
279 |
}
|
|
280 |
case EKeyRightArrow:
|
|
281 |
{
|
|
282 |
(static_cast <CMusUiReceiveView*>
|
|
283 |
(MusUiView()))->HandleCommandL( EMusuiCmdViewVolumeUp );
|
|
284 |
return EKeyWasConsumed;
|
|
285 |
}
|
|
286 |
|
|
287 |
// TODO:
|
|
288 |
case EKeyUpArrow:
|
|
289 |
{
|
|
290 |
break;
|
|
291 |
}
|
|
292 |
case EKeyDownArrow:
|
|
293 |
{
|
|
294 |
break;
|
|
295 |
}
|
|
296 |
default:
|
|
297 |
return EKeyWasNotConsumed;
|
|
298 |
}
|
|
299 |
|
|
300 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveContainer::OfferKeyEventL" );
|
|
301 |
return EKeyWasNotConsumed;
|
|
302 |
}
|
|
303 |
|
|
304 |
|
|
305 |
// -----------------------------------------------------------------------------
|
|
306 |
//
|
|
307 |
// -----------------------------------------------------------------------------
|
|
308 |
//
|
|
309 |
void CMusUiReceiveContainer::HandlePointerEventL( const TPointerEvent& )
|
|
310 |
{
|
|
311 |
if ( iFullScreen )
|
|
312 |
{
|
|
313 |
// We respond to whatever pointer event by returning from fullscreen
|
|
314 |
(static_cast <CMusUiReceiveView*>
|
|
315 |
(MusUiView()))->HandleCommandL( EMusuiCmdToolbarFullScreen );
|
|
316 |
}
|
|
317 |
}
|
|
318 |
|
|
319 |
|
|
320 |
// -----------------------------------------------------------------------------
|
|
321 |
//
|
|
322 |
// -----------------------------------------------------------------------------
|
|
323 |
//
|
|
324 |
void CMusUiReceiveContainer::UpdatePointerCapture()
|
|
325 |
{
|
|
326 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveContainer::UpdatePointerCapture" );
|
|
327 |
|
|
328 |
if ( iFullScreen )
|
|
329 |
{
|
|
330 |
// In order to capture pointer events this container must be visible.
|
|
331 |
// Thus we make it as small as possible.
|
|
332 |
SetRect( TRect( 0, 0, 0, 0 ) );
|
|
333 |
MakeVisible( ETrue );
|
|
334 |
SetGloballyCapturing( ETrue );
|
|
335 |
SetPointerCapture( ETrue );
|
|
336 |
}
|
|
337 |
|
|
338 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveContainer::UpdatePointerCapture" );
|
|
339 |
}
|
|
340 |
|
|
341 |
// end of file
|