83
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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 |
* Implementation of the container control for WidgetManager application.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include <aknViewAppUi.h>
|
|
21 |
#include <eikappui.h>
|
|
22 |
#include <widgetmanagerview.rsg>
|
|
23 |
#include <coemain.h>
|
|
24 |
#include <eikenv.h>
|
|
25 |
#include <barsread.h>
|
|
26 |
#include <AknUtils.h>
|
|
27 |
#include <barsread.h>
|
|
28 |
#include <StringLoader.h>
|
|
29 |
#include <eikenv.h>
|
|
30 |
#include <AknIconArray.h>
|
|
31 |
#include <aknstyluspopupmenu.h>
|
|
32 |
#include <avkon.loc>
|
|
33 |
#include <aknlayout.cdl.h>
|
|
34 |
#include <layoutmetadata.cdl.h>
|
|
35 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
36 |
#include <aknlayoutscalable_apps.cdl.h>
|
|
37 |
#include <AknLayout.lag>
|
|
38 |
#include <AknsSkinInstance.h>
|
|
39 |
#include <AknIconUtils.h>
|
|
40 |
#include <AknsDrawUtils.h>
|
|
41 |
#include <aknenv.h>
|
|
42 |
#include <aknlists.h>
|
|
43 |
#include <eikclbd.h>
|
|
44 |
#include <aknsfld.h>
|
|
45 |
#include <AknsBasicBackgroundControlContext.h>
|
|
46 |
#include <apgcli.h>
|
|
47 |
#include <widgetmanager.mbg>
|
|
48 |
#include <avkon.rsg>
|
|
49 |
#include <coecobs.h>
|
|
50 |
#include <coecntrl.h>
|
|
51 |
#include <featmgr.h> // FeatureManager
|
|
52 |
#include <hlplch.h> // HlpLauncher
|
|
53 |
#include <csxhelp/hmsc.hlp.hrh>
|
|
54 |
#include <aisystemuids.hrh>
|
|
55 |
#include <babitflags.h>
|
|
56 |
|
|
57 |
#include "wmcommon.h"
|
|
58 |
#include "wmplugin.h"
|
|
59 |
#include "wmmaincontainer.h"
|
|
60 |
#include "wmmaincontainerview.h"
|
|
61 |
#include "wmresourceloader.h"
|
|
62 |
#include "widgetmanager.hrh"
|
|
63 |
#include "wmlistbox.h"
|
|
64 |
#include "wmpersistentwidgetorder.h"
|
|
65 |
#include "wmdetailsdlg.h"
|
|
66 |
#include "wmportalbutton.h"
|
|
67 |
#include "wmwidgetloaderao.h"
|
|
68 |
#include "wmconfiguration.h"
|
|
69 |
#include "wminstaller.h"
|
|
70 |
|
|
71 |
#include <hscontentcontroller.h> // content control api
|
|
72 |
#include <hscontentinfoarray.h> // content control api
|
|
73 |
|
|
74 |
// CONSTANTS
|
|
75 |
const TInt KTextLimit = 40; // Text-limit for find-field
|
|
76 |
const TInt KMinWidgets = 1; // minimum number of widgets to show findpane
|
|
77 |
|
|
78 |
// ---------------------------------------------------------
|
|
79 |
// CWmMainContainer::CWmMainContainer()
|
|
80 |
// ---------------------------------------------------------
|
|
81 |
//
|
|
82 |
CWmMainContainer::CWmMainContainer( CWmPlugin& aWmPlugin ) :
|
|
83 |
iWmPlugin( aWmPlugin )
|
|
84 |
{
|
|
85 |
iWidgetsList = NULL;
|
|
86 |
iFindbox = NULL;
|
|
87 |
iFindPaneIsVisible = EFalse;
|
|
88 |
iBgContext = NULL;
|
|
89 |
iFocusMode = ENowhere;
|
|
90 |
iClosingDown = ETrue;
|
|
91 |
}
|
|
92 |
|
|
93 |
// ---------------------------------------------------------
|
|
94 |
// CWmMainContainer::~CWmMainContainer()
|
|
95 |
// ---------------------------------------------------------
|
|
96 |
//
|
|
97 |
CWmMainContainer::~CWmMainContainer()
|
|
98 |
{
|
|
99 |
TRAP_IGNORE(DeactivateFindPaneL(EFalse));
|
|
100 |
|
|
101 |
if ( iWidgetLoader )
|
|
102 |
{
|
|
103 |
iWidgetLoader->SetObserver( NULL );
|
|
104 |
delete iWidgetLoader;
|
|
105 |
}
|
|
106 |
|
|
107 |
RemoveCtrlsFromStack();
|
|
108 |
Components().ResetAndDestroy();
|
|
109 |
|
|
110 |
iWidgetsList = NULL;
|
|
111 |
iPortalButtonOne = NULL;
|
|
112 |
iPortalButtonTwo = NULL;
|
|
113 |
iFindbox = NULL;
|
|
114 |
delete iBgContext;
|
|
115 |
delete iConfiguration;
|
|
116 |
}
|
|
117 |
|
|
118 |
// ---------------------------------------------------------
|
|
119 |
// CWmMainContainer::NewL
|
|
120 |
// ---------------------------------------------------------
|
|
121 |
//
|
|
122 |
CWmMainContainer* CWmMainContainer::NewL(
|
|
123 |
const TRect& aRect,
|
|
124 |
CWmPlugin& aWmPlugin )
|
|
125 |
{
|
|
126 |
CWmMainContainer* self = CWmMainContainer::NewLC(
|
|
127 |
aRect,
|
|
128 |
aWmPlugin );
|
|
129 |
CleanupStack::Pop( self );
|
|
130 |
return self;
|
|
131 |
}
|
|
132 |
|
|
133 |
// ---------------------------------------------------------
|
|
134 |
// CWmMainContainer::NewLC
|
|
135 |
// ---------------------------------------------------------
|
|
136 |
//
|
|
137 |
CWmMainContainer* CWmMainContainer::NewLC(
|
|
138 |
const TRect& aRect,
|
|
139 |
CWmPlugin& aWmPlugin )
|
|
140 |
{
|
|
141 |
CWmMainContainer* self = new (ELeave) CWmMainContainer( aWmPlugin );
|
|
142 |
CleanupStack::PushL( self );
|
|
143 |
self->ConstructL( aRect );
|
|
144 |
return self;
|
|
145 |
}
|
|
146 |
|
|
147 |
// ---------------------------------------------------------
|
|
148 |
// ScreenRect
|
|
149 |
// rectangle representing the screen
|
|
150 |
// ---------------------------------------------------------
|
|
151 |
//
|
|
152 |
TRect ScreenRect()
|
|
153 |
{
|
|
154 |
TRect screen;
|
|
155 |
CCoeEnv* env = CCoeEnv::Static();
|
|
156 |
if ( env )
|
|
157 |
{
|
|
158 |
CWsScreenDevice* screenDevice = env->ScreenDevice();
|
|
159 |
if ( screenDevice )
|
|
160 |
screen.SetRect( TPoint(0,0), screenDevice->SizeInPixels() );
|
|
161 |
}
|
|
162 |
return screen;
|
|
163 |
}
|
|
164 |
|
|
165 |
// ---------------------------------------------------------
|
|
166 |
// CWmMainContainer::ConstructL
|
|
167 |
// ---------------------------------------------------------
|
|
168 |
//
|
|
169 |
void CWmMainContainer::ConstructL(
|
|
170 |
const TRect& aRect )
|
|
171 |
{
|
|
172 |
// Initialize control array
|
|
173 |
InitComponentArrayL();
|
|
174 |
Components().SetControlsOwnedExternally( ETrue );
|
|
175 |
|
|
176 |
// create the UI
|
|
177 |
CreateWindowL();
|
|
178 |
|
|
179 |
// background context
|
|
180 |
iBgContext = CAknsBasicBackgroundControlContext::NewL(
|
|
181 |
KAknsIIDQsnBgScreen, ScreenRect() , ETrue);
|
|
182 |
|
|
183 |
// load configuration
|
|
184 |
iConfiguration = CWmConfiguration::NewL( iWmPlugin.ResourceLoader() );
|
|
185 |
|
|
186 |
// set up controls
|
|
187 |
InitializeControlsL( aRect );
|
|
188 |
|
|
189 |
// set size and activate
|
|
190 |
SetRect( aRect );
|
|
191 |
ActivateL();
|
|
192 |
|
|
193 |
}
|
|
194 |
|
|
195 |
// ---------------------------------------------------------
|
|
196 |
// CWmMainContainer::SizeChanged
|
|
197 |
// ---------------------------------------------------------
|
|
198 |
//
|
|
199 |
void CWmMainContainer::SizeChanged()
|
|
200 |
{
|
|
201 |
CCoeControl::SizeChanged();
|
|
202 |
iBgContext->SetRect( ScreenRect() );
|
|
203 |
LayoutControls();
|
|
204 |
}
|
|
205 |
|
|
206 |
// ---------------------------------------------------------
|
|
207 |
// CWmMainContainer::LayoutControls
|
|
208 |
// ---------------------------------------------------------
|
|
209 |
//
|
|
210 |
void CWmMainContainer::LayoutControls()
|
|
211 |
{
|
|
212 |
TRect rect( Rect() );
|
|
213 |
|
|
214 |
// determine layout type
|
|
215 |
iLandscape = Layout_Meta_Data::IsLandscapeOrientation();
|
|
216 |
iMirrored = Layout_Meta_Data::IsMirrored();
|
|
217 |
|
|
218 |
// layout iPortalButtons
|
|
219 |
if ( iConfiguration->PortalButtonCount() == 1 )
|
|
220 |
{
|
|
221 |
// one button
|
|
222 |
TAknWindowLineLayout btnPane = AknLayoutScalable_Apps
|
|
223 |
::wgtman_btn_pane( iLandscape ? 1 : 0 ).LayoutLine();
|
|
224 |
AknLayoutUtils::LayoutControl( iPortalButtonOne, rect, btnPane );
|
|
225 |
}
|
|
226 |
else
|
|
227 |
{
|
|
228 |
// two buttons
|
|
229 |
TInt variety = (iLandscape ? 3 : 2);
|
|
230 |
TAknWindowLineLayout oviBtnLayout = AknLayoutScalable_Apps
|
|
231 |
::wgtman_btn_pane( variety ).LayoutLine();
|
|
232 |
TAknWindowLineLayout operatorBtnLayout = AknLayoutScalable_Apps
|
|
233 |
::wgtman_btn_pane_cp_01( variety ).LayoutLine();
|
|
234 |
|
|
235 |
// button placement
|
|
236 |
if ( iConfiguration->PortalButtonsMirrored() )
|
|
237 |
{
|
|
238 |
AknLayoutUtils::LayoutControl( iPortalButtonOne, rect, operatorBtnLayout );
|
|
239 |
AknLayoutUtils::LayoutControl( iPortalButtonTwo, rect, oviBtnLayout );
|
|
240 |
}
|
|
241 |
else
|
|
242 |
{
|
|
243 |
AknLayoutUtils::LayoutControl( iPortalButtonOne, rect, oviBtnLayout );
|
|
244 |
AknLayoutUtils::LayoutControl( iPortalButtonTwo, rect, operatorBtnLayout );
|
|
245 |
}
|
|
246 |
}
|
|
247 |
|
|
248 |
// layout iWidgetsList
|
|
249 |
TAknWindowLineLayout listPane = AknLayoutScalable_Apps
|
|
250 |
::listscroll_wgtman_pane( iLandscape ? 1 : 0 ).LayoutLine();
|
|
251 |
if( iFindbox && iFindPaneIsVisible )
|
|
252 |
{
|
|
253 |
TAknLayoutRect layoutRect;
|
|
254 |
layoutRect.LayoutRect( rect, listPane );
|
|
255 |
iWidgetsList->SetRect( layoutRect.Rect() );
|
|
256 |
HandleFindSizeChanged();
|
|
257 |
}
|
|
258 |
else
|
|
259 |
{
|
|
260 |
AknLayoutUtils::LayoutControl( iWidgetsList, rect, listPane );
|
|
261 |
}
|
|
262 |
|
|
263 |
DrawDeferred();
|
|
264 |
}
|
|
265 |
|
|
266 |
// ---------------------------------------------------------
|
|
267 |
// CWmMainContainer::OfferKeyEventL
|
|
268 |
// ---------------------------------------------------------
|
|
269 |
//
|
|
270 |
TKeyResponse CWmMainContainer::OfferKeyEventL(
|
|
271 |
const TKeyEvent& aKeyEvent,
|
|
272 |
TEventCode aType )
|
|
273 |
{
|
|
274 |
TKeyResponse keyResponse( EKeyWasNotConsumed );
|
|
275 |
|
|
276 |
// This is a bug fix for ou1cimx1#217716 & ou1cimx1#217667.
|
|
277 |
// For some weird reason homescreen is genarating one extra EEventKey
|
|
278 |
// when using bluetooth keyboard & backspace key. This if is to
|
|
279 |
// ignore that event. Extra event allways has iModifiers set to
|
|
280 |
// EModifierAutorepeatable, EModifierKeyboardExtend and
|
|
281 |
// EModifierNumLock.
|
|
282 |
if ( aType == EEventKey &&
|
|
283 |
aKeyEvent.iScanCode == EStdKeyBackspace &&
|
|
284 |
aKeyEvent.iModifiers&EModifierKeyboardExtend &&
|
|
285 |
aKeyEvent.iModifiers&EModifierNumLock &&
|
|
286 |
aKeyEvent.iModifiers&EModifierAutorepeatable )
|
|
287 |
{
|
|
288 |
return EKeyWasConsumed;
|
|
289 |
}
|
|
290 |
|
|
291 |
// Handle search keyevent
|
|
292 |
keyResponse = HandleSearchKeyEventL( aKeyEvent, aType );
|
|
293 |
|
|
294 |
// Move focus between controls
|
|
295 |
if ( keyResponse == EKeyWasNotConsumed )
|
|
296 |
{
|
|
297 |
keyResponse = MoveFocusByKeys( aKeyEvent, aType );
|
|
298 |
}
|
|
299 |
|
|
300 |
// Handle list keyevent
|
|
301 |
if ( keyResponse == EKeyWasNotConsumed )
|
|
302 |
{
|
|
303 |
keyResponse = HandleListKeyEventL( aKeyEvent, aType );
|
|
304 |
}
|
|
305 |
|
|
306 |
// Handle buttons keyevent
|
|
307 |
if ( keyResponse == EKeyWasNotConsumed )
|
|
308 |
{
|
|
309 |
keyResponse = HandleButtonKeyEventL( aKeyEvent, aType );
|
|
310 |
}
|
|
311 |
|
|
312 |
// Update ui if needed
|
|
313 |
if ( keyResponse == EKeyWasConsumed )
|
|
314 |
{
|
|
315 |
DrawDeferred();
|
|
316 |
}
|
|
317 |
|
|
318 |
// Do not let UI framework forward the keys to child controls as
|
|
319 |
// we have already done that.
|
|
320 |
return EKeyWasConsumed;
|
|
321 |
}
|
|
322 |
|
|
323 |
// ---------------------------------------------------------
|
|
324 |
// CWmMainContainer::HandleSearchKeyEventL
|
|
325 |
// ---------------------------------------------------------
|
|
326 |
//
|
|
327 |
TKeyResponse CWmMainContainer::HandleSearchKeyEventL(
|
|
328 |
const TKeyEvent& aKeyEvent,
|
|
329 |
TEventCode aType )
|
|
330 |
{
|
|
331 |
TKeyResponse keyResponse( EKeyWasNotConsumed );
|
|
332 |
|
|
333 |
// open search field with alpha digit numbers
|
|
334 |
if ( aType == EEventKeyDown && !iFindPaneIsVisible &&
|
|
335 |
aKeyEvent.iScanCode < EStdKeyF1 &&
|
|
336 |
TChar( aKeyEvent.iScanCode ).IsAlphaDigit() )
|
|
337 |
{
|
|
338 |
ActivateFindPaneL( EFalse );
|
|
339 |
|
|
340 |
if ( iFindPaneIsVisible )
|
|
341 |
{
|
|
342 |
return EKeyWasConsumed;
|
|
343 |
}
|
|
344 |
}
|
|
345 |
|
|
346 |
if ( iFindPaneIsVisible && aType == EEventKey )
|
|
347 |
{
|
|
348 |
if ( aKeyEvent.iScanCode == EStdKeyNo || aKeyEvent.iCode == EKeyNo )
|
|
349 |
{
|
|
350 |
DeactivateFindPaneL();
|
|
351 |
return EKeyWasConsumed;
|
|
352 |
}
|
|
353 |
|
|
354 |
TBool needsRefresh( EFalse );
|
|
355 |
|
|
356 |
if ( iFindbox->TextLength() == 0
|
|
357 |
&& aKeyEvent.iScanCode == EStdKeyBackspace )
|
|
358 |
{
|
|
359 |
// if lenght is 0 and backspace is pressed AknFind will deactivate
|
|
360 |
// searchbox so we don't want to pass this event to AknFind
|
|
361 |
keyResponse = EKeyWasConsumed;
|
|
362 |
}
|
|
363 |
else
|
|
364 |
{
|
|
365 |
keyResponse = AknFind::HandleFindOfferKeyEventL(
|
|
366 |
aKeyEvent, aType, this,
|
|
367 |
iWidgetsList, iFindbox, ETrue, needsRefresh );
|
|
368 |
}
|
|
369 |
if ( needsRefresh )
|
|
370 |
{
|
|
371 |
DrawNow();
|
|
372 |
}
|
|
373 |
}
|
|
374 |
|
|
375 |
return keyResponse;
|
|
376 |
}
|
|
377 |
|
|
378 |
// ---------------------------------------------------------
|
|
379 |
// CWmMainContainer::HandleListKeyEventL
|
|
380 |
// ---------------------------------------------------------
|
|
381 |
//
|
|
382 |
TKeyResponse CWmMainContainer::HandleListKeyEventL(
|
|
383 |
const TKeyEvent& aKeyEvent,
|
|
384 |
TEventCode aType )
|
|
385 |
{
|
|
386 |
TKeyResponse keyResponse( EKeyWasNotConsumed );
|
|
387 |
|
|
388 |
// pass key event except backpace or delete key event to widgets list if focused
|
|
389 |
if ( iWidgetsList->IsFocused() )
|
|
390 |
{
|
|
391 |
if ( ( aType == EEventKey ) && ( aKeyEvent.iCode == EKeyBackspace
|
|
392 |
|| aKeyEvent.iCode == EKeyDelete ) )
|
|
393 |
{
|
|
394 |
if( CanDoUninstall() )
|
|
395 |
{
|
|
396 |
UninstallWidgetL();
|
|
397 |
}
|
|
398 |
else
|
|
399 |
{
|
|
400 |
CWmWidgetData* data = iWidgetsList->WidgetData();
|
|
401 |
if( data != NULL )
|
|
402 |
iWmPlugin.ResourceLoader().InfoPopupL(
|
|
403 |
R_QTN_WM_UNINST_NOT_ALLOWED, data->Name() );
|
|
404 |
}
|
|
405 |
keyResponse = EKeyWasConsumed;
|
|
406 |
}
|
|
407 |
else
|
|
408 |
{
|
|
409 |
//passing to listbox handler
|
|
410 |
keyResponse = iWidgetsList->OfferKeyEventL(
|
|
411 |
aKeyEvent, aType );
|
|
412 |
}
|
|
413 |
}
|
|
414 |
|
|
415 |
return keyResponse;
|
|
416 |
}
|
|
417 |
|
|
418 |
// ---------------------------------------------------------
|
|
419 |
// CWmMainContainer::HandleButtonKeyEventL
|
|
420 |
// ---------------------------------------------------------
|
|
421 |
//
|
|
422 |
TKeyResponse CWmMainContainer::HandleButtonKeyEventL(
|
|
423 |
const TKeyEvent& aKeyEvent,
|
|
424 |
TEventCode aType )
|
|
425 |
{
|
|
426 |
TKeyResponse keyResponse( EKeyWasNotConsumed );
|
|
427 |
|
|
428 |
// pass key event to portal button if focused
|
|
429 |
if ( iPortalButtonOne->IsFocused() )
|
|
430 |
{
|
|
431 |
keyResponse = iPortalButtonOne->OfferKeyEventL(
|
|
432 |
aKeyEvent, aType );
|
|
433 |
}
|
|
434 |
|
|
435 |
// pass key event to the other portal button if exists and focused
|
|
436 |
if ( iPortalButtonTwo && iPortalButtonTwo->IsFocused() )
|
|
437 |
{
|
|
438 |
keyResponse = iPortalButtonTwo->OfferKeyEventL(
|
|
439 |
aKeyEvent, aType );
|
|
440 |
}
|
|
441 |
|
|
442 |
return keyResponse;
|
|
443 |
}
|
|
444 |
|
|
445 |
// ---------------------------------------------------------
|
|
446 |
// CWmMainContainer::MoveFocusByKeys
|
|
447 |
// ---------------------------------------------------------
|
|
448 |
//
|
|
449 |
TKeyResponse CWmMainContainer::MoveFocusByKeys(
|
|
450 |
const TKeyEvent& aKeyEvent,
|
|
451 |
TEventCode aType )
|
|
452 |
{
|
|
453 |
TKeyResponse keyResponse( EKeyWasNotConsumed );
|
|
454 |
|
|
455 |
if ( iWidgetsList->IsFocused() )
|
|
456 |
{
|
|
457 |
// ------------------------------------
|
|
458 |
// focus is in the WIDGETS LIST
|
|
459 |
// ------------------------------------
|
|
460 |
if ( !iLandscape &&
|
|
461 |
aKeyEvent.iScanCode == EStdKeyUpArrow &&
|
|
462 |
iWidgetsList->CurrentItemIndex() == 0 )
|
|
463 |
{
|
|
464 |
// widget list top -> up -> ovi button (portrait)
|
|
465 |
if ( aType == EEventKey )
|
|
466 |
SetFocusToPortalButton( OperatorButtonHigherPriority ( 0 ) );
|
|
467 |
keyResponse = EKeyWasConsumed;
|
|
468 |
}
|
|
469 |
else if ( !iLandscape &&
|
|
470 |
aKeyEvent.iScanCode == EStdKeyDownArrow &&
|
|
471 |
iWidgetsList->CurrentItemIndex() ==
|
|
472 |
iWidgetsList->Model()->NumberOfItems() - 1 )
|
|
473 |
{
|
|
474 |
// widget list bottom -> down -> ovi button (portrait)
|
|
475 |
if ( aType == EEventKey )
|
|
476 |
SetFocusToPortalButton( OperatorButtonHigherPriority ( 0 ) );
|
|
477 |
keyResponse = EKeyWasConsumed;
|
|
478 |
}
|
|
479 |
else if ( iLandscape && !iMirrored &&
|
|
480 |
aKeyEvent.iScanCode == EStdKeyRightArrow )
|
|
481 |
{
|
|
482 |
// widget list -> right -> ovi button (landscape normal)
|
|
483 |
if ( aType == EEventKey )
|
|
484 |
SetFocusToPortalButton( OperatorButtonHigherPriority ( 0 ) );
|
|
485 |
keyResponse = EKeyWasConsumed;
|
|
486 |
}
|
|
487 |
else if ( iLandscape && iMirrored &&
|
|
488 |
aKeyEvent.iScanCode == EStdKeyLeftArrow )
|
|
489 |
{
|
|
490 |
// widget list -> left -> ovi button (landscape mirrored)
|
|
491 |
if ( aType == EEventKey )
|
|
492 |
SetFocusToPortalButton( OperatorButtonHigherPriority ( 0 ) );
|
|
493 |
keyResponse = EKeyWasConsumed;
|
|
494 |
}
|
|
495 |
}
|
|
496 |
else if ( iPortalButtonOne->IsFocused() )
|
|
497 |
{
|
|
498 |
// ------------------------------------
|
|
499 |
// focus is in the FIRST PORTAL BUTTON
|
|
500 |
// ------------------------------------
|
|
501 |
if ( !iLandscape &&
|
|
502 |
aKeyEvent.iScanCode == EStdKeyDownArrow )
|
|
503 |
{
|
|
504 |
// left portal -> down -> widget list top (portrait)
|
|
505 |
if ( aType == EEventKey )
|
|
506 |
SetFocusToWidgetList( 0 );
|
|
507 |
keyResponse = EKeyWasConsumed;
|
|
508 |
}
|
|
509 |
else if ( !iLandscape &&
|
|
510 |
aKeyEvent.iScanCode == EStdKeyUpArrow )
|
|
511 |
{
|
|
512 |
// left portal -> up -> widget list bottom (portrait)
|
|
513 |
if ( aType == EEventKey )
|
|
514 |
SetFocusToWidgetList( iWidgetsList->Model()->NumberOfItems()-1 );
|
|
515 |
keyResponse = EKeyWasConsumed;
|
|
516 |
}
|
|
517 |
else if ( !iLandscape && !iMirrored &&
|
|
518 |
aKeyEvent.iScanCode == EStdKeyLeftArrow &&
|
|
519 |
iConfiguration->PortalButtonCount() > 1 &&
|
|
520 |
iConfiguration->PortalButtonsMirrored() )
|
|
521 |
{
|
|
522 |
// right portal -> left -> left portal
|
|
523 |
// (portrait, operator button higher priority )
|
|
524 |
if ( aType == EEventKey )
|
|
525 |
SetFocusToPortalButton( 1 );
|
|
526 |
keyResponse = EKeyWasConsumed;
|
|
527 |
}
|
|
528 |
else if ( !iLandscape && !iMirrored &&
|
|
529 |
aKeyEvent.iScanCode == EStdKeyRightArrow &&
|
|
530 |
iConfiguration->PortalButtonCount() > 1 &&
|
|
531 |
!iConfiguration->PortalButtonsMirrored() )
|
|
532 |
{
|
|
533 |
// left portal -> right -> right portal (portrait normal)
|
|
534 |
if ( aType == EEventKey )
|
|
535 |
SetFocusToPortalButton( 1 );
|
|
536 |
keyResponse = EKeyWasConsumed;
|
|
537 |
}
|
|
538 |
else if ( !iLandscape && iMirrored &&
|
|
539 |
aKeyEvent.iScanCode == EStdKeyRightArrow &&
|
|
540 |
iConfiguration->PortalButtonCount() > 1 &&
|
|
541 |
iConfiguration->PortalButtonsMirrored() )
|
|
542 |
{
|
|
543 |
// right portal -> left -> left portal (portrait mirrored)
|
|
544 |
if ( aType == EEventKey )
|
|
545 |
SetFocusToPortalButton( 1 );
|
|
546 |
keyResponse = EKeyWasConsumed;
|
|
547 |
}
|
|
548 |
else if ( !iLandscape && iMirrored &&
|
|
549 |
aKeyEvent.iScanCode == EStdKeyLeftArrow &&
|
|
550 |
iConfiguration->PortalButtonCount() > 1 &&
|
|
551 |
!iConfiguration->PortalButtonsMirrored() )
|
|
552 |
{
|
|
553 |
// right portal -> left -> left portal (portrait mirrored)
|
|
554 |
if ( aType == EEventKey )
|
|
555 |
SetFocusToPortalButton( 1 );
|
|
556 |
keyResponse = EKeyWasConsumed;
|
|
557 |
}
|
|
558 |
else if ( iLandscape && !iMirrored &&
|
|
559 |
aKeyEvent.iScanCode == EStdKeyLeftArrow )
|
|
560 |
{
|
|
561 |
// upper portal -> left -> widget list (landscape normal)
|
|
562 |
if ( aType == EEventKey )
|
|
563 |
SetFocusToWidgetList();
|
|
564 |
keyResponse = EKeyWasConsumed;
|
|
565 |
}
|
|
566 |
else if ( iLandscape && iMirrored &&
|
|
567 |
aKeyEvent.iScanCode == EStdKeyRightArrow )
|
|
568 |
{
|
|
569 |
// upper portal -> right -> widget list (landscape mirrored)
|
|
570 |
if ( aType == EEventKey )
|
|
571 |
SetFocusToWidgetList();
|
|
572 |
keyResponse = EKeyWasConsumed;
|
|
573 |
}
|
|
574 |
else if ( iLandscape &&
|
|
575 |
aKeyEvent.iScanCode == EStdKeyUpArrow &&
|
|
576 |
iConfiguration->PortalButtonCount() > 1 &&
|
|
577 |
iConfiguration->PortalButtonsMirrored() )
|
|
578 |
{
|
|
579 |
// lower portal -> up -> upper portal
|
|
580 |
// (landscape, operator button higher priority )
|
|
581 |
if ( aType == EEventKey )
|
|
582 |
SetFocusToPortalButton( 1 );
|
|
583 |
keyResponse = EKeyWasConsumed;
|
|
584 |
}
|
|
585 |
else if ( iLandscape &&
|
|
586 |
aKeyEvent.iScanCode == EStdKeyDownArrow &&
|
|
587 |
iConfiguration->PortalButtonCount() > 1 &&
|
|
588 |
!iConfiguration->PortalButtonsMirrored() )
|
|
589 |
{
|
|
590 |
// upper portal -> down -> lower portal (landscape)
|
|
591 |
if ( aType == EEventKey )
|
|
592 |
SetFocusToPortalButton( 1 );
|
|
593 |
keyResponse = EKeyWasConsumed;
|
|
594 |
}
|
|
595 |
}
|
|
596 |
else if ( iPortalButtonTwo && iPortalButtonTwo->IsFocused() )
|
|
597 |
{
|
|
598 |
// ------------------------------------
|
|
599 |
// focus is in the SECOND PORTAL BUTTON
|
|
600 |
// ------------------------------------
|
|
601 |
if ( !iLandscape &&
|
|
602 |
aKeyEvent.iScanCode == EStdKeyDownArrow )
|
|
603 |
{
|
|
604 |
// right portal -> down -> widget list top (portrait)
|
|
605 |
if ( aType == EEventKey )
|
|
606 |
SetFocusToWidgetList( 0 );
|
|
607 |
keyResponse = EKeyWasConsumed;
|
|
608 |
}
|
|
609 |
else if ( !iLandscape &&
|
|
610 |
aKeyEvent.iScanCode == EStdKeyUpArrow )
|
|
611 |
{
|
|
612 |
// right portal -> up -> widget list bottom (portrait)
|
|
613 |
if ( aType == EEventKey )
|
|
614 |
SetFocusToWidgetList( iWidgetsList->Model()->NumberOfItems()-1 );
|
|
615 |
keyResponse = EKeyWasConsumed;
|
|
616 |
}
|
|
617 |
else if ( !iLandscape && !iMirrored &&
|
|
618 |
aKeyEvent.iScanCode == EStdKeyRightArrow &&
|
|
619 |
iConfiguration->PortalButtonCount() > 1 &&
|
|
620 |
iConfiguration->PortalButtonsMirrored() )
|
|
621 |
{
|
|
622 |
// left portal -> right -> right portal
|
|
623 |
// (portrait, operator button higher priority )
|
|
624 |
if ( aType == EEventKey )
|
|
625 |
SetFocusToPortalButton( 0 );
|
|
626 |
keyResponse = EKeyWasConsumed;
|
|
627 |
}
|
|
628 |
else if ( !iLandscape && !iMirrored &&
|
|
629 |
aKeyEvent.iScanCode == EStdKeyLeftArrow &&
|
|
630 |
iConfiguration->PortalButtonCount() > 1 &&
|
|
631 |
!iConfiguration->PortalButtonsMirrored() )
|
|
632 |
{
|
|
633 |
// right portal -> left -> left portal (portrait normal)
|
|
634 |
if ( aType == EEventKey )
|
|
635 |
SetFocusToPortalButton( 0 );
|
|
636 |
keyResponse = EKeyWasConsumed;
|
|
637 |
}
|
|
638 |
else if ( !iLandscape && iMirrored &&
|
|
639 |
aKeyEvent.iScanCode == EStdKeyLeftArrow &&
|
|
640 |
iConfiguration->PortalButtonCount() > 1 &&
|
|
641 |
iConfiguration->PortalButtonsMirrored() )
|
|
642 |
{
|
|
643 |
// left portal -> right -> right portal (portrait mirrored)
|
|
644 |
if ( aType == EEventKey )
|
|
645 |
SetFocusToPortalButton( 0 );
|
|
646 |
keyResponse = EKeyWasConsumed;
|
|
647 |
}
|
|
648 |
else if ( !iLandscape && iMirrored &&
|
|
649 |
aKeyEvent.iScanCode == EStdKeyRightArrow &&
|
|
650 |
iConfiguration->PortalButtonCount() > 1 &&
|
|
651 |
!iConfiguration->PortalButtonsMirrored() )
|
|
652 |
{
|
|
653 |
// left portal -> right -> right portal (portrait mirrored)
|
|
654 |
if ( aType == EEventKey )
|
|
655 |
SetFocusToPortalButton( 0 );
|
|
656 |
keyResponse = EKeyWasConsumed;
|
|
657 |
}
|
|
658 |
else if ( iLandscape && !iMirrored &&
|
|
659 |
aKeyEvent.iScanCode == EStdKeyLeftArrow )
|
|
660 |
{
|
|
661 |
// lower portal -> left -> widget list (landscape normal)
|
|
662 |
if ( aType == EEventKey )
|
|
663 |
SetFocusToWidgetList();
|
|
664 |
keyResponse = EKeyWasConsumed;
|
|
665 |
}
|
|
666 |
else if ( iLandscape && iMirrored &&
|
|
667 |
aKeyEvent.iScanCode == EStdKeyRightArrow )
|
|
668 |
{
|
|
669 |
// lower portal -> right -> widget list (landscape mirrored)
|
|
670 |
if ( aType == EEventKey )
|
|
671 |
SetFocusToWidgetList();
|
|
672 |
keyResponse = EKeyWasConsumed;
|
|
673 |
}
|
|
674 |
else if ( iLandscape &&
|
|
675 |
aKeyEvent.iScanCode == EStdKeyDownArrow &&
|
|
676 |
iConfiguration->PortalButtonsMirrored() )
|
|
677 |
{
|
|
678 |
// upper portal -> down -> lower portal
|
|
679 |
// ( landscape operator button higher priority )
|
|
680 |
if ( aType == EEventKey )
|
|
681 |
SetFocusToPortalButton( 0 );
|
|
682 |
keyResponse = EKeyWasConsumed;
|
|
683 |
}
|
|
684 |
else if ( iLandscape &&
|
|
685 |
aKeyEvent.iScanCode == EStdKeyUpArrow &&
|
|
686 |
!iConfiguration->PortalButtonsMirrored() )
|
|
687 |
{
|
|
688 |
// lower portal -> up -> upper portal (landscape)
|
|
689 |
if ( aType == EEventKey )
|
|
690 |
SetFocusToPortalButton( 0 );
|
|
691 |
keyResponse = EKeyWasConsumed;
|
|
692 |
}
|
|
693 |
}
|
|
694 |
else
|
|
695 |
{
|
|
696 |
// ------------------------------------
|
|
697 |
// focus is NOWHERE
|
|
698 |
// ------------------------------------
|
|
699 |
if ( aKeyEvent.iScanCode == EStdKeyUpArrow ||
|
|
700 |
aKeyEvent.iScanCode == EStdKeyDownArrow )
|
|
701 |
{
|
|
702 |
// no focus -> key hit -> focus list
|
|
703 |
if ( aType == EEventKey )
|
|
704 |
{
|
|
705 |
SetFocusToWidgetList();
|
|
706 |
keyResponse = EKeyWasNotConsumed;
|
|
707 |
}
|
|
708 |
}
|
|
709 |
}
|
|
710 |
|
|
711 |
return keyResponse;
|
|
712 |
}
|
|
713 |
|
|
714 |
|
|
715 |
// ---------------------------------------------------------
|
|
716 |
// CWmMainContainer::OperatorButtonHigherPriority
|
|
717 |
// ---------------------------------------------------------
|
|
718 |
//
|
|
719 |
TInt CWmMainContainer::OperatorButtonHigherPriority( TInt aIndex )
|
|
720 |
{
|
|
721 |
TInt ret = aIndex;
|
|
722 |
if ( iConfiguration->PortalButtonsMirrored() )
|
|
723 |
{
|
|
724 |
if ( aIndex == 0 )
|
|
725 |
{
|
|
726 |
ret = 1;
|
|
727 |
}
|
|
728 |
else if ( aIndex == 1 )
|
|
729 |
{
|
|
730 |
ret = 0;
|
|
731 |
}
|
|
732 |
}
|
|
733 |
return ret;
|
|
734 |
}
|
|
735 |
|
|
736 |
// ---------------------------------------------------------
|
|
737 |
// CWmMainContainer::SetFocusToPortalButton
|
|
738 |
// ---------------------------------------------------------
|
|
739 |
//
|
|
740 |
void CWmMainContainer::SetFocusToPortalButton( TInt aIndex )
|
|
741 |
{
|
|
742 |
if ( aIndex != 0 && iPortalButtonTwo )
|
|
743 |
{
|
|
744 |
iWidgetsList->SetFocus(EFalse);
|
|
745 |
iPortalButtonOne->SetFocus(EFalse);
|
|
746 |
iPortalButtonTwo->SetFocus(ETrue);
|
|
747 |
}
|
|
748 |
else
|
|
749 |
{
|
|
750 |
iWidgetsList->SetFocus(EFalse);
|
|
751 |
if ( iPortalButtonTwo )
|
|
752 |
iPortalButtonTwo->SetFocus(EFalse);
|
|
753 |
iPortalButtonOne->SetFocus(ETrue);
|
|
754 |
}
|
|
755 |
DrawDeferred();
|
|
756 |
UpdateFocusMode();
|
|
757 |
}
|
|
758 |
|
|
759 |
// ---------------------------------------------------------
|
|
760 |
// CWmMainContainer::SetFocusToWidgetList
|
|
761 |
// ---------------------------------------------------------
|
|
762 |
//
|
|
763 |
void CWmMainContainer::SetFocusToWidgetList( TInt aIndex )
|
|
764 |
{
|
|
765 |
iPortalButtonOne->SetFocus(EFalse);
|
|
766 |
if ( iPortalButtonTwo )
|
|
767 |
iPortalButtonTwo->SetFocus(EFalse);
|
|
768 |
if ( aIndex >= 0 && aIndex < iWidgetsList->Model()->NumberOfItems() )
|
|
769 |
{
|
|
770 |
iWidgetsList->SetCurrentItemIndex( aIndex );
|
|
771 |
}
|
|
772 |
iWidgetsList->SetFocus(ETrue);
|
|
773 |
DrawDeferred();
|
|
774 |
UpdateFocusMode();
|
|
775 |
}
|
|
776 |
|
|
777 |
// ---------------------------------------------------------
|
|
778 |
// CWmMainContainer::UpdateFocusMode
|
|
779 |
// ---------------------------------------------------------
|
|
780 |
//
|
|
781 |
void CWmMainContainer::UpdateFocusMode()
|
|
782 |
{
|
|
783 |
if ( iPortalButtonOne->IsFocused() )
|
|
784 |
{
|
|
785 |
// PORTAL BUTTON is focused
|
|
786 |
iFocusMode = EPortal;
|
|
787 |
}
|
|
788 |
else if ( iPortalButtonTwo && iPortalButtonTwo->IsFocused() )
|
|
789 |
{
|
|
790 |
// SECOND PORTAL BUTTON is focused
|
|
791 |
iFocusMode = EPortal;
|
|
792 |
}
|
|
793 |
else if( ( iFindPaneIsVisible ) &&
|
|
794 |
( iFindbox->IsFocused() || iWidgetsList->IsFocused() ) )
|
|
795 |
{
|
|
796 |
// FIND MODE
|
|
797 |
iFocusMode = EFind;
|
|
798 |
}
|
|
799 |
else if ( iWidgetsList->IsFocused() )
|
|
800 |
{
|
|
801 |
// WIDGETS LIST is focused
|
|
802 |
iFocusMode = EList;
|
|
803 |
}
|
|
804 |
else
|
|
805 |
{
|
|
806 |
// NO focus
|
|
807 |
iFocusMode = ENowhere;
|
|
808 |
}
|
|
809 |
}
|
|
810 |
|
|
811 |
// ---------------------------------------------------------
|
|
812 |
// CWmMainContainer::FindChildControlByPoint
|
|
813 |
// ---------------------------------------------------------
|
|
814 |
//
|
|
815 |
CCoeControl* CWmMainContainer::FindChildControlByPoint(
|
|
816 |
const TPoint& aPoint )
|
|
817 |
{
|
|
818 |
CCoeControl* theControl = NULL;
|
|
819 |
CCoeControlArray::TCursor cursor = Components().Begin();
|
|
820 |
CCoeControl* c;
|
|
821 |
while((c=cursor.Control<CCoeControl>()) != NULL )
|
|
822 |
{
|
|
823 |
if(c->IsVisible())
|
|
824 |
{
|
|
825 |
if ( c->Rect().Contains( aPoint ) ) theControl = c;
|
|
826 |
}
|
|
827 |
cursor.Next();
|
|
828 |
}
|
|
829 |
return theControl;
|
|
830 |
}
|
|
831 |
|
|
832 |
// ---------------------------------------------------------
|
|
833 |
// CWmMainContainer::HandlePointerEventL
|
|
834 |
// ---------------------------------------------------------
|
|
835 |
//
|
|
836 |
void CWmMainContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent )
|
|
837 |
{
|
|
838 |
if ( !iClosingDown )
|
|
839 |
{
|
|
840 |
TBool eatEvent( EFalse );
|
|
841 |
TPointerEvent event( aPointerEvent );
|
|
842 |
|
|
843 |
if (aPointerEvent.iType == TPointerEvent::EButton1Down)
|
|
844 |
{
|
|
845 |
// Check if user clicked a child control
|
|
846 |
CCoeControl* control = FindChildControlByPoint( aPointerEvent.iPosition );
|
|
847 |
if ( control && !control->IsFocused() )
|
|
848 |
{
|
|
849 |
// remove focus from ALL other child controls.
|
|
850 |
CCoeControlArray::TCursor cursor = Components().Begin();
|
|
851 |
CCoeControl* c;
|
|
852 |
while ((c=cursor.Control<CCoeControl>()) != NULL )
|
|
853 |
{
|
|
854 |
if ( c != control && c->IsFocused() ) c->SetFocus( EFalse );
|
|
855 |
cursor.Next();
|
|
856 |
}
|
|
857 |
|
|
858 |
// Set focus to the control that was clicked
|
|
859 |
control->SetFocus( ETrue );
|
|
860 |
|
|
861 |
// update focus mode accordingly
|
|
862 |
UpdateFocusMode();
|
|
863 |
// repaint
|
|
864 |
DrawDeferred();
|
|
865 |
}
|
|
866 |
|
|
867 |
// stylus popup should not be opened when uninstalling.
|
|
868 |
// ou1cimx1#302973
|
|
869 |
if ( control == iWidgetsList && iWidgetsList->IsFocused() )
|
|
870 |
{
|
|
871 |
TInt itemIndex = iWidgetsList->CurrentListBoxItemIndex();
|
|
872 |
TBool itemPointed = iWidgetsList->View()->XYPosToItemIndex(
|
|
873 |
aPointerEvent.iPosition,
|
|
874 |
itemIndex );
|
|
875 |
if ( itemIndex >= 0 && itemPointed )
|
|
876 |
{
|
|
877 |
CWmWidgetData& data = iWidgetsList->WidgetData( itemIndex );
|
|
878 |
if ( &data && data.IsUninstalling() )
|
|
879 |
{
|
|
880 |
event.iType = TPointerEvent::EButton1Up;
|
|
881 |
eatEvent = ETrue;
|
|
882 |
}
|
|
883 |
}
|
|
884 |
}
|
|
885 |
|
|
886 |
}
|
|
887 |
|
|
888 |
// set downkey event to base class
|
|
889 |
CCoeControl::HandlePointerEventL( aPointerEvent );
|
|
890 |
|
|
891 |
// send key up event if selected widget is being uninstalled.
|
|
892 |
// stylus popup shouldn't be displayed for this item.
|
|
893 |
if ( eatEvent )
|
|
894 |
{
|
|
895 |
CCoeControl::HandlePointerEventL( event );
|
|
896 |
}
|
|
897 |
}
|
|
898 |
}
|
|
899 |
|
|
900 |
// ---------------------------------------------------------
|
|
901 |
// CWmMainContainer::InitializeControlsL
|
|
902 |
// ---------------------------------------------------------
|
|
903 |
//
|
|
904 |
void CWmMainContainer::InitializeControlsL( const TRect& /*aRect*/ )
|
|
905 |
{
|
|
906 |
// Create portal buttons
|
|
907 |
iPortalButtonOne = CWmPortalButton::NewL( this, 0 );
|
|
908 |
iPortalButtonOne->SetMopParent( this );
|
|
909 |
AddControlL( iPortalButtonOne, EPortalOne );
|
|
910 |
if ( iConfiguration->PortalButtonCount() > 1 )
|
|
911 |
{
|
|
912 |
iPortalButtonTwo = CWmPortalButton::NewL( this, 1 );
|
|
913 |
iPortalButtonTwo->SetMopParent( this );
|
|
914 |
AddControlL( iPortalButtonTwo, EPortalTwo );
|
|
915 |
}
|
|
916 |
|
|
917 |
// Create widget list box
|
|
918 |
iWidgetsList = CWmListBox::NewL(
|
|
919 |
iWmPlugin,
|
|
920 |
TRect(),
|
|
921 |
this );
|
|
922 |
iWidgetsList->SetMopParent( this );
|
|
923 |
AddControlL( iWidgetsList, EWidgetsList );
|
|
924 |
iWidgetsList->ActivateL();
|
|
925 |
iWidgetsList->SetListBoxObserver( this );
|
|
926 |
|
|
927 |
// Create scroll bar.
|
|
928 |
iWidgetsList->CreateScrollBarFrameL( ETrue );
|
|
929 |
iWidgetsList->ScrollBarFrame()->SetScrollBarVisibilityL(
|
|
930 |
CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
|
|
931 |
iWidgetsList->UpdateScrollBarsL();
|
|
932 |
|
|
933 |
// search field
|
|
934 |
iFindbox = CAknSearchField::NewL( *this,
|
|
935 |
CAknSearchField::EAdaptiveSearch,
|
|
936 |
0, KTextLimit );
|
|
937 |
AddControlL( iFindbox, EFindBox );
|
|
938 |
iFindbox->AddAdaptiveSearchTextObserverL(this);
|
|
939 |
|
|
940 |
UpdateFocusMode();
|
|
941 |
StartLoadingWidgetsL();
|
|
942 |
}
|
|
943 |
|
|
944 |
// ---------------------------------------------------------
|
|
945 |
// CWmMainContainer::HandleWidgetListChanged
|
|
946 |
// ---------------------------------------------------------
|
|
947 |
//
|
|
948 |
void CWmMainContainer::HandleWidgetListChanged()
|
|
949 |
{
|
|
950 |
TRAP_IGNORE( StartLoadingWidgetsL(); );
|
|
951 |
}
|
|
952 |
|
|
953 |
// ---------------------------------------------------------
|
|
954 |
// CWmMainContainer::StartLoadingWidgetsL
|
|
955 |
// ---------------------------------------------------------
|
|
956 |
//
|
|
957 |
void CWmMainContainer::StartLoadingWidgetsL()
|
|
958 |
{
|
|
959 |
if ( !iWidgetLoader )
|
|
960 |
{
|
|
961 |
// create the widget loader AO
|
|
962 |
iWidgetLoader = CWmWidgetLoaderAo::NewL( iWmPlugin, *iWidgetsList );
|
|
963 |
iWidgetLoader->SetObserver( this );
|
|
964 |
}
|
|
965 |
iWidgetLoader->StartLoading();
|
|
966 |
}
|
|
967 |
|
|
968 |
// ---------------------------------------------------------
|
|
969 |
// CWmMainContainer::HandleResourceChange
|
|
970 |
// ---------------------------------------------------------
|
|
971 |
//
|
|
972 |
void CWmMainContainer::HandleResourceChange( TInt aType )
|
|
973 |
{
|
|
974 |
CCoeControl::HandleResourceChange( aType );
|
|
975 |
|
|
976 |
if ( KEikDynamicLayoutVariantSwitch == aType )
|
|
977 |
{
|
|
978 |
TRect rect;
|
|
979 |
AknLayoutUtils::LayoutMetricsRect(
|
|
980 |
AknLayoutUtils::EMainPane, rect );
|
|
981 |
SetRect( rect );
|
|
982 |
|
|
983 |
// notify widgetlist
|
|
984 |
iWidgetsList->HandleLayoutChanged();
|
|
985 |
}
|
|
986 |
}
|
|
987 |
|
|
988 |
|
|
989 |
// ---------------------------------------------------------
|
|
990 |
// CWmMainContainer::MopSupplyObject
|
|
991 |
// ---------------------------------------------------------
|
|
992 |
//
|
|
993 |
TTypeUid::Ptr CWmMainContainer::MopSupplyObject( TTypeUid aId )
|
|
994 |
{
|
|
995 |
if ( aId.iUid == MAknsControlContext::ETypeId )
|
|
996 |
{
|
|
997 |
return MAknsControlContext::SupplyMopObject(
|
|
998 |
aId, iBgContext );
|
|
999 |
}
|
|
1000 |
return CCoeControl::MopSupplyObject( aId );
|
|
1001 |
}
|
|
1002 |
|
|
1003 |
// ---------------------------------------------------------
|
|
1004 |
// CWmMainContainer::Draw
|
|
1005 |
// ---------------------------------------------------------
|
|
1006 |
//
|
|
1007 |
void CWmMainContainer::Draw( const TRect& aRect ) const
|
|
1008 |
{
|
|
1009 |
CWindowGc& gc = SystemGc();
|
|
1010 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
|
|
1011 |
MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
|
|
1012 |
AknsDrawUtils::Background( skin, cc, this, gc, aRect );
|
|
1013 |
}
|
|
1014 |
|
|
1015 |
// ---------------------------------------------------------
|
|
1016 |
// CWmMainContainer::AddControlL
|
|
1017 |
// ---------------------------------------------------------
|
|
1018 |
//
|
|
1019 |
void CWmMainContainer::AddControlL(
|
|
1020 |
CCoeControl* aControl,
|
|
1021 |
TInt aControlId )
|
|
1022 |
{
|
|
1023 |
Components().AppendLC( aControl, aControlId ); // Ownership transfered
|
|
1024 |
CleanupStack::Pop(aControl);
|
|
1025 |
CAknView* view = iWmPlugin.ViewAppUi().View(
|
|
1026 |
TUid::Uid(EWmMainContainerViewId) );
|
|
1027 |
if ( view )
|
|
1028 |
{
|
|
1029 |
iWmPlugin.ViewAppUi().AddToStackL( *view, aControl );
|
|
1030 |
}
|
|
1031 |
else
|
|
1032 |
{
|
|
1033 |
iWmPlugin.ViewAppUi().AddToStackL( aControl );
|
|
1034 |
}
|
|
1035 |
aControl->MakeVisible( ETrue );
|
|
1036 |
}
|
|
1037 |
|
|
1038 |
// ---------------------------------------------------------
|
|
1039 |
// CWmMainContainer::IsLoadingWidgets
|
|
1040 |
// ---------------------------------------------------------
|
|
1041 |
//
|
|
1042 |
TBool CWmMainContainer::IsLoadingWidgets()
|
|
1043 |
{
|
|
1044 |
return ((iWidgetLoader && iWidgetLoader->IsLoading()) ?
|
|
1045 |
ETrue : EFalse);
|
|
1046 |
}
|
|
1047 |
|
|
1048 |
// ---------------------------------------------------------
|
|
1049 |
// CWmMainContainer::PortalSelected
|
|
1050 |
// ---------------------------------------------------------
|
|
1051 |
//
|
|
1052 |
TBool CWmMainContainer::PortalSelected()
|
|
1053 |
{
|
|
1054 |
return ( iFocusMode == EPortal );
|
|
1055 |
}
|
|
1056 |
|
|
1057 |
// ---------------------------------------------------------
|
|
1058 |
// CWmMainContainer::WidgetSelected
|
|
1059 |
// ---------------------------------------------------------
|
|
1060 |
//
|
|
1061 |
TBool CWmMainContainer::WidgetSelected()
|
|
1062 |
{
|
|
1063 |
return ( iFocusMode == EList ) || ( iFocusMode == EFind );
|
|
1064 |
}
|
|
1065 |
|
|
1066 |
// ---------------------------------------------------------
|
|
1067 |
// CWmMainContainer::CanDoAdd
|
|
1068 |
// ---------------------------------------------------------
|
|
1069 |
//
|
|
1070 |
TBool CWmMainContainer::CanDoAdd()
|
|
1071 |
{
|
|
1072 |
TBool retVal = EFalse;
|
|
1073 |
CWmWidgetData* data = iWidgetsList->WidgetData();
|
|
1074 |
if ( WidgetSelected() && data && !data->IsUninstalling() )
|
|
1075 |
{
|
|
1076 |
if ( data->HsContentInfo().CanBeAdded() )
|
|
1077 |
retVal = ETrue;
|
|
1078 |
}
|
|
1079 |
return retVal;
|
|
1080 |
}
|
|
1081 |
|
|
1082 |
// ---------------------------------------------------------
|
|
1083 |
// CWmMainContainer::CanDoUninstall
|
|
1084 |
// ---------------------------------------------------------
|
|
1085 |
//
|
|
1086 |
TBool CWmMainContainer::CanDoUninstall()
|
|
1087 |
{
|
|
1088 |
TBool retVal( EFalse );
|
|
1089 |
CWmWidgetData* data = iWidgetsList->WidgetData();
|
|
1090 |
if ( WidgetSelected() && data && !data->IsUninstalling() )
|
|
1091 |
{
|
|
1092 |
if ( data->WidgetType() == CWmWidgetData::ECps &&
|
|
1093 |
data->PublisherUid() != KNullUid &&
|
|
1094 |
data->WrtType() != CWmWidgetData::EUnIdentified )
|
|
1095 |
{
|
|
1096 |
retVal = ETrue;
|
|
1097 |
}
|
|
1098 |
}
|
|
1099 |
return retVal;
|
|
1100 |
}
|
|
1101 |
|
|
1102 |
// ---------------------------------------------------------
|
|
1103 |
// CWmMainContainer::CanDoLaunch
|
|
1104 |
// ---------------------------------------------------------
|
|
1105 |
//
|
|
1106 |
TBool CWmMainContainer::CanDoLaunch()
|
|
1107 |
{
|
|
1108 |
TBool retVal(EFalse);
|
|
1109 |
|
|
1110 |
if ( WidgetSelected() )
|
|
1111 |
{
|
|
1112 |
CWmWidgetData* data = iWidgetsList->WidgetData();
|
|
1113 |
if ( data && !data->IsUninstalling() )
|
|
1114 |
{
|
|
1115 |
if ( data->WidgetType() == CWmWidgetData::ECps &&
|
|
1116 |
data->PublisherUid() != KNullUid )
|
|
1117 |
{
|
|
1118 |
retVal = ETrue;
|
|
1119 |
}
|
|
1120 |
}
|
|
1121 |
}
|
|
1122 |
return retVal;
|
|
1123 |
}
|
|
1124 |
|
|
1125 |
// ---------------------------------------------------------
|
|
1126 |
// CWmMainContainer::CanDoFind
|
|
1127 |
// ---------------------------------------------------------
|
|
1128 |
//
|
|
1129 |
TBool CWmMainContainer::CanDoFind()
|
|
1130 |
{
|
|
1131 |
return !iFindPaneIsVisible;
|
|
1132 |
}
|
|
1133 |
|
|
1134 |
// ---------------------------------------------------------
|
|
1135 |
// CWmMainContainer::CanDoSort
|
|
1136 |
// ---------------------------------------------------------
|
|
1137 |
//
|
|
1138 |
TBool CWmMainContainer::CanDoSort()
|
|
1139 |
{
|
|
1140 |
return !iFindPaneIsVisible;
|
|
1141 |
}
|
|
1142 |
|
|
1143 |
// ---------------------------------------------------------
|
|
1144 |
// CWmMainContainer::CanDoDetails
|
|
1145 |
// ---------------------------------------------------------
|
|
1146 |
//
|
|
1147 |
TBool CWmMainContainer::CanDoDetails()
|
|
1148 |
{
|
|
1149 |
return ( WidgetSelected() && iWidgetsList->WidgetData()
|
|
1150 |
&& !iWidgetsList->WidgetData()->IsUninstalling() );
|
|
1151 |
}
|
|
1152 |
|
|
1153 |
// ---------------------------------------------------------
|
|
1154 |
// CWmMainContainer::CanDoHelp
|
|
1155 |
// ---------------------------------------------------------
|
|
1156 |
//
|
|
1157 |
TBool CWmMainContainer::CanDoHelp()
|
|
1158 |
{
|
|
1159 |
return FeatureManager::FeatureSupported( KFeatureIdHelp );
|
|
1160 |
}
|
|
1161 |
|
|
1162 |
// ---------------------------------------------------------------------------
|
|
1163 |
// CWmMainContainer::AddWidgetToHomeScreenL
|
|
1164 |
// ---------------------------------------------------------------------------
|
|
1165 |
//
|
|
1166 |
void CWmMainContainer::AddWidgetToHomeScreenL()
|
|
1167 |
{
|
|
1168 |
CWmWidgetData* data = iWidgetsList->WidgetData();
|
|
1169 |
if ( !iClosingDown )
|
|
1170 |
{
|
|
1171 |
if ( iFindbox && iFindPaneIsVisible )
|
|
1172 |
{
|
|
1173 |
DeactivateFindPaneL(EFalse);
|
|
1174 |
}
|
|
1175 |
|
|
1176 |
if ( data && !data->IsUninstalling() )
|
|
1177 |
{
|
|
1178 |
// set add to homescreen to be executed later
|
|
1179 |
iWmPlugin.SetPostponedCommandL(
|
|
1180 |
CWmPlugin::EAddToHomescreen,
|
|
1181 |
data->HsContentInfo() );
|
|
1182 |
|
|
1183 |
iWmPlugin.CloseView();
|
|
1184 |
}
|
|
1185 |
}
|
|
1186 |
}
|
|
1187 |
|
|
1188 |
// ---------------------------------------------------------------------------
|
|
1189 |
// CWmMainContainer::LaunchWidgetL
|
|
1190 |
// ---------------------------------------------------------------------------
|
|
1191 |
//
|
|
1192 |
void CWmMainContainer::LaunchWidgetL()
|
|
1193 |
{
|
|
1194 |
if ( CanDoLaunch() )
|
|
1195 |
{
|
|
1196 |
CWmWidgetData* data = iWidgetsList->WidgetData();
|
|
1197 |
|
|
1198 |
HBufC* param = KNullDesC().AllocLC(); // launch params
|
|
1199 |
|
|
1200 |
RApaLsSession appArc;
|
|
1201 |
User::LeaveIfError( appArc.Connect() ); // connect to AppArc server
|
|
1202 |
CleanupClosePushL( appArc );
|
|
1203 |
TThreadId id;
|
|
1204 |
User::LeaveIfError( appArc.StartDocument(
|
|
1205 |
*param, data->PublisherUid(), id ) );
|
|
1206 |
|
|
1207 |
CleanupStack::PopAndDestroy( &appArc );
|
|
1208 |
CleanupStack::PopAndDestroy( param );
|
|
1209 |
}
|
|
1210 |
}
|
|
1211 |
|
|
1212 |
// ---------------------------------------------------------------------------
|
|
1213 |
// CWmMainContainer::ActivateFindPaneL
|
|
1214 |
// ---------------------------------------------------------------------------
|
|
1215 |
//
|
|
1216 |
void CWmMainContainer::ActivateFindPaneL( TBool aActivateAdaptive )
|
|
1217 |
{
|
|
1218 |
if ( iFindbox && !iFindPaneIsVisible &&
|
|
1219 |
iWidgetsList->Model()->NumberOfItems() > KMinWidgets )
|
|
1220 |
{
|
|
1221 |
// set focus
|
|
1222 |
if ( iWidgetsList->ItemDrawer()->Flags()
|
|
1223 |
& CListItemDrawer::ESingleClickDisabledHighlight )
|
|
1224 |
{
|
|
1225 |
ResetFocus();
|
|
1226 |
}
|
|
1227 |
else
|
|
1228 |
{
|
|
1229 |
iWidgetsList->SetFocus( ETrue, EDrawNow );
|
|
1230 |
}
|
|
1231 |
|
|
1232 |
|
|
1233 |
// set column filter flag
|
|
1234 |
TBitFlags32 bitFlag;
|
|
1235 |
bitFlag.ClearAll(); // clear all columns
|
|
1236 |
bitFlag.Assign( 1,1 ); // turn on column at index one
|
|
1237 |
iFindbox->SetListColumnFilterFlags( bitFlag );
|
|
1238 |
|
|
1239 |
// enable filtering
|
|
1240 |
CAknFilteredTextListBoxModel* m =
|
|
1241 |
static_cast <CAknFilteredTextListBoxModel*> ( iWidgetsList->Model() );
|
|
1242 |
if ( m )
|
|
1243 |
{
|
|
1244 |
m->CreateFilterL( iWidgetsList, iFindbox );
|
|
1245 |
if ( m->Filter() )
|
|
1246 |
{
|
|
1247 |
m->Filter()->SetParentControl( this );
|
|
1248 |
}
|
|
1249 |
}
|
|
1250 |
|
|
1251 |
iFindbox->ActivateL();
|
|
1252 |
iFindbox->ResetL();
|
|
1253 |
iFindbox->SetSearchTextL( KNullDesC );
|
|
1254 |
iFindbox->SetSkinEnabledL( ETrue );
|
|
1255 |
iFindPaneIsVisible = ETrue;
|
|
1256 |
iFindbox->MakeVisible( ETrue );
|
|
1257 |
|
|
1258 |
// layout listbox and findbox
|
|
1259 |
LayoutControls();
|
|
1260 |
|
|
1261 |
if ( aActivateAdaptive )
|
|
1262 |
{
|
|
1263 |
iFindbox->ShowAdaptiveSearchGrid();
|
|
1264 |
}
|
|
1265 |
iFindbox->SetFocus( ETrue );
|
|
1266 |
iWidgetsList->SetFindPaneIsVisible( ETrue );
|
|
1267 |
|
|
1268 |
// set soft key set
|
|
1269 |
CEikButtonGroupContainer* cbaGroup =
|
|
1270 |
CEikButtonGroupContainer::Current();
|
|
1271 |
cbaGroup->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_CANCEL__SELECT );
|
|
1272 |
cbaGroup->DrawNow();
|
|
1273 |
|
|
1274 |
UpdateFocusMode();
|
|
1275 |
}
|
|
1276 |
}
|
|
1277 |
|
|
1278 |
// ---------------------------------------------------------------------------
|
|
1279 |
// CWmMainContainer::DeactivateFindPaneL
|
|
1280 |
// ---------------------------------------------------------------------------
|
|
1281 |
//
|
|
1282 |
void CWmMainContainer::DeactivateFindPaneL(TBool aLayout)
|
|
1283 |
{
|
|
1284 |
if( iFindbox && iFindPaneIsVisible )
|
|
1285 |
{
|
|
1286 |
// notify search field we're shutting down
|
|
1287 |
TKeyEvent keyEvent = { EKeyNo, EStdKeyNo, 0, 0 };
|
|
1288 |
iFindbox->OfferKeyEventL( keyEvent, EEventKey );
|
|
1289 |
|
|
1290 |
// reset findbox
|
|
1291 |
iFindbox->ResetL();
|
|
1292 |
|
|
1293 |
// reset filter
|
|
1294 |
CAknFilteredTextListBoxModel* m =
|
|
1295 |
static_cast <CAknFilteredTextListBoxModel*> ( iWidgetsList->Model() );
|
|
1296 |
if ( m && m->Filter() )
|
|
1297 |
{
|
|
1298 |
m->Filter()->ResetFilteringL();
|
|
1299 |
m->RemoveFilter();
|
|
1300 |
}
|
|
1301 |
|
|
1302 |
//set focus
|
|
1303 |
if ( iWidgetsList->ItemDrawer()->Flags()
|
|
1304 |
& CListItemDrawer::ESingleClickDisabledHighlight )
|
|
1305 |
{
|
|
1306 |
ResetFocus();
|
|
1307 |
}
|
|
1308 |
else
|
|
1309 |
{
|
|
1310 |
iWidgetsList->SetFocus( ETrue, EDrawNow );
|
|
1311 |
}
|
|
1312 |
|
|
1313 |
iFindbox->MakeVisible( EFalse );
|
|
1314 |
iFindPaneIsVisible = EFalse;
|
|
1315 |
iWidgetsList->SetFindPaneIsVisible( EFalse );
|
|
1316 |
|
|
1317 |
|
|
1318 |
// set soft key set
|
|
1319 |
CEikButtonGroupContainer* cbaGroup =
|
|
1320 |
CEikButtonGroupContainer::Current();
|
|
1321 |
TInt cbaResourceId = ( AknLayoutUtils::MSKEnabled() ?
|
|
1322 |
R_AVKON_SOFTKEYS_OPTIONS_BACK__SELECT :
|
|
1323 |
R_AVKON_SOFTKEYS_OPTIONS_BACK );
|
|
1324 |
cbaGroup->SetCommandSetL( cbaResourceId );
|
|
1325 |
|
|
1326 |
if (aLayout) //no need to draw UI if exiting list
|
|
1327 |
{
|
|
1328 |
LayoutControls();
|
|
1329 |
cbaGroup->DrawNow();
|
|
1330 |
|
|
1331 |
UpdateFocusMode();
|
|
1332 |
DrawNow();
|
|
1333 |
}
|
|
1334 |
}
|
|
1335 |
}
|
|
1336 |
|
|
1337 |
// ---------------------------------------------------------------------------
|
|
1338 |
// CWmMainContainer::SortListAlphabeticallyL
|
|
1339 |
// ---------------------------------------------------------------------------
|
|
1340 |
//
|
|
1341 |
void CWmMainContainer::SortListAlphabeticallyL()
|
|
1342 |
{
|
|
1343 |
if ( iWidgetsList )
|
|
1344 |
{
|
|
1345 |
iWidgetsList->DoSortToVisibleArray( CWmListBox::EAlphabetical );
|
|
1346 |
iWidgetsList->DoSortToOrderData( CWmListBox::EAlphabetical );
|
|
1347 |
|
|
1348 |
//store changed list order
|
|
1349 |
CWmPersistentWidgetOrder* widgetOrder =
|
|
1350 |
CWmPersistentWidgetOrder::NewL( iWmPlugin.FileServer() );
|
|
1351 |
CleanupStack::PushL( widgetOrder );
|
|
1352 |
widgetOrder->StoreL( iWidgetsList->OrderDataArray() );
|
|
1353 |
|
|
1354 |
CleanupStack::PopAndDestroy( widgetOrder );
|
|
1355 |
}
|
|
1356 |
}
|
|
1357 |
|
|
1358 |
// ---------------------------------------------------------------------------
|
|
1359 |
// CWmMainContainer::UninstallWidgetL
|
|
1360 |
// ---------------------------------------------------------------------------
|
|
1361 |
//
|
|
1362 |
void CWmMainContainer::UninstallWidgetL()
|
|
1363 |
{
|
|
1364 |
if ( CanDoUninstall() )
|
|
1365 |
{
|
|
1366 |
CWmWidgetData* data = iWidgetsList->WidgetData();
|
|
1367 |
if ( data )
|
|
1368 |
{
|
|
1369 |
if ( iWmPlugin.ResourceLoader().QueryPopupL(
|
|
1370 |
R_QTN_WM_UNINSTALL_WIDGET_QUERY, data->Name() ) )
|
|
1371 |
{
|
|
1372 |
|
|
1373 |
TRAPD( err, iWmPlugin.WmInstaller().UninstallL( data ) );
|
|
1374 |
if ( err != KErrNone )
|
|
1375 |
{
|
|
1376 |
iWmPlugin.ResourceLoader().InfoPopupL(
|
|
1377 |
R_QTN_WM_UNINST_PROCESS_BUSY, KNullDesC );
|
|
1378 |
}
|
|
1379 |
}
|
|
1380 |
}
|
|
1381 |
}
|
|
1382 |
}
|
|
1383 |
|
|
1384 |
// ---------------------------------------------------------------------------
|
|
1385 |
// CWmMainContainer::OpenPortalL
|
|
1386 |
// ---------------------------------------------------------------------------
|
|
1387 |
//
|
|
1388 |
void CWmMainContainer::OpenPortalL()
|
|
1389 |
{
|
|
1390 |
if ( !iClosingDown )
|
|
1391 |
{
|
|
1392 |
// execute whichever of the portal buttons happens to be active
|
|
1393 |
if ( iPortalButtonOne->IsFocused() )
|
|
1394 |
iPortalButtonOne->ExecuteL();
|
|
1395 |
else if ( iPortalButtonTwo && iPortalButtonTwo->IsFocused() )
|
|
1396 |
iPortalButtonTwo->ExecuteL();
|
|
1397 |
else if ( !iPortalButtonTwo )
|
|
1398 |
iPortalButtonOne->ExecuteL();
|
|
1399 |
}
|
|
1400 |
}
|
|
1401 |
|
|
1402 |
// ---------------------------------------------------------------------------
|
|
1403 |
// CWmMainContainer::SelectL
|
|
1404 |
// ---------------------------------------------------------------------------
|
|
1405 |
//
|
|
1406 |
void CWmMainContainer::SelectL()
|
|
1407 |
{
|
|
1408 |
if ( WidgetSelected() )
|
|
1409 |
AddWidgetToHomeScreenL();
|
|
1410 |
else if ( PortalSelected() )
|
|
1411 |
OpenPortalL();
|
|
1412 |
else
|
|
1413 |
SetFocusToWidgetList();
|
|
1414 |
}
|
|
1415 |
|
|
1416 |
// ---------------------------------------------------------------------------
|
|
1417 |
// CWmMainContainer::ShowHelpL
|
|
1418 |
// ---------------------------------------------------------------------------
|
|
1419 |
//
|
|
1420 |
void CWmMainContainer::ShowHelpL()
|
|
1421 |
{
|
|
1422 |
TUid fwUid = TUid::Uid( AI_UID3_AIFW_COMMON );
|
|
1423 |
// retrieve resolve host application help context
|
|
1424 |
CArrayFix<TCoeHelpContext>* helpContext =
|
|
1425 |
iEikonEnv->EikAppUi()->AppHelpContextL();
|
|
1426 |
|
|
1427 |
// add the widget manager entry into the help context
|
|
1428 |
CleanupStack::PushL( helpContext );
|
|
1429 |
helpContext->InsertL( 0, TCoeHelpContext(
|
|
1430 |
fwUid, KWM_HLP_WIDGET_COLLECTION ) );
|
|
1431 |
CleanupStack::Pop( helpContext );
|
|
1432 |
|
|
1433 |
// launch help
|
|
1434 |
HlpLauncher::LaunchHelpApplicationL(
|
|
1435 |
iEikonEnv->WsSession(),
|
|
1436 |
helpContext );
|
|
1437 |
helpContext = 0; // HlpLauncher takes ownership of helpContext
|
|
1438 |
}
|
|
1439 |
|
|
1440 |
// ---------------------------------------------------------------------------
|
|
1441 |
// CWmMainContainer::RemoveCtrlsFromStack
|
|
1442 |
// ---------------------------------------------------------------------------
|
|
1443 |
//
|
|
1444 |
void CWmMainContainer::RemoveCtrlsFromStack()
|
|
1445 |
{
|
|
1446 |
for ( TInt i=0; i < CountComponentControls(); i++ )
|
|
1447 |
{
|
|
1448 |
CCoeControl* ctl = ComponentControl( i ) ;
|
|
1449 |
if ( ctl )
|
|
1450 |
{
|
|
1451 |
iWmPlugin.ViewAppUi().RemoveFromStack( ctl );
|
|
1452 |
}
|
|
1453 |
}
|
|
1454 |
}
|
|
1455 |
|
|
1456 |
// ---------------------------------------------------------------------------
|
|
1457 |
// CWmMainContainer::HandleListBoxEventL
|
|
1458 |
// ---------------------------------------------------------------------------
|
|
1459 |
//
|
|
1460 |
void CWmMainContainer::HandleListBoxEventL(
|
|
1461 |
CEikListBox* /*aListBox*/, TListBoxEvent aEventType )
|
|
1462 |
{
|
|
1463 |
if ( ( aEventType == EEventEnterKeyPressed ||
|
|
1464 |
aEventType == EEventItemSingleClicked )
|
|
1465 |
&& !iClosingDown )
|
|
1466 |
{
|
|
1467 |
AddWidgetToHomeScreenL();
|
|
1468 |
}
|
|
1469 |
}
|
|
1470 |
|
|
1471 |
// ----------------------------------------------------
|
|
1472 |
// CWmMainContainer::LaunchDetailsDialogL
|
|
1473 |
// ----------------------------------------------------
|
|
1474 |
//
|
|
1475 |
void CWmMainContainer::LaunchDetailsDialogL()
|
|
1476 |
{
|
|
1477 |
CWmWidgetData* data = iWidgetsList->WidgetData();
|
|
1478 |
if ( data )
|
|
1479 |
{
|
|
1480 |
// Find out if HS is full
|
|
1481 |
TBool hsFull = ETrue;
|
|
1482 |
MHsContentController& controller = iWmPlugin.ContentController();
|
|
1483 |
CHsContentInfo* activeView = CHsContentInfo::NewLC();
|
|
1484 |
if ( controller.ActiveViewL( *activeView ) == KErrNone )
|
|
1485 |
{
|
|
1486 |
hsFull = activeView->IsFull();
|
|
1487 |
}
|
|
1488 |
CleanupStack::PopAndDestroy( activeView );
|
|
1489 |
|
|
1490 |
CWmDetailsDlg* dlg = CWmDetailsDlg::NewL(
|
|
1491 |
data->Name(),
|
|
1492 |
data->Description(),
|
|
1493 |
!hsFull,
|
|
1494 |
data->HsContentInfo().IconPath(),
|
|
1495 |
*iWidgetsList->DefaultLogo(),
|
|
1496 |
*iWidgetsList->DefaultMask()
|
|
1497 |
);
|
|
1498 |
|
|
1499 |
if ( dlg && dlg->ExecuteLD() == ECbaAddToHs )
|
|
1500 |
{
|
|
1501 |
AddWidgetToHomeScreenL();
|
|
1502 |
}
|
|
1503 |
else
|
|
1504 |
{
|
|
1505 |
if ( iWidgetsList->ItemDrawer()->Flags()
|
|
1506 |
& CListItemDrawer::ESingleClickDisabledHighlight )
|
|
1507 |
{
|
|
1508 |
ResetFocus();
|
|
1509 |
}
|
|
1510 |
else
|
|
1511 |
{
|
|
1512 |
iWidgetsList->SetFocus( ETrue, EDrawNow );
|
|
1513 |
UpdateFocusMode();
|
|
1514 |
}
|
|
1515 |
}
|
|
1516 |
}
|
|
1517 |
}
|
|
1518 |
|
|
1519 |
// ----------------------------------------------------
|
|
1520 |
// CWmMainContainer::SetClosingDown
|
|
1521 |
// ----------------------------------------------------
|
|
1522 |
//
|
|
1523 |
void CWmMainContainer::SetClosingDown( TBool aClosingDown )
|
|
1524 |
{
|
|
1525 |
iClosingDown = aClosingDown;
|
|
1526 |
}
|
|
1527 |
|
|
1528 |
// ----------------------------------------------------
|
|
1529 |
// CWmMainContainer::ClosingDown
|
|
1530 |
// ----------------------------------------------------
|
|
1531 |
//
|
|
1532 |
TBool CWmMainContainer::ClosingDown()
|
|
1533 |
{
|
|
1534 |
return iClosingDown;
|
|
1535 |
}
|
|
1536 |
|
|
1537 |
// ----------------------------------------------------
|
|
1538 |
// CWmMainContainer::Configuration
|
|
1539 |
// ----------------------------------------------------
|
|
1540 |
//
|
|
1541 |
CWmConfiguration& CWmMainContainer::Configuration()
|
|
1542 |
{
|
|
1543 |
return *iConfiguration;
|
|
1544 |
}
|
|
1545 |
|
|
1546 |
// ----------------------------------------------------
|
|
1547 |
// CWmMainContainer::HandleFindSizeChanged
|
|
1548 |
// ----------------------------------------------------
|
|
1549 |
//
|
|
1550 |
void CWmMainContainer::HandleFindSizeChanged()
|
|
1551 |
{
|
|
1552 |
TAknWindowLineLayout findPane =
|
|
1553 |
AknLayoutScalable_Avkon::find_pane().LayoutLine();
|
|
1554 |
|
|
1555 |
TAknWindowLineLayout listPane;
|
|
1556 |
|
|
1557 |
TRect listRect = iWidgetsList->Rect();
|
|
1558 |
listPane.il = listRect.iTl.iX;
|
|
1559 |
listPane.it = listRect.iTl.iY;
|
|
1560 |
listPane.ib = 0;
|
|
1561 |
listPane.iH = TUint16( listRect.Height() - ( findPane.iH - 1 ) );
|
|
1562 |
listPane.iW = listRect.Width();
|
|
1563 |
listPane.ir = ELayoutEmpty;
|
|
1564 |
|
|
1565 |
// set findpane width equal to listwidth
|
|
1566 |
findPane.iW = listPane.iW;
|
|
1567 |
|
|
1568 |
TRect rect = Rect();
|
|
1569 |
AknLayoutUtils::LayoutControl( iFindbox, rect, findPane );
|
|
1570 |
AknLayoutUtils::LayoutControl( iWidgetsList, rect, listPane );
|
|
1571 |
|
|
1572 |
iWidgetsList->DrawNow();
|
|
1573 |
}
|
|
1574 |
|
|
1575 |
// ----------------------------------------------------
|
|
1576 |
// CWmMainContainer::ProcessForegroundEvent
|
|
1577 |
// ----------------------------------------------------
|
|
1578 |
//
|
|
1579 |
void CWmMainContainer::ProcessForegroundEvent( TBool aForeground )
|
|
1580 |
{
|
|
1581 |
if ( iFindbox && iFindPaneIsVisible &&
|
|
1582 |
iFindbox->IsFocused() )
|
|
1583 |
{
|
|
1584 |
// keep focus & do nothing
|
|
1585 |
}
|
|
1586 |
else if ( aForeground )
|
|
1587 |
{
|
|
1588 |
// set init state when wm comes to foreground.
|
|
1589 |
// remove focus from all controls when activating view.
|
|
1590 |
ResetFocus( EDrawNow );
|
|
1591 |
}
|
|
1592 |
}
|
|
1593 |
|
|
1594 |
// ----------------------------------------------------
|
|
1595 |
// CWmMainContainer::ResetFocus
|
|
1596 |
// ----------------------------------------------------
|
|
1597 |
//
|
|
1598 |
void CWmMainContainer::ResetFocus( TDrawNow aDrawNow )
|
|
1599 |
{
|
|
1600 |
CCoeControl* control = NULL;
|
|
1601 |
CCoeControlArray::TCursor cursor = Components().Begin();
|
|
1602 |
while( ( control = cursor.Control<CCoeControl>() ) != NULL )
|
|
1603 |
{
|
|
1604 |
if( control->IsVisible() && control->IsFocused() )
|
|
1605 |
{
|
|
1606 |
control->SetFocus( EFalse, aDrawNow );
|
|
1607 |
}
|
|
1608 |
cursor.Next();
|
|
1609 |
}
|
|
1610 |
UpdateFocusMode();
|
|
1611 |
}
|
|
1612 |
|
|
1613 |
// ----------------------------------------------------
|
|
1614 |
// CWmMainContainer::WmListBox
|
|
1615 |
// ----------------------------------------------------
|
|
1616 |
//
|
|
1617 |
CWmListBox& CWmMainContainer::WmListBox()
|
|
1618 |
{
|
|
1619 |
return *iWidgetsList;
|
|
1620 |
}
|
|
1621 |
|
|
1622 |
// ----------------------------------------------------
|
|
1623 |
// CWmMainContainer::FocusChanged
|
|
1624 |
// ----------------------------------------------------
|
|
1625 |
//
|
|
1626 |
void CWmMainContainer::FocusChanged( TDrawNow aDrawNow )
|
|
1627 |
{
|
|
1628 |
CCoeControl::FocusChanged( aDrawNow );
|
|
1629 |
|
|
1630 |
if ( iFindbox && iFindPaneIsVisible &&
|
|
1631 |
!iFindbox->IsFocused() && IsFocused() )
|
|
1632 |
{
|
|
1633 |
// reset focus to find pane if its lost ( ou1cimx1#308019 )
|
|
1634 |
ResetFocus();
|
|
1635 |
iFindbox->SetFocus( ETrue );
|
|
1636 |
UpdateFocusMode();
|
|
1637 |
}
|
|
1638 |
}
|
|
1639 |
|
|
1640 |
// ----------------------------------------------------
|
|
1641 |
// CWmMainContainer::AdaptiveSearchTextChanged
|
|
1642 |
// ----------------------------------------------------
|
|
1643 |
//
|
|
1644 |
void CWmMainContainer::AdaptiveSearchTextChanged( CAknSearchField* /*aSearchField*/ )
|
|
1645 |
{
|
|
1646 |
// fix for ou1cimx1#376818. aknfind will call drawDeferred for lisbox.
|
|
1647 |
// We need to be sure that button area is also drawn.
|
|
1648 |
DrawDeferred();
|
|
1649 |
}
|
|
1650 |
|
|
1651 |
|
|
1652 |
// ----------------------------------------------------
|
|
1653 |
// CWmMainContainer::LoadDone
|
|
1654 |
// ----------------------------------------------------
|
|
1655 |
//
|
|
1656 |
void CWmMainContainer::LoadDoneL( TBool aWidgetListChanged )
|
|
1657 |
{
|
|
1658 |
if ( aWidgetListChanged && iFindbox && iFindPaneIsVisible )
|
|
1659 |
{
|
|
1660 |
CAknFilteredTextListBoxModel* m =
|
|
1661 |
static_cast <CAknFilteredTextListBoxModel*> ( iWidgetsList->Model() );
|
|
1662 |
if ( m && m->Filter() )
|
|
1663 |
{
|
|
1664 |
m->Filter()->HandleItemArrayChangeL();
|
|
1665 |
}
|
|
1666 |
}
|
|
1667 |
}
|
|
1668 |
|
|
1669 |
// End of File
|
|
1670 |
|