Revision: 201033 RCL_3 PDK_3.0.3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 14 Sep 2010 21:19:17 +0300
branchRCL_3
changeset 64 34937ec34dac
parent 60 5b3385a43d68
child 68 5b238bc8ffb6
Revision: 201033 Kit: 201035
photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmds.cpp
photosgallery/gallery/inc/glxappui.h
photosgallery/gallery/src/glxappui.cpp
photosgallery/imgvwr/src/glxivwrappui.cpp
photosgallery/viewframework/commandhandlers/commandhandlerbase/group/glxcommandhandlerbase.mmp
photosgallery/viewframework/commandhandlers/commandhandlerbase/src/glxmpxcommandcommandhandler.cpp
photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerslideshow.h
photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlernewmedia.cpp
photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerslideshow.cpp
photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxmediaselectionpopup.cpp
photosgallery/viewframework/dataprovider/bwins/glxdataprovideru.def
photosgallery/viewframework/dataprovider/inc/glxdrmgiftexturecreator.h
photosgallery/viewframework/dataprovider/inc/glxmulmodelproviderbase.h
photosgallery/viewframework/dataprovider/src/glxdetailsmulmodelproviderimpl.cpp
photosgallery/viewframework/dataprovider/src/glxdrmgiftexturecreator.cpp
photosgallery/viewframework/dataprovider/src/glxmedialistmulmodelproviderimpl.cpp
photosgallery/viewframework/dataprovider/src/glxmulmodelproviderbase.cpp
photosgallery/viewframework/drmutility/group/glxdrmutility.mmp
photosgallery/viewframework/drmutility/src/glxdrmutility.cpp
photosgallery/viewframework/medialists/src/glxattributecontext.cpp
photosgallery/viewframework/tvout/src/glxhdmicontroller.cpp
photosgallery/viewframework/uiutilities/src/glxprogressindicator.cpp
photosgallery/viewframework/views/cloudview/inc/glxcloudviewcontrol.h
photosgallery/viewframework/views/cloudview/inc/glxtagscontextmenucontrol.h
photosgallery/viewframework/views/cloudview/src/glxcloudviewcontrol.cpp
photosgallery/viewframework/views/cloudview/src/glxcloudviewimp.cpp
photosgallery/viewframework/views/cloudview/src/glxtagscontextmenucontrol.cpp
photosgallery/viewframework/views/fullscreenview/inc/glxfullscreenviewimp.h
photosgallery/viewframework/views/fullscreenview/src/glxfullscreenviewimp.cpp
photosgallery/viewframework/views/listview/src/glxlistviewimp.cpp
photosgallery/viewframework/views/listview/src/glxpreviewthumbnailbinding.cpp
photosgallery/viewframework/views/metadatadialog/inc/glxmetadatacontainer.h
photosgallery/viewframework/views/metadatadialog/src/glxmetadatacontainer.cpp
photosgallery/viewframework/views/viewbase/src/glxmedialistviewbase.cpp
--- a/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmds.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmds.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -314,6 +314,10 @@
         {
         __ASSERT_DEBUG((EGlxFilterImage == aFilterProperties.iItemType), Panic(
                 EGlxPanicIllegalArgument));
+
+        CMdEPropertyDef& drmProperty = DataSource()->ImageDef().GetPropertyDefL(MdeConstants::MediaObject::KDRMProperty);
+        CMdEPropertyCondition& drmPropertyCondition = aLogicCondition.AddPropertyConditionL(drmProperty);
+        drmPropertyCondition.SetNegate(ETrue);
         }
         
     if( aFilterProperties.iPath )          // If this is set. Then we need to filter on the Ids it supplies
--- a/photosgallery/gallery/inc/glxappui.h	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/gallery/inc/glxappui.h	Tue Sep 14 21:19:17 2010 +0300
@@ -153,25 +153,33 @@
     void ReserveMemoryL(TEntryType aType);
 
     //OOM
-    /*
-    *Invoked by the OOM framwork when photos app needs to free memory for other applications.
-    */
+    /**
+     * Invoked by the OOM framework FreeRam event 
+     * to free the memory for other applications.
+     */
     void StartCleanupL();
 
     //OOM
-    /*
-    *Invoked by the OOM framwork when photos app needs to free memory for other applications.
-    */
+    /**
+     * Invoked by the OOM framework MemoryGood event 
+     * to stop the memory clean-up operation.
+     */
     void StopCleanupL();
-	
-	/**
+
+    /**
      * Check for updates via IAD.
      */
     void DoCheckForIADUpdatesL();
+    
     /**
      * close photos app.
      */
-     void ClosePhotosL();
+    void ClosePhotosL();
+
+    /**
+     * Open navigational state at root level
+     */
+    void NavigateToMainListL();
 
 private:
     MMPXViewUtility* iViewUtility;
@@ -202,23 +210,17 @@
      * IAD updater class
      */
     CGlxIadUpdate* iIadUpdate;
-	
-    /**
-    *This flag to chk whether red key has been pressed
-    */
-    TBool iEndKeyPressed;
 
     /**
-     *Timer to check for IAD updates 30 seconds after application startup.
+     * Timer to check for IAD updates 30 seconds after application startup.
      */
-     CPeriodic* iPeriodic ;
-     
-     /**
-      * Flag to filter any spurious EPathChanged event from MPX Collection f/w.
-      */     
-     TBool iStateChangeRequested;
-} ;
+    CPeriodic* iPeriodic;
 
+    /**
+     * Flag to filter any spurious EPathChanged event from MPX Collection f/w.
+     */
+    TBool iStateChangeRequested;
+    };
 
 #endif // C_GLXWERAPPUI_H
 
--- a/photosgallery/gallery/src/glxappui.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/gallery/src/glxappui.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -60,6 +60,10 @@
 #include <hal_data.h>
 #include <oommonitorsession.h>
 #include <glxtracer.h>
+#include <glxmedialist.h>
+#include <glxmedialistiterator.h>
+#include <glxattributecontext.h>
+#include <glxattributeretriever.h>
 
 //OOM
 #include <oommonitorplugin.h>
@@ -119,7 +123,6 @@
     ReserveMemoryL(EEntryTypeStartUp);
     // publish zoom context, no zoom keys for now
     NGlxZoomStatePublisher::PublishStateL( EFalse );
-    iEndKeyPressed = EFalse;
     iStateChangeRequested = EFalse;
     }
 
