83
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2007 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// System includes
|
|
20 |
#include <startupdomainpskeys.h>
|
|
21 |
#include <centralrepository.h>
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <e32property.h>
|
|
24 |
#include <avkon.rsg> // for status pane layout resource ids
|
|
25 |
#include <eikon.hrh>
|
|
26 |
#include <bautils.h>
|
|
27 |
#include <ecom/implementationproxy.h>
|
|
28 |
#include <data_caging_path_literals.hrh>
|
|
29 |
#include <ConeResLoader.h>
|
|
30 |
#include <featmgr.h>
|
|
31 |
#include <avkondomainpskeys.h>
|
|
32 |
#include <AknUtils.h>
|
|
33 |
#include <layoutmetadata.cdl.h>
|
|
34 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
35 |
|
|
36 |
// User includes
|
|
37 |
#include <hscontentpublisher.h>
|
|
38 |
#include <aipspropertyobserver.h>
|
|
39 |
|
|
40 |
#include "appui.h"
|
|
41 |
#include "ainativeui.hrh"
|
|
42 |
#include "ainativeuistrings.h" // string literals
|
|
43 |
#include "ainativeuiview.h"
|
|
44 |
#include "application.h"
|
|
45 |
#include "nativeuicontroller.h"
|
|
46 |
#include "aifweventhandler.h"
|
|
47 |
#include <AiNativeUi.rsg>
|
|
48 |
|
|
49 |
#include "aicontentmodel.h"
|
|
50 |
#include "aiuiidleintegration.h"
|
|
51 |
#include "activeidle2domaincrkeys.h"
|
|
52 |
#include "activeidle2domainpskeys.h"
|
|
53 |
#include "extrstandbycontainerif.h"
|
|
54 |
#include "debug.h"
|
|
55 |
|
|
56 |
|
|
57 |
namespace
|
|
58 |
{
|
|
59 |
_LIT( KResourceDrive, "Z:" );
|
|
60 |
_LIT( KResourceFile, "ainativeui.rsc" );
|
|
61 |
#define KResourcePath KDC_APP_RESOURCE_DIR
|
|
62 |
|
|
63 |
const TInt KDefaultStatusPaneLayout = R_AVKON_STATUS_PANE_LAYOUT_IDLE;
|
|
64 |
|
|
65 |
//
|
|
66 |
// Get status pane configuration from cenrep
|
|
67 |
//
|
|
68 |
TInt GetLayoutCenrep()
|
|
69 |
{
|
|
70 |
TInt value = EAiStatusPaneLayoutIdleNormal;
|
|
71 |
TUid uid = { KCRUidActiveIdleLV };
|
|
72 |
CRepository* cenRep = CRepository::NewLC( uid );
|
|
73 |
cenRep->Get( KAiStatusPaneLayout, value );
|
|
74 |
CleanupStack::PopAndDestroy( cenRep );
|
|
75 |
return value;
|
|
76 |
}
|
|
77 |
|
|
78 |
//
|
|
79 |
// Resolves status pane layout for CXnAppUiAdapter::ConstructL()
|
|
80 |
//
|
|
81 |
TInt StatusPaneLayoutResourceIdL( TInt aLayoutId )
|
|
82 |
{
|
|
83 |
TInt layout = aLayoutId;
|
|
84 |
switch( aLayoutId )
|
|
85 |
{
|
|
86 |
case EAiStatusPaneLayoutIdleNormal:
|
|
87 |
{
|
|
88 |
layout = R_AVKON_STATUS_PANE_LAYOUT_IDLE;
|
|
89 |
break;
|
|
90 |
}
|
|
91 |
case EAiStatusPaneLayoutIdleFlat:
|
|
92 |
{
|
|
93 |
layout = R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT;
|
|
94 |
break;
|
|
95 |
}
|
|
96 |
case EAiStatusPaneLayoutIdleHidden:
|
|
97 |
{
|
|
98 |
layout = KDefaultStatusPaneLayout;
|
|
99 |
break;
|
|
100 |
}
|
|
101 |
default:
|
|
102 |
{
|
|
103 |
break;
|
|
104 |
}
|
|
105 |
}
|
|
106 |
return layout;
|
|
107 |
}
|
|
108 |
|
|
109 |
// -----------------------------------------------------------------------------
|
|
110 |
//
|
|
111 |
// Calculate touch sensitive softkey area for Top button (landscape)
|
|
112 |
// -----------------------------------------------------------------------------
|
|
113 |
TRect SoftkeyRectTopTouch()
|
|
114 |
{
|
|
115 |
TRect screen;
|
|
116 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen );
|
|
117 |
|
|
118 |
TAknLayoutRect layoutRect;
|
|
119 |
|
|
120 |
TAknWindowComponentLayout rightAreaLayout(
|
|
121 |
AknLayoutScalable_Avkon::area_side_right_pane( 0 ) );
|
|
122 |
|
|
123 |
|
|
124 |
layoutRect.LayoutRect( screen, TAknWindowComponentLayout::Compose( rightAreaLayout,
|
|
125 |
AknLayoutScalable_Avkon::sctrl_sk_top_pane() ).LayoutLine() );
|
|
126 |
TRect topSKRect( layoutRect.Rect() );
|
|
127 |
|
|
128 |
layoutRect.LayoutRect( topSKRect,
|
|
129 |
AknLayoutScalable_Avkon::aid_touch_sctrl_top().LayoutLine() );
|
|
130 |
return layoutRect.Rect();
|
|
131 |
}
|
|
132 |
|
|
133 |
// -----------------------------------------------------------------------------
|
|
134 |
//
|
|
135 |
// Calculate touch sensitive softkey area for right button (portrait)
|
|
136 |
// -----------------------------------------------------------------------------
|
|
137 |
TRect SoftkeyRectRightTouch()
|
|
138 |
{
|
|
139 |
TRect screen;
|
|
140 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen );
|
|
141 |
|
|
142 |
TAknLayoutRect layoutRect;
|
|
143 |
|
|
144 |
TAknWindowComponentLayout bottomAreaLayout(
|
|
145 |
AknLayoutScalable_Avkon::area_bottom_pane( 0 ) );
|
|
146 |
|
|
147 |
|
|
148 |
layoutRect.LayoutRect( screen, TAknWindowComponentLayout::Compose( bottomAreaLayout,
|
|
149 |
AknLayoutScalable_Avkon::control_bg_pane() ).LayoutLine() );
|
|
150 |
TRect rightSKRect( layoutRect.Rect() );
|
|
151 |
layoutRect.LayoutRect(
|
|
152 |
rightSKRect,
|
|
153 |
AknLayoutScalable_Avkon::aid_touch_ctrl_right().LayoutLine() );
|
|
154 |
return layoutRect.Rect();
|
|
155 |
}
|
|
156 |
|
|
157 |
|
|
158 |
}
|
|
159 |
|
|
160 |
using namespace AiNativeUiController;
|
|
161 |
|
|
162 |
// ========== MEMBER FUNCTIONS ================================================
|
|
163 |
|
|
164 |
CAppUi::CAppUi(CNativeUiController* aUiCtl)
|
|
165 |
: iUiCtl(aUiCtl)
|
|
166 |
{
|
|
167 |
}
|
|
168 |
|
|
169 |
void CAppUi::ConstructL()
|
|
170 |
{
|
|
171 |
BaseConstructL(EAknEnableSkin|EAknEnableMSK/*|ENoAppResourceFile*/);
|
|
172 |
|
|
173 |
// Disable CCoeEnv exit checks.
|
|
174 |
// Active Idle Framework will perform the checks.
|
|
175 |
iCoeEnv->DisableExitChecks(ETrue);
|
|
176 |
|
|
177 |
if( !iResourceLoader )
|
|
178 |
{
|
|
179 |
iResourceLoader = new(ELeave) RConeResourceLoader( *iCoeEnv );
|
|
180 |
|
|
181 |
// 1) Load resources file for resource publishing
|
|
182 |
TFullName resourceFile( KResourceDrive );
|
|
183 |
resourceFile.Append( KResourcePath );
|
|
184 |
resourceFile.Append( KResourceFile );
|
|
185 |
BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), resourceFile );
|
|
186 |
|
|
187 |
iResourceLoader->OpenL( resourceFile );
|
|
188 |
}
|
|
189 |
|
|
190 |
iTimer = CPeriodic::NewL( CActive::EPriorityStandard );
|
|
191 |
|
|
192 |
if( !iUiCtl )
|
|
193 |
{
|
|
194 |
User::Leave(KErrNotFound);
|
|
195 |
return; // for lint
|
|
196 |
}
|
|
197 |
|
|
198 |
iFwEventHandler = iUiCtl->FwEventHandler();
|
|
199 |
|
|
200 |
iUiCtl->SetAppUi( this );
|
|
201 |
|
|
202 |
if( iFwEventHandler )
|
|
203 |
{
|
|
204 |
iFwEventHandler->AppEnvReadyL();
|
|
205 |
}
|
|
206 |
|
|
207 |
TBool isFullScreen = EFalse;
|
|
208 |
//Get pointer to status pane
|
|
209 |
CEikStatusPane* statusPane = static_cast<CAknAppUi*>( iEikonEnv->EikAppUi() )->StatusPane();
|
|
210 |
if( statusPane )
|
|
211 |
{
|
|
212 |
// Update status pane layout ot the correct one.
|
|
213 |
TInt statusPaneLayout = GetLayoutCenrep();
|
|
214 |
iCurrentStatusPaneLayout = StatusPaneLayoutResourceIdL( statusPaneLayout );
|
|
215 |
|
|
216 |
TInt id = statusPane->CurrentLayoutResId();
|
|
217 |
if( id != iCurrentStatusPaneLayout &&
|
|
218 |
id != R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT )
|
|
219 |
{
|
|
220 |
statusPane->SwitchLayoutL( iCurrentStatusPaneLayout );
|
|
221 |
}
|
|
222 |
else
|
|
223 |
{
|
|
224 |
iCurrentStatusPaneLayout = id;
|
|
225 |
}
|
|
226 |
|
|
227 |
if( statusPaneLayout == EAiStatusPaneLayoutIdleHidden &&
|
|
228 |
iCurrentStatusPaneLayout != R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT )
|
|
229 |
{
|
|
230 |
statusPane->MakeVisible( EFalse );
|
|
231 |
isFullScreen = ETrue;
|
|
232 |
}
|
|
233 |
else
|
|
234 |
{
|
|
235 |
statusPane->MakeVisible( ETrue );
|
|
236 |
}
|
|
237 |
statusPane->ApplyCurrentSettingsL();
|
|
238 |
statusPane->DrawNow();
|
|
239 |
}
|
|
240 |
|
|
241 |
iAppView = CAiNativeUiView::NewL( ClientRect(), this );
|
|
242 |
iAppView->SetMopParent(this);
|
|
243 |
RegisterViewL( *iAppView );
|
|
244 |
AddToStackL( iAppView );
|
|
245 |
|
|
246 |
// Reset softkey locked indications. Error may be ignored - not defined would be typical.
|
|
247 |
RProperty::Define( KPSUidAiInformation, KActiveIdleExtHS_LSKLocked, RProperty::EText );
|
|
248 |
RProperty::Set( KPSUidAiInformation, KActiveIdleExtHS_LSKLocked, KNullDesC );
|
|
249 |
RProperty::Define( KPSUidAiInformation, KActiveIdleExtHS_RSKLocked, RProperty::EText );
|
|
250 |
RProperty::Set( KPSUidAiInformation, KActiveIdleExtHS_RSKLocked, KNullDesC );
|
|
251 |
RProperty::Define( KPSUidAiInformation, KActiveIdleExtHS_PluginConfChange, RProperty::EInt );
|
|
252 |
RProperty::Set( KPSUidAiInformation, KActiveIdleExtHS_PluginConfChange, 0 );
|
|
253 |
|
|
254 |
const TUid KCAIPluginContainerImplementationUid = { 0x101FD658 };
|
|
255 |
|
|
256 |
iStanbyContainerIF = CExtrStandbyContainerIF::NewL( KCAIPluginContainerImplementationUid,
|
|
257 |
iAppView );
|
|
258 |
iStanbyContainerIF->SetRect( ClientRect() );
|
|
259 |
iStanbyContainerIF->SetFullScreenMode( isFullScreen );
|
|
260 |
iAppView->SetControl( iStanbyContainerIF );
|
|
261 |
|
|
262 |
iAIRepository = CRepository::NewL( TUid::Uid( KCRUidActiveIdleLV ) );
|
|
263 |
// CenRep notifier to listen statuspane key changes in cenrep.
|
|
264 |
iNotifyHandler = CCenRepNotifyHandler::NewL( *this,
|
|
265 |
*iAIRepository,
|
|
266 |
CCenRepNotifyHandler::EIntKey,
|
|
267 |
KAiStatusPaneLayout );
|
|
268 |
iNotifyHandler->StartListeningL();
|
|
269 |
|
|
270 |
TAiIdleKeySoundConfig keySoundConfig;
|
|
271 |
keySoundConfig.iKeySounds = KeySounds();
|
|
272 |
keySoundConfig.iContextResId = R_NATIVEUI_DEFAULT_SKEY_LIST;
|
|
273 |
iIdleIntegration = CAiUiIdleIntegration::NewL
|
|
274 |
( *iEikonEnv, keySoundConfig, iFwEventHandler );
|
|
275 |
|
|
276 |
// Check powerkey availability
|
|
277 |
FeatureManager::InitializeLibL();
|
|
278 |
iFeatureNoPowerKey =
|
|
279 |
FeatureManager::FeatureSupported( KFeatureIdNoPowerkey );
|
|
280 |
FeatureManager::UnInitializeLib();
|
|
281 |
|
|
282 |
if(iFeatureNoPowerKey)
|
|
283 |
{
|
|
284 |
iPowerkeyStatusObserver = AiUtility::CreatePSPropertyObserverL(
|
|
285 |
TCallBack( HandlePowerkeyEvent, this ),
|
|
286 |
KPSUidAvkonDomain,
|
|
287 |
KAknEndKeyEvent );
|
|
288 |
}
|
|
289 |
|
|
290 |
CAknAppUiBase::SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort |
|
|
291 |
CAknAppUiBase::EDisableSendKeyLong );
|
|
292 |
}
|
|
293 |
|
|
294 |
CAppUi* CAppUi::NewL(CNativeUiController* aUiCtl)
|
|
295 |
{
|
|
296 |
CAppUi* self = new (ELeave) CAppUi(aUiCtl );
|
|
297 |
|
|
298 |
// ConstructL is called by the UI framework
|
|
299 |
|
|
300 |
return self;
|
|
301 |
}
|
|
302 |
|
|
303 |
CAppUi::~CAppUi()
|
|
304 |
{
|
|
305 |
Release( iPowerkeyStatusObserver );
|
|
306 |
delete iTimer;
|
|
307 |
delete iNotifyHandler;
|
|
308 |
delete iAIRepository;
|
|
309 |
delete iStanbyContainerIF;
|
|
310 |
delete iIdleIntegration;
|
|
311 |
TRAP_IGNORE( DeactivateActiveViewL() );
|
|
312 |
if( iAppView )
|
|
313 |
{
|
|
314 |
DeregisterView( *iAppView );
|
|
315 |
RemoveFromStack( iAppView );
|
|
316 |
delete iAppView;
|
|
317 |
}
|
|
318 |
if( iResourceLoader )
|
|
319 |
{
|
|
320 |
iResourceLoader->Close();
|
|
321 |
delete iResourceLoader;
|
|
322 |
}
|
|
323 |
}
|
|
324 |
|
|
325 |
void CAppUi::HandleForegroundEventL(TBool aForeground)
|
|
326 |
{
|
|
327 |
CAknAppUi::HandleForegroundEventL( aForeground );
|
|
328 |
}
|
|
329 |
|
|
330 |
void CAppUi::HandleCommandL(TInt aCommand)
|
|
331 |
{
|
|
332 |
switch (aCommand)
|
|
333 |
{
|
|
334 |
case EEikCmdExit:
|
|
335 |
{
|
|
336 |
TInt value;
|
|
337 |
TInt err = RProperty::Get( KPSUidStartup, KPSGlobalSystemState, value );
|
|
338 |
if( err == KErrNone )
|
|
339 |
{
|
|
340 |
if ( value == ESwStateShuttingDown )
|
|
341 |
{
|
|
342 |
// If all is ok we filter our exits
|
|
343 |
Exit();
|
|
344 |
}
|
|
345 |
}
|
|
346 |
else
|
|
347 |
{
|
|
348 |
// If all is not ok we still exit
|
|
349 |
Exit();
|
|
350 |
}
|
|
351 |
break;
|
|
352 |
}
|
|
353 |
case EAknSoftkeyExit:
|
|
354 |
case EAknCmdExit: // fallthrough
|
|
355 |
{
|
|
356 |
|
|
357 |
#ifdef _DEBUG
|
|
358 |
|
|
359 |
Exit();
|
|
360 |
if( iFwEventHandler && iUiCtl )
|
|
361 |
{
|
|
362 |
iFwEventHandler->HandleUiShutdown( *iUiCtl );
|
|
363 |
}
|
|
364 |
break;
|
|
365 |
|
|
366 |
#endif // _DEBUG
|
|
367 |
|
|
368 |
}
|
|
369 |
|
|
370 |
case ENativeUiSoftkeyLeft:
|
|
371 |
{
|
|
372 |
if( iFwEventHandler ) // LSK
|
|
373 |
{
|
|
374 |
HBufC* appBuf;
|
|
375 |
appBuf = HBufC::NewLC( RProperty::KMaxPropertySize );
|
|
376 |
TPtr appPtr = appBuf->Des();
|
|
377 |
RProperty::Get( KPSUidAiInformation, KActiveIdleExtHS_LSKLocked, appPtr );
|
|
378 |
if( appPtr.Length() > 0 )
|
|
379 |
{
|
|
380 |
iFwEventHandler->HandlePluginEvent(KAiLskLaunchByIndexLocked);
|
|
381 |
}
|
|
382 |
else
|
|
383 |
{
|
|
384 |
iFwEventHandler->HandlePluginEvent(KAiLskLaunchByIndex);
|
|
385 |
}
|
|
386 |
CleanupStack::PopAndDestroy( appBuf );
|
|
387 |
}
|
|
388 |
break;
|
|
389 |
}
|
|
390 |
|
|
391 |
case ENativeUiSoftkeyRight:
|
|
392 |
{
|
|
393 |
break;
|
|
394 |
}
|
|
395 |
|
|
396 |
case ENativeUiSelectionKey:
|
|
397 |
{
|
|
398 |
if( iAppView )
|
|
399 |
{
|
|
400 |
TKeyEvent keyEvent;
|
|
401 |
keyEvent.iCode = EKeyOK;
|
|
402 |
keyEvent.iRepeats = 0;
|
|
403 |
TEventCode type(EEventKey);
|
|
404 |
iAppView->OfferKeyEventL(keyEvent, type);
|
|
405 |
}
|
|
406 |
break;
|
|
407 |
}
|
|
408 |
|
|
409 |
default:
|
|
410 |
{
|
|
411 |
break;
|
|
412 |
}
|
|
413 |
|
|
414 |
}
|
|
415 |
|
|
416 |
}
|
|
417 |
|
|
418 |
void CAppUi::HandleResourceChangeL(TInt aType)
|
|
419 |
{
|
|
420 |
CAknAppUi::HandleResourceChangeL(aType);
|
|
421 |
|
|
422 |
if( aType == KEikDynamicLayoutVariantSwitch )
|
|
423 |
{
|
|
424 |
// Screen layout changed, update and draw status pane.
|
|
425 |
//Get pointer to status pane
|
|
426 |
CEikStatusPane* statusPane = static_cast<CAknAppUi*>( iEikonEnv->EikAppUi() )->StatusPane();
|
|
427 |
if( statusPane )
|
|
428 |
{
|
|
429 |
// Update status pane layout ot the correct one.
|
|
430 |
TInt statusPaneLayout = GetLayoutCenrep();
|
|
431 |
TInt id = statusPane->CurrentLayoutResId();
|
|
432 |
if( id != iCurrentStatusPaneLayout )
|
|
433 |
{
|
|
434 |
statusPane->SwitchLayoutL( id );
|
|
435 |
iCurrentStatusPaneLayout = id;
|
|
436 |
}
|
|
437 |
if( statusPaneLayout == EAiStatusPaneLayoutIdleHidden &&
|
|
438 |
id != R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT )
|
|
439 |
{
|
|
440 |
statusPane->MakeVisible( EFalse );
|
|
441 |
iStanbyContainerIF->SetFullScreenMode( ETrue );
|
|
442 |
}
|
|
443 |
else
|
|
444 |
{
|
|
445 |
statusPane->MakeVisible( ETrue );
|
|
446 |
iStanbyContainerIF->SetFullScreenMode( EFalse );
|
|
447 |
}
|
|
448 |
statusPane->ApplyCurrentSettingsL();
|
|
449 |
statusPane->DrawNow();
|
|
450 |
}
|
|
451 |
if( iAppView )
|
|
452 |
{
|
|
453 |
iAppView->SetRect( ClientRect() );
|
|
454 |
iAppView->DrawNow();
|
|
455 |
}
|
|
456 |
|
|
457 |
}
|
|
458 |
}
|
|
459 |
|
|
460 |
void CAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination)
|
|
461 |
{
|
|
462 |
// Pointer event handling for RSK and SIND launching
|
|
463 |
// LSK handled via HandleCommand
|
|
464 |
if ( AknLayoutUtils::PenEnabled() && aEvent.Type() == EEventPointer )
|
|
465 |
{
|
|
466 |
TPointerEvent *event = aEvent.Pointer();
|
|
467 |
HandlePointerEvent( *event );
|
|
468 |
}
|
|
469 |
|
|
470 |
if( iIdleIntegration )
|
|
471 |
{
|
|
472 |
// Forward window server events first to idle integration library
|
|
473 |
iIdleIntegration->HandleWsEventL(aEvent, aDestination);
|
|
474 |
}
|
|
475 |
|
|
476 |
// Call base class to let the UI framework handle the event
|
|
477 |
CAknAppUi::HandleWsEventL( aEvent, aDestination);
|
|
478 |
}
|
|
479 |
|
|
480 |
void CAppUi::HandlePointerEvent( TPointerEvent &aEvent )
|
|
481 |
{
|
|
482 |
if ( !Cba()->IsVisible() )
|
|
483 |
{
|
|
484 |
return;
|
|
485 |
}
|
|
486 |
|
|
487 |
TRect rskRect;
|
|
488 |
if ( Layout_Meta_Data::IsLandscapeOrientation() )
|
|
489 |
{
|
|
490 |
rskRect = ::SoftkeyRectTopTouch();
|
|
491 |
}
|
|
492 |
else
|
|
493 |
{
|
|
494 |
rskRect = ::SoftkeyRectRightTouch();
|
|
495 |
}
|
|
496 |
// pointer event done in RSK => activate sind timer.
|
|
497 |
if ( aEvent.iType == TPointerEvent::EButton1Down &&
|
|
498 |
rskRect.Contains( aEvent.iParentPosition ))
|
|
499 |
{
|
|
500 |
iSINDKeyDown = ETrue;
|
|
501 |
const TTimeIntervalMicroSeconds32 KLongKeyPress(600000);
|
|
502 |
iTimer->Cancel();
|
|
503 |
iTimer->Start( KLongKeyPress, 0, TCallBack( TimerDone, this ) );
|
|
504 |
}
|
|
505 |
// It doesn't matter where the button up is done
|
|
506 |
// the voice dial is still skipped
|
|
507 |
else if ( iSINDKeyDown &&
|
|
508 |
aEvent.iType == TPointerEvent::EButton1Up )
|
|
509 |
{
|
|
510 |
SkipVoiceDial();
|
|
511 |
}
|
|
512 |
// Dragging outside RSK cancels opening of shortcut
|
|
513 |
// and voice dial
|
|
514 |
else if ( iSINDKeyDown &&
|
|
515 |
aEvent.iType == TPointerEvent::EDrag &&
|
|
516 |
!rskRect.Contains( aEvent.iParentPosition ))
|
|
517 |
{
|
|
518 |
iTimer->Cancel();
|
|
519 |
iSINDKeyDown = EFalse;
|
|
520 |
}
|
|
521 |
}
|
|
522 |
|
|
523 |
void CAppUi::HandleScreenDeviceChangedL()
|
|
524 |
{
|
|
525 |
CAknAppUi::HandleScreenDeviceChangedL();
|
|
526 |
|
|
527 |
if ( iFwEventHandler && iUiCtl )
|
|
528 |
{
|
|
529 |
//iFwEventHandler->HandleUiLayoutChangeL(*iUiCtl);
|
|
530 |
}
|
|
531 |
}
|
|
532 |
|
|
533 |
void CAppUi::PrepareToExit()
|
|
534 |
{
|
|
535 |
if ( iFwEventHandler && iUiCtl )
|
|
536 |
{
|
|
537 |
iUiCtl->PrepareToExit();
|
|
538 |
iFwEventHandler->HandleUiShutdown(*iUiCtl);
|
|
539 |
}
|
|
540 |
}
|
|
541 |
|
|
542 |
TKeyResponse CAppUi::HandleKeyEventL(
|
|
543 |
const TKeyEvent& aKeyEvent,
|
|
544 |
TEventCode aType )
|
|
545 |
{
|
|
546 |
if( aKeyEvent.iScanCode == EStdKeyDevice1 )
|
|
547 |
{
|
|
548 |
if( aType == EEventKeyDown )
|
|
549 |
{
|
|
550 |
iSINDKeyDown = ETrue;
|
|
551 |
const TTimeIntervalMicroSeconds32 KLongKeyPress(600000);
|
|
552 |
iTimer->Cancel();
|
|
553 |
iTimer->Start( KLongKeyPress, 0, TCallBack( TimerDone, this ) );
|
|
554 |
}
|
|
555 |
else if( aType == EEventKeyUp )
|
|
556 |
{
|
|
557 |
if( iSINDKeyDown )
|
|
558 |
{
|
|
559 |
SkipVoiceDial();
|
|
560 |
}
|
|
561 |
}
|
|
562 |
return EKeyWasConsumed;
|
|
563 |
}
|
|
564 |
else
|
|
565 |
{
|
|
566 |
if( aType == EEventKeyDown && iSINDKeyDown )
|
|
567 |
{
|
|
568 |
iSINDKeyDown = EFalse;
|
|
569 |
SkipVoiceDial();
|
|
570 |
}
|
|
571 |
if( iAppView )
|
|
572 |
{
|
|
573 |
return iAppView->OfferKeyEventL(aKeyEvent, aType);
|
|
574 |
}
|
|
575 |
}
|
|
576 |
|
|
577 |
return EKeyWasNotConsumed;
|
|
578 |
}
|
|
579 |
|
|
580 |
void CAppUi::SkipVoiceDial()
|
|
581 |
{
|
|
582 |
iTimer->Cancel();
|
|
583 |
// Handle skip scenario only if voice dial ui hasn't been launched
|
|
584 |
if ( iFwEventHandler )
|
|
585 |
{
|
|
586 |
HBufC* app2Buf;
|
|
587 |
app2Buf = HBufC::New( RProperty::KMaxPropertySize );
|
|
588 |
if ( app2Buf )
|
|
589 |
{
|
|
590 |
TPtr app2Ptr = app2Buf->Des();
|
|
591 |
RProperty::Get( KPSUidAiInformation, KActiveIdleExtHS_RSKLocked, app2Ptr );
|
|
592 |
if( app2Ptr.Length() > 0 )
|
|
593 |
{
|
|
594 |
iFwEventHandler->HandlePluginEvent(KAiRskLaunchByIndexLocked);
|
|
595 |
}
|
|
596 |
else
|
|
597 |
{
|
|
598 |
iFwEventHandler->HandlePluginEvent(KAiRskLaunchByIndex);
|
|
599 |
}
|
|
600 |
delete app2Buf;
|
|
601 |
}
|
|
602 |
}
|
|
603 |
iSINDKeyDown = EFalse;
|
|
604 |
}
|
|
605 |
|
|
606 |
TInt CAppUi::TimerDone(TAny* aSelf)
|
|
607 |
{
|
|
608 |
CAppUi* self = static_cast<CAppUi*>( aSelf );
|
|
609 |
if ( self )
|
|
610 |
{
|
|
611 |
self->iTimer->Cancel();
|
|
612 |
self->iSINDKeyDown = EFalse;
|
|
613 |
self->iFwEventHandler->HandlePluginEvent(KAiRskLaunchVoiceDial);
|
|
614 |
}
|
|
615 |
return KErrNone;
|
|
616 |
}
|
|
617 |
|
|
618 |
void CAppUi::StartL()
|
|
619 |
{
|
|
620 |
if( iStanbyContainerIF )
|
|
621 |
{
|
|
622 |
iStanbyContainerIF->StartL();
|
|
623 |
}
|
|
624 |
|
|
625 |
if( iFwEventHandler )
|
|
626 |
{
|
|
627 |
iFwEventHandler->HandleUiReadyEventL( *iUiCtl );
|
|
628 |
}
|
|
629 |
}
|
|
630 |
|
|
631 |
void CAppUi::HandleNotifyInt( TUint32 aId, TInt aNewValue )
|
|
632 |
{
|
|
633 |
// Set status pane on the fly.
|
|
634 |
if( aId == KAiStatusPaneLayout )
|
|
635 |
{
|
|
636 |
if( aNewValue == EAiStatusPaneLayoutIdleNormal ||
|
|
637 |
aNewValue == EAiStatusPaneLayoutIdleFlat ||
|
|
638 |
aNewValue == EAiStatusPaneLayoutIdleHidden )
|
|
639 |
{
|
|
640 |
//Get pointer to status pane
|
|
641 |
CEikStatusPane* statusPane = static_cast<CAknAppUi*>( iEikonEnv->EikAppUi() )->StatusPane();
|
|
642 |
if( statusPane )
|
|
643 |
{
|
|
644 |
// Update status pane layout ot the correct one.
|
|
645 |
if( aNewValue == EAiStatusPaneLayoutIdleHidden &&
|
|
646 |
iCurrentStatusPaneLayout != R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT )
|
|
647 |
{
|
|
648 |
statusPane->MakeVisible( EFalse );
|
|
649 |
if ( iStanbyContainerIF )
|
|
650 |
{
|
|
651 |
iStanbyContainerIF->SetFullScreenMode( ETrue );
|
|
652 |
}
|
|
653 |
|
|
654 |
}
|
|
655 |
else
|
|
656 |
{
|
|
657 |
statusPane->MakeVisible( ETrue );
|
|
658 |
if ( iStanbyContainerIF )
|
|
659 |
{
|
|
660 |
iStanbyContainerIF->SetFullScreenMode( EFalse );
|
|
661 |
}
|
|
662 |
}
|
|
663 |
statusPane->DrawNow();
|
|
664 |
if( iStanbyContainerIF )
|
|
665 |
{
|
|
666 |
iStanbyContainerIF->SetRect( ClientRect() );
|
|
667 |
}
|
|
668 |
if ( iAppView )
|
|
669 |
{
|
|
670 |
iAppView->DrawNow();
|
|
671 |
}
|
|
672 |
|
|
673 |
}
|
|
674 |
}
|
|
675 |
}
|
|
676 |
}
|
|
677 |
|
|
678 |
void CAppUi::ExtHSThemeChanged()
|
|
679 |
{
|
|
680 |
//TRAP_IGNORE( iFwEventHandler->HandleUiThemeChangeStartL( *iUiCtl ) );
|
|
681 |
TRAP_IGNORE( iFwEventHandler->HandleUiReadyEventL( *iUiCtl ) );
|
|
682 |
}
|
|
683 |
|
|
684 |
TInt CAppUi::HandlePowerkeyEvent( TAny* aPtr )
|
|
685 |
{
|
|
686 |
CAppUi* self = static_cast<CAppUi*>(aPtr);
|
|
687 |
if( self && self->iStanbyContainerIF )
|
|
688 |
{
|
|
689 |
TKeyEvent keyEvent;
|
|
690 |
keyEvent.iCode = EKeyPhoneEnd;
|
|
691 |
TEventCode eventType;
|
|
692 |
eventType = EEventKey;
|
|
693 |
TRAP_IGNORE( self->iStanbyContainerIF->OfferKeyEventL( keyEvent, eventType ) );
|
|
694 |
}
|
|
695 |
return KErrNone;
|
|
696 |
}
|
|
697 |
|
|
698 |
// End of File.
|