# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1274955080 -10800 # Node ID a67f740606827ad5f63756a4995d27854374171d # Parent b790c5b3d11f4c601c0e300cdc48a1af83089730 Revision: 201019 Kit: 2010121 diff -r b790c5b3d11f -r a67f74060682 imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager.h --- a/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager.h Fri May 14 16:10:12 2010 +0300 +++ b/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager.h Thu May 27 13:11:20 2010 +0300 @@ -26,6 +26,7 @@ #include class MThumbnailManagerObserver; +class MThumbnailManagerRequestObserver; typedef TInt TThumbnailRequestId; @@ -45,7 +46,8 @@ EAudioFullScreenThumbnailSize, EGridThumbnailSize, EListThumbnailSize, -EFullScreenThumbnailSize +EFullScreenThumbnailSize, +EThumbnailSizeCount //last item, don't remove } TThumbnailSize; /** * Thumbnail engine. @@ -413,8 +415,7 @@ * @return Symbian OS error code or KErrNone if change was * successful. */ - virtual TInt ChangePriority( TThumbnailRequestId aId, TInt aNewPriority ) = - 0; + virtual TInt ChangePriority( TThumbnailRequestId aId, TInt aNewPriority ) = 0; /** * Get a list of supported file formats for object files. @@ -566,6 +567,21 @@ virtual TThumbnailRequestId RenameThumbnailsL( const TDesC& aCurrentPath, const TDesC& aNewPath, TInt aPriority = CActive::EPriorityIdle ) = 0; + /** + * Set optional request observer for getting information about completed + * requests that don't include a thumbnail. + * + * @since Symbian^3 + * @param aObserver Observer to receive notifications. + */ + virtual void SetRequestObserver( MThumbnailManagerRequestObserver& aObserver ) = 0; + + /** + * Remove optional request observer. + * + * @since Symbian^3 + */ + virtual void RemoveRequestObserver() = 0; }; #endif // THUMBNAILMANAGER_H diff -r b790c5b3d11f -r a67f74060682 imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager_qt.h --- a/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager_qt.h Fri May 14 16:10:12 2010 +0300 +++ b/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager_qt.h Thu May 27 13:11:20 2010 +0300 @@ -18,15 +18,18 @@ #ifndef THUMBNAILMANAGER_QT_H #define THUMBNAILMANAGER_QT_H -#include -#include -#include +#include +#include +#include + #include -class ThumbnailManagerPrivate; class QString; class QSize; +class ThumbnailManagerPrivate; +class TestThumbnailManager; + #ifdef TNMQT_DLL # define TNM_EXPORT Q_DECL_EXPORT #else @@ -300,7 +303,7 @@ * @param id Request ID for the operation * @param errorCode error code */ - void thumbnailReady( QPixmap , void * , int , int ); + TNM_EXPORT void thumbnailReady( QPixmap , void * , int , int ); /** * Final thumbnail bitmap generation or loading is complete. @@ -310,7 +313,7 @@ * @param id Request ID for the operation * @param errorCode error code */ - void thumbnailReady( QImage , void * , int , int ); + TNM_EXPORT void thumbnailReady( QImage , void * , int , int ); protected: @@ -320,6 +323,9 @@ private: ThumbnailManagerPrivate* d; + + friend class ThumbnailManagerPrivate; + friend class TestThumbnailManager; }; #endif // THUMBNAILMANAGER_QT diff -r b790c5b3d11f -r a67f74060682 imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanagerobserver.h --- a/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanagerobserver.h Fri May 14 16:10:12 2010 +0300 +++ b/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanagerobserver.h Thu May 27 13:11:20 2010 +0300 @@ -101,4 +101,37 @@ TThumbnailRequestId aId ) = 0; }; +/** Thumbnail request types */ +enum TThumbnailRequestType + { + ERequestDeleteThumbnails = 0 + }; + +/** + * Optional callback interface for getting information about other completed + * requests that don't include a thumbnail. + * + * Request types: + * - ERequestDeleteThumbnails + * + * Can be added using SetRequestObserver(MThumbnailManagerRequestObserver& aObserver) + * and removed using RemoveRequestObserver(). + * + * @since Symbian^3 + */ +class MThumbnailManagerRequestObserver + { +public: + /** + * A request is complete. + * + * @since Symbian^3 + * @param aError Error code. + * @param aRequestType Type of the completed request. + * @param aId Request ID for the operation. + */ + virtual void ThumbnailRequestReady( TInt aError, TThumbnailRequestType aRequestType, + TThumbnailRequestId aId ) = 0; +}; + #endif // THUMBNAILMANAGEROBSERVER_H diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h --- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h Thu May 27 13:11:20 2010 +0300 @@ -109,6 +109,7 @@ //default displaymode (bpp - bits per pixel) for TNs in DB //this makes possible to provide all colour depths up to 16M aka 24 -bit full colour +//Symbian^4 EColor16MAP const TDisplayMode KStoreDisplayMode = EColor16MAP; //required amount of memory to keep bitmaps on RAM in bits @@ -155,7 +156,7 @@ _LIT8( KWmaMime, "audio/x-ms-wma" ); _LIT( KWmaExt, ".wma" ); _LIT8( KBmpMime, "image/bmp" ); _LIT( KBmpExt, ".bmp" ); _LIT8( KAudio3gppMime, "audio/3gpp" ); -_LIT8( KVideo3gppMime, "video/3gpp" ); _LIT( K3gpExt, ".3gp" ); +_LIT8( KVideo3gppMime, "video/3gpp" ); _LIT( K3gpExt, ".3gp" ); _LIT( K3gppExt, ".3gpp" ); _LIT8( KAudioAmrMime, "audio/AMR" ); _LIT( KAmrExt, ".amr" ); _LIT8( KVideoWmvMime, "video/x-ms-wmv" ); _LIT( KWmvExt, ".wmv" ); _LIT8( KRealAudioMime, "audio/vnd.rn-realaudio" ); _LIT( KRealAudioExt, ".ra" ); @@ -280,8 +281,7 @@ * Control flags may be modified by server to signal client side what actually was done, like preview TN */ TThumbnailControlFlags iControlFlags; - - + /** * Original control flags set by the server for handling specific situations * (for example for distinguishing between preview thumbnails and @@ -298,6 +298,11 @@ * Thumbnail's orientation */ TInt iOrientation; + + /** + * Overwrite old thumbs (SetThumbnailL) + */ + TBool iOverwrite; }; diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/ThumbnailManager_0x102830AB_v10.10.6_SA_S60.50_Euro1.sis Binary file imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/ThumbnailManager_0x102830AB_v10.10.6_SA_S60.50_Euro1.sis has changed diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/ThumbnailManager_0x102830AB_v10.10.7_SA_S60.50_Euro1.sis Binary file imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/ThumbnailManager_0x102830AB_v10.10.7_SA_S60.50_Euro1.sis has changed diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/package.pkg --- a/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/package.pkg Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/package.pkg Thu May 27 13:11:20 2010 +0300 @@ -17,7 +17,7 @@ &EN ; Header -#{"Thumbnail Manager"},(0x102830AB), 10, 10, 6, TYPE=SA, RU +#{"Thumbnail Manager"},(0x102830AB), 10, 10, 7, TYPE=SA, RU ; Localised Vendor name %{"Nokia"} diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/stub.pkg --- a/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/stub.pkg Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/stub.pkg Thu May 27 13:11:20 2010 +0300 @@ -17,7 +17,7 @@ &EN ; Header -#{"ThumbnailManager"},(0x102830AB), 10, 10, 6, TYPE=SA +#{"ThumbnailManager"},(0x102830AB), 10, 10, 7, TYPE=SA ; Localised Vendor name %{"Nokia"} diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/thumbnailmanager_stub.sis Binary file imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/thumbnailmanager_stub.sis has changed diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/sis/thumbnailmanagercenrep/package.pkg --- a/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanagercenrep/package.pkg Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanagercenrep/package.pkg Thu May 27 13:11:20 2010 +0300 @@ -17,7 +17,7 @@ &EN ; Header -#{"Thumbnail Manager Cenrep"},(0x10202BE9), 10, 10, 6, TYPE=SP +#{"Thumbnail Manager Cenrep"},(0x10202BE9), 10, 10, 7, TYPE=SP ; Localised Vendor name %{"Symbian Software Ltd."} diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagdaemon.h --- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagdaemon.h Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagdaemon.h Thu May 27 13:11:20 2010 +0300 @@ -173,6 +173,8 @@ // reconnect timer CPeriodic* iReconnect; + TBool iSessionError; + #ifdef _DEBUG TUint32 iAddCounter; TUint32 iModCounter; diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h --- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h Thu May 27 13:11:20 2010 +0300 @@ -43,6 +43,7 @@ */ class CThumbAGProcessor: public CActive, public MThumbnailManagerObserver, + public MThumbnailManagerRequestObserver, public MMdEQueryObserver, public MHarvesterEventObserver, public MMPXCollectionObserver, @@ -78,6 +79,8 @@ // from MThumbnailManagerObserver void ThumbnailPreviewReady( MThumbnailData& aThumbnail, TThumbnailRequestId aId ); void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, TThumbnailRequestId aId ); + // from MThumbnailManagerRequestObserver + void ThumbnailRequestReady( TInt aError, TThumbnailRequestType aRequestType, TThumbnailRequestId aId ); // from MHarvesterEventObserver void HarvestingUpdated( @@ -311,7 +314,6 @@ TBool iMMCHarvesting; TBool iMMCHarvestingTemp; - CPeriodic* iPeriodicTimer; //MDS Harvester client @@ -346,8 +348,7 @@ //Flag is MPX harvesting or MTP synchronisation in progress TBool iMPXHarvesting; - //inactivity polling timer - CPeriodic* iInactivityTimer; + //overall status of device TBool iIdle; diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp Thu May 27 13:11:20 2010 +0300 @@ -147,6 +147,7 @@ } iMdESession = CMdESession::NewL( *this ); + iSessionError = EFalse; } else { @@ -280,8 +281,10 @@ void CThumbAGDaemon::HandleSessionError( CMdESession& /*aSession*/, TInt aError ) { TN_DEBUG2( "CThumbAGDaemon::HandleSessionError == %d", aError ); - if (aError != KErrNone) + if (aError != KErrNone && !iSessionError) { + iSessionError = ETrue; + // kill processor right away, because it also has MdESession if(iProcessor) { diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp Thu May 27 13:11:20 2010 +0300 @@ -66,6 +66,8 @@ TN_DEBUG1( "CThumbAGProcessor::ConstructL() - begin" ); iTMSession = CThumbnailManager::NewL( *this ); + iTMSession->SetRequestObserver(*this); + iQueryAllItems = NULL; iQueryPlaceholders = NULL; iQuery = NULL; @@ -116,11 +118,13 @@ { TN_DEBUG1( "CThumbAGProcessor::~CThumbAGProcessor() - begin" ); - if(iForegroundGenerationObserver) - { - delete iForegroundGenerationObserver; - iForegroundGenerationObserver = NULL; - } + Cancel(); + + if(iPeriodicTimer) + { + iPeriodicTimer->Cancel(); + delete iPeriodicTimer; + } if(iActivityManager) { @@ -128,19 +132,27 @@ iActivityManager = NULL; } - if (iInactivityTimer) + if (iQuery) { - iInactivityTimer->Cancel(); - delete iInactivityTimer; - iInactivityTimer = NULL; + iQuery->Cancel(); + delete iQuery; + iQuery = NULL; } - if(iPeriodicTimer) + if(iQueryPlaceholders) { - iPeriodicTimer->Cancel(); - delete iPeriodicTimer; + iQueryPlaceholders->Cancel(); + delete iQueryPlaceholders; + iQueryPlaceholders = NULL; } + if (iQueryAllItems) + { + iQueryAllItems->Cancel(); + delete iQueryAllItems; + iQueryAllItems = NULL; + } + if (!iInit) { #ifdef MDS_MODIFY_OBSERVER @@ -149,35 +161,18 @@ #endif } + if(iForegroundGenerationObserver) + { + delete iForegroundGenerationObserver; + iForegroundGenerationObserver = NULL; + } + if ( iCollectionUtility ) { iCollectionUtility->Close(); iCollectionUtility = NULL; } - Cancel(); - - if(iQueryPlaceholders) - { - iQueryPlaceholders->Cancel(); - delete iQueryPlaceholders; - iQueryPlaceholders = NULL; - } - - if (iQuery) - { - iQuery->Cancel(); - delete iQuery; - iQuery = NULL; - } - - if (iQueryAllItems) - { - iQueryAllItems->Cancel(); - delete iQueryAllItems; - iQueryAllItems = NULL; - } - iAddQueue.Close(); iModifyQueue.Close(); iRemoveQueue.ResetAndDestroy(); @@ -188,6 +183,7 @@ if (iTMSession) { + iTMSession->RemoveRequestObserver(); delete iTMSession; iTMSession = NULL; } @@ -435,6 +431,29 @@ TN_DEBUG1( "CThumbAGProcessor::ThumbnailReady() - end" ); } +// ----------------------------------------------------------------------------- +// CThumbAGProcessor::ThumbnailRequestReady() +// ----------------------------------------------------------------------------- +// +void CThumbAGProcessor::ThumbnailRequestReady( TInt /*aError*/, TThumbnailRequestType aRequestType, + TThumbnailRequestId /*aId*/ ) + { + if (aRequestType == ERequestDeleteThumbnails) + { + TN_DEBUG1( "CThumbAGProcessor::ThumbnailRequestReady() - delete" ); + + iActiveCount--; + + if(iActiveCount <= 0) + { + iActiveCount = 0; + iActive = EFalse; + } + + ActivateAO(); + } + } + // --------------------------------------------------------------------------- // CThumbAGProcessor::SetMdESession() // --------------------------------------------------------------------------- @@ -665,7 +684,7 @@ } } - // 10.1 specific + // Symbian^4 specific if( imageObjectDef.Id() != aObject->Def().Id() ) { TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() 1st round not image"); @@ -935,6 +954,7 @@ } else { + iTMSession->SetRequestObserver(*this); iSessionDied = EFalse; } } @@ -1110,9 +1130,10 @@ iRemoveQueue.Remove( 0 ); delete source; delete uri; + + iActiveCount++; + iActive = ETrue; } - - ActivateAO(); } else if( i2ndRoundGenerateQueue.Count() > 0) { @@ -1133,7 +1154,7 @@ // void CThumbAGProcessor::DeleteAndCancelQuery(TBool aRestoreItems) { - TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() in" ); + TN_DEBUG2( "CThumbAGProcessor::DeleteAndCancelQuery(aRestoreItems = %d) in", aRestoreItems ); if(iQuery) { @@ -1728,7 +1749,8 @@ { iIdle = ETrue; - if(iAddQueue.Count() + iModifyQueue.Count() + iRemoveQueue.Count() + i2ndRoundGenerateQueue.Count() > 0 ) + if(iAddQueue.Count() + iModifyQueue.Count() + iRemoveQueue.Count() + + iQueryQueue.Count() + i2ndRoundGenerateQueue.Count() > 0 ) { ActivateAO(); } diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailmanagerimpl.h --- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailmanagerimpl.h Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailmanagerimpl.h Thu May 27 13:11:20 2010 +0300 @@ -353,6 +353,22 @@ */ TThumbnailRequestId RenameThumbnailsL( const TDesC& aCurrentPath, const TDesC& aNewPath, TInt aPriority = CActive::EPriorityIdle ); + + /** + * Set optional request observer for getting information about completed + * requests that don't include a thumbnail. + * + * @since Symbian^3 + * @param aObserver Observer to receive notifications. + */ + void SetRequestObserver( MThumbnailManagerRequestObserver& aObserver ); + + /** + * Remove optional request observer. + * + * @since Symbian^3 + */ + void RemoveRequestObserver(); private: @@ -400,6 +416,11 @@ * Observer to receive notifications about completed operations. */ MThumbnailManagerObserver& iObserver; + + /** + * Observer to receive notifications about completed requests. + */ + MThumbnailManagerRequestObserver* iRequestObserver; /** * Session. diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestactive.h --- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestactive.h Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestactive.h Thu May 27 13:11:20 2010 +0300 @@ -32,7 +32,7 @@ class CThumbnailDataImpl; class CThumbnailRequestQueue; -enum TThumbnailRequestType +enum TThumbnailReqType { EReqGetThumbnailHandle = 0, EReqGetThumbnailPath = 1, @@ -66,16 +66,17 @@ * @since S60 v5.0 * @param aFs Fileserver used. * @param aThumbnailSession Session used. - * @param aObserver Observer to receive notifications about completed - * operations. + * @param aObserver Observer to receive notifications about completed operations. + * @param aRequestObserver Observer to receive notifications about completed requests. * @param aId Assigned ID of the request, session specific. * @param aPriority assigned processing priority * @param aQueue request processor * @return New CThumbnailRequestActive object. */ static CThumbnailRequestActive* NewL( RFs& aFs, RThumbnailSession& - aThumbnailSession, MThumbnailManagerObserver& aObserver, - TThumbnailRequestId aId, TInt aPriority, CThumbnailRequestQueue* aQueue ); + aThumbnailSession, MThumbnailManagerObserver& aObserver, + MThumbnailManagerRequestObserver* aRequestObserver, TThumbnailRequestId aId, + TInt aPriority, CThumbnailRequestQueue* aQueue ); /** * Get a thumbnail created from file object. @@ -163,12 +164,13 @@ * @param aGeneratePersistentSizesOnly * @param aTargetUri Target URI to which the imported thumbnail is linked. * @param aThumbnailSize Requested thumbnail size + * @param aOverwrite Overwrite old existing thumbs */ void SetThumbnailL( TDesC8* aBuffer, TThumbnailId aThumbnailId, const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager ::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly, - const TDesC& aTargetUri, TThumbnailSize aThumbnailSize ); + const TDesC& aTargetUri, TThumbnailSize aThumbnailSize, TBool aOverwrite); /** * Set a thumbnail @@ -187,12 +189,13 @@ * @param aGeneratePersistentSizesOnly * @param aTargetUri Target URI to which the imported thumbnail is linked. * @param aThumbnailSize Requested thumbnail size + * @param aOverwrite Overwrite old existing thumbs */ void SetThumbnailL( CFbsBitmap* aBitmap, TThumbnailId aThumbnailId, const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager ::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly, - const TDesC& aTargetUri, TThumbnailSize aThumbnailSize ); + const TDesC& aTargetUri, TThumbnailSize aThumbnailSize, TBool aOverwrite); /** * Update thumbnails by Id. @@ -294,16 +297,16 @@ * @since S60 v5.0 * @param aFs Fileserver used. * @param aThumbnailSession Session used. - * @param aObserver Observer to receive notifications about completed - * operations. + * @param aObserver Observer to receive notifications about completed operations. + * @param aRequestObserver Observer to receive notifications about completed requests. * @param aId Assigned ID of the request, session specific. * @param aPriority assigned processing priority * @param aQueue request processor * @return New CThumbnailRequestActive object. */ CThumbnailRequestActive( RFs& aFs, RThumbnailSession& aThumbnailSession, - MThumbnailManagerObserver& aObserver, TThumbnailRequestId aId, TInt aPriority, - CThumbnailRequestQueue* aQueue); + MThumbnailManagerObserver& aObserver, MThumbnailManagerRequestObserver* aRequestObserver, + TThumbnailRequestId aId, TInt aPriority, CThumbnailRequestQueue* aQueue); /** * Symbian 2nd phase constructor can leave. @@ -386,6 +389,11 @@ * Observer to receive notifications about completed operations. */ MThumbnailManagerObserver& iObserver; + + /** + * Observer to receive notifications about completed requests. + */ + MThumbnailManagerRequestObserver* iRequestObserver; /** * Fileserver, not own @@ -454,7 +462,7 @@ // not own CThumbnailRequestQueue* iRequestQueue; - TThumbnailRequestType iRequestType; + TThumbnailReqType iRequestType; // request timeout timer CPeriodic* iTimer; diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp Thu May 27 13:11:20 2010 +0300 @@ -89,7 +89,7 @@ // --------------------------------------------------------------------------- // CThumbnailManagerImpl::CThumbnailManagerImpl( MThumbnailManagerObserver& - aObserver ): iObserver( aObserver ), iDisplayMode( + aObserver ): iObserver( aObserver ), iRequestObserver( NULL ), iDisplayMode( KThumbnailDefaultDisplayMode ), iFlags( EDefaultFlags ), iQualityPreference ( EOptimizeForQuality ), iRequestId( 0 ) { @@ -154,7 +154,7 @@ TInt priority = ValidatePriority(aPriority); CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL - ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue ); + ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue ); CleanupStack::PushL( getThumbnailActive ); if(aObjectSource.Id() > 0) @@ -215,7 +215,7 @@ TInt priority = ValidatePriority(aPriority); CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL - ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue ); + ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue ); CleanupStack::PushL( getThumbnailActive ); getThumbnailActive->GetThumbnailL( KNullDesC, aThumbnailId, iFlags, @@ -249,7 +249,7 @@ TInt priority = ValidatePriority(aPriority); CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL - ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue ); + ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue ); CleanupStack::PushL( getThumbnailActive ); if ( aObjectSource.Uri().Length()) @@ -290,16 +290,26 @@ TInt priority = ValidatePriority(aPriority); CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL - ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue ); + ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue ); CleanupStack::PushL( getThumbnailActive ); - if ( aObjectSource.Uri().Length() && - aObjectSource.Buffer() != NULL && - aObjectSource.MimeType() != KNullDesC8) + if (aObjectSource.Uri().Length() && + aObjectSource.Bitmap() != NULL) { + // from bitmap + getThumbnailActive->SetThumbnailL( aObjectSource.GetBitmapOwnership(), + aObjectSource.Id(), KBmpMime, iFlags, iQualityPreference, + iSize, iDisplayMode, priority, aClientData, ETrue, + aObjectSource.Uri(), iThumbnailSize, ETrue); + } + else if (aObjectSource.Uri().Length() && + aObjectSource.Buffer() != NULL && + aObjectSource.MimeType() != KNullDesC8) + { + // from buffer getThumbnailActive->SetThumbnailL( aObjectSource.GetBufferOwnership(), aObjectSource.Id(), aObjectSource.MimeType(), iFlags, iQualityPreference, iSize, iDisplayMode, - priority, aClientData, EFalse, aObjectSource.Uri(), iThumbnailSize); + priority, aClientData, ETrue, aObjectSource.Uri(), iThumbnailSize, ETrue); } iRequestQueue->AddRequestL( getThumbnailActive ); @@ -329,7 +339,7 @@ TInt priority = ValidatePriority(aPriority); CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL - ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue ); + ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue ); CleanupStack::PushL( getThumbnailActive ); @@ -339,7 +349,7 @@ getThumbnailActive->SetThumbnailL( aObjectSource.GetBitmapOwnership(), aObjectSource.Id(), KBmpMime, iFlags, iQualityPreference, iSize, iDisplayMode, priority, NULL, ETrue, - aObjectSource.Uri(), EUnknownThumbnailSize); + aObjectSource.Uri(), EUnknownThumbnailSize, EFalse); } else if( !aObjectSource.Buffer() ) { @@ -354,7 +364,7 @@ getThumbnailActive->SetThumbnailL( aObjectSource.GetBufferOwnership(), aObjectSource.Id(), aObjectSource.MimeType(), iFlags, iQualityPreference, iSize, iDisplayMode, priority, NULL, - ETrue, aObjectSource.Uri(), EUnknownThumbnailSize); + ETrue, aObjectSource.Uri(), EUnknownThumbnailSize, EFalse); } iRequestQueue->AddRequestL( getThumbnailActive ); @@ -491,7 +501,8 @@ __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId )); CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL - ( iFs, iSession, iObserver, iRequestId, CActive::EPriorityIdle, iRequestQueue ); + ( iFs, iSession, iObserver, iRequestObserver, iRequestId, CActive::EPriorityIdle, + iRequestQueue ); CleanupStack::PushL( getThumbnailActive ); @@ -533,7 +544,8 @@ __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId )); CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL - ( iFs, iSession, iObserver, iRequestId, CActive::EPriorityIdle, iRequestQueue ); + ( iFs, iSession, iObserver, iRequestObserver, iRequestId, CActive::EPriorityIdle, + iRequestQueue ); CleanupStack::PushL( getThumbnailActive ); @@ -620,7 +632,7 @@ TInt priority = ValidatePriority(aPriority); CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL - ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue ); + ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue ); CleanupStack::PushL( getThumbnailActive ); getThumbnailActive->UpdateThumbnailsL( aPath, aItemId, iFlags, iQualityPreference, @@ -648,7 +660,7 @@ TInt priority = ValidatePriority(aPriority); CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL - ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue ); + ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue ); CleanupStack::PushL( getThumbnailActive ); getThumbnailActive->RenameThumbnails( aCurrentPath, aNewPath, priority ); @@ -661,6 +673,32 @@ return iRequestId; } + +// --------------------------------------------------------------------------- +// CThumbnailManagerImpl::SetRequestObserver() +// Adds optional request observer +// --------------------------------------------------------------------------- +// +void CThumbnailManagerImpl::SetRequestObserver( MThumbnailManagerRequestObserver& aObserver ) + { + iRequestObserver = NULL; + iRequestObserver = &aObserver; + } + +// --------------------------------------------------------------------------- +// CThumbnailManagerImpl::RemoveRequestObserver() +// Removes optional request observer +// --------------------------------------------------------------------------- +// +void CThumbnailManagerImpl::RemoveRequestObserver() + { + if (iRequestObserver) + { + iRequestObserver = NULL; + } + } + + // --------------------------------------------------------------------------- // CThumbnailManagerImpl::ValidatePriority() // Check that given priority is in range of CActive::TPriority diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailobjectsource.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailobjectsource.cpp Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailobjectsource.cpp Thu May 27 13:11:20 2010 +0300 @@ -134,6 +134,7 @@ iUri = aUri.AllocL(); iMimeType = HBufC8::NewL( aMimeType.Length() ); iMimeType->Des().Copy( aMimeType ); + iBitmap = NULL; } @@ -149,6 +150,7 @@ iMimeType = HBufC8::NewL( aMimeType.Length() ); iMimeType->Des().Copy( aMimeType ); iThumbnailId = 0; + iBitmap = NULL; } // --------------------------------------------------------------------------- @@ -177,6 +179,7 @@ iMimeType->Des().Copy( aMimeType ); iUri = aUri.AllocL(); iThumbnailId = 0; + iBitmap = NULL; } // --------------------------------------------------------------------------- diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp Thu May 27 13:11:20 2010 +0300 @@ -65,10 +65,11 @@ // CThumbnailRequestActive* CThumbnailRequestActive::NewL( RFs& aFs, RThumbnailSession& aThumbnailSession, MThumbnailManagerObserver& aObserver, + MThumbnailManagerRequestObserver* aRequestObserver, TThumbnailRequestId aId, TInt aPriority, CThumbnailRequestQueue* aQueue ) { CThumbnailRequestActive* self = new( ELeave )CThumbnailRequestActive( aFs, - aThumbnailSession, aObserver, aId, aPriority, aQueue ); + aThumbnailSession, aObserver, aRequestObserver, aId, aPriority, aQueue ); CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop( self ); @@ -83,10 +84,11 @@ // CThumbnailRequestActive::CThumbnailRequestActive( RFs& aFs, RThumbnailSession& aThumbnailSession, MThumbnailManagerObserver& aObserver, + MThumbnailManagerRequestObserver* aRequestObserver, TThumbnailRequestId aId, TInt aPriority, CThumbnailRequestQueue* aQueue ): CActive( aPriority ), iSession( aThumbnailSession ), iParamsPckg( iParams ), - iObserver( aObserver ), iFs( aFs ), iBitmapHandle( 0 ), iRequestId( aId ), - iRequestQueue( aQueue ), iCanceled( EFalse ) + iObserver( aObserver ), iRequestObserver( aRequestObserver ), iFs( aFs ), iBitmapHandle( 0 ), + iRequestId( aId ), iRequestQueue( aQueue ), iCanceled( EFalse ) { CActiveScheduler::Add( this ); TN_DEBUG2( "CThumbnaiRequestActive::CThumbnailRequestActive() AO's priority = %d", Priority()); @@ -244,10 +246,38 @@ iTimer->Cancel(); - if (iRequestType == EReqDeleteThumbnails || iCanceled || - iRequestType == EReqRenameThumbnails) + if (iRequestType == EReqDeleteThumbnails) { - TN_DEBUG1( "CThumbnailRequestActive::RunL() - rename/delete/canceled" ); + TN_DEBUG1( "CThumbnailRequestActive::RunL() - delete" ); + + if (iRequestObserver) + { + iRequestObserver->ThumbnailRequestReady(iStatus.Int(), ERequestDeleteThumbnails ,iParams.iRequestId); + } + + iFile.Close(); + iMyFileHandle.Close(); + + // no action for delete/rename or canceled request + iRequestQueue->RequestComplete(this); + +#ifdef _DEBUG + TTime stop; + stop.UniversalTime(); + TN_DEBUG3( "CThumbnailRequestActive::RunL() total execution time of req %d is %d ms", + iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 ); +#endif + } + else if (iCanceled || iRequestType == EReqRenameThumbnails) + { + if (iCanceled) + { + TN_DEBUG1( "CThumbnailRequestActive::RunL() - canceled" ); + } + else if (iRequestType == EReqRenameThumbnails) + { + TN_DEBUG1( "CThumbnailRequestActive::RunL() - rename" ); + } iFile.Close(); iMyFileHandle.Close(); @@ -287,7 +317,7 @@ TCallBack(TimerCallBack, this)); SetActive(); } - else if ( iStatus.Int()) + else if ( iStatus.Int() ) { TN_DEBUG2( "CThumbnailRequestActive::RunL() - error (%d) occured", iStatus.Int() ); // An error occurred @@ -527,17 +557,26 @@ TN_DEBUG1( "CThumbnailRequestActive::HandleError() - session reconnected"); } } - iCallbackThumbnail->Set( NULL, iClientData ); + + if (iRequestObserver && iRequestType == EReqDeleteThumbnails) + { + TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - iRequestObserver->ThumbnailRequestReady %d", iParams.iRequestId ); + iRequestObserver->ThumbnailRequestReady(iError, ERequestDeleteThumbnails ,iParams.iRequestId); + } + else + { + iCallbackThumbnail->Set( NULL, iClientData ); - // don't leak internal TNM codes - if (iError == KThumbnailErrThumbnailNotFound) - { - iError = KErrNotFound; + // don't leak internal TNM codes + if (iError == KThumbnailErrThumbnailNotFound) + { + iError = KErrNotFound; + } + + TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - iObserver.ThumbnailReady %d", iParams.iRequestId ); + iObserver.ThumbnailReady( iError, *iCallbackThumbnail, iParams.iRequestId ); } - TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - iObserver.ThumbnailReady %d", iParams.iRequestId ); - iObserver.ThumbnailReady( iError, *iCallbackThumbnail, iParams.iRequestId ); - iError = KErrNone; } @@ -589,6 +628,7 @@ iParams.iQualityPreference = aQualityPreference; iParams.iThumbnailSize = aThumbnailSize; iParams.iThumbnailId = aThumbnailId; + iParams.iOverwrite = EFalse; User::LeaveIfError( iFile.Duplicate( aFile )); @@ -624,6 +664,7 @@ iParams.iQualityPreference = aQualityPreference; iParams.iThumbnailSize = aThumbnailSize; iParams.iThumbnailId = aThumbnailId; + iParams.iOverwrite = EFalse; iTargetUri = aTargetUri; } @@ -657,6 +698,7 @@ iParams.iThumbnailSize = aThumbnailSize; iParams.iThumbnailId = aThumbnailId; iParams.iFileName = aPath; + iParams.iOverwrite = EFalse; iPath = aPath; iTargetUri = aTargetUri; @@ -671,7 +713,8 @@ const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, - TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri, TThumbnailSize aThumbnailSize ) + TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri, TThumbnailSize aThumbnailSize, + TBool aOverwrite) { iRequestType = EReqSetThumbnailBuffer; @@ -691,6 +734,7 @@ iParams.iFlags = aFlags; iParams.iQualityPreference = aQualityPreference; iParams.iThumbnailId = aThumbnailId; + iParams.iOverwrite = aOverwrite; iTargetUri = aTargetUri; } @@ -704,7 +748,8 @@ const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, - TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri, TThumbnailSize aThumbnailSize ) + TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri, TThumbnailSize aThumbnailSize, + TBool aOverwrite) { iClientData = aClientData; iParams.iControlFlags = (aGeneratePersistentSizesOnly ? @@ -721,6 +766,7 @@ iParams.iQualityPreference = aQualityPreference; iParams.iThumbnailId = aThumbnailId; iParams.iFileName = aTargetUri; + iParams.iOverwrite = aOverwrite; iTargetUri = aTargetUri; @@ -769,6 +815,7 @@ iParams.iFlags = aFlags; iParams.iQualityPreference = aQualityPreference; iParams.iThumbnailId = aThumbnailId; + iParams.iOverwrite = EFalse; iPath = aPath; iOrientation = aOrientation; diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/bwins/thumbnailmanagerqt.def --- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/bwins/thumbnailmanagerqt.def Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/bwins/thumbnailmanagerqt.def Thu May 27 13:11:20 2010 +0300 @@ -16,4 +16,6 @@ ?getThumbnail@ThumbnailManager@@QAEHKPAXH@Z @ 15 NONAME ; int ThumbnailManager::getThumbnail(unsigned long, void *, int) ?mode@ThumbnailManager@@QBE?AW4ThumbnailMode@1@XZ @ 16 NONAME ; enum ThumbnailManager::ThumbnailMode ThumbnailManager::mode(void) const ?setThumbnail@ThumbnailManager@@QAEHABVQImage@@ABVQString@@PAXH@Z @ 17 NONAME ; int ThumbnailManager::setThumbnail(class QImage const &, class QString const &, void *, int) + ?thumbnailReady@ThumbnailManager@@IAEXVQImage@@PAXHH@Z @ 18 NONAME ; void ThumbnailManager::thumbnailReady(class QImage, void *, int, int) + ?thumbnailReady@ThumbnailManager@@IAEXVQPixmap@@PAXHH@Z @ 19 NONAME ; void ThumbnailManager::thumbnailReady(class QPixmap, void *, int, int) diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/eabi/thumbnailmanagerqt.def --- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/eabi/thumbnailmanagerqt.def Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/eabi/thumbnailmanagerqt.def Thu May 27 13:11:20 2010 +0300 @@ -19,4 +19,6 @@ _ZNK16ThumbnailManager17qualityPreferenceEv @ 18 NONAME _ZNK16ThumbnailManager4modeEv @ 19 NONAME _ZN16ThumbnailManager12setThumbnailERK6QImageRK7QStringPvi @ 20 NONAME + _ZN16ThumbnailManager14thumbnailReadyE6QImagePvii @ 21 NONAME + _ZN16ThumbnailManager14thumbnailReadyE7QPixmapPvii @ 22 NONAME diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/inc/thumbnailmanager_p_qt.h --- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/inc/thumbnailmanager_p_qt.h Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/inc/thumbnailmanager_p_qt.h Thu May 27 13:11:20 2010 +0300 @@ -214,11 +214,14 @@ int connectionCounterPixmap; private: + + ThumbnailManager *q_ptr; CThumbnailManager* iThumbnailManager; QByteArray* byteArray; - + + friend class ThumbnailManager; friend class TestThumbnailManager; }; diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_p_qt.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_p_qt.cpp Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_p_qt.cpp Thu May 27 13:11:20 2010 +0300 @@ -29,9 +29,11 @@ const int ThumbnailMangerPriorityLowest = CActive::EPriorityIdle; const int ThumbnailMangerPriorityHighest = CActive::EPriorityHigh; -ThumbnailManagerPrivate::ThumbnailManagerPrivate() : iThumbnailManager( NULL ), byteArray( NULL ), +ThumbnailManagerPrivate::ThumbnailManagerPrivate() : connectionCounterImage( 0 ), - connectionCounterPixmap( 0 ) + connectionCounterPixmap( 0 ), + iThumbnailManager( NULL ), + byteArray( NULL ) { TRAP_IGNORE( iThumbnailManager = CThumbnailManager::NewL( *this ); @@ -291,12 +293,12 @@ } if (connectionCounterImage) { - emit thumbnailReady(image, aThumbnail.ClientData(), aId, aError); + emit q_ptr->thumbnailReady(image, aThumbnail.ClientData(), aId, aError); } if (connectionCounterPixmap) { QPixmap pixmap = QPixmap::fromImage(image); - emit thumbnailReady(pixmap, aThumbnail.ClientData(), aId, aError); + emit q_ptr->thumbnailReady(pixmap, aThumbnail.ClientData(), aId, aError); } } } diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_qt.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_qt.cpp Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_qt.cpp Thu May 27 13:11:20 2010 +0300 @@ -23,19 +23,12 @@ QObject( parentPtr ), d( new ThumbnailManagerPrivate() ) { - QObject::connect( d, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ), - this, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ) ); - QObject::connect( d, SIGNAL( thumbnailReady( QImage , void * , int , int ) ), - this, SIGNAL( thumbnailReady( QImage , void * , int , int ) ) ); + d->q_ptr = this; } Q_DECL_EXPORT ThumbnailManager::~ThumbnailManager() { - QObject::disconnect( d, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ), - this, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ) ); - QObject::disconnect( d, SIGNAL( thumbnailReady( QImage , void * , int , int ) ), - this, SIGNAL( thumbnailReady( QImage , void * , int , int ) ) ); if( NULL != d ){ delete d; } @@ -138,3 +131,4 @@ d->connectionCounterImage--; } } + diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/moc_thumbnailmanager_p_qt.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/moc_thumbnailmanager_p_qt.cpp Thu May 27 13:11:20 2010 +0300 @@ -0,0 +1,99 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'thumbnailmanager_p_qt.h' +** +** Created: Fri 30. Apr 11:26:04 2010 +** by: The Qt Meta Object Compiler version 62 (Qt 4.6.3) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../inc/thumbnailmanager_p_qt.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'thumbnailmanager_p_qt.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 62 +#error "This file was generated using the moc from 4.6.3. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_ThumbnailManagerPrivate[] = { + + // content: + 4, // revision + 0, // classname + 0, 0, // classinfo + 2, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 2, // signalCount + + // signals: signature, parameters, type, tag, flags + 29, 25, 24, 24, 0x05, + 67, 25, 24, 24, 0x05, + + 0 // eod +}; + +static const char qt_meta_stringdata_ThumbnailManagerPrivate[] = { + "ThumbnailManagerPrivate\0\0,,,\0" + "thumbnailReady(QPixmap,void*,int,int)\0" + "thumbnailReady(QImage,void*,int,int)\0" +}; + +const QMetaObject ThumbnailManagerPrivate::staticMetaObject = { + { &QObject::staticMetaObject, qt_meta_stringdata_ThumbnailManagerPrivate, + qt_meta_data_ThumbnailManagerPrivate, 0 } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &ThumbnailManagerPrivate::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *ThumbnailManagerPrivate::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *ThumbnailManagerPrivate::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_ThumbnailManagerPrivate)) + return static_cast(const_cast< ThumbnailManagerPrivate*>(this)); + if (!strcmp(_clname, "MThumbnailManagerObserver")) + return static_cast< MThumbnailManagerObserver*>(const_cast< ThumbnailManagerPrivate*>(this)); + return QObject::qt_metacast(_clname); +} + +int ThumbnailManagerPrivate::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + switch (_id) { + case 0: thumbnailReady((*reinterpret_cast< QPixmap(*)>(_a[1])),(*reinterpret_cast< void*(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3])),(*reinterpret_cast< int(*)>(_a[4]))); break; + case 1: thumbnailReady((*reinterpret_cast< QImage(*)>(_a[1])),(*reinterpret_cast< void*(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3])),(*reinterpret_cast< int(*)>(_a[4]))); break; + default: ; + } + _id -= 2; + } + return _id; +} + +// SIGNAL 0 +void ThumbnailManagerPrivate::thumbnailReady(QPixmap _t1, void * _t2, int _t3, int _t4) +{ + void *_a[] = { 0, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)), const_cast(reinterpret_cast(&_t4)) }; + QMetaObject::activate(this, &staticMetaObject, 0, _a); +} + +// SIGNAL 1 +void ThumbnailManagerPrivate::thumbnailReady(QImage _t1, void * _t2, int _t3, int _t4) +{ + void *_a[] = { 0, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)), const_cast(reinterpret_cast(&_t3)), const_cast(reinterpret_cast(&_t4)) }; + QMetaObject::activate(this, &staticMetaObject, 1, _a); +} +QT_END_MOC_NAMESPACE diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/test_qtnmwrapper.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/test_qtnmwrapper.cpp Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/test_qtnmwrapper.cpp Thu May 27 13:11:20 2010 +0300 @@ -146,7 +146,7 @@ connect( wrapper, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ), this, SLOT( thumbnailReady( QPixmap , void* , int , int ))); - wrapper_p = new ThumbnailManagerPrivate(); + wrapper_p = wrapper->d; //new ThumbnailManagerPrivate(); } void TestThumbnailManager::cleanup() @@ -161,7 +161,7 @@ ipixmap = NULL; } - delete wrapper_p; + // delete wrapper_p; } // --- test --- @@ -327,8 +327,7 @@ QVERIFY(td.bitmap->SizeInPixels().iHeight == TestThumbnailData::BITMAP_HEIGHT); disconnect( wrapper_p, SIGNAL(thumbnailReady( QImage , void* , int, int ) ), - this, SLOT( thumbnailReadyImage(QImage, void* , int , int ))); - + this, SLOT( thumbnailReadyImage(QImage, void* , int , int ))); } void TestThumbnailManager::testThumbnailReadyPixmap() @@ -355,7 +354,6 @@ disconnect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ), this, SLOT( thumbnailReadyPixmap( QPixmap , void* , int , int ))); - } void TestThumbnailManager::testThumbnailReadyImageAndPixmap() @@ -387,8 +385,7 @@ this, SLOT( thumbnailReadyImage( QImage , void* , int , int ))); disconnect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ), - this, SLOT( thumbnailReadyPixmap( QPixmap , void* , int , int ))); - + this, SLOT( thumbnailReadyPixmap( QPixmap , void* , int , int ))); } void TestThumbnailManager::testPriorities_data() @@ -417,13 +414,18 @@ // --- private slots - callback --- -void TestThumbnailManager::thumbnailReady( QPixmap /*pixmap*/, void * /*clientData*/, int /*id*/, int /*errorCode*/ ) +void TestThumbnailManager::thumbnailReady( QPixmap pixmap, void *clientData, int id, int errorCode ) { //do nothing, we dont test Thumbnail Manager's functionality, we just use it + Q_UNUSED( pixmap ); + Q_UNUSED( clientData ); + Q_UNUSED( id ); + Q_UNUSED( errorCode ); } -void TestThumbnailManager::thumbnailReady_p( QPixmap pixmap, void * /*clientData*/, int id, int errorCode ) +void TestThumbnailManager::thumbnailReady_p( QPixmap pixmap, void * clientData, int id, int errorCode ) { + Q_UNUSED( clientData ); QVERIFY( pixmap.isNull() == pixmapNull ); QVERIFY( errorCode == aerrorCode ); QVERIFY( id == aid ); diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/test_qtnmwrapper.pro --- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/test_qtnmwrapper.pro Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/test_qtnmwrapper.pro Thu May 27 13:11:20 2010 +0300 @@ -44,7 +44,3 @@ icons.sources += tnmwrapper_tsrc.mbm icons.path = / DEPLOYMENT += icons -#needed to make directory /shared/EUnit/logs/ so that test result can be written -testres.sources += distribution.policy.s60 -testres.path = /shared/EUnit/logs/ -DEPLOYMENT += testres diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h Thu May 27 13:11:20 2010 +0300 @@ -685,11 +685,14 @@ #ifdef _DEBUG TUint32 iPlaceholderCounter; #endif + /** * Fetched checker. * Own. */ CThumbnailFetchedChecker* iFetchedChecker; + + TBool iSessionError; }; #endif // THUMBNAILSERVER_H diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailsql.h --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailsql.h Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailsql.h Thu May 27 13:11:20 2010 +0300 @@ -204,7 +204,7 @@ _LIT8( KThumbnailTempRename, "UPDATE TempThumbnailInfo SET Path = :NewPath WHERE Path = :Path;" ); // reset blacklisted -_LIT8( KThumbnailTouchBlacklistedRows, "UPDATE ThumbnailInfo SET Modified = 0 WHERE Flags & :Flag" ); +_LIT8( KThumbnailTouchBlacklistedRows, "UPDATE ThumbnailInfo SET Flags = 4, Modified = 0 WHERE Flags & :Flag" ); // existence check _LIT8( KThumbnailSelectAllPaths, "SELECT ThumbnailInfo.RowID,Path FROM ThumbnailInfo " diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailgeneratetask.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailgeneratetask.cpp Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailgeneratetask.cpp Thu May 27 13:11:20 2010 +0300 @@ -240,6 +240,7 @@ size.iSize.iWidth ); aCroppedTargetSize.iHeight = Max( aCroppedTargetSize.iHeight, size.iSize.iHeight ); + if(iBuffer) { iFlags = ( CThumbnailManager::TThumbnailFlags ) (iFlags | CThumbnailManager::ECropToAspectRatio); diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp Thu May 27 13:11:20 2010 +0300 @@ -224,6 +224,7 @@ // connect to MDS iMdESession = CMdESession::NewL( *this ); + iSessionError = EFalse; User::LeaveIfError( iFbsSession.Connect()); User::LeaveIfError( Start( KThumbnailServerName )); @@ -329,8 +330,10 @@ void CThumbnailServer::HandleSessionError( CMdESession& /*aSession*/, TInt aError ) { TN_DEBUG2( "CThumbnailServer::HandleSessionError == %d", aError ); - if (aError != KErrNone && !iShutdown) + if (aError != KErrNone && !iShutdown && !iSessionError) { + iSessionError = ETrue; + if (!iReconnect->IsActive()) { iReconnect->Start( KMdEReconnect, KMdEReconnect, @@ -425,17 +428,15 @@ const TThumbnailBitmapRef* ref = bpiter.NextValue(); while ( ref ) - { + { + if ( ref->iSession == aSession ) + { + TN_DEBUG2( "CThumbnailServer::DropSession() - ref->iSession = 0x%08x", ref->iSession ); - TN_DEBUG2( "CThumbnailServer::DropSession() - ref->iSession = 0x%08x", ref->iSession ); - - if ( ref->iSession == aSession ) - { delete ref->iBitmap; bpiter.RemoveCurrent(); - TN_DEBUG2( "CThumbnailServer::DropSession() - deleted bitmap, left=%d", - iBitmapPool.Count()); + TN_DEBUG2( "CThumbnailServer::DropSession() - deleted bitmap, left=%d", iBitmapPool.Count()); } ref = bpiter.NextValue(); @@ -889,7 +890,6 @@ CThumbnailStore** resPtr = iStores.Find( aDrive ); CThumbnailStore* res = NULL; - if ( resPtr ) { res = * resPtr; @@ -1321,6 +1321,10 @@ { aMimeType = TDataType( KVideo3gppMime ); } + else if ( ext.CompareF( K3gppExt ) == 0 ) + { + aMimeType = TDataType( KVideo3gppMime ); + } else if ( ext.CompareF( KAmrExt ) == 0 ) { aMimeType = TDataType( KAudioAmrMime ); @@ -1629,6 +1633,7 @@ // reconnect to MDS TRAP_IGNORE( self->iMdESession = CMdESession::NewL( *self ) ); + self->iSessionError = EFalse; TN_DEBUG1( "CThumbAGDaemon::ReconnectCallBack() - done"); diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp Thu May 27 13:11:20 2010 +0300 @@ -156,6 +156,8 @@ // void CThumbnailServerSession::CreateL() { + TN_DEBUG2( "CThumbnailServerSession::AddSession() = 0x%08x", this ); + Server()->AddSession(); } @@ -471,8 +473,8 @@ if( err == KErrCompletion ) { // If thumbnail of requested size is blacklisted, fetching is left with KErrCompletion - TN_DEBUG1( - "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - thumbnail blacklisted" ); + TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - thumbnail blacklisted" ); + aMessage.Complete( err ); iMessage = RMessage2(); } @@ -494,8 +496,7 @@ } else if (!err && iBuffer) { - TN_DEBUG1( - "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - found existing thumbnail - jpeg " ); + TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - found existing thumbnail - jpeg " ); CThumbnailDecodeTask* task = new( ELeave )CThumbnailDecodeTask( Server() ->Processor(), * Server(), iBuffer, params.iPriority, params.iDisplayMode ); @@ -515,8 +516,8 @@ } else { - TN_DEBUG2( - "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - thumbnail not found, err=%d", err ); + TN_DEBUG2( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - thumbnail not found, err=%d", err ); + aMessage.Complete( ConvertSqlErrToE32Err( err )); iMessage = RMessage2(); } @@ -591,8 +592,8 @@ else if( err == KErrCompletion ) { // If thumbnail of requested size is blacklisted, fetching is left with KErrCompletion - TN_DEBUG1( - "CThumbnailServerSession::RequestThumbByPathAsyncL() - thumbnail blacklisted" ); + TN_DEBUG1( "CThumbnailServerSession::RequestThumbByPathAsyncL() - thumbnail blacklisted" ); + aMessage.Complete( err ); iMessage = RMessage2(); } @@ -613,7 +614,9 @@ User::Leave(err); } - if(Server()->StoreForPathL(params.iFileName)->IsDiskFull()) + // disk space check only for stored sizes + if ( params.iThumbnailSize != ECustomThumbnailSize && + Server()->StoreForPathL(params.iFileName)->IsDiskFull() ) { User::Leave( KErrDiskFull ); } @@ -641,26 +644,31 @@ aMessage.ReadL( 0, iRequestParams ); const TThumbnailRequestParams& params = iRequestParams(); - if(params.iThumbnailSize != EUnknownThumbnailSize) + // delete existing + if(params.iOverwrite) { Server()->DeleteThumbnailsL( params.iTargetUri); } - if(params.iThumbnailSize == EFullScreenThumbnailSize || - params.iThumbnailSize == EGridThumbnailSize || - params.iThumbnailSize == EListThumbnailSize ) - { - TInt sourceType = TThumbnailPersistentSize::EUnknownSourceType; - TDataType mimetype; - TInt ret = Server()->MimeTypeFromFileExt( params.iTargetUri, mimetype ); - - if( ret == KErrNone ) + // if only one size + if ((params.iControlFlags & EThumbnailGeneratePersistentSizesOnly) == 0) + { + if(params.iThumbnailSize == EFullScreenThumbnailSize || + params.iThumbnailSize == EGridThumbnailSize || + params.iThumbnailSize == EListThumbnailSize ) { - sourceType = Server()->SourceTypeFromMimeType( mimetype ); - ModifyThumbnailSize(sourceType); + TInt sourceType = TThumbnailPersistentSize::EUnknownSourceType; + TDataType mimetype; + TInt ret = Server()->MimeTypeFromFileExt( params.iTargetUri, mimetype ); + + if( ret == KErrNone ) + { + sourceType = Server()->SourceTypeFromMimeType( mimetype ); + ModifyThumbnailSize(sourceType); + } + User::LeaveIfError( ret ); } - User::LeaveIfError( ret ); - } + } TInt bufferSize = aMessage.Int2(); HBufC8* buffer = HBufC8::NewMaxLC( bufferSize ); @@ -684,17 +692,44 @@ aMessage.ReadL( 0, iRequestParams ); const TThumbnailRequestParams& params = iRequestParams(); + const TThumbnailServerRequestId reqId( this, params.iRequestId ); + + // delete existing + if(params.iOverwrite) + { + Server()->DeleteThumbnailsL( params.iTargetUri); + } + + // if only one size + if ((params.iControlFlags & EThumbnailGeneratePersistentSizesOnly) == 0) + { + if(params.iThumbnailSize == EFullScreenThumbnailSize || + params.iThumbnailSize == EGridThumbnailSize || + params.iThumbnailSize == EListThumbnailSize ) + { + TInt sourceType = TThumbnailPersistentSize::EUnknownSourceType; + TDataType mimetype; + TInt ret = Server()->MimeTypeFromFileExt( params.iTargetUri, mimetype ); + + if( ret == KErrNone ) + { + sourceType = Server()->SourceTypeFromMimeType( mimetype ); + ModifyThumbnailSize(sourceType); + } + User::LeaveIfError( ret ); + } + } + TInt bitmapHandle = aMessage.Int1(); - TThumbnailServerRequestId &reqId = (TThumbnailServerRequestId&)params.iRequestId; // get bitmap CFbsBitmap* bitmap = new( ELeave )CFbsBitmap(); CleanupStack::PushL( bitmap ); User::LeaveIfError( bitmap->Duplicate( bitmapHandle ) ); - + // use pool to prevent bitmap leak // this bitmap is shared to several scale tasks, one of which can Leave - Server()->AddBitmapToPoolL( reqId.iSession, bitmap, reqId ); + Server()->AddBitmapToPoolL( this, bitmap, reqId ); CleanupStack::Pop( bitmap ); iBitmapHandle = bitmap->Handle(); @@ -763,7 +798,7 @@ // completion to first task, because task processor works like stack if( i == 0 ) - { + { // scaleTask is now responsible for completing the RMessage scaleTask->SetMessageData( reqId, iMessage, iClientThread ); iMessage = RMessage2(); @@ -797,12 +832,14 @@ // void CThumbnailServerSession::CreateGenerateTaskFromFileHandleL( RFile64* aFile) { - const TThumbnailRequestParams& params = iRequestParams(); + TThumbnailRequestParams& params = iRequestParams(); TN_DEBUG2( "CThumbnailServerSession::CreateGenerateTaskFromFileHandleL() -- create thumbnail generation task for %S", ¶ms.iFileName ); - if(Server()->StoreForPathL(params.iFileName)->IsDiskFull()) + // disk space check only for stored sizes + if ( params.iThumbnailSize != ECustomThumbnailSize && + Server()->StoreForPathL(params.iFileName)->IsDiskFull() ) { User::Leave( KErrDiskFull ); } @@ -817,7 +854,6 @@ missingSizes = new (ELeave) RArray < TThumbnailPersistentSize >; CleanupClosePushL( *missingSizes ); - TBool gridSizeOnly(EFalse); if ( params.iQualityPreference == CThumbnailManager @@ -840,6 +876,25 @@ return; } } + // creating single TN on demand + else if( params.iThumbnailSize > ECustomThumbnailSize && params.iThumbnailSize < EThumbnailSizeCount) + { + TThumbnailPersistentSize persistentSize = Server()->PersistentSizeL(params.iThumbnailSize); + + if(persistentSize.iCrop) + { + params.iFlags = ( CThumbnailManager::TThumbnailFlags ) (params.iFlags | CThumbnailManager::ECropToAspectRatio); + } + else + { + params.iFlags = ( CThumbnailManager::TThumbnailFlags ) (params.iFlags & CThumbnailManager::ECropToAspectRatio); + } + + if( ClientThreadAlive() ) + { + iMessage.Write( 0, iRequestParams ); + } + } // priority TInt priority = params.iPriority; @@ -881,6 +936,7 @@ // Generate task is now responsible for completing the message iMessage = RMessage2(); } + // ----------------------------------------------------------------------------- // CThumbnailServerSession::CreateGenerateTaskL() // Create a task to generate a new thumbnail @@ -893,7 +949,9 @@ TN_DEBUG2( "CThumbnailServerSession::CreateGenerateTaskFromBufferL() -- create thumbnail generation task for %S", ¶ms.iTargetUri ); - if(Server()->StoreForPathL(params.iTargetUri)->IsDiskFull()) + // disk space check only for stored sizes + if ( params.iThumbnailSize != ECustomThumbnailSize && + Server()->StoreForPathL(params.iTargetUri)->IsDiskFull() ) { User::Leave( KErrDiskFull ); } @@ -1072,8 +1130,7 @@ TN_DEBUG1("CThumbnailServerSession()::ProcessBitmapL() bitmap to pool"); - TThumbnailServerRequestId &reqId = (TThumbnailServerRequestId&)params.iRequestId; - Server()->AddBitmapToPoolL( this, iBitmap, reqId ); + Server()->AddBitmapToPoolL( this, iBitmap, TThumbnailServerRequestId( this, params.iRequestId ) ); iMessage.Complete( KErrNone ); iMessage = RMessage2(); @@ -1175,7 +1232,6 @@ aMessage.ReadL( 0, iRequestParams ); const TThumbnailRequestParams& params = iRequestParams(); - #ifdef RD_MDS_2_5 // try to query path from MDS CThumbnailMDSQueryTask* task = new( ELeave )CThumbnailMDSQueryTask( @@ -1183,9 +1239,11 @@ CleanupStack::PushL( task ); task->QueryPathByIdL(params.iThumbnailId, ETrue); + task->SetMessageData( TThumbnailServerRequestId( this, params.iRequestId ) ); Server()->QueueTaskL( task ); CleanupStack::Pop( task ); // owned by processor now #endif // RD_MDS_2_5 + aMessage.Complete( KErrNone ); iMessage = RMessage2(); } @@ -1195,8 +1253,7 @@ // list of supported MIME types // ----------------------------------------------------------------------------- // -void CThumbnailServerSession::GetMimeTypeBufferSizeL( const RMessage2& aMessage - ) +void CThumbnailServerSession::GetMimeTypeBufferSizeL( const RMessage2& aMessage ) { TPckgBuf < TInt > buf; buf() = Server()->GetMimeTypeBufferSize(); diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp Thu May 27 13:11:20 2010 +0300 @@ -35,7 +35,7 @@ #include "thumbnailserver.h" -_LIT8( KThumbnailSqlConfig, "page_size=32768; cache_size=32;" ); +_LIT8( KThumbnailSqlConfig, "page_size=32768; cache_size=64;" ); const TInt KStreamBufferSize = 1024 * 8; const TInt KMajor = 3; @@ -299,6 +299,7 @@ { TN_DEBUG2( "CThumbnailStore::OpenDatabaseL() drive: %d", iDrive ); + CloseStatements(); iDatabase.Close(); iUnrecoverable = ETrue; @@ -474,6 +475,7 @@ TBuf<50> mediaid; mediaid.Num(id); + CloseStatements(); iDatabase.Close(); iUnrecoverable = ETrue; @@ -529,6 +531,7 @@ // delete db if not fully complete if (prepareErr < 0 || mediaidErr < 0) { + CloseStatements(); iDatabase.Close(); TN_DEBUG1( "CThumbnailStore::RecreateDatabaseL() delete database" ); TInt del = iDatabase.Delete(pathPtr); @@ -1553,7 +1556,6 @@ TInt found = KErrNotFound; TInt rowStatus = 0; TInt column = 0; - TBool inTempTable = ETrue; TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() -- TEMP TABLE lookup" ); @@ -1575,7 +1577,6 @@ if(rowStatus != KSqlAtRow) { TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() -- MAIN TABLE lookup" ); - inTempTable = EFalse; CleanupStack::PopAndDestroy( stmt ); stmt = &iStmt_KThumbnailSelectInfoByPath; @@ -1602,21 +1603,23 @@ // KErrNotFound to get thumbnail regenerated. column = 4; TInt flags = stmt->ColumnInt( column ); - if( flags & KThumbnailDbFlagBlacklisted && (*path).Length() ) + if( flags & KThumbnailDbFlagDeleted ) { - TBool modified = EFalse; - CheckModifiedByPathL( aPath, inTempTable, modified ); - if( modified ) - { - // Close db to get deletion of thumbnails executed. - CleanupStack::PopAndDestroy( &stmt ); - DeleteThumbnailsL( *path ); - User::Leave( KErrNotFound ); - } - else - { - User::Leave( KErrCompletion ); - } + CleanupStack::PopAndDestroy( stmt ); + + // delete existing blacklisted thumbs + DeleteThumbnailsL(*path, ETrue); + + CleanupStack::PopAndDestroy( path ); + + User::Leave( KErrNotFound ); + } + else if( flags & KThumbnailDbFlagBlacklisted ) + { + CleanupStack::PopAndDestroy( stmt ); + CleanupStack::PopAndDestroy( path ); + + User::Leave( KErrCompletion ); } else if( !(flags & KThumbnailDbFlagBlacklisted) ) { @@ -1799,19 +1802,40 @@ } else { - TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- add to Deleted" ); + TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- MAIN TABLE lookup" ); - // only add path to deleted table - stmt = &iStmt_KThumbnailSqlInsertDeleted; + stmt = &iStmt_KThumbnailSqlSelectRowIDInfoByPath; CleanupStack::PushL(TCleanupItem(ResetStatement, stmt)); - + paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath ); User::LeaveIfError( paramIndex ); User::LeaveIfError( stmt->BindText( paramIndex, *path )); + + rowStatus = stmt->Next(); + + CleanupStack::PopAndDestroy( stmt ); - count = stmt->Exec(); + // there were matching rows in main table + if (rowStatus == KSqlAtRow) + { + TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- add to Deleted" ); - CleanupStack::PopAndDestroy( stmt ); + // only add path to deleted table + stmt = &iStmt_KThumbnailSqlInsertDeleted; + CleanupStack::PushL(TCleanupItem(ResetStatement, stmt)); + + paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath ); + User::LeaveIfError( paramIndex ); + User::LeaveIfError( stmt->BindText( paramIndex, *path )); + + count = stmt->Exec(); + + CleanupStack::PopAndDestroy( stmt ); + } + else + { + TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- no thumbs in MAIN" ); + } } if (aTransaction) @@ -1937,6 +1961,7 @@ if(iBatchItemCount <= 0 || CheckDbState() != KErrNone) { // cache empty or db unusable + TN_DEBUG1( "CThumbnailStore::FlushCacheTable() error "); return; } @@ -1949,7 +1974,9 @@ } //set init max flush delay - TInt aMaxFlushDelay(KMaxFlushDelay); + TReal32 aMaxFlushDelay(KMaxFlushDelay); + TReal32 aPreviousFlushDelay(iPreviousFlushDelay); + TReal32 aBatchFlushItemCount(iBatchFlushItemCount); if(MPXHarvesting) { @@ -1961,16 +1988,24 @@ //1st item in batch if( iBatchItemCount == 1) { + TN_DEBUG2("CThumbnailStore::FlushCacheTable() calculate new batch size iPreviousFlushDelay = %d", iPreviousFlushDelay); //adjust batch size dynamically between min and max based on previous flush speed - if(iPreviousFlushDelay > 0 ) + if( iPreviousFlushDelay > 0 ) { - iBatchFlushItemCount = (aMaxFlushDelay/iPreviousFlushDelay)*iBatchFlushItemCount; + TReal32 aNewBatchFlushItemCount = aMaxFlushDelay / aPreviousFlushDelay * aBatchFlushItemCount; + iBatchFlushItemCount = (TInt)aNewBatchFlushItemCount; + + TN_DEBUG2("CThumbnailStore::FlushCacheTable() aMaxFlushDelay %e", aMaxFlushDelay); + TN_DEBUG2("CThumbnailStore::FlushCacheTable() aPreviousFlushDelay %e", aPreviousFlushDelay); + TN_DEBUG2("CThumbnailStore::FlushCacheTable() aBatchFlushItemCount %e", aBatchFlushItemCount); + TN_DEBUG2("CThumbnailStore::FlushCacheTable() aNewBatchFlushItemCount %e", aNewBatchFlushItemCount); + TN_DEBUG2("CThumbnailStore::FlushCacheTable() iBatchFlushItemCount %d", iBatchFlushItemCount); - if(iBatchFlushItemCount < KMInBatchItems) + if( iBatchFlushItemCount < KMInBatchItems ) { iBatchFlushItemCount = KMInBatchItems; } - else if(iBatchFlushItemCount > KMaxBatchItems) + else if( iBatchFlushItemCount > KMaxBatchItems ) { iBatchFlushItemCount = KMaxBatchItems; } @@ -2203,14 +2238,14 @@ TRAPD( err, finished = self->FileExistenceCheckL() ); if (err != KErrNone) { - TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - file existance check failed, err %d", err); + TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - file existence check failed, err %d", err); return err; } // all files checked. if (finished) { - TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - file existance check finished, store %d", self->iDrive); + TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - file existence check finished, store %d", self->iDrive); self->iCheckFilesExist = EFalse; } } @@ -2288,9 +2323,9 @@ { TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- timestamp is the same as original" ); } - } - - rowStatus = stmt->Next(); + + rowStatus = stmt->Next(); + } //switch to main table if modified not found from temp if(rowStatus != KSqlAtRow && !checkMain && !modifiedChanged) diff -r b790c5b3d11f -r a67f74060682 imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtask.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtask.cpp Fri May 14 16:10:12 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtask.cpp Thu May 27 13:11:20 2010 +0300 @@ -113,9 +113,9 @@ { iState = EComplete; - if ( iMessage.Handle()) + if ( ClientThreadAlive() ) { - if(iMessage.Identity() == KDaemonUid ) + if( iMessage.Identity() == KDaemonUid ) { iProcessor.SetDaemonAsProcess(ETrue); } @@ -123,10 +123,12 @@ { iProcessor.SetDaemonAsProcess(EFalse); } + iMessage.Complete( CThumbnailServerSession::ConvertSqlErrToE32Err( aReason )); - ResetMessageData(); } + ResetMessageData(); + iProcessor.TaskComplete( this ); } } @@ -230,15 +232,12 @@ // void CThumbnailTask::CancelMessage() { - if ( iMessage.Handle()) + if ( ClientThreadAlive() ) { - if ( ClientThreadAlive() ) - { - iMessage.Complete( KErrCancel ); - } - - ResetMessageData(); + iMessage.Complete( KErrCancel ); } + + ResetMessageData(); } // ---------------------------------------------------------------------------