@@ -130,7 +133,6 @@
 CGlxAppUi::~CGlxAppUi()
     {
     TRACER("CGlxAppUi::~CGlxAppUi()");
-	iEndKeyPressed = EFalse;
     if ( iNavigationalState )
         {
         iNavigationalState->RemoveObserver(*this);
@@ -243,12 +245,7 @@
     TRAPD(err, HandleActivationMessageL(aCommand, aDocumentName, aTail));
     if ( KErrNone != err )
         {
-        // Open navigational state at root level
-        CMPXCollectionPath* newState = CMPXCollectionPath::NewL();
-        CleanupStack::PushL( newState );
-        iNavigationalState->NavigateToL( *newState );
-        iStateChangeRequested = ETrue;
-        CleanupStack::PopAndDestroy( newState );
+        NavigateToMainListL();
         }
 
     //Start a timer to check for thr IAD update after 60 Secs.
@@ -453,12 +450,7 @@
 
     if (aData.Length() == 0 )
         {
-        // Open navigational state at root level
-        CMPXCollectionPath* newState = CMPXCollectionPath::NewL();
-        CleanupStack::PushL(newState);
-        iNavigationalState->NavigateToL(*newState);
-        iStateChangeRequested = ETrue;
-        CleanupStack::PopAndDestroy(newState);
+        NavigateToMainListL();
         }
     else
         {
@@ -468,6 +460,21 @@
     }
 
 // ---------------------------------------------------------------------------
+// NavigateToMainListL
+// ---------------------------------------------------------------------------
+//
+void CGlxAppUi::NavigateToMainListL()
+    {
+    TRACER("void CGlxAppUi::NavigateToMainListL()");
+    // Open navigational state at root level
+    CMPXCollectionPath* collPath = CMPXCollectionPath::NewL();
+    CleanupStack::PushL(collPath);
+    iNavigationalState->NavigateToL(*collPath);
+    iStateChangeRequested = ETrue;
+    CleanupStack::PopAndDestroy(collPath);
+    }
+
+// ---------------------------------------------------------------------------
 // HandleActivationMessageL
 // ---------------------------------------------------------------------------
 //
@@ -485,8 +492,8 @@
     RDesReadStream stream(aData);
     CleanupClosePushL(stream);
     stream >> msgUid;
-    
-    switch ( msgUid.iUid )
+
+    switch (msgUid.iUid)
         {
         case KGlxActivationCmdShowLastModified:
         case KGlxActivationCameraAlbum:
@@ -494,17 +501,64 @@
             {
             GLX_LOG_INFO("CGlxAppUi::HandleActivationMessageL: Creating Screen Clearer");
             iUiUtility->DisplayScreenClearerL();
+
             HBufC8* activationParam = HBufC8::NewLC(KMaxUidName);
+            // While harvesting is in progress, activate the Camera Album 
+            // instead of All grid. However, do not change the activation
+            // parameter as it is used within photos.
             activationParam->Des().AppendNum(KGlxActivationCmdShowAll);
             SetActivationParamL(*activationParam);
             CleanupStack::PopAndDestroy(activationParam);
-            
-            // Go to All grid view
-            GLX_LOG_INFO("CGlxAppUi::HandleActivationMessageL: All Grid View");
+
             // Send the command to reset the view
             ProcessCommandL(EGlxCmdResetView);
             iNavigationalState->SetBackExitStatus(ETrue);
-            path->AppendL(KGlxCollectionPluginAllImplementationUid);
+            
+            // 1)While harvesting is going on, TNM publishes itemsleft 'PSkey' value.
+            //      After harvesting is over, itemsleft count will be 0.
+            // 2)Tnm sets the value to KErrNotReady until it gets the total count while harvesting.
+            //      TNM doesn't update the key value in batches. It updates @ a single shot. 
+            //      so need to check against KErrNotReady also.
+            if (iUiUtility->GetItemsLeftCount() == KErrNotReady
+                    || iUiUtility->GetItemsLeftCount())
+                {
+                // Go to Camera Album grid view
+                GLX_LOG_INFO("CGlxAppUi::HandleActivationMessageL: Camera Album Grid View");
+                path->AppendL(KGlxCollectionPluginAlbumsImplementationUid);
+                MGlxMediaList* mediaList = MGlxMediaList::InstanceL(*path);
+                CleanupClosePushL(*mediaList);
+
+                TGlxSequentialIterator iter;
+                CGlxAttributeContext* attributeContext =
+                        new (ELeave) CGlxAttributeContext(&iter);
+                CleanupStack::PushL(attributeContext);
+                iter.SetRange(1);
+                attributeContext->AddAttributeL(KMPXMediaGeneralTitle);
+                mediaList->AddContextL(attributeContext,
+                        KGlxFetchContextPriorityBlocking);
+                TRAPD(err, GlxAttributeRetriever::RetrieveL(
+                        *attributeContext, *mediaList, EFalse));
+                if (err != KErrNone)
+                    {
+                    mediaList->RemoveContext(attributeContext);
+                    User::Leave( err);
+                    }
+                TInt count = mediaList->Count();
+                GLX_LOG_INFO1("CGlxAppUi::HandleActivationMessageL() count=%d", count);
+                __ASSERT_DEBUG(count != 0, Panic(EGlxPanicRequiredItemNotFound));
+
+                path->AppendL(TMPXItemId(mediaList->Item(0).Id().Value()));
+
+                mediaList->RemoveContext(attributeContext);
+                CleanupStack::PopAndDestroy(attributeContext);
+                CleanupStack::PopAndDestroy(mediaList);
+                }
+            else
+                {
+                // Go to All grid view
+                GLX_LOG_INFO("CGlxAppUi::HandleActivationMessageL: All Grid View");
+                path->AppendL(KGlxCollectionPluginAllImplementationUid);
+                }
             }
             break;
 
@@ -514,10 +568,10 @@
         }
     CleanupStack::PopAndDestroy(&stream);
     iNavigationalState->SetStartingLevel(path->Levels());
-    iNavigationalState->NavigateToL( *path );
+    iNavigationalState->NavigateToL(*path);
     iStateChangeRequested = ETrue;
     CleanupStack::PopAndDestroy(path);
-    
+
     // Introduced to fix bug EMJN-78GH6N. 
     if (0 != iEikonEnv->RootWin().OrdinalPosition())
         {
@@ -649,36 +703,34 @@
 // Handle OOM events.
 // ---------------------------------------------------------------------------
 //
+void CGlxAppUi::HandleApplicationSpecificEventL(TInt aEventType,
+        const TWsEvent& aWsEvent)
+    {
+    TRACER("CGlxAppUi::HandleApplicationSpecificEventL");
+    GLX_LOG_INFO1("CGlxAppUi::HandleApplicationSpecificEventL() aEventType=%d", aEventType);
 
-void CGlxAppUi::HandleApplicationSpecificEventL(TInt aEventType, const TWsEvent& aWsEvent)
-{
-TRACER("CGlxAppUi::HandleApplicationSpecificEventL");
-CAknViewAppUi::HandleApplicationSpecificEventL(aEventType,aWsEvent);
-	if(aWsEvent.Type() == KAknUidValueEndKeyCloseEvent)
-		{
-		/**
-		* Making the flag etrue ensures that it will not call LaunchMmViewL in handlecommandl while 
-		* red key is pressed. Otherwise it will launch matrix menu, not idle screen. 
-		*/
-		iEndKeyPressed = ETrue;
-		ClosePhotosL();
-		}
-switch(aEventType)	
-	{
-	case KAppOomMonitor_FreeRam:
-		{
-		StartCleanupL();				
-		}
-		break;
-	case KAppOomMonitor_MemoryGood:
-		{
-		StopCleanupL();
-		}
-		break;
-	default:
-		break;
-	}
-}
+    CAknViewAppUi::HandleApplicationSpecificEventL(aEventType, aWsEvent);
+    if (aWsEvent.Type() == KAknUidValueEndKeyCloseEvent)
+        {
+        ClosePhotosL();
+        }
+
+    switch (aEventType)
+        {
+        case KAppOomMonitor_FreeRam:
+            {
+            StartCleanupL();
+            }
+            break;
+        case KAppOomMonitor_MemoryGood:
+            {
+            StopCleanupL();
+            }
+            break;
+        default:
+            break;
+        }
+    }
 
 // ---------------------------------------------------------------------------
 // StartCleanup
@@ -687,6 +739,7 @@
 //
 void CGlxAppUi::StartCleanupL()
     {
+    TRACER("CGlxAppUi::StartCleanupL");
     MGlxCache* cacheManager = MGlxCache::InstanceL();
     cacheManager->ReleaseRAML();
     cacheManager->Close();
@@ -699,6 +752,7 @@
 //
 void CGlxAppUi::StopCleanupL()
     {
+    TRACER("CGlxAppUi::StopCleanupL");
     MGlxCache* cacheManager = MGlxCache::InstanceL();
     cacheManager->StopRAMReleaseL();
     cacheManager->Close();
--- a/photosgallery/imgvwr/src/glxivwrappui.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/imgvwr/src/glxivwrappui.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -37,7 +37,7 @@
 #include <glxtracer.h>
 #include <glxlog.h>
 #include <glxivwr.rsg>
-
+#include <eikbtgpc.h>
 
 
 //constants
@@ -73,7 +73,13 @@
 
     // Enable Avkon skins.
     BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible );
-
+     
+    // Hide status pane
+	StatusPane()->MakeVisible(EFalse);
+	// Hide Softkeys
+	CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
+	cba->MakeVisible(EFalse); 
+       
     // Create navigational state 
     iNavigationalState = CGlxNavigationalState::InstanceL();
     iNavigationalState->AddObserverL( *this );
--- a/photosgallery/viewframework/commandhandlers/commandhandlerbase/group/glxcommandhandlerbase.mmp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/group/glxcommandhandlerbase.mmp	Tue Sep 14 21:19:17 2010 +0300
@@ -86,5 +86,6 @@
 LIBRARY         commonengine.lib
 LIBRARY         caf.lib
 LIBRARY         libpthread.lib
+LIBRARY			eikdlg.lib
 // End of File
 
--- a/photosgallery/viewframework/commandhandlers/commandhandlerbase/src/glxmpxcommandcommandhandler.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/src/glxmpxcommandcommandhandler.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -531,21 +531,26 @@
     // get progress note 
     HBufC* progressText = ProgressTextL(aCommandId);
     __ASSERT_DEBUG(progressText, Panic(EGlxPanicNullDescriptor));
-	CleanupStack::PushL(progressText);
+    CleanupStack::PushL(progressText);
     // construct progress dialog
-	iProgressDialog = new(ELeave)CAknProgressDialog(
-			(REINTERPRET_CAST(CEikDialog**,&iProgressDialog)));
-	iProgressDialog->PrepareLC(R_GLX_PROGRESS_NOTE); 
-	iProgressDialog->SetTextL(*progressText);
-	iProgressDialog->SetCallback(this);
-	
+    iProgressDialog = new (ELeave) CAknProgressDialog(
+            (REINTERPRET_CAST(CEikDialog**,&iProgressDialog)));
+    iProgressDialog->PrepareLC(R_GLX_PROGRESS_NOTE);
+    if (aCommandId == EGlxCmdRename)
+        {
+        iProgressDialog->ButtonGroupContainer().SetCommandSetL(
+                R_AVKON_SOFTKEYS_EMPTY);
+        }
+    iProgressDialog->SetTextL(*progressText);
+    iProgressDialog->SetCallback(this);
+
     // pick up progress info so that progress notification can be later updated
-	iProgressInfo = iProgressDialog->GetProgressInfoL();
-	
+    iProgressInfo = iProgressDialog->GetProgressInfoL();
+
     // launch the note
-	iProgressDialog->RunLD();
-	CleanupStack::PopAndDestroy(progressText); 
-	}
+    iProgressDialog->RunLD();
+    CleanupStack::PopAndDestroy(progressText);
+    }
 
 // -----------------------------------------------------------------------------
 // DismissProgressNoteL
--- a/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerslideshow.h	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerslideshow.h	Tue Sep 14 21:19:17 2010 +0300
@@ -70,6 +70,9 @@
     TBool DoIsDisabled(TInt aCommandId, MGlxMediaList& aList) const;
     /// @ref CGlxMediaListCommandHandler::BypassFiltersForExecute
     TBool BypassFiltersForExecute() const;
+    /// @ref CGlxMediaListCommandHandler::DynInitMenuPaneL
+    void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane, 
+                            TBool aIsBrowseMode);
     /// @ref CGlxCommandHandler::PopulateToolbar
     void PopulateToolbarL();
 private:    // From MGlxMediaListObserver
--- a/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlernewmedia.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlernewmedia.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -11,17 +11,13 @@
 *
 * Contributors:
 *
-* Description:    Delete command handler
+* Description:    New media command handler
 *
 */
 
 
 
 
-/**
- * @internal reviewed 06/06/2007 by Dave Schofield
- */
-
 #include "glxcommandhandlernewmedia.h"
 
 #include <AknUtils.h>
@@ -297,14 +293,18 @@
             KGlxMediaCollectionPluginSpecificDefaultMediaTitle);
     rootList->AddContextL(attributeContext, KGlxFetchContextPriorityBlocking);
 
-    TGlxFetchContextRemover contextRemover(attributeContext, *rootList);
-    // put to cleanupstack as cleanupstack is emptied before stack objects
-    // are deleted
-    CleanupClosePushL(contextRemover);
-    User::LeaveIfError(GlxAttributeRetriever::RetrieveL(*attributeContext,
-            *rootList, ETrue));
-    // context off the list
-    CleanupStack::PopAndDestroy(&contextRemover);
+    // Media list must not have been deleted when the destructor of 
+    // TGlxContextRemover is called while going out-of-scope.
+        {
+        TGlxFetchContextRemover contextRemover(attributeContext, *rootList);
+        // put to cleanupstack as cleanupstack is emptied before stack objects
+        // are deleted
+        CleanupClosePushL(contextRemover);
+        User::LeaveIfError(GlxAttributeRetriever::RetrieveL(
+                *attributeContext, *rootList, ETrue));
+        // context off the list
+        CleanupStack::PopAndDestroy(&contextRemover);
+        } // Limiting scope of contextRemover
 
     TInt index = rootList->Index(KGlxIdSpaceIdRoot, aCollectionId);
 
--- a/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerslideshow.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerslideshow.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -46,6 +46,8 @@
 #include <glxsettingsmodel.h>
 #include <glxupnprenderer.h> // get UPnP state
 #include <glxgeneraluiutilities.h>
+#include <glxthumbnailattributeinfo.h>
+
 namespace
 	{
 	const TInt KShwDefaultBufferSize = 128;
@@ -553,4 +555,95 @@
             CAknButton::EPositionLeft);
 	}
 
+// -----------------------------------------------------------------------------
+// DynInitMenuPaneL
+// -----------------------------------------------------------------------------
+//
+void CGlxCommandHandlerSlideshow::DynInitMenuPaneL(TInt /*aResourceId*/,
+        CEikMenuPane* aMenuPane, TBool aIsBrowseMode)
+    {
+    TRACER("CGlxCommandHandlerSlideshow::DynInitMenuPaneL");
+    MGlxMediaList& mediaList = MediaList();
+    if (aMenuPane)
+        {
+        TInt pos = 0;
+        if (mediaList.Count())
+            {
+            TInt focusIndex = mediaList.FocusIndex();
+            if (!aIsBrowseMode && focusIndex > KErrNotFound && focusIndex
+                    < mediaList.Count())
+                {
+                if (aMenuPane->MenuItemExists(EGlxCmdSlideshowPlay, pos))
+                    {
+                    const TGlxMedia& media = mediaList.Item(focusIndex);
+                    if (EMPXVideo == media.Category())
+                        {
+                        aMenuPane->SetItemDimmed(EGlxCmdSlideshowPlay, ETrue);
+                        }
+                    else
+                        {
+                        CEikMenuPaneItem::SData& item =
+                                aMenuPane->ItemDataByIndexL(pos);
+                        if (item.iFlags & EEikMenuItemSpecific)
+                            {
+                            TSize tnSize = iUiUtility->GetGridIconSize();
+                            TMPXAttribute thumbnailAttribute(
+                                    KGlxMediaIdThumbnail,
+                                    GlxFullThumbnailAttributeId(ETrue,
+                                            tnSize.iWidth, tnSize.iHeight));
+
+                            const CGlxThumbnailAttribute* value =
+                                    media.ThumbnailAttribute(
+                                            thumbnailAttribute);
+
+                            // No thumbnail available, hence there might be
+                            // no vaild items to play slideshow
+                            if (!value)
+                                {
+                                aMenuPane->SetItemDimmed(
+                                        EGlxCmdSlideshowPlay, ETrue);
+                                }
+                            }
+                        }
+                    }
+                }
+
+            if (aIsBrowseMode)
+                {
+                if (aMenuPane->MenuItemExists(EGlxCmdSlideshow, pos)
+                        && mediaList.SelectionCount())
+                    {
+                    aMenuPane->SetItemDimmed(EGlxCmdSlideshow, ETrue);
+                    }
+
+                if (aMenuPane->MenuItemExists(EGlxCmdSlideshowPlay, pos)
+                        && mediaList.SelectionCount() == 0)
+                    {
+                    CEikMenuPaneItem::SData& item =
+                            aMenuPane->ItemDataByIndexL(pos);
+                    if (item.iFlags & EEikMenuItemSpecific
+                            && EMPXVideo == mediaList.Item(
+                                    mediaList.FocusIndex()).Category())
+                        {
+                        aMenuPane->SetItemDimmed(EGlxCmdSlideshowPlay, ETrue);
+                        }
+                    }
+                }
+            }
+        else
+            {
+            if (aMenuPane->MenuItemExists(EGlxCmdSlideshowPlay, pos))
+                {
+                aMenuPane->SetItemDimmed(EGlxCmdSlideshowPlay, ETrue);
+                }
+
+            if (aMenuPane->MenuItemExists(EGlxCmdSlideshow, pos))
+                {
+                aMenuPane->SetItemDimmed(EGlxCmdSlideshow, ETrue);
+                }
+            }
+        }
+    }
+
+
 // End of File
--- a/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxmediaselectionpopup.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxmediaselectionpopup.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -15,11 +15,6 @@
 *
 */
 
-
-/**
- * @internal reviewed 06/06/2007 by Dave Schofield
- * @internal reviewed 13/07/2007 by Aki Vanhatalo
- */
 // INCLUDE FILES
 
 #include "glxmediaselectionpopup.h"
@@ -248,8 +243,14 @@
 					{
 					cbaContainer->SetCommandSetL(R_AVKON_SOFTKEYS_CANCEL);
 					}
+                //LSK / SK1’s visibility is determined by the screen context, if single click support enabled.
+                //As suggested by Avkon, disable the CEikCba’s item specific softkey default behavior.
+				CEikCba* eikCba = static_cast<CEikCba*>( cbaContainer->ButtonGroup() );
+				if( eikCba )
+					{
+					eikCba->EnableItemSpecificSoftkey( EFalse );
+					}
 				cbaContainer->DrawDeferred();
