--- a/photosgallery/viewframework/views/gridview/src/glxgridviewmlobserver.cpp Wed Sep 15 12:13:06 2010 +0300
+++ b/photosgallery/viewframework/views/gridview/src/glxgridviewmlobserver.cpp Wed Oct 13 14:32:09 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -55,30 +55,25 @@
// ---------------------------------------------------------------------------
//
EXPORT_C CGlxGridViewMLObserver* CGlxGridViewMLObserver::NewL(
- MHgScrollBufferObserver& aHgScrollBufferObs,
MGlxMediaList& aMediaList, CHgGrid* aHgGrid,
TGlxFilterItemType aFilterType)
{
TRACER("CGlxGridViewMLObserver::NewL()");
CGlxGridViewMLObserver* self = new (ELeave) CGlxGridViewMLObserver(
- aHgScrollBufferObs, aMediaList, aHgGrid, aFilterType);
+ aMediaList, aHgGrid, aFilterType);
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self);
return self;
}
-
// ---------------------------------------------------------------------------
// C++ default constructor can NOT contain any code, that
// might leave.
// ---------------------------------------------------------------------------
//
-CGlxGridViewMLObserver::CGlxGridViewMLObserver(
- MHgScrollBufferObserver& aHgScrollBufferObs,
- MGlxMediaList& aMediaList, CHgGrid* aHgGrid,
- TGlxFilterItemType aFilterType) :
- iHgScrollBufferObs(aHgScrollBufferObs), iMediaList(aMediaList), iHgGrid(
- aHgGrid), iFilterType(aFilterType)
+CGlxGridViewMLObserver::CGlxGridViewMLObserver(MGlxMediaList& aMediaList,
+ CHgGrid* aHgGrid, TGlxFilterItemType aFilterType) :
+ iMediaList(aMediaList), iHgGrid(aHgGrid), iFilterType(aFilterType)
{
TRACER("CGlxGridViewMLObserver::CGlxGridViewMLObserver()");
}
@@ -86,7 +81,7 @@
// ---------------------------------------------------------------------------
// Symbian 2nd phase constructor can leave.
// ---------------------------------------------------------------------------
-//
+//
void CGlxGridViewMLObserver::ConstructL()
{
TRACER("CGlxGridViewMLObserver::ConstructL()");
@@ -99,19 +94,19 @@
iGridIconSize = uiUtility->GetGridIconSize();
iItemsPerPage = uiUtility->VisibleItemsInPageGranularityL();
CleanupStack::PopAndDestroy(uiUtility);
-
- iQualityTnAttrib = TMPXAttribute (KGlxMediaIdThumbnail,
- GlxFullThumbnailAttributeId( ETrue, iGridIconSize.iWidth,
+
+ iQualityTnAttrib = TMPXAttribute (KGlxMediaIdThumbnail,
+ GlxFullThumbnailAttributeId( ETrue, iGridIconSize.iWidth,
iGridIconSize.iHeight ) );
- iSpeedTnAttrib = TMPXAttribute (KGlxMediaIdThumbnail,
- GlxFullThumbnailAttributeId( EFalse, iGridIconSize.iWidth,
+ iSpeedTnAttrib = TMPXAttribute (KGlxMediaIdThumbnail,
+ GlxFullThumbnailAttributeId( EFalse, iGridIconSize.iWidth,
iGridIconSize.iHeight ) );
-
+
iIconsFileName.Append(KDC_APP_BITMAP_DIR);
iIconsFileName.Append(KGlxIconsFilename);
iIsDefaultIconSet = EFalse;
-
+
iDiskErrorIntimated = EFalse;
}
@@ -133,8 +128,8 @@
// ----------------------------------------------------------------------------
// HandleItemAddedL
// ----------------------------------------------------------------------------
-//
-void CGlxGridViewMLObserver::HandleItemAddedL( TInt aStartIndex, TInt aEndIndex,
+//
+void CGlxGridViewMLObserver::HandleItemAddedL( TInt aStartIndex, TInt aEndIndex,
MGlxMediaList* aList )
{
TRACER("CGlxGridViewMLObserver::HandleItemAddedL()");
@@ -152,14 +147,14 @@
TTime startTime;
GLX_LOG_INFO("CGlxGridViewMLObserver::HandleItemAddedL - ResizeL(+)");
startTime.HomeTime();
-#endif
+#endif
iHgGrid->ResizeL(aList->Count());
#ifdef _DEBUG
TTime stopTime;
stopTime.HomeTime();
GLX_DEBUG2("CGlxGridViewMLObserver::HandleItemAddedL - ResizeL(-) took <%d> us",
(TInt)stopTime.MicroSecondsFrom(startTime).Int64());
-#endif
+#endif
}
else
{
@@ -173,65 +168,46 @@
// ----------------------------------------------------------------------------
// HandleItemRemoved
// ----------------------------------------------------------------------------
-//
-void CGlxGridViewMLObserver::HandleItemRemovedL( TInt aStartIndex,
+//
+void CGlxGridViewMLObserver::HandleItemRemovedL( TInt aStartIndex,
TInt aEndIndex, MGlxMediaList* aList )
{
TRACER("CGlxGridViewMLObserver::HandleItemRemovedL()");
- GLX_DEBUG3("CGlxGridViewMLObserver::HandleItemRemovedL() aStartIndex(%d), aEndIndex(%d)",
- aStartIndex, aEndIndex);
if (iHgGrid)
{
- TInt mediaCount = aList->Count();
- // If the last item is also deleted, refresh the view
- if (mediaCount <= 0)
+ TInt mediaCount = aList->Count();
+
+ for (TInt i = aEndIndex; i>= aStartIndex; i--)
{
- if (iMediaList.VisibleWindowIndex() > iMediaList.Count())
- {
- iMediaList.SetVisibleWindowIndexL(0);
- }
- //This is done since the Hg doesnot refresh the screen
- //when we remove all the items from the grid
- GLX_LOG_INFO("CGlxGridViewMLObserver::HandleItemRemovedL - Hg Reset");
- iHgGrid->DrawDeferred();
- iHgGrid->Reset();
- return;
+ iHgGrid->RemoveItem(i);
}
- if (aStartIndex == aEndIndex)
- {
- iHgGrid->RemoveItem(aStartIndex);
- }
- else
- {
- GLX_LOG_INFO("CGlxGridViewMLObserver::HandleItemRemovedL - Hg RemoveItems(+)");
- // Need to disable the buffering support until HgGrid data model
- // is synced with Medialist; Otherwise, RequestL would result in
- // requesting same index for the no of items removed.
- iHgGrid->DisableScrollBuffer();
- for (TInt i = aEndIndex; i >= aStartIndex; i--)
+ // If the last item is also deleted, this refreshes the view
+ if (mediaCount <=0)
+ {
+ if(iMediaList.VisibleWindowIndex() > iMediaList.Count())
{
- iHgGrid->RemoveItem(i);
- }
- // Enable Buffer support
- iHgGrid->EnableScrollBufferL(iHgScrollBufferObs, (KNoOfPages
- * iItemsPerPage), KBufferTresholdSize);
- GLX_LOG_INFO("CGlxGridViewMLObserver::HandleItemRemovedL - Hg RemoveItems(-)");
+ iMediaList.SetVisibleWindowIndexL(0);
+ }
+ //This is done since the Hg doesnot refresh the screen
+ //when we remove all the items from the grid
+ iHgGrid->DrawDeferred();
+ iHgGrid->Reset();
+ return;
+ }
+ else if (iMediaList.VisibleWindowIndex() > iMediaList.Count())
+ {
+ iMediaList.SetVisibleWindowIndexL(iMediaList.Count()-1);
}
-
- if (iMediaList.VisibleWindowIndex() > iMediaList.Count())
- {
- iMediaList.SetVisibleWindowIndexL(iMediaList.Count() - 1);
- }
- iHgGrid->RefreshScreen(iHgGrid->FirstIndexOnScreen());
+ iHgGrid->RefreshScreen(iHgGrid->FirstIndexOnScreen());
}
}
// ----------------------------------------------------------------------------
// HandleAttributesAvailableL
// ----------------------------------------------------------------------------
-//
-void CGlxGridViewMLObserver::HandleAttributesAvailableL( TInt aItemIndex,
+//
+void CGlxGridViewMLObserver::HandleAttributesAvailableL( TInt aItemIndex,
const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* /*aList*/ )
{
TRACER("CGlxGridViewMLObserver::HandleAttributesAvailableL()");
@@ -290,20 +266,20 @@
CHgItem::EHgItemFlagsNone);
}
}
-
- //Now Update the items with the DRM/video icon and date/time
+
+ //Now Update the items with the DRM/video icon and date/time
UpdateItemsL(aItemIndex,aAttributes);
-
+
//Now refresh the screen based on the attributes available index
RefreshScreenL(aItemIndex,aAttributes);
}
-
+
// ----------------------------------------------------------------------------
// HandleFocusChangedL
// ----------------------------------------------------------------------------
-//
+//
void CGlxGridViewMLObserver::HandleFocusChangedL( NGlxListDefs::
- TFocusChangeType /*aType*/, TInt aNewIndex, TInt aOldIndex,
+ TFocusChangeType /*aType*/, TInt aNewIndex, TInt aOldIndex,
MGlxMediaList* /*aList*/ )
{
TRACER("CGlxGridViewMLObserver::HandleFocusChangedL()");
@@ -323,8 +299,8 @@
// ----------------------------------------------------------------------------
// HandleItemSelected
// ----------------------------------------------------------------------------
-//
-void CGlxGridViewMLObserver::HandleItemSelectedL(TInt /*aIndex*/,
+//
+void CGlxGridViewMLObserver::HandleItemSelectedL(TInt /*aIndex*/,
TBool /*aSelected*/, MGlxMediaList* /*aList*/ )
{
TRACER("CGlxGridViewMLObserver::HandleItemSelectedL()");
@@ -333,18 +309,18 @@
// ----------------------------------------------------------------------------
// HandleMessageL
// ----------------------------------------------------------------------------
-//
- void CGlxGridViewMLObserver::HandleMessageL( const CMPXMessage& /*aMessage*/,
+//
+ void CGlxGridViewMLObserver::HandleMessageL( const CMPXMessage& /*aMessage*/,
MGlxMediaList* /*aList*/ )
{
TRACER("CGlxGridViewMLObserver::HandleMessageL()");
}
-
+
// ----------------------------------------------------------------------------
// HandleError
// ----------------------------------------------------------------------------
//
-void CGlxGridViewMLObserver::HandleError( TInt /*aError*/ )
+void CGlxGridViewMLObserver::HandleError( TInt /*aError*/ )
{
TRACER("CGlxGridViewMLObserver::HandleError()");
TRAP_IGNORE(HandleErrorL());
@@ -359,15 +335,15 @@
TRACER("CGlxGridViewMLObserver::HandleErrorL()");
TInt bitmapId = EMbmGlxiconsQgn_prop_image_corrupted;
- TInt maskId = EMbmGlxiconsQgn_prop_image_corrupted_mask;
+ TInt maskId = EMbmGlxiconsQgn_prop_image_corrupted_mask;
TInt flags = CHgItem::EHgItemFlagsNone ;
-
+
for ( TInt i = 0; i < iMediaList.Count(); i++ )
{
const TGlxMedia& item = iMediaList.Item( i );
TInt thumbnailError = GlxErrorManager::HasAttributeErrorL(
item.Properties(), KGlxMediaIdThumbnail );
-
+
if (KErrNone != thumbnailError)
{
switch (thumbnailError)
@@ -402,19 +378,19 @@
}
}
- break;
+ break;
}
-
+
SetIconL(i, bitmapId, maskId, flags);
}
}
- iHgGrid->RefreshScreen(iHgGrid->FirstIndexOnScreen());
+ iHgGrid->RefreshScreen(iHgGrid->FirstIndexOnScreen());
}
// ----------------------------------------------------------------------------
// SetIconL
// ----------------------------------------------------------------------------
-//
+//
void CGlxGridViewMLObserver::SetIconL(TInt aItemIndex, TInt aBitmapId,
TInt aMaskId, TInt aFlags)
{
@@ -440,17 +416,17 @@
// ----------------------------------------------------------------------------
// HandleCommandCompleteL
// ----------------------------------------------------------------------------
-//
-void CGlxGridViewMLObserver::HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/,
+//
+void CGlxGridViewMLObserver::HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/,
TInt /*aError*/, MGlxMediaList* /*aList*/ )
{
TRACER("CGlxGridViewMLObserver::HandleCommandCompleteL()");
}
-
+
// ----------------------------------------------------------------------------
// HandleMediaL
// ----------------------------------------------------------------------------
-//
+//
void CGlxGridViewMLObserver::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ )
{
TRACER("CGlxGridViewMLObserver::HandleMediaL()");
@@ -489,22 +465,22 @@
GLX_DEBUG2("GridMLObserver::HandlePopulatedL() iMediaList.Count()=%d",
iMediaList.Count());
-
+
if (iMediaList.Count() <= 0)
{
GLX_DEBUG1("GridMLObserver::HandlePopulatedL() - SetEmptyTextL()");
iHgGrid->DrawNow();
}
-
+
GLX_DEBUG1("GridMLObserver::HandlePopulatedL() - SetDefaultIconL()");
SetDefaultIconL(ETrue);
}
}
-
+
// ----------------------------------------------------------------------------
// HandleItemModifiedL
// ----------------------------------------------------------------------------
-//
+//
void CGlxGridViewMLObserver::HandleItemModifiedL(const RArray<TInt>& aItemIndexes,
MGlxMediaList* /*aList*/)
{
@@ -513,9 +489,9 @@
{
TInt modifiedIndex = aItemIndexes[index];
iModifiedIndexes.AppendL(modifiedIndex);
- }
+ }
}
-
+
// ----------------------------------------------------------------------------
// HasRelevantThumbnailAttribute
// ----------------------------------------------------------------------------
@@ -530,7 +506,7 @@
iSpeedTnAttrib );
if ( qualityTn || speedTn )
{
- GLX_DEBUG1("GridMLObserver::HasRelevantThumbnail() - TN avail");
+ GLX_DEBUG1("GridMLObserver::HasRelevantThumbnail() - TN avail");
return ETrue;
}
return EFalse;
@@ -540,7 +516,7 @@
// ----------------------------------------------------------------------------
// RefreshScreenL
// ----------------------------------------------------------------------------
-//
+//
void CGlxGridViewMLObserver::RefreshScreenL(TInt aItemIndex,
const RArray<TMPXAttribute>& aAttributes)
{
@@ -566,11 +542,11 @@
firstIndex))
{
GLX_DEBUG2("GridMLObserver::HandleAttributesAvailableL()"
- " RefreshScreen - aItemIndex(%d)", aItemIndex);
+ " RefreshScreen - aItemIndex(%d)", aItemIndex);
iHgGrid->RefreshScreen(aItemIndex);
}
}
-
+
if (!iIsDefaultIconSet)
{
GLX_DEBUG1("GridMLObserver::HandleAttributesAvailableL()"
@@ -589,17 +565,17 @@
if ( HasRelevantThumbnail(lastOnScreen) )
{
GLX_DEBUG2("GridMLObserver::HandleAttributesAvailableL()"
- " RefreshScreen - aItemIndex(%d)", aItemIndex);
+ " RefreshScreen - aItemIndex(%d)", aItemIndex);
iHgGrid->RefreshScreen(aItemIndex);
}
else if (aItemIndex == lastOnScreen)
{
GLX_DEBUG2("GridMLObserver::HandleAttributesAvailableL()"
- " RefreshScreen - lastOnScreen(%d)", lastOnScreen);
+ " RefreshScreen - lastOnScreen(%d)", lastOnScreen);
iHgGrid->RefreshScreen(lastOnScreen);
}
}
-
+
if (!iIsDefaultIconSet)
{
GLX_DEBUG1("GridMLObserver::HandleAttributesAvailableL()"
@@ -608,12 +584,12 @@
}
}
}
-
- if (iModifiedIndexes.Count() > 0)
+
+ if (iModifiedIndexes.Count() > 0)
{
for(TInt index = 0;index<iModifiedIndexes.Count();index++)
{
- if (iModifiedIndexes[index] == aItemIndex &&
+ if (iModifiedIndexes[index] == aItemIndex &&
HasRelevantThumbnail(aItemIndex))
{
GLX_DEBUG2("GridMLObserver::HandleAttributesAvailableL()"
@@ -625,19 +601,19 @@
}
}
}
-
+
// ----------------------------------------------------------------------------
// UpdateItemsL
// ----------------------------------------------------------------------------
-//
-void CGlxGridViewMLObserver::UpdateItemsL(TInt aItemIndex,
+//
+void CGlxGridViewMLObserver::UpdateItemsL(TInt aItemIndex,
const RArray<TMPXAttribute>& aAttributes)
{
TRACER("CGlxGridViewMLObserver::UpdateItemsL()");
TInt mediaCount = iMediaList.Count();
const TGlxMedia& item = iMediaList.Item( aItemIndex );
TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match );
-
+
if (aAttributes.Find(KMPXMediaDrmProtected, match) != KErrNotFound)
{
if (item.IsDrmProtected())
@@ -651,9 +627,9 @@
* fix for EABI-7RKHDG
* to show the invalid DRM icon
*/
- TMPXGeneralCategory cat = item.Category();
+ TMPXGeneralCategory cat = item.Category();
TBool checkViewRights = (cat==EMPXImage);
-
+
if(iDRMUtility->ItemRightsValidityCheckL(uri, checkViewRights))
{
iHgGrid->ItemL(aItemIndex).SetFlags(
@@ -665,11 +641,11 @@
CHgItem::EHgItemFlagsDrmRightsExpired);
}
}
- else
+ else
{
- TMPXGeneralCategory cat = item.Category();
+ TMPXGeneralCategory cat = item.Category();
TBool checkViewRights = (cat==EMPXImage);
-
+
if(iDRMUtility->ItemRightsValidityCheckL(uri, checkViewRights))
{
iHgGrid->ItemL(aItemIndex).SetFlags(
@@ -684,7 +660,7 @@
}
}
}
-
+
if (aAttributes.Find(KMPXMediaGeneralDate, match) != KErrNotFound)
{
TTime time(0);
@@ -693,20 +669,20 @@
iHgGrid->ItemL(aItemIndex).SetTime(time);
}
}
-
+
if (aAttributes.Find(KMPXMediaGeneralCategory, match) != KErrNotFound)
{
if (item.Category() == EMPXVideo)
{
iHgGrid->ItemL(aItemIndex).SetFlags(CHgItem::EHgItemFlagsVideo);
}
- }
+ }
}
-
+
// ----------------------------------------------------------------------------
// DisplayErrorNoteL
// ----------------------------------------------------------------------------
-//
+//
void CGlxGridViewMLObserver::DisplayErrorNoteL(TInt aError)
{
TRACER("CGlxGridViewMLObserver::DisplayErrorNoteL()");
@@ -720,7 +696,7 @@
// ----------------------------------------------------------------------------
// SetDefaultIconL
// ----------------------------------------------------------------------------
-//
+//
void CGlxGridViewMLObserver::SetDefaultIconL(TBool aTransparent)
{
TRACER("CGlxGridViewMLObserver::SetDefaultIconL()");
@@ -735,7 +711,7 @@
TSize bmpSize = CHgGrid::PreferredImageSize();
bitmap->Create(bmpSize, EColor16M);
mask->Create(bmpSize, EGray256); // Gray mask
- const TInt scanlineLength = bmpSize.iWidth; // 1 byte per pixel
+ const TInt scanlineLength = bmpSize.iWidth; // 1 byte per pixel
RBuf8 maskData;
maskData.Create(scanlineLength);
maskData.FillZ(scanlineLength); // Init with zero
@@ -750,7 +726,7 @@
mask->EndDataAccess();
iHgGrid->SetDefaultIconL(CGulIcon::NewL(bitmap, mask));
CleanupStack::Pop(mask);
- CleanupStack::Pop(bitmap);
+ CleanupStack::Pop(bitmap);
}
else if (!iIsDefaultIconSet)
{