photosgallery/controllers/imageviewer/src/glximageviewermanager.cpp
branchRCL_3
changeset 75 01504893d9cb
parent 60 5b3385a43d68
equal deleted inserted replaced
68:5b238bc8ffb6 75:01504893d9cb
    24 #include <f32file.h>
    24 #include <f32file.h>
    25 #include <caf/manager.h>
    25 #include <caf/manager.h>
    26 #include <caf/content.h>
    26 #include <caf/content.h>
    27 #include <driveinfo.h>
    27 #include <driveinfo.h>
    28 #include <coeutils.h>
    28 #include <coeutils.h>
    29 #include <coemain.h>
       
    30 
    29 
    31 _LIT( KPrivateFolder, "\\Private\\" );
    30 _LIT( KPrivateFolder, "\\Private\\" );
    32 _LIT( KGifFileMime, "image/gif" );
    31 _LIT( KGifFileMime, "image/gif" );
    33 _LIT( KMbmFileExt, "image/x-epoc-mbm");
    32 _LIT( KMbmFileExt, "image/x-epoc-mbm");
    34 _LIT( KTempFilePath, "?:\\data\\images\\" );
    33 _LIT( KTempFilePath, "?:\\data\\images\\" );
   120     if (aFileName.Length() == 0)
   119     if (aFileName.Length() == 0)
   121         {
   120         {
   122         User::Leave(KErrNotSupported);    
   121         User::Leave(KErrNotSupported);    
   123         }
   122         }
   124     iImageUri = aFileName.AllocL();  
   123     iImageUri = aFileName.AllocL();  
   125     CreateImageDecoderL();
       
   126     }
   124     }
   127 
   125 
   128 // ---------------------------------------------------------------------------
   126 // ---------------------------------------------------------------------------
   129 // Reset
   127 // Reset
   130 // ---------------------------------------------------------------------------
   128 // ---------------------------------------------------------------------------
   136         {
   134         {
   137         iFile->Close();
   135         iFile->Close();
   138         }
   136         }
   139     delete iFile;
   137     delete iFile;
   140     iFile = NULL;
   138     iFile = NULL;
   141 
       
   142 	CloseImageDecoder();
       
   143 
   139 
   144     if (iIsPrivateGif)
   140     if (iIsPrivateGif)
   145         {
   141         {
   146         iManager->DeleteFile(iImageUri->Des());
   142         iManager->DeleteFile(iImageUri->Des());
   147         iIsPrivateGif = EFalse;
   143         iIsPrivateGif = EFalse;
   210             iIsPrivateGif = ETrue;
   206             iIsPrivateGif = ETrue;
   211             }
   207             }
   212         }
   208         }
   213     SetImageUriL( filePath );
   209     SetImageUriL( filePath );
   214     }
   210     }
   215 
       
   216 // ---------------------------------------------------------------------------
       
   217 // CloseImageDecoder
       
   218 // ---------------------------------------------------------------------------
       
   219 //
       
   220 EXPORT_C void CGlxImageViewerManager::CloseImageDecoder()
       
   221     {
       
   222     TRACER("void CGlxImageViewerManager::CloseImageDecoder()");
       
   223     if (iImageDecoder)
       
   224         {
       
   225         delete iImageDecoder;
       
   226         iImageDecoder = NULL;
       
   227         }
       
   228     }
       
   229 
       
   230 // ---------------------------------------------------------------------------
       
   231 // CreateImageDecoderL
       
   232 // ---------------------------------------------------------------------------
       
   233 //
       
   234 EXPORT_C void CGlxImageViewerManager::CreateImageDecoderL()
       
   235     {
       
   236     TRACER("void CGlxImageViewerManager::CreateImageDecoderL()");
       
   237 
       
   238     CloseImageDecoder();
       
   239 
       
   240     TInt err = KErrNone;
       
   241     if (IsPrivate())
       
   242         {
       
   243         if (&ImageFileHandle())
       
   244             {
       
   245             GLX_DEBUG1("CGlxImageViewerManager::CreateImageDecoderL() FH");
       
   246             TRAP(err, iImageDecoder = CImageDecoder::FileNewL(
       
   247                     ImageFileHandle(), ContentAccess::EPeek));
       
   248             }
       
   249         }
       
   250     else
       
   251         {
       
   252         if (ImageUri())
       
   253             {
       
   254             GLX_DEBUG1("CGlxImageViewerManager::CreateImageDecoderL() FN");
       
   255             TRAP(err, iImageDecoder = CImageDecoder::FileNewL(
       
   256                     CCoeEnv::Static()->FsSession(), ImageUri()->Des()));
       
   257             }
       
   258         }
       
   259 
       
   260     GLX_DEBUG2("CGlxImageViewerManager::CreateImageDecoderL() err(%d)", err);
       
   261     User::LeaveIfError(err);
       
   262     }