diff -r 71da52165949 -r ce1c7ad1f18b photosgallery/controllers/imageviewer/src/glximageviewermanager.cpp --- a/photosgallery/controllers/imageviewer/src/glximageviewermanager.cpp Fri Mar 12 15:42:44 2010 +0200 +++ b/photosgallery/controllers/imageviewer/src/glximageviewermanager.cpp Mon Mar 15 12:40:30 2010 +0200 @@ -19,9 +19,17 @@ #include "glximageviewermanager.h" #include #include +#include #include +#include +#include +#include +_LIT( KPrivateFolder, "\\Private\\" ); +_LIT( KGifFileExt, ".gif" ); +_LIT( KTempFilePath, "?:\\data\\images\\200104E7.gif" ); + EXPORT_C CGlxImageViewerManager* CGlxImageViewerManager::InstanceL() { TRACER("CGlxImageViewerManager::InstanceL()"); @@ -52,6 +60,12 @@ return iIsPrivate; } +EXPORT_C TBool CGlxImageViewerManager::IsPrivateGif() + { + TRACER("CGlxImageViewerManager::IsPrivateGif()"); + return iIsPrivateGif; + } + CGlxImageViewerManager::CGlxImageViewerManager() : iImageUri(NULL), iFile(NULL), iIsPrivate(EFalse) { @@ -121,6 +135,18 @@ delete iFile; iFile = NULL; + if (iIsPrivateGif) + { + iManager->DeleteFile(iImageUri->Des()); + iIsPrivateGif = EFalse; + } + + if ( iManager ) + { + delete iManager; + iManager = NULL; + } + if ( iImageUri ) { delete iImageUri; @@ -136,18 +162,34 @@ EXPORT_C void CGlxImageViewerManager::SetImageFileHandleL(const RFile& aFileHandle) { TRACER("void CGlxImageViewerManager::SetImageFileHandleL()"); - _LIT( KPrivateFolder, "\\Private\\" ); // Platsec private folder TFileName filePath; - User::LeaveIfError( aFileHandle.FullName( filePath ) ); - SetImageUriL( filePath ); - TParsePtrC parse( filePath ); - if( parse.PathPresent() && - parse.Path().Length() > KPrivateFolder().Length() && - parse.Path().Left( KPrivateFolder().Length() ).CompareF( KPrivateFolder ) == 0 ) + User::LeaveIfError(aFileHandle.FullName(filePath)); + TParsePtrC parse(filePath); + if (parse.PathPresent() && parse.Path().Length() + > KPrivateFolder().Length() && parse.Path().Left( + KPrivateFolder().Length()).CompareF(KPrivateFolder) == 0) { // File is in private folder; duplicate file handle iFile = new (ELeave) RFile64; - User::LeaveIfError( iFile->Duplicate( aFileHandle ) ); + User::LeaveIfError(iFile->Duplicate(aFileHandle)); iIsPrivate = ETrue; + if (parse.Ext().Compare(KGifFileExt) == 0) + { + // Gif file from private path, hence make a local copy. + TFileName ramFilePath(KTempFilePath); + TChar drive; + User::LeaveIfError(DriveInfo::GetDefaultDrive( + DriveInfo::EDefaultRam, drive)); + ramFilePath[0] = drive; + ConeUtils::EnsurePathExistsL(ramFilePath); + if (!iManager) + { + iManager = ContentAccess::CManager::NewL(); + } + iManager->CopyFile(*iFile, ramFilePath); + filePath.Copy(ramFilePath); + iIsPrivateGif = ETrue; + } } + SetImageUriL( filePath ); }