37 #include "glxnavigablelist.h" |
37 #include "glxnavigablelist.h" |
38 #include "mglxfetchcontext.h" |
38 #include "mglxfetchcontext.h" |
39 #include "mglxmedialistobserver.h" |
39 #include "mglxmedialistobserver.h" |
40 #include "glxmediastaticitemdefs.h" |
40 #include "glxmediastaticitemdefs.h" |
41 |
41 |
42 /** |
|
43 * Min & Max wait interval for a modify event, in microseconds |
|
44 * This is to allow thumbnail manager to procees the event first. |
|
45 */ |
|
46 const TInt KModifyEventMinWaitInterval = 2000000; |
|
47 const TInt KModifyEventMaxWaitInterval = 3000000; |
|
48 /** |
|
49 * Maximum items count for minimum wait interval. |
|
50 */ |
|
51 const TInt KMaxItemsCount = 500; |
|
52 namespace NGlxMediaList |
42 namespace NGlxMediaList |
53 { |
43 { |
54 /** |
44 /** |
55 * Interface to notify observers. Allows different notifications to use |
45 * Interface to notify observers. Allows different notifications to use |
56 * the same (complicated) iteration loop |
46 * the same (complicated) iteration loop |
1518 MGlxMediaListObserver* obs = iItemListObservers[obsIdx]; |
1508 MGlxMediaListObserver* obs = iItemListObservers[obsIdx]; |
1519 obs->HandleItemModifiedL(itemIndices, this); |
1509 obs->HandleItemModifiedL(itemIndices, this); |
1520 } |
1510 } |
1521 |
1511 |
1522 CleanupStack::PopAndDestroy(&itemIndices); |
1512 CleanupStack::PopAndDestroy(&itemIndices); |
1523 RPointerArray<CGlxMediaList>& mediaLists = iMediaListArray->Array(); |
|
1524 TInt listCount = mediaLists.Count(); |
|
1525 GLX_DEBUG2("ML:HandleItemModifiedL listCount=%d", listCount); |
|
1526 if (listCount > 0) |
|
1527 { |
|
1528 CGlxMediaList* mediaList = mediaLists[listCount-1]; |
|
1529 // Force a delay to allow TNM to process the modified event |
|
1530 if (mediaList == this) |
|
1531 { |
|
1532 GLX_DEBUG3("ML:HandleItemModifiedL(wait) listCount=%d, Id=%d", |
|
1533 listCount, id.Value()); |
|
1534 TTimeIntervalMicroSeconds32 timeout; |
|
1535 timeout = (mediaList->Count() > KMaxItemsCount ? |
|
1536 KModifyEventMaxWaitInterval : KModifyEventMinWaitInterval ); |
|
1537 RTimer timer; |
|
1538 CleanupClosePushL(timer); |
|
1539 TRequestStatus status; |
|
1540 timer.CreateLocal(); |
|
1541 timer.After(status, timeout); |
|
1542 // User::WaitForRequest() will add codescanner warning but is necessary |
|
1543 // as User::WaitForAnyRequest() cannot be used in this case |
|
1544 User::WaitForRequest(status); |
|
1545 CleanupStack::PopAndDestroy(&timer); |
|
1546 } |
|
1547 } |
|
1548 } |
1513 } |
1549 } |
1514 } |
1550 |
1515 |
1551 // ----------------------------------------------------------------------------- |
1516 // ----------------------------------------------------------------------------- |
1552 // NotifyObserversOfMediaL |
1517 // NotifyObserversOfMediaL |