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: Thumbnail Composer plugin |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 * @internal reviewed 12/07/2007 by Simon Brooks |
|
22 */ |
|
23 |
|
24 #include <e32base.h> |
|
25 |
|
26 #include <mdelogiccondition.h> |
|
27 #include <mdeconstants.h> |
|
28 |
|
29 #include <mpxcollectionutility.h> |
|
30 #include <mpxcollectionpath.h> |
|
31 #include <mpxcollectionmessage.h> |
|
32 #include <mpxmessagegeneraldefs.h> |
|
33 #include <mpxcollectionframeworkdefs.h> |
|
34 |
|
35 #include <glxassert.h> |
|
36 #include <glxcollectionpluginall.hrh> |
|
37 #include <glxthumbnailattributeinfo.h> |
|
38 #include <glxbackgroundtnmessagedefs.h> |
|
39 #include <glxmediaid.h> |
|
40 #include <glxthumbnailinfo.h> |
|
41 #include <glxfilterfactory.h> |
|
42 #include <glxcommandfactory.h> |
|
43 #include <glxtracer.h> |
|
44 |
|
45 #include "glxthumbnailcomposerplugin.h" |
|
46 |
|
47 // This can be any number other than zero |
|
48 const TUint KGlxBackgroundThumbnailAttributeId = 1; |
|
49 const TInt KGlxThumbnailComposerInactivityTimeout = 30; // seconds |
|
50 const TInt KGlxThumbnailComposerDelay = 10000; // microseconds |
|
51 const TInt KGlxThumbnailComposerHarvestDelay = 5000000; // microseconds |
|
52 const TInt KGlxThumbnailComposerLargeDelay = 30000000; // microseconds |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // destructor |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 CGlxThumbnailCompeserInactivityTimer::~CGlxThumbnailCompeserInactivityTimer() |
|
59 { |
|
60 // no implementation |
|
61 } |
|
62 |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // NewL |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 CGlxThumbnailCompeserInactivityTimer* CGlxThumbnailCompeserInactivityTimer::NewL(TInt aPriority, CGlxThumbnailComposerPlugin& aCallback) |
|
69 { |
|
70 TRACER("CGlxThumbnailCompeserInactivityTimer::NewL"); |
|
71 CGlxThumbnailCompeserInactivityTimer* self = |
|
72 new (ELeave) CGlxThumbnailCompeserInactivityTimer(aPriority, aCallback); |
|
73 CleanupStack::PushL(self); |
|
74 self->ConstructL(); |
|
75 CleanupStack::Pop(self); |
|
76 CActiveScheduler::Add(self); |
|
77 return self; |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // After |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 void CGlxThumbnailCompeserInactivityTimer::After( TTimeIntervalMicroSeconds32 aInterval ) |
|
85 { |
|
86 TRACER("CGlxThumbnailCompeserInactivityTimer::RunL"); |
|
87 |
|
88 // Fix for ELLZ-7DBBDZ and JPKN-7M2AYJ: to prevent a KERN EXEC 15 panic that occurs |
|
89 // if a timer request is made while one is already outstanding. |
|
90 Cancel(); |
|
91 // Forward the call on to the base class. |
|
92 CTimer::After( aInterval ); |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // constructor |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 CGlxThumbnailCompeserInactivityTimer::CGlxThumbnailCompeserInactivityTimer(TInt aPriority, CGlxThumbnailComposerPlugin& aCallback) |
|
100 : CTimer(aPriority), iCallback(aCallback) |
|
101 { |
|
102 // no implementation |
|
103 } |
|
104 |
|
105 // --------------------------------------------------------------------------- |
|
106 // RunL |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 void CGlxThumbnailCompeserInactivityTimer::RunL() |
|
110 { |
|
111 TRACER("CGlxThumbnailCompeserInactivityTimer::RunL"); |
|
112 switch (iCallback.iState) |
|
113 { |
|
114 case CGlxThumbnailComposerPlugin::EStateFirstOpening: |
|
115 case CGlxThumbnailComposerPlugin::EStateOpening: |
|
116 { |
|
117 iCallback.DoOpenCollectionL(); |
|
118 break; |
|
119 } |
|
120 case CGlxThumbnailComposerPlugin::EStateActiveSmall: |
|
121 case CGlxThumbnailComposerPlugin::EStateActiveLarge: |
|
122 { |
|
123 iCallback.DoRequestItemL(); |
|
124 break; |
|
125 } |
|
126 case CGlxThumbnailComposerPlugin::EStateClosing: |
|
127 { |
|
128 iCallback.CloseCollection(); |
|
129 break; |
|
130 } |
|
131 } |
|
132 } |
|
133 |
|
134 // --------------------------------------------------------------------------- |
|
135 // DoCancel |
|
136 // --------------------------------------------------------------------------- |
|
137 // |
|
138 void CGlxThumbnailCompeserInactivityTimer::DoCancel() |
|
139 { |
|
140 // no implementation |
|
141 } |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 // RunError |
|
145 // --------------------------------------------------------------------------- |
|
146 // |
|
147 TInt CGlxThumbnailCompeserInactivityTimer::RunError(TInt /*aError*/) |
|
148 { |
|
149 TRACER("CGlxThumbnailCompeserInactivityTimer::RunError"); |
|
150 iCallback.ReturnToIdle(); |
|
151 return KErrNone; |
|
152 } |
|
153 |
|
154 |
|
155 |
|
156 // --------------------------------------------------------------------------- |
|
157 // NewL |
|
158 // --------------------------------------------------------------------------- |
|
159 // |
|
160 CGlxThumbnailComposerPlugin* CGlxThumbnailComposerPlugin::NewL() |
|
161 { |
|
162 TRACER("CGlxThumbnailComposerPlugin::NewL"); |
|
163 CGlxThumbnailComposerPlugin* self = |
|
164 new (ELeave) CGlxThumbnailComposerPlugin(); |
|
165 CleanupStack::PushL(self); |
|
166 self->ConstructL(); |
|
167 CleanupStack::Pop(self); |
|
168 return self; |
|
169 } |
|
170 |
|
171 // --------------------------------------------------------------------------- |
|
172 // ~CGlxThumbnailComposerPlugin |
|
173 // --------------------------------------------------------------------------- |
|
174 // |
|
175 CGlxThumbnailComposerPlugin::~CGlxThumbnailComposerPlugin() |
|
176 { |
|
177 delete iPath; |
|
178 delete iCollectionUtility; |
|
179 if ( iInactivityTimer ) |
|
180 { |
|
181 iInactivityTimer->Cancel(); |
|
182 } |
|
183 delete iInactivityTimer; |
|
184 } |
|
185 |
|
186 // --------------------------------------------------------------------------- |
|
187 // CGlxThumbnailComposerPlugin |
|
188 // --------------------------------------------------------------------------- |
|
189 // |
|
190 CGlxThumbnailComposerPlugin::CGlxThumbnailComposerPlugin() : iLastError(KErrNone) |
|
191 { |
|
192 } |
|
193 |
|
194 // --------------------------------------------------------------------------- |
|
195 // ConstructL |
|
196 // --------------------------------------------------------------------------- |
|
197 // |
|
198 void CGlxThumbnailComposerPlugin::ConstructL() |
|
199 { |
|
200 TRACER("CGlxThumbnailComposerPlugin::ConstructL"); |
|
201 iInactivityTimer = CGlxThumbnailCompeserInactivityTimer::NewL(CActive::EPriorityIdle, *this); |
|
202 } |
|
203 |
|
204 // --------------------------------------------------------------------------- |
|
205 // SetObservers |
|
206 // --------------------------------------------------------------------------- |
|
207 // |
|
208 void CGlxThumbnailComposerPlugin::SetObservers() |
|
209 { |
|
210 TRAPD(err, SetObserversL()); |
|
211 GLX_ASSERT_ALWAYS( KErrNone == err, Panic( EGlxPanicEnvironment ), |
|
212 "CGlxThumbnailComposerPlugin cannot set observers, reset Harvester server" ); |
|
213 } |
|
214 |
|
215 // --------------------------------------------------------------------------- |
|
216 // SetObserversL |
|
217 // --------------------------------------------------------------------------- |
|
218 // |
|
219 void CGlxThumbnailComposerPlugin::SetObserversL() |
|
220 { |
|
221 TRACER("CGlxThumbnailComposerPlugin::SetObserversL"); |
|
222 if ( iSession ) |
|
223 { |
|
224 CMdELogicCondition* condition = |
|
225 CMdELogicCondition::NewLC( ELogicConditionOperatorOr ); |
|
226 |
|
227 #ifdef GLX_USE_MDS_2_0 |
|
228 |
|
229 CMdENamespaceDef* defaultNamespace = |
|
230 iSession->GetDefaultNamespaceDefL(); |
|
231 |
|
232 CMdEObjectDef* imageDef = defaultNamespace->GetObjectDefL( |
|
233 MdeConstants::Image::KImageObject ); |
|
234 condition->AddObjectConditionL( *imageDef ); |
|
235 |
|
236 CMdEObjectDef* videoDef = defaultNamespace->GetObjectDefL( |
|
237 MdeConstants::Video::KVideoObject ); |
|
238 condition->AddObjectConditionL( *videoDef ); |
|
239 |
|
240 #else |
|
241 |
|
242 CMdENamespaceDef& defaultNamespace = |
|
243 iSession->GetDefaultNamespaceDefL(); |
|
244 |
|
245 CMdEObjectDef& imageDef = defaultNamespace.GetObjectDefL( |
|
246 MdeConstants::Image::KImageObject ); |
|
247 condition->AddObjectConditionL( imageDef ); |
|
248 |
|
249 CMdEObjectDef& videoDef = defaultNamespace.GetObjectDefL( |
|
250 MdeConstants::Video::KVideoObject ); |
|
251 condition->AddObjectConditionL( videoDef ); |
|
252 |
|
253 #endif |
|
254 |
|
255 iSession->AddObjectObserverL( *this, condition ); |
|
256 CleanupStack::Pop( condition ); |
|
257 |
|
258 if ( iState == EStateIdle ) |
|
259 { |
|
260 iState = EStateFirstOpening; |
|
261 iInactivityTimer->After(KGlxThumbnailComposerLargeDelay); |
|
262 } |
|
263 } |
|
264 } |
|
265 |
|
266 // --------------------------------------------------------------------------- |
|
267 // RemoveObservers |
|
268 // --------------------------------------------------------------------------- |
|
269 // |
|
270 void CGlxThumbnailComposerPlugin::RemoveObservers() |
|
271 { |
|
272 if ( iSession ) |
|
273 { |
|
274 #ifdef GLX_USE_MDS_2_0 |
|
275 iSession->RemoveObjectObserver( *this ); |
|
276 #else |
|
277 TRAP_IGNORE(iSession->RemoveObjectObserverL( *this )); |
|
278 #endif |
|
279 } |
|
280 } |
|
281 |
|
282 // --------------------------------------------------------------------------- |
|
283 // IsComposingComplete |
|
284 // --------------------------------------------------------------------------- |
|
285 // |
|
286 TBool CGlxThumbnailComposerPlugin::IsComposingComplete() |
|
287 { |
|
288 TRACER("CGlxThumbnailComposerPlugin::IsComposingComplete"); |
|
289 return ( iState == EStateIdle ); |
|
290 } |
|
291 |
|
292 #ifdef GLX_USE_MDS_2_0 |
|
293 |
|
294 // --------------------------------------------------------------------------- |
|
295 // HandleObjectAdded |
|
296 // --------------------------------------------------------------------------- |
|
297 // |
|
298 void CGlxThumbnailComposerPlugin::HandleObjectAdded( |
|
299 CMdESession& /*aSession*/, const RArray<TItemId>& /*aObjectIdArray*/ ) |
|
300 { |
|
301 TRACER("CGlxThumbnailComposerPlugin::HandleObjectAdded"); |
|
302 if ( ( iState == EStateIdle ) || ( iState == EStateFirstOpening ) || ( iState == EStateClosing ) ) |
|
303 { |
|
304 iInactivityTimer->Cancel(); |
|
305 iState = EStateOpening; |
|
306 iInactivityTimer->After(20000000); |
|
307 } |
|
308 else |
|
309 { |
|
310 iLastError = 1; |
|
311 iState = EStateActiveLarge; |
|
312 } |
|
313 } |
|
314 |
|
315 // --------------------------------------------------------------------------- |
|
316 // HandleObjectModified |
|
317 // --------------------------------------------------------------------------- |
|
318 // |
|
319 void CGlxThumbnailComposerPlugin::HandleObjectModified( |
|
320 CMdESession& /*aSession*/, |
|
321 const RArray<TItemId>& /*aObjectIdArray*/) |
|
322 { |
|
323 //no implemention needed |
|
324 } |
|
325 |
|
326 // --------------------------------------------------------------------------- |
|
327 // HandleObjectRemoved |
|
328 // --------------------------------------------------------------------------- |
|
329 // |
|
330 void CGlxThumbnailComposerPlugin::HandleObjectRemoved( |
|
331 CMdESession& /*aSession*/, |
|
332 const RArray<TItemId>& /*aObjectIdArray*/) |
|
333 { |
|
334 //no implemention needed |
|
335 } |
|
336 |
|
337 #else |
|
338 |
|
339 void CGlxThumbnailComposerPlugin::HandleObjectNotification(CMdESession& /*aSession*/, |
|
340 TObserverNotificationType aType, |
|
341 const RArray<TItemId>& /*aObjectIdArray*/) |
|
342 { |
|
343 |
|
344 TRACER("CGlxThumbnailComposerPlugin::HandleObjectNotification"); |
|
345 if (aType == ENotifyAdd) |
|
346 { |
|
347 if ( iState == EStateIdle ) |
|
348 { |
|
349 iState = EStateOpening; |
|
350 iInactivityTimer->After(0); |
|
351 } |
|
352 else |
|
353 { |
|
354 iLastError = 1; |
|
355 iState = EStateActiveLarge; |
|
356 } |
|
357 } |
|
358 } |
|
359 |
|
360 #endif |
|
361 |
|
362 // --------------------------------------------------------------------------- |
|
363 // HandleCollectionMediaL |
|
364 // --------------------------------------------------------------------------- |
|
365 // |
|
366 void CGlxThumbnailComposerPlugin::HandleCollectionMediaL( |
|
367 const CMPXMedia& /*aMedia*/, TInt aError ) |
|
368 { |
|
369 TRACER("CGlxThumbnailComposerPlugin::HandleCollectionMediaL"); |
|
370 if ( iPath && KErrNone != aError ) |
|
371 { |
|
372 //GLX_LOG_WARNING1( "Error %d getting media", aError ); |
|
373 |
|
374 // Error generating thumbnails, try the next item |
|
375 iLastError = aError; |
|
376 iCurrentIndex++; |
|
377 RequestItemL(); |
|
378 } |
|
379 } |
|
380 |
|
381 // --------------------------------------------------------------------------- |
|
382 // HandleCollectionMessageL |
|
383 // --------------------------------------------------------------------------- |
|
384 // |
|
385 void CGlxThumbnailComposerPlugin::HandleCollectionMessage( |
|
386 CMPXMessage* aMsg, TInt /*aErr*/ ) |
|
387 { |
|
388 TRACER("CGlxThumbnailComposerPlugin::HandleCollectionMessage"); |
|
389 if ( iState != EStateIdle && aMsg ) |
|
390 { |
|
391 TRAPD( err, DoHandleCollectionMessageL( *aMsg ) ); |
|
392 if ( KErrNone != err ) |
|
393 { |
|
394 //GLX_LOG_WARNING1( "Error %d handling message", err ); |
|
395 ReturnToIdle(); |
|
396 } |
|
397 } |
|
398 } |
|
399 |
|
400 // --------------------------------------------------------------------------- |
|
401 // HandleOpenL |
|
402 // --------------------------------------------------------------------------- |
|
403 // |
|
404 void CGlxThumbnailComposerPlugin::HandleOpenL( const CMPXMedia& /*aEntries*/, |
|
405 TInt /*aIndex*/, TBool /*aComplete*/, TInt aError ) |
|
406 { |
|
407 TRACER("CGlxThumbnailComposerPlugin::HandleOpenL"); |
|
408 if ( KErrNone != aError ) |
|
409 { |
|
410 //GLX_LOG_WARNING1( "Error %d opening collection", aError ); |
|
411 ReturnToIdle(); |
|
412 } |
|
413 } |
|
414 |
|
415 // --------------------------------------------------------------------------- |
|
416 // HandleOpenL |
|
417 // --------------------------------------------------------------------------- |
|
418 // |
|
419 void CGlxThumbnailComposerPlugin::HandleOpenL( |
|
420 const CMPXCollectionPlaylist& /*aPlaylist*/, TInt /*aError*/ ) |
|
421 { |
|
422 // No implemention needed |
|
423 } |
|
424 |
|
425 // --------------------------------------------------------------------------- |
|
426 // HandleCommandComplete |
|
427 // --------------------------------------------------------------------------- |
|
428 // |
|
429 void CGlxThumbnailComposerPlugin::HandleCommandComplete( |
|
430 CMPXCommand* /*aCommandResult*/, TInt /*aError*/ ) |
|
431 { |
|
432 TRACER("CGlxThumbnailComposerPlugin::HandleCommandComplete"); |
|
433 if( EStateCleanup == iState ) |
|
434 { |
|
435 ReturnToIdle(); |
|
436 } |
|
437 else |
|
438 { |
|
439 iInactivityTimer->After(0); |
|
440 } |
|
441 } |
|
442 |
|
443 // --------------------------------------------------------------------------- |
|
444 // DoOpenCollectionL |
|
445 // --------------------------------------------------------------------------- |
|
446 // |
|
447 void CGlxThumbnailComposerPlugin::DoOpenCollectionL() |
|
448 { |
|
449 TRACER("CGlxThumbnailComposerPlugin::HandleCollectionMediaL"); |
|
450 if ( !iCollectionUtility ) |
|
451 { |
|
452 // Open isolated collection utility |
|
453 iCollectionUtility = MMPXCollectionUtility::NewL( |
|
454 this, KMcModeIsolated ); |
|
455 } |
|
456 |
|
457 CMPXFilter* filter = CMPXFilter::NewL(); |
|
458 CleanupStack::PushL(filter); |
|
459 filter->SetTObjectValueL<TGlxFilterSortDirection>(KGlxFilterGeneralSortDirection, EGlxFilterSortDirectionDescending); |
|
460 iCollectionUtility->Collection().SetFilterL(filter); |
|
461 CleanupStack::PopAndDestroy(filter); |
|
462 |
|
463 CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
|
464 CleanupStack::PushL( path ); |
|
465 // argument path all collection id |
|
466 path->AppendL( KGlxCollectionPluginAllImplementationUid ); |
|
467 |
|
468 iCollectionUtility->Collection().OpenL( *path ); |
|
469 CleanupStack::PopAndDestroy( path ); |
|
470 |
|
471 iState = EStateActiveSmall; |
|
472 } |
|
473 |
|
474 // --------------------------------------------------------------------------- |
|
475 // DoHandleCollectionMessageL |
|
476 // --------------------------------------------------------------------------- |
|
477 // |
|
478 void CGlxThumbnailComposerPlugin::DoHandleCollectionMessageL( |
|
479 const CMPXMessage& aMsg ) |
|
480 { |
|
481 TRACER("CGlxThumbnailComposerPlugin::DoHandleCollectionMessageL"); |
|
482 if ( aMsg.IsSupported( KMPXMessageGeneralId ) ) |
|
483 { |
|
484 TInt messageId = aMsg.ValueTObjectL<TInt>( KMPXMessageGeneralId ); |
|
485 |
|
486 // Is it a background thumbnail message |
|
487 if ( KGlxMessageIdBackgroundThumbnail == messageId ) |
|
488 { |
|
489 // Is it the item expected |
|
490 TGlxMediaId id( ( TUint32 ) |
|
491 aMsg.ValueTObjectL<TMPXItemId>( KGlxBackgroundThumbnailMediaId ) ); |
|
492 if ( iPath && id.Value() |
|
493 == ( TUint32 )iPath->IdOfIndex( iCurrentIndex ) ) |
|
494 { |
|
495 TInt error = aMsg.ValueTObjectL<TInt>( KGlxBackgroundThumbnailError ); |
|
496 if ( error == KErrCancel ) |
|
497 { |
|
498 iState = EStateActiveLarge; |
|
499 iLastError = error; |
|
500 } |
|
501 else if( KErrNone != error ) |
|
502 { |
|
503 //GLX_LOG_WARNING1( "Error %d in command", error ); |
|
504 error = KErrNone; |
|
505 } |
|
506 // Yes, then request the next item |
|
507 iCurrentIndex++; |
|
508 RequestItemL(); |
|
509 } |
|
510 } |
|
511 else if ( KMPXMessageGeneral == messageId |
|
512 && aMsg.IsSupported( KMPXMessageGeneralEvent ) ) |
|
513 { |
|
514 TInt messageEvent = aMsg.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ); |
|
515 |
|
516 // Is it a path changed event |
|
517 if ( TMPXCollectionMessage::EPathChanged == messageEvent |
|
518 && aMsg.IsSupported( KMPXMessageGeneralType ) ) |
|
519 { |
|
520 TInt messageType = aMsg.ValueTObjectL<TInt>( KMPXMessageGeneralType ); |
|
521 |
|
522 if ( EMcPathChangedByOpen == messageType |
|
523 && iCollectionUtility && !iPath ) |
|
524 { |
|
525 iPath = iCollectionUtility->Collection().PathL(); |
|
526 |
|
527 iCurrentIndex = 0; |
|
528 RequestItemL(); |
|
529 } |
|
530 } |
|
531 } |
|
532 } |
|
533 } |
|
534 |
|
535 // --------------------------------------------------------------------------- |
|
536 // RequestItemL |
|
537 // --------------------------------------------------------------------------- |
|
538 // |
|
539 void CGlxThumbnailComposerPlugin::RequestItemL() |
|
540 { |
|
541 TRACER("CGlxThumbnailComposerPlugin::RequestItemL"); |
|
542 if ( iLastError == KErrCancel ) |
|
543 { |
|
544 iInactivityTimer->Inactivity(KGlxThumbnailComposerInactivityTimeout); |
|
545 } |
|
546 else if ( iLastError == 1 ) |
|
547 { |
|
548 iInactivityTimer->After(KGlxThumbnailComposerHarvestDelay); |
|
549 } |
|
550 else |
|
551 { |
|
552 iInactivityTimer->After(KGlxThumbnailComposerDelay); |
|
553 } |
|
554 iLastError = KErrNone; |
|
555 } |
|
556 |
|
557 // --------------------------------------------------------------------------- |
|
558 // DoRequestItemL |
|
559 // --------------------------------------------------------------------------- |
|
560 // |
|
561 void CGlxThumbnailComposerPlugin::DoRequestItemL() |
|
562 { |
|
563 TRACER("CGlxThumbnailComposerPlugin::DoRequestItemL"); |
|
564 |
|
565 if ( iPath && iCurrentIndex < iPath->Count() ) |
|
566 { |
|
567 GLX_ASSERT_ALWAYS( iCollectionUtility, Panic( EGlxPanicNullPointer ), |
|
568 "No collection utility" ); |
|
569 // request next item |
|
570 iPath->Set( iCurrentIndex ); |
|
571 |
|
572 RArray<TMPXAttribute> attrs; |
|
573 CleanupClosePushL( attrs ); |
|
574 // Add thumbnail attribute |
|
575 attrs.AppendL( TMPXAttribute( |
|
576 KGlxMediaIdThumbnail, KGlxBackgroundThumbnailAttributeId ) ); |
|
577 |
|
578 // Don't add spec for bitmap handle, to request background thumbnail |
|
579 CMPXAttributeSpecs* attrSpecs = NULL; |
|
580 |
|
581 // Start first task |
|
582 iCollectionUtility->Collection().MediaL( |
|
583 *iPath, attrs.Array(), attrSpecs ); |
|
584 CleanupStack::PopAndDestroy( &attrs ); |
|
585 } |
|
586 else |
|
587 { |
|
588 delete iPath; |
|
589 iPath = NULL; |
|
590 |
|
591 if ( iState == EStateActiveLarge ) |
|
592 { |
|
593 // go on to do small thumbnails |
|
594 DoOpenCollectionL(); |
|
595 } |
|
596 else |
|
597 { |
|
598 CMPXCommand* command |
|
599 = TGlxCommandFactory::ThumbnailCleanupCommandLC(); |
|
600 iCollectionUtility->Collection().CommandL( *command ); |
|
601 CleanupStack::PopAndDestroy( command ); |
|
602 |
|
603 iState = EStateCleanup; |
|
604 } |
|
605 } |
|
606 } |
|
607 |
|
608 // --------------------------------------------------------------------------- |
|
609 // ReturnToIdle |
|
610 // --------------------------------------------------------------------------- |
|
611 // |
|
612 void CGlxThumbnailComposerPlugin::ReturnToIdle() |
|
613 { |
|
614 iState = EStateClosing; |
|
615 iInactivityTimer->After(KGlxThumbnailComposerLargeDelay); |
|
616 } |
|
617 |
|
618 // --------------------------------------------------------------------------- |
|
619 // CloseCollection |
|
620 // --------------------------------------------------------------------------- |
|
621 // |
|
622 void CGlxThumbnailComposerPlugin::CloseCollection() |
|
623 { |
|
624 if ( ( EStateClosing == iState ) && iCollectionUtility ) |
|
625 { |
|
626 iCollectionUtility->Close(); |
|
627 iCollectionUtility = NULL; |
|
628 iState = EStateIdle; |
|
629 } |
|
630 } |
|