photosgallery/controllers/fetcher/src/glxfetchercontainer.cpp
branchRCL_3
changeset 24 ea65f74e6de4
parent 21 f9e827349359
--- a/photosgallery/controllers/fetcher/src/glxfetchercontainer.cpp	Thu Jul 15 18:39:01 2010 +0300
+++ b/photosgallery/controllers/fetcher/src/glxfetchercontainer.cpp	Thu Aug 19 09:55:03 2010 +0300
@@ -32,7 +32,6 @@
 #include <AknsBasicBackgroundControlContext.h>      // Background Context
 
 #include <glxuistd.h>                               // KGlxFetchontextPriorityNormal and KGlxIconsFilename           
-#include <glxcollectionpluginall.hrh> 	            // All item collection plugin id
 #include <glxfilterfactory.h>                       // For Filters required in Medilaits
 #include <glxresourceutilities.h>                   // for CGlxResourceUtilities
 #include <glxfetcherdialog.rsg>                     // FOR GETTING Dialog ID AND RESOURCE ID
@@ -58,11 +57,6 @@
 #include "glxfetchercommandhandler.h"
 
 const TInt KPadding(7);
-const TInt KNoOfPages(4);
-const TInt KBufferTreshold(1);
-const TInt KItemsPerPage(18);
-const TInt KBufferSize(KNoOfPages * KItemsPerPage);
-const TInt KBufferTresholdSize(KBufferTreshold * KItemsPerPage);
 
 //-----------------------------------------------------------------------------
 // Two-phased constructor.
@@ -143,7 +137,6 @@
         }
     }
 
-
 // ---------------------------------------------------------------------------
 // CreateAndDisplayGridL
 // ---------------------------------------------------------------------------
@@ -169,6 +162,7 @@
 	    iMultipleMarkNotStarted = EFalse;
 	    }
 	}
+
 // ---------------------------------------------------------------------------
 // CreateMediaListL()
 // Creates a collection path
@@ -199,6 +193,7 @@
 	
 	CleanupStack::PopAndDestroy( path );
 	}
+
 // ---------------------------------------------------------------------------
 // CreateHgGridWidgetL
 // ---------------------------------------------------------------------------
@@ -252,7 +247,9 @@
     // This Displays the scrollbar at the opening of the Grid view
     iHgGrid->SetScrollBarTypeL(CHgScroller::EHgScrollerTimeStrip );
     // Enable Buffer support
-    iHgGrid->EnableScrollBufferL(*this, KBufferSize, KBufferTresholdSize);
+    iHgGrid->EnableScrollBufferL(*this, (KNoOfPages
+            * iUiUtility->VisibleItemsInPageGranularityL()),
+            KBufferTresholdSize);
     // Enable Marking support
     iHgGrid->SetMarkingObserver(*this);
 
@@ -265,12 +262,12 @@
 //  
 void CGlxFetcherContainer::CreateGridMediaListObserverL()
     {
-    iGlxGridMLObserver = CGlxGridViewMLObserver::NewL(*iMediaList, iHgGrid,
-            iFilterType);
+    iGlxGridMLObserver = CGlxGridViewMLObserver::NewL(*this, *iMediaList,
+            iHgGrid, iFilterType);
     }
     
 // ---------------------------------------------------------------------------
-// BufferPositionChanged
+// Request
 // ---------------------------------------------------------------------------
 //  
 void CGlxFetcherContainer::Request(TInt aRequestStart, TInt aRequestEnd,
@@ -279,6 +276,7 @@
     TRACER("CGlxFetcherContainer::Request()");
     TRAP_IGNORE(RequestL( aRequestStart, aRequestEnd ));
     }
+
 // ---------------------------------------------------------------------------
 // RequestL
 // ---------------------------------------------------------------------------
@@ -303,7 +301,7 @@
             visIndex = 0;
             }
 		
-        GLX_LOG_INFO1("CGlxGridViewImp::Request - SetVisibleWindowIndex "
+        GLX_LOG_INFO1("CGlxFetcherContainer::Request - SetVisibleWindowIndex "
                 "visIndex(%d)", visIndex);
         iMediaList->SetVisibleWindowIndexL(visIndex);
         }
@@ -314,13 +312,14 @@
         TInt lastOnScreen = firstIndex + iHgGrid->ItemsOnScreen() - 1;
         if (i >= firstIndex && i <= lastOnScreen)
             {
-            GLX_LOG_INFO1("CGlxGridViewImp::Request - RefreshScreen i(%d)", i);
+            GLX_LOG_INFO1("CGlxFetcherContainer::Request - RefreshScreen i(%d)", i);
             iHgGrid->RefreshScreen(i);
             }
         }
     }
