# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1272880131 -10800 # Node ID ffa62e555b02ff10cd6e9a566eac55c85a35a229 # Parent 7197e789b953e7663cc16f7556a1848fae1e7755 Revision: 201015 Kit: 201018 diff -r 7197e789b953 -r ffa62e555b02 imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager.h --- a/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager.h Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager.h Mon May 03 12:48:51 2010 +0300 @@ -548,6 +548,23 @@ */ virtual void UpdateThumbnailsL( const TThumbnailId aItemId, const TDesC& aPath, const TInt aOrientation, const TInt64 aModified, const TInt aPriority ) = 0; + + /** + * Rename Thumbnails. This is an asynchronous + * operation, which always returns immediately. + * + * @since S60 v5.0 + * @param aCurrentPath Current path of the Thumbnail + * @param aNewPath New path for the Thumbnail + * @param aPriority Priority for this operation + * @return Thumbnail request ID. This can be used to + * cancel the request or change priority. + * The ID is specific to this CThumbnailManager + * instance and may not be shared with other + * instances. + */ + virtual TThumbnailRequestId RenameThumbnailsL( const TDesC& aCurrentPath, + const TDesC& aNewPath, TInt aPriority = CActive::EPriorityIdle ) = 0; }; diff -r 7197e789b953 -r ffa62e555b02 imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager_qt.h --- a/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager_qt.h Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager_qt.h Mon May 03 12:48:51 2010 +0300 @@ -18,13 +18,22 @@ #ifndef THUMBNAILMANAGER_QT_H #define THUMBNAILMANAGER_QT_H -#include -#include +#include +#include +#include +#include class ThumbnailManagerPrivate; class QString; class QSize; +#ifdef TNMQT_DLL +# define TNM_EXPORT Q_DECL_EXPORT +#else +# define TNM_EXPORT Q_DECL_IMPORT +#endif + + /** default priority value */ const int tnmWrapperPriorityIdle = -100; @@ -109,19 +118,19 @@ * * @param parentPtr parent */ - IMPORT_C ThumbnailManager( QObject* parentPtr = NULL ); + TNM_EXPORT ThumbnailManager( QObject* parentPtr = NULL ); /** * Destructor */ - IMPORT_C ~ThumbnailManager(); + TNM_EXPORT ~ThumbnailManager(); /** * Get quality versus performance preference. * * @return quality versus performance preference */ - IMPORT_C QualityPreference qualityPreference() const; + TNM_EXPORT QualityPreference qualityPreference() const; /** * Set quality versus performance preference. @@ -130,14 +139,14 @@ * value. * @return true on success */ - IMPORT_C bool setQualityPreference( QualityPreference qualityPreference ); + TNM_EXPORT bool setQualityPreference( QualityPreference qualityPreference ); /** * Get the current desired size for thumbnail bitmaps. * * @return Current desired size for thumbnail bitmaps (in pixels). */ - IMPORT_C QSize thumbnailSize() const; + TNM_EXPORT QSize thumbnailSize() const; /** * Set desired size for thumbnail bitmaps. @@ -145,7 +154,7 @@ * @param thumbnailSize New desired thumbnail size. * @return true on success */ - IMPORT_C bool setThumbnailSize( const QSize& thumbnailSize ); + TNM_EXPORT bool setThumbnailSize( const QSize& thumbnailSize ); /** * Set desired size for thumbnail bitmaps. @@ -153,14 +162,14 @@ * @param thumbnailSize New desired thumbnail size. * @return true on success */ - IMPORT_C bool setThumbnailSize( ThumbnailSize thumbnailSize ); + TNM_EXPORT bool setThumbnailSize( ThumbnailSize thumbnailSize ); /** * Get current mode for thumbnail generation. * * @return Current mode. */ - IMPORT_C ThumbnailMode mode() const; + TNM_EXPORT ThumbnailMode mode() const; /** * Set mode for thumbnail generation. @@ -168,7 +177,7 @@ * @param mode New flags. * @return true on success */ - IMPORT_C bool setMode( ThumbnailMode mode ); + TNM_EXPORT bool setMode( ThumbnailMode mode ); /** * Get a thumbnail for an object file. If a thumbnail already exists, it @@ -188,7 +197,7 @@ * instance and may not be shared with other * instances. */ - IMPORT_C int getThumbnail( const QString& fileName, void * clientData = NULL, + TNM_EXPORT int getThumbnail( const QString& fileName, void * clientData = NULL, int priority = tnmWrapperPriorityIdle ); /** @@ -209,7 +218,7 @@ * instance and may not be shared with other * instances. */ - IMPORT_C int getThumbnail( unsigned long int thumbnailId, void * clientData = NULL, + TNM_EXPORT int getThumbnail( unsigned long int thumbnailId, void * clientData = NULL, int priority = tnmWrapperPriorityIdle ); /** @@ -227,7 +236,7 @@ * cancel the request or change priority. * */ - IMPORT_C int setThumbnail( const QPixmap& source, const QString& fileName, + TNM_EXPORT int setThumbnail( const QPixmap& source, const QString& fileName, void * clientData = NULL, int priority = tnmWrapperPriorityIdle ); /** @@ -245,7 +254,7 @@ * cancel the request or change priority. * */ - IMPORT_C int setThumbnail( const QImage& source, const QString& fileName, + TNM_EXPORT int setThumbnail( const QImage& source, const QString& fileName, void * clientData = NULL, int priority = tnmWrapperPriorityIdle ); /** @@ -254,7 +263,7 @@ * * @param fileName Source file */ - IMPORT_C void deleteThumbnails( const QString& fileName ); + TNM_EXPORT void deleteThumbnails( const QString& fileName ); /** * Delete all thumbnails for a given object. This is an asynchronous @@ -262,7 +271,7 @@ * * @param thumbnailId thumbnail id */ - IMPORT_C void deleteThumbnails( unsigned long int thumbnailId ); + TNM_EXPORT void deleteThumbnails( unsigned long int thumbnailId ); /** * Cancel a thumbnail operation. @@ -270,7 +279,7 @@ * @param id Request ID for the operation to be cancelled. * @return true if cancelling was successful. */ - IMPORT_C bool cancelRequest( int id ); + TNM_EXPORT bool cancelRequest( int id ); /** * Change the priority of a queued thumbnail operation. @@ -280,7 +289,7 @@ * @param newPriority New priority value * @return true if change was successful. */ - IMPORT_C bool changePriority( int id, int newPriority ); + TNM_EXPORT bool changePriority( int id, int newPriority ); signals: /** @@ -292,7 +301,23 @@ * @param errorCode error code */ void thumbnailReady( QPixmap , void * , int , int ); + + /** + * Final thumbnail bitmap generation or loading is complete. + * + * @param image An object representing the resulting thumbnail. + * @param clientData Client data + * @param id Request ID for the operation + * @param errorCode error code + */ + void thumbnailReady( QImage , void * , int , int ); + +protected: + void connectNotify(const char *signal); + + void disconnectNotify(const char *signal); + private: ThumbnailManagerPrivate* d; }; diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/conf/thumbnailmanager.confml Binary file imagehandlingutilities/thumbnailmanager/conf/thumbnailmanager.confml has changed diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h --- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h Mon May 03 12:48:51 2010 +0300 @@ -50,9 +50,21 @@ const TInt KDaemonProcessing = 0x00000040; //insert to temp table first wo indexing and move data to main table as batch -const TUint KMaxBatchItems = 36; +//actual batch size will vary and will be between min...max batch size values below + +//minimum batch size +const TUint KMInBatchItems = 3; +//maximum batch size +const TUint KMaxBatchItems = 18; +//Max allowed flush time +const TUint KMaxFlushDelay = 3000; //ms +// fixed batch size for MTP +const TUint KMaxBatchItemsMTP = 60; + //how many items daemon will query at once from MDS const TUint KMaxQueryItems = 100; +// max items for PH & AllItems query +const TUint KMaxQueryItems2 = 100; // maximum number of active client side queue requests const TUint KMaxClientRequests = 2; @@ -432,7 +444,7 @@ */ EDeleteThumbnailsById, - EReserved1, + ERenameThumbnails, /** * Update thumbnails by given Id. diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/inc/thumbnailpanic.h --- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailpanic.h Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/inc/thumbnailpanic.h Mon May 03 12:48:51 2010 +0300 @@ -31,7 +31,7 @@ = 2, EThumbnailBadPath = 3, EThumbnailUnknownMessage = 4, EThumbnailMessageNotCompleted = 5, EThumbnailBitmapNotReleased = 6, EThumbnailEmptyDescriptor = 7, EThumbnailWrongId = 8, EThumbnailAlreadyRunning = - 9, EThumbnailDatabaseUnrecoverable = 10 + 9, EThumbnailDatabaseUnrecoverable = 10, EThumbnailSQLTransaction = 11 }; /** diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/plugins/audio/group/thumbnailaudioprovider.mmp --- a/imagehandlingutilities/thumbnailmanager/plugins/audio/group/thumbnailaudioprovider.mmp Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/plugins/audio/group/thumbnailaudioprovider.mmp Mon May 03 12:48:51 2010 +0300 @@ -57,5 +57,7 @@ DEBUGLIBRARY flogger.lib +OPTION ARMCC -O3 -OTime + PAGED BYTEPAIRCOMPRESSTARGET diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/plugins/image/group/thumbnailimageprovider.mmp --- a/imagehandlingutilities/thumbnailmanager/plugins/image/group/thumbnailimageprovider.mmp Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/plugins/image/group/thumbnailimageprovider.mmp Mon May 03 12:48:51 2010 +0300 @@ -56,5 +56,7 @@ DEBUGLIBRARY flogger.lib +OPTION ARMCC -O3 -OTime + PAGED BYTEPAIRCOMPRESSTARGET diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp --- a/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp Mon May 03 12:48:51 2010 +0300 @@ -553,7 +553,6 @@ reader = CExifRead::NewL( *iBuffer, CExifRead::ENoJpeg ); } - CleanupStack::PushL( reader ); iExifThumbImage = reader->GetThumbnailL(); @@ -591,16 +590,6 @@ User::LeaveIfError( err ); } -/* - // If the Exif thumbnail is smaller than requested it will not be used - TFrameInfo frame = iDecoder->FrameInfo( 0 ); - - if ( frame.iOverallSizeInPixels.iWidth < iSize.iWidth || - frame.iOverallSizeInPixels.iHeight < iSize.iHeight ) - { - User::Leave( KErrGeneral ); - } - */ TN_DEBUG1( "CThumbnailImageDecoder::CreateExifDecoderL() end" ); } diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/plugins/video/group/thumbnailvideoprovider.mmp --- a/imagehandlingutilities/thumbnailmanager/plugins/video/group/thumbnailvideoprovider.mmp Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/plugins/video/group/thumbnailvideoprovider.mmp Mon May 03 12:48:51 2010 +0300 @@ -50,6 +50,8 @@ DEBUGLIBRARY flogger.lib +OPTION ARMCC -O3 -OTime + PAGED BYTEPAIRCOMPRESSTARGET diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/package.pkg --- a/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/package.pkg Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/package.pkg Mon May 03 12:48:51 2010 +0300 @@ -17,7 +17,7 @@ &EN ; Header -#{"Thumbnail Manager"},(0x102830AB), 10, 10, 4, TYPE=SA, RU +#{"Thumbnail Manager"},(0x102830AB), 10, 10, 5, TYPE=SA, RU ; Localised Vendor name %{"Nokia"} diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/stub.pkg --- a/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/stub.pkg Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/stub.pkg Mon May 03 12:48:51 2010 +0300 @@ -17,7 +17,7 @@ &EN ; Header -#{"ThumbnailManager"},(0x102830AB), 10, 10, 4, TYPE=SA +#{"ThumbnailManager"},(0x102830AB), 10, 10, 5, TYPE=SA ; Localised Vendor name %{"Nokia"} diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/thumbnailmanager_stub.sis Binary file imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/thumbnailmanager_stub.sis has changed diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/sis/thumbnailmanagercenrep/package.pkg --- a/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanagercenrep/package.pkg Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanagercenrep/package.pkg Mon May 03 12:48:51 2010 +0300 @@ -17,7 +17,7 @@ &EN ; Header -#{"Thumbnail Manager Cenrep"},(0x10202BE9), 10, 10, 4, TYPE=SP +#{"Thumbnail Manager Cenrep"},(0x10202BE9), 10, 10, 5, TYPE=SP ; Localised Vendor name %{"Symbian Software Ltd."} diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbagdaemon/group/thumbagdaemon.mmp --- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/group/thumbagdaemon.mmp Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/group/thumbagdaemon.mmp Mon May 03 12:48:51 2010 +0300 @@ -67,6 +67,8 @@ DEBUGLIBRARY flogger.lib +OPTION ARMCC -O3 -OTime + PAGED BYTEPAIRCOMPRESSTARGET diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h --- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h Mon May 03 12:48:51 2010 +0300 @@ -158,7 +158,19 @@ */ void QueryL( RArray& aIDArray ); + /** + * QueryPlaceholdersL + * + * @since S60 v5.0 + */ void QueryPlaceholdersL(); + + /** + * DeleteAndCancelQuery + * + * @since Symbian^3 + */ + void DeleteAndCancelQuery(); protected: @@ -243,6 +255,13 @@ */ void UpdatePSValues(const TBool aDefine = EFalse); + /** + * Comparison function for logaritmic use of queue arrays + * + * @since S60 v5.0 + */ + static TInt Compare(const TItemId& aLeft, const TItemId& aRight); + private: // not own @@ -265,22 +284,33 @@ //reference to current processing queue RArray* iLastQueue; + //background generation state + // EFalse = 1st round, create only grid size thumbnail for images and videos + // ETrue = 2nds round, create all missing sizes for all media items TBool i2ndRound; + //MDS query issues TBool iQueryActive; + //MDS query complete TBool iQueryReady; + //Processing MDS itens which are modified TBool iModify; TInt iProcessingCount; - //Flag is MDS Harvester harevsting + //MDS harvester's overall state TBool iHarvesting; TBool iHarvestingTemp; - - //Flag is MDS placeholder harvesting active + + //MDS Harvester's placeholder harvesting state TBool iPHHarvesting; TBool iPHHarvestingTemp; + //MDS Harvester's SD card harvesting state + TBool iMMCHarvesting; + TBool iMMCHarvestingTemp; + + CPeriodic* iPeriodicTimer; //MDS Harvester client diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp Mon May 03 12:48:51 2010 +0300 @@ -186,7 +186,6 @@ { // 2 observers TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) ); -//modify TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) ); #ifdef MDS_URI_OBSERVER // remove observer with uri @@ -374,8 +373,7 @@ iProcessor->RemoveFromQueues( aObjectIdArray, EFalse); } - // Add event to processing queue by type and enable force run - + // Add event to processing queue by type and enable force run RPointerArray dummyArray; TRAPD(err, iProcessor->AddToQueueL(aType, aObjectIdArray, dummyArray, EFalse)); if (err != KErrNone) diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp Mon May 03 12:48:51 2010 +0300 @@ -201,11 +201,62 @@ // CThumbAGProcessor::HandleQueryNewResults() // ----------------------------------------------------------------------------- // -void CThumbAGProcessor::HandleQueryNewResults( CMdEQuery& /*aQuery*/, - const TInt /*aFirstNewItemIndex*/, - const TInt /*aNewItemCount*/ ) +void CThumbAGProcessor::HandleQueryNewResults( CMdEQuery& aQuery, + const TInt aFirstNewItemIndex, + const TInt aNewItemCount ) { - // No implementation required + // PH & AllItems query results are handled here + if (aNewItemCount > 0) + { + if(&aQuery == iQueryPlaceholders) + { + TN_DEBUG2( "CThumbAGProcessor::HandleQueryNewResults - iQueryPlaceholders, %d new", aNewItemCount); + + for(TInt i = aFirstNewItemIndex; i < iQueryPlaceholders->Count(); i++) + { + const CMdEObject* object = &iQueryPlaceholders->Result(i); + + if(!object) + { + continue; + } + + if(!object->Placeholder()) + { + TN_DEBUG2( "CThumbAGProcessor::HandleQueryNewResults %d not placeholder", object->Id()); + continue; + } + + // ignore if fails + iPlaceholderQueue.InsertInOrder(object->Id(), Compare); + } + } + else if(&aQuery == iQueryAllItems) + { + TN_DEBUG2( "CThumbAGProcessor::HandleQueryNewResults - QueryAllItems, %d new", aNewItemCount); + + for(TInt i = aFirstNewItemIndex; i < iQueryAllItems->Count(); i++) + { + const CMdEObject* object = &iQueryAllItems->Result(i); + + if(!object) + { + continue; + } + + if (iAddQueue.FindInOrder(object->Id(), Compare) == KErrNotFound && + iModifyQueue.FindInOrder(object->Id(), Compare) == KErrNotFound ) + { + // ignore if fails + iAddQueue.InsertInOrder(object->Id(), Compare); + } + } + } + } + else + { + TN_DEBUG1( "CThumbAGProcessor::HandleQueryNewResults - error, no new items"); + } } // ----------------------------------------------------------------------------- @@ -221,67 +272,28 @@ TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted - iQueryPlaceholders completed"); iPlaceholderQueue.Reset(); - // if no errors in query - if (aError == KErrNone ) + + //free query + delete iQueryPlaceholders; + iQueryPlaceholders = NULL; + + if(iDoQueryAllItems) { - for(TInt i = 0; i < iQueryPlaceholders->Count(); i++) - { - const CMdEObject* object = &iQueryPlaceholders->Result(i); - - if(!object) - { - continue; - } - - if(!object->Placeholder()) - { - TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted %d not placeholder", object->Id()); - continue; - } - - /*if (iPlaceholderQueue.Find( object->Id() ) == KErrNotFound) - { - TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted %d added to placeholder queue", object->Id());*/ - TRAP_IGNORE( iPlaceholderQueue.AppendL( object->Id() )); - //} - } - } - delete iQueryPlaceholders; - iQueryPlaceholders = NULL; - - if(iDoQueryAllItems) - { - iDoQueryAllItems = EFalse; - TRAP_IGNORE(QueryAllItemsL()); - } + iDoQueryAllItems = EFalse; + TRAP_IGNORE(QueryAllItemsL()); + } } else if(&aQuery == iQueryAllItems) { TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted - QueryAllItems completed"); - // if no errors in query - if (aError == KErrNone ) - { - for(TInt i = 0; i < iQueryAllItems->Count(); i++) - { - const CMdEObject* object = &iQueryAllItems->Result(i); - - if(!object) - { - continue; - } - - if (iAddQueue.Find( object->Id() ) == KErrNotFound && iModifyQueue.Find( object->Id()) == KErrNotFound ) - { - TRAP_IGNORE( iAddQueue.AppendL( object->Id() )); - } - } + #ifdef _DEBUG TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted IN-COUNTERS---------- Amount: %d, Add",iQueryAllItems->Count()); #endif - } - //free query - delete iQueryAllItems; - iQueryAllItems = NULL; + + //free query + delete iQueryAllItems; + iQueryAllItems = NULL; } else if(&aQuery == iQuery ) { @@ -302,7 +314,7 @@ { TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() some result items missing"); - RArray iQueryQueueDelta; + RArray queryQueueDelta; TInt itemIndex(KErrNotFound); @@ -324,23 +336,26 @@ if(!found) { TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() missing from results item %d", iQueryQueue[queryItem] ); - iQueryQueueDelta.Append( iQueryQueue[queryItem] ); + + // ignore if fails + queryQueueDelta.InsertInOrder(iQueryQueue[queryItem], Compare); } } - TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() missing items total count %d", iQueryQueueDelta.Count()); + TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() missing items total count %d", queryQueueDelta.Count()); //cleanup from previous queue it item is not found from MDS - while(iQueryQueueDelta.Count()) + while(queryQueueDelta.Count()) { - itemIndex = iLastQueue->Find(iQueryQueueDelta[0]); + itemIndex = iLastQueue->FindInOrder(queryQueueDelta[0], Compare); + if(itemIndex >= 0) { TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() remove items %d", iQueryQueue[0]); iLastQueue->Remove( itemIndex ); } - iQueryQueueDelta.Remove(0); + queryQueueDelta.Remove(0); } - iQueryQueueDelta.Close(); + queryQueueDelta.Close(); } // no results, reset query @@ -354,23 +369,8 @@ } else { - TInt itemIndex(KErrNotFound); - - //cleanup current queue - while(iQueryQueue.Count()) - { - itemIndex = iLastQueue->Find(iQueryQueue[0]); - if(itemIndex >= 0) - { - iLastQueue->Remove( itemIndex ); - } - iQueryQueue.Remove(0); - } - - delete iQuery; - iQuery = NULL; - iProcessingCount = 0; - TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() Query FAILED!"); + DeleteAndCancelQuery(); + TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() Query FAILED!"); } } else @@ -479,9 +479,10 @@ for (int i=0; i= 0) { @@ -503,10 +503,11 @@ iPlaceholderQueue.Remove( itemIndex ); } - if(iAddQueue.Find( aIDArray[i]) == KErrNotFound && i2ndRoundGenerateQueue.Find( aIDArray[i])) + if(iAddQueue.FindInOrder(aIDArray[i], Compare) == KErrNotFound && + i2ndRoundGenerateQueue.FindInOrder(aIDArray[i], Compare) == KErrNotFound) { TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - append to add queue"); - iAddQueue.Append( aIDArray[i]); + User::LeaveIfError(iAddQueue.InsertInOrder(aIDArray[i], Compare)); } } } @@ -518,7 +519,7 @@ for (int i=0; i= 0) { @@ -528,7 +529,7 @@ else { TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - real modify"); - itemIndex = iAddQueue.Find( aIDArray[i] ); + itemIndex = iAddQueue.FindInOrder(aIDArray[i], Compare); if (itemIndex >= 0) { @@ -536,9 +537,8 @@ iAddQueue.Remove( itemIndex ); } else - { - - itemIndex = i2ndRoundGenerateQueue.Find( aIDArray[i] ); + { + itemIndex = i2ndRoundGenerateQueue.FindInOrder(aIDArray[i], Compare); if (itemIndex >= 0) { @@ -548,7 +548,7 @@ } TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - append to modify queue"); - iModifyQueue.AppendL(aIDArray[i]); + User::LeaveIfError(iModifyQueue.InsertInOrder(aIDArray[i], Compare)); SetForceRun( ETrue ); } @@ -562,14 +562,14 @@ for (int i=0; i= 0) { iAddQueue.Remove(itemIndex); } // ..and Modify Queue - itemIndex = iModifyQueue.Find( aIDArray[i] ); + itemIndex = iModifyQueue.FindInOrder(aIDArray[i], Compare); if(itemIndex >= 0) { iModifyQueue.Remove(itemIndex); @@ -657,15 +657,16 @@ if(iLastQueue == &iAddQueue || iLastQueue == &iModifyQueue) { TN_DEBUG2( "CThumbAGProcessor::CreateThumbnailsL() - 1st round add/modify, append to 2nd round queue", aObject->Id() ); - if(i2ndRoundGenerateQueue.Find(aObject->Id()) == KErrNotFound) + if(i2ndRoundGenerateQueue.FindInOrder(aObject->Id(), Compare) == KErrNotFound) { - i2ndRoundGenerateQueue.Append( aObject->Id() ); + // ignore if fails + i2ndRoundGenerateQueue.InsertInOrder(aObject->Id(), Compare); } } - if( !(imageObjectDef.Id() == aObject->Def().Id() || videoObjectDef.Id() == aObject->Def().Id()) ) + if( imageObjectDef.Id() != aObject->Def().Id() ) { - TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() 1st round and not image or video, skip"); + TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() 1st round not image"); ActivateAO(); return; } @@ -731,10 +732,11 @@ TN_DEBUG3( "CThumbAGProcessor::QueryL() - fill begin aIDArray == %d, iQueryQueue == %d", aIDArray.Count(), iQueryQueue.Count() ); - for(TInt i=0;i < KMaxQueryItems && i < maxCount; i++) + for(TInt i=0; i < KMaxQueryItems && i < maxCount; i++) { - TN_DEBUG2( "CThumbAGProcessor::QueryL() - fill %d", aIDArray[i] ); - iQueryQueue.Append( aIDArray[i] ); + TN_DEBUG2( "CThumbAGProcessor::QueryL() - fill %d", aIDArray[0] ); + iQueryQueue.InsertInOrder(aIDArray[0], Compare); + aIDArray.Remove(0); } TN_DEBUG3( "CThumbAGProcessor::QueryL() - fill end aIDArray == %d, iQueryQueue == %d", aIDArray.Count(), iQueryQueue.Count() ); @@ -836,7 +838,7 @@ audioPHObjectCondition.SetPlaceholderOnly( ETrue ); audioPHObjectCondition.SetNotPresent( ETrue ); - iQueryPlaceholders->FindL(); + iQueryPlaceholders->FindL(KMaxTInt, KMaxQueryItems2); TN_DEBUG1( "CThumbAGProcessor::QueryPlaceholdersL - end" ); } @@ -895,7 +897,7 @@ if( err == KErrNone ) { TN_DEBUG1( "CThumbAGProcessor::RunL() add iHarvesterClient observer"); - err = iHarvesterClient.AddHarvesterEventObserver( *this, EHEObserverTypeOverall | EHEObserverTypePlaceholder, KMaxTInt ); + err = iHarvesterClient.AddHarvesterEventObserver( *this, EHEObserverTypeOverall | EHEObserverTypeMMC | EHEObserverTypePlaceholder, KMaxTInt ); TN_DEBUG2( "CThumbAGProcessor::RunL() iHarvesterClient observer err = %d", err); __ASSERT_DEBUG((err==KErrNone), User::Panic(_L("CThumbAGProcessor::RunL(), !iHarvesterClient "), err)); } @@ -967,14 +969,9 @@ { TN_DEBUG1( "void CThumbAGProcessor::RunL() skip idle detection!"); CancelTimeout(); - } + } else { - if(iActivityManager) - { - iIdle = iActivityManager->IsInactive(); - } - if( !iIdle || iHarvesting || iMPXHarvesting || iPeriodicTimer->IsActive() ) { TN_DEBUG1( "void CThumbAGProcessor::RunL() device not idle"); @@ -1009,17 +1006,17 @@ const CMdEObject* object = &iQuery->Result( iProcessingCount-1 ); iProcessingCount--; - TInt itemIndex = iLastQueue->Find( object->Id()); - if(itemIndex >= 0) - { - iLastQueue->Remove(itemIndex); - } - - // process one item at once if ( object ) { + TInt itemIndex = iLastQueue->FindInOrder(object->Id(), Compare); + if(itemIndex >= 0) + { + iLastQueue->Remove(itemIndex); + } + + //process one item at once //remove item from queryQueue when request is issued - itemIndex = iQueryQueue.Find( object->Id()); + itemIndex = iQueryQueue.FindInOrder(object->Id(), Compare); if(itemIndex >= 0) { iQueryQueue.Remove(itemIndex); @@ -1033,27 +1030,9 @@ //force is coming, but executing non-forced query complete-> cancel old else { - TN_DEBUG1( "CThumbAGProcessor::RunL() - deleting query 1" ); - delete iQuery; - iQuery = NULL; - iQueryReady = EFalse; - iProcessingCount = 0; - - //move remainig IDs in query queue back to original queue - while(iQueryQueue.Count()) - { - if(iLastQueue) - { - if(iLastQueue->Find( iQueryQueue[0]) == KErrNotFound) - { - iLastQueue->Append(iQueryQueue[0]); - } - } - iQueryQueue.Remove(0); - } - iLastQueue = NULL; - ActivateAO(); - return; + DeleteAndCancelQuery(); + ActivateAO(); + return; } //is last query item @@ -1071,31 +1050,7 @@ { if(iForceRun && !iModify) { - if(iQuery) - { - TN_DEBUG1( "CThumbAGProcessor::RunL() - deleting query 2" ); - iQuery->Cancel(); - delete iQuery; - iQuery = NULL; - } - - iQueryReady = EFalse; - iQueryActive = EFalse; - - //move remainig IDs in query queue back to original queue - while(iQueryQueue.Count()) - { - if(iLastQueue) - { - if(iLastQueue->Find( iQueryQueue[0]) == KErrNotFound) - { - iLastQueue->Append(iQueryQueue[0]); - } - } - iQueryQueue.Remove(0); - } - iLastQueue = NULL; - + DeleteAndCancelQuery(); ActivateAO(); } else @@ -1168,6 +1123,44 @@ } // --------------------------------------------------------------------------- +// CThumbAGProcessor::DeleteAndCancelQuery() +// --------------------------------------------------------------------------- +// +void CThumbAGProcessor::DeleteAndCancelQuery() + { + TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() in" ); + + if(iQuery) + { + TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() - deleting query" ); + iQuery->Cancel(); + delete iQuery; + iQuery = NULL; + } + + iQueryReady = EFalse; + iQueryActive = EFalse; + iProcessingCount = 0; + + //move remainig IDs in query queue back to original queue + while(iQueryQueue.Count()) + { + if(iLastQueue) + { + if(iLastQueue->FindInOrder(iQueryQueue[0], Compare) == KErrNotFound) + { + //ignore if fails + iLastQueue->InsertInOrder(iQueryQueue[0], Compare); + } + } + iQueryQueue.Remove(0); + } + iLastQueue = NULL; + + TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() out" ); + } + +// --------------------------------------------------------------------------- // CThumbAGProcessor::DoCancel() // --------------------------------------------------------------------------- // @@ -1268,8 +1261,48 @@ } } } + //MMC harvesting + else if( aHEObserverType == EHEObserverTypeMMC) + { + switch(aHarvesterEventState) + { + case EHEStateStarted: + case EHEStateHarvesting: + case EHEStatePaused: + case EHEStateResumed: + { + iMMCHarvestingTemp = ETrue; + break; + } + case EHEStateFinished: + case EHEStateUninitialized: + { + iMMCHarvestingTemp = EFalse; + break; + } + }; + + if(iMMCHarvestingTemp != iMMCHarvesting) + { + iMMCHarvesting = iMMCHarvestingTemp; + + if( iMMCHarvesting ) + { + TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS MMC harvesterin started"); + if(iPreviousItemsLeft != KErrNotReady) + { + iPreviousItemsLeft = KErrNotReady; + RProperty::Set(KTAGDPSNotification, KDaemonProcessing, iPreviousItemsLeft); + } + } + else + { + TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS MMC harvesting finished "); + } + } + } - TN_DEBUG3( "CThumbAGProcessor::HarvestingUpdated -- end() iHarvesting == %d, iPHHarvesting == %d ", iHarvesting, iPHHarvesting); + TN_DEBUG4( "CThumbAGProcessor::HarvestingUpdated -- end() iHarvesting == %d, iPHHarvesting == %d iMMCHarvesting == %d ", iHarvesting, iPHHarvesting, iMMCHarvesting); } // --------------------------------------------------------------------------- @@ -1349,13 +1382,6 @@ return; } - if( !IsActive() ) - { - SetActive(); - TRequestStatus* statusPtr = &iStatus; - User::RequestComplete( statusPtr, KErrNone ); - } - //check if forced run needs to continue if (iModifyQueue.Count()) { @@ -1366,6 +1392,14 @@ iModify = EFalse; SetForceRun( EFalse ); } + + if( !IsActive() && ((!iActive && !iQueryActive) || iForceRun )) + { + TN_DEBUG1( "CThumbAGProcessor::ActivateAO() - Activated"); + SetActive(); + TRequestStatus* statusPtr = &iStatus; + User::RequestComplete( statusPtr, KErrNone ); + } UpdatePSValues(); } @@ -1462,32 +1496,28 @@ { TN_DEBUG2( "CThumbAGProcessor::RemoveFromQueues() - %d", aIDArray[i]); - itemIndex = iPlaceholderQueue.Find( aIDArray[i] ); - + itemIndex = iPlaceholderQueue.FindInOrder(aIDArray[i], Compare); if(itemIndex >= 0) { iPlaceholderQueue.Remove(itemIndex); TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iPlaceholderQueue" ); } - itemIndex = iAddQueue.Find( aIDArray[i] ); - + itemIndex = iAddQueue.FindInOrder(aIDArray[i], Compare); if(itemIndex >= 0) { iAddQueue.Remove(itemIndex); TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iAddQueue" ); } - itemIndex = i2ndRoundGenerateQueue.Find( aIDArray[i] ); - + itemIndex = i2ndRoundGenerateQueue.FindInOrder(aIDArray[i], Compare); if(itemIndex >= 0) { i2ndRoundGenerateQueue.Remove(itemIndex); TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - i2ndRoundGenerateQueue" ); } - itemIndex = iModifyQueue.Find( aIDArray[i] ); - + itemIndex = iModifyQueue.FindInOrder(aIDArray[i], Compare); if(itemIndex >= 0) { iModifyQueue.Remove(itemIndex); @@ -1499,34 +1529,19 @@ } } - itemIndex = iQueryQueue.Find( aIDArray[i] ); - + itemIndex = iQueryQueue.FindInOrder(aIDArray[i], Compare); if(itemIndex >= 0) { iQueryQueue.Remove(itemIndex); TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iQueryQueue" ); } - - itemIndex = iPlaceholderQueue.Find( aIDArray[i] ); - + + itemIndex = iPlaceholderQueue.FindInOrder(aIDArray[i], Compare); if(itemIndex >= 0) { iPlaceholderQueue.Remove(itemIndex); TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iPlaceholderQueue" ); } - - /* - if( aRemoveFromDelete ) - { - itemIndex = iRemoveQueue.Find( aIDArray[i] ); - - if(itemIndex >= 0) - { - iRemoveQueue.Remove(itemIndex); - TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iRemoveQueue" ); - continue; - } - }*/ } TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - end" ); @@ -1593,7 +1608,7 @@ CMdEObjectCondition& audioPHObjectCondition = rootCondition.AddObjectConditionL(audioObjDef); - iQueryAllItems->FindL(); + iQueryAllItems->FindL(KMaxTInt, KMaxQueryItems2); TN_DEBUG1( "CThumbAGProcessor::QueryAllItemsL - end" ); } @@ -1770,12 +1785,20 @@ daemonProcessing = ETrue; } - //disable 2nd round generarion when there is items in 1st round queues - //or 2nd queue is empty - if( !i2ndRoundGenerateQueue.Count() || itemsLeft ) + //adjust items left to containing also items not yet processed but removed from queue under processing + if((iLastQueue == &iModifyQueue || iLastQueue == &iAddQueue) && !i2ndRound) { + itemsLeft +=iQueryQueue.Count(); + } + + //cancel 2nd round generarion when there is items in 1st round queues + if(itemsLeft && i2ndRound) + { + DeleteAndCancelQuery(); i2ndRound = EFalse; } + + TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() KItemsleft == %d", itemsLeft); if(aDefine) { @@ -1803,4 +1826,15 @@ } } +// --------------------------------------------------------------------------- +// CThumbAGProcessor::Compare +// Comparison function for logaritmic use of queue arrays +// --------------------------------------------------------------------------- +// +TInt CThumbAGProcessor::Compare(const TItemId& aLeft, const TItemId& aRight) + { + return (aLeft - aRight); + } + + // End of file diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailclient/group/thumbnailmanager.mmp --- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/group/thumbnailmanager.mmp Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/group/thumbnailmanager.mmp Mon May 03 12:48:51 2010 +0300 @@ -54,5 +54,7 @@ DEBUGLIBRARY flogger.lib +OPTION ARMCC -O3 -OTime + PAGED BYTEPAIRCOMPRESSTARGET diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailmanagerimpl.h --- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailmanagerimpl.h Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailmanagerimpl.h Mon May 03 12:48:51 2010 +0300 @@ -337,6 +337,23 @@ void UpdateThumbnailsL( const TThumbnailId aItemId, const TDesC& aPath, const TInt aOrientation, const TInt64 aModified, TInt aPriority ); + /** + * Rename Thumbnails. This is an asynchronous + * operation, which always returns immediately. + * + * @since S60 v5.0 + * @param aCurrentPath Current path of the Thumbnail + * @param aNewPath New path for the Thumbnail + * @param aPriority Priority for this operation + * @return Thumbnail request ID. This can be used to + * cancel the request or change priority. + * The ID is specific to this CThumbnailManager + * instance and may not be shared with other + * instances. + */ + TThumbnailRequestId RenameThumbnailsL( const TDesC& aCurrentPath, + const TDesC& aNewPath, TInt aPriority = CActive::EPriorityIdle ); + private: /** diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestactive.h --- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestactive.h Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestactive.h Mon May 03 12:48:51 2010 +0300 @@ -40,7 +40,8 @@ EReqSetThumbnailBitmap = 3, EReqUpdateThumbnails = 4, EReqGetThumbnailHandleLater = 5, - EReqDeleteThumbnails = 6 + EReqDeleteThumbnails = 6, + EReqRenameThumbnails = 7 }; /** @@ -223,6 +224,17 @@ const TInt aPriority ); /** + * Rename thumbnails. + * + * @since S60 v5.0 + * @param aCurrentPath Current path of the Thumbnail + * @param aNewPath New path for the Thumbnail + * @param aPriority Priority for this operation + */ + void RenameThumbnails( const TDesC& aCurrentPath, const TDesC& aNewPath, + const TInt aPriority ); + + /** * Start active request. * * @since S60 v5.0 diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailsession.h --- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailsession.h Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailsession.h Mon May 03 12:48:51 2010 +0300 @@ -192,6 +192,13 @@ void UpdateThumbnails( const TDesC& aPath, const TInt aOrientation, const TInt64 aModified, TThumbnailRequestParamsPckg& aParams, TRequestStatus& aStatus); + /** + * Rename thumbnails. + * + * @since S60 v5.0 + */ + void RenameThumbnails( TThumbnailRequestParamsPckg& aParams, TRequestStatus& aStatus ); + private: /** diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp Mon May 03 12:48:51 2010 +0300 @@ -147,7 +147,7 @@ TInt aPriority, TBool aGeneratePersistentSizesOnly) { iRequestId++; - TN_DEBUG4( "CThumbnailManagerImpl::GetThumbnailL() URI==%S, iThumbnailSize==%d %d", &aObjectSource.Uri(), iThumbnailSize, iRequestId ); + TN_DEBUG4( "CThumbnailManagerImpl::GetThumbnailL() URI==%S, iThumbnailSize==%d, req %d", &aObjectSource.Uri(), iThumbnailSize, iRequestId ); __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId )); @@ -208,7 +208,7 @@ aThumbnailId, TAny* aClientData /*= NULL*/, TInt aPriority) { iRequestId++; - TN_DEBUG5( "CThumbnailManagerImpl::GetThumbnailL() reqid==%d, aThumbnailId==%d, iThumbnailSize==%d %d", iRequestId, aThumbnailId, iThumbnailSize, iRequestId ); + TN_DEBUG4( "CThumbnailManagerImpl::GetThumbnailL() aThumbnailId==%d, iThumbnailSize==%d, req %d", aThumbnailId, iThumbnailSize, iRequestId ); __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId )); @@ -613,7 +613,7 @@ TInt aPriority ) { iRequestId++; - TN_DEBUG4( "CThumbnailManagerImpl::UpdateThumbnailsL() URI==%S, aItemId==%d %d", &aPath, aItemId, iRequestId); + TN_DEBUG4( "CThumbnailManagerImpl::UpdateThumbnailsL() URI==%S, aItemId==%d, req %d", &aPath, aItemId, iRequestId); __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId )); @@ -633,6 +633,35 @@ } // --------------------------------------------------------------------------- +// CThumbnailManagerImpl::RenameThumbnailsL() +// Renames thumbnails by given path +// --------------------------------------------------------------------------- +// +TThumbnailRequestId CThumbnailManagerImpl::RenameThumbnailsL( const TDesC& aCurrentPath, + const TDesC& aNewPath, TInt aPriority ) + { + iRequestId++; + TN_DEBUG3( "CThumbnailManagerImpl::RenameThumbnailsL() URI==%S, req %d", &aCurrentPath, iRequestId); + + __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId )); + + TInt priority = ValidatePriority(aPriority); + + CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL + ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue ); + CleanupStack::PushL( getThumbnailActive ); + + getThumbnailActive->RenameThumbnails( aCurrentPath, aNewPath, priority ); + + iRequestQueue->AddRequestL( getThumbnailActive ); + CleanupStack::Pop( getThumbnailActive ); + + iRequestQueue->Process(); + + return iRequestId; + } + +// --------------------------------------------------------------------------- // CThumbnailManagerImpl::ValidatePriority() // Check that given priority is in range of CActive::TPriority // --------------------------------------------------------------------------- diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp Mon May 03 12:48:51 2010 +0300 @@ -163,6 +163,7 @@ case EReqGetThumbnailHandleLater: { // open file handle + iFile.Close(); User::LeaveIfError( iFile.Open( iFs, iTargetUri, EFileShareReadersOrWriters ) ); TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iTargetUri ); @@ -185,7 +186,12 @@ iSession.DeleteThumbnails( iParams.iThumbnailId, iParamsPckg, iStatus ); } break; - } + } + case EReqRenameThumbnails: + { + iSession.RenameThumbnails( iParamsPckg, iStatus ); + break; + } default: { break; @@ -219,9 +225,15 @@ iTimer->Cancel(); - if (iRequestType == EReqDeleteThumbnails || iCanceled) + if (iRequestType == EReqDeleteThumbnails || iCanceled || + iRequestType == EReqRenameThumbnails) { - // no action for delete or canceled request + TN_DEBUG1( "CThumbnailRequestActive::RunL() - rename/delete/canceled" ); + + iFile.Close(); + iMyFileHandle.Close(); + + // no action for delete/rename or canceled request iRequestQueue->RequestComplete(this); #ifdef _DEBUG @@ -239,8 +251,8 @@ // We tried to get thumbnail using file path, but it was not found in // the database. We need to open the file now (on the client side) and - // use file handle. - + // use file handle. + iFile.Close(); TInt err = iFile.Open( iFs, iParams.iFileName, EFileShareReadersOrWriters ); TN_DEBUG2( "CThumbnaiRequestActive::RunL() - file handle open err = %d", err ); User::LeaveIfError( err ); @@ -273,6 +285,10 @@ iObserver.ThumbnailReady( iStatus.Int(), *iCallbackThumbnail, iParams.iRequestId ); ReleaseServerBitmap(); + + iFile.Close(); + iMyFileHandle.Close(); + iRequestQueue->RequestComplete(this); #ifdef _DEBUG @@ -296,6 +312,8 @@ ReleaseServerBitmap(); + iFile.Close(); + //set flags so that EThumbnailGeneratePersistentSizesOnly is done aka check all missing sizes iParams.iQualityPreference = CThumbnailManager::EOptimizeForQuality; iParams.iControlFlags = EThumbnailGeneratePersistentSizesOnly; @@ -350,12 +368,17 @@ if ( iProcessingPreview ) { TN_DEBUG2( "CThumbnailRequestActive::RunL() - iObserver.ThumbnailPreviewReady %d", iParams.iRequestId ); - //increase priority of 2nd round (both, AO and request itself) + + //increase priority of 2nd round (both, AO and request itself) this->SetPriority(this->Priority() + 1); iParams.iPriority++; iObserver.ThumbnailPreviewReady( *iCallbackThumbnail, iParams.iRequestId ); iProcessingPreview = EFalse; + ReleaseServerBitmap(); + + iFile.Close(); + Get2ndPhaseThumbnailL(); } else @@ -365,6 +388,9 @@ iObserver.ThumbnailReady( iStatus.Int(), * iCallbackThumbnail, iParams.iRequestId ); ReleaseServerBitmap(); + iFile.Close(); + iMyFileHandle.Close(); + iRequestQueue->RequestComplete(this); #ifdef _DEBUG @@ -480,6 +506,9 @@ ReleaseServerBitmap(); + iFile.Close(); + iMyFileHandle.Close(); + iRequestCompleted = ETrue; iRequestQueue->RequestComplete(this); iRequestActive = EFalse; @@ -726,6 +755,22 @@ } // --------------------------------------------------------------------------- +// CThumbnailRequestActive::RenameThumbnails() +// Rename thumbnails. +// --------------------------------------------------------------------------- +// +void CThumbnailRequestActive::RenameThumbnails( const TDesC& aCurrentPath, + const TDesC& aNewPath, const TInt aPriority ) + { + iRequestType = EReqRenameThumbnails; + + iParams.iRequestId = iRequestId; + iParams.iPriority = aPriority; + iParams.iFileName = aCurrentPath; + iParams.iTargetUri = aNewPath; + } + +// --------------------------------------------------------------------------- // Request 2nd phase thumbnail // --------------------------------------------------------------------------- // @@ -798,8 +843,16 @@ CThumbnailRequestActive* self = static_cast( aAny ); + self->iTimer->Cancel(); + + if (self->IsActive()) + { + // hangs without this + TRequestStatus* statusPtr = &self->iStatus; + User::RequestComplete( statusPtr, KErrTimedOut ); + } + self->Cancel(); - self->iTimer->Cancel(); if (self->iStartError != KErrNone) { @@ -812,6 +865,8 @@ self->HandleError(); + TN_DEBUG1( "CThumbnailRequestActive::TimerCallBack() - end"); + return KErrNone; } diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailsession.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailsession.cpp Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailsession.cpp Mon May 03 12:48:51 2010 +0300 @@ -338,6 +338,18 @@ SendReceive( EUpdateThumbnails, args, aStatus ); } + +// --------------------------------------------------------------------------- +// Rename thumbnails. +// --------------------------------------------------------------------------- +// +void RThumbnailSession::RenameThumbnails( TThumbnailRequestParamsPckg& aParams, + TRequestStatus& aStatus ) + { + TIpcArgs args( &aParams, KCheckValue); + + SendReceive( ERenameThumbnails, args, aStatus ); + } // End of file diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/inc/thumbnailmanager_p_qt.h --- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/inc/thumbnailmanager_p_qt.h Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/inc/thumbnailmanager_p_qt.h Mon May 03 12:48:51 2010 +0300 @@ -19,19 +19,21 @@ #define THUMBNAILMANAGER_P_QT_H #include +#include + #include #include #include -#include + class QString; -class QPixmap; class QSize; class CThumbnailManager; class MThumbnailData; class CFbsBitmap; class QByteArray; +class TestThumbnailManager; class ThumbnailManagerPrivate : public QObject, @@ -137,7 +139,7 @@ * Change the priority of a queued thumbnail operation. */ bool changePriority( int id, int newPriority ); - + //FROM MThumbnailManagerObserver /** * Preview thumbnail generation or loading is complete. @@ -185,20 +187,40 @@ * Final thumbnail bitmap generation or loading is complete. */ void thumbnailReady( QPixmap , void * , int , int ); - + + void thumbnailReady( QImage , void * , int , int ); + +private: + /** + * Copy CFbsBitmap into a QImage. + */ + QImage fromBitmap( CFbsBitmap* bitmap ); -private: /** * Copy CFbsBitmap into a QPixmap. */ - QPixmap copyPixmap( CFbsBitmap* bitmap ); + QPixmap fromImage( CFbsBitmap* bitmap ); + /** + * Limit priority to presumed range. + */ + int convertPriority(int basePriority); + + +public: + + int connectionCounterImage; + + int connectionCounterPixmap; private: CThumbnailManager* iThumbnailManager; QByteArray* byteArray; + + friend class TestThumbnailManager; + }; #endif // ThumbnailManager_H diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_p_qt.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_p_qt.cpp Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_p_qt.cpp Mon May 03 12:48:51 2010 +0300 @@ -16,7 +16,7 @@ */ #include -#include +#include #include #include #include @@ -24,7 +24,14 @@ #include "thumbnailmanager_qt.h" #include "thumbnailmanager_p_qt.h" -ThumbnailManagerPrivate::ThumbnailManagerPrivate() : iThumbnailManager( NULL ), byteArray( NULL ) +#include + +const int ThumbnailMangerPriorityLowest = CActive::EPriorityIdle; +const int ThumbnailMangerPriorityHighest = CActive::EPriorityHigh; + +ThumbnailManagerPrivate::ThumbnailManagerPrivate() : iThumbnailManager( NULL ), byteArray( NULL ), + connectionCounterImage( 0 ), + connectionCounterPixmap( 0 ) { TRAP_IGNORE( iThumbnailManager = CThumbnailManager::NewL( *this ); @@ -103,6 +110,8 @@ { int result( -1 ); QString symbFileName( fileName ); + + priority = convertPriority(priority); if( symbFileName.contains( "/" ) ) symbFileName.replace( "/", "\\", Qt::CaseSensitive ); @@ -123,6 +132,9 @@ int priority ) { int result( -1 ); + + priority = convertPriority(priority); + TRAP_IGNORE( result = iThumbnailManager->GetThumbnailL( aThumbnailId, clientData, priority )); return result; } @@ -133,6 +145,8 @@ int result( -1 ); RBuf file; _LIT( mime, "image/png" ); + + priority = convertPriority(priority); if( !byteArray ){ byteArray = new QByteArray(); @@ -169,6 +183,8 @@ RBuf file; _LIT( mime, "image/png" ); + priority = convertPriority(priority); + if( !byteArray ){ byteArray = new QByteArray(); } @@ -228,21 +244,28 @@ bool ThumbnailManagerPrivate::changePriority( int id, int newPriority ) { + newPriority = convertPriority(newPriority); + return ( iThumbnailManager->ChangePriority( id, newPriority ) == KErrNone ); } -QPixmap ThumbnailManagerPrivate::copyPixmap( CFbsBitmap* bitmap ) +QImage ThumbnailManagerPrivate::fromBitmap( CFbsBitmap* bitmap ) { TSize size = bitmap->SizeInPixels(); - int bytesPerLine = bitmap->ScanLineLength( size.iWidth, - bitmap->DisplayMode() ); + int bytesPerLine = bitmap->ScanLineLength( size.iWidth, bitmap->DisplayMode() ); const uchar* dataPtr = ( const uchar* ) bitmap->DataAddress(); + QImage image = QImage(dataPtr, size.iWidth, size.iHeight, bytesPerLine, QImage::Format_RGB16); + return image.copy(); +} - return QPixmap::fromImage( QImage( dataPtr, - size.iWidth, - size.iHeight, - bytesPerLine, - QImage::Format_RGB16 ) ); +QPixmap ThumbnailManagerPrivate::fromImage( CFbsBitmap* bitmap ) +{ + return QPixmap::fromImage(fromBitmap(bitmap)); +} + +int ThumbnailManagerPrivate::convertPriority(int basePriority) +{ + return qBound(ThumbnailMangerPriorityLowest, basePriority, ThumbnailMangerPriorityHighest); } void ThumbnailManagerPrivate::ThumbnailPreviewReady( MThumbnailData& /*aThumbnail*/, @@ -258,15 +281,23 @@ byteArray = NULL; } - QPixmap* pixmap( NULL ); + if (connectionCounterImage || connectionCounterPixmap) { + QImage image; + + if (aError == KErrNone) { + image = fromBitmap(aThumbnail.Bitmap()); + } else { + image = QImage(); + } - if( aError == KErrNone ){ - pixmap = new QPixmap( copyPixmap( aThumbnail.Bitmap() ) ); - }else { - pixmap = new QPixmap(); + if (connectionCounterImage) { + emit thumbnailReady(image, aThumbnail.ClientData(), aId, aError); + } + + if (connectionCounterPixmap) { + QPixmap pixmap = QPixmap::fromImage(image); + emit thumbnailReady(pixmap, aThumbnail.ClientData(), aId, aError); + } } - - emit thumbnailReady( *pixmap, aThumbnail.ClientData(), aId, aError ); - delete pixmap; } diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_qt.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_qt.cpp Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_qt.cpp Mon May 03 12:48:51 2010 +0300 @@ -15,105 +15,126 @@ * */ -#include +#include #include "thumbnailmanager_qt.h" #include "thumbnailmanager_p_qt.h" -EXPORT_C ThumbnailManager::ThumbnailManager( QObject* parentPtr ) : +Q_DECL_EXPORT ThumbnailManager::ThumbnailManager( QObject* parentPtr ) : 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 ) ) ); } -EXPORT_C ThumbnailManager::~ThumbnailManager() +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; } } -EXPORT_C ThumbnailManager::QualityPreference ThumbnailManager::qualityPreference() const +Q_DECL_EXPORT ThumbnailManager::QualityPreference ThumbnailManager::qualityPreference() const { return d->qualityPreference(); } -EXPORT_C bool ThumbnailManager::setQualityPreference( QualityPreference +Q_DECL_EXPORT bool ThumbnailManager::setQualityPreference( QualityPreference qualityPreference ) { return d->setQualityPreference( qualityPreference ); } -EXPORT_C QSize ThumbnailManager::thumbnailSize() const +Q_DECL_EXPORT QSize ThumbnailManager::thumbnailSize() const { return d->thumbnailSize(); } -EXPORT_C bool ThumbnailManager::setThumbnailSize( const QSize& thumbnailSize ) +Q_DECL_EXPORT bool ThumbnailManager::setThumbnailSize( const QSize& thumbnailSize ) { return d->setThumbnailSize( thumbnailSize ); } -EXPORT_C bool ThumbnailManager::setThumbnailSize( ThumbnailSize thumbnailSize ) +Q_DECL_EXPORT bool ThumbnailManager::setThumbnailSize( ThumbnailSize thumbnailSize ) { return d->setThumbnailSize( thumbnailSize ); } -EXPORT_C ThumbnailManager::ThumbnailMode ThumbnailManager::mode() const +Q_DECL_EXPORT ThumbnailManager::ThumbnailMode ThumbnailManager::mode() const { return d->mode(); } -EXPORT_C bool ThumbnailManager::setMode( ThumbnailMode mode ) +Q_DECL_EXPORT bool ThumbnailManager::setMode( ThumbnailMode mode ) { return d->setMode( mode ); } -EXPORT_C int ThumbnailManager::getThumbnail( const QString& fileName, void * clientData, +Q_DECL_EXPORT int ThumbnailManager::getThumbnail( const QString& fileName, void * clientData, int priority ) { return d->getThumbnail( fileName, clientData, priority ); } -EXPORT_C int ThumbnailManager::getThumbnail( unsigned long int thumbnailId, void * clientData, +Q_DECL_EXPORT int ThumbnailManager::getThumbnail( unsigned long int thumbnailId, void * clientData, int priority ) { return d->getThumbnail( thumbnailId, clientData, priority ); } -EXPORT_C int ThumbnailManager::setThumbnail( const QPixmap& source, const QString& filename, +Q_DECL_EXPORT int ThumbnailManager::setThumbnail( const QPixmap& source, const QString& filename, void * clientData , int priority ) { return d->setThumbnail( source, filename, clientData, priority ); } -EXPORT_C int ThumbnailManager::setThumbnail( const QImage& source, const QString& filename, +Q_DECL_EXPORT int ThumbnailManager::setThumbnail( const QImage& source, const QString& filename, void * clientData , int priority ) { return d->setThumbnail( source, filename, clientData, priority ); } -EXPORT_C void ThumbnailManager::deleteThumbnails( const QString& fileName ) +Q_DECL_EXPORT void ThumbnailManager::deleteThumbnails( const QString& fileName ) { d->deleteThumbnails( fileName ); } -EXPORT_C void ThumbnailManager::deleteThumbnails( unsigned long int thumbnailId ) +Q_DECL_EXPORT void ThumbnailManager::deleteThumbnails( unsigned long int thumbnailId ) { d->deleteThumbnails( thumbnailId ); } -EXPORT_C bool ThumbnailManager::cancelRequest( int id ) +Q_DECL_EXPORT bool ThumbnailManager::cancelRequest( int id ) { return d->cancelRequest( id ); } -EXPORT_C bool ThumbnailManager::changePriority( int id, int newPriority ) +Q_DECL_EXPORT bool ThumbnailManager::changePriority( int id, int newPriority ) { return d->changePriority( id, newPriority ); } +void ThumbnailManager::connectNotify(const char *signal) +{ + if (QLatin1String(signal) == SIGNAL(thumbnailReady(QPixmap,void*,int,int))) { + d->connectionCounterPixmap++; + } else if (QLatin1String(signal) == SIGNAL(thumbnailReady(QImage,void*,int,int))) { + d->connectionCounterImage++; + } +} + +void ThumbnailManager::disconnectNotify(const char *signal) +{ + if (QLatin1String(signal) == SIGNAL(thumbnailReady(QPixmap,void*,int,int))) { + d->connectionCounterPixmap--; + } else if (QLatin1String(signal) == SIGNAL(thumbnailReady(QImage,void*,int,int))) { + d->connectionCounterImage--; + } +} diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/thumbnailmanagerqt.pro --- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/thumbnailmanagerqt.pro Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/thumbnailmanagerqt.pro Mon May 03 12:48:51 2010 +0300 @@ -20,6 +20,7 @@ symbian:TARGET.UID3=0x20029F65 +DEFINES+=TNMQT_DLL INCLUDEPATH += . INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/test_qtnmwrapper.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/test_qtnmwrapper.cpp Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/test_qtnmwrapper.cpp Mon May 03 12:48:51 2010 +0300 @@ -39,10 +39,21 @@ void thumbnailReady_p( QPixmap , void * , int , int ); + void thumbnailReadyPixmap( QPixmap , void * , int , int ); + + void thumbnailReadyImage( QImage , void * , int , int ); + private slots: - void initTestCase(); - void cleanupTestCase(); + void init(); + void cleanup(); + + void testThumbnailReadyError(); + void testThumbnailReadyValid(); + void testThumbnailReadyImage(); + void testThumbnailReadyPixmap(); + void testThumbnailReadyImageAndPixmap(); + void createAndDestroy(); void qualityPreference(); void thumbnailSize(); @@ -56,17 +67,30 @@ void deleteThumbnailsByName(); void deleteThumbnailsById(); - void testThumbnailReadyError(); - void testThumbnailReadyValid(); + void testPriorities_data(); + void testPriorities(); + public: - ThumbnailManager* wrapper; + ThumbnailManager *wrapper; + ThumbnailManagerPrivate *wrapper_p; + QPixmap* ipixmap; int aid; int aerrorCode; bool pixmapNull; + //pixmap + int pixmapId; + int pixmapErr; + void *pixmapDataPtr; + + //image + int imageId; + int imageErr; + void *imageDataPtr; + }; enum testDataType{ @@ -77,7 +101,11 @@ class TestThumbnailData : public MThumbnailData { public: - TestThumbnailData( testDataType type) : bitmap(0), clientData(0) + static const int BITMAP_WIDTH = 26; + static const int BITMAP_HEIGHT = 15; + +public: + TestThumbnailData( testDataType type, void* clientData_ = 0) : bitmap(0), clientData(clientData_) { switch( type ){ case AllNull: @@ -85,7 +113,7 @@ case BitmapValid: bitmap = new CFbsBitmap(); - QVERIFY( !bitmap->Create(TSize(26,15),EColor64K) ); + QVERIFY( !bitmap->Create(TSize(BITMAP_WIDTH, BITMAP_HEIGHT),EColor64K) ); QVERIFY( !bitmap->Load( _L("c:\\tnmwrapper_tsrc.mbm") ) ); break; }; @@ -93,10 +121,9 @@ }; ~TestThumbnailData() { - if( bitmap ) - delete bitmap; - if( clientData ) - delete clientData; + if( bitmap ) { + delete bitmap; + } }; CFbsBitmap* Bitmap() {return bitmap;}; @@ -111,34 +138,45 @@ }; +// --- test initialization --- -// ======== MEMBER FUNCTIONS ======== -void TestThumbnailManager::initTestCase() +void TestThumbnailManager::init() { wrapper = new ThumbnailManager(); connect( wrapper, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ), this, SLOT( thumbnailReady( QPixmap , void* , int , int ))); + + wrapper_p = new ThumbnailManagerPrivate(); } -void TestThumbnailManager::cleanupTestCase() +void TestThumbnailManager::cleanup() { disconnect( wrapper, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ), this, SLOT( thumbnailReady( QPixmap , void* , int , int ))); delete wrapper; wrapper = NULL; - if( ipixmap ){ + if( ipixmap ) { delete ipixmap; ipixmap = NULL; } + + delete wrapper_p; } +// --- test --- +/** + * Simple create and destroy. + */ void TestThumbnailManager::createAndDestroy() { //empty } +/** + * Checking quality preference flag. + */ void TestThumbnailManager::qualityPreference() { QVERIFY( wrapper->setQualityPreference( ThumbnailManager::OptimizeForQuality ) ); @@ -146,6 +184,9 @@ QVERIFY( wrapper->qualityPreference() == ThumbnailManager::OptimizeForPerformance ); } +/** + * Checking thumbnail size flag. + */ void TestThumbnailManager::thumbnailSize() { QVERIFY( wrapper->setThumbnailSize( ThumbnailManager::ThumbnailSmall ) ); @@ -155,6 +196,9 @@ QVERIFY( wrapper->thumbnailSize() == QSize( 100, 100 ) ); } +/** + * Checking thumbnail mode flag. + */ void TestThumbnailManager::thumbnailMode() { QVERIFY( wrapper->setMode( ThumbnailManager::Default ) ); @@ -165,6 +209,9 @@ QVERIFY( wrapper->mode() == ThumbnailManager::CropToAspectRatio ); } +/** + * Checking thumbnail mode flag. + */ void TestThumbnailManager::getThumbnailByName() { wrapper->setMode( ThumbnailManager::CropToAspectRatio ); @@ -224,21 +271,9 @@ wrapper->deleteThumbnails( 2 ); } -void TestThumbnailManager::thumbnailReady( QPixmap /*pixmap*/, void * /*clientData*/, int /*id*/, int /*errorCode*/ ) -{ - //do nothing, we dont test Thumbnail Manager's functionality, we just use it -} - -void TestThumbnailManager::thumbnailReady_p( QPixmap pixmap, void * /*clientData*/, int id, int errorCode ) -{ - QVERIFY( pixmap.isNull() == pixmapNull ); - QVERIFY( errorCode == aerrorCode ); - QVERIFY( aid == id ); -} - void TestThumbnailManager::testThumbnailReadyError() { - ThumbnailManagerPrivate* wrapper_p = new ThumbnailManagerPrivate(); + int a=0; QVERIFY( connect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ), this, SLOT( thumbnailReady_p( QPixmap , void* , int , int )), Qt::DirectConnection ) ); @@ -252,13 +287,10 @@ disconnect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ), this, SLOT( thumbnailReady_p( QPixmap , void* , int , int ))); - delete wrapper_p; } void TestThumbnailManager::testThumbnailReadyValid() { - ThumbnailManagerPrivate* wrapper_p = new ThumbnailManagerPrivate(); - QVERIFY( connect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ), this, SLOT( thumbnailReady_p( QPixmap , void* , int , int )), Qt::DirectConnection ) ); @@ -270,7 +302,147 @@ disconnect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ), this, SLOT( thumbnailReady_p( QPixmap , void* , int , int ))); - delete wrapper_p; +} + +void TestThumbnailManager::testThumbnailReadyImage() +{ + QVERIFY( connect( wrapper_p, SIGNAL(thumbnailReady( QImage , void* , int, int ) ), + this, SLOT( thumbnailReadyImage( QImage , void* , int , int )), Qt::DirectConnection ) ); + + pixmapId = 0; + pixmapErr = 0; + pixmapDataPtr = 0; + + imageId = 432; + imageErr = KErrNone; + imageDataPtr = reinterpret_cast(0x1234); + + TestThumbnailData td = TestThumbnailData(BitmapValid); + td.clientData = imageDataPtr; + + wrapper_p->ThumbnailReady(imageErr, td, imageId); + + QVERIFY(td.bitmap!=0); + QVERIFY(td.bitmap->SizeInPixels().iWidth == TestThumbnailData::BITMAP_WIDTH); + QVERIFY(td.bitmap->SizeInPixels().iHeight == TestThumbnailData::BITMAP_HEIGHT); + + disconnect( wrapper_p, SIGNAL(thumbnailReady( QImage , void* , int, int ) ), + this, SLOT( thumbnailReadyImage(QImage, void* , int , int ))); + +} + +void TestThumbnailManager::testThumbnailReadyPixmap() +{ + QVERIFY( connect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ), + this, SLOT( thumbnailReadyPixmap( QPixmap , void* , int , int )), Qt::DirectConnection ) ); + + pixmapId = 432; + pixmapErr = -7; + pixmapDataPtr = reinterpret_cast(0x1234); + + imageId = 0; + imageErr = 0; + imageDataPtr = 0; + + TestThumbnailData td = TestThumbnailData(BitmapValid); + td.clientData = pixmapDataPtr; + + wrapper_p->ThumbnailReady(pixmapErr, td, pixmapId); + + QVERIFY(td.bitmap!=0); + QVERIFY(td.bitmap->SizeInPixels().iWidth == TestThumbnailData::BITMAP_WIDTH); + QVERIFY(td.bitmap->SizeInPixels().iHeight == TestThumbnailData::BITMAP_HEIGHT); + + disconnect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ), + this, SLOT( thumbnailReadyPixmap( QPixmap , void* , int , int ))); + +} + +void TestThumbnailManager::testThumbnailReadyImageAndPixmap() +{ + QVERIFY( connect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ), + this, SLOT( thumbnailReadyPixmap( QPixmap , void* , int , int )), Qt::DirectConnection ) ); + + QVERIFY( connect( wrapper_p, SIGNAL(thumbnailReady( QImage , void* , int, int ) ), + this, SLOT( thumbnailReadyImage( QImage , void* , int , int )), Qt::DirectConnection ) ); + + pixmapId = 432; + pixmapErr = KErrNone; + pixmapDataPtr = reinterpret_cast(0x1234); + + imageId = pixmapId; + imageErr = pixmapErr; + imageDataPtr = pixmapDataPtr; + + TestThumbnailData td = TestThumbnailData(BitmapValid); + td.clientData = pixmapDataPtr; + + wrapper_p->ThumbnailReady(pixmapErr, td, pixmapId); + + QVERIFY(td.bitmap!=0); + QVERIFY(td.bitmap->SizeInPixels().iWidth == TestThumbnailData::BITMAP_WIDTH); + QVERIFY(td.bitmap->SizeInPixels().iHeight == TestThumbnailData::BITMAP_HEIGHT); + + disconnect( wrapper_p, SIGNAL(thumbnailReady( QImage , void* , int, int ) ), + this, SLOT( thumbnailReadyImage( QImage , void* , int , int ))); + + disconnect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ), + this, SLOT( thumbnailReadyPixmap( QPixmap , void* , int , int ))); + +} + +void TestThumbnailManager::testPriorities_data() +{ + // note: current bounds for priorites are [-100:20] (from: CActive::TPriority) + + QTest::addColumn("priority"); + QTest::addColumn("expectedPriority"); + QTest::newRow("priority 0") << 0 << 0; + QTest::newRow("priority 10") << 10 << 10; + QTest::newRow("priority 20") << 20 << 20; + QTest::newRow("priority 100") << 100 << 20; + QTest::newRow("priority 200") << 200 << 20; + QTest::newRow("priority -10") << -10 << -10; + QTest::newRow("priority -100") << -100 << -100; + QTest::newRow("priority -200") << -200 << -100; +} + +void TestThumbnailManager::testPriorities() +{ + QFETCH(int, priority); + QFETCH(int, expectedPriority); + QCOMPARE(wrapper_p->convertPriority(priority), expectedPriority); +} + + +// --- private slots - callback --- + +void TestThumbnailManager::thumbnailReady( QPixmap /*pixmap*/, void * /*clientData*/, int /*id*/, int /*errorCode*/ ) +{ + //do nothing, we dont test Thumbnail Manager's functionality, we just use it +} + +void TestThumbnailManager::thumbnailReady_p( QPixmap pixmap, void * /*clientData*/, int id, int errorCode ) +{ + QVERIFY( pixmap.isNull() == pixmapNull ); + QVERIFY( errorCode == aerrorCode ); + QVERIFY( id == aid ); +} + +void TestThumbnailManager::thumbnailReadyPixmap( QPixmap pixmap, void *clientData, int id, int errorCode ) +{ + Q_UNUSED( pixmap ); + QVERIFY( errorCode == pixmapErr ); + QVERIFY( id == pixmapId ); + QVERIFY( clientData = pixmapDataPtr ); +} + +void TestThumbnailManager::thumbnailReadyImage( QImage image, void *clientData, int id, int errorCode ) +{ + Q_UNUSED( image ); + QVERIFY( errorCode == imageErr ); + QVERIFY( id == imageId ); + QVERIFY( clientData = imageDataPtr ); } #ifdef _LOG_TO_C_ diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailserver/group/thumbnailserver.mmp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/group/thumbnailserver.mmp Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/group/thumbnailserver.mmp Mon May 03 12:48:51 2010 +0300 @@ -33,10 +33,11 @@ EPOCHEAPSIZE 4096 0x3000000 // max heap 48MB #endif - CAPABILITY ALL -TCB -DRM VENDORID VID_DEFAULT +EPOCPROCESSPRIORITY background + SOURCEPATH ../src SOURCE thumbnailserver.cpp SOURCE thumbnailserversession.cpp @@ -50,6 +51,7 @@ SOURCE thumbnailcenrep.cpp SOURCE thumbnailmemorycardobserver.cpp SOURCE thumbnaildecodetask.cpp +SOURCE thumbnailfetchedchecker.cpp #ifdef RD_MDS_2_5 SOURCE thumbnailmdsquerytask.cpp #endif // RD_MDS_2_5 @@ -90,7 +92,7 @@ DEBUGLIBRARY flogger.lib -BYTEPAIRCOMPRESSTARGET -EPOCPROCESSPRIORITY background +OPTION ARMCC -O3 -OTime UNPAGED +BYTEPAIRCOMPRESSTARGET diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailfetchedchecker.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailfetchedchecker.h Mon May 03 12:48:51 2010 +0300 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: + * +*/ +#ifndef THUMBNAILFETCHEDCHECKER_H +#define THUMBNAILFETCHEDCHECKER_H + +#include + +NONSHARABLE_CLASS( CThumbnailFetchedChecker ): public CBase + { +public: + static CThumbnailFetchedChecker* NewL(); + virtual ~CThumbnailFetchedChecker(); +public: + TInt LastFetchResult( const TDesC& aUri ); + void SetFetchResult( const TDesC& aUri, TInt aError ); + void Reset(); +private: + CThumbnailFetchedChecker(); + + NONSHARABLE_CLASS( CEntry ) : public CBase + { + public: + static CEntry* NewL( const TDesC& aUri, TInt aError ); + static TInt FindCB( const TDesC* aUri, const CEntry& aEntry ); + static TInt InsertCB( const CEntry& aEntry1, const CEntry& aEntry2 ); + CEntry(); + virtual ~CEntry(); + public: + HBufC* iUri; + TInt iError; + }; + +private: + RPointerArray< CEntry > iNotFetched; +}; + +#endif // THUMBNAILFETCHEDCHECKER_H diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h Mon May 03 12:48:51 2010 +0300 @@ -45,6 +45,7 @@ class CThumbnailServerSession; class CThumbnailDiskUnmountObserver; class CThumbnailMemoryCardObserver; +class CThumbnailFetchedChecker; /** * Helper function to destroy all objects which are referred to @@ -373,6 +374,15 @@ TBool UpdateThumbnailsL( const TDesC& aPath, const TInt aOrientation, const TInt64 aModified ); + /** + * Rename thumbnails. + * + * @since S60 v5.0 + * @param aCurrentPath Current path of the Thumbnail + * @param aNewPath New path for the Thumbnail + */ + void RenameThumbnailsL( const TDesC& aCurrentPath, const TDesC& aNewPath ); + /** * Resolve mime type from file extension * @@ -451,6 +461,7 @@ TBool IsFormatting(); + inline CThumbnailFetchedChecker& FetchedChecker() const { return *iFetchedChecker; } protected: // Functions from base classes /** @@ -674,6 +685,11 @@ #ifdef _DEBUG TUint32 iPlaceholderCounter; #endif + /** + * Fetched checker. + * Own. + */ + CThumbnailFetchedChecker* iFetchedChecker; }; #endif // THUMBNAILSERVER_H diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserversession.h --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserversession.h Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserversession.h Mon May 03 12:48:51 2010 +0300 @@ -254,6 +254,14 @@ void UpdateThumbnailsL( const RMessage2& aMessage ); /** + * Rename thumbnails. + * + * @since S60 v5.0 + * @param aMessage Message. + */ + void RenameThumbnailsL( const RMessage2& aMessage ); + + /** * Checks if client thread is still alive and RMessage2 handle valid. * * @since S60 v5.0 diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailsql.h --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailsql.h Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailsql.h Mon May 03 12:48:51 2010 +0300 @@ -94,6 +94,7 @@ _LIT( KThumbnailSqlParamData, ":Data" ); _LIT( KThumbnailSqlParamFlags, ":Flags" ); _LIT( KThumbnailSqlParamPath, ":Path" ); +_LIT( KThumbnailSqlParamNewPath, ":NewPath" ); _LIT( KThumbnailSqlParamWidth, ":Width" ); _LIT( KThumbnailSqlParamHeight, ":Height" ); _LIT( KThumbnailSqlParamOriginalWidth, ":OrigWidth" ); @@ -199,6 +200,10 @@ "WHERE NOT EXISTS (SELECT Path FROM ThumbnailInfo " "WHERE ThumbnailDeleted.Path = ThumbnailInfo.Path);" ); +// rename thumb +_LIT8( KThumbnailRename, "UPDATE ThumbnailInfo SET Path = :NewPath WHERE Path = :Path;" ); +_LIT8( KThumbnailTempRename, "UPDATE TempThumbnailInfo SET Path = :NewPath WHERE Path = :Path;" ); + // reset blacklisted _LIT8( KThumbnailTouchBlacklistedRows, "UPDATE ThumbnailInfo SET Modified = 0 WHERE Flags & :Flag" ); diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailstore.h --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailstore.h Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailstore.h Mon May 03 12:48:51 2010 +0300 @@ -40,7 +40,7 @@ { enum TState { - EOpen, EError, EClosed + EOpen, EOldOpen, EError, EClosed }; public: RThumbnailTransaction( RSqlDatabase& aDatabase ); @@ -273,6 +273,15 @@ TBool aTransaction = ETrue); /** + * Rename thumbnails. + * + * @since S60 v5.0 + * @param aCurrentPath Current path of the Thumbnail + * @param aNewPath New path for the Thumbnail + */ + void RenameThumbnailsL( const TDesC& aCurrentPath, const TDesC& aNewPath ); + + /** * Persistent sizes. * * @since S60 v5.0 @@ -325,7 +334,7 @@ * * @since S60 v5.0 */ - TInt UpdateImeiL(); + void UpdateImeiL(); /** * Checks that database rowids match. @@ -625,6 +634,18 @@ RSqlStatement iStmt_KThumbnailSqlDeleteInfoByRowID; RSqlStatement iStmt_KThumbnailSqlDeleteInfoDataByRowID; RSqlStatement iStmt_KThumbnailSelectAllPaths; + RSqlStatement iStmt_KThumbnailRename; + RSqlStatement iStmt_KThumbnailTempRename; + + /** + * Dynamic batch size + */ + TInt iBatchFlushItemCount; + + /** + * Measure time spend in flush + */ + TTime iStartFlush, iStopFlush; }; // End of File diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailfetchedchecker.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailfetchedchecker.cpp Mon May 03 12:48:51 2010 +0300 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: + * +*/ + +#include "thumbnailfetchedchecker.h" + +const int KMaxStoredEntries = 100; + +// ----------------------------------------------------------------------------- +// CThumbnailFetchedChecker::CThumbnailFetchedChecker() +// ----------------------------------------------------------------------------- +// +CThumbnailFetchedChecker* CThumbnailFetchedChecker::NewL() + { + return new (ELeave) CThumbnailFetchedChecker(); + } + +// ----------------------------------------------------------------------------- +// CThumbnailFetchedChecker::CThumbnailFetchedChecker() +// ----------------------------------------------------------------------------- +// +CThumbnailFetchedChecker::CThumbnailFetchedChecker() + { + } + +// ----------------------------------------------------------------------------- +// CThumbnailFetchedChecker::~CThumbnailFetchedChecker() +// ----------------------------------------------------------------------------- +// +CThumbnailFetchedChecker::~CThumbnailFetchedChecker() + { + iNotFetched.ResetAndDestroy(); + } + +// ----------------------------------------------------------------------------- +// CThumbnailFetchedChecker::LastFetchResult() +// ----------------------------------------------------------------------------- +// +TInt CThumbnailFetchedChecker::LastFetchResult( const TDesC& aUri ) + { + TInt i = iNotFetched.FindInOrder( aUri, CEntry::FindCB ); + if ( i >= 0 && i < iNotFetched.Count() ) + { + return iNotFetched[ i ]->iError; + } + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CThumbnailFetchedChecker::SetFetchResult() +// ----------------------------------------------------------------------------- +// +void CThumbnailFetchedChecker::SetFetchResult( const TDesC& aUri, TInt aError ) + { + if ( aError == KErrNone ) + { + // Do not store successful results + TInt i = iNotFetched.FindInOrder( aUri, CEntry::FindCB ); + if ( i >= 0 && i < iNotFetched.Count() ) + { + delete iNotFetched[ i ]; + iNotFetched.Remove( i ); + } + } + else + { + // Add or update + CEntry* entry = NULL; + TRAPD( err, entry = CEntry::NewL( aUri, aError ) ); + if ( !err && entry ) + { + err = iNotFetched.Find( entry ); + if ( err != KErrNotFound ) + { + TInt i = iNotFetched.FindInOrder( aUri, CEntry::FindCB ); + if ( i >= 0 && i < iNotFetched.Count() ) + { + iNotFetched[ i ]->iError = aError; + } + } + else + { + if( iNotFetched.Count() < KMaxStoredEntries ) + { + TInt err = iNotFetched.InsertInOrder( entry, CEntry::InsertCB ); + if ( err != KErrNone ) + { + delete entry; + } + } + } + } + } + } + +// ----------------------------------------------------------------------------- +// CThumbnailFetchedChecker::Reset() +// ----------------------------------------------------------------------------- +// +void CThumbnailFetchedChecker::Reset() + { + iNotFetched.ResetAndDestroy(); + } + +// ----------------------------------------------------------------------------- +// CThumbnailFetchedChecker::CEntry::New() +// ----------------------------------------------------------------------------- +// +CThumbnailFetchedChecker::CEntry* CThumbnailFetchedChecker::CEntry::NewL( + const TDesC& aUri, TInt aError ) + { + CEntry* self = new (ELeave) CEntry(); + if ( self ) + { + self->iUri = aUri.Alloc(); + self->iError = aError; + if ( !self->iUri ) + { + delete self; + self = NULL; + } + } + return self; + } + +// ----------------------------------------------------------------------------- +// CThumbnailFetchedChecker::CEntry::FindCB() +// ----------------------------------------------------------------------------- +// +TInt CThumbnailFetchedChecker::CEntry::FindCB( + const TDesC* aUri, const CThumbnailFetchedChecker::CEntry& aEntry ) + { + return aUri->CompareF( *( aEntry.iUri ) ); + } + +// ----------------------------------------------------------------------------- +// CThumbnailFetchedChecker::CEntry::InsertCB() +// ----------------------------------------------------------------------------- +// +TInt CThumbnailFetchedChecker::CEntry::InsertCB( + const CThumbnailFetchedChecker::CEntry& aEntry1, + const CThumbnailFetchedChecker::CEntry& aEntry2 ) + { + return aEntry1.iUri->CompareF( *( aEntry2.iUri ) ); + } + +// ----------------------------------------------------------------------------- +// CThumbnailFetchedChecker::CEntry::CEntry() +// ----------------------------------------------------------------------------- +// +CThumbnailFetchedChecker::CEntry::CEntry() + { + } + +// ----------------------------------------------------------------------------- +// CThumbnailFetchedChecker::CEntry::~CEntry() +// ----------------------------------------------------------------------------- +// +CThumbnailFetchedChecker::CEntry::~CEntry() + { + delete iUri; + } diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp Mon May 03 12:48:51 2010 +0300 @@ -36,6 +36,7 @@ #include "thumbnailcenrep.h" #include "thumbnailmemorycardobserver.h" #include "tmgetimei.h" +#include "thumbnailfetchedchecker.h" _LIT8( KThumbnailMimeWildCard, "*" ); @@ -73,7 +74,7 @@ ERequestThumbByBufferAsync, ERequestSetThumbnailByBuffer, EDeleteThumbnailsById, - EReserved1, + ERenameThumbnails, EUpdateThumbnails, ERequestSetThumbnailByBitmap, EThumbnailServerRequestCount, @@ -96,7 +97,7 @@ CPolicyServer::ECustomCheck, // ERequestThumbByBufferAsync CPolicyServer::ECustomCheck, // ERequestSetThumbnailByBuffer CPolicyServer::ECustomCheck, // EDeleteThumbnailsById - CPolicyServer::ECustomCheck, + CPolicyServer::ECustomCheck, // ERenameThumbnails CPolicyServer::ECustomCheck, // EUpdateThumbnails CPolicyServer::ECustomCheck, // ERequestSetThumbnailByBitmap CPolicyServer::ECustomCheck, // EThumbnailServerRequestCount @@ -142,7 +143,8 @@ case EGetMimeTypeList: case ERequestSetThumbnailByBuffer: case EDeleteThumbnailsById: - case EUpdateThumbnails: + case EUpdateThumbnails: + case ERenameThumbnails: case ERequestSetThumbnailByBitmap: { if( aMsg.HasCapability( ECapabilityReadDeviceData ) && @@ -152,8 +154,6 @@ } break; } - - case EReserved1: case EThumbnailServerRequestCount: default: { @@ -254,6 +254,7 @@ //OpenStoresL(); AddUnmountObserversL(); + iFetchedChecker = CThumbnailFetchedChecker::NewL(); } @@ -267,6 +268,7 @@ iShutdown = ETrue; + delete iFetchedChecker; delete iShutdownObserver; delete iProcessor; @@ -536,6 +538,10 @@ { TN_DEBUG1( "CThumbnailServer::StoreThumbnailL() - file doesn't exists anymore, skip store!"); } + if( iFetchedChecker ) + { + iFetchedChecker->SetFetchResult( aPath, KErrNone ); + } } @@ -547,8 +553,23 @@ aThumbnail, TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aOriginalSize ) { TN_DEBUG3( "CThumbnailServer::FetchThumbnailL(aPath=%S aThumbnailSize=%d)", &aPath, aThumbnailSize ); - - StoreForPathL( aPath )->FetchThumbnailL( aPath, aThumbnail, aData, aThumbnailSize, aOriginalSize); + if( iFetchedChecker ) + { + TInt err( iFetchedChecker->LastFetchResult( aPath ) ); + if ( err == KErrNone ) // To avoid useless sql gets that fails for sure + { + TRAP( err, StoreForPathL( aPath )->FetchThumbnailL( aPath, aThumbnail, aData, aThumbnailSize, aOriginalSize) ); + if ( err != KErrNone ) + { + iFetchedChecker->SetFetchResult( aPath, err ); + } + } + User::LeaveIfError( err ); + } + else + { + StoreForPathL( aPath )->FetchThumbnailL( aPath, aThumbnail, aData, aThumbnailSize, aOriginalSize); + } } @@ -600,6 +621,11 @@ TN_DEBUG2( "CThumbnailServer::DeleteThumbnailsL(%S)", &aPath); StoreForPathL( aPath )->DeleteThumbnailsL( aPath ); + + if( iFetchedChecker ) + { + iFetchedChecker->SetFetchResult( aPath, KErrNone ); + } } // ----------------------------------------------------------------------------- @@ -911,16 +937,14 @@ // CThumbnailStore::PersistentSizeL() // --------------------------------------------------------------------------- // -TThumbnailPersistentSize & CThumbnailServer::PersistentSizeL( TThumbnailSize - aThumbnailSize ) +TThumbnailPersistentSize & CThumbnailServer::PersistentSizeL( TThumbnailSize aThumbnailSize ) { if ( !iCenrep ) - { - iCenrep = CThumbnailCenRep::NewL(); - } + { + iCenrep = CThumbnailCenRep::NewL(); + } - return iCenrep->PersistentSizeL( aThumbnailSize ); - + return iCenrep->PersistentSizeL( aThumbnailSize ); } // ----------------------------------------------------------------------------- @@ -1175,6 +1199,11 @@ // delete old thumbs store->DeleteThumbnailsL(aPath, ETrue); + if( iFetchedChecker ) + { + iFetchedChecker->SetFetchResult( aPath, KErrNone ); + } + // need to create new thumbs } else @@ -1193,6 +1222,23 @@ } // ----------------------------------------------------------------------------- +// Renames thumbnails. +// ----------------------------------------------------------------------------- +// +void CThumbnailServer::RenameThumbnailsL( const TDesC& aCurrentPath, const TDesC& aNewPath ) + { + TN_DEBUG2( "CThumbnailServer::RenameThumbnailsL(%S)", &aCurrentPath); + + StoreForPathL( aCurrentPath )->RenameThumbnailsL( aCurrentPath, aNewPath ); + + if( iFetchedChecker ) + { + iFetchedChecker->SetFetchResult( aNewPath, iFetchedChecker->LastFetchResult(aCurrentPath) ); + iFetchedChecker->SetFetchResult( aCurrentPath, KErrNone ); + } + } + +// ----------------------------------------------------------------------------- // CThumbnailServer::MimeTypeFromFileExt() // ----------------------------------------------------------------------------- // diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp Mon May 03 12:48:51 2010 +0300 @@ -133,7 +133,12 @@ { UpdateThumbnailsL( aMessage ); break; - } + } + case ERenameThumbnails: + { + RenameThumbnailsL( aMessage ); + break; + } default: { err = KErrUnknown; @@ -338,6 +343,38 @@ } // ----------------------------------------------------------------------------- +// CThumbnailServerSession::RenameThumbnailsL() +// Rename thumbnails. +// ----------------------------------------------------------------------------- +// +void CThumbnailServerSession::RenameThumbnailsL( const RMessage2& aMessage ) + { + if(aMessage.Int1() != KCheckValue) + { + TN_DEBUG1( "CThumbnailServerSession::RenameThumbnailsL() - error in aMessage - leaving" ); + User::Leave(KErrArgument); + } + + // read message params + aMessage.ReadL( 0, iRequestParams ); + const TThumbnailRequestParams& params = iRequestParams(); + + // renaming only inside one store + if (params.iFileName.Left(1).CompareF( params.iTargetUri.Left(1) ) == 0) + { + Server()->RenameThumbnailsL( params.iFileName, params.iTargetUri ); + + aMessage.Complete( KErrNone ); + } + else + { + aMessage.Complete( KErrNotSupported ); + } + + iMessage = RMessage2(); + } + +// ----------------------------------------------------------------------------- // CThumbnailServerSession::RequestThumbByIdAsyncL() // ----------------------------------------------------------------------------- // @@ -615,9 +652,14 @@ { TInt sourceType = TThumbnailPersistentSize::EUnknownSourceType; TDataType mimetype; - Server()->MimeTypeFromFileExt( params.iTargetUri, mimetype ); - sourceType = Server()->SourceTypeFromMimeType( mimetype ); - ModifyThumbnailSize(sourceType); + TInt ret = Server()->MimeTypeFromFileExt( params.iTargetUri, mimetype ); + + if( ret == KErrNone ) + { + sourceType = Server()->SourceTypeFromMimeType( mimetype ); + ModifyThumbnailSize(sourceType); + } + User::LeaveIfError( ret ); } TInt bufferSize = aMessage.Int2(); diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp Mon May 03 12:48:51 2010 +0300 @@ -44,7 +44,7 @@ const TInt KStoreUnrecoverableErr = KErrCorrupt; // Database path without drive letter -_LIT( KThumbnailDatabaseName, ":[102830AB]thumbnail_v3.db" ); +_LIT( KThumbnailDatabaseName, ":[102830AB]thumbnail_v5.db" ); _LIT( KDrv, ":"); @@ -68,7 +68,18 @@ // --------------------------------------------------------------------------- // void RThumbnailTransaction::BeginL() - { + { + if (iDatabase.InTransaction()) + { + TN_DEBUG1( "RThumbnailTransaction::BeginL() - error: old transaction open!" ); + __ASSERT_DEBUG(( !iDatabase.InTransaction() ), ThumbnailPanic( EThumbnailSQLTransaction )); + + // old transaction already open, don't open another + iState = EOldOpen; + + return; + } + const TInt err = iDatabase.Exec( KThumbnailBeginTransaction ); if ( err >= 0 ) { @@ -91,7 +102,7 @@ // void RThumbnailTransaction::Close() { - if ( iState != EClosed ) + if ( iState != EClosed && iState != EOldOpen ) { Rollback(); } @@ -103,13 +114,16 @@ // void RThumbnailTransaction::CommitL() { - TInt ret = iDatabase.Exec( KThumbnailCommitTransaction ); + if ( iState != EOldOpen ) + { + TInt ret = iDatabase.Exec( KThumbnailCommitTransaction ); #ifdef _DEBUG TPtrC errorMsg = iDatabase.LastErrorMessage(); TN_DEBUG3( "RThumbnailTransaction::CommitL() lastError %S, ret = %d" , &errorMsg, ret); #endif User::LeaveIfError( ret ); + } iState = EClosed; } @@ -120,12 +134,20 @@ // TInt RThumbnailTransaction::Rollback() { - const TInt err = iDatabase.Exec( KThumbnailRollbackTransaction ); - if ( err >= 0 ) + if ( iState != EOldOpen ) { - iState = EClosed; + const TInt err = iDatabase.Exec( KThumbnailRollbackTransaction ); + if ( err >= 0 ) + { + iState = EClosed; + } + + return err; } - return err; + + iState = EClosed; + + return KErrNone; } @@ -167,10 +189,6 @@ iDiskFullNotifier = NULL; } - if(!iServer->IsFormatting()) - { - FlushCacheTable( ETrue ); - } if( iAutoFlushTimer ) { iAutoFlushTimer->Cancel(); @@ -178,6 +196,18 @@ iAutoFlushTimer = NULL; } + if( iMaintenanceTimer ) + { + iMaintenanceTimer->Cancel(); + delete iMaintenanceTimer; + iMaintenanceTimer = NULL; + } + + if(!iServer->IsFormatting()) + { + FlushCacheTable( ETrue ); + } + CloseStatements(); iDatabase.Close(); @@ -191,7 +221,7 @@ // CThumbnailStore::CThumbnailStore( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer ): iFs( aFs ), iDrive( aDrive ), iDriveChar( 0 ), iBatchItemCount(0), iImei(aImei), - iServer(aServer), iDiskFull(EFalse), iUnrecoverable(ETrue) + iServer(aServer), iDiskFull(EFalse), iUnrecoverable(ETrue), iBatchFlushItemCount(KMInBatchItems) { // no implementation required } @@ -293,18 +323,16 @@ checkError = CheckRowIDs(); } } - else + + // if db file not found, wrong version, corrupted database or other error opening db + if ( err != KErrNone || checkError == KErrNotSupported ) { - // if db file not found, wrong version, corrupted database or other error opening db - if ( checkError == KErrNotSupported || err != KErrNone ) - { - CleanupClosePushL(iDatabase); - RecreateDatabaseL(ETrue); - CleanupStack::Pop(&iDatabase); - - aNewDatabase = ETrue; - } - } + CleanupClosePushL(iDatabase); + RecreateDatabaseL(ETrue); + CleanupStack::Pop(&iDatabase); + + aNewDatabase = ETrue; + } } // opened existing database file @@ -319,7 +347,7 @@ if(imeiError != KErrNone) { //take ownership - imeiError = UpdateImeiL(); + TRAP(imeiError, UpdateImeiL() ); //Touch blacklisted items TRAP(blistError, PrepareBlacklistedItemsForRetryL() ); @@ -332,9 +360,7 @@ TRAP(blistError2, PrepareBlacklistedItemsForRetryL() ); } - if(imeiError == KSqlErrCorrupt || imeiError == KErrCorrupt || - blistError == KSqlErrCorrupt || blistError == KErrCorrupt || - blistError2 == KSqlErrCorrupt || blistError2 == KErrCorrupt ) + if(imeiError != KErrNone || blistError != KErrNone || blistError2 != KErrNone ) { CleanupClosePushL(iDatabase); RecreateDatabaseL(ETrue); @@ -745,31 +771,30 @@ // UpdateImeiL() // ----------------------------------------------------------------------------- // -TInt CThumbnailStore::UpdateImeiL() +void CThumbnailStore::UpdateImeiL() { TN_DEBUG1( "CThumbnailStore::UpdateImeiL()" ); RSqlStatement stmt; CleanupClosePushL( stmt ); - TInt ret = stmt.Prepare( iDatabase, KThumbnailUpdateIMEI ); + User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailUpdateIMEI ) ); TInt paramIndex = stmt.ParameterIndex( KThumbnailSqlParamImei ); User::LeaveIfError( paramIndex ); User::LeaveIfError( stmt.BindText( paramIndex, iImei )); - TInt err = stmt.Exec(); + TInt err = stmt.Exec(); if(err < 0) { #ifdef _DEBUG - TPtrC errorMsg2 = iDatabase.LastErrorMessage(); - TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2); + TPtrC errorMsg = iDatabase.LastErrorMessage(); + TN_DEBUG2( "RThumbnailTransaction::UpdateImeiL() lastError %S" , &errorMsg); #endif - return ret; + User::Leave(err); } CleanupStack::PopAndDestroy( &stmt ); - return KErrNone; } // --------------------------------------------------------------------------- @@ -961,6 +986,22 @@ #endif User::LeaveIfError( err ); + err = iStmt_KThumbnailRename.Prepare( iDatabase, KThumbnailRename ); +#ifdef _DEBUG + msg.Append( iDatabase.LastErrorMessage() ); + TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailRename %S" , &msg ); + msg.Zero(); +#endif + User::LeaveIfError( err ); + + err = iStmt_KThumbnailTempRename.Prepare( iDatabase, KThumbnailTempRename ); +#ifdef _DEBUG + msg.Append( iDatabase.LastErrorMessage() ); + TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailTempRename %S" , &msg ); + msg.Zero(); +#endif + User::LeaveIfError( err ); + TN_DEBUG1("CThumbnailStore::PrepareStatementsL() end"); } @@ -1005,6 +1046,8 @@ iStmt_KThumbnailSqlDeleteInfoByRowID.Close(); iStmt_KThumbnailSqlDeleteInfoDataByRowID.Close(); iStmt_KThumbnailSelectAllPaths.Close(); + iStmt_KThumbnailRename.Close(); + iStmt_KThumbnailTempRename.Close(); TN_DEBUG1("CThumbnailStore::CloseStatements() end"); } @@ -1347,10 +1390,11 @@ found = ETrue; } + CleanupStack::PopAndDestroy( stmt ); + // check if duplicate in Deleted if (found) { - CleanupStack::PopAndDestroy( stmt ); stmt = &iStmt_KThumbnailSqlFindDeleted; CleanupStack::PushL(TCleanupItem(ResetStatement, stmt)); @@ -1360,6 +1404,8 @@ rowStatus = stmt->Next(); + CleanupStack::PopAndDestroy( stmt ); + if(rowStatus == KSqlAtRow) { TN_DEBUG1( "CThumbnailStore::FindDuplicateL() - duplicate marked deleted" ); @@ -1372,8 +1418,6 @@ } } - CleanupStack::PopAndDestroy( stmt ); - return found; } @@ -1695,10 +1739,10 @@ rowStatus = stmt->Next(); } - CleanupStack::PopAndDestroy( stmt ); + CleanupStack::PopAndDestroy( stmt_infodata ); CleanupStack::PopAndDestroy( stmt_info ); - CleanupStack::PopAndDestroy( stmt_infodata ); - + CleanupStack::PopAndDestroy( stmt ); + // if forcing instant delete if (aForce) { @@ -1744,9 +1788,15 @@ CleanupStack::PopAndDestroy( stmt_infodata ); CleanupStack::PopAndDestroy( stmt_info ); + CleanupStack::PopAndDestroy( stmt ); + + //remove delete mark + User::LeaveIfError( iDatabase.Exec( KThumbnailSqlDeleteFromDeleted ) ); } else { + TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- add to Deleted" ); + // only add path to deleted table stmt = &iStmt_KThumbnailSqlInsertDeleted; CleanupStack::PushL(TCleanupItem(ResetStatement, stmt)); @@ -1756,9 +1806,9 @@ User::LeaveIfError( stmt->BindText( paramIndex, *path )); count = stmt->Exec(); - } - - CleanupStack::PopAndDestroy( stmt ); + + CleanupStack::PopAndDestroy( stmt ); + } if (aTransaction) { @@ -1783,6 +1833,84 @@ CleanupStack::PopAndDestroy( path ); } +// ----------------------------------------------------------------------------- +// Rename thumbnails +// ----------------------------------------------------------------------------- +// +void CThumbnailStore::RenameThumbnailsL( const TDesC& aCurrentPath, const TDesC& aNewPath ) + { + TN_DEBUG2( "CThumbnailStore::RenameThumbnailsL(%S)", &aCurrentPath ); + +#ifdef _DEBUG + TTime aStart, aStop; + aStart.UniversalTime(); +#endif + + User::LeaveIfError( CheckDbState() ); + + TInt paramIndex = 0; + + HBufC* path = aCurrentPath.AllocLC(); + TPtr ptr(path->Des()); + StripDriveLetterL( ptr ); + + HBufC* newPath = aNewPath.AllocLC(); + TPtr ptr2(newPath->Des()); + StripDriveLetterL( ptr2 ); + + RThumbnailTransaction transaction( iDatabase ); + CleanupClosePushL( transaction ); + transaction.BeginL(); + + TN_DEBUG1( "CThumbnailStore::RenameThumbnailsL() -- TEMP TABLE" ); + + RSqlStatement* stmt = NULL; + stmt = &iStmt_KThumbnailTempRename; + CleanupStack::PushL(TCleanupItem(ResetStatement, stmt)); + + paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath ); + User::LeaveIfError( paramIndex ); + User::LeaveIfError( stmt->BindText( paramIndex, *path )); + + paramIndex = stmt->ParameterIndex( KThumbnailSqlParamNewPath ); + User::LeaveIfError( paramIndex ); + User::LeaveIfError( stmt->BindText( paramIndex, *newPath )); + + User::LeaveIfError( stmt->Exec() ); + + TN_DEBUG1( "CThumbnailStore::RenameThumbnailsL() -- MAIN TABLE" ); + + CleanupStack::PopAndDestroy( stmt ); + stmt = &iStmt_KThumbnailRename; + CleanupStack::PushL(TCleanupItem(ResetStatement, stmt)); + + paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath ); + User::LeaveIfError( paramIndex ); + User::LeaveIfError( stmt->BindText( paramIndex, *path )); + + paramIndex = stmt->ParameterIndex( KThumbnailSqlParamNewPath ); + User::LeaveIfError( paramIndex ); + User::LeaveIfError( stmt->BindText( paramIndex, *newPath )); + + User::LeaveIfError( stmt->Exec() ); + + CleanupStack::PopAndDestroy( stmt ); + + // if thumb was for some reason already marked deleted, clean from deleted + User::LeaveIfError( iDatabase.Exec( KThumbnailSqlDeleteFromDeleted ) ); + + transaction.CommitL(); + CleanupStack::PopAndDestroy( &transaction ); + + CleanupStack::PopAndDestroy( newPath ); + CleanupStack::PopAndDestroy( path ); + +#ifdef _DEBUG + aStop.UniversalTime(); + TN_DEBUG2( "CThumbnailStore::RenameThumbnailsL() took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000); +#endif + } + // --------------------------------------------------------------------------- // CThumbnailStore::PersistentSizes() // --------------------------------------------------------------------------- @@ -1808,17 +1936,30 @@ return; } - if(iBatchItemCount < KMaxBatchItems && !aForce) + // fixed batch size if MTP sync on + TInt MPXHarvesting(0); + TInt ret = RProperty::Get(KTAGDPSNotification, KMPXHarvesting, MPXHarvesting); + if(ret != KErrNone) + { + TN_DEBUG2( "CThumbnailStore::FlushCacheTable() error checking MTP sync: %d", ret); + } + + if(MPXHarvesting && iBatchItemCount < KMaxBatchItemsMTP && !aForce) + { + TN_DEBUG1("CThumbnailStore::FlushCacheTable() MTP sync, fixed batch..."); + + //some items in cache + StartAutoFlush(); + return; + } + else if(!MPXHarvesting && iBatchItemCount < iBatchFlushItemCount && !aForce) { //some items in cache StartAutoFlush(); return; - } + } -#ifdef _DEBUG - TTime aStart, aStop; - aStart.UniversalTime(); -#endif + iStartFlush.UniversalTime(); // Move data from temp table to main.... TInt err_begin = iDatabase.Exec( KThumbnailBeginTransaction ); @@ -1871,16 +2012,31 @@ // open new TRAP_IGNORE(OpenDatabaseL(ETrue)); } + + iStopFlush.UniversalTime(); + TInt aFlushDelay = (TInt)iStopFlush.MicroSecondsFrom(iStartFlush).Int64()/1000; + + TN_DEBUG2( "CThumbnailStore::FlushCacheTable() took %d ms", aFlushDelay); + + //adjust batch size dynamically between min and max based on read flush speed + if (!MPXHarvesting) + { + //increase batch count if there room for one more item (based on average time per item) + if( aFlushDelay < KMaxFlushDelay && iBatchFlushItemCount < KMaxBatchItems ) + { + iBatchFlushItemCount++; + } + //decrease batch count if we exeeced max time allowed in flushing the TEMP table + else if(aFlushDelay > KMaxFlushDelay && iBatchFlushItemCount > KMInBatchItems ) + { + iBatchFlushItemCount--; + } + } //cache flushed iBatchItemCount = 0; - -#ifdef _DEBUG - aStop.UniversalTime(); - TN_DEBUG2( "CThumbnailStore::FlushCacheTable() took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000); -#endif - TN_DEBUG1("CThumbnailStore::FlushCacheTable() out"); + TN_DEBUG2("CThumbnailStore::FlushCacheTable() out iBatchFlushItemCount = %d", iBatchFlushItemCount); } // ----------------------------------------------------------------------------- @@ -2047,7 +2203,7 @@ { self->StartMaintenance(); } - else + else if (!self->iDeleteThumbs && !self->iCheckFilesExist) { // no need to monitor activity anymore self->iActivityManager->Cancel(); diff -r 7197e789b953 -r ffa62e555b02 imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp --- a/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp Fri Apr 16 15:16:16 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp Mon May 03 12:48:51 2010 +0300 @@ -66,6 +66,7 @@ { TN_DEBUG1( "CTMActivityManager::ConstructL()"); iTimer.CreateLocal(); + iWatch = ENone; } // --------------------------------------------------------------------------- @@ -112,8 +113,6 @@ { TN_DEBUG1( "CTMActivityManager::Start()"); - iFirstRound = ETrue; - #ifdef MONITOR_LIGHTS if(!iLight) { @@ -121,11 +120,16 @@ } #endif - if( !IsActive() ) + if ( iWatch == ENone ) { - SetActive(); - TRequestStatus* statusPtr = &iStatus; - User::RequestComplete( statusPtr, KErrNone ); + iFirstRound = ETrue; + + if( !IsActive() ) + { + SetActive(); + TRequestStatus* statusPtr = &iStatus; + User::RequestComplete( statusPtr, KErrNone ); + } } } @@ -161,12 +165,12 @@ TN_DEBUG1( "CTMActivityManager::RunL() inactive"); NotifyObserver(); - if (!IsActive()) //observer might have called a Reset() - { - iTimer.Inactivity(iStatus,0); - iWatch = EWaitingForActivity; + if (!IsActive()) //observer might have called a Reset() + { + iTimer.Inactivity(iStatus,0); + iWatch = EWaitingForActivity; + } } - } else { iTimer.Inactivity(iStatus,iTimeout); @@ -174,8 +178,8 @@ } else if (iWatch == EWaitingForActivity) { - TN_DEBUG1( "CTMActivityManager::RunL() active"); - NotifyObserver(); + TN_DEBUG1( "CTMActivityManager::RunL() active"); + NotifyObserver(); if (!IsActive()) //observer might have called a Reset() {