-
                 }
             listBox->DrawDeferred();
 
@@ -334,7 +335,9 @@
 		const TKeyEvent& aKeyEvent, TEventCode aType)
 	{
     TRACER("CGlxSingleGraphicPopupMenuStyleListBox::OfferKeyEventL");
-
+    //Note: To add custom implementation to OfferKeyEventL(), change 
+    //CAknSingleGraphicPopupMenuStyleListBox to CGlxSingleGraphicPopupMenuStyleListBox.
+    
     //Based on the selected item index, disable the MultipleSelection flag
     //to stop the flickering of 'marked box', when Highlighted 'New Tag' is selected.
     CGlxMediaListAdaptor* mediaListAdaptor =
@@ -485,11 +488,9 @@
 
     iMediaList->RemoveMediaListObserver(this); // We no longer require any callbacks from the media list
 
-
     CMPXCollectionPath* path = NULL;
     if (aAccepted)
         {
-
 		//Check if a static item is selected
 		if (iMediaListAdaptor->IsStaticItemSelected())
             {
@@ -519,7 +520,6 @@
                 // The error is neither KErrNone or KErrCancel, leave.
                 User::Leave(error);
                 }
-
             }
         else
             {
@@ -885,14 +885,18 @@
             KGlxMediaCollectionPluginSpecificSelectMediaPopupTitle);
     rootList->AddContextL(attributeContext, KGlxFetchContextPriorityBlocking);
 
-    // TGlxContextRemover will remove the context when it goes out of scope
-    // Used here to avoid a trap and still have safe cleanup   
-    TGlxFetchContextRemover contextRemover(attributeContext, *rootList);
-    CleanupClosePushL(contextRemover);
-    User::LeaveIfError(GlxAttributeRetriever::RetrieveL(*attributeContext,
-            *rootList, EFalse));
-    // context off the list
-    CleanupStack::PopAndDestroy(&contextRemover);
+    // Media list must not have been deleted when the destructor of 
+    // TGlxContextRemover is called while going out-of-scope.
+        {
+        // TGlxContextRemover will remove the context when it goes out of scope
+        // Used here to avoid a trap and still have safe cleanup   
+        TGlxFetchContextRemover contextRemover(attributeContext, *rootList);
+        CleanupClosePushL(contextRemover);
+        User::LeaveIfError(GlxAttributeRetriever::RetrieveL(
+                *attributeContext, *rootList, EFalse));
+        // context off the list
+        CleanupStack::PopAndDestroy(&contextRemover);
+        } // Limiting scope of contextRemover
 
     TInt index = rootList->Index(KGlxIdSpaceIdRoot, iCollectionId);
 
--- a/photosgallery/viewframework/dataprovider/bwins/glxdataprovideru.def	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/dataprovider/bwins/glxdataprovideru.def	Tue Sep 14 21:19:17 2010 +0300
@@ -19,23 +19,23 @@
 	?AddMpxAttributeBindingL@TGlxMulBindingSetFactory@@IBEXABW4TVisualAttribute@mulvisualitem@Alf@@ABVTMPXAttribute@@H@Z @ 18 NONAME ; void TGlxMulBindingSetFactory::AddMpxAttributeBindingL(enum Alf::mulvisualitem::TVisualAttribute const &, class TMPXAttribute const &, int) const
 	??0TGlxMulBindingSetFactory@@IAE@XZ @ 19 NONAME ; TGlxMulBindingSetFactory::TGlxMulBindingSetFactory(void)
 	??1CGlxDetailsMulModelProvider@@UAE@XZ @ 20 NONAME ; CGlxDetailsMulModelProvider::~CGlxDetailsMulModelProvider(void)
-	??1CGlxMediaListMulModelProvider@@UAE@XZ @ 21 NONAME ; CGlxMediaListMulModelProvider::~CGlxMediaListMulModelProvider(void)
-	?NewL@CGlxMediaListMulModelProvider@@SAPAV1@AAVCAlfEnv@@AAVIMulWidget@Alf@@AAVMGlxMediaList@@ABVTGlxMulBindingSetFactory@@W4TLogicalTemplate@mulwidget@4@H@Z @ 22 NONAME ; class CGlxMediaListMulModelProvider * CGlxMediaListMulModelProvider::NewL(class CAlfEnv &, class Alf::IMulWidget &, class MGlxMediaList &, class TGlxMulBindingSetFactory const &, enum Alf::mulwidget::TLogicalTemplate, int)
-	?HideLocationMenuItem@CGlxDetailsMulModelProvider@@QAEXAAVCEikMenuPane@@@Z @ 23 NONAME ; void CGlxDetailsMulModelProvider::HideLocationMenuItem(class CEikMenuPane &)
-	?NewL@CGlxDescriptionBoundCommand@@SAPAV1@XZ @ 24 NONAME ; class CGlxDescriptionBoundCommand * CGlxDescriptionBoundCommand::NewL(void)
-	?AddFullScreenThumbnailBindingL@TGlxMulBindingSetFactory@@IBEXABW4TVisualAttribute@mulvisualitem@Alf@@@Z @ 25 NONAME ; void TGlxMulBindingSetFactory::AddFullScreenThumbnailBindingL(enum Alf::mulvisualitem::TVisualAttribute const &) const
-	?AddIconBindingL@TGlxMulBindingSetFactory@@IBEXABW4TVisualAttribute@mulvisualitem@Alf@@PBVCGlxMulIconProvider@@ABVTSize@@@Z @ 26 NONAME ; void TGlxMulBindingSetFactory::AddIconBindingL(enum Alf::mulvisualitem::TVisualAttribute const &, class CGlxMulIconProvider const *, class TSize const &) const
-	?NewL@CGlxAttributeRequirements@@SAPAV1@AAVMGlxMediaList@@@Z @ 27 NONAME ; class CGlxAttributeRequirements * CGlxAttributeRequirements::NewL(class MGlxMediaList &)
-	?EnableMskL@CGlxDetailsMulModelProvider@@QAEXXZ @ 28 NONAME ; void CGlxDetailsMulModelProvider::EnableMskL(void)
-	?NewL@CGlxMulLocationIconProvider@@SAPAV1@XZ @ 29 NONAME ; class CGlxMulLocationIconProvider * CGlxMulLocationIconProvider::NewL(void)
-	?AddCommandBindingL@TGlxMulBindingSetFactory@@IBEXPAVMGlxBoundCommand@@@Z @ 30 NONAME ; void TGlxMulBindingSetFactory::AddCommandBindingL(class MGlxBoundCommand *) const
-	?NewL@CGlxDateAndTimeBoundCommand@@SAPAV1@XZ @ 31 NONAME ; class CGlxDateAndTimeBoundCommand * CGlxDateAndTimeBoundCommand::NewL(void)
-	?AddTemplateBindingL@TGlxMulBindingSetFactory@@IBEXW4TLogicalTemplate@mulwidget@Alf@@0@Z @ 32 NONAME ; void TGlxMulBindingSetFactory::AddTemplateBindingL(enum Alf::mulwidget::TLogicalTemplate, enum Alf::mulwidget::TLogicalTemplate) const
-	?NewL@CGlxFileSizeBoundCommand@@SAPAV1@XZ @ 33 NONAME ; class CGlxFileSizeBoundCommand * CGlxFileSizeBoundCommand::NewL(void)
-	?NewL@CGlxMulStaticIconProvider@@SAPAV1@H@Z @ 34 NONAME ; class CGlxMulStaticIconProvider * CGlxMulStaticIconProvider::NewL(int)
-	?NewL@CGlxMulVideoIconProvider@@SAPAV1@H@Z @ 35 NONAME ; class CGlxMulVideoIconProvider * CGlxMulVideoIconProvider::NewL(int)
-	?AddThumbnailBindingL@TGlxMulBindingSetFactory@@IBEXABW4TVisualAttribute@mulvisualitem@Alf@@ABVTSize@@@Z @ 36 NONAME ; void TGlxMulBindingSetFactory::AddThumbnailBindingL(enum Alf::mulvisualitem::TVisualAttribute const &, class TSize const &) const
-	?NewL@CGlxMulDriveIconProvider@@SAPAV1@XZ @ 37 NONAME ; class CGlxMulDriveIconProvider * CGlxMulDriveIconProvider::NewL(void)
-	?NewL@CGlxDetailsMulModelProvider@@SAPAV1@AAVCAlfEnv@@AAVIMulWidget@Alf@@AAVMGlxMediaList@@W4TLogicalTemplate@mulwidget@4@H@Z @ 38 NONAME ; class CGlxDetailsMulModelProvider * CGlxDetailsMulModelProvider::NewL(class CAlfEnv &, class Alf::IMulWidget &, class MGlxMediaList &, enum Alf::mulwidget::TLogicalTemplate, int)
-	?AnimateDRMGifItem@CGlxMediaListMulModelProvider@@QAEXH@Z @ 39 NONAME ; void CGlxMediaListMulModelProvider::AnimateDRMGifItem(int)
+	?AnimateDRMGifItem@CGlxMediaListMulModelProvider@@QAEXH@Z @ 21 NONAME ; void CGlxMediaListMulModelProvider::AnimateDRMGifItem(int)
+	??1CGlxMediaListMulModelProvider@@UAE@XZ @ 22 NONAME ; CGlxMediaListMulModelProvider::~CGlxMediaListMulModelProvider(void)
+	?NewL@CGlxMediaListMulModelProvider@@SAPAV1@AAVCAlfEnv@@AAVIMulWidget@Alf@@AAVMGlxMediaList@@ABVTGlxMulBindingSetFactory@@W4TLogicalTemplate@mulwidget@4@H@Z @ 23 NONAME ; class CGlxMediaListMulModelProvider * CGlxMediaListMulModelProvider::NewL(class CAlfEnv &, class Alf::IMulWidget &, class MGlxMediaList &, class TGlxMulBindingSetFactory const &, enum Alf::mulwidget::TLogicalTemplate, int)
+	?HideLocationMenuItem@CGlxDetailsMulModelProvider@@QAEXAAVCEikMenuPane@@@Z @ 24 NONAME ; void CGlxDetailsMulModelProvider::HideLocationMenuItem(class CEikMenuPane &)
+	?NewL@CGlxDescriptionBoundCommand@@SAPAV1@XZ @ 25 NONAME ; class CGlxDescriptionBoundCommand * CGlxDescriptionBoundCommand::NewL(void)
+	?AddFullScreenThumbnailBindingL@TGlxMulBindingSetFactory@@IBEXABW4TVisualAttribute@mulvisualitem@Alf@@@Z @ 26 NONAME ; void TGlxMulBindingSetFactory::AddFullScreenThumbnailBindingL(enum Alf::mulvisualitem::TVisualAttribute const &) const
+	?AddIconBindingL@TGlxMulBindingSetFactory@@IBEXABW4TVisualAttribute@mulvisualitem@Alf@@PBVCGlxMulIconProvider@@ABVTSize@@@Z @ 27 NONAME ; void TGlxMulBindingSetFactory::AddIconBindingL(enum Alf::mulvisualitem::TVisualAttribute const &, class CGlxMulIconProvider const *, class TSize const &) const
+	?NewL@CGlxAttributeRequirements@@SAPAV1@AAVMGlxMediaList@@@Z @ 28 NONAME ; class CGlxAttributeRequirements * CGlxAttributeRequirements::NewL(class MGlxMediaList &)
+	?EnableMskL@CGlxDetailsMulModelProvider@@QAEXXZ @ 29 NONAME ; void CGlxDetailsMulModelProvider::EnableMskL(void)
+	?NewL@CGlxMulLocationIconProvider@@SAPAV1@XZ @ 30 NONAME ; class CGlxMulLocationIconProvider * CGlxMulLocationIconProvider::NewL(void)
+	?AddCommandBindingL@TGlxMulBindingSetFactory@@IBEXPAVMGlxBoundCommand@@@Z @ 31 NONAME ; void TGlxMulBindingSetFactory::AddCommandBindingL(class MGlxBoundCommand *) const
+	?NewL@CGlxDateAndTimeBoundCommand@@SAPAV1@XZ @ 32 NONAME ; class CGlxDateAndTimeBoundCommand * CGlxDateAndTimeBoundCommand::NewL(void)
+	?AddTemplateBindingL@TGlxMulBindingSetFactory@@IBEXW4TLogicalTemplate@mulwidget@Alf@@0@Z @ 33 NONAME ; void TGlxMulBindingSetFactory::AddTemplateBindingL(enum Alf::mulwidget::TLogicalTemplate, enum Alf::mulwidget::TLogicalTemplate) const
+	?NewL@CGlxFileSizeBoundCommand@@SAPAV1@XZ @ 34 NONAME ; class CGlxFileSizeBoundCommand * CGlxFileSizeBoundCommand::NewL(void)
+	?NewL@CGlxMulStaticIconProvider@@SAPAV1@H@Z @ 35 NONAME ; class CGlxMulStaticIconProvider * CGlxMulStaticIconProvider::NewL(int)
+	?NewL@CGlxMulVideoIconProvider@@SAPAV1@H@Z @ 36 NONAME ; class CGlxMulVideoIconProvider * CGlxMulVideoIconProvider::NewL(int)
+	?AddThumbnailBindingL@TGlxMulBindingSetFactory@@IBEXABW4TVisualAttribute@mulvisualitem@Alf@@ABVTSize@@@Z @ 37 NONAME ; void TGlxMulBindingSetFactory::AddThumbnailBindingL(enum Alf::mulvisualitem::TVisualAttribute const &, class TSize const &) const
+	?NewL@CGlxMulDriveIconProvider@@SAPAV1@XZ @ 38 NONAME ; class CGlxMulDriveIconProvider * CGlxMulDriveIconProvider::NewL(void)
+	?NewL@CGlxDetailsMulModelProvider@@SAPAV1@AAVCAlfEnv@@AAVIMulWidget@Alf@@AAVMGlxMediaList@@W4TLogicalTemplate@mulwidget@4@H@Z @ 39 NONAME ; class CGlxDetailsMulModelProvider * CGlxDetailsMulModelProvider::NewL(class CAlfEnv &, class Alf::IMulWidget &, class MGlxMediaList &, enum Alf::mulwidget::TLogicalTemplate, int)
 
--- a/photosgallery/viewframework/dataprovider/inc/glxdrmgiftexturecreator.h	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/dataprovider/inc/glxdrmgiftexturecreator.h	Tue Sep 14 21:19:17 2010 +0300
@@ -19,7 +19,8 @@
 
 #include <w32std.h>
 #include <fbs.h>
-#include <icl\imagedata.h>
+#include <icl/imagedata.h>
+#include <mglxmedialist.h>                         // Interface for reading lists of media items
 
 class CGlxDRMgifDecoderAO;
 class CImageDecoder;
@@ -44,7 +45,7 @@
      * 
      */
     static CGlxDrmGifTextureCreator* NewL(const CGlxBinding& aBinding,
-            const TGlxMedia& aMedia, TInt aItemIndex,  Alf::IMulModel* aModel);
+            const TGlxMedia& aMedia, TInt aItemIndex,  Alf::IMulModel* aModel, MGlxMediaList& aMediaList);
     
     /*
      * destructor
@@ -71,7 +72,7 @@
      * Ctor 
      */
     CGlxDrmGifTextureCreator(const CGlxBinding& aBinding,
-            const TGlxMedia& aMedia, TInt aItemIndex,  Alf::IMulModel* aModel);
+            const TGlxMedia& aMedia, TInt aItemIndex,  Alf::IMulModel* aModel, MGlxMediaList& aMediaList);
     
     /*
      * ConstructL()
@@ -144,5 +145,6 @@
     TBool iTransparencyPossible;
     TFrameInfo iFrameInfo;
     TBool iFrameShift;
+    MGlxMediaList& iMediaList;
     };
 #endif /* GLXDRMGIFTEXTURECREATOR_H_ */
