60
|
1 |
/*
|
|
2 |
* Copyright (c) 2008-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: Slideshow command handler
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
#include "glxcommandhandlerslideshow.h"
|
|
22 |
|
|
23 |
#include <data_caging_path_literals.hrh>
|
|
24 |
#include <mpxcollectionpath.h>
|
|
25 |
#include <mpxmediadrmdefs.h> // for KMPXMediaDrmProtected
|
|
26 |
#include <mpxviewutility.h>
|
|
27 |
#include <aknViewAppUi.h>
|
|
28 |
|
|
29 |
#include <glxuiutilities.rsg>
|
|
30 |
#include <mglxmedialist.h>
|
|
31 |
#include <glxuistd.h>
|
|
32 |
#include <glxcommandhandlers.hrh>
|
|
33 |
#include <glxresourceutilities.h> // for CGlxResourceUtilities
|
|
34 |
#include <glxattributecontext.h> // for CGlxAttributeContext
|
|
35 |
#include <glxmedia.h> // for TGlxMedia
|
|
36 |
#include <StringLoader.h> // for stringloader
|
|
37 |
#include <glxlog.h>
|
|
38 |
#include <glxtracer.h>
|
|
39 |
|
|
40 |
#include "shwslideshowviewplugin.hrh" // for the slideshow view's UID
|
|
41 |
#include "shwslideshowsettingsplugin_UID.hrh"// for slideshow setting dlg UID
|
|
42 |
#include "glxuiutility.h"
|
|
43 |
#include "glxscreenfurniture.h"
|
|
44 |
#include <glxicons.mbg>
|
|
45 |
#include <glxsetappstate.h> // set PCFW app state
|
|
46 |
#include <glxsettingsmodel.h>
|
|
47 |
#include <glxupnprenderer.h> // get UPnP state
|
|
48 |
#include <glxgeneraluiutilities.h>
|
|
49 |
namespace
|
|
50 |
{
|
|
51 |
const TInt KShwDefaultBufferSize = 128;
|
|
52 |
}
|
|
53 |
|
|
54 |
// ---------------------------------------------------------------------------
|
|
55 |
// Two-phased constructor.
|
|
56 |
// ---------------------------------------------------------------------------
|
|
57 |
//
|
|
58 |
EXPORT_C CGlxCommandHandlerSlideshow* CGlxCommandHandlerSlideshow::NewL(
|
|
59 |
MGlxMediaListProvider* aMediaListProvider, TBool aStepBack,
|
|
60 |
TBool aHasToolbarItem, const TDesC& aFileName)
|
|
61 |
{
|
|
62 |
TRACER( "CGlxCommandHandlerSlideshow::NewL" );
|
|
63 |
CGlxCommandHandlerSlideshow* self =
|
|
64 |
new (ELeave) CGlxCommandHandlerSlideshow(aMediaListProvider,
|
|
65 |
aStepBack, aHasToolbarItem);
|
|
66 |
CleanupStack::PushL(self);
|
|
67 |
self->ConstructL(aFileName);
|
|
68 |
CleanupStack::Pop(self);
|
|
69 |
return self;
|
|
70 |
}
|
|
71 |
|
|
72 |
// ---------------------------------------------------------------------------
|
|
73 |
// C++ default constructor can NOT contain any code, that
|
|
74 |
// might leave.
|
|
75 |
// ---------------------------------------------------------------------------
|
|
76 |
//
|
|
77 |
CGlxCommandHandlerSlideshow::CGlxCommandHandlerSlideshow( MGlxMediaListProvider*
|
|
78 |
aMediaListProvider, TBool aStepBack, TBool aHasToolbarItem )
|
|
79 |
: CGlxMediaListCommandHandler(aMediaListProvider, aHasToolbarItem), iStepBack(aStepBack)
|
|
80 |
{
|
|
81 |
// Do nothing
|
|
82 |
}
|
|
83 |
|
|
84 |
|
|
85 |
// ---------------------------------------------------------------------------
|
|
86 |
// Symbian 2nd phase constructor can leave.
|
|
87 |
// ---------------------------------------------------------------------------
|
|
88 |
//
|
|
89 |
void CGlxCommandHandlerSlideshow::ConstructL(const TDesC& aFileName)
|
|
90 |
{
|
|
91 |
TRACER( "CGlxCommandHandlerSlideshow::ConstructL" );
|
|
92 |
|
|
93 |
// Get a handle
|
|
94 |
iUiUtility = CGlxUiUtility::UtilityL();
|
|
95 |
|
|
96 |
iResourceOffset = CCoeEnv::Static()->AddResourceFileL(aFileName);
|
|
97 |
|
|
98 |
iShowInToolbar = ETrue;
|
|
99 |
|
|
100 |
// Add supported commands with filter fields
|
|
101 |
// Play slideshow forwards
|
|
102 |
TCommandInfo info(EGlxCmdSlideshowPlay);
|
|
103 |
// Disable for static items and dont enable empty slideshow
|
|
104 |
info.iMinSelectionLength = 1;
|
|
105 |
// Enable only for albums that have more than one item
|
|
106 |
info.iMinSlideshowPlayableContainedItemCount = 1;
|
|
107 |
// Disable for animated GIFs
|
|
108 |
info.iDisallowAnimatedGIFs = ETrue;
|
|
109 |
// Disable DRM protected content
|
|
110 |
info.iDisallowDRM = ETrue;
|
|
111 |
// Note: cannot just require all to be images as user can also start
|
|
112 |
// slideshow for a whole album from list view and in that case
|
|
113 |
// selection contains a container
|
|
114 |
// Disable all videos
|
|
115 |
TMPXGeneralCategory categoryFilter = EMPXVideo;
|
|
116 |
// Disable the command for videos
|
|
117 |
TCommandInfo::TCategoryRule categoryRule = TCommandInfo::EForbidAll;
|
|
118 |
info.iCategoryFilter = categoryFilter;
|
|
119 |
info.iCategoryRule = categoryRule;
|
|
120 |
AddCommandL(info);
|
|
121 |
|
|
122 |
// new info to get the default filters
|
|
123 |
TCommandInfo info_show_always(EGlxCmdSlideshowSettings);
|
|
124 |
// Disable for empty views and views with only static items
|
|
125 |
info_show_always.iMinSelectionLength = 1;
|
|
126 |
// slideshow settings
|
|
127 |
AddCommandL(info_show_always);
|
|
128 |
|
|
129 |
// Menu
|
|
130 |
info_show_always.iCommandId = EGlxCmdSlideshow;
|
|
131 |
AddCommandL(info_show_always);
|
|
132 |
|
|
133 |
// Dummy command to get UPnP state
|
|
134 |
TCommandInfo infoUpnpState(EGlxCmdShowViaUpnpStateChanged);
|
|
135 |
AddCommandL(infoUpnpState);
|
|
136 |
|
|
137 |
// Buffer
|
|
138 |
iBufFlat = CBufFlat::NewL(KShwDefaultBufferSize);
|
|
139 |
}
|
|
140 |
|
|
141 |
// ---------------------------------------------------------------------------
|
|
142 |
// Destructor
|
|
143 |
// ---------------------------------------------------------------------------
|
|
144 |
//
|
|
145 |
EXPORT_C CGlxCommandHandlerSlideshow::~CGlxCommandHandlerSlideshow()
|
|
146 |
{
|
|
147 |
TRACER( "CGlxCommandHandlerSlideshow::~CGlxCommandHandlerSlideshow" );
|
|
148 |
if ( iResourceOffset )
|
|
149 |
{
|
|
150 |
CCoeEnv::Static()->DeleteResourceFile(iResourceOffset);
|
|
151 |
}
|
|
152 |
|
|
153 |
if (iUiUtility)
|
|
154 |
{
|
|
155 |
iUiUtility->Close();
|
|
156 |
}
|
|
157 |
|
|
158 |
delete iBufFlat;
|
|
159 |
delete iBuffer;
|
|
160 |
}
|
|
161 |
|
|
162 |
// ---------------------------------------------------------------------------
|
|
163 |
// DoActivateL
|
|
164 |
// ---------------------------------------------------------------------------
|
|
165 |
//
|
|
166 |
void CGlxCommandHandlerSlideshow::DoActivateL(TInt aViewId)
|
|
167 |
{
|
|
168 |
TRACER( "CGlxCommandHandlerSlideshow::DoActivateL" );
|
|
169 |
iViewId = aViewId;
|
|
170 |
|
|
171 |
// for media list item "focus changed" notification
|
|
172 |
MGlxMediaList& mediaList( MediaList() );
|
|
173 |
mediaList.AddMediaListObserverL( this );
|
|
174 |
}
|
|
175 |
|
|
176 |
|
|
177 |
// ----------------------------------------------------------------------------
|
|
178 |
// Deactivate
|
|
179 |
// ----------------------------------------------------------------------------
|
|
180 |
void CGlxCommandHandlerSlideshow::Deactivate()
|
|
181 |
{
|
|
182 |
TRACER( "CGlxCommandHandlerSlideshow::Deactivate" );
|
|
183 |
|
|
184 |
MGlxMediaList& mediaList( MediaList() );
|
|
185 |
mediaList.RemoveMediaListObserver( this );
|
|
186 |
}
|
|
187 |
|
|
188 |
// ----------------------------------------------------------------------------
|
|
189 |
// IsSlideshowPlayableOnFocusedContainer
|
|
190 |
// ----------------------------------------------------------------------------
|
|
191 |
//
|
|
192 |
TBool CGlxCommandHandlerSlideshow::IsSlideshowNotPlayableOnFocusedContainer
|
|
193 |
(TInt aCommandId, MGlxMediaList& aList)
|
|
194 |
{
|
|
195 |
TRACER("CGlxCommandHandlerSlideshow::IsSlideshowNotPlayableOnFocusedContainer");
|
|
196 |
TBool slideshowDisabled = EFalse;
|
|
197 |
|
|
198 |
// get the media item
|
|
199 |
const TGlxMedia& item = aList.Item( aList.FocusIndex() );
|
|
200 |
const TCommandInfo& info = CommandInfo(aCommandId);
|
|
201 |
|
|
202 |
// Check minimum item count if not yet disabled by previous rules
|
|
203 |
TInt count(0);
|
|
204 |
|
|
205 |
if( (info.iMinSlideshowPlayableContainedItemCount )&&
|
|
206 |
( item.GetSlideshowPlayableContainedItemCount(count) ) )
|
|
207 |
{
|
|
208 |
// disable if less than required amount of items in container
|
|
209 |
// (ignore non-containers, i.e. -1)
|
|
210 |
if( count != -1 )
|
|
211 |
{
|
|
212 |
slideshowDisabled = ( count < info.iMinSlideshowPlayableContainedItemCount );
|
|
213 |
}
|
|
214 |
}
|
|
215 |
return slideshowDisabled;
|
|
216 |
}
|
|
217 |
|
|
218 |
// -----------------------------------------------------------------------------
|
|
219 |
// DoExecute - the relevant action for the command id
|
|
220 |
// -----------------------------------------------------------------------------
|
|
221 |
//
|
|
222 |
TBool CGlxCommandHandlerSlideshow::DoExecuteL(TInt aCommandId,
|
|
223 |
MGlxMediaList& aList )
|
|
224 |
{
|
|
225 |
TRACER( "CGlxCommandHandlerSlideshow::DoExecuteL" );
|
|
226 |
TBool handledCommand = ETrue;
|
|
227 |
|
|
228 |
switch (aCommandId)
|
|
229 |
{
|
|
230 |
case EGlxCmdSlideshowPlay:
|
|
231 |
{
|
|
232 |
// This check has to be done again here since Slideshow can be
|
|
233 |
// activated from toolbar even when there are non-slideshow playable
|
|
234 |
// items in a container and when that container is focused.
|
|
235 |
if( aList.Count() <= 0 || IsSlideshowNotPlayableOnFocusedContainer( aCommandId, aList ) )
|
|
236 |
{
|
|
237 |
HBufC* popupText = NULL;
|
|
238 |
|
|
239 |
//Load the "No Images to Play Slideshow" string from the resource file
|
|
240 |
popupText = StringLoader::LoadLC( R_GLX_NO_IMAGES_TO_PLAY_SLIDESHOW );
|
|
241 |
|
|
242 |
// Show the Info Note.
|
|
243 |
GlxGeneralUiUtilities::ShowInfoNoteL( popupText->Des(), EFalse );
|
|
244 |
|
|
245 |
// LoadLC will push text on to cleanupstack,
|
|
246 |
// hence it should be poped and destroyed
|
|
247 |
CleanupStack::PopAndDestroy( popupText );
|
|
248 |
}
|
|
249 |
else
|
|
250 |
{
|
|
251 |
// Activate the slideshow view to play forwards
|
|
252 |
ActivateViewL( NShwSlideshow::EPlayForwards );
|
|
253 |
|
|
254 |
// set PCFW app state
|
|
255 |
GlxSetAppState::SetState(EGlxInSlideshowView);
|
|
256 |
}
|
|
257 |
break;
|
|
258 |
}
|
|
259 |
/* case EGlxCmdSlideshowPlayBackwards:
|
|
260 |
{
|
|
261 |
// Activate the slideshow view to play backwards
|
|
262 |
ActivateViewL( NShwSlideshow::EPlayBackwards );
|
|
263 |
|
|
264 |
// set PCFW app state
|
|
265 |
GlxSetAppState::SetState(EGlxInSlideshowView);
|
|
266 |
|
|
267 |
break;
|
|
268 |
} */
|
|
269 |
case EGlxCmdSlideshowSettings:
|
|
270 |
{
|
|
271 |
// In order for the Settings Dialogs Akn StatusPane to become
|
|
272 |
// visible the the Hui display should be deactivated & activated
|
|
273 |
// before & after the Settings Dialog (which is uses the Akn
|
|
274 |
// framework) is activated & deactivated respectively.
|
|
275 |
// Activating and deactivating the HUI within the Settings
|
|
276 |
// Dialog class will cause a Cone 8 panic.
|
|
277 |
|
|
278 |
iAvkonAppUi->ProcessCommandL(EGlxCmdDialogLaunched);
|
|
279 |
|
|
280 |
// hide HUI display
|
|
281 |
CGlxUiUtility::HideAlfDisplayL();
|
|
282 |
{
|
|
283 |
MMPXViewUtility* viewUtility = MMPXViewUtility::UtilityL();
|
|
284 |
CleanupClosePushL(*viewUtility);
|
|
285 |
|
|
286 |
// Activate the slideshow settings dialog
|
|
287 |
viewUtility->ActivateViewL(
|
|
288 |
TUid::Uid(KShwSettingsDlgImplementationUid));
|
|
289 |
|
|
290 |
CleanupStack::PopAndDestroy(viewUtility);
|
|
291 |
}
|
|
292 |
// show HUI display
|
|
293 |
CGlxUiUtility::ShowAlfDisplayL();
|
|
294 |
iAvkonAppUi->ProcessCommandL(EGlxCmdResetView);
|
|
295 |
break;
|
|
296 |
}
|
|
297 |
case EGlxCmdShowViaUpnpStateChanged:
|
|
298 |
{
|
|
299 |
handledCommand = EFalse;
|
|
300 |
break;
|
|
301 |
}
|
|
302 |
default:
|
|
303 |
{
|
|
304 |
handledCommand = EFalse;
|
|
305 |
break;
|
|
306 |
}
|
|
307 |
}
|
|
308 |
|
|
309 |
return handledCommand;
|
|
310 |
}
|
|
311 |
|
|
312 |
// -----------------------------------------------------------------------------
|
|
313 |
// DoIsDisabled
|
|
314 |
// -----------------------------------------------------------------------------
|
|
315 |
//
|
|
316 |
TBool CGlxCommandHandlerSlideshow::DoIsDisabled(
|
|
317 |
TInt /*aCommandId*/, MGlxMediaList& /*aList*/) const
|
|
318 |
{
|
|
319 |
TRACER("CGlxCommandHandlerSlideshow::DoIsDisabled");
|
|
320 |
// Disable if UPnP is active
|
|
321 |
return ( GlxUpnpRenderer::Status() == NGlxUpnpRenderer::EActive );
|
|
322 |
}
|
|
323 |
|
|
324 |
// -----------------------------------------------------------------------------
|
|
325 |
// BypassFiltersForExecute
|
|
326 |
// -----------------------------------------------------------------------------
|
|
327 |
//
|
|
328 |
TBool CGlxCommandHandlerSlideshow::BypassFiltersForExecute() const
|
|
329 |
{
|
|
330 |
TRACER("CGlxCommandHandlerSlideshow::BypassFiltersForExecute");
|
|
331 |
// Always bypass filters to minimise the time spent by the base class
|
|
332 |
// when it initialises the slideshow menu item.
|
|
333 |
return ETrue;
|
|
334 |
}
|
|
335 |
|
|
336 |
// ----------------------------------------------------------------------------
|
|
337 |
// HandleFocusChangedL
|
|
338 |
// ----------------------------------------------------------------------------
|
|
339 |
void CGlxCommandHandlerSlideshow::HandleFocusChangedL(
|
|
340 |
NGlxListDefs::TFocusChangeType /*aType*/,
|
|
341 |
TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* aList)
|
|
342 |
{
|
|
343 |
TRACER("CGlxCommandHandlerSlideshow::HandleFocusChangedL");
|
|
344 |
// Check if toolbar is available.
|
|
345 |
CAknToolbar* toolbar = iUiUtility->GetGridToolBar();
|
|
346 |
if (aList->Count() <= 0 && toolbar)
|
|
347 |
{
|
|
348 |
toolbar->SetItemDimmed(EGlxCmdSlideshowPlay, ETrue, ETrue);
|
|
349 |
}
|
|
350 |
}
|
|
351 |
|
|
352 |
// ---------------------------------------------------------------------------
|
|
353 |
// HandleItemAddedL
|
|
354 |
// ---------------------------------------------------------------------------
|
|
355 |
//
|
|
356 |
void CGlxCommandHandlerSlideshow::HandleItemAddedL(TInt /*aStartIndex*/,
|
|
357 |
TInt /*aEndIndex*/, MGlxMediaList* aList)
|
|
358 |
{
|
|
359 |
TRACER("CGlxCommandHandlerSlideshow::HandleItemAddedL");
|
|
360 |
// Check if toolbar is available.
|
|
361 |
CAknToolbar* toolbar = iUiUtility->GetGridToolBar();
|
|
362 |
if (aList->Count() > 0 && toolbar)
|
|
363 |
{
|
|
364 |
toolbar->SetItemDimmed(EGlxCmdSlideshowPlay, EFalse, ETrue);
|
|
365 |
}
|
|
366 |
}
|
|
367 |
|
|
368 |
// ---------------------------------------------------------------------------
|
|
369 |
// HandleMediaL
|
|
370 |
// ---------------------------------------------------------------------------
|
|
371 |
//
|
|
372 |
void CGlxCommandHandlerSlideshow::HandleMediaL(TInt /*aListIndex*/,
|
|
373 |
MGlxMediaList* /*aList*/)
|
|
374 |
{
|
|
375 |
}
|
|
376 |
|
|
377 |
// ---------------------------------------------------------------------------
|
|
378 |
// HandleItemRemovedL
|
|
379 |
// ---------------------------------------------------------------------------
|
|
380 |
//
|
|
381 |
void CGlxCommandHandlerSlideshow::HandleItemRemovedL(TInt /*aStartIndex*/,
|
|
382 |
TInt /*aEndIndex*/, MGlxMediaList* aList)
|
|
383 |
{
|
|
384 |
TRACER("CGlxCommandHandlerSlideshow::HandleItemRemovedL");
|
|
385 |
// Check if toolbar is available.
|
|
386 |
CAknToolbar* toolbar = iUiUtility->GetGridToolBar();
|
|
387 |
if (aList->Count() <= 0 && toolbar)
|
|
388 |
{
|
|
389 |
toolbar->SetItemDimmed(EGlxCmdSlideshowPlay, ETrue, ETrue);
|
|
390 |
}
|
|
391 |
}
|
|
392 |
|
|
393 |
// ---------------------------------------------------------------------------
|
|
394 |
// HandleItemModifiedL
|
|
395 |
// ---------------------------------------------------------------------------
|
|
396 |
//
|
|
397 |
void CGlxCommandHandlerSlideshow::HandleItemModifiedL(
|
|
398 |
const RArray<TInt>& /*aItemIndexes*/, MGlxMediaList* /*aList*/)
|
|
399 |
{
|
|
400 |
}
|
|
401 |
|
|
402 |
// ---------------------------------------------------------------------------
|
|
403 |
// HandleAttributesAvailableL
|
|
404 |
// ---------------------------------------------------------------------------
|
|
405 |
//
|
|
406 |
void CGlxCommandHandlerSlideshow::HandleAttributesAvailableL(
|
|
407 |
TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes,
|
|
408 |
MGlxMediaList* /*aList*/ )
|
|
409 |
{
|
|
410 |
TRACER("CGlxCommandHandlerSlideshow::HandleAttributesAvailableL");
|
|
411 |
if ( iShowInToolbar && MediaList().FocusIndex() == aItemIndex )
|
|
412 |
{
|
|
413 |
TIdentityRelation<TMPXAttribute> match( TMPXAttribute::MatchContentId );
|
|
414 |
|
|
415 |
if ( aAttributes.Find( KMPXMediaGeneralCategory, match ) >= 0
|
|
416 |
|| aAttributes.Find( KMPXMediaDrmProtected, match ) >= 0
|
|
417 |
|| aAttributes.Find( KGlxMediaGeneralFramecount, match ) >= 0 )
|
|
418 |
{
|
|
419 |
UpdateToolbar();
|
|
420 |
}
|
|
421 |
}
|
|
422 |
}
|
|
423 |
|
|
424 |
// ---------------------------------------------------------------------------
|
|
425 |
// HandleItemSelectedL
|
|
426 |
// ---------------------------------------------------------------------------
|
|
427 |
//
|
|
428 |
void CGlxCommandHandlerSlideshow::HandleItemSelectedL(TInt /*aIndex*/,
|
|
429 |
TBool /*aSelected*/, MGlxMediaList* /*aList*/)
|
|
430 |
{
|
|
431 |
}
|
|
432 |
|
|
433 |
// ---------------------------------------------------------------------------
|
|
434 |
// HandleMessageL
|
|
435 |
// ---------------------------------------------------------------------------
|
|
436 |
//
|
|
437 |
void CGlxCommandHandlerSlideshow::HandleMessageL(
|
|
438 |
const CMPXMessage& /*aMessage*/, MGlxMediaList* /*aList*/)
|
|
439 |
{
|
|
440 |
}
|
|
441 |
|
|
442 |
// -----------------------------------------------------------------------------
|
|
443 |
// ActivateViewL - launch the view
|
|
444 |
// -----------------------------------------------------------------------------
|
|
445 |
//
|
|
446 |
void CGlxCommandHandlerSlideshow::ActivateViewL( NShwSlideshow::TPlayDirection
|
|
447 |
aPlaybackDirection )
|
|
448 |
{
|
|
449 |
TRACER( "CGlxCommandHandlerSlideshow::ActivateViewL" );
|
|
450 |
|
|
451 |
// Determine the path from the media list
|
|
452 |
CMPXCollectionPath* path = MediaList().PathLC();
|
|
453 |
// Ensure the path's at the correct level for the view
|
|
454 |
if ( iStepBack && path->Levels() > 0 )
|
|
455 |
{
|
|
456 |
path->Back();
|
|
457 |
}
|
|
458 |
// Stream the data buffer
|
|
459 |
RBufWriteStream stream;
|
|
460 |
stream.Open( *iBufFlat );
|
|
461 |
CleanupClosePushL( stream );
|
|
462 |
// Write out the playback direction
|
|
463 |
stream.WriteInt32L( aPlaybackDirection );
|
|
464 |
stream.CommitL();
|
|
465 |
// Externalize the path to the stream
|
|
466 |
path->ExternalizeL( stream );
|
|
467 |
|
|
468 |
// ActivateViewL takes a TDesC*, rather than a TDesC8
|
|
469 |
// so copy the data accordingly
|
|
470 |
if ( iBuffer )
|
|
471 |
{
|
|
472 |
delete iBuffer;
|
|
473 |
iBuffer = NULL;
|
|
474 |
}
|
|
475 |
|
|
476 |
TInt length = iBufFlat->Size();
|
|
477 |
iBuffer = HBufC::NewL( length );
|
|
478 |
TPtr bufferPtr = iBuffer->Des();
|
|
479 |
TPtr8 ptr = iBufFlat->Ptr( 0 );
|
|
480 |
bufferPtr.Copy( ptr );
|
|
481 |
|
|
482 |
// Get the view utility
|
|
483 |
MMPXViewUtility* viewUtility = MMPXViewUtility::UtilityL();
|
|
484 |
CleanupClosePushL( *viewUtility );
|
|
485 |
|
|
486 |
viewUtility->ActivateViewL( TUid::Uid(KShwSlideshowViewImplementationId),
|
|
487 |
iBuffer );
|
|
488 |
|
|
489 |
// set the view navigation direction so that previous view keeps its
|
|
490 |
// media list and focus
|
|
491 |
iUiUtility->SetViewNavigationDirection( EGlxNavigationForwards );
|
|
492 |
|
|
493 |
CleanupStack::PopAndDestroy( 3, path ); // viewUtility, stream and path
|
|
494 |
}
|
|
495 |
|
|
496 |
// ---------------------------------------------------------------------------
|
|
497 |
// UpdateToolbarL
|
|
498 |
// ---------------------------------------------------------------------------
|
|
499 |
//
|
|
500 |
void CGlxCommandHandlerSlideshow::UpdateToolbar()
|
|
501 |
{
|
|
502 |
TRACER("CGlxCommandHandlerSlideshow::UpdateToolbar");
|
|
503 |
TBool visible = EFalse;
|
|
504 |
|
|
505 |
if ( GlxUpnpRenderer::Status() != NGlxUpnpRenderer::EActive )
|
|
506 |
{
|
|
507 |
TInt focus = MediaList().FocusIndex();
|
|
508 |
|
|
509 |
if ( focus >= 0 )
|
|
510 |
{
|
|
511 |
const TGlxMedia& media = MediaList().Item( focus );
|
|
512 |
|
|
513 |
TInt frameCount = 0;
|
|
514 |
// get count, ignore return value
|
|
515 |
(void)media.GetFrameCount( frameCount );
|
|
516 |
|
|
517 |
// medialistcommandhandler has added these attributes to a low
|
|
518 |
// priority fetch context when command was loaded so the values
|
|
519 |
// should be loaded
|
|
520 |
visible = ( EMPXImage == media.Category()
|
|
521 |
&& !media.IsDrmProtected()
|
|
522 |
&& 1 == frameCount );
|
|
523 |
}
|
|
524 |
}
|
|
525 |
|
|
526 |
iUiUtility->ScreenFurniture()->SetToolbarItemVisibility(
|
|
527 |
EGlxCmdSlideshowPlay, visible );
|
|
528 |
}
|
|
529 |
|
|
530 |
// ----------------------------------------------------------------------------
|
|
531 |
// HandlePopulatedL
|
|
532 |
// ----------------------------------------------------------------------------
|
|
533 |
//
|
|
534 |
void CGlxCommandHandlerSlideshow::HandlePopulatedL( MGlxMediaList* aList )
|
|
535 |
{
|
|
536 |
TRACER("CGlxCommandHandlerSlideshow::HandlePopulatedL()");
|
|
537 |
// Check if toolbar is available.
|
|
538 |
CAknToolbar* toolbar = iUiUtility->GetGridToolBar();
|
|
539 |
if (aList->Count() == 0 && toolbar)
|
|
540 |
{
|
|
541 |
toolbar->SetItemDimmed(EGlxCmdSlideshowPlay, ETrue, ETrue);
|
|
542 |
}
|
|
543 |
}
|
|
544 |
|
|
545 |
// ---------------------------------------------------------------------------
|
|
546 |
// PopulateToolbar
|
|
547 |
// ---------------------------------------------------------------------------
|
|
548 |
//
|
|
549 |
void CGlxCommandHandlerSlideshow::PopulateToolbarL()
|
|
550 |
{
|
|
551 |
TRACER("CGlxCommandHandlerSlideshow::PopulateToolbarL");
|
|
552 |
iUiUtility->ScreenFurniture()->SetTooltipL(EGlxCmdSlideshowPlay,
|
|
553 |
CAknButton::EPositionLeft);
|
|
554 |
}
|
|
555 |
|
|
556 |
// End of File
|