+
 // ---------------------------------------------------------------------------
-// SetIcons
+// SetIconsL
 // ---------------------------------------------------------------------------
 //  
 void CGlxFetcherContainer::SetIconsL(TInt aIndex)
@@ -343,11 +342,11 @@
         CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
         bitmap->Duplicate( value->iBitmap->Handle());
         iHgGrid->ItemL(aIndex).SetIcon(CGulIcon::NewL(bitmap));
-        GLX_LOG_INFO1("### CGlxGridViewImp::Request value-Index is %d",aIndex);
+        GLX_LOG_INFO1("### CGlxFetcherContainer::Request value-Index is %d",aIndex);
         }
     else if (item.GetIconInfo(icon))
         {
-        GLX_LOG_INFO1("CGlxGridViewImp::Request - icon(%d)", aIndex);
+        GLX_LOG_INFO1("CGlxFetcherContainer::Request - icon(%d)", aIndex);
         CFbsBitmap* bitmap = NULL;
         CFbsBitmap* mask = NULL;
         AknsUtils::CreateIconLC(AknsUtils::SkinInstance(), KAknsIIDNone,
@@ -363,13 +362,13 @@
         iHgGrid->ItemL(aIndex).SetIcon(CGulIcon::NewL(bitmap, mask));
         CleanupStack::Pop(mask);
         CleanupStack::Pop(bitmap);
-        GLX_LOG_INFO1("### CGlxGridViewImp::Request GetIconInfo-Index is %d",
+        GLX_LOG_INFO1("### CGlxFetcherContainer::Request GetIconInfo-Index is %d",
                 aIndex);
         }
     else if (KErrNone != tnError && KErrNotSupported != tnError)
         {
         GLX_LOG_INFO2(
-                "CGlxGridViewImp::Request - image_corrupted tnError(%d), "
+                "CGlxFetcherContainer::Request - image_corrupted tnError(%d), "
                     "i(%d)", tnError, aIndex);
 
         CFbsBitmap* bitmap = NULL;
@@ -441,22 +440,29 @@
     }
 
 // ---------------------------------------------------------------------------
-// HandleSelect
+// HandleSelectL
 // ---------------------------------------------------------------------------
 //  
 void CGlxFetcherContainer::HandleSelectL( TInt aIndex )
     {
-    TRACER("CGlxGridViewImp::HandleSelect()");
+    TRACER("CGlxFetcherContainer::HandleSelectL()");
+    GLX_LOG_INFO1("CGlxFetcherContainer::HandleSelectL(%d)", aIndex);
     // Make sure that the Selection Index is inside medialist count
-    if (aIndex <iMediaList->Count() && aIndex >=0)
+    if (aIndex < iMediaList->Count() && aIndex >= 0)
         {
         // Setting the focus of the medialist
-        iMediaList->SetFocusL(NGlxListDefs::EAbsolute, aIndex);        
+        iMediaList->SetFocusL(NGlxListDefs::EAbsolute, aIndex);
+
+        //Show Left Soft Key when media is selected
+        CEikButtonGroupContainer* cbaContainer =
+                CEikButtonGroupContainer::Current();
+        cbaContainer->SetCommandSetL(R_AVKON_SOFTKEYS_OK_CANCEL);
+        cbaContainer->DrawDeferred();
         }
     }
 
 // ---------------------------------------------------------------------------
-// HandleOpen
+// HandleOpenL
 // ---------------------------------------------------------------------------
 //  
 void CGlxFetcherContainer::HandleOpenL( TInt aIndex )
@@ -482,7 +488,7 @@
 //  
 void CGlxFetcherContainer::HandleMarkingL( TInt aIndex, TBool/* aMarked*/ )
     {
-    TRACER("CGlxGridViewImp::HandleMarkingL()");
+    TRACER("CGlxFetcherContainer::HandleMarkingL()");
     HandleMultipleMarkingL(aIndex);
     iEventObserver.HandleMarkEventL();    
     }
@@ -493,7 +499,7 @@
 //  
 void CGlxFetcherContainer::HandleMultipleMarkingL(TInt aIndex )
     {
-    TRACER("CGlxGridViewImp::HandleMultipleMarkingL()");
+    TRACER("CGlxFetcherContainer::HandleMultipleMarkingL()");
     if(iMediaList->IsSelected(aIndex))
         {
         if(iHgGrid)
@@ -603,7 +609,6 @@
     return retVal;
     }
 
-
 // -----------------------------------------------------------------------------
 // Retrieve Uris
 // -----------------------------------------------------------------------------