--- a/photosgallery/viewframework/dataprovider/inc/glxmulmodelproviderbase.h	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/dataprovider/inc/glxmulmodelproviderbase.h	Tue Sep 14 21:19:17 2010 +0300
@@ -91,7 +91,7 @@
 	 * @param aAtIndex media list index
 	 */
 	void SetDataT( const CGlxBinding& aBinding, const TGlxMedia& aMedia,
-        TInt aAtIndex );
+        TInt aAtIndex, MGlxMediaList& aMediaList);
 
     /// @todo docs	 
 	void UpdateItems( TInt aIndex, TInt aCount );
--- a/photosgallery/viewframework/dataprovider/src/glxdetailsmulmodelproviderimpl.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/dataprovider/src/glxdetailsmulmodelproviderimpl.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -285,7 +285,7 @@
 		{
 		if( KErrNotFound != iMediaList.FocusIndex())
 			{
-			SetDataT( *iEntries[ i ], iMediaList.Item(iMediaList.FocusIndex()), i ) ;
+			SetDataT( *iEntries[ i ], iMediaList.Item(iMediaList.FocusIndex()), i, iMediaList);
 			}
 		}       
     }       
--- a/photosgallery/viewframework/dataprovider/src/glxdrmgiftexturecreator.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/dataprovider/src/glxdrmgiftexturecreator.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -38,11 +38,11 @@
 // -----------------------------------------------------------------------------
 CGlxDrmGifTextureCreator* CGlxDrmGifTextureCreator::NewL(
         const CGlxBinding& aBinding, const TGlxMedia& aMedia,
-        TInt aItemIndex, Alf::IMulModel* aModel)
+        TInt aItemIndex, Alf::IMulModel* aModel, MGlxMediaList& aMediaList)
     {
     TRACER("CGlxDrmGifTextureCreator* CGlxDrmGifTextureCreator::NewL()");
     CGlxDrmGifTextureCreator* self = new (ELeave) CGlxDrmGifTextureCreator(
-            aBinding, aMedia, aItemIndex, aModel);
+            aBinding, aMedia, aItemIndex, aModel, aMediaList);
     CleanupStack::PushL(self);
     self->ConstructL();
     CleanupStack::Pop(self);
@@ -119,9 +119,9 @@
 // -----------------------------------------------------------------------------
 CGlxDrmGifTextureCreator::CGlxDrmGifTextureCreator(
         const CGlxBinding& aBinding, const TGlxMedia& aMedia,
-        TInt aItemIndex, Alf::IMulModel* aModel) :
+        TInt aItemIndex, Alf::IMulModel* aModel, MGlxMediaList& aMediaList) :
     iBinding(&aBinding), iMedia(&aMedia), iModel(aModel), iItemIndex(
-            aItemIndex)
+            aItemIndex), iMediaList(aMediaList)
     {
     TRACER("CGlxDrmGifTextureCreator::CGlxDrmGifTextureCreator()");
     // Implement nothing here
@@ -230,19 +230,25 @@
     GLX_LOG_INFO2("DrmGif: RefreshL() iAnimCount=%d, iFrameShift=%d",
             iAnimCount, iFrameShift);
     TInt textureId = KErrNotFound;
-    if (iTransparencyPossible && !iFrameShift)
+    if(iMediaList.Count())
         {
-        textureId
-                = (iUiUtility->GlxTextureManager().CreateDRMAnimatedGifTextureL(
-                        *iMedia, iMedia->IdSpaceId(), iAnimCount,
-                        iDecodedBitmap[iAnimCount], iDecodedMask[iAnimCount])).Id();
-        }
-    else
-        {
-        textureId
-                = (iUiUtility->GlxTextureManager().CreateDRMAnimatedGifTextureL(
-                        *iMedia, iMedia->IdSpaceId(), iAnimCount,
-                        iDecodedBitmap[iAnimCount], NULL)).Id();
+        const TGlxMedia media = iMediaList.Item(iItemIndex);
+
+        if (iTransparencyPossible && !iFrameShift)
+            {
+            textureId
+                    = (iUiUtility->GlxTextureManager().CreateDRMAnimatedGifTextureL(
+                            media, media.IdSpaceId(), iAnimCount,
+                            iDecodedBitmap[iAnimCount],
+                            iDecodedMask[iAnimCount])).Id();
+            }
+        else
+            {
+            textureId
+                    = (iUiUtility->GlxTextureManager().CreateDRMAnimatedGifTextureL(
+                            media, media.IdSpaceId(), iAnimCount,
+                            iDecodedBitmap[iAnimCount], NULL)).Id();
+            }
         }
 
     SetTexture(textureId);
@@ -495,6 +501,9 @@
     {
     TRACER("CGlxDrmGifTextureCreator::SetTexture()");
     auto_ptr<MulVisualItem> item(new (EMM) MulVisualItem());
-    iBinding->PopulateT(*item, *iMedia, ETrue, aTextureId);
-    iModel->SetData(iItemIndex, item);
+    if (iMediaList.Count())
+        {
+        iBinding->PopulateT(*item, iMediaList.Item(iItemIndex), ETrue, aTextureId);
+        iModel->SetData(iItemIndex, item);
+        }
     }
--- a/photosgallery/viewframework/dataprovider/src/glxmedialistmulmodelproviderimpl.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/dataprovider/src/glxmedialistmulmodelproviderimpl.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -135,7 +135,7 @@
     {
     TRACER("CGlxMediaListMulModelProviderImpl::HandleBindingChanged");
     SetDataT( aBinding, iMediaList.Item(iMediaList.FocusIndex()), 
-                iMediaList.FocusIndex() );
+                iMediaList.FocusIndex(), iMediaList);
     
     }
     
@@ -285,7 +285,7 @@
         {
         for(int i = aIndex; i < aIndex + aCount ; i++)
             {
-		    SetDataT( *iBindingSet, iMediaList.Item(i), i );            
+		    SetDataT( *iBindingSet, iMediaList.Item(i), i, iMediaList);            
             }
         }
     else
--- a/photosgallery/viewframework/dataprovider/src/glxmulmodelproviderbase.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/dataprovider/src/glxmulmodelproviderbase.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -312,7 +312,7 @@
 // ----------------------------------------------------------------------------
 //	
 void CGlxMulModelProviderBase::SetDataT( const CGlxBinding& aBinding,
-        const TGlxMedia& aMedia, TInt aAtIndex )
+        const TGlxMedia& aMedia, TInt aAtIndex, MGlxMediaList& aMediaList )
     {
     TRACER("CGlxMulModelProviderBase::SetDataT");
     
@@ -335,7 +335,7 @@
             if (!iDrmGifTextureCreator)
                 {
                 iDrmGifTextureCreator = CGlxDrmGifTextureCreator::NewL(
-                        aBinding, aMedia, aAtIndex, iModel);
+                        aBinding, aMedia, aAtIndex, iModel, aMediaList);
                 }
             else
                 {
--- a/photosgallery/viewframework/drmutility/group/glxdrmutility.mmp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/drmutility/group/glxdrmutility.mmp	Tue Sep 14 21:19:17 2010 +0300
@@ -46,5 +46,4 @@
 LIBRARY         cafutils.lib
 LIBRARY         drmuihandling.lib
 LIBRARY         efsrv.lib
-
 // End of File
--- a/photosgallery/viewframework/drmutility/src/glxdrmutility.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/drmutility/src/glxdrmutility.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -171,7 +171,16 @@
 #ifdef _DEBUG
     TTime startTime;
     startTime.HomeTime();
-#endif         
+#endif 
+    TFileName fileName(KNullDesC);
+    fileName.Append(aFileHandle.FullName(fileName));
+    if (iLastConsumedItemUri->Length() > 0)
+        {
+        if (fileName.CompareF(*iLastConsumedItemUri) == 0)
+            {
+            return ETrue;
+            }
+        }
     TBool rightsValid = EFalse;
     ContentAccess::TAttribute attrib =
         aCheckViewRights ? ContentAccess::ECanView : ContentAccess::ECanPlay;
@@ -222,6 +231,20 @@
         TBool aCheckViewRights)
     {
     TRACER("CGlxDRMUtility::DisplayItemRightsCheckL(RFile)");
+    TFileName fileName(KNullDesC);
+    fileName.Append(aFileHandle.FullName(fileName));
+    // Allow to display if rights for a URI was just consumed (i.e. same as stored URI)
+    if (iLastConsumedItemUri->Length() > 0)
+        {
+        if (fileName.CompareF(*iLastConsumedItemUri) == 0)
+            {
+            return ETrue;
+            }
+        }
+
+    //Clear the stored uri
+    ClearLastConsumedItemUriL();
+
     // Otherwise, check current rights for the URI of newly focused item
     return ItemRightsValidityCheckL(aFileHandle, aCheckViewRights);
     }
@@ -265,7 +288,22 @@
     {
     TRACER("CGlxDRMUtility::ConsumeRightsL(RFile)");
     CData* data = CData::NewLC(aFileHandle, KDefaultContentObject(), EPeek);
+
+    //When consuming rights for a URI, clear stored URI
+    ClearLastConsumedItemUriL();
+
     TInt err = data->ExecuteIntent(ContentAccess::EView);
+    TFileName fileName(KNullDesC);
+    fileName.Append(aFileHandle.FullName(fileName));
+
+    if (err == KErrNone)
+        {
+        //Update stored URI
+        iLastConsumedItemUri = iLastConsumedItemUri->ReAllocL(fileName.Length());
+        TPtr newPtr = iLastConsumedItemUri->Des();
+        newPtr.Copy(fileName);
+        }
+
     CleanupStack::PopAndDestroy(data);
     return (err == KErrNone);
     }
