imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp
branchRCL_3
changeset 11 dea39715fc05
parent 10 7403edfcf0fb
child 13 ee674526fac5
equal deleted inserted replaced
10:7403edfcf0fb 11:dea39715fc05
    34 #include "thumbnaildiskunmountobserver.h"
    34 #include "thumbnaildiskunmountobserver.h"
    35 #include "thumbnailpanic.h"
    35 #include "thumbnailpanic.h"
    36 #include "thumbnailcenrep.h"
    36 #include "thumbnailcenrep.h"
    37 #include "thumbnailmemorycardobserver.h"
    37 #include "thumbnailmemorycardobserver.h"
    38 #include "tmgetimei.h"
    38 #include "tmgetimei.h"
    39 //#include "thumbnailfetchedchecker.h"
       
    40 
    39 
    41 
    40 
    42 _LIT8( KThumbnailMimeWildCard, "*" );
    41 _LIT8( KThumbnailMimeWildCard, "*" );
    43 _LIT8( KThumbnailMimeImage, "image" );
    42 _LIT8( KThumbnailMimeImage, "image" );
    44 _LIT8( KThumbnailMimeVideo, "video" );
    43 _LIT8( KThumbnailMimeVideo, "video" );
   218     
   217     
   219     // create shutdown observer
   218     // create shutdown observer
   220     iShutdownObserver = CTMShutdownObserver::NewL( *this, KTMPSNotification, KShutdown, ETrue );  
   219     iShutdownObserver = CTMShutdownObserver::NewL( *this, KTMPSNotification, KShutdown, ETrue );  
   221     iShutdown = EFalse;
   220     iShutdown = EFalse;
   222     
   221     
       
   222     // MDS session reconnect timer
       
   223     iReconnect = CPeriodic::NewL(CActive::EPriorityIdle);
       
   224     
   223     // connect to MDS
   225     // connect to MDS
   224     iMdESession = CMdESession::NewL( *this );
   226     iMdESession = CMdESession::NewL( *this );
   225     
   227     
   226     User::LeaveIfError( iFbsSession.Connect());
   228     User::LeaveIfError( iFbsSession.Connect());
   227     User::LeaveIfError( Start( KThumbnailServerName ));
   229     User::LeaveIfError( Start( KThumbnailServerName ));
   250     iFormatting = EFalse;
   252     iFormatting = EFalse;
   251     
   253     
   252     //OpenStoresL();
   254     //OpenStoresL();
   253     
   255     
   254     AddUnmountObserversL();
   256     AddUnmountObserversL();
   255     
       
   256     iReconnect = CPeriodic::NewL(CActive::EPriorityIdle);
       
   257 	
       
   258     //iFetchedChecker = CThumbnailFetchedChecker::NewL();
       
   259     }
   257     }
   260 
   258 
   261 
   259 
   262 // ---------------------------------------------------------------------------
   260 // ---------------------------------------------------------------------------
   263 // Destructor.
   261 // Destructor.
   267     {
   265     {
   268     TN_DEBUG1( "CThumbnailServer::~CThumbnailServer()" );
   266     TN_DEBUG1( "CThumbnailServer::~CThumbnailServer()" );
   269 
   267 
   270     iShutdown = ETrue;
   268     iShutdown = ETrue;
   271     
   269     
   272     //delete iFetchedChecker;
       
   273     delete iShutdownObserver;
   270     delete iShutdownObserver;
   274     delete iProcessor;
   271     delete iProcessor;
   275     
   272     
   276     if(iReconnect)
   273     if(iReconnect)
   277         {
   274         {
   537         }
   534         }
   538     else
   535     else
   539         {
   536         {
   540         TN_DEBUG1( "CThumbnailServer::StoreThumbnailL() - file doesn't exists anymore, skip store!");
   537         TN_DEBUG1( "CThumbnailServer::StoreThumbnailL() - file doesn't exists anymore, skip store!");
   541         }
   538         }
   542 	/*if( iFetchedChecker )
       
   543 		{	
       
   544     	iFetchedChecker->SetFetchResult( aPath, KErrNone );
       
   545 		}*/
       
   546     }
   539     }
   547 
   540 
   548 
   541 
   549 // -----------------------------------------------------------------------------
   542 // -----------------------------------------------------------------------------
   550 // CThumbnailServer::FetchThumbnailL()
   543 // CThumbnailServer::FetchThumbnailL()
   552 //
   545 //
   553 void CThumbnailServer::FetchThumbnailL( const TDesC& aPath, CFbsBitmap* &
   546 void CThumbnailServer::FetchThumbnailL( const TDesC& aPath, CFbsBitmap* &
   554     aThumbnail, TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aOriginalSize )
   547     aThumbnail, TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aOriginalSize )
   555     {
   548     {
   556     TN_DEBUG3( "CThumbnailServer::FetchThumbnailL(aPath=%S aThumbnailSize=%d)", &aPath, aThumbnailSize );
   549     TN_DEBUG3( "CThumbnailServer::FetchThumbnailL(aPath=%S aThumbnailSize=%d)", &aPath, aThumbnailSize );
       
   550 
   557     StoreForPathL( aPath )->FetchThumbnailL( aPath, aThumbnail, aData, aThumbnailSize, aOriginalSize);
   551     StoreForPathL( aPath )->FetchThumbnailL( aPath, aThumbnail, aData, aThumbnailSize, aOriginalSize);
   558 /*    TInt err( iFetchedChecker->LastFetchResult( aPath ) );
       
   559     if ( err == KErrNone ) // To avoid useless sql gets that fails for sure
       
   560         {
       
   561         TRAP( err, StoreForPathL( aPath )->FetchThumbnailL( aPath, aThumbnail, aData, aThumbnailSize, aOriginalSize) );
       
   562         if ( err != KErrNone )
       
   563             {
       
   564             iFetchedChecker->SetFetchResult( aPath, err );
       
   565             }
       
   566         }
       
   567     User::LeaveIfError( err );*/
       
   568     }
   552     }
   569 
   553 
   570 
   554 
   571 
   555 
   572 // -----------------------------------------------------------------------------
   556 // -----------------------------------------------------------------------------
   614 void CThumbnailServer::DeleteThumbnailsL( const TDesC& aPath )
   598 void CThumbnailServer::DeleteThumbnailsL( const TDesC& aPath )
   615     {
   599     {
   616     TN_DEBUG2( "CThumbnailServer::DeleteThumbnailsL(%S)", &aPath);
   600     TN_DEBUG2( "CThumbnailServer::DeleteThumbnailsL(%S)", &aPath);
   617     
   601     
   618     StoreForPathL( aPath )->DeleteThumbnailsL( aPath );
   602     StoreForPathL( aPath )->DeleteThumbnailsL( aPath );
   619 	/*
       
   620 	if( iFetchedChecker )
       
   621 		{
       
   622     	iFetchedChecker->SetFetchResult( aPath, KErrNone );
       
   623 		}*/
       
   624     }
   603     }
   625 
   604 
   626 // -----------------------------------------------------------------------------
   605 // -----------------------------------------------------------------------------
   627 // CThumbnailServer::ResolveMimeTypeL()
   606 // CThumbnailServer::ResolveMimeTypeL()
   628 // -----------------------------------------------------------------------------
   607 // -----------------------------------------------------------------------------
   629 //
   608 //
   630 TDataType CThumbnailServer::ResolveMimeTypeL( RFile& aFile )
   609 TDataType CThumbnailServer::ResolveMimeTypeL( RFile64& aFile )
   631     {
   610     {
   632     TN_DEBUG1( "CThumbnailStore::ResolveMimeTypeL()");
   611     TN_DEBUG1( "CThumbnailStore::ResolveMimeTypeL()");
   633     RFile tmp = aFile;
   612     RFile64 tmp = aFile;
   634     
   613     
   635     // check if DRM
   614     // check if DRM
   636     ContentAccess::CData* data = ContentAccess::CData::NewLC( 
   615     ContentAccess::CData* data = ContentAccess::CData::NewLC( 
   637             tmp, ContentAccess::KDefaultContentObject, ContentAccess::EPeek );
   616             tmp, ContentAccess::KDefaultContentObject, ContentAccess::EPeek );
   638 
   617