|
1 /* |
|
2 * Copyright (c) 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: Slideshow settings list implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 //EXTERNAL INCLUDES |
|
22 #include <aknappui.h> |
|
23 #include <StringLoader.h> |
|
24 #include <featmgr.h> // for FeatureManager |
|
25 #include <MGFetch.h> |
|
26 #include <aknnotewrappers.h> // for CAknInformationNote |
|
27 #include <centralrepository.h> // for CRepository |
|
28 #include <coeutils.h> // for ConeUtils |
|
29 #include <musicplayerdomaincrkeys.h> // for KPlaybackRestrictedMimeTypes |
|
30 #include <caf/caf.h> // for ContentAccess::CContent |
|
31 #include <centralrepository.h> // for CRepository |
|
32 #include <AknQueryDialog.h> // for querydialog |
|
33 |
|
34 #include <shwsettingsdialog.rsg> |
|
35 #include <glxassert.h> // for GLX_ASSERT_DEBUG |
|
36 #include <data_caging_path_literals.hrh> |
|
37 #include <bautils.h> |
|
38 #include <f32file.h> |
|
39 #include <aknslidersettingpage.h> |
|
40 |
|
41 //INTERNAL INCLUDES |
|
42 #include <glxlog.h> |
|
43 #include <glxtracer.h> |
|
44 #include "shwslideshowsettingslist.h" |
|
45 #include "shwsettingsmodel.h" |
|
46 #include "shwslideshowengine.h" |
|
47 #include "shweffectinfo.h" |
|
48 #include "shwslideshowsettings.hrh" |
|
49 #include "shwconstants.h" |
|
50 #include "shwconstants.hrh" |
|
51 |
|
52 _LIT(KResourceFile, "z:shwsettingsdialog.rsc"); |
|
53 |
|
54 // Add our own setting page |
|
55 // EEBD-79UL8Q - "no naviscroll support in slideshow settings" |
|
56 /** |
|
57 * CShwSliderSettingPage |
|
58 * CShwSliderSettingPage class for creating a slider setting page |
|
59 */ |
|
60 NONSHARABLE_CLASS( CShwSlideShowSettingsList::CShwSliderSettingPage ) |
|
61 : public CAknSliderSettingPage |
|
62 { |
|
63 public: |
|
64 /** |
|
65 * C++ Constructor. |
|
66 * @param aSettingPageResourceId The setting page's resource ID |
|
67 * @param aSliderValue The initial value of the slider |
|
68 */ |
|
69 CShwSliderSettingPage( TInt aSettingPageResourceId, TInt& aSliderValue ); |
|
70 |
|
71 /** |
|
72 * C++ Constructor. |
|
73 * @param aSettingTitleText The setting page's title |
|
74 * @param aSettingNumber The setting page's number |
|
75 * @param aControlType The setting page's control type |
|
76 * @param aEditorResourceId The setting page's editor resource ID |
|
77 * @param aSettingPageResourceId The setting page's resource ID |
|
78 * @param aSliderValue The initial value of the slider |
|
79 */ |
|
80 CShwSliderSettingPage( const TDesC* aSettingTitleText, |
|
81 TInt aSettingNumber, |
|
82 TInt aControlType, |
|
83 TInt aEditorResourceId, |
|
84 TInt aSettingPageResourceId, |
|
85 TInt& aSliderValue ); |
|
86 /** |
|
87 * Destructor. |
|
88 */ |
|
89 ~CShwSliderSettingPage(); |
|
90 |
|
91 public: // from CCoeControl |
|
92 /** |
|
93 * @ref CCoeControl::OfferKeyEventL |
|
94 */ |
|
95 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
96 |
|
97 }; |
|
98 |
|
99 // Add our own setting item to fix |
|
100 // EEBD-79UL8Q - "no naviscroll support in slideshow settings" |
|
101 /** |
|
102 * CShwSliderSettingItem |
|
103 * CShwSliderSettingItem class for creating a slider setting item |
|
104 */ |
|
105 NONSHARABLE_CLASS( CShwSlideShowSettingsList::CShwSliderSettingItem ) |
|
106 : public CAknSliderSettingItem |
|
107 { |
|
108 public: |
|
109 /** |
|
110 * Default C++ Constructor. |
|
111 * @param aIdentifier The resource ID |
|
112 * @param aExternalSliderValue The initial value of the slider |
|
113 */ |
|
114 CShwSliderSettingItem( TInt aIdentifier, TInt& aExternalSliderValue ); |
|
115 |
|
116 /** |
|
117 * Destructor. |
|
118 */ |
|
119 ~CShwSliderSettingItem(); |
|
120 |
|
121 protected: // from CAknSliderSettingItem |
|
122 /** |
|
123 * @ref CAknSliderSettingItem::CreateSettingPageL |
|
124 */ |
|
125 CAknSettingPage* CreateSettingPageL(); |
|
126 }; |
|
127 |
|
128 /** |
|
129 * CShwTransEffectEnumPopupSettingItem |
|
130 * CShwTransEffectEnumPopupSettingItem class for creating a enum Popup SettingsItem |
|
131 */ |
|
132 NONSHARABLE_CLASS( CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem ) |
|
133 : public CAknEnumeratedTextPopupSettingItem |
|
134 { |
|
135 public: |
|
136 |
|
137 /** |
|
138 * Default C++ Constructor. |
|
139 * @param aIdentifier The resource ID |
|
140 * @param aShwSettings The Slideshow settings model |
|
141 * @param aEffects Array of Transition effects |
|
142 */ |
|
143 CShwTransEffectEnumPopupSettingItem(TInt aIdentifier, |
|
144 CShwSettingsModel& aShwSettings, |
|
145 RArray<TShwEffectInfo>& aEffects); |
|
146 /** |
|
147 * Destructor. |
|
148 */ |
|
149 ~CShwTransEffectEnumPopupSettingItem(); |
|
150 |
|
151 /** |
|
152 * Retrieve the currently selected transition effect |
|
153 * @param [out] The selected effects ECOM Uid |
|
154 * @param [out] The selected effects index within the ECOM library |
|
155 */ |
|
156 void SelectedEffectL(TUid& aEffectUid, TUint& aEffectIndex); |
|
157 |
|
158 public: // from CAknEnumeratedTextPopupSettingItem |
|
159 |
|
160 /** |
|
161 * @ref CAknEnumeratedTextPopupSettingItem::LoadL |
|
162 */ |
|
163 void LoadL(); |
|
164 |
|
165 /** |
|
166 * @ref CAknEnumeratedTextPopupSettingItem::StoreL |
|
167 */ |
|
168 void StoreL(); |
|
169 |
|
170 /** |
|
171 * @ref CAknEnumeratedTextPopupSettingItem::CompleteConstructionL |
|
172 */ |
|
173 void CompleteConstructionL(); |
|
174 |
|
175 /** |
|
176 * @ref CAknEnumeratedTextPopupSettingItem::ExternalValue |
|
177 */ |
|
178 inline TInt ExternalValue() |
|
179 { |
|
180 return CAknEnumeratedTextPopupSettingItem::ExternalValue(); |
|
181 }; |
|
182 |
|
183 private: |
|
184 |
|
185 // Slideshow settings data |
|
186 CShwSettingsModel& iShwSettings; |
|
187 |
|
188 // Array of Transition effects |
|
189 RArray<TShwEffectInfo>& iEffects; |
|
190 |
|
191 // The current index within the iEffects array |
|
192 TInt iTransTypeIndex; |
|
193 }; |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 /** |
|
199 * CShwTransEffectBinaryPopupSettingItem |
|
200 * CShwTransEffectBinaryPopupSettingItem class for creating a binary |
|
201 * Popup SettingsItem |
|
202 */ |
|
203 NONSHARABLE_CLASS( CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem ) |
|
204 : public CAknBinaryPopupSettingItem |
|
205 { |
|
206 public: |
|
207 |
|
208 /** |
|
209 * Default C++ Destructor. |
|
210 * @param aIdentifier The resource ID |
|
211 * @param aShwSettings The Slideshow settings model |
|
212 * @param aEffects Array of Transition effects |
|
213 */ |
|
214 CShwTransEffectBinaryPopupSettingItem(TInt aIdentifier, |
|
215 CShwSettingsModel& aShwSettings, |
|
216 RArray<TShwEffectInfo>& aEffects); |
|
217 /** |
|
218 * Destructor. |
|
219 */ |
|
220 ~CShwTransEffectBinaryPopupSettingItem(); |
|
221 |
|
222 /** |
|
223 * Retrieve the currently selected transition effect |
|
224 * @param [out] The selected effects ECOM Uid |
|
225 * @param [out] The selected effects index within the ECOM library |
|
226 */ |
|
227 void SelectedEffectL(TUid& aEffectUid, TUint& aEffectIndex); |
|
228 |
|
229 public: // from CAknEnumeratedTextPopupSettingItem |
|
230 |
|
231 /** |
|
232 * @ref CAknEnumeratedTextPopupSettingItem::LoadL |
|
233 */ |
|
234 void LoadL(); |
|
235 |
|
236 /** |
|
237 * @ref CAknEnumeratedTextPopupSettingItem::StoreL |
|
238 */ |
|
239 void StoreL(); |
|
240 |
|
241 /** |
|
242 * @ref CAknEnumeratedTextPopupSettingItem::CompleteConstructionL |
|
243 */ |
|
244 void CompleteConstructionL(); |
|
245 |
|
246 /** |
|
247 * @ref CAknEnumeratedTextPopupSettingItem::SetExternalValue |
|
248 */ |
|
249 inline void SetExternalValue( TInt aNewValue ) |
|
250 { |
|
251 CAknBinaryPopupSettingItem::SetExternalValue( aNewValue ); |
|
252 }; |
|
253 |
|
254 private: |
|
255 |
|
256 // Slideshow settings data |
|
257 CShwSettingsModel& iShwSettings; |
|
258 |
|
259 // Array of Transition effects |
|
260 RArray<TShwEffectInfo>& iEffects; |
|
261 |
|
262 // The current index within the iEffects array |
|
263 TInt iTransTypeIndex; |
|
264 }; |
|
265 |
|
266 |
|
267 //----------------------------------------------------------------------------- |
|
268 // C++ constructor |
|
269 //----------------------------------------------------------------------------- |
|
270 CShwSlideShowSettingsList::CShwSliderSettingPage |
|
271 ::CShwSliderSettingPage( TInt aSettingPageResourceId, TInt& aSliderValue ) |
|
272 : CAknSliderSettingPage( aSettingPageResourceId, aSliderValue ) |
|
273 { |
|
274 } |
|
275 |
|
276 //----------------------------------------------------------------------------- |
|
277 // C++ constructor |
|
278 //----------------------------------------------------------------------------- |
|
279 CShwSlideShowSettingsList::CShwSliderSettingPage |
|
280 ::CShwSliderSettingPage( const TDesC* aSettingTitleText, |
|
281 TInt aSettingNumber, |
|
282 TInt aControlType, |
|
283 TInt aEditorResourceId, |
|
284 TInt aSettingPageResourceId, |
|
285 TInt& aSliderValue ) |
|
286 : CAknSliderSettingPage( aSettingTitleText, aSettingNumber, aControlType, |
|
287 aEditorResourceId, aSettingPageResourceId, aSliderValue ) |
|
288 { |
|
289 } |
|
290 |
|
291 //----------------------------------------------------------------------------- |
|
292 // C++ destructor |
|
293 //----------------------------------------------------------------------------- |
|
294 CShwSlideShowSettingsList::CShwSliderSettingPage::~CShwSliderSettingPage() |
|
295 { |
|
296 } |
|
297 |
|
298 //----------------------------------------------------------------------------- |
|
299 // CShwSliderSettingPage::OfferKeyEventL |
|
300 //----------------------------------------------------------------------------- |
|
301 TKeyResponse CShwSlideShowSettingsList::CShwSliderSettingPage:: |
|
302 OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
|
303 { |
|
304 TRACER("CShwSlideShowSettingsList::CShwSliderSettingPage::OfferKeyEventL"); |
|
305 GLX_LOG_INFO("CShwSlideShowSettingsList::CShwSliderSettingPage::OfferKeyEventL"); |
|
306 // Fix for EEBD-79UL8Q - "No Naviscroll support in Slideshow settings |
|
307 // options menu" |
|
308 TKeyEvent localKeyEvent = aKeyEvent; |
|
309 if ( aType == EEventKey ) |
|
310 { |
|
311 switch ( aKeyEvent.iCode ) |
|
312 { |
|
313 // Handle the previous and next navi-scroll events and modify the |
|
314 // key code to the corresponding values used by the dialog |
|
315 case EKeyPrevious: |
|
316 localKeyEvent.iCode = EKeyLeftArrow; |
|
317 break; |
|
318 case EKeyNext: |
|
319 localKeyEvent.iCode = EKeyRightArrow; |
|
320 break; |
|
321 default: |
|
322 // nothing to change |
|
323 break; |
|
324 } |
|
325 } |
|
326 |
|
327 // pass the key event up to the parent to handle |
|
328 return CAknSliderSettingPage::OfferKeyEventL( localKeyEvent, aType ); |
|
329 } |
|
330 |
|
331 |
|
332 //----------------------------------------------------------------------------- |
|
333 // C++ default constructor |
|
334 //----------------------------------------------------------------------------- |
|
335 CShwSlideShowSettingsList::CShwSliderSettingItem::CShwSliderSettingItem |
|
336 ( TInt aIdentifier, TInt& aExternalSliderValue ) |
|
337 : CAknSliderSettingItem( aIdentifier, aExternalSliderValue ) |
|
338 { |
|
339 } |
|
340 |
|
341 //----------------------------------------------------------------------------- |
|
342 // C++ destructor |
|
343 //----------------------------------------------------------------------------- |
|
344 CShwSlideShowSettingsList::CShwSliderSettingItem::~CShwSliderSettingItem() |
|
345 { |
|
346 } |
|
347 |
|
348 //----------------------------------------------------------------------------- |
|
349 // CShwSliderSettingItem::CreateSettingPageL |
|
350 //----------------------------------------------------------------------------- |
|
351 CAknSettingPage* CShwSlideShowSettingsList::CShwSliderSettingItem:: |
|
352 CreateSettingPageL() |
|
353 { |
|
354 TRACER("CShwSlideShowSettingsList::CShwSliderSettingPage::OfferKeyEventL"); |
|
355 GLX_LOG_INFO("CShwSlideShowSettingsList::CShwSliderSettingPage::OfferKeyEventL"); |
|
356 TPtrC text = SettingName(); |
|
357 return new( ELeave ) CShwSlideShowSettingsList::CShwSliderSettingPage( |
|
358 &text, SettingNumber(), EAknCtSlider, SettingEditorResourceId(), |
|
359 SettingPageResourceId(), InternalSliderValue() ); |
|
360 } |
|
361 |
|
362 |
|
363 //----------------------------------------------------------------------------- |
|
364 // C++ default constructor |
|
365 //----------------------------------------------------------------------------- |
|
366 CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem |
|
367 ::CShwTransEffectEnumPopupSettingItem( TInt aIdentifier, |
|
368 CShwSettingsModel& aShwSettings, RArray<TShwEffectInfo>& aEffects ) |
|
369 : CAknEnumeratedTextPopupSettingItem(aIdentifier, iTransTypeIndex), |
|
370 iShwSettings(aShwSettings), iEffects(aEffects) |
|
371 { |
|
372 } |
|
373 |
|
374 //----------------------------------------------------------------------------- |
|
375 // C++ destructor |
|
376 //----------------------------------------------------------------------------- |
|
377 CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem |
|
378 ::~CShwTransEffectEnumPopupSettingItem() |
|
379 { |
|
380 } |
|
381 |
|
382 |
|
383 //----------------------------------------------------------------------------- |
|
384 // CShwTransEffectEnumPopupSettingItem::SelectedEffectL |
|
385 //----------------------------------------------------------------------------- |
|
386 void CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem:: |
|
387 SelectedEffectL(TUid& aEffectUid, TUint& aEffectIndex) |
|
388 { |
|
389 TRACER("CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem::SelectedEffectL"); |
|
390 GLX_LOG_INFO("CShwTransEffectEnumPopupSettingItem::SelectedEffectL"); |
|
391 GLX_ASSERT_DEBUG( |
|
392 ( 0 <= iTransTypeIndex )&&( iTransTypeIndex < iEffects.Count() ), |
|
393 Panic( EGlxPanicIndexOutOfRange ), |
|
394 "Slideshow effect index is out of range" ); |
|
395 aEffectUid = iEffects[iTransTypeIndex].iId.iPluginUid; |
|
396 aEffectIndex = iEffects[iTransTypeIndex].iId.iIndex; |
|
397 } |
|
398 |
|
399 |
|
400 |
|
401 //----------------------------------------------------------------------------- |
|
402 // CShwTransEffectEnumPopupSettingItem::CompleteConstructionL |
|
403 //----------------------------------------------------------------------------- |
|
404 void CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem |
|
405 ::CompleteConstructionL() |
|
406 { |
|
407 TRACER("CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem::::CompleteConstructionL"); |
|
408 GLX_LOG_INFO("CShwTransEffectEnumPopupSettingItem::CompleteConstructionL"); |
|
409 CAknEnumeratedTextPopupSettingItem::CompleteConstructionL(); |
|
410 |
|
411 TUint max = iEffects.Count(); |
|
412 |
|
413 // Construct a new EnumeratedTextArray and an empty PopupText array |
|
414 CArrayPtrFlat<CAknEnumeratedText>* enumeratedTextArray = |
|
415 new (ELeave) CArrayPtrFlat<CAknEnumeratedText>(max); |
|
416 CleanupStack::PushL(enumeratedTextArray); |
|
417 |
|
418 CArrayPtrFlat<HBufC>* poppedUpTextArray = |
|
419 new (ELeave) CArrayPtrFlat<HBufC>(max); |
|
420 CleanupStack::PushL(poppedUpTextArray); |
|
421 |
|
422 // transfers the ownership of the arrays |
|
423 SetEnumeratedTextArrays(enumeratedTextArray, poppedUpTextArray); |
|
424 HandleTextArrayUpdateL(); |
|
425 CleanupStack::Pop(poppedUpTextArray); |
|
426 CleanupStack::Pop(enumeratedTextArray); |
|
427 } |
|
428 |
|
429 |
|
430 //----------------------------------------------------------------------------- |
|
431 // CShwTransEffectEnumPopupSettingItem::LoadL |
|
432 //----------------------------------------------------------------------------- |
|
433 void CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem::LoadL() |
|
434 { |
|
435 TRACER("CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem::LoadL"); |
|
436 GLX_LOG_INFO("CShwTransEffectEnumPopupSettingItem::LoadL"); |
|
437 // Clear out old array contents |
|
438 CArrayPtr<CAknEnumeratedText>* enumTxtArray = EnumeratedTextArray(); |
|
439 enumTxtArray->ResetAndDestroy(); |
|
440 |
|
441 // Create new array of transition types |
|
442 TUint max = iEffects.Count(); |
|
443 CAknEnumeratedText* enumeratedTxt = NULL; |
|
444 HBufC* transitionTxt = NULL; |
|
445 |
|
446 for (TInt ii = 0; ii < max; ++ii) |
|
447 { |
|
448 transitionTxt = iEffects[ii].iName.AllocLC(); |
|
449 enumeratedTxt = new (ELeave) CAknEnumeratedText(ii, transitionTxt); |
|
450 CleanupStack::Pop(transitionTxt); |
|
451 CleanupStack::PushL(enumeratedTxt); |
|
452 enumTxtArray->AppendL(enumeratedTxt); |
|
453 CleanupStack::Pop(enumeratedTxt); |
|
454 } |
|
455 |
|
456 // Get persisted default value |
|
457 TUid effectUid = {0}; |
|
458 TUint effectIndex = 0; |
|
459 iTransTypeIndex = KErrNotFound; |
|
460 iShwSettings.TransitionTypeL(effectUid, effectIndex); |
|
461 |
|
462 for (TInt ii = 0; ii < max; ++ii) |
|
463 { |
|
464 if (iEffects[ii].iId.iPluginUid == effectUid && |
|
465 iEffects[ii].iId.iIndex == effectIndex) |
|
466 { |
|
467 iTransTypeIndex = ii; |
|
468 continue; |
|
469 } |
|
470 } |
|
471 |
|
472 User::LeaveIfError(iTransTypeIndex); // should never be KErrNotFound |
|
473 User::LeaveIfError(CAknEnumeratedTextSettingItem::IndexFromValue |
|
474 (iTransTypeIndex)); |
|
475 SetExternalValue(iTransTypeIndex); |
|
476 CAknEnumeratedTextPopupSettingItem::LoadL(); |
|
477 } |
|
478 |
|
479 //----------------------------------------------------------------------------- |
|
480 // CShwTransEffectEnumPopupSettingItem::StoreL |
|
481 //----------------------------------------------------------------------------- |
|
482 void CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem::StoreL() |
|
483 { |
|
484 TRACER("CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem::StoreL"); |
|
485 GLX_LOG_INFO("CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem::StoreL"); |
|
486 CAknEnumeratedTextPopupSettingItem::StoreL(); |
|
487 } |
|
488 |
|
489 |
|
490 |
|
491 //----------------------------------------------------------------------------- |
|
492 // C++ default constructor |
|
493 //----------------------------------------------------------------------------- |
|
494 CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem |
|
495 ::CShwTransEffectBinaryPopupSettingItem(TInt aIdentifier, |
|
496 CShwSettingsModel& aShwSettings, |
|
497 RArray<TShwEffectInfo>& aEffects) |
|
498 : CAknBinaryPopupSettingItem(aIdentifier, iTransTypeIndex), |
|
499 iShwSettings(aShwSettings), iEffects(aEffects) |
|
500 { |
|
501 } |
|
502 |
|
503 //----------------------------------------------------------------------------- |
|
504 // C++ destructor |
|
505 //----------------------------------------------------------------------------- |
|
506 CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem |
|
507 ::~CShwTransEffectBinaryPopupSettingItem() |
|
508 { |
|
509 } |
|
510 |
|
511 |
|
512 |
|
513 //----------------------------------------------------------------------------- |
|
514 // CShwTransEffectBinaryPopupSettingItem::SelectedEffectL |
|
515 //----------------------------------------------------------------------------- |
|
516 void CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem:: |
|
517 SelectedEffectL(TUid& aEffectUid, TUint& aEffectIndex) |
|
518 { |
|
519 TRACER("CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem::SelectedEffectL"); |
|
520 GLX_LOG_INFO("CShwTransEffectBinaryPopupSettingItem::SelectedEffectL"); |
|
521 GLX_ASSERT_DEBUG( |
|
522 ( 0 <= iTransTypeIndex )&&( iTransTypeIndex < iEffects.Count() ), |
|
523 Panic( EGlxPanicIndexOutOfRange ), |
|
524 "Slideshow effect index is out of range" ); |
|
525 |
|
526 aEffectUid = iEffects[iTransTypeIndex].iId.iPluginUid; |
|
527 aEffectIndex = iEffects[iTransTypeIndex].iId.iIndex; |
|
528 } |
|
529 |
|
530 |
|
531 |
|
532 //----------------------------------------------------------------------------- |
|
533 // CShwTransEffectBinaryPopupSettingItem::CompleteConstructionL |
|
534 //----------------------------------------------------------------------------- |
|
535 void CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem |
|
536 ::CompleteConstructionL() |
|
537 { |
|
538 TRACER("CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem::CompleteConstructionL"); |
|
539 GLX_LOG_INFO("CShwTransEffectBinaryPopupSettingItem::CompleteConstructionL"); |
|
540 |
|
541 // Retrieve all available effects |
|
542 TUint max = iEffects.Count(); |
|
543 |
|
544 // Construct a new EnumeratedTextArray and an empty PopupText array |
|
545 CArrayPtrFlat<CAknEnumeratedText>* enumeratedTextArray = |
|
546 new (ELeave) CArrayPtrFlat<CAknEnumeratedText>(max); |
|
547 CleanupStack::PushL(enumeratedTextArray); |
|
548 |
|
549 CArrayPtrFlat<HBufC>* poppedUpTextArray = |
|
550 new (ELeave) CArrayPtrFlat<HBufC>(max); |
|
551 CleanupStack::PushL(poppedUpTextArray); |
|
552 |
|
553 // Transfers ownership |
|
554 SetEnumeratedTextArrays(enumeratedTextArray, poppedUpTextArray); |
|
555 HandleTextArrayUpdateL(); |
|
556 CleanupStack::Pop(poppedUpTextArray); |
|
557 CleanupStack::Pop(enumeratedTextArray); |
|
558 } |
|
559 |
|
560 |
|
561 //----------------------------------------------------------------------------- |
|
562 // CShwTransEffectBinaryPopupSettingItem::LoadL |
|
563 //----------------------------------------------------------------------------- |
|
564 void CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem::LoadL() |
|
565 { |
|
566 TRACER("CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem::LoadL"); |
|
567 GLX_LOG_INFO("CShwTransEffectBinaryPopupSettingItem::LoadL"); |
|
568 // Clear out old array contents |
|
569 CArrayPtr<CAknEnumeratedText>* enumTxtArray = EnumeratedTextArray(); |
|
570 enumTxtArray->ResetAndDestroy(); |
|
571 |
|
572 // Create new array of transition types |
|
573 TUint max = iEffects.Count(); |
|
574 CAknEnumeratedText* enumeratedTxt = NULL; |
|
575 HBufC* transitionTxt = NULL; |
|
576 |
|
577 for (TInt ii = 0; ii < max; ++ii) |
|
578 { |
|
579 transitionTxt = iEffects[ii].iName.AllocLC(); |
|
580 enumeratedTxt = new (ELeave) CAknEnumeratedText(ii, transitionTxt); |
|
581 CleanupStack::Pop(transitionTxt); |
|
582 CleanupStack::PushL(enumeratedTxt); |
|
583 enumTxtArray->AppendL(enumeratedTxt); |
|
584 CleanupStack::Pop(enumeratedTxt); |
|
585 } |
|
586 |
|
587 // Get persisted default value |
|
588 TUid effectUid = {0}; |
|
589 TUint effectIndex = 0; |
|
590 iTransTypeIndex = KErrNotFound; |
|
591 iShwSettings.TransitionTypeL(effectUid, effectIndex); |
|
592 |
|
593 for (TInt ii = 0; ii < max; ++ii) |
|
594 { |
|
595 if (iEffects[ii].iId.iPluginUid == effectUid && |
|
596 iEffects[ii].iId.iIndex == effectIndex) |
|
597 { |
|
598 iTransTypeIndex = ii; |
|
599 continue; |
|
600 } |
|
601 } |
|
602 |
|
603 User::LeaveIfError(iTransTypeIndex); // should never be KErrNotFound |
|
604 User::LeaveIfError(CAknEnumeratedTextSettingItem::IndexFromValue |
|
605 (iTransTypeIndex)); |
|
606 SetExternalValue(iTransTypeIndex); |
|
607 |
|
608 CAknBinaryPopupSettingItem::LoadL(); |
|
609 } |
|
610 |
|
611 //----------------------------------------------------------------------------- |
|
612 // CShwTransEffectBinaryPopupSettingItem::StoreL |
|
613 //----------------------------------------------------------------------------- |
|
614 void CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem::StoreL() |
|
615 { |
|
616 TRACER("CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem::StoreL"); |
|
617 GLX_LOG_INFO("CShwTransEffectBinaryPopupSettingItem::StoreL"); |
|
618 CAknBinaryPopupSettingItem::StoreL(); |
|
619 } |
|
620 |
|
621 |
|
622 //----------------------------------------------------------------------------- |
|
623 // CShwTransEffectEnumPopupSettingItem::NewL |
|
624 //----------------------------------------------------------------------------- |
|
625 CShwSlideShowSettingsList* CShwSlideShowSettingsList::NewL(CShwSettingsModel& |
|
626 aShwSettings) |
|
627 { |
|
628 TRACER("CShwSlideShowSettingsList::NewL"); |
|
629 GLX_LOG_INFO("CShwSlideShowSettingsList::NewL"); |
|
630 CShwSlideShowSettingsList* self = new (ELeave) CShwSlideShowSettingsList |
|
631 (aShwSettings); |
|
632 CleanupStack::PushL(self); |
|
633 self->ConstructL(); |
|
634 CleanupStack::Pop(self); |
|
635 return self; |
|
636 } |
|
637 |
|
638 |
|
639 |
|
640 //----------------------------------------------------------------------------- |
|
641 // destructor. |
|
642 //----------------------------------------------------------------------------- |
|
643 CShwSlideShowSettingsList::~CShwSlideShowSettingsList() |
|
644 { |
|
645 TRACER("CShwSlideShowSettingsList::~CShwSlideShowSettingsList"); |
|
646 GLX_LOG_INFO("CShwSlideShowSettingsList::~CShwSlideShowSettingsList"); |
|
647 delete iRepository; |
|
648 iMusicNamePath.Close(); |
|
649 iEffects.Close(); |
|
650 } |
|
651 |
|
652 //----------------------------------------------------------------------------- |
|
653 // C++ default constructor. |
|
654 //----------------------------------------------------------------------------- |
|
655 CShwSlideShowSettingsList::CShwSlideShowSettingsList( |
|
656 CShwSettingsModel& aShwSettings ) |
|
657 : iShwSettings( aShwSettings ) |
|
658 { |
|
659 TRACER("CShwSlideShowSettingsList::CShwSlideShowSettingsList"); |
|
660 GLX_LOG_INFO("CShwSlideShowSettingsList::CShwSlideShowSettingsList"); |
|
661 } |
|
662 |
|
663 //----------------------------------------------------------------------------- |
|
664 // Second stage constructor. |
|
665 //----------------------------------------------------------------------------- |
|
666 void CShwSlideShowSettingsList::ConstructL() |
|
667 { |
|
668 TRACER("CShwSlideShowSettingsList::ConstructL"); |
|
669 GLX_LOG_INFO("CShwSlideShowSettingsList::ConstructL"); |
|
670 iMusicNamePath.CreateL(KMaxFileName); |
|
671 } |
|
672 |
|
673 //----------------------------------------------------------------------------- |
|
674 // CShwSlideShowSettingsList::CreateSettingItemL |
|
675 //----------------------------------------------------------------------------- |
|
676 CAknSettingItem* CShwSlideShowSettingsList::CreateSettingItemL(TInt |
|
677 aResourceId) |
|
678 { |
|
679 TRACER("CShwSlideShowSettingsList::CreateSettingItemL"); |
|
680 GLX_LOG_INFO("CShwSlideShowSettingsList::CreateSettingItemL"); |
|
681 CAknSettingItem* settingItem = NULL; // No need to push onto cleanup stack |
|
682 switch(aResourceId) |
|
683 { |
|
684 case EPlayDirectionItem: |
|
685 { |
|
686 iPlayDirection = iShwSettings.PlayOrderL(); |
|
687 settingItem = new (ELeave) CAknBinaryPopupSettingItem(aResourceId, |
|
688 iPlayDirection); |
|
689 |
|
690 break; |
|
691 } |
|
692 case EMusicEnabledItem: |
|
693 { |
|
694 iMusicState = iShwSettings.MusicOnL(); |
|
695 settingItem = new (ELeave) CAknBinaryPopupSettingItem(aResourceId, |
|
696 iMusicState); |
|
697 break; |
|
698 } |
|
699 case EFileNamePathItem: |
|
700 { |
|
701 // get the track from settings |
|
702 iShwSettings.MusicNamePathL( iMusicNamePath ); |
|
703 if(!ConeUtils::FileExists( iMusicNamePath ) ) |
|
704 { |
|
705 HBufC* noneTxt = ReadLBufStringL( R_SHW_SLIDESHOW_SETTINGS_TRACK_NONE ); |
|
706 iMusicNamePath = *noneTxt; |
|
707 iShwSettings.SaveMusicNamePathL( *noneTxt ); |
|
708 delete noneTxt; |
|
709 } |
|
710 settingItem = new (ELeave) CAknTextSettingItem( |
|
711 aResourceId, iMusicNamePath ); |
|
712 |
|
713 // The music should be disabled when the file does not exist |
|
714 // Note: this change is not persisted. Same check is performed |
|
715 // each time the Settings Dialog is launched |
|
716 if( FileNameExistsL() ) |
|
717 { |
|
718 // Ensure that the DRM is still valid. If it has become |
|
719 // invalid while after being used in slideshow, the user |
|
720 // should be informed now. |
|
721 ValidateDRML(); |
|
722 } |
|
723 else |
|
724 { |
|
725 // file does not exist, set music off |
|
726 SetMusicStateL( EFalse ); |
|
727 } |
|
728 |
|
729 break; |
|
730 } |
|
731 case ETransDelayItem: |
|
732 { |
|
733 // need to reverse as slider is left to right, range is |
|
734 // from minimum to maximum |
|
735 iTransDelay = KMinTransDelay + KMaxTransDelay - iShwSettings.TransDelayL(); |
|
736 // Use our own slider setting item to fix |
|
737 // EEBD-79UL8Q - "no naviscroll support in slideshow settings" |
|
738 settingItem = new (ELeave) CShwSliderSettingItem( aResourceId, |
|
739 iTransDelay ); |
|
740 break; |
|
741 } |
|
742 case ETransEffectItem: |
|
743 { |
|
744 // Retrieve all available effects |
|
745 CShwSlideshowEngine::AvailableEffectsL(iEffects); |
|
746 settingItem = new (ELeave) |
|
747 CShwTransEffectBinaryPopupSettingItem(aResourceId, |
|
748 iShwSettings, iEffects); |
|
749 // As of now, Slideshow have only one effect. Thats why setting pan not |
|
750 // require in setting dialog. |
|
751 // Whenever other effect will be implemented, comment line No. 722 and |
|
752 // 738 and uncomment line No. 723 to 727 and line No. 739 to 743 |
|
753 settingItem->SetHidden(ETrue); |
|
754 /*if (iEffectsCount > 2) // hide this item - the TransEffectListItem |
|
755 { // is used instead |
|
756 settingItem->SetHidden(ETrue); |
|
757 HandleChangeInItemArrayOrVisibilityL(); |
|
758 }*/ |
|
759 |
|
760 break; |
|
761 } |
|
762 case ETransEffectListItem: |
|
763 { |
|
764 CShwSlideshowEngine::AvailableEffectsL(iEffects); |
|
765 iEffectsCount = iEffects.Count(); |
|
766 settingItem = new (ELeave) CShwTransEffectEnumPopupSettingItem( |
|
767 aResourceId, iShwSettings, iEffects); |
|
768 |
|
769 settingItem->SetHidden(ETrue); |
|
770 /*if (iEffectsCount <= 2) // hide this item - used only with menu |
|
771 { |
|
772 settingItem->SetHidden(ETrue); |
|
773 HandleChangeInItemArrayOrVisibilityL(); |
|
774 }*/ |
|
775 break; |
|
776 } |
|
777 default: |
|
778 { |
|
779 User::Leave(KErrNotSupported); |
|
780 } |
|
781 } |
|
782 return settingItem; // return ownership to framework |
|
783 } |
|
784 |
|
785 |
|
786 |
|
787 |
|
788 //----------------------------------------------------------------------------- |
|
789 // CShwSlideShowSettingsList::VerifySelectionL |
|
790 //----------------------------------------------------------------------------- |
|
791 TBool CShwSlideShowSettingsList::VerifySelectionL( |
|
792 const MDesCArray* aSelectedFiles) |
|
793 { |
|
794 TRACER("CShwSlideShowSettingsList::VerifySelectionL"); |
|
795 GLX_LOG_INFO("CShwSlideShowSettingsList::VerifySelectionL"); |
|
796 return (aSelectedFiles && aSelectedFiles->MdcaCount() > 0); |
|
797 } |
|
798 |
|
799 |
|
800 |
|
801 |
|
802 //----------------------------------------------------------------------------- |
|
803 // CShwSlideShowSettingsList::HandleListBoxEventL |
|
804 //----------------------------------------------------------------------------- |
|
805 void CShwSlideShowSettingsList::HandleListBoxEventL(CEikListBox* aListBox, |
|
806 TListBoxEvent aEventType) |
|
807 { |
|
808 TRACER("CShwSlideShowSettingsList::HandleListBoxEventL"); |
|
809 GLX_LOG_INFO("CShwSlideShowSettingsList::HandleListBoxEventL"); |
|
810 if ((aEventType == EEventEnterKeyPressed) || |
|
811 (aEventType == EEventEditingStarted) || |
|
812 (aEventType == EEventItemSingleClicked)) |
|
813 { |
|
814 TInt index = aListBox->CurrentItemIndex(); |
|
815 GLX_ASSERT_DEBUG( |
|
816 index < (*SettingItemArray()).Count(), |
|
817 Panic( EGlxPanicIndexOutOfRange ), |
|
818 "Slideshow listbox index is out of range" ); |
|
819 |
|
820 UpdateListBoxL(index); |
|
821 } |
|
822 } |
|
823 |
|
824 |
|
825 //----------------------------------------------------------------------------- |
|
826 // CShwSlideShowSettingsList::UpdateListBoxL |
|
827 //----------------------------------------------------------------------------- |
|
828 void CShwSlideShowSettingsList::UpdateListBoxL( TInt aListBoxIndex, |
|
829 TBool aKeyEvent ) |
|
830 { |
|
831 TRACER("CShwSlideShowSettingsList::UpdateListBoxL"); |
|
832 GLX_LOG_INFO("CShwSlideShowSettingsList::UpdateListBoxL"); |
|
833 switch(aListBoxIndex) |
|
834 { |
|
835 case EPlayDirectionItem: |
|
836 { |
|
837 SetPlayDirectionL(!iPlayDirection); |
|
838 break; |
|
839 } |
|
840 case EMusicEnabledItem: |
|
841 { |
|
842 UpdateMusicStateL(); |
|
843 break; |
|
844 } |
|
845 case EFileNamePathItem: |
|
846 { |
|
847 UpdateMusicFileNamePathL(); |
|
848 break; |
|
849 } |
|
850 case ETransDelayItem: |
|
851 { |
|
852 UpdateTransDelayL(); |
|
853 break; |
|
854 } |
|
855 case ETransEffectItem: |
|
856 case ETransEffectListItem: |
|
857 { |
|
858 UpdateTransEffectL(aKeyEvent); |
|
859 break; |
|
860 } |
|
861 default: |
|
862 { |
|
863 User::Leave(KErrNotSupported); |
|
864 } |
|
865 } |
|
866 SettingItemArray()->RecalculateVisibleIndicesL(); |
|
867 HandleChangeInItemArrayOrVisibilityL(); |
|
868 } |
|
869 |
|
870 |
|
871 |
|
872 //----------------------------------------------------------------------------- |
|
873 // CShwSlideShowSettingsList::UpdateMusicStateL() |
|
874 //----------------------------------------------------------------------------- |
|
875 |
|
876 void CShwSlideShowSettingsList::UpdateMusicStateL() |
|
877 { |
|
878 TRACER("CShwSlideShowSettingsList::UpdateMusicStateL"); |
|
879 GLX_LOG_INFO("CShwSlideShowSettingsList::UpdateMusicStateL"); |
|
880 // if music was disabled (iMusicState member variable has not yet |
|
881 // been updated) and a valid file does not exist |
|
882 |
|
883 |
|
884 RBuf fileName; |
|
885 User::LeaveIfError(fileName.Create(KMaxFileName)); |
|
886 fileName.CleanupClosePushL(); |
|
887 iShwSettings.MusicNamePathL(fileName); |
|
888 |
|
889 // if music was disabled (iMusicState member variable has not yet |
|
890 // been updated) |
|
891 |
|
892 if (!iMusicState ) |
|
893 { |
|
894 HBufC* defVal = ReadLBufStringL( R_SHW_SLIDESHOW_SETTINGS_TRACK_NONE ); |
|
895 CleanupStack::PushL(defVal); |
|
896 // if file not defined (None) |
|
897 if ( fileName.operator ==( *defVal ) ) |
|
898 { |
|
899 if (ConfirmationQueryL(R_SHW_QTN_LGAL_NOTE_TRACK_DEFINE)) |
|
900 { |
|
901 // only change the music state if the update of the music file name |
|
902 // and path was successful |
|
903 // The music state is updated inside this method if the Filename is |
|
904 // valid |
|
905 UpdateMusicFileNamePathL(); |
|
906 } |
|
907 } |
|
908 else |
|
909 { |
|
910 // if file defined but not exists |
|
911 if (!FileNameExistsL()) |
|
912 { |
|
913 // Display the information note |
|
914 HBufC* noteBuf = StringLoader::LoadLC( R_SHW_QTN_LGAL_NOTE_SLIDESHOW_DEFINE ); |
|
915 CAknInformationNote* note = new( ELeave ) CAknInformationNote; |
|
916 CleanupStack::Pop( noteBuf ); |
|
917 note->ExecuteLD( *noteBuf ); |
|
918 } |
|
919 else |
|
920 { |
|
921 SetMusicStateL( !iMusicState ); |
|
922 } |
|
923 } |
|
924 CleanupStack::PopAndDestroy( defVal ); |
|
925 } |
|
926 else |
|
927 { |
|
928 SetMusicStateL( !iMusicState ); |
|
929 } |
|
930 CleanupStack::PopAndDestroy( &fileName ); |
|
931 } |
|
932 |
|
933 //----------------------------------------------------------------------------- |
|
934 // CShwSlideShowSettingsList::UpdateMusicFileNamePathL |
|
935 //----------------------------------------------------------------------------- |
|
936 void CShwSlideShowSettingsList::UpdateMusicFileNamePathL() |
|
937 { |
|
938 TRACER("CShwSlideShowSettingsList::UpdateMusicFileNamePathL"); |
|
939 GLX_LOG_INFO("CShwSlideShowSettingsList::UpdateMusicFileNamePathL"); |
|
940 |
|
941 CAknSettingItem* item = (*SettingItemArray())[EFileNamePathItem]; |
|
942 |
|
943 // Retrieve & persist the new file path |
|
944 FetchFileNameFromUserL(); |
|
945 |
|
946 if( ConeUtils::FileExists( iMusicNamePath ) ) |
|
947 { |
|
948 if( ValidateDRML() ) |
|
949 { |
|
950 // persist new settings value |
|
951 item->LoadL(); // externalise the new value to iMusicNamePath |
|
952 iShwSettings.SaveMusicNamePathL( iMusicNamePath ); |
|
953 // Redraw the control |
|
954 ListBox()->DrawItem( EFileNamePathItem ); |
|
955 // turn music [enabled] on |
|
956 SetMusicStateL( ETrue ); |
|
957 return; |
|
958 } |
|
959 } |
|
960 else |
|
961 { |
|
962 ResetMusicDefaultsL(); |
|
963 } |
|
964 SetMusicStateL( EFalse ); |
|
965 } |
|
966 |
|
967 //----------------------------------------------------------------------------- |
|
968 // CShwSlideShowSettingsList::UpdateTransDelayL |
|
969 //----------------------------------------------------------------------------- |
|
970 void CShwSlideShowSettingsList::UpdateTransDelayL() |
|
971 { |
|
972 TRACER("CShwSlideShowSettingsList::UpdateTransDelayL"); |
|
973 GLX_LOG_INFO("CShwSlideShowSettingsList::UpdateTransDelayL"); |
|
974 CAknSettingItem* item = (*SettingItemArray())[ETransDelayItem]; |
|
975 |
|
976 item->EditItemL(EFalse); |
|
977 item->StoreL(); |
|
978 |
|
979 // The slider control has a fast (2) value drawn to the right and a |
|
980 // slow value (30) drawn to the left. However, the slider only allows |
|
981 // ascending values from left to right so the delay value has to be |
|
982 // inverted. Range is from minimum to maximum |
|
983 iShwSettings.SaveTransDelayL( KMinTransDelay + KMaxTransDelay - iTransDelay ); |
|
984 |
|
985 // Redraw the control |
|
986 ListBox()->DrawItem(ETransDelayItem); |
|
987 } |
|
988 |
|
989 |
|
990 |
|
991 //----------------------------------------------------------------------------- |
|
992 // CShwSlideShowSettingsList::UpdateTransEffectL |
|
993 //----------------------------------------------------------------------------- |
|
994 void CShwSlideShowSettingsList::UpdateTransEffectL(TBool aKeyEvent) |
|
995 { |
|
996 TRACER("CShwSlideShowSettingsList::UpdateTransEffectL"); |
|
997 GLX_LOG_INFO("CShwSlideShowSettingsList::UpdateTransEffectL"); |
|
998 CAknSettingItem* effectItem = (*SettingItemArray())[ETransEffectItem]; |
|
999 |
|
1000 TUint effectIndex = 0; |
|
1001 TUid effectUid = {0}; |
|
1002 const TUint KToggleEvents = 2; |
|
1003 |
|
1004 |
|
1005 // should always toggle if there are two entries |
|
1006 if (aKeyEvent && iEffectsCount <= KToggleEvents) |
|
1007 { |
|
1008 effectItem->EditItemL(EFalse); |
|
1009 effectItem->StoreL(); |
|
1010 static_cast<CShwTransEffectBinaryPopupSettingItem*>(effectItem) |
|
1011 ->SelectedEffectL(effectUid, effectIndex); |
|
1012 } |
|
1013 else |
|
1014 { |
|
1015 // always display listbox when there are > 2 effects or when it's |
|
1016 // opened from the menu |
|
1017 CAknSettingItem* effectListItem = |
|
1018 (*SettingItemArray())[ETransEffectListItem]; |
|
1019 effectListItem->EditItemL(EFalse); |
|
1020 effectListItem->StoreL(); |
|
1021 static_cast<CShwTransEffectEnumPopupSettingItem*>(effectListItem) |
|
1022 ->SelectedEffectL(effectUid, effectIndex); |
|
1023 |
|
1024 static_cast<CShwTransEffectBinaryPopupSettingItem*>(effectItem) |
|
1025 ->SetExternalValue(static_cast<CShwTransEffectEnumPopupSettingItem*> |
|
1026 (effectListItem)->ExternalValue()); |
|
1027 static_cast<CAknBinaryPopupSettingItem*>(effectItem)-> |
|
1028 CAknBinaryPopupSettingItem::LoadL(); |
|
1029 } |
|
1030 iShwSettings.SaveTransitionTypeL(effectUid, effectIndex); |
|
1031 |
|
1032 // Redraw the control |
|
1033 ListBox()->DrawItem(ETransEffectItem); |
|
1034 } |
|
1035 |
|
1036 |
|
1037 |
|
1038 //----------------------------------------------------------------------------- |
|
1039 // CShwSlideShowSettingsList::FetchFileNameFromUserL |
|
1040 //----------------------------------------------------------------------------- |
|
1041 void CShwSlideShowSettingsList::FetchFileNameFromUserL() |
|
1042 { |
|
1043 TRACER("CShwSlideShowSettingsList::FetchFileNameFromUserL"); |
|
1044 GLX_LOG_INFO("CShwSlideShowSettingsList::FetchFileNameFromUserL"); |
|
1045 CDesCArray* files = new (ELeave) CDesCArrayFlat(1); |
|
1046 CleanupStack::PushL(files); |
|
1047 |
|
1048 HBufC* title = ReadLBufStringL( R_SHW_QTN_POPUP_SELECT_TRACK ); |
|
1049 |
|
1050 CleanupStack::PushL( title ); |
|
1051 HBufC* noneTxt = ReadLBufStringL( R_SHW_SLIDESHOW_SETTINGS_TRACK_NONE ); |
|
1052 CleanupStack::PushL( noneTxt ); |
|
1053 |
|
1054 TBool fetchReturn = MGFetch::RunL(*files, EAudioFile, EFalse, KNullDesC(), *title, this); |
|
1055 |
|
1056 if(fetchReturn) |
|
1057 { |
|
1058 iMusicNamePath = (*files)[0]; |
|
1059 } |
|
1060 // Fix for Bug EJQZ-7EMCS7 - If user doesnt select a file from list, It shows the same file selected |
|
1061 else if (iMusicNamePath !=*noneTxt && !fetchReturn) |
|
1062 { |
|
1063 // Do Nothing , If the user doesnt select a file from the list, |
|
1064 // it shows the same file as before and thus do nothing. |
|
1065 } |
|
1066 else |
|
1067 { |
|
1068 // load "none" from resource |
|
1069 iMusicNamePath = *noneTxt; |
|
1070 } |
|
1071 CleanupStack::PopAndDestroy(noneTxt); |
|
1072 CleanupStack::PopAndDestroy( title ); |
|
1073 CleanupStack::PopAndDestroy( files ); |
|
1074 } |
|
1075 |
|
1076 //----------------------------------------------------------------------------- |
|
1077 // CShwSlideShowSettingsList::ResetMusicDefaultsL |
|
1078 //----------------------------------------------------------------------------- |
|
1079 void CShwSlideShowSettingsList::ResetMusicDefaultsL() |
|
1080 { |
|
1081 TRACER("CShwSlideShowSettingsList::ResetMusicDefaultsL"); |
|
1082 GLX_LOG_INFO("CShwSlideShowSettingsList::ResetMusicDefaultsL"); |
|
1083 // load "none" from resource |
|
1084 HBufC* noneTxt = ReadLBufStringL( R_SHW_SLIDESHOW_SETTINGS_TRACK_NONE ); |
|
1085 CleanupStack::PushL( noneTxt ); |
|
1086 iMusicNamePath = *noneTxt; |
|
1087 (*SettingItemArray())[EFileNamePathItem]->LoadL(); |
|
1088 // save empty string to settings so that the dialog will pick up |
|
1089 // empty text from the resource to show |
|
1090 // this fixes error when the old localised "none" text |
|
1091 // was shown for track (MKER-7BJCE5) |
|
1092 iShwSettings.SaveMusicNamePathL( *noneTxt ); |
|
1093 CleanupStack::PopAndDestroy( noneTxt ); |
|
1094 |
|
1095 // turn music [enabled] off |
|
1096 SetMusicStateL( EFalse ); |
|
1097 ListBox()->DrawItem( EFileNamePathItem ); |
|
1098 } |
|
1099 |
|
1100 //----------------------------------------------------------------------------- |
|
1101 // CShwSlideShowSettingsList::ValidateDRML |
|
1102 //----------------------------------------------------------------------------- |
|
1103 TBool CShwSlideShowSettingsList::ValidateDRML() |
|
1104 { |
|
1105 TRACER("CShwSlideShowSettingsList::ValidateDRML"); |
|
1106 GLX_LOG_INFO("CShwSlideShowSettingsList::ValidateDRML"); |
|
1107 |
|
1108 // check that DRM exists |
|
1109 // create a CContent object. CAF will figure out the appropriate agent |
|
1110 ContentAccess::CContent* content = |
|
1111 ContentAccess::CContent::NewL(iMusicNamePath); |
|
1112 CleanupStack::PushL( content ); |
|
1113 |
|
1114 // create a CData object to read the content, while also |
|
1115 ContentAccess::CData* data = NULL; |
|
1116 // verifying that the intent is supported by the current rights |
|
1117 TRAPD( err, data = content->OpenContentL( ContentAccess::EPlay ); ); |
|
1118 delete data; |
|
1119 CleanupStack::PopAndDestroy( content ); |
|
1120 |
|
1121 if( KErrCA_LowerLimit <= err && err <= KErrCA_UpperLimit ) |
|
1122 { |
|
1123 // if there are no play rights for the file and we're only allowed |
|
1124 // play files that are DRM protected |
|
1125 if( err == KErrCANoRights && PlayOnlyDRMProtectedFilesL() ) |
|
1126 { |
|
1127 ShowErrorNoteL( R_SHW_NOT_ALLOWED_TXT ); |
|
1128 return EFalse; // can't play file (rights don't exist) |
|
1129 } |
|
1130 else |
|
1131 { |
|
1132 ShowErrorNoteL( R_SHW_SETTINGSLIST_DRM_TXT ); |
|
1133 return EFalse; // can't play file (rights are invalid) |
|
1134 } |
|
1135 } |
|
1136 else |
|
1137 { |
|
1138 User::LeaveIfError( err ); |
|
1139 } |
|
1140 return ETrue; |
|
1141 } |
|
1142 |
|
1143 |
|
1144 //----------------------------------------------------------------------------- |
|
1145 // CShwSlideShowSettingsList::ShowErrorNoteL |
|
1146 //----------------------------------------------------------------------------- |
|
1147 void CShwSlideShowSettingsList::ShowErrorNoteL(TInt aResourceId) const |
|
1148 { |
|
1149 TRACER("CShwSlideShowSettingsList::ShowErrorNoteL"); |
|
1150 GLX_LOG_INFO("CShwSlideShowSettingsList::ShowErrorNoteL"); |
|
1151 HBufC* errText = StringLoader::LoadLC( aResourceId ); |
|
1152 CAknInformationNote* note = new (ELeave) CAknInformationNote( EFalse ); |
|
1153 note->ExecuteLD( *errText ); |
|
1154 CleanupStack::PopAndDestroy( errText ); |
|
1155 } |
|
1156 |
|
1157 |
|
1158 |
|
1159 //----------------------------------------------------------------------------- |
|
1160 // CShwSlideShowSettingsList::FileNameExistsL |
|
1161 //----------------------------------------------------------------------------- |
|
1162 TBool CShwSlideShowSettingsList::FileNameExistsL() |
|
1163 { |
|
1164 TRACER("CShwSlideShowSettingsList::FileNameExistsL"); |
|
1165 GLX_LOG_INFO("CShwSlideShowSettingsList::FileNameExistsL"); |
|
1166 RBuf fileName; |
|
1167 User::LeaveIfError(fileName.Create(KMaxFileName)); |
|
1168 fileName.CleanupClosePushL(); |
|
1169 iShwSettings.MusicNamePathL(fileName); |
|
1170 TBool retVal = EFalse; |
|
1171 |
|
1172 if (fileName.Length() > 0) |
|
1173 { |
|
1174 retVal = ConeUtils::FileExists(fileName); |
|
1175 } |
|
1176 CleanupStack::PopAndDestroy(&fileName); |
|
1177 return retVal; |
|
1178 } |
|
1179 |
|
1180 //----------------------------------------------------------------------------- |
|
1181 // CShwSlideShowSettingsList::SetMusicStateL() |
|
1182 //----------------------------------------------------------------------------- |
|
1183 void CShwSlideShowSettingsList::SetMusicStateL(TBool aNewMusicState) |
|
1184 { |
|
1185 TRACER("CShwSlideShowSettingsList::SetMusicStateL"); |
|
1186 GLX_LOG_INFO("CShwSlideShowSettingsList::SetMusicStateL"); |
|
1187 if (aNewMusicState != iMusicState) |
|
1188 { |
|
1189 // retrieve music on/off setting |
|
1190 (*SettingItemArray())[EMusicEnabledItem]->EditItemL(EFalse); |
|
1191 // updates Music State |
|
1192 iMusicState = aNewMusicState; |
|
1193 // internalise new state to settings item |
|
1194 (*(SettingItemArray()))[EMusicEnabledItem]->StoreL(); |
|
1195 // persist music state |
|
1196 iShwSettings.SaveMusicStateL(iMusicState); |
|
1197 // redraw music on/off control |
|
1198 ListBox()->DrawItem(EMusicEnabledItem); |
|
1199 } |
|
1200 } |
|
1201 //----------------------------------------------------------------------------- |
|
1202 // CShwSlideShowSettingsList::SetPlayDirectionL() |
|
1203 //----------------------------------------------------------------------------- |
|
1204 void CShwSlideShowSettingsList::SetPlayDirectionL(TBool aNewPlayDirection) |
|
1205 { |
|
1206 TRACER("CShwSlideShowSettingsList::SetPlayDirectionL"); |
|
1207 GLX_LOG_INFO("CShwSlideShowSettingsList::SetMusicStateL"); |
|
1208 if (aNewPlayDirection != iPlayDirection) |
|
1209 { |
|
1210 // retrieve play direction setting |
|
1211 (*SettingItemArray())[EPlayDirectionItem]->EditItemL(EFalse); |
|
1212 // updates play direction |
|
1213 iPlayDirection = aNewPlayDirection; |
|
1214 // internalise new state to settings item |
|
1215 (*(SettingItemArray()))[EPlayDirectionItem]->StoreL(); |
|
1216 |
|
1217 // persist direction |
|
1218 iShwSettings.SavePlayOrderL(iPlayDirection); |
|
1219 //@TODO cenrep update |
|
1220 |
|
1221 // redraw music on/off control |
|
1222 ListBox()->DrawItem(EPlayDirectionItem); |
|
1223 } |
|
1224 } |
|
1225 //----------------------------------------------------------------------------- |
|
1226 // CShwSlideShowSettingsList::ConfirmationQueryL |
|
1227 //----------------------------------------------------------------------------- |
|
1228 TBool CShwSlideShowSettingsList::ConfirmationQueryL(TInt aQueryStrId) |
|
1229 { |
|
1230 TRACER("CShwSlideShowSettingsList::ConfirmationQueryL"); |
|
1231 GLX_LOG_INFO("CShwSlideShowSettingsList::ConfirmationQueryL"); |
|
1232 HBufC* titleText = StringLoader::LoadLC(aQueryStrId); |
|
1233 CAknQueryDialog* query = CAknQueryDialog::NewL(); |
|
1234 CleanupStack::PushL(query); |
|
1235 query->SetPromptL(*titleText); |
|
1236 CleanupStack::Pop(query); |
|
1237 TInt retVal = query->ExecuteLD(R_SHW_CONFIRMATION_QUERY); |
|
1238 CleanupStack::PopAndDestroy(); //titleText |
|
1239 return (retVal == EAknSoftkeyOk || retVal == EAknSoftkeyYes); |
|
1240 } |
|
1241 |
|
1242 //----------------------------------------------------------------------------- |
|
1243 // CShwSlideShowSettingsList::PlayOnlyDRMProtectedFiles |
|
1244 //----------------------------------------------------------------------------- |
|
1245 TBool CShwSlideShowSettingsList::PlayOnlyDRMProtectedFilesL() |
|
1246 { |
|
1247 TRACER("CShwSlideShowSettingsList::PlayOnlyDRMProtectedFilesL"); |
|
1248 GLX_LOG_INFO("CShwSlideShowSettingsList::PlayOnlyDRMProtectedFilesL"); |
|
1249 TBool playOnlyDRMProtectedFiles = EFalse; |
|
1250 if (!iRepository) |
|
1251 { |
|
1252 iRepository = CRepository::NewL(KCRUidMusicPlayerFeatures); |
|
1253 } |
|
1254 // Check if DRM protected files are the only files that be played |
|
1255 TInt err = iRepository->Get(KRequireDRMInPlayback, |
|
1256 playOnlyDRMProtectedFiles); |
|
1257 if (err == KErrNotFound) // there maybe no KRequireDRMInPlayback entry |
|
1258 { |
|
1259 return EFalse; |
|
1260 } |
|
1261 else |
|
1262 { |
|
1263 User::LeaveIfError(err); |
|
1264 } |
|
1265 |
|
1266 return playOnlyDRMProtectedFiles; |
|
1267 } |
|
1268 |
|
1269 //----------------------------------------------------------------------------- |
|
1270 // CShwSlideShowSettingsList::ReadLBufStringL |
|
1271 //----------------------------------------------------------------------------- |
|
1272 HBufC* CShwSlideShowSettingsList::ReadLBufStringL( const TInt aResourceId ) |
|
1273 { |
|
1274 TRACER("CShwSlideShowSettingsList::ReadLBufStringL"); |
|
1275 GLX_LOG_INFO("CShwSlideShowSettingsList::ReadLBufStringL"); |
|
1276 RFs fs; |
|
1277 User::LeaveIfError( fs.Connect() ); |
|
1278 CleanupClosePushL( fs ); |
|
1279 |
|
1280 TParse parse; |
|
1281 parse.Set( KResourceFile, &KDC_APP_RESOURCE_DIR, NULL ); |
|
1282 |
|
1283 TFileName resFile; |
|
1284 resFile.Copy( parse.FullName() ); |
|
1285 BaflUtils::NearestLanguageFile( fs, resFile ); |
|
1286 |
|
1287 RResourceFile rFile; |
|
1288 rFile.OpenL( fs, resFile ); |
|
1289 CleanupClosePushL( rFile ); |
|
1290 |
|
1291 // Set pointer to starting |
|
1292 rFile.ConfirmSignatureL( 0 ); |
|
1293 |
|
1294 HBufC8* buf = rFile.AllocReadLC( aResourceId ); |
|
1295 |
|
1296 TResourceReader resReader; |
|
1297 resReader.SetBuffer( buf ); |
|
1298 |
|
1299 // get the string from resource reader |
|
1300 HBufC* defVal = resReader.ReadHBufCL(); |
|
1301 |
|
1302 // pop and destroy stack data |
|
1303 CleanupStack::PopAndDestroy( buf ); |
|
1304 CleanupStack::PopAndDestroy( &rFile ); |
|
1305 CleanupStack::PopAndDestroy( &fs ); |
|
1306 |
|
1307 return defVal; |
|
1308 } |
|
1309 |
|
1310 // End of File |