--- a/photosgallery/viewframework/medialists/src/glxattributecontext.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/medialists/src/glxattributecontext.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -172,20 +172,19 @@
             }
         }
     
-    
     // If the attribute request is for Thumbnail, Check if there is a match found.
     // And set the size and thumbnail quality
 	TIdentityRelation<TMPXAttribute> matchContent(&TMPXAttribute::MatchContentId);
 	TMPXAttribute tnAttr(KGlxMediaIdThumbnail, 0);
 	
-	if (iAttributes.Find(tnAttr, matchContent) != KErrNotFound) 
+	if (aAttributes.Find(tnAttr, matchContent) != KErrNotFound) 
 		{
 		// Allocate CMPXAttributeSpecs
 		CMPXAttributeSpecs* attributeSpecs = CMPXAttributeSpecs::NewL();
 		CleanupStack::PushL(attributeSpecs);
 		
-	attributeSpecs->SetTObjectValueL(
-	   TMPXAttribute( KGlxMediaIdThumbnail,
+		attributeSpecs->SetTObjectValueL(
+	    TMPXAttribute( KGlxMediaIdThumbnail,
 					   KGlxAttribSpecThumbnailSize ), 
 					   TSize(iDefaultSpecSize.iWidth,iDefaultSpecSize.iHeight) );
 		
@@ -193,11 +192,16 @@
 		   TMPXAttribute( KGlxMediaIdThumbnail,
 					   KGlxAttribSpecThumbnailQualityOverSpeed ), ETrue );
 		
+		// Memory leak guard check
+		if (aDetailedSpecs)
+		    {
+            delete aDetailedSpecs;
+            aDetailedSpecs = NULL;
+		    }
 		aDetailedSpecs = attributeSpecs;
 		
 		// Pop from stack
 		CleanupStack::Pop(attributeSpecs);
-		
 		}
 
     // If an error was found, return KErrGeneral
--- a/photosgallery/viewframework/tvout/src/glxhdmicontroller.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/tvout/src/glxhdmicontroller.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -161,7 +161,7 @@
     {
     TRACER("CGlxHdmiController::ShiftToPostingMode()");
     iIsPhotosInForeground = ETrue;
-    if (iGlxTvOut->IsHDMIConnected())
+    if (iGlxTvOut->IsHDMIConnected() && iIsImageSupported)
         {
         if (!iSurfaceUpdater)
             {
--- a/photosgallery/viewframework/uiutilities/src/glxprogressindicator.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/uiutilities/src/glxprogressindicator.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -179,7 +179,6 @@
     else
         {
         iProgressDialog->ProcessFinishedL();
-        iGlxGridViewNotifyObserver.HandleDialogDismissedL();
         if (iProgressDialog)
             {
             iProgressDialog = NULL;
@@ -223,6 +222,7 @@
         }
     iProgressDialog = NULL;
     iProgressInfo = NULL;
+    iGlxGridViewNotifyObserver.HandleDialogDismissedL();
     }
 
 // -----------------------------------------------------------------------------
@@ -256,6 +256,12 @@
 void EXPORT_C CGlxProgressIndicator::ShowProgressbarL()
     {
     TRACER("CGlxProgressIndicator::ShowProgressbarL");
+    if (iProgressDialog)
+        {
+        GLX_DEBUG1("Glx: ShowProgressbarL() - Already displayed. No need to Re-create it!");
+        return;
+        }
+    
     TInt itemsLeft = iUiUtility->GetItemsLeftCount();
     GLX_DEBUG3("ShowProgressbarL itemsLeft(%d), iFinalCount(%d)", itemsLeft,
             iFinalCount);
--- a/photosgallery/viewframework/views/cloudview/inc/glxcloudviewcontrol.h	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/views/cloudview/inc/glxcloudviewcontrol.h	Tue Sep 14 21:19:17 2010 +0300
@@ -365,12 +365,17 @@
 	 **/
     void SetFocusColor();
     
+    /** 
+     * Resets focused item color
+     **/
+    void ResetFocusColor();
     
-    /** 
-	 * Set the middle point of the infobuble
-	 **/
-    void SetBubleMidPoint(TPoint& aMidPoint);
-    
+    /**
+     *  Set the focus to first visible item
+     *  in the current view position
+     */
+    void SetFocusToFirstVisibleItemL();
+
    /** 
 	 * Move the viewport up depending on the condition
 	 *
@@ -382,11 +387,6 @@
 	 **/  
     void MoveDownIfRequired();
 
-    /** 
-	 * calculate the mid point of the bubble
-	 **/
-    void CalculateBubleMidPoint();
-	 
 public:
 
 	void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex,
@@ -555,9 +555,6 @@
 	// FocusIndex keeps track of the focussed row 
 	TInt iFocusRowIndex;
 
-	// EndRowindex keeps track of the end row 
-	TInt iEndRowIndex;
-
 	//keeps track of the end row 
 	TInt iLayoutIndex;
 
@@ -648,6 +645,9 @@
 
     /**flag to identify the next down event */
     TBool iDownEventReceived;
+    
+    // Flag to show Alf visual focus
+    TBool iShowFocus;
 	};
 
 #endif // C_GLXCLOUDVIEWCONTROL_H
--- a/photosgallery/viewframework/views/cloudview/inc/glxtagscontextmenucontrol.h	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/views/cloudview/inc/glxtagscontextmenucontrol.h	Tue Sep 14 21:19:17 2010 +0300
@@ -37,7 +37,7 @@
      * To Handle menu items in Grid layout
      * @param aCommand command to be handled
      */
-    virtual void HandleGridMenuListL(TInt aCommand) = 0;
+    virtual void HandleGridMenuListL(TInt aCommand = 0) = 0;
     };
 
 class CGlxTagsContextMenuControl : public CAlfControl,
--- a/photosgallery/viewframework/views/cloudview/src/glxcloudviewcontrol.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/views/cloudview/src/glxcloudviewcontrol.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -198,8 +198,6 @@
 
         if ( iLabels.Count ()==listCount && iAttributeContext->RequestCountL (&iMediaList)==0)
             {
-            //if we navigate in forward direction, first item should be highlighted.if we are navigating in
-            // backwards direction, index is not necessarily zero, it will be restored.
             if ( iUiUtility->ViewNavigationDirection ()== EGlxNavigationForwards && iMediaList.Count ())
                 {
                 iMediaList.SetFocusL (NGlxListDefs::EAbsolute, 0);
@@ -211,6 +209,7 @@
     iTouchFeedback = MTouchFeedback::Instance(); 
     iPhysics = CAknPhysics::NewL(*this, NULL);
     InitPhysicsL();
+    iShowFocus = EFalse;
     }
 
 
@@ -241,7 +240,6 @@
 // --------------------------------------------------------------------------- 
 //
 CGlxCloudViewControl::~CGlxCloudViewControl()
-
     {
     TRACER("GLX_CLOUD::CGlxCloudViewControl::~CGlxCloudViewControl");
     iCloudInfo.Close ();
@@ -403,16 +401,14 @@
     GLX_LOG_INFO("GLX_CLOUD ::CGlxCloudViewControl::::LayoutVisibleArea Exiting layout append");
     iLayoutIndex = 0;
     GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::::LayoutVisibleArea layout Count realloc  %d ", iLayout->Count ());
-    for (TInt j = 0; j <= iEndRowIndex; j++)
+    TInt totalHeight = 0;
+    for (TInt j = 0; j <= iCloudInfo.Count() - 1; j++)
         {
         GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::::LayoutVisibleArea Drawing row started  %d ", j);
         LayoutVisibleRows (startpoint,iCloudInfo[j].iStartIndex, 
                 iCloudInfo[j].iEndIndex);
         startpoint.iY += KRowHeight + KNumMinRowSpace;		
-        }
-    TInt totalHeight = 0;
-    for (TInt j = 0; j <= iCloudInfo.Count()-1; j++)
-        {
+
         totalHeight+=KRowHeight;
         totalHeight+=KNumMinRowSpace;
         }
@@ -461,150 +457,186 @@
 // --------------------------------------------------------------------------- 
 //
 TBool CGlxCloudViewControl::OfferEventL(const TAlfEvent &aEvent)
-    {   TRACER("GLX_CLOUD:: CGlxCloudViewControl::OfferEventL");
+    {
+    TRACER("GLX_CLOUD:: CGlxCloudViewControl::OfferEventL");
 
     //check if key inputs needs handling
     TBool consumed = EFalse;
-    if ( ( iLabels.Count () == 0 ) ) 
+    if (iLabels.Count() == 0)
         {
         GLX_LOG_INFO( "GLX_CLOUD ::CGlxCloudViewControl::offerkeyeventL no key press returning  ");
         return EFalse; //return as no futher processing is required
         }
 
+    if (aEvent.IsKeyEvent() && iTagsContextMenuControl->ItemMenuVisibility())
+        {
+        // Hide the context menu, if visible
+        ShowContextItemMenuL(EFalse);
+        }
+
     if ( aEvent.IsKeyEvent ()&& aEvent.Code() == EEventKey )
         {
         switch (aEvent.KeyEvent().iCode)            
             {	
-            //@ EABI-7R7FRU Fute failure: Tag views enter key has no functionality.
             case EKeyEnter :
             case EKeyDevice3:
                 {
-                iObserverEnterKeyEvent.HandleEnterKeyEventL( (TInt)EAknCmdOpen );
-                consumed= ETrue;
+                if (iShowFocus)
+                    {
+                    iShowFocus = EFalse;
+                    iObserverEnterKeyEvent.HandleEnterKeyEventL(
+                            (TInt) EAknCmdOpen);
+                    }
+                else
+                    {
+                    SetFocusToFirstVisibleItemL();
+                    }
+                consumed = ETrue;
                 }
                 break;
             case EKeyUpArrow:
-                {             
-                if(iCloudInfo.Count() >1 )
+                {
+                if (iShowFocus)
                     {
-                    HandleKeyUpL ();
-                    consumed = ETrue;
-                    iFocusRowIndex = RowNumber (iMediaList.FocusIndex ()); 
+                    HandleKeyUpL();
+                    iFocusRowIndex = RowNumber(iMediaList.FocusIndex());
 
-                    MoveUpIfRequired();                   
+                    MoveUpIfRequired();
                     }
+                else
+                    {
+                    SetFocusToFirstVisibleItemL();
+                    }
+                consumed = ETrue;
                 }
                 break;
 
             case EKeyDownArrow:
-                {              
-                if (iCloudInfo.Count() > 1)
+                {
+                if (iShowFocus)
                     {
-                    HandleKeyDownL ();
-                    consumed = ETrue;
-                    iFocusRowIndex = RowNumber (iMediaList.FocusIndex ());
+                    HandleKeyDownL();
+                    iFocusRowIndex = RowNumber(iMediaList.FocusIndex());
 
-                    MoveDownIfRequired();                                 
-                    }                  
+                    MoveDownIfRequired();
+                    }
+                else
+                    {
+                    SetFocusToFirstVisibleItemL();
+                    }
+                consumed = ETrue;
                 }
                 break;
 
             case EKeyLeftArrow:
             case EKeyPrevious:
                 {
-                // arabic hebrew change
-                if ( GlxGeneralUiUtilities::LayoutIsMirrored () )
+                if (iShowFocus)
                     {
-                    if ( iMediaList.FocusIndex() == iMediaList.Count() - 1 )
+                    // arabic hebrew change
+                    if (GlxGeneralUiUtilities::LayoutIsMirrored())
                         {
-                        iMediaList.SetFocusL (NGlxListDefs::EAbsolute, 0);
+                        if (iMediaList.FocusIndex() == iMediaList.Count() - 1)
+                            {
+                            iMediaList.SetFocusL(NGlxListDefs::EAbsolute, 0);
+                            }
+                        else
+                            {
+                            iMediaList.SetFocusL(NGlxListDefs::EAbsolute,
+                                    iMediaList.FocusIndex() + 1);
+                            }
+                        iScrollDirection = 0;
                         }
                     else
                         {
-                        iMediaList.SetFocusL (NGlxListDefs::EAbsolute,
-                                iMediaList.FocusIndex ()+ 1);
+                        if (iMediaList.FocusIndex() == 0)
+                            {
+                            iMediaList.SetFocusL(NGlxListDefs::EAbsolute,
+                                    iMediaList.Count() - 1);
+                            }
+                        else
+                            {
+                            iMediaList.SetFocusL(NGlxListDefs::EAbsolute,
+                                    iMediaList.FocusIndex() - 1);
+                            }
+                        iScrollDirection = 1;
                         }
-                    iScrollDirection = 0;
+                    TInt focusRowIndex = RowNumber(iMediaList.FocusIndex());
+                    if (iFocusRowIndex != focusRowIndex)
+                        {
+                        iFocusRowIndex = focusRowIndex;
+                        if (iScrollDirection == 0)
+                            {
+                            MoveDownIfRequired();
+                            }
+                        else
+                            {
+                            MoveUpIfRequired();
+                            }
+                        }
                     }
                 else
                     {
-                    if ( iMediaList.FocusIndex ()== 0 )
-                        {
-                        iMediaList.SetFocusL (NGlxListDefs::EAbsolute,
-                                iMediaList.Count() - 1 );
-                        }
-                    else
-                        {
-                        iMediaList.SetFocusL (NGlxListDefs::EAbsolute,
-                                iMediaList.FocusIndex ()- 1);
-                        }
-                    iScrollDirection = 1;
+                    SetFocusToFirstVisibleItemL();
                     }
                 consumed = ETrue;
-                TInt focusRowIndex = RowNumber (iMediaList.FocusIndex ());
-                if(iFocusRowIndex != focusRowIndex)
-                    {
-                    iFocusRowIndex = focusRowIndex; 
-                    if( iScrollDirection == 0 )
-                        {                      
-                        MoveDownIfRequired();
-                        }
-                    else
-                        {
-                        MoveUpIfRequired();
-                        }
-                    }                
                 }
-
                 break;
 
             case EKeyRightArrow:
             case EKeyNext:
-                {               
-                // arabic hebrew change
-                if ( GlxGeneralUiUtilities::LayoutIsMirrored () )
+                {
+                if (iShowFocus)
                     {
-                    if ( iMediaList.FocusIndex ()== 0 )
+                    // arabic hebrew change
+                    if (GlxGeneralUiUtilities::LayoutIsMirrored())
                         {
-                        iMediaList.SetFocusL (NGlxListDefs::EAbsolute,
-                                iMediaList.Count() - 1 );
+                        if (iMediaList.FocusIndex() == 0)
+                            {
+                            iMediaList.SetFocusL(NGlxListDefs::EAbsolute,
+                                    iMediaList.Count() - 1);
+                            }
+                        else
+                            {
+                            iMediaList.SetFocusL(NGlxListDefs::EAbsolute,
+                                    iMediaList.FocusIndex() - 1);
+                            }
+                        iScrollDirection = 1;
                         }
                     else
                         {
-                        iMediaList.SetFocusL (NGlxListDefs::EAbsolute,
-                                iMediaList.FocusIndex ()- 1);
+                        if (iMediaList.FocusIndex() == iMediaList.Count() - 1)
+                            {
+                            iMediaList.SetFocusL(NGlxListDefs::EAbsolute, 0);
+                            }
+                        else
+                            {
+                            iMediaList.SetFocusL(NGlxListDefs::EAbsolute,
+                                    iMediaList.FocusIndex() + 1);
+                            }
+                        iScrollDirection = 0;
                         }
-                    iScrollDirection = 1;
+                    TInt focusRowIndex = RowNumber(iMediaList.FocusIndex());
+
+                    if (iFocusRowIndex != focusRowIndex)
+                        {
+                        iFocusRowIndex = focusRowIndex;
+                        if (iScrollDirection == 1)
+                            {
+                            MoveUpIfRequired();
+                            }
+                        else
+                            {
+                            MoveDownIfRequired();
+                            }
+                        }
                     }
                 else
                     {
-                    if ( iMediaList.FocusIndex ()== iMediaList.Count() - 1 )
-                        {
-                        iMediaList.SetFocusL (NGlxListDefs::EAbsolute, 0);
-                        }
-                    else
-                        {
-                        iMediaList.SetFocusL (NGlxListDefs::EAbsolute,
-                                iMediaList.FocusIndex ()+ 1);
-                        }
-                    iScrollDirection = 0;
+                    SetFocusToFirstVisibleItemL();
                     }
-                TInt focusRowIndex = RowNumber (iMediaList.FocusIndex ());
-
-                if( iFocusRowIndex != focusRowIndex )
-                    {
-                    iFocusRowIndex = focusRowIndex;  
-                    if( iScrollDirection == 1 )
-                        {                           
-                        MoveUpIfRequired();                               
-                        }
-                    else
-                        {                           
-                        MoveDownIfRequired();                               
-                        }
-                    }
+                consumed = ETrue;
                 }
-                consumed = ETrue;
                 break;
 
             default:
@@ -680,7 +712,8 @@
     {
     TRACER("GLX_CLOUD::CGlxCloudViewControl::HandleLayoutFocusChange");
 
-    if ( iLabels.Count()-1 >= iMediaList.FocusIndex())
+    if ((iShowFocus || !iUiUtility->IsPenSupported()) && (iLabels.Count() - 1
+            >= iMediaList.FocusIndex()))
         {
         //to highlight focused element 
         SetFocusColor(); 
@@ -694,10 +727,9 @@
 void CGlxCloudViewControl::FocusUpdate()
     {
     TRACER("GLX_CLOUD::CGlxCloudViewControl::FocusUpdate");
-    GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::FocusUpdate HighLighted RowNum  %d ",iFocusRowIndex);
-    GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::FocusUpdate End RowNumn %d ",iCloudInfo.Count()-1);
-    iFocusRowIndex = RowNumber (iMediaList.FocusIndex ());
-    iEndRowIndex = iCloudInfo.Count()-1;
+    iFocusRowIndex = RowNumber(iMediaList.FocusIndex());
+    GLX_LOG_INFO1("GLX_CLOUD::FocusUpdate iFocusRowIndex=%d", 
+            iFocusRowIndex);
     LayoutVisibleArea();
     }
 
@@ -796,10 +828,6 @@
         //reset the layout and get the items from cache
         UpdateLayout(); //remove all the visuals from the layout.layout is empty now.
         iCloudInfo.Close (); //row information is reset
-        //get the new array contents from cache.no need to reset the array as the number
-        //of items in array will remain same.
-        FetchAttributeFromCacheL();
-        UpdateRowDataL (); //updates the row data and reassigns font sizes and draw the layout on screen.
         }
 
     InitPhysicsL();
@@ -887,8 +915,6 @@
         //of items in array will remain same.
         UpdateLayout(); //remove all the visuals from the layout.layout is empty now.        
         FetchAttributeFromCacheL();
-        //if we navigate in forward direction, first item should be highlighted.if we are navigating in
-        // backwards direction, index is not necessarily zero, it will be restored.
         if ( iUiUtility->ViewNavigationDirection ()== EGlxNavigationForwards && iMediaList.Count ())
             {
             iMediaList.SetFocusL (NGlxListDefs::EAbsolute, 0);
@@ -1071,8 +1097,6 @@
 
     GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::UpdateRowData  iCloudInfo.count loop exit  %d ", iCloudInfo.Count());
     FocusUpdate (); //Start screen drawing 
-
-    iEndRowIndex = iCloudInfo.Count()-1;
     }
 
 // ---------------------------------------------------------------------------
@@ -1235,11 +1259,11 @@
     }
 
 // ---------------------------------------------------------------------------
-// SetFocusColor()
+// AppendToCloudArrayL()
 // ---------------------------------------------------------------------------
 //
-void CGlxCloudViewControl::AppendToCloudArrayL( 
-        TGlxCloudInfo& aCloudInfo,const TInt& aStartIndex, const TInt& aEndIndex )
+void CGlxCloudViewControl::AppendToCloudArrayL(TGlxCloudInfo& aCloudInfo,
+        const TInt& aStartIndex, const TInt& aEndIndex)
     {
     TRACER("GLX_CLOUD::CGlxCloudViewControl::AppendToCloudArrayL");
     aCloudInfo.iStartIndex = aStartIndex;
@@ -1251,21 +1275,28 @@
 // SetFocusColor()
 // ---------------------------------------------------------------------------
 //
-void  CGlxCloudViewControl::SetFocusColor()
+void CGlxCloudViewControl::SetFocusColor()
     {
-    iLabels[iMediaList.FocusIndex()]->SetColor (KAknsIIDQsnHighlightColors ,EAknsCIQsnHighlightColorsCG3); 
+    TRACER("GLX_CLOUD::CGlxCloudViewControl::SetFocusColor");
+    if (iMediaList.Count())
+        {
+        iLabels[iMediaList.FocusIndex()]->SetColor(
+                KAknsIIDQsnHighlightColors, EAknsCIQsnHighlightColorsCG3);
+        }
     }
 
 // ---------------------------------------------------------------------------
-// SetBubleMidPoint()
+// ResetFocusColor()
 // ---------------------------------------------------------------------------
 //
-void  CGlxCloudViewControl::SetBubleMidPoint(TPoint& aMidPoint)
+void CGlxCloudViewControl::ResetFocusColor()
     {
-    TRACER("GLX_CLOUD::CGlxCloudViewControl::SetBubleMidPoint");
-    //Substract the viewport position so as to set the buble at the right position on the screen     
-    aMidPoint.iX-=iViewPortPosition.iX;
-    aMidPoint.iY-=iViewPortPosition.iY;
+    TRACER("GLX_CLOUD::CGlxCloudViewControl::ResetFocusColor");
+    if (iMediaList.Count())
+        {
+        iLabels[iMediaList.FocusIndex()]->SetColor(KAknsIIDQsnTextColors,
+                EAknsCIQsnTextColorsCG6);
+        }
     }
 
 // ---------------------------------------------------------------------------
@@ -1275,19 +1306,21 @@
 void CGlxCloudViewControl::MoveUpIfRequired()
     {
     TRACER("GLX_CLOUD::CGlxCloudViewControl::MoveUpIfRequired");
+    TInt focusIndex = iMediaList.FocusIndex();
+
     //get the focused item's position
     TPoint point;
-    iLayout->ChildPos(iMediaList.FocusIndex(),point);
+    iLayout->ChildPos(focusIndex,point);
     TSize size;
-    iLayout->ChildSize(iMediaList.FocusIndex(),size);
-    TInt focus = iMediaList.FocusIndex();
-    TInt rownumber = RowNumber(focus);
+    iLayout->ChildSize(focusIndex,size);
+
+    TInt rownumber = RowNumber(focusIndex);
     //if the focused item is not visible then move the viewport
     if(point.iY < iViewPortPosition.iY)         
         { 
         //set the new position of viewport
-        TInt offeset = iViewPortPosition.iY - point.iY;
-        iViewPortPosition.iY-=offeset;
+        TInt offset = iViewPortPosition.iY - point.iY;
+        iViewPortPosition.iY-=offset;
         if( (iViewPortPosition.iY < 0) )
             {
             iViewPortPosition.iY = 0;
@@ -1309,82 +1342,51 @@
 //
 void CGlxCloudViewControl::MoveDownIfRequired()
     {
-    TRACER("GLX_CLOUD::CGlxCloudViewControl::MoveDownIfRequired");  
+    TRACER("GLX_CLOUD::CGlxCloudViewControl::MoveDownIfRequired");
+    TInt focusIndex = iMediaList.FocusIndex();
+
     //get the focused item's position
     TPoint point;
-    iLayout->ChildPos(iMediaList.FocusIndex(),point);
+    iLayout->ChildPos(focusIndex, point);
     TSize size;
-    iLayout->ChildSize(iMediaList.FocusIndex(),size);
-    //if the focused visual is not visible then move the viewport 
-    if(point.iY+size.iHeight > iViewPortPosition.iY+iViewPortSize.iHeight )
-        { 
-        //set the new position of viewport
-        TInt offeset = (point.iY+size.iHeight) - (iViewPortPosition.iY+iViewPortSize.iHeight);
-        iViewPortPosition.iY+=offeset;
-        if( (iViewPortPosition.iY > iViewPortVirtualSize.iHeight) )
-            {
-            iViewPortPosition.iY = iViewPortVirtualSize.iHeight - iViewPortSize.iHeight;
-            } 
+    iLayout->ChildSize(focusIndex, size);
+
+    //Reset viewport position for cases:
+    //case 1)Focus index is first item
+    if (focusIndex == 0)
+        {
+		iViewPortPosition.iY = 0;
+		}
+    //case 2)Focused item is in last screen
+    else if( point.iY > (iViewPortVirtualSize.iHeight - iViewPortSize.iHeight))
+        {
+        iViewPortPosition.iY = iViewPortVirtualSize.iHeight - iViewPortSize.iHeight;
         }
-    //if its key event then it should be cyclic
-    else if (iMediaList.FocusIndex() == 0)
+    else
         {
-        iViewPortPosition.iY = 0;
-        }     
+        iViewPortPosition.iY = point.iY + KNumMinRowSpace;
+        }
+
+    //Validate the viewport position
+    if ((iViewPortPosition.iY > iViewPortVirtualSize.iHeight))
+        {
+		iViewPortPosition.iY = iViewPortVirtualSize.iHeight - iViewPortSize.iHeight;
+        }
+
+    GLX_LOG_INFO1("GLX_CLOUD::MoveDownIfRequired() iViewPortPosition.iY:%d",
+            iViewPortPosition.iY);
     iViewPortLayout->SetViewportPos(iViewPortPosition, KSlowCloudMovement);
     iScrollEventData.mViewStartPos = iViewPortPosition.iY;
     if(iScrollBarWidget)
         {
-        Scroll();           
+        Scroll();
         }
-    }     
-
-// ---------------------------------------------------------------------------
-// MoveDownIfRequired()
-// ---------------------------------------------------------------------------
-//
-void CGlxCloudViewControl::CalculateBubleMidPoint()
-    { 
-    TRACER("GLX_CLOUD::CGlxCloudViewControl::CalculateBubleMidPoint");
-    TPoint midpoint;
-    TAlfRealRect focussedItemRect;
-    TRect mainPaneRect;
-    AknLayoutUtils::LayoutMetricsRect (AknLayoutUtils::EMainPane, mainPaneRect);
-
-    CAlfVisual& visual = iLayout->Visual( iMediaList.FocusIndex() );
-    focussedItemRect = visual.DisplayRect();
-
-    if( GlxGeneralUiUtilities::LayoutIsMirrored () )
-        {  
-        midpoint.iX = focussedItemRect.iBr.iX +
-        ((focussedItemRect.iTl.iX - focussedItemRect.iBr.iX )/2);
-        }
-
-    else 
-        {
-        midpoint.iX=focussedItemRect.iTl.iX +
-        ((focussedItemRect.iBr.iX - focussedItemRect.iTl.iX )/2);
-        }
-
-    midpoint.iY=focussedItemRect.iTl.iY+
-                ((focussedItemRect.iBr.iY - focussedItemRect.iTl.iY )/2); 
-    TPoint anchorRect;
-
-    //Get the position of anchor layout
-    iViewPortLayout->ChildPos (0, anchorRect);
-
-    //Add the differance to the midpoint
-    midpoint.iX+=anchorRect.iX;
-    midpoint.iY+=anchorRect.iY; 
-
-    //Substract from the viewport position the viewport position    
-    SetBubleMidPoint(midpoint);   
-    } 
+    }
 
 // ---------------------------------------------------------------------------
 // HandlePointerEventL()
 // ---------------------------------------------------------------------------
-//  
+//
 TBool CGlxCloudViewControl::HandlePointerEventL( const TAlfEvent &aEvent )
     {
     TRACER("GLX_CLOUD::CGlxCloudViewControl::HandlePointerEventL");
@@ -1422,6 +1424,8 @@
                     {
                     iTouchFeedback->InstantFeedback(ETouchFeedbackBasic);
                     iMediaList.SetFocusL (NGlxListDefs::EAbsolute, index);
+                    iShowFocus = ETrue;
+                    HandleLayoutFocusChange();
 
                     //Start the timer to interpret longpress events
                     iTimerComplete = EFalse;
@@ -1444,6 +1448,12 @@
         }
     else if (iDownEventReceived && aEvent.PointerUp())
         {
+        if (!iTagsContextMenuControl->ItemMenuVisibility())
+            {
+            iShowFocus = EFalse;
+            ResetFocusColor();
+            }
+
         iDownEventReceived = EFalse;
         Display()->Roster().SetPointerEventObservers(0, *this);
         consumed = ETrue;
@@ -1477,10 +1487,8 @@
                     TInt focus = iMediaList.FocusIndex();
                     if (index != focus)
                         {
-                        iTouchFeedback->InstantFeedback( ETouchFeedbackBasic );
                         TInt focusrowindex = iFocusRowIndex;
                         iMediaList.SetFocusL(NGlxListDefs::EAbsolute, index);
-                        SetFocusColor();
                         iFocusRowIndex = RowNumber (iMediaList.FocusIndex ());
                         
                         if( iFocusRowIndex > focusrowindex)
@@ -1749,15 +1757,17 @@
     }
 
 // ---------------------------------------------------------------------------
-// attachScrollBar()
+// InitializeScrollBar()
 // ---------------------------------------------------------------------------
-//	
-void CGlxCloudViewControl::InitializeScrollBar(IAlfScrollBarWidget* aScrollBarWidget)
+//
+void CGlxCloudViewControl::InitializeScrollBar(
+        IAlfScrollBarWidget* aScrollBarWidget)
     {
     TRACER("GLX_CLOUD::CGlxCloudViewControl::InitializeScrollBar");
     iScrollBarWidget = aScrollBarWidget;
     ((IAlfScrollBarModel *) (iScrollBarWidget->model()))->initializeData(
             iScrollEventData.mSpan, iScrollEventData.mViewLength, 0);
+    Scroll();
     DisplayScrollBar();
     }
 
@@ -1814,19 +1824,30 @@
 // DisplayScrollBar()
 // ---------------------------------------------------------------------------
 //
-void CGlxCloudViewControl::DisplayScrollBar() 
+void CGlxCloudViewControl::DisplayScrollBar()
     {
+    TRACER("GLX_CLOUD::CGlxCloudViewControl::DisplayScrollBar()");
     if (iScrollBarWidget)
         {
         IAlfElement* vertBaseElement =(iScrollBarWidget->control()->findElement ("BaseElement"));
         IAlfScrollBarDefaultBaseElement* scrollbarbaselement=static_cast<IAlfScrollBarDefaultBaseElement*> (
             vertBaseElement->makeInterface (IAlfScrollBarDefaultBaseElement::type() ) );
 
-        // To set the scrollbar visibility, it's enough to set the opacity 
-        // of baselayout. No need to set the opacity of thumb separately. 
-        if (iScrollEventData.mSpan)
+        TInt totalHeight = 0;
+        for (TInt index = 0; index <= iCloudInfo.Count() - 1; index++)
+            {
+            totalHeight += KRowHeight;
+            totalHeight += KNumMinRowSpace;
+            }
+
+        // To set the scrollbar visibility, it's enough to set the opacity
+        // of baselayout. No need to set the opacity of thumb separately.
+        // Set the scrollbar visibility only
+        // when visuals height exceeds the screen height
+        if (iScrollEventData.mSpan && totalHeight > iTagScreenHeight)
             {
             //make scroll bar visible
+            GLX_LOG_INFO("GLX_CLOUD: Make scrollbar visible!");
             scrollbarbaselement->setOpacity(1.0);
             }
         else
@@ -1964,7 +1985,8 @@
     TRect rect;
     AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
     
-    if(!iPhysicsStarted)//only if physics hasnt started
+    //only if not dragged and physics hasnt started
+    if (!iPhysicsStarted && !iViewDragged)
         {
         iTagsContextMenuControl->SetViewableRect(rect);
         iTagsContextMenuControl->ShowItemMenuL(ETrue);
@@ -1978,10 +2000,39 @@
 //
 void CGlxCloudViewControl::ShowContextItemMenuL(TBool aShow)
     {
+    TRACER("GLX_CLOUD::ShowContextItemMenuL");
+    GLX_LOG_INFO1("GLX_CLOUD::ShowContextItemMenuL() aShow=%d", aShow);
     iTagsContextMenuControl->ShowItemMenuL(aShow);
     if(!aShow)
         {
         iViewPortLayout->UpdateChildrenLayout(0);
+        iShowFocus = EFalse;
+        ResetFocusColor();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// SetFocusToFirstVisibleItemL()
+// ---------------------------------------------------------------------------
+//
+void CGlxCloudViewControl::SetFocusToFirstVisibleItemL()
+    {
+    TRACER("GLX_CLOUD::CGlxCloudViewControl::SetFocusToFirstVisibleItemL()");
+    iShowFocus = ETrue;
+
+    TInt visIndex = GetAbsoluteIndex(TPoint(KLeftMargin + KLeftMargin,
+            KColSpace));
+    GLX_LOG_INFO1("GLX_CLOUD::SetFocusToFirstVisibleItemL() visIndex=%d", visIndex);
+
+    if (visIndex != KErrNotFound)
+        {
+        iMediaList.SetFocusL(NGlxListDefs::EAbsolute, visIndex);
+
+        MoveUpIfRequired();
+        }
+    else
+        {
+        HandleLayoutFocusChange();
         }
     }
 
--- a/photosgallery/viewframework/views/cloudview/src/glxcloudviewimp.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/views/cloudview/src/glxcloudviewimp.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -456,7 +456,11 @@
 void CGlxCloudViewImp::HandleGridMenuListL(TInt aCommand)
     {
     TRACER("GLX_CLOUD::CGlxCloudViewImp::HandleGridMenuListL");
-    ProcessCommandL(aCommand);
+    iCloudControl->ShowContextItemMenuL(EFalse);
+    if (aCommand)
+        {
+        ProcessCommandL(aCommand);
+        }
     }
 
 // ----------------------------------------------------------------------------
--- a/photosgallery/viewframework/views/cloudview/src/glxtagscontextmenucontrol.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/views/cloudview/src/glxtagscontextmenucontrol.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -275,26 +275,21 @@
         }
 
     TInt upperYPos = aPoint.iY - KMinimalGap;
-    TInt XPos = aPoint.iX;
+    TInt xPos = aPoint.iX;
     
-    //Preferred is to display in upper area
-    TInt upperDisplayableHeight = upperYPos - iViewableRect.iTl.iY;
-    TInt rightDisplayableWidth = iViewableRect.iBr.iX - (XPos + KRightMargin
-            + KWidthPadding);
-
     //always draw above
-    if(rightDisplayableWidth < iMaxTextWidth)
+    if ((iViewableRect.iBr.iX - (xPos + KRightMargin + KWidthPadding))
+            < iMaxTextWidth)
         {
-        XPos = aPoint.iX - iMaxTextWidth;
+        xPos = aPoint.iX - iMaxTextWidth;
         }
-    if(upperDisplayableHeight < KGridHeight)
+
+    if (upperYPos + KGridHeight > iViewableRect.iBr.iY)
         {
-        iMainVisual->SetPos(TAlfRealPoint(XPos , upperYPos ));
+        upperYPos = iViewableRect.iBr.iY - KGridHeight;
         }
-    else
-        {
-        iMainVisual->SetPos(TAlfRealPoint(XPos , upperYPos - KGridHeight));
-        }
+
+    iMainVisual->SetPos(TAlfRealPoint(xPos, upperYPos));
     
 	if ( iTimer)
 	    {
@@ -446,6 +441,7 @@
     {
     TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::TimerCompleteL");
     ShowItemMenuL(EFalse);
+    iItemMenuObserver.HandleGridMenuListL();
     }
 
 // --------------------------------------------------------------------------- 
--- a/photosgallery/viewframework/views/fullscreenview/inc/glxfullscreenviewimp.h	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/views/fullscreenview/inc/glxfullscreenviewimp.h	Tue Sep 14 21:19:17 2010 +0300
@@ -315,6 +315,18 @@
      */
     void UpdateItems();
 
+    /**
+     * Handle coverflow item removed event / 
+     * external file deletion while gaining foreground
+     */
+    void HandleItemRemovedL();
+    
+    /**
+     * Sets the title pane text
+     * @param aTitleText Title text
+     */
+    void SetTitlePaneTextL(const TDesC& aTitleText);
+
 private:
     /** Softkey resource id's */
     TFullScreenViewResourceIds iResourceIds; 
@@ -367,6 +379,9 @@
     TInt iInitialZoomRatio ;
     //Previous focused index
     TInt iOldFocusIndex;
+    // Previous focused Uri
+    HBufC* iUri;
+
     TBool iImgViewerMode;
 	CGlxMMCNotifier* iMMCNotifier;
 	TBool iMMCState;
--- a/photosgallery/viewframework/views/fullscreenview/src/glxfullscreenviewimp.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/views/fullscreenview/src/glxfullscreenviewimp.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -46,6 +46,7 @@
 #include <mpxcollectionpath.h>
 
 #include <gesturehelper.h>
+#include <coeutils.h>
 
 using namespace GestureHelper;
 
@@ -229,6 +230,12 @@
         delete iMMCNotifier;
         iMMCNotifier = NULL;
         }
+    
+    if (iUri)
+        {
+        delete iUri;
+        }
+    
     if(iMediaListMulModelProvider)
         {
         delete iMediaListMulModelProvider;
@@ -425,6 +432,7 @@
     CAknViewAppUi* appui = AppUi();
     if ( appui )
         {
+        SetTitlePaneTextL(KNullDesC);
         appui->StatusPane()->MakeVisible(EFalse);
         appui->Cba()->MakeVisible(EFalse);
         }
@@ -949,6 +957,11 @@
     if(iZoomControl && iZoomControl->Activated())
         {
         iZoomControl->HandleZoomForegroundEvent(aForeground);
+        if (aForeground && iUri && !ConeUtils::FileExists(iUri->Des()))
+            {
+            GLX_LOG_INFO("File does not exist, Exit zoom view!");
+            HandleItemRemovedL();
+            }
         }
 
     if (!aForeground)
@@ -1163,36 +1176,7 @@
             case ETypeItemRemoved:
                 {
                 GLX_LOG_INFO("CGlxFullScreenViewImp::OfferEventL ETypeItemRemoved");
-                TInt focusIndex = iMediaList->FocusIndex();
-                TInt mlCount = iMediaList->Count();
-                GLX_LOG_INFO2("CGlxFullScreenViewImp::OfferEventL focusIndex=%d, iOldFocusIndex=%d",
-                        focusIndex, iOldFocusIndex);
-                if (mlCount && (iOldFocusIndex == focusIndex
-                        || iOldFocusIndex == mlCount) && iZoomControl
-                        && iZoomControl->Activated())
-                    {
-                    GLX_LOG_INFO("Fcused item is removed, Exit zoom view!");
-                    DeactivateZoomControlL();
-                    }
-                SetItemToHDMIL();
-                if (focusIndex != KErrNotFound && EUiOn == GetUiState())
-                    {
-                    // show/hide the slider
-                    if (iSliderWidget)
-                        {
-                        iSliderWidget->ShowWidget(CheckIfSliderToBeShownL());
-                        }
-                    }
-                /** if this is the last image deleted when Photo is in foreground, go back to the previous view*/
-                if (mlCount == 0 && IsForeground()
-                        && iNaviState->ViewingMode()
-                                == NGlxNavigationalState::EView)
-                    {
-                    iUiUtility->SetViewNavigationDirection(
-                            EGlxNavigationBackwards);
-                    iNaviState->ActivatePreviousViewL();
-                    }
-                TRAP_IGNORE(ShowDrmExpiryNoteL());
+                HandleItemRemovedL();
                 return EEventConsumed;
                 }
             case ETypeHighlight:
@@ -1317,6 +1301,9 @@
 		case EAknSoftkeyBack:
             {
             HideUi(ETrue);
+            // Enable status pane  and  Set null text 
+			StatusPane()->MakeVisible(ETrue);
+			SetTitlePaneTextL(KNullDesC);
             break;
             }                        
         } 
@@ -1854,7 +1841,11 @@
         //(e.g. video, corrupted item, item with invalid DRM)
         iHdmiController->ItemNotSupported();
         }
+    
     iOldFocusIndex = iMediaList->FocusIndex();
+    delete iUri;
+    iUri = NULL;   
+    iUri = item.Uri().AllocL();
     }
 
 // ---------------------------------------------------------------------------
@@ -2091,3 +2082,60 @@
             }
         }
     }
+
+// ---------------------------------------------------------------------------
+// Sets the title pane text
+// ---------------------------------------------------------------------------
+void CGlxFullScreenViewImp::SetTitlePaneTextL(const TDesC& aTitleText)
+	{
+    TRACER("CGlxFullScreenViewImp::SetTitlePaneTextL()");
+    CAknViewAppUi* appui = AppUi();
+    if (appui)
+        {
+        CAknTitlePane* titlePane =
+                (CAknTitlePane*) appui->StatusPane()->ControlL(TUid::Uid(
+                        EEikStatusPaneUidTitle));
+        titlePane->SetTextL(aTitleText);
+        titlePane->DrawNow();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// HandleItemRemovedL
+// ---------------------------------------------------------------------------
+void CGlxFullScreenViewImp::HandleItemRemovedL()
+    {
+    TRACER("CGlxFullScreenViewImp::HandleItemRemovedL()");
+    TInt focusIndex = iMediaList->FocusIndex();
+    TInt mlCount = iMediaList->Count();
+    GLX_LOG_INFO2("CGlxFullScreenViewImp::HandleItemRemovedL focusIndex=%d, iOldFocusIndex=%d",
+            focusIndex, iOldFocusIndex);
+    // When photos is in background, the Following scenario could happen,
+    // 1) First item is deleted => iOldFocusIndex == focusIndex (or)
+    // 2) Last item is deleted => iOldFocusIndex == mlCount (or)
+    // 3) New item is added and focused item is deleted => iOldFocusIndex != focusIndex
+    if (mlCount && (iOldFocusIndex == focusIndex || iOldFocusIndex == mlCount
+            || iOldFocusIndex != focusIndex) && iZoomControl
+            && iZoomControl->Activated())
+        {
+        GLX_LOG_INFO("Focused item is removed, Exit zoom view!");
+        DeactivateZoomControlL();
+        }
+    SetItemToHDMIL();
+    if (focusIndex != KErrNotFound && EUiOn == GetUiState())
+        {
+        // show/hide the slider
+        if (iSliderWidget)
+            {
+            iSliderWidget->ShowWidget(CheckIfSliderToBeShownL());
+            }
+        }
+    /** if this is the last image deleted when Photo is in foreground, go back to the previous view*/
+    if (mlCount == 0 && IsForeground() && iNaviState->ViewingMode()
+            == NGlxNavigationalState::EView)
+        {
+        iUiUtility->SetViewNavigationDirection(EGlxNavigationBackwards);
+        iNaviState->ActivatePreviousViewL();
+        }
+    TRAP_IGNORE(ShowDrmExpiryNoteL());
+    }
--- a/photosgallery/viewframework/views/listview/src/glxlistviewimp.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/views/listview/src/glxlistviewimp.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -633,6 +633,12 @@
     if (iMediaList->FocusIndex() != EGlxListItemAll || iMediaList->IdSpaceId(
             0) != KGlxIdSpaceIdRoot)
         {
+        // Delete the bitmap; otherwise this memory will be leaked
+        if (aBitmap)
+            {
+            delete aBitmap;
+            aBitmap = NULL;
+            }
         GLX_LOG_INFO("CGlxListViewImp::PreviewTNReadyL()- Ignore!");
         return;
         }
@@ -716,16 +722,6 @@
             HBufC* emptyText = StringLoader::LoadLC(R_LIST_EMPTY_VIEW_TEXT); 
             iList->SetEmptyTextL(*emptyText);
             CleanupStack::PopAndDestroy(emptyText);
-            
-            //While coming back to main listview
-            TGlxIdSpaceId id = iMediaList->IdSpaceId(0);
-            if((id == KGlxIdSpaceIdRoot) && (mediaCount > 0))
-                {            
-                for (TInt i = 0; i < mediaCount; i++)
-                    {
-                    SetDefaultThumbnailL(i);
-                    }
-                }            
             }		
         
 		//Fix for ESLM-7SAHPT::Clear Flag to Disable QWERTY search input in list view
@@ -743,11 +739,18 @@
 		
 	if (mediaCount)
 	    {
+        TGlxIdSpaceId id = iMediaList->IdSpaceId(0);
+
 		for (TInt i=0; i<mediaCount; i++)
 			{
 		   	const TGlxMedia& item = iMediaList->Item(i);
 			iList->ItemL(i).SetTitleL(item.Title());
 			iList->ItemL(i).SetTextL(item.SubTitle());
+            // Set the default TNs for the main listview
+            if (id == KGlxIdSpaceIdRoot)
+                {
+                SetDefaultThumbnailL(i);
+                }
 			}
 		GLX_DEBUG3("CGlxListViewImp::CreateListL() Medialist Count = %d, "
 		        "iLastFocusIndex %d",mediaCount,iLastFocusedIndex);
@@ -1167,10 +1170,6 @@
             {
             iProgressIndicator->ShowProgressbarL();
             }
-        else
-            {
-            iProgressIndicator->DismissProgressDialog();
-            }
         }
     }
 
--- a/photosgallery/viewframework/views/listview/src/glxpreviewthumbnailbinding.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/views/listview/src/glxpreviewthumbnailbinding.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -153,9 +153,11 @@
             if (value)
                 {
                 CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
+                CleanupStack::PushL(bitmap);
                 ScaleBitmapToListSizeL(value->iBitmap, bitmap);
                 GLX_LOG_INFO1("iObserver.PreviewTNReadyL() iTrialCount=%d", iTrialCount);
                 iObserver.PreviewTNReadyL(bitmap, NULL);
+                CleanupStack::Pop(bitmap);
                 }
             else
                 {
--- a/photosgallery/viewframework/views/metadatadialog/inc/glxmetadatacontainer.h	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/views/metadatadialog/inc/glxmetadatacontainer.h	Tue Sep 14 21:19:17 2010 +0300
@@ -217,6 +217,8 @@
     	//Flag to indicate rename command is started
     	TBool iRenameStarted;
 
+        // Flag to indicate text entry popup display status
+        TBool iIsPopupShown;
 	};
 
 #endif //C_GLXMETADATACONTAINER_H__
--- a/photosgallery/viewframework/views/metadatadialog/src/glxmetadatacontainer.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/views/metadatadialog/src/glxmetadatacontainer.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -135,6 +135,9 @@
 
     //Flag to indicate rename command is started
     iRenameStarted = EFalse;
+
+    // Flag to indicate text entry popup display status
+	iIsPopupShown = EFalse;
     }
 
 // ---------------------------------------------------------
@@ -814,11 +817,13 @@
         {
         popup->SetLeftSoftKeyL(ETrue);
         }
+    iIsPopupShown = ETrue;
 
     //action upon selecting ok from the editor 
     if (popup->ExecuteLD() == EEikBidOk)
         {
-		if(0 != (popupText.Compare(*textBuf)))
+        iIsPopupShown = EFalse;
+		if (iItemMediaList->Count() && 0 != (popupText.Compare(*textBuf)))
             {
             TFileName fileName = ParseFileName(*textBuf);
             //check If filename already exists
@@ -921,6 +926,10 @@
 
     //notify observer that some operation has happened. So refresh the toolbar area..
     iResetToolbarObs.HandleToolbarResetting(EFalse);
+    if (!iItemMediaList->Count())
+        {
+        iDialogObesrver.HandleItemRemovedL();
+        }
     }
 
 // ----------------------------------------------------------------------------
@@ -1060,23 +1069,23 @@
             CGlxUStringConverter* stringConverter =
                     CGlxUStringConverter::NewL();
             CleanupStack::PushL(stringConverter);
-
-            //fetch media uri
-            stringConverter->AsStringL(item, aAttributes[index], 0,
-                    modifiedUri);
-            CleanupStack::PopAndDestroy(stringConverter);
-
-            //Check if media item was renamed
-            if (modifiedUri && modifiedUri->Compare(*iUri) != 0)
-                {
-                //Set rename command as started since
-                //Rename is also possible from File Manager
-                iRenameStarted = ETrue;
-                CleanupStack::PushL(modifiedUri);
-                RefreshMediaListL(*modifiedUri);
-                CleanupStack::PopAndDestroy(modifiedUri);
-                }
-            }
+			//fetch media uri
+			stringConverter->AsStringL(item, aAttributes[index], 0, modifiedUri);
+			if (modifiedUri)
+				{
+				CleanupStack::PushL(modifiedUri);
+				//Check if media item was renamed
+				if (modifiedUri->Compare(*iUri) != 0)
+					{
+					//Set rename command as started since
+					//Rename is also possible from File Manager
+					iRenameStarted = ETrue;
+					RefreshMediaListL(*modifiedUri);
+					}
+				CleanupStack::PopAndDestroy(modifiedUri);
+				}
+			CleanupStack::PopAndDestroy(stringConverter);
+			}
 
         }
 
@@ -1278,7 +1287,7 @@
         TInt /*aEndIndex*/, MGlxMediaList* /*aList*/)
     {
     TRACER("CGlxMetadataContainer::HandleItemRemovedL()");
-    if (iItemMediaList->Count() == 0)
+    if (!iItemMediaList->Count() && !iIsPopupShown)
         {
         iDialogObesrver.HandleItemRemovedL();
         }
--- a/photosgallery/viewframework/views/viewbase/src/glxmedialistviewbase.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/views/viewbase/src/glxmedialistviewbase.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -169,8 +169,11 @@
         if ((navigationalState->Id() != TMPXItemId(
 				KGlxCollectionPluginAlbumsImplementationUid)))
             {
-            iPreloadContextForCommandHandlers
-                    = new (ELeave) CGlxAttributeContext(&iSelectionIterator);
+			if (!iPreloadContextForCommandHandlers)
+				{
+				iPreloadContextForCommandHandlers
+						= new (ELeave) CGlxAttributeContext(&iSelectionIterator);
+				}
             TInt commandHandlerCount = iCommandHandlerList.Count();
             for (TInt i = 0; i < commandHandlerCount; i++)
                 {
@@ -390,6 +393,8 @@
         if (iPreloadContextForCommandHandlers)
             {
             iMediaList->RemoveContext(iPreloadContextForCommandHandlers);
+            delete iPreloadContextForCommandHandlers;
+            iPreloadContextForCommandHandlers = NULL;
             }
         iMediaList->Close();
         iMediaList = NULL;