videocollection/hgmyvideos/src/vcxhgmyvideoscategorylistimpl.cpp
branchRCL_3
changeset 8 ce5ada96ab30
parent 0 96612d01cf9f
child 11 8970fbd719ec
--- a/videocollection/hgmyvideos/src/vcxhgmyvideoscategorylistimpl.cpp	Fri Feb 19 22:52:52 2010 +0200
+++ b/videocollection/hgmyvideos/src/vcxhgmyvideoscategorylistimpl.cpp	Fri Mar 12 15:43:00 2010 +0200
@@ -20,6 +20,8 @@
 // INCLUDE FILES
 #include <ganes/HgScroller.h>
 #include <vcxhgmyvideos.rsg>
+#include <myvideosindicator.h>
+#include <ganes/HgDoubleGraphicList.h>
 
 #include "vcxhgmyvideoscategorylistimpl.h"
 #include "vcxhgmyvideoscategorymodelhandler.h"
@@ -79,7 +81,21 @@
 void CVcxHgMyVideosCategoryListImpl::ConstructL()
     {
     CVcxHgMyVideosListBase::ConstructL();
-    iCategoryModel = new (ELeave) CVcxHgMyVideosCategoryModelHandler( iModel, *iScroller );
+    iCategoryModel = CVcxHgMyVideosCategoryModelHandler::NewL( iModel, *iScroller );
+
+    // Load indicator
+    CGulIcon* ind = iCategoryModel->VideoIndicatorL().VideoOverlayIndicatorL();
+    if ( ind )
+        {
+        CleanupStack::PushL( ind );
+        // Ownership of the icon is transferred
+        static_cast<CHgDoubleGraphicList*>( iScroller )->SetIconOverlayIndicator( ind );
+        CleanupStack::Pop( ind );
+        }
+
+    // Set default icon as empty
+    iScroller->SetDefaultIconL( iCategoryModel->CreateEmptyHgListIconL() );
+
     iScroller->SetFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
     iScroller->SetSelectionObserver( *this );
     }
@@ -141,10 +157,53 @@
 void CVcxHgMyVideosCategoryListImpl::HandleOpenL( TInt /*aIndex*/ )
     {
     TInt highlight = Highlight();
+    TInt categoryId = iCategoryModel->ResolveCategoryId( highlight );
     
-    if ( highlight >= 0 && iModel.TouchSupport() )
+    switch ( categoryId )
         {
-        iView.ActivateVideoListL( iCategoryModel->ResolveCategoryId( highlight ) );
+        case KVcxMvcCategoryIdAll:
+        case KVcxMvcCategoryIdDownloads:
+        case KVcxMvcCategoryIdCaptured:
+        case KVcxMvcCategoryIdOther:
+            {
+            if ( highlight >= 0 && iModel.TouchSupport() )
+                {
+                iView.ActivateVideoListL( iCategoryModel->ResolveCategoryId( highlight ) );
+                }
+            }
+            break;
+            
+        case KCategoryIdLastWatched:
+            {
+            iCategoryModel->PlayLastWatchedVidedoL();
+            }
+            break;
+            
+        case KCategoryIdExtraItem1:
+        case KCategoryIdExtraItem2:
+        case KCategoryIdExtraItem3:
+            {
+            // Handle item according to type (open web link or start app).
+            
+            TVcxHgMyVideosCategoryItemType itemType;
+            TUid appUid;
+            TBuf<64> urlString;
+            iCategoryModel->HandleExtraItemSelectionL( categoryId, itemType, appUid, urlString );
+            
+            if ( itemType == TVcxHgMyVideosCategoryItemTypeUid )
+                {
+                iView.LaunchAppL( appUid );
+                }
+            else if ( itemType == TVcxHgMyVideosCategoryItemTypeUrl )
+                {
+                iView.LaunchBrowserL( urlString );
+                }
+            }
+            break;
+            
+        default:
+            ASSERT( 0 );
+            break;
         }
     }