photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerdelete.cpp
branchRCL_3
changeset 24 ea65f74e6de4
parent 19 420f6808bf21
--- a/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerdelete.cpp	Thu Jul 15 18:39:01 2010 +0300
+++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerdelete.cpp	Thu Aug 19 09:55:03 2010 +0300
@@ -39,6 +39,8 @@
 #include <mpxcollectionpath.h>
 #include <glxcollectionpluginimageviewer.hrh>
 #include "glxcommandfactory.h"
+#include <glximageviewermanager.h>
+
 
 // ---------------------------------------------------------------------------
 // Two-phased constructor.
@@ -214,35 +216,31 @@
         MGlxMediaList& aList) const 
         {
         TRACER( "CGlxCommandHandlerDelete::DoIsDisabled" );
-        TBool fullscreenViewingMode = EFalse;
-        CGlxNavigationalState* aNavigationalState = CGlxNavigationalState::InstanceL();
-        CMPXCollectionPath* naviState = aNavigationalState->StateLC();
+        TBool disable = EFalse;
+
+        CGlxNavigationalState* navState = CGlxNavigationalState::InstanceL();
+		CleanupClosePushL(*navState);
+        CMPXCollectionPath* path = navState->StateLC();
         
-        if ( naviState->Levels() >= 1)
+        if ( path->Levels() >= 1)
             {
-            if (aNavigationalState->ViewingMode() == NGlxNavigationalState::EBrowse) 
+			CGlxImageViewerManager* viewerInstance = CGlxImageViewerManager::InstanceL();
+            if (path->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid)
+                        && viewerInstance->IsPrivate())
                 {
-                // For image viewer collection, goto view mode
-                if (naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid))
-                    {
-                    //it means we are in img viewer.
-                    fullscreenViewingMode = ETrue;
-                    }
-                } 
-            else 
-                {
-                //it means we are in Fullscreen.
-                fullscreenViewingMode = ETrue;
-                }                
+                //it means we are in image viewer private path.
+                disable = ETrue;
+                }
+			viewerInstance->DeleteInstance();
             }
-        CleanupStack::PopAndDestroy( naviState );
-        aNavigationalState->Close();
-        if (EGlxCmdDelete==aCommandId && 0 == aList.Count() &&
-		                                 !fullscreenViewingMode)
+        CleanupStack::PopAndDestroy(path);
+        CleanupStack::PopAndDestroy(navState);
+
+        if (EGlxCmdDelete==aCommandId && 0 == aList.Count())
             {   
-            return ETrue;
+            disable = ETrue;
             }     
-        return EFalse;
+        return disable;
         }
 //end of file