26
|
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:
|
|
15 |
* Provides ScreenSaverAnimPlugin edit list view container methods.
|
|
16 |
*
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
// INCLUDE FILES
|
|
23 |
|
|
24 |
#include <aknlists.h>
|
|
25 |
#include <akntitle.h>
|
|
26 |
#include <aknslider.h>
|
|
27 |
#include <aknsettingpage.h>
|
|
28 |
#include <aknslidersettingpage.h>
|
|
29 |
#include <CFLDFileListContainer.h>
|
|
30 |
#include <MGFetch.h>
|
|
31 |
#include <DRMHelper.h>
|
|
32 |
#include <screensaveranimplugin.rsg>
|
|
33 |
#include <barsread.h>
|
|
34 |
#include <centralrepository.h>
|
|
35 |
|
|
36 |
#include "ScreenSaverAnimPlugin.h"
|
|
37 |
#include "ScreenSaverAnimPluginConst.h"
|
|
38 |
#include "ScreenSaverAnimPluginHelper.h"
|
|
39 |
#include "ScreenSaverAnimPluginContainer.h"
|
|
40 |
#include "ScreenSaverAnimPlugin.hrh"
|
|
41 |
|
|
42 |
// ========================= MEMBER FUNCTIONS ================================
|
|
43 |
CScreenSaverAnimPluginContainer* CScreenSaverAnimPluginContainer::NewLC(
|
|
44 |
CScreenSaverAnimPlugin* aCaller,
|
|
45 |
const CCoeControl* aParent,
|
|
46 |
CScreenSaverAnimSettingObject* aSettingObject )
|
|
47 |
{
|
|
48 |
CScreenSaverAnimPluginContainer* self =
|
|
49 |
new ( ELeave ) CScreenSaverAnimPluginContainer( aCaller,
|
|
50 |
aSettingObject );
|
|
51 |
CleanupStack::PushL( self );
|
|
52 |
TRect rect;
|
|
53 |
self->GetNormalScreenLayoutRect( rect );
|
|
54 |
self->ConstructL(aParent, rect );
|
|
55 |
return self;
|
|
56 |
|
|
57 |
}
|
|
58 |
|
|
59 |
// ---------------------------------------------------------------------------
|
|
60 |
// CScreenSaverAnimPluginContainer::NewL
|
|
61 |
// ---------------------------------------------------------------------------
|
|
62 |
//
|
|
63 |
|
|
64 |
CScreenSaverAnimPluginContainer* CScreenSaverAnimPluginContainer::NewL(
|
|
65 |
CScreenSaverAnimPlugin* aCaller,
|
|
66 |
const CCoeControl* aParent,
|
|
67 |
CScreenSaverAnimSettingObject* aSettingObject )
|
|
68 |
{
|
|
69 |
CScreenSaverAnimPluginContainer* self =
|
|
70 |
CScreenSaverAnimPluginContainer::NewLC( aCaller,
|
|
71 |
aParent,
|
|
72 |
aSettingObject );
|
|
73 |
CleanupStack::Pop( self );
|
|
74 |
return self;
|
|
75 |
|
|
76 |
}
|
|
77 |
|
|
78 |
// ---------------------------------------------------------------------------
|
|
79 |
// Constructor
|
|
80 |
//
|
|
81 |
// ---------------------------------------------------------------------------
|
|
82 |
//
|
|
83 |
CScreenSaverAnimPluginContainer::CScreenSaverAnimPluginContainer(
|
|
84 |
CScreenSaverAnimPlugin* aCaller,
|
|
85 |
CScreenSaverAnimSettingObject* aSettingObject )
|
|
86 |
:
|
|
87 |
iSettingObject( aSettingObject ),
|
|
88 |
iCaller( aCaller )
|
|
89 |
{
|
|
90 |
}
|
|
91 |
|
|
92 |
|
|
93 |
// ---------------------------------------------------------------------------
|
|
94 |
// CScreenSaverAnimPluginContainer::ConstructL(const TRect& aRect)
|
|
95 |
// EPOC two phased constructor
|
|
96 |
//
|
|
97 |
// ---------------------------------------------------------------------------
|
|
98 |
//
|
|
99 |
void CScreenSaverAnimPluginContainer::ConstructL( const CCoeControl* aParent,
|
|
100 |
const TRect& aRect )
|
|
101 |
{
|
|
102 |
#ifdef SCREENSAVER_LOG_ENABLED
|
|
103 |
_LIT( msg, "In ConstructL of container" );
|
|
104 |
PrintDebugMsg( msg );
|
|
105 |
#endif
|
|
106 |
|
|
107 |
CreateWindowL( aParent );
|
|
108 |
|
|
109 |
#ifdef SCREENSAVER_LOG_ENABLED
|
|
110 |
_LIT( msg1, "Window Created" );
|
|
111 |
PrintDebugMsg( msg1 );
|
|
112 |
#endif
|
|
113 |
|
|
114 |
BaseConstructL( aRect, NULL, R_SANIM_SETTING_LBX_ITEMS );
|
|
115 |
|
|
116 |
#ifdef SCREENSAVER_LOG_ENABLED
|
|
117 |
_LIT( msg2, "Base ConstructL called" );
|
|
118 |
PrintDebugMsg( msg2 );
|
|
119 |
#endif
|
|
120 |
|
|
121 |
}
|
|
122 |
|
|
123 |
// ---------------------------------------------------------------------------
|
|
124 |
// CScreenSaverAnimPluginContainer::BaseConstructL
|
|
125 |
|
|
126 |
// ---------------------------------------------------------------------------
|
|
127 |
//
|
|
128 |
void CScreenSaverAnimPluginContainer::BaseConstructL(
|
|
129 |
const TRect& aRect, TInt /* aTitleId */, TInt aResLbxId )
|
|
130 |
{
|
|
131 |
// Feature support should only be read once. It should not change run-time.
|
|
132 |
GetFeatureSupportL( iFeaturesSupport );
|
|
133 |
CEikStatusPane* sp = static_cast< CAknAppUi* >(
|
|
134 |
CEikonEnv::Static()->EikAppUi() )->StatusPane();
|
|
135 |
CAknTitlePane* title = static_cast<CAknTitlePane*>(
|
|
136 |
sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle) ) );
|
|
137 |
|
|
138 |
iListBox = new( ELeave ) CAknSettingStyleListBox;
|
|
139 |
|
|
140 |
ConstructListBoxL( aResLbxId );
|
|
141 |
iListBox->SetContainerWindowL( *this );
|
|
142 |
iListBox->SetRect( aRect );
|
|
143 |
|
|
144 |
iListBox->CreateScrollBarFrameL( ETrue );
|
|
145 |
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
|
|
146 |
CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
|
|
147 |
|
|
148 |
SetRect( aRect );
|
|
149 |
ActivateL();
|
|
150 |
|
|
151 |
}
|
|
152 |
|
|
153 |
// ---------------------------------------------------------------------------
|
|
154 |
// CScreenSaverAnimPluginContainer::~CScreenSaverAnimPluginContainer()
|
|
155 |
// Destructor
|
|
156 |
// ---------------------------------------------------------------------------
|
|
157 |
//
|
|
158 |
CScreenSaverAnimPluginContainer::~CScreenSaverAnimPluginContainer()
|
|
159 |
{
|
|
160 |
delete iItems;
|
|
161 |
delete iListBox;
|
|
162 |
// delete iItemArray;
|
|
163 |
}
|
|
164 |
|
|
165 |
// ---------------------------------------------------------------------------
|
|
166 |
// Sets feature support - see screensaveranimpluginconst.h for feature list.
|
|
167 |
// ---------------------------------------------------------------------------
|
|
168 |
//
|
|
169 |
void CScreenSaverAnimPluginContainer::GetFeatureSupportL(
|
|
170 |
TBitFlags& aFeatureBitFlags ) const
|
|
171 |
{
|
|
172 |
CRepository* featureRep = CRepository::NewLC( KCRUidThemesVariation );
|
|
173 |
TInt value = KErrNone;
|
|
174 |
featureRep->Get( KThemesLocalVariation, value );
|
|
175 |
|
|
176 |
aFeatureBitFlags.ClearAll();
|
|
177 |
|
|
178 |
//map value to feature flags
|
|
179 |
if ( value & KScreenSaverRemoveAnimPluginTimeout )
|
|
180 |
{
|
|
181 |
aFeatureBitFlags.Set( EAnimPluginBacklightRemoved );
|
|
182 |
}
|
|
183 |
|
|
184 |
CleanupStack::PopAndDestroy( featureRep );
|
|
185 |
}
|
|
186 |
|
|
187 |
// ---------------------------------------------------------------------------
|
|
188 |
// Checks if feature is supported.
|
|
189 |
// ---------------------------------------------------------------------------
|
|
190 |
//
|
|
191 |
TBool CScreenSaverAnimPluginContainer::IsFeatureSupported( TInt aFeatureID )
|
|
192 |
{
|
|
193 |
if ( ( aFeatureID >= 0 ) && ( aFeatureID < KAnimPluginMaxFeatureID ) )
|
|
194 |
{
|
|
195 |
return iFeaturesSupport.IsSet( aFeatureID );
|
|
196 |
}
|
|
197 |
else
|
|
198 |
{
|
|
199 |
// invalid feature value.
|
|
200 |
return EFalse;
|
|
201 |
}
|
|
202 |
}
|
|
203 |
|
|
204 |
// ---------------------------------------------------------------------------
|
|
205 |
// CScreenSaverAnimPluginContainer::HandleListBoxEventL
|
|
206 |
// (other items were commented in a header).
|
|
207 |
// ---------------------------------------------------------------------------
|
|
208 |
//
|
|
209 |
void CScreenSaverAnimPluginContainer::HandleListBoxEventL(
|
|
210 |
CEikListBox* /*aListBox*/, TListBoxEvent aEventType )
|
|
211 |
{
|
|
212 |
switch ( aEventType )
|
|
213 |
{
|
|
214 |
case EEventEnterKeyPressed:
|
|
215 |
case EEventItemDoubleClicked:
|
|
216 |
case EEventItemSingleClicked:
|
|
217 |
HandleListBoxSelectionL();
|
|
218 |
break;
|
|
219 |
default:
|
|
220 |
break;
|
|
221 |
}
|
|
222 |
}
|
|
223 |
|
|
224 |
// ---------------------------------------------------------------------------
|
|
225 |
// CScreenSaverAnimPluginContainer::HandleListBoxSelectionL()
|
|
226 |
// ---------------------------------------------------------------------------
|
|
227 |
//
|
|
228 |
void CScreenSaverAnimPluginContainer::HandleListBoxSelectionL()
|
|
229 |
{
|
|
230 |
TInt index = iListBox->CurrentItemIndex();
|
|
231 |
|
|
232 |
switch ( index )
|
|
233 |
{
|
|
234 |
case ESanimAnimFileNameId:
|
|
235 |
if ( !iInShowFileItem )
|
|
236 |
{
|
|
237 |
iInShowFileItem = ETrue;
|
|
238 |
TRAPD( err,ShowFileNameItemL() );
|
|
239 |
iInShowFileItem = EFalse;
|
|
240 |
User::LeaveIfError( err );
|
|
241 |
}
|
|
242 |
break;
|
|
243 |
case ESanimAnimTimeoutId:
|
|
244 |
ShowAnimTimeOutItemL();
|
|
245 |
break;
|
|
246 |
case ESanimLightsTimeoutId:
|
|
247 |
ShowLightsTimeOutItemL();
|
|
248 |
break;
|
|
249 |
default:
|
|
250 |
break;
|
|
251 |
}
|
|
252 |
}
|
|
253 |
|
|
254 |
// ---------------------------------------------------------------------------
|
|
255 |
// CScreenSaverAnimPluginContainer::ConstructListBoxL( TInt aResLbxId )
|
|
256 |
// ---------------------------------------------------------------------------
|
|
257 |
//
|
|
258 |
void CScreenSaverAnimPluginContainer::ConstructListBoxL( TInt aResLbxId )
|
|
259 |
{
|
|
260 |
#ifdef SCREENSAVER_LOG_ENABLED
|
|
261 |
_LIT( msg, "In Construct ListBoxL" );
|
|
262 |
PrintDebugMsg( msg );
|
|
263 |
#endif
|
|
264 |
|
|
265 |
iListBox->ConstructL( this, EAknListBoxSelectionList );
|
|
266 |
iItems = iCoeEnv->ReadDesC16ArrayResourceL( aResLbxId );
|
|
267 |
iItemArray = static_cast< CDesCArray* >( iListBox->Model()->ItemTextArray() );
|
|
268 |
iListBox->SetListBoxObserver( this );
|
|
269 |
CreateListBoxItemsL();
|
|
270 |
}
|
|
271 |
|
|
272 |
// ---------------------------------------------------------------------------
|
|
273 |
// CScreenSaverAnimPluginContainer::CreateListBoxItemsL()
|
|
274 |
//
|
|
275 |
//
|
|
276 |
// ---------------------------------------------------------------------------
|
|
277 |
//
|
|
278 |
void CScreenSaverAnimPluginContainer::CreateListBoxItemsL()
|
|
279 |
{
|
|
280 |
#ifdef SCREENSAVER_LOG_ENABLED
|
|
281 |
_LIT( msg, "Make FileName" );
|
|
282 |
PrintDebugMsg( msg );
|
|
283 |
#endif
|
|
284 |
|
|
285 |
MakeFileNameItem();
|
|
286 |
iItemArray->InsertL( ESanimAnimFileNameId, iItem );
|
|
287 |
|
|
288 |
#ifdef SCREENSAVER_LOG_ENABLED
|
|
289 |
_LIT( msg1, "Make Duration" );
|
|
290 |
PrintDebugMsg( msg1 );
|
|
291 |
#endif
|
|
292 |
|
|
293 |
MakeAnimTimeOutItemL();
|
|
294 |
iItemArray->InsertL( ESanimAnimTimeoutId, iItem );
|
|
295 |
|
|
296 |
if ( !IsFeatureSupported( EAnimPluginBacklightRemoved ) )
|
|
297 |
{
|
|
298 |
#ifdef SCREENSAVER_LOG_ENABLED
|
|
299 |
_LIT( msg2, "Make Backlight" );
|
|
300 |
PrintDebugMsg( msg2 );
|
|
301 |
#endif
|
|
302 |
|
|
303 |
MakeLightsTimeOutItemL();
|
|
304 |
iItemArray->InsertL( ESanimLightsTimeoutId, iItem );
|
|
305 |
}
|
|
306 |
}
|
|
307 |
|
|
308 |
// ---------------------------------------------------------------------------
|
|
309 |
// CScreenSaverAnimPluginContainer::UpdateListBoxL( TInt aItemId )
|
|
310 |
// ---------------------------------------------------------------------------
|
|
311 |
//
|
|
312 |
void CScreenSaverAnimPluginContainer::UpdateListBoxL( TInt aItemId )
|
|
313 |
{
|
|
314 |
switch ( aItemId )
|
|
315 |
{
|
|
316 |
case ESanimAnimFileNameId:
|
|
317 |
MakeFileNameItem();
|
|
318 |
break;
|
|
319 |
case ESanimAnimTimeoutId:
|
|
320 |
MakeAnimTimeOutItemL();
|
|
321 |
break;
|
|
322 |
case ESanimLightsTimeoutId:
|
|
323 |
MakeLightsTimeOutItemL();
|
|
324 |
break;
|
|
325 |
default:
|
|
326 |
break;
|
|
327 |
}
|
|
328 |
|
|
329 |
iItemArray->Delete( aItemId );
|
|
330 |
iItemArray->InsertL( aItemId, iItem );
|
|
331 |
iListBox->HandleItemAdditionL();
|
|
332 |
}
|
|
333 |
|
|
334 |
// ---------------------------------------------------------------------------
|
|
335 |
// CScreenSaverAnimPluginContainer::HandleResourceChange( TInt aType )
|
|
336 |
// ---------------------------------------------------------------------------
|
|
337 |
//
|
|
338 |
void CScreenSaverAnimPluginContainer::HandleResourceChange( TInt aType )
|
|
339 |
{
|
|
340 |
CCoeControl::HandleResourceChange( aType );
|
|
341 |
if( aType == KEikDynamicLayoutVariantSwitch )
|
|
342 |
{
|
|
343 |
TRect mainPaneRect;
|
|
344 |
GetNormalScreenLayoutRect( mainPaneRect );
|
|
345 |
SetRect(mainPaneRect);
|
|
346 |
|
|
347 |
DrawNow();
|
|
348 |
}
|
|
349 |
}
|
|
350 |
|
|
351 |
// ---------------------------------------------------------------------------
|
|
352 |
// CScreenSaverAnimPluginContainer::MakeFileNameItem()
|
|
353 |
//
|
|
354 |
// ---------------------------------------------------------------------------
|
|
355 |
//
|
|
356 |
void CScreenSaverAnimPluginContainer::MakeFileNameItem()
|
|
357 |
{
|
|
358 |
iItem = ( *iItems )[ESanimAnimFileNameId];
|
|
359 |
TParsePtrC fileParser( iSettingObject->iFileName );
|
|
360 |
TPtrC ptr( fileParser.NameAndExt() );
|
|
361 |
|
|
362 |
// Filename may be quite long - copy only the amount there's space left
|
|
363 |
iItem += ptr.Left( iItem.MaxLength() - iItem.Length() - 1 );
|
|
364 |
}
|
|
365 |
|
|
366 |
// ---------------------------------------------------------------------------
|
|
367 |
// CScreenSaverAnimPluginContainer::MakeAnimTimeOutItemL()
|
|
368 |
//
|
|
369 |
// ---------------------------------------------------------------------------
|
|
370 |
//
|
|
371 |
void CScreenSaverAnimPluginContainer::MakeAnimTimeOutItemL()
|
|
372 |
{
|
|
373 |
iItem = ( *iItems )[ESanimAnimTimeoutId];
|
|
374 |
|
|
375 |
HBufC* animText = CAknSlider::CreateValueTextInHBufCL(
|
|
376 |
iSettingObject->iAnimationTimeout,
|
|
377 |
R_ANIM_TIMEOUT_SLIDER );
|
|
378 |
|
|
379 |
// for A&H number conversion
|
|
380 |
TPtr bufPtr = animText->Des();
|
|
381 |
if( AknTextUtils::DigitModeQuery( AknTextUtils::EDigitModeShownToUser ) )
|
|
382 |
{
|
|
383 |
AknTextUtils::LanguageSpecificNumberConversion( bufPtr );
|
|
384 |
}
|
|
385 |
iItem += bufPtr;
|
|
386 |
delete animText;
|
|
387 |
|
|
388 |
}
|
|
389 |
|
|
390 |
// ---------------------------------------------------------------------------
|
|
391 |
// CScreenSaverAnimPluginContainer::MakeLightTimeOutItemL()
|
|
392 |
//
|
|
393 |
// ---------------------------------------------------------------------------
|
|
394 |
//
|
|
395 |
void CScreenSaverAnimPluginContainer::MakeLightsTimeOutItemL()
|
|
396 |
{
|
|
397 |
iItem = ( *iItems )[ESanimLightsTimeoutId];
|
|
398 |
|
|
399 |
HBufC* animText = NULL;
|
|
400 |
|
|
401 |
if ( iSettingObject->iLightsTimeout == 0 )
|
|
402 |
{
|
|
403 |
animText = iCoeEnv->AllocReadResourceL( R_SANIM_SLIDER_OFF );
|
|
404 |
}
|
|
405 |
else
|
|
406 |
{
|
|
407 |
animText = CAknSlider::CreateValueTextInHBufCL(
|
|
408 |
iSettingObject->iLightsTimeout,
|
|
409 |
R_LIGHT_TIMEOUT_SLIDER );
|
|
410 |
}
|
|
411 |
|
|
412 |
// for A&H number conversion
|
|
413 |
TPtr bufPtr = animText->Des();
|
|
414 |
if( AknTextUtils::DigitModeQuery( AknTextUtils::EDigitModeShownToUser ) )
|
|
415 |
{
|
|
416 |
AknTextUtils::LanguageSpecificNumberConversion( bufPtr );
|
|
417 |
}
|
|
418 |
iItem += bufPtr;
|
|
419 |
delete animText;
|
|
420 |
|
|
421 |
}
|
|
422 |
|
|
423 |
// ---------------------------------------------------------------------------
|
|
424 |
// CScreenSaverAnimPluginContainer::ShowFileNameItemL()
|
|
425 |
//
|
|
426 |
// ---------------------------------------------------------------------------
|
|
427 |
//
|
|
428 |
void CScreenSaverAnimPluginContainer::ShowFileNameItemL()
|
|
429 |
{
|
|
430 |
|
|
431 |
CDesCArrayFlat* selectedFile = new( ELeave )CDesCArrayFlat( 1 );
|
|
432 |
CleanupStack::PushL( selectedFile );
|
|
433 |
|
|
434 |
TResourceReader reader;
|
|
435 |
iCoeEnv->CreateResourceReaderLC( reader,
|
|
436 |
R_MIMETYPE_SPECIFIC_PLUGIN_ARRAY );
|
|
437 |
TInt countResource = reader.ReadInt16();
|
|
438 |
|
|
439 |
CDesCArrayFlat* mimetypesList = new( ELeave )
|
|
440 |
CDesCArrayFlat( countResource );
|
|
441 |
|
|
442 |
CleanupStack::PushL( mimetypesList );
|
|
443 |
|
|
444 |
for ( TInt i = 0; i < countResource; i++ )
|
|
445 |
{
|
|
446 |
HBufC* mimeType = reader.ReadHBufCL();
|
|
447 |
|
|
448 |
// Check plugin availability before appending mimetype
|
|
449 |
TUid uid = iCaller->FindAnimPluginL( *mimeType );
|
|
450 |
if ( uid != KNullUid )
|
|
451 |
{
|
|
452 |
mimetypesList->AppendL( *mimeType );
|
|
453 |
}
|
|
454 |
delete mimeType;
|
|
455 |
reader.ReadInt32();
|
|
456 |
}
|
|
457 |
|
|
458 |
CScreenSaverAnimPluginVerifier* verifier =
|
|
459 |
CScreenSaverAnimPluginVerifier::NewL( iCaller );
|
|
460 |
CleanupStack::PushL( verifier );
|
|
461 |
TBool fileSelected = MGFetch::RunL( *selectedFile,
|
|
462 |
EAnyMediaFile,
|
|
463 |
EFalse,
|
|
464 |
KNullDesC,
|
|
465 |
KNullDesC,
|
|
466 |
mimetypesList,
|
|
467 |
verifier );
|
|
468 |
|
|
469 |
CleanupStack::PopAndDestroy( verifier );
|
|
470 |
CleanupStack::PopAndDestroy( mimetypesList );
|
|
471 |
CleanupStack::PopAndDestroy(); // reader
|
|
472 |
|
|
473 |
if ( fileSelected )
|
|
474 |
{
|
|
475 |
TPtrC fileNamePtr = selectedFile->MdcaPoint( 0 );
|
|
476 |
TFileName tempFileName;
|
|
477 |
tempFileName.Copy( fileNamePtr );
|
|
478 |
iSettingObject->iFileName.Copy( tempFileName );
|
|
479 |
// Write the new setting into the central repository
|
|
480 |
iCaller->SetAnimSettings();
|
|
481 |
UpdateListBoxL( ESanimAnimFileNameId );
|
|
482 |
}
|
|
483 |
|
|
484 |
CleanupStack::PopAndDestroy( selectedFile );
|
|
485 |
|
|
486 |
}
|
|
487 |
|
|
488 |
// ----------------------------------------------------
|
|
489 |
// CScreenSaverAnimPluginContainer::ShowAnimTimeOutItemL()
|
|
490 |
// Display the animation time-out setting page.
|
|
491 |
// ----------------------------------------------------
|
|
492 |
//
|
|
493 |
void CScreenSaverAnimPluginContainer::ShowAnimTimeOutItemL()
|
|
494 |
{
|
|
495 |
|
|
496 |
CAknSettingPage* dlg = new( ELeave ) CAknSliderSettingPage(
|
|
497 |
R_ANIM_TIMEOUT_SETTING_PAGE,
|
|
498 |
iSettingObject->iAnimationTimeout );
|
|
499 |
if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
|
|
500 |
{
|
|
501 |
// Write the new setting into the central repository
|
|
502 |
iCaller->SetAnimSettings();
|
|
503 |
UpdateListBoxL( ESanimAnimTimeoutId );
|
|
504 |
}
|
|
505 |
}
|
|
506 |
|
|
507 |
// ----------------------------------------------------
|
|
508 |
// CScreenSaverAnimPluginContainer::ShowLightsTimeOutItemL()
|
|
509 |
// Display the animation time-out setting page.
|
|
510 |
// ----------------------------------------------------
|
|
511 |
//
|
|
512 |
void CScreenSaverAnimPluginContainer::ShowLightsTimeOutItemL()
|
|
513 |
{
|
|
514 |
CAknSettingPage* dlg =
|
|
515 |
new( ELeave ) CAknSliderSettingPage( R_LIGHT_TIMEOUT_SETTING_PAGE,
|
|
516 |
iSettingObject->iLightsTimeout );
|
|
517 |
if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
|
|
518 |
{
|
|
519 |
// Write the new setting into the central repository
|
|
520 |
iCaller->SetAnimSettings();
|
|
521 |
UpdateListBoxL( ESanimLightsTimeoutId );
|
|
522 |
}
|
|
523 |
}
|
|
524 |
|
|
525 |
void CScreenSaverAnimPluginContainer::SizeChanged()
|
|
526 |
{
|
|
527 |
if (iListBox)
|
|
528 |
{
|
|
529 |
// Get size from main pane, place from this rect
|
|
530 |
TRect mainPaneRect;
|
|
531 |
AknLayoutUtils::LayoutMetricsRect(
|
|
532 |
AknLayoutUtils::EMainPane,
|
|
533 |
mainPaneRect );
|
|
534 |
|
|
535 |
iListBox->SetExtent( Rect().iTl, mainPaneRect.Size() );
|
|
536 |
}
|
|
537 |
}
|
|
538 |
|
|
539 |
TInt CScreenSaverAnimPluginContainer::CountComponentControls() const
|
|
540 |
{
|
|
541 |
if ( iListBox )
|
|
542 |
{
|
|
543 |
return 1;
|
|
544 |
}
|
|
545 |
else
|
|
546 |
{
|
|
547 |
return 0;
|
|
548 |
}
|
|
549 |
}
|
|
550 |
|
|
551 |
CCoeControl* CScreenSaverAnimPluginContainer::
|
|
552 |
ComponentControl( TInt /*aIndex*/ ) const
|
|
553 |
{
|
|
554 |
if ( iListBox )
|
|
555 |
{
|
|
556 |
return iListBox;
|
|
557 |
}
|
|
558 |
else
|
|
559 |
{
|
|
560 |
return NULL;
|
|
561 |
}
|
|
562 |
}
|
|
563 |
|
|
564 |
// ---------------------------------------------------------------------------
|
|
565 |
// CScreenSaverAnimPluginContainer::OfferKeyEventL
|
|
566 |
// Called when a key is pressed.
|
|
567 |
//
|
|
568 |
// ---------------------------------------------------------------------------
|
|
569 |
TKeyResponse CScreenSaverAnimPluginContainer::OfferKeyEventL(
|
|
570 |
const TKeyEvent& aKeyEvent, TEventCode aType )
|
|
571 |
{
|
|
572 |
switch (aKeyEvent.iCode)
|
|
573 |
{
|
|
574 |
case EKeyLeftArrow:
|
|
575 |
case EKeyRightArrow:
|
|
576 |
// Listbox takes all event even if it doesn't use them
|
|
577 |
return EKeyWasNotConsumed;
|
|
578 |
default:
|
|
579 |
break;
|
|
580 |
}
|
|
581 |
return iListBox->OfferKeyEventL( aKeyEvent, aType );
|
|
582 |
}
|
|
583 |
|
|
584 |
void CScreenSaverAnimPluginContainer::SetContainerWindowL( const CCoeControl&
|
|
585 |
/* aContainer*/ )
|
|
586 |
{
|
|
587 |
}
|
|
588 |
|
|
589 |
// ---------------------------------------------------------------------------
|
|
590 |
// CScreenSaverAnimPluginContainer::FocusChanged
|
|
591 |
// ---------------------------------------------------------------------------
|
|
592 |
void CScreenSaverAnimPluginContainer::FocusChanged( TDrawNow aDrawNow )
|
|
593 |
{
|
|
594 |
// Pass focus changed event to listbox.
|
|
595 |
if ( iListBox )
|
|
596 |
{
|
|
597 |
iListBox->SetFocus( IsFocused(), aDrawNow );
|
|
598 |
}
|
|
599 |
}
|
|
600 |
|
|
601 |
// -----------------------------------------------------------------------------
|
|
602 |
// CSvgRenderFrameControl::GetNormalScreenLayoutRect
|
|
603 |
// Gets the normal screen layout rectangle for control from LAF.
|
|
604 |
// -----------------------------------------------------------------------------
|
|
605 |
//
|
|
606 |
void CScreenSaverAnimPluginContainer::GetNormalScreenLayoutRect(
|
|
607 |
TRect& aRect ) const // Rectangle specifying extent of control
|
|
608 |
{
|
|
609 |
AknLayoutUtils::LayoutMetricsRect(
|
|
610 |
AknLayoutUtils::EMainPane,
|
|
611 |
aRect );
|
|
612 |
}
|
|
613 |
|
|
614 |
// End of File
|