--- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h Fri Feb 19 23:07:36 2010 +0200
@@ -71,6 +71,9 @@
//Store's auto flush timeout
const TInt KAutoFlushTimeout = 30000000; //30 sec
+// minimum background generation idle time seconds
+const TInt KBackgroundGenerationIdle = 2;
+
// video decoder timeout
const TInt KVideoDecoderTimeout = 5000000; // 5 seconds
--- a/imagehandlingutilities/thumbnailmanager/plugins/audio/inc/thumbnailimagedecoderv3.h Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/plugins/audio/inc/thumbnailimagedecoderv3.h Fri Feb 19 23:07:36 2010 +0200
@@ -85,6 +85,13 @@
* @return Size of original image.
*/
const TSize& OriginalSize()const;
+
+ /**
+ * Leave if image is corrupt
+ *
+ * @since S60 v5.0
+ */
+ void LeaveIfCorruptL(const TInt aError );
private:
/**
--- a/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailaudioprovider.cpp Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailaudioprovider.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -139,7 +139,7 @@
//
void CThumbnailAudioProvider::GetThumbnailL( RFs& /* aFs */, TDesC8& /*aBuffer */)
{
-
+ User::Leave( KErrNotSupported );
}
// ---------------------------------------------------------------------------
--- a/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailimagedecoderv3.cpp Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailimagedecoderv3.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -198,18 +198,25 @@
iDecoder = NULL;
CImageDecoder::TOptions options = ( CImageDecoder::TOptions )(
- CImageDecoder::EOptionNoDither | CImageDecoder::EPreferFastDecode );
+ CImageDecoder::EOptionNoDither | CImageDecoder::EPreferFastDecode | CImageDecoder::EOptionAlwaysThread );
TRAPD( decErr, iDecoder = CExtJpegDecoder::DataNewL(
CExtJpegDecoder::EHwImplementation, iFs, *iBuffer, options ));
if ( decErr != KErrNone )
{
+ TN_DEBUG2( "CThumbnailImageDecoderv3::CreateDecoderL() - HW CExtJpegDecoder failed %d", decErr);
+
+ LeaveIfCorruptL( decErr );
+
TRAP( decErr, iDecoder = CExtJpegDecoder::DataNewL(
CExtJpegDecoder::ESwImplementation, iFs, *iBuffer, options ));
if ( decErr != KErrNone )
- {
+ {
+ TN_DEBUG2( "CThumbnailImageDecoderv3::CreateDecoderL() - SW CExtJpegDecoder failed %d", decErr);
+
+ LeaveIfCorruptL( decErr );
// don't force any mime type
TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options ) );
if ( decErr != KErrNone )
@@ -217,7 +224,7 @@
delete iBuffer;
iBuffer = NULL;
- TN_DEBUG1( "CThumbnailImageDecoderv3::CreateDecoderL() - error" );
+ TN_DEBUG2( "CThumbnailImageDecoderv3::CreateDecoderL() - CImageDecoder error %d", decErr );
User::Leave( decErr );
}
@@ -246,4 +253,18 @@
return iOriginalSize;
}
+// -----------------------------------------------------------------------------
+// CThumbnailImageDecoder3::LeaveIfCorruptL()
+// Leave is image is corrupted
+// -----------------------------------------------------------------------------
+//
+void CThumbnailImageDecoderv3::LeaveIfCorruptL(const TInt aError )
+ {
+ //no sense to try other codecs if image is corrupted
+ if( aError == KErrCorrupt || aError == KErrUnderflow)
+ {
+ User::Leave( aError );
+ }
+ }
+
//End of file
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/inc/thumbnailimagedecoder.h Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/plugins/image/inc/thumbnailimagedecoder.h Fri Feb 19 23:07:36 2010 +0200
@@ -102,6 +102,13 @@
* @return Size of original image.
*/
const TSize& OriginalSize()const;
+
+ /**
+ * Leave if image is corrupt
+ *
+ * @since S60 v5.0
+ */
+ void LeaveIfCorruptL(const TInt aError );
private:
/**
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/inc/thumbnailimagedecoderv2.h Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/plugins/image/inc/thumbnailimagedecoderv2.h Fri Feb 19 23:07:36 2010 +0200
@@ -96,6 +96,13 @@
* @since S60 v5.0
*/
void CreateDecoderL();
+
+ /**
+ * Leave if image is corrupt
+ *
+ * @since S60 v5.0
+ */
+ void LeaveIfCorruptL(const TInt aError );
private:
// data
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -338,7 +338,7 @@
// If the image is in jpeg format, try to get thumbnail from EXIF data (if EOptimizeForQuality not set)
if ( IsJpeg() && !( aFlags == CThumbnailManager::EOptimizeForQuality ))
{
- TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() crete exif decoder" );
+ TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() create exif decoder" );
TRAPD( err, CreateExifDecoderL( aFlags ));
thumbFound = ( err == KErrNone );
iEXIF = ETrue;
@@ -347,7 +347,7 @@
if ( !thumbFound )
{
iEXIF = EFalse;
- TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() crete normal decoder" );
+ TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() create normal decoder" );
delete iDecoder;
iDecoder = NULL;
@@ -362,12 +362,12 @@
if ( aFlags == CThumbnailManager::EOptimizeForQuality )
{
options = ( CImageDecoder::TOptions )( CImageDecoder
- ::EOptionNoDither );
+ ::EOptionNoDither | CImageDecoder::EOptionAlwaysThread );
}
else
{
- options = ( CImageDecoder::TOptions )( CImageDecoder
- ::EOptionNoDither | CImageDecoder::EPreferFastDecode );
+ options = ( CImageDecoder::TOptions )( CImageDecoder
+ ::EOptionNoDither | CImageDecoder::EPreferFastDecode | CImageDecoder::EOptionAlwaysThread );
}
if ( IsSvg())
@@ -407,11 +407,15 @@
if ( decErr != KErrNone )
{
+ TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder error %d", decErr );
+ LeaveIfCorruptL(decErr);
+
// don't force any mime type
TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options ) );
+
if ( decErr != KErrNone )
{
- TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - error 2" );
+ TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder no mime error %d", decErr );
User::Leave( decErr );
}
@@ -422,7 +426,6 @@
}
else
{
-
if ( !iBuffer )
{
TRAPD( decErr, iDecoder = CExtJpegDecoder::FileNewL(
@@ -430,12 +433,24 @@
if ( decErr != KErrNone )
{
+ TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - HW CExtJpegDecoder failed %d", decErr);
+ LeaveIfCorruptL(decErr);
+
TRAP( decErr, iDecoder = CExtJpegDecoder::FileNewL(
CExtJpegDecoder::ESwImplementation, iFs, fullName, options) );
if ( decErr != KErrNone )
{
- iDecoder = CImageDecoder::FileNewL( iFile, ContentAccess::EPeek, options );
+ TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - SW CExtJpegDecoder failed %d", decErr);
+ LeaveIfCorruptL(decErr);
+
+ TRAP( decErr, iDecoder = CImageDecoder::FileNewL( iFile, ContentAccess::EPeek, options ));
+
+ if( decErr != KErrNone)
+ {
+ TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder failed %d", decErr);
+ User::Leave( decErr );
+ }
TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder created" );
}
@@ -456,21 +471,28 @@
if ( decErr != KErrNone )
{
+ TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - HW CExtJpegDecoder failed %d", decErr);
+ LeaveIfCorruptL(decErr);
+
TRAP( decErr, iDecoder = CExtJpegDecoder::DataNewL(
CExtJpegDecoder::ESwImplementation, iFs, *iBuffer, options ));
if ( decErr != KErrNone )
- {
+ {
+ TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - SW CExtJpegDecoder failed %d", decErr);
+ LeaveIfCorruptL(decErr);
TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, iMimeType.Des8(), options) );
if ( decErr != KErrNone )
{
+ TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder failed %d", decErr);
+ LeaveIfCorruptL(decErr);
// don't force any mime type
TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options ) );
+
if ( decErr != KErrNone )
{
- TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - error 3" );
-
+ TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder no mime failed %d", decErr);
User::Leave( decErr );
}
}
@@ -540,12 +562,12 @@
CImageDecoder::TOptions options;
if ( aFlags == CThumbnailManager::EOptimizeForQuality )
{
- options = ( CImageDecoder::TOptions )( CImageDecoder::EOptionNoDither );
+ options = ( CImageDecoder::TOptions )( CImageDecoder::EOptionNoDither | CImageDecoder::EOptionAlwaysThread );
}
else
{
options = ( CImageDecoder::TOptions )( CImageDecoder::EOptionNoDither |
- CImageDecoder::EPreferFastDecode );
+ CImageDecoder::EPreferFastDecode | CImageDecoder::EOptionAlwaysThread );
}
TRAPD( err, iDecoder = CExtJpegDecoder::DataNewL( iFs, * iExifThumbImage,
@@ -588,4 +610,18 @@
return iOriginalSize;
}
+// -----------------------------------------------------------------------------
+// CThumbnailImageDecoder::LeaveIfCorruptL()
+// Leave is image is corrupted
+// -----------------------------------------------------------------------------
+//
+void CThumbnailImageDecoder::LeaveIfCorruptL(const TInt aError )
+ {
+ //no sense to try other codecs if image is corrupted
+ if( aError == KErrCorrupt || aError == KErrUnderflow)
+ {
+ User::Leave( aError );
+ }
+ }
+
//End of file
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoderv2.cpp Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoderv2.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -155,28 +155,34 @@
iDecoder = NULL;
CImageDecoder::TOptions options = ( CImageDecoder::TOptions )(
- CImageDecoder::EOptionNoDither | CImageDecoder::EPreferFastDecode );
+ CImageDecoder::EOptionNoDither | CImageDecoder::EPreferFastDecode | CImageDecoder::EOptionAlwaysThread );
TRAPD( decErr, iDecoder = CExtJpegDecoder::DataNewL(
CExtJpegDecoder::EHwImplementation, iFs, *iBuffer, options ));
if ( decErr != KErrNone )
{
+ TN_DEBUG2( "CThumbnailImageDecoderv2::CreateDecoderL() - HW CExtJpegDecoder failed = %d", decErr );
TRAP( decErr, iDecoder = CExtJpegDecoder::DataNewL(
CExtJpegDecoder::ESwImplementation, iFs, *iBuffer, options ));
if ( decErr != KErrNone )
{
+ TN_DEBUG2( "CThumbnailImageDecoderv2::CreateDecoderL() - SW CExtJpegDecoder failed %d", decErr);
+ LeaveIfCorruptL( decErr );
+
TRAP( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, KJpegMime(), options ) );
if ( decErr != KErrNone )
- {
+ {
+ TN_DEBUG2( "CThumbnailImageDecoderv2::CreateDecoderL() - CImageDecoder failed %d", decErr);
+ LeaveIfCorruptL( decErr );
+
// don't force any mime type
TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options ) );
if ( decErr != KErrNone )
{
- TN_DEBUG1( "CThumbnailImageDecoderv2::CreateDecoderL() - error" );
-
+ TN_DEBUG2( "CThumbnailImageDecoderv2::CImageDecoder() - CImageDecoder no mime error %d", decErr );
User::Leave( decErr );
}
}
@@ -196,4 +202,18 @@
TN_DEBUG1( "CThumbnailImageDecoderv2::CreateDecoderL() end" );
}
+// -----------------------------------------------------------------------------
+// CThumbnailImageDecoderv2::LeaveIfCorruptL()
+// Leave if image is corrupted
+// -----------------------------------------------------------------------------
+//
+void CThumbnailImageDecoderv2::LeaveIfCorruptL(const TInt aError )
+ {
+ //no sense to try other codecs if image is corrupted
+ if( aError == KErrCorrupt || aError == KErrUnderflow)
+ {
+ User::Leave( aError );
+ }
+ }
+
//End of file
--- a/imagehandlingutilities/thumbnailmanager/plugins/video/src/thumbnailvideoprovider.cpp Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/plugins/video/src/thumbnailvideoprovider.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -169,6 +169,7 @@
void CThumbnailVideoProvider::GetThumbnailL( RFs& /*aFs*/, TDesC8& /*aBuffer*/)
{
TN_DEBUG1( "CThumbnailVideoProvider::GetThumbnailL() - nothing to do" );
+ User::Leave( KErrNotSupported );
}
// ---------------------------------------------------------------------------
Binary file imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/ThumbnailManager_0x102830AB_v9.20.2_SA_S60.50_Euro1.sis has changed
--- a/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/stub.pkg Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/stub.pkg Fri Feb 19 23:07:36 2010 +0200
@@ -17,7 +17,7 @@
&EN
; Header
-#{"ThumbnailManager"},(0x102830AB), 9, 20, 1, TYPE=SA
+#{"ThumbnailManager"},(0x102830AB), 9, 20, 2, TYPE=SA
; Localised Vendor name
%{"Nokia"}
Binary file imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/thumbnailmanager_stub.sis has changed
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/group/thumbagdaemon.mmp Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/group/thumbagdaemon.mmp Fri Feb 19 23:07:36 2010 +0200
@@ -39,15 +39,18 @@
SOURCEPATH ../src
SOURCE thumbagdaemon.cpp
SOURCE thumbagprocessor.cpp
-SOURCE ../../thumbnailserver/src/tmshutdownobserver.cpp
-SOURCE thumbagformatobserver.cpp
+
+SOURCEPATH ../../tmcommon/src
+SOURCE tmactivitymanager.cpp
+SOURCE tmshutdownobserver.cpp
+SOURCE tmformatobserver.cpp
// Default system include paths for middleware layer modules.
MW_LAYER_SYSTEMINCLUDE
USERINCLUDE ../inc
USERINCLUDE ../../inc
-USERINCLUDE ../../thumbnailserver/inc
+USERINCLUDE ../../tmcommon/inc
LIBRARY euser.lib
LIBRARY mdeclient.lib
@@ -55,7 +58,8 @@
LIBRARY centralrepository.lib
LIBRARY harvesterclient.lib
LIBRARY bafl.lib
-LIBRARY mpxcollectionhelper.lib mpxcollectionutility.lib mpxcommon.lib
+LIBRARY mpxcollectionhelper.lib mpxcollectionutility.lib mpxcommon.lib
+LIBRARY hwrmlightclient.lib
DEBUGLIBRARY flogger.lib
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagdaemon.h Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagdaemon.h Fri Feb 19 23:07:36 2010 +0200
@@ -135,6 +135,13 @@
* @since S60 v5.0
*/
void ConstructL();
+
+ /**
+ * Initilization helper
+ *
+ * @since S60 v5.2
+ */
+ void InitializeL();
private:
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h Fri Feb 19 23:07:36 2010 +0200
@@ -29,9 +29,11 @@
#include <harvesterclient.h>
#include <e32property.h>
#include <mpxcollectionobserver.h>
+#include <hwrmlight.h>
+#include "tmactivitymanager.h"
+#include "tmformatobserver.h"
//FORWARD DECLARATIONS
-class CThumbAGFormatObserver;
class MMPXCollectionUtility;
/**
@@ -43,7 +45,10 @@
public MThumbnailManagerObserver,
public MMdEQueryObserver,
public MHarvesterEventObserver,
- public MMPXCollectionObserver
+ public MMPXCollectionObserver,
+ public MHWRMLightObserver,
+ public MTMActivityManagerObserver,
+ public MTMFormatObserver
{
public:
@@ -80,7 +85,11 @@
HarvesterEventState aHarvesterEventState,
TInt aItemsLeft );
-private: // From MMPXCollectionObserver
+ //From MTMFormatObserver
+ void FormatNotification(TBool aFormat);
+
+private:
+ // From MMPXCollectionObserver
/// See @ref MMPXCollectionObserver::HandleCollectionMessageL
void HandleCollectionMessage( CMPXMessage* aMessage, TInt aError );
@@ -92,7 +101,14 @@
/// See @ref MMPXCollectionObserver::HandleCollectionMediaL
void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError );
-
+
+private: //From MHWRMLightObserver
+ void LightStatusChanged(TInt aTarget, CHWRMLight::TLightStatus aStatus);
+
+private: //From MTMActivityManagerObserver
+ void ActivityDetected();
+ void InactivityDetected();
+
public:
/**
@@ -131,12 +147,12 @@
void SetForceRun( const TBool aForceRun );
- void SetFormat(TBool aStatus);
+ TBool IsInactive();
- void QueryForPlaceholdersL();
-
protected:
+ void QueryAllItemsL();
+
/**
* QueryL
*
@@ -145,6 +161,8 @@
*/
void QueryL( RArray<TItemId>& aIDArray );
+ void QueryPlaceholdersL();
+
protected:
/**
@@ -219,7 +237,7 @@
* @since S60 v5.0
*/
void CancelTimeout();
-
+
private:
// not own
@@ -229,24 +247,19 @@
// own
CThumbnailManager* iTMSession;
CMdEObjectQuery* iQuery;
- CMdEObjectQuery* iQueryForPlaceholders;
+ CMdEObjectQuery* iQueryAllItems;
+ CMdEObjectQuery* iQueryPlaceholders;
RArray<TItemId> iAddQueue;
RArray<TItemId> iModifyQueue;
RArray<TItemId> iRemoveQueue;
- RArray<TItemId> iPresentQueue;
RArray<TItemId> iQueryQueue;
+ RArray<TItemId> iPlaceholderQueue;
- RArray<TItemId> iTempModifyQueue;
- RArray<TItemId> iTempAddQueue;
-
- RArray<TItemId> iPlaceholderIDs;
TBool iQueryActive;
TBool iQueryReady;
- TBool iQueryForPlaceholdersActive;
-
TBool iModify;
TInt iProcessingCount;
@@ -254,8 +267,11 @@
TBool iHarvesting;
TBool iHarvestingTemp;
+ //Flag is MDS placeholder harvesting active
+ TBool iPHHarvesting;
+ TBool iPHHarvestingTemp;
+
CPeriodic* iPeriodicTimer;
- TBool iTimerActive;
//MDS Harvester client
RHarvesterClient iHarvesterClient;
@@ -280,7 +296,7 @@
//PS key to get info server's idle status
RProperty iProperty;
- CThumbAGFormatObserver* iFormatObserver;
+ CTMFormatObserver* iFormatObserver;
TBool iFormatting;
TBool iSessionDied;
@@ -291,6 +307,20 @@
//Flag is MPX harvesting or MTP synchronisation in progress
TBool iMPXHarvesting;
+ //inactivity polling timer
+ CPeriodic* iInactivityTimer;
+ //overall status of device
+ TBool iIdle;
+
+ //Backlight control
+ CHWRMLight* iLight;
+ #ifdef _DEBUG
+ TInt iLightMask;
+ #endif
+ //backlight status
+ TBool iLights;
+
+ CTMActivityManager* iActivityManager;
};
#endif // THUMBAGPROCESSOR_H
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -62,7 +62,8 @@
// ---------------------------------------------------------------------------
//
CThumbAGDaemon::CThumbAGDaemon()
- : CServer2( CActive::EPriorityStandard, CServer2::EUnsharableSessions )
+ : CServer2( CActive::EPriorityStandard, CServer2::EUnsharableSessions ), iShutdownObserver(NULL),
+ iMDSShutdownObserver(NULL), iMdESession(NULL), iProcessor(NULL)
{
// No implementation required
}
@@ -82,34 +83,72 @@
iModCounter = 0;
iDelCounter = 0;
#endif
-
+
+ InitializeL();
+
+ TN_DEBUG1( "CThumbAGDaemon::ConstructL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// ~CThumbAGDaemon
+// ---------------------------------------------------------------------------
+//
+void CThumbAGDaemon::InitializeL()
+ {
+ TN_DEBUG1( "CThumbAGDaemon::InitializeL() - begin" );
+
if (DaemonEnabledL())
{
- TN_DEBUG1( "CThumbAGDaemon::ConstructL() - create observers" );
+ TN_DEBUG1( "CThumbAGDaemon::InitializeL() - create observers" );
- // create shutdown observer
+ // create shutdown observer
+ if(iMDSShutdownObserver)
+ {
+ delete iMDSShutdownObserver;
+ iMDSShutdownObserver = NULL;
+ }
iMDSShutdownObserver = CTMShutdownObserver::NewL( *this, KMdSPSShutdown, KMdSShutdown, EFalse );
- iShutdownObserver = CTMShutdownObserver::NewL( *this, KTAGDPSNotification, KShutdown, ETrue );
- iShutdown = EFalse;
-
+
+ if(iShutdownObserver)
+ {
+ delete iShutdownObserver;
+ iShutdownObserver = NULL;
+ }
+ iShutdownObserver = CTMShutdownObserver::NewL( *this, KTAGDPSNotification, KShutdown, ETrue );
+ iShutdown = EFalse;
+
// create processor
- iProcessor = NULL;
- iProcessor = CThumbAGProcessor::NewL();
-
- TN_DEBUG1( "CThumbAGDaemon::ConstructL() - connect to MDS" );
+ if(iProcessor)
+ {
+ delete iProcessor;
+ iProcessor = NULL;
+ }
+
+ iProcessor = CThumbAGProcessor::NewL();
+
+ TN_DEBUG1( "CThumbAGDaemon::InitializeL() - connect to MDS" );
- // connect to MDS
- iMdESession = NULL;
- iMdESession = CMdESession::NewL( *this );
+ if(iMdESession)
+ {
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectPresentObserverL( * this ));
+
+ // connect to MDS
+ delete iMdESession;
+ iMdESession = NULL;
+ }
+
+ iMdESession = CMdESession::NewL( *this );
}
else
{
// no error here, but need to shutdown daemon neatly
User::Leave(KErrNone);
}
-
- TN_DEBUG1( "CThumbAGDaemon::ConstructL() - end" );
- }
+ TN_DEBUG1( "CThumbAGDaemon::InitializeL() - end" );
+ }
// ---------------------------------------------------------------------------
// ~CThumbAGDaemon
@@ -203,7 +242,6 @@
if (aError == KErrNone)
{
iProcessor->SetMdESession(iMdESession);
- TRAP_IGNORE(iProcessor->QueryForPlaceholdersL());
TRAPD( err, AddObserversL() );
if (err != KErrNone)
@@ -223,9 +261,12 @@
//
void CThumbAGDaemon::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
{
+ TN_DEBUG2( "CThumbAGDaemon::HandleSessionError == %d", aError );
if (aError != KErrNone)
{
- TN_DEBUG2( "CThumbAGDaemon::HandleSessionError == %d", aError );
+ delete iMdESession;
+ iMdESession = NULL;
+ TRAP_IGNORE(InitializeL());
}
}
@@ -271,7 +312,7 @@
// If delete event, remove IDs from Modify and Add queues
if ( aType == ENotifyRemove )
{
- iProcessor->RemoveFromQueues( aObjectIdArray );
+ iProcessor->RemoveFromQueues( aObjectIdArray, EFalse);
}
// Add event to processing queue by type and enable force run
@@ -297,7 +338,7 @@
// -----------------------------------------------------------------------------
// CThumbAGDaemon::HandleObjectPresentNotification
// -----------------------------------------------------------------------------
-//
+//b
void CThumbAGDaemon::HandleObjectPresentNotification(CMdESession& /*aSession*/,
TBool aPresent, const RArray<TItemId>& aObjectIdArray)
{
@@ -314,43 +355,41 @@
//tread present objects as added
if(aPresent)
{
- TRAP_IGNORE( iProcessor->QueryForPlaceholdersL());
if ( aObjectIdArray.Count() > 0)
- {
- // do not force run of these items
- TRAP(err, iProcessor->AddToQueueL(ENotifyModify, aObjectIdArray, ETrue));
+ {
+ // do not force run of these items
+ TRAP(err, iProcessor->AddToQueueL(ENotifyAdd, aObjectIdArray, ETrue));
- TN_DEBUG2( "CThumbAGDaemon::HandleObjectPresentNotification() - ENotifyAdd %d", aObjectIdArray.Count() );
+ TN_DEBUG2( "CThumbAGDaemon::HandleObjectPresentNotification() - ENotifyAdd %d", aObjectIdArray.Count() );
-
-#ifdef _DEBUG
+ #ifdef _DEBUG
iAddCounter = iAddCounter + aObjectIdArray.Count();
if (err != KErrNone)
{
TN_DEBUG1( "CThumbAGDaemon::HandleObjectPresentNotification() - error adding to queue" );
}
-#endif
+ #endif
}
}
else
{
TN_DEBUG1( "CThumbAGDaemon::HandleObjectPresentNotification() - handle not present" );
- TRAP_IGNORE( iProcessor->QueryForPlaceholdersL() );
-#ifdef _DEBUG
- if( iModCounter < aObjectIdArray.Count() )
+
+ #ifdef _DEBUG
+ if( iAddCounter < aObjectIdArray.Count() )
{
- iModCounter = 0;
+ iAddCounter = 0;
}
else
{
- iModCounter = iModCounter - aObjectIdArray.Count();
+ iAddCounter = iAddCounter - aObjectIdArray.Count();
}
-#endif
+ #endif
if ( aObjectIdArray.Count() > 0)
- {
- iProcessor->RemoveFromQueues( aObjectIdArray, ETrue );
- }
+ {
+ iProcessor->RemoveFromQueues( aObjectIdArray, ETrue );
+ }
}
#ifdef _DEBUG
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -21,14 +21,15 @@
#include <mdeconstants.h>
#include <centralrepository.h>
+#include <mpxcollectionutility.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcollectionmessage.h>
+#include <CoreApplicationUIsDomainPSKeys.h>
+
#include "thumbagprocessor.h"
#include "thumbnaillog.h"
#include "thumbnailmanagerconstants.h"
#include "thumbnailmanagerprivatecrkeys.h"
-#include "thumbagformatobserver.h"
-#include <mpxcollectionutility.h>
-#include <mpxmessagegeneraldefs.h>
-#include <mpxcollectionmessage.h>
// ---------------------------------------------------------------------------
// CThumbAGProcessor::NewL()
@@ -71,7 +72,8 @@
#endif
iTMSession = CThumbnailManager::NewL( *this );
-
+ iQueryAllItems = NULL;
+ iQueryPlaceholders = NULL;
iQuery = NULL;
iQueryActive = EFalse;
iModify = EFalse;
@@ -89,13 +91,27 @@
iForceRun = EFalse;
iActive = EFalse;
- iFormatObserver = CThumbAGFormatObserver::NewL( this );
+ iFormatObserver = CTMFormatObserver::NewL( *this );
iFormatting = EFalse;
iSessionDied = EFalse;
iCollectionUtility = NULL;
+
+ iLight = CHWRMLight::NewL(this);
+
+#ifdef _DEBUG
+ if(iLight)
+ {
+ iLightMask = iLight->SupportedTargets();
+ TN_DEBUG2( "CThumbAGProcessor::ConstructL() - iLightMask == %d", iLightMask );
+ }
+#endif
+ iActivityManager = CTMActivityManager::NewL( this, KBackgroundGenerationIdle);
+
+ ActivateAO();
+
TN_DEBUG1( "CThumbAGProcessor::ConstructL() - end" );
}
@@ -107,6 +123,19 @@
{
TN_DEBUG1( "CThumbAGProcessor::~CThumbAGProcessor() - begin" );
+ if(iActivityManager)
+ {
+ delete iActivityManager;
+ iActivityManager = NULL;
+ }
+
+ if (iInactivityTimer)
+ {
+ iInactivityTimer->Cancel();
+ delete iInactivityTimer;
+ iInactivityTimer = NULL;
+ }
+
if(iPeriodicTimer)
{
iPeriodicTimer->Cancel();
@@ -127,6 +156,13 @@
Cancel();
+ if(iQueryPlaceholders)
+ {
+ iQueryPlaceholders->Cancel();
+ delete iQueryPlaceholders;
+ iQueryPlaceholders = NULL;
+ }
+
if (iQuery)
{
iQuery->Cancel();
@@ -134,21 +170,18 @@
iQuery = NULL;
}
- if (iQueryForPlaceholders)
+ if (iQueryAllItems)
{
- iQueryForPlaceholders->Cancel();
- delete iQueryForPlaceholders;
- iQueryForPlaceholders = NULL;
+ iQueryAllItems->Cancel();
+ delete iQueryAllItems;
+ iQueryAllItems = NULL;
}
iAddQueue.Close();
iModifyQueue.Close();
iRemoveQueue.Close();
iQueryQueue.Close();
- iPresentQueue.Close();
- iTempModifyQueue.Close();
- iTempAddQueue.Close();
- iPlaceholderIDs.Close();
+ iPlaceholderQueue.Close();
if (iTMSession)
{
@@ -158,6 +191,9 @@
delete iFormatObserver;
+ delete iLight;
+ iLight = NULL;
+
TN_DEBUG1( "CThumbAGProcessor::~CThumbAGProcessor() - end" );
}
@@ -176,50 +212,79 @@
// CThumbAGProcessor::HandleQueryCompleted()
// -----------------------------------------------------------------------------
//
-void CThumbAGProcessor::HandleQueryCompleted( CMdEQuery& /*aQuery*/, const TInt aError )
+void CThumbAGProcessor::HandleQueryCompleted( CMdEQuery& aQuery, const TInt aError )
{
-
- if( iQueryForPlaceholdersActive && iQueryForPlaceholders)
+ TN_DEBUG3( "CThumbAGProcessor::HandleQueryCompleted, aError == %d Count== %d", aError, aQuery.Count());
+
+ if(&aQuery == iQueryPlaceholders)
{
- TN_DEBUG3( "CThumbAGProcessor::HandleQueryCompletedv2, aError == %d Count== %d", aError, iQueryForPlaceholders->Count());
+ TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted - iQueryPlaceholders completed");
+ iPlaceholderQueue.Reset();
// if no errors in query
if (aError == KErrNone )
{
-
- for(TInt i = 0; i < iQueryForPlaceholders->Count(); i++)
+ 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;
+ }
+ 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 = &iQueryForPlaceholders->Result(i);
-
+ const CMdEObject* object = &iQueryAllItems->Result(i);
+
if(!object)
- continue;
-
- if(!object->Placeholder())
{
- TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompletedv2 %d not placeholder",object->Id());
continue;
}
-
- if (iPlaceholderIDs.Find( object->Id() ) == KErrNotFound)
- {
- TRAP_IGNORE( iPlaceholderIDs.AppendL( object->Id() ));
- }
+
+ if (iAddQueue.Find( object->Id() ) == KErrNotFound)
+ {
+ TRAP_IGNORE( iAddQueue.AppendL( object->Id() ));
+ }
}
-
+#ifdef _DEBUG
+TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted IN-COUNTERS---------- Amount: %d, Add",iQueryAllItems->Count());
+#endif
}
- else
+ //free query
+ delete iQueryAllItems;
+ iQueryAllItems = NULL;
+ }
+ else if(&aQuery == iQuery )
+ {
+ TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted - Query completed");
+ if(iQueryActive)
{
- TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() FAILED!");
+ iQueryReady = ETrue;
+ iQueryActive = EFalse;
}
-
- iQueryForPlaceholdersActive = EFalse;
- }
-
- else if(iQueryActive)
- {
- TN_DEBUG3( "CThumbAGProcessor::HandleQueryCompleted, aError == %d Count== %d", aError, iQuery->Count());
- iQueryReady = ETrue;
- iQueryActive = EFalse;
// if no errors in query
if (aError == KErrNone && iQuery)
@@ -228,13 +293,16 @@
}
else
{
+ delete iQuery;
+ iQuery = NULL;
iProcessingCount = 0;
- TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() FAILED!");
+ TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() Query FAILED!");
}
}
else
{
TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() - NO QUERY ACTIVE");
+ __ASSERT_DEBUG((EFalse), User::Panic(_L("CThumbAGProcessor::HandleQueryCompleted()"), -1));
}
ActivateAO();
@@ -268,7 +336,7 @@
iSessionDied = ETrue;
- if( !iTimerActive)
+ if( !iPeriodicTimer->IsActive())
{
StartTimeout();
}
@@ -299,6 +367,10 @@
{
TN_DEBUG1( "CThumbAGProcessor::SetMdESession - Error: GetDefaultNamespaceDefL leave" );
}
+
+ TRAP_IGNORE(QueryPlaceholdersL());
+ TRAP_IGNORE(QueryAllItemsL());
+
ActivateAO();
}
@@ -307,27 +379,12 @@
// ---------------------------------------------------------------------------
//
void CThumbAGProcessor::AddToQueueL( TObserverNotificationType aType,
- const RArray<TItemId>& aIDArray, TBool aPresent )
+ const RArray<TItemId>& aIDArray, TBool /*aPresent*/ )
{
TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - begin" );
-
- if(aPresent)
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - Add to SetPresentQueue" );
- for (int i=0; i<aIDArray.Count(); i++)
- {
- // only add to Present queue if not already in Add or Present queue
- if (iAddQueue.Find( aIDArray[i] ) == KErrNotFound)
- {
- if (iPresentQueue.Find( aIDArray[i] ) == KErrNotFound)
- {
- iPresentQueue.AppendL(aIDArray[i]);
- }
- }
- }
- }
+
// update queues
- else if (aType == ENotifyAdd)
+ if (aType == ENotifyAdd)
{
TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - ENotifyAdd" );
@@ -336,120 +393,108 @@
// only add to Add queue if not already in Add queue
if (iAddQueue.Find( aIDArray[i] ) == KErrNotFound)
{
- //if in Present Queue remove from there and and put to add queue
- TInt index = iPresentQueue.Find( aIDArray[i] );
- if( index != KErrNotFound)
- {
- iPresentQueue.Remove( index );
- }
iAddQueue.AppendL(aIDArray[i]);
- iTempAddQueue.AppendL(aIDArray[i]);
}
}
}
else if (aType == ENotifyModify)
{
TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - ENotifyModify" );
+
+ if(iPHHarvesting)
+ {
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - PH harvesting active, treat like add" );
+ for (int i=0; i<aIDArray.Count(); i++)
+ {
+ // only add to Add queue if not already in Add queue
+ if (iAddQueue.Find( aIDArray[i] ) == KErrNotFound)
+ {
+ iAddQueue.AppendL(aIDArray[i]);
+ }
+
+ TInt itemIndex = iPlaceholderQueue.Find( aIDArray[i] );
+
+ if (itemIndex >= 0)
+ {
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - remove from placeholder queue");
+ iPlaceholderQueue.Remove( itemIndex );
+ }
+ }
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - PH harvesting finished, check is real modify!" );
- for (int i=0; i<aIDArray.Count(); i++)
- {
- TInt itemIndex = iPlaceholderIDs.Find( aIDArray[i] );
- if(itemIndex >= 0 )
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - harvesting now ended for this placeholder - not Real ENotifyModify" );
- iPlaceholderIDs.Remove(itemIndex);
- TN_DEBUG2( "CThumbAGProcessor::AddToQueueL() - placeholders left %d", iPlaceholderIDs.Count() );
- if (iAddQueue.Find( aIDArray[i] ) == KErrNotFound)
- {
- iAddQueue.AppendL(aIDArray[i]);
- }
- if (iTempModifyQueue.Find( aIDArray[i] ) == KErrNotFound)
- {
- iTempModifyQueue.AppendL( aIDArray[i] );
- }
- }
- else if ( iTempAddQueue.Find( aIDArray[i] ) == KErrNotFound)
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - Real ENotifyModify, force run" );
- iModifyQueue.InsertL( aIDArray[i], 0 );
-
- TInt itemIndex = iAddQueue.Find( aIDArray[i] );
- if(itemIndex >= 0)
+ TInt itemIndex(KErrNotFound);
+
+ for (int i=0; i<aIDArray.Count(); i++)
+ {
+ itemIndex = iPlaceholderQueue.Find( aIDArray[i] );
+
+ if (itemIndex >= 0)
+ {
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - placeholder modify, remove from placeholder queue");
+ iPlaceholderQueue.Remove( itemIndex );
+ iAddQueue.Append( aIDArray[i] );
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - real modify");
+ itemIndex = iAddQueue.Find( aIDArray[i] );
+
+ if (itemIndex >= 0)
+ {
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - remove from add queue");
+ iAddQueue.Remove( itemIndex );
+ }
+
+ if( iPlaceholderQueue.Find( aIDArray[i] ) == KErrNotFound )
+ {
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - append to modify queue");
+ iModifyQueue.AppendL(aIDArray[i]);
+ }
+
+ SetForceRun( ETrue );
+ }
+ }
+ }
+ }
+ else if (aType == ENotifyRemove)
+ {
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - ENotifyRemove, remove IDs from all queues, append to Delete" );
+
+ for (int i=0; i<aIDArray.Count(); i++)
+ {
+ // can be removed from Add queue
+ TInt itemIndex = iAddQueue.Find( aIDArray[i] );
+ if(itemIndex >= 0)
{
iAddQueue.Remove(itemIndex);
}
- itemIndex = iPresentQueue.Find( aIDArray[i] );
- if(itemIndex >= 0)
+
+ // ..and Modify Queue
+ itemIndex = iModifyQueue.Find( aIDArray[i] );
+ if(itemIndex >= 0)
{
- iPresentQueue.Remove(itemIndex);
+ iModifyQueue.Remove(itemIndex);
}
- SetForceRun( ETrue );
- }
- else
- {
- if (iTempModifyQueue.Find( aIDArray[i] ) == KErrNotFound)
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - harvesting now ended for this file - not Real ENotifyModify" );
- iTempModifyQueue.AppendL( aIDArray[i] );
- }
- else
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - harvesting ended allready for this file - Real ENotifyModify, force run" );
- iModifyQueue.InsertL( aIDArray[i], 0 );
- TInt itemIndex = iAddQueue.Find( aIDArray[i] );
- if(itemIndex >= 0)
- {
- iAddQueue.Remove(itemIndex);
- }
- itemIndex = iPresentQueue.Find( aIDArray[i] );
- if(itemIndex >= 0)
- {
- iPresentQueue.Remove(itemIndex);
- }
- SetForceRun( ETrue );
- }
- }
- }
- }
- else if (aType == ENotifyRemove)
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - ENotifyRemove" );
-
- for (int i=0; i<aIDArray.Count(); i++)
+
+ //add to remove queue
+ if (iRemoveQueue.Find( aIDArray[i] ) == KErrNotFound)
+ {
+ iRemoveQueue.AppendL(aIDArray[i]);
+ }
+ }
+ }
+#ifdef _DEBUG
+ else
{
- // only add to Remove queue if not already in Remove queue
- if (iRemoveQueue.Find( aIDArray[i] ) == KErrNotFound)
- {
- iRemoveQueue.AppendL(aIDArray[i]);
- }
-
- // can be removed from Add queue
- TInt itemIndex = iAddQueue.Find( aIDArray[i] );
- if(itemIndex >= 0)
- {
- iAddQueue.Remove(itemIndex);
- }
- // ..and Present Queue
- itemIndex = iPresentQueue.Find( aIDArray[i] );
- if(itemIndex >= 0)
- {
- iPresentQueue.Remove(itemIndex);
- }
- // ..and Modify Queue
- itemIndex = iModifyQueue.Find( aIDArray[i] );
- if(itemIndex >= 0)
- {
- iModifyQueue.Remove(itemIndex);
- }
- }
- }
- else
- {
- // should not come here
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - should not come here" );
- return;
- }
-
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - should not come here" );
+ __ASSERT_DEBUG((EFalse), User::Panic(_L("CThumbAGProcessor::AddToQueueL()"), -2));
+ return;
+ }
+#endif
+
ActivateAO();
TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - end" );
@@ -463,104 +508,62 @@
{
TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() - begin" );
- if( iModify )
+ TInt orientationVal = 0;
+ TInt64 modifiedVal = 0;
+
+ CMdEProperty* orientation = NULL;
+ CMdEObjectDef& objDef = iDefNamespace->GetObjectDefL( MdeConstants::Image::KImageObject );
+ TInt orientErr = aObject->Property( objDef.GetPropertyDefL( MdeConstants::Image::KOrientationProperty ), orientation, 0 );
+
+ if (orientErr == KErrNone)
{
- TInt orientationVal = 0;
- TInt64 modifiedVal = 0;
-
- CMdEProperty* orientation = NULL;
- CMdEObjectDef& objDef = iDefNamespace->GetObjectDefL( MdeConstants::Image::KImageObject );
- TInt orientErr = aObject->Property( objDef.GetPropertyDefL( MdeConstants::Image::KOrientationProperty ), orientation, 0 );
+ orientationVal = orientation->Uint16ValueL();
+ }
- if (orientErr == KErrNone)
- {
- orientationVal = orientation->Uint16ValueL();
- }
+ CMdEProperty* modified = NULL;
+ CMdEObjectDef& objDef2 = iDefNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject );
+ TInt modifyErr = aObject->Property( objDef2.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty ), modified, 0 );
+
+ if (modifyErr >= 0)
+ {
+ modifiedVal = modified->TimeValueL().Int64();
+ }
+
+ // modify existing thumbs
+ if (iTMSession)
+ {
+ // run as lower priority than getting but higher that creating thumbnails
+ TRAPD(err, iTMSession->UpdateThumbnailsL(aObject->Id(), aObject->Uri(), orientationVal, modifiedVal, CActive::EPriorityIdle ));
- CMdEProperty* modified = NULL;
- CMdEObjectDef& objDef2 = iDefNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject );
- TInt modifyErr = aObject->Property( objDef2.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty ), modified, 0 );
-
- if (modifyErr >= 0)
+ if ( err != KErrNone )
{
- modifiedVal = modified->TimeValueL().Int64();
- }
-
- // modify existing thumbs
- if (iTMSession)
- {
- // run as lower priority than getting but higher that creating thumbnails
- TRAPD(err, iTMSession->UpdateThumbnailsL(aObject->Id(), aObject->Uri(), orientationVal, modifiedVal, CActive::EPriorityIdle ));
+ TN_DEBUG2( "CThumbAGProcessor::UpdateThumbnailsL, iTMSession error == %d", err );
- if ( err != KErrNone )
- {
- TN_DEBUG2( "CThumbAGProcessor::UpdateThumbnailsL, iTMSession error == %d", err );
-
- iSessionDied = ETrue;
- iActive = EFalse;
- ActivateAO();
- }
- else
- {
- iActive = ETrue;
- }
- }
+ iSessionDied = ETrue;
+ iActive = EFalse;
+ ActivateAO();
+ }
else
{
- ActivateAO();
+ iActive = ETrue;
}
-
-#ifdef _DEBUG
- iModCounter++;
-#endif
}
else
{
- CThumbnailObjectSource* source = NULL;
- CMdEProperty* mimeType = NULL;
- CMdEObjectDef& objDef = iDefNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject );
- TInt mime = aObject->Property( objDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty ), mimeType, 0 );
-
- // create new thumbs
- if (mime != KErrNotFound)
- {
- source = CThumbnailObjectSource::NewLC(aObject->Uri(), aObject->Id(), mimeType->TextValueL());
- }
- else
- {
- source = CThumbnailObjectSource::NewLC(aObject->Uri(), aObject->Id());
- }
-
- if (iTMSession)
- {
- // run as very low priority task
- TInt id = iTMSession->CreateThumbnails(*source, CActive::EPriorityIdle );
- if ( id < 0 )
- {
- TN_DEBUG2( "CThumbAGProcessor::CreateThumbnailsL, iTMSession error == %d", id );
-
- iSessionDied = ETrue;
- iActive = EFalse;
- CleanupStack::PopAndDestroy( source );
- ActivateAO();
- }
- else
- {
- iActive = ETrue;
- CleanupStack::PopAndDestroy( source );
- }
-
- }
- else
- {
- ActivateAO();
- }
+ ActivateAO();
+ }
#ifdef _DEBUG
+ if(iModify)
+ {
+ iModCounter++;
+ }
+ else
+ {
iAddCounter++;
-#endif
}
-
+#endif
+
#ifdef _DEBUG
TN_DEBUG3( "CThumbAGProcessor::OUT-COUNTERS----------, Add = %d Modify = %d",
iAddCounter, iModCounter );
@@ -641,6 +644,66 @@
TN_DEBUG1( "CThumbAGProcessor::QueryL() - end" );
}
+
+// ---------------------------------------------------------------------------
+// CThumbAGProcessor::QueryForPlaceholders()
+// ---------------------------------------------------------------------------
+//
+
+void CThumbAGProcessor::QueryPlaceholdersL()
+ {
+ TN_DEBUG1( "CThumbAGProcessor::QueryPlaceholdersL" );
+
+ CMdEObjectQuery::TState state(CMdEObjectQuery::EStateFirst);
+
+ if( iQueryPlaceholders )
+ {
+ state = iQueryPlaceholders->State();
+
+ if(state == CMdEObjectQuery::EStateSearching )
+ {
+ TN_DEBUG1( "CThumbAGProcessor::QueryPlaceholdersL active- skip" );
+ return;
+ }
+
+ // delete old query
+ iQueryPlaceholders->Cancel();
+ delete iQueryPlaceholders;
+ iQueryPlaceholders = NULL;
+ }
+
+ TN_DEBUG1( "CThumbAGProcessor::QueryPlaceholdersL - start" );
+
+ CMdEObjectDef& imageObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Image::KImageObject );
+ CMdEObjectDef& videoObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Video::KVideoObject );
+ CMdEObjectDef& audioObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Audio::KAudioObject );
+
+ CMdEObjectDef& objDef = iDefNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject);
+ iQueryPlaceholders = iMdESession->NewObjectQueryL( *iDefNamespace, objDef, this );
+
+ iQueryPlaceholders->SetResultMode( EQueryResultModeItem );
+
+ CMdELogicCondition& rootCondition = iQueryPlaceholders->Conditions();
+ rootCondition.SetOperator( ELogicConditionOperatorOr );
+
+ CMdEObjectCondition& imagePHObjectCondition = rootCondition.AddObjectConditionL(imageObjDef);
+ imagePHObjectCondition.SetPlaceholderOnly( ETrue );
+ imagePHObjectCondition.SetNotPresent( ETrue );
+
+ CMdEObjectCondition& videoPHObjectCondition = rootCondition.AddObjectConditionL(videoObjDef);
+ videoPHObjectCondition.SetPlaceholderOnly( ETrue );
+ videoPHObjectCondition.SetNotPresent( ETrue );
+
+ CMdEObjectCondition& audioPHObjectCondition = rootCondition.AddObjectConditionL(audioObjDef);
+ audioPHObjectCondition.SetPlaceholderOnly( ETrue );
+ audioPHObjectCondition.SetNotPresent( ETrue );
+
+ iQueryPlaceholders->FindL();
+
+ TN_DEBUG1( "CThumbAGProcessor::QueryPlaceholdersL - end" );
+ }
+
+
// ---------------------------------------------------------------------------
// CThumbAGProcessor::RunL()
// ---------------------------------------------------------------------------
@@ -665,12 +728,16 @@
TN_DEBUG1( "iHarvesterClient connected");
iHarvesterClient.AddHarvesterEventObserver( *this, EHEObserverTypeOverall, KMaxTInt );
iHarvesterClient.AddHarvesterEventObserver( *this, EHEObserverTypePlaceholder, KMaxTInt );
+ iHarvesterClient.AddHarvesterEventObserver( *this, EHEObserverTypeMMC, KMaxTInt );
TN_DEBUG1( "iHarvesterClient AddHarvesterEventObserver added");
}
TN_DEBUG1( "create MMPXCollectionUtility");
iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeIsolated );
TN_DEBUG1( "CThumbAGProcessor::RunL() - Initialisation done" );
+
+ iActivityManager->Start();
+
return;
}
@@ -684,9 +751,11 @@
if (err != KErrNone)
{
iTMSession = NULL;
+ ActivateAO();
TN_DEBUG2( "CThumbAGProcessor::RunL() - Session restart failed, error == %d", err );
}
- else {
+ else
+ {
iSessionDied = EFalse;
}
}
@@ -712,56 +781,61 @@
iActiveCount = 0;
}
- //Iforce run can proceed from this point
- if( !iForceRun )
- {
- //check if harvesting or waiting timeout
- if( iHarvesting || iTimerActive || iMPXHarvesting )
+ //force run can proceed from this point
+ if( iForceRun )
+ {
+ CancelTimeout();
+ TN_DEBUG1( "void CThumbAGProcessor::RunL() forced run, continue!");
+ }
+ else
+ {
+ if( !iLights)
+ {
+ iIdle = ETrue;
+ }
+ else
{
- TN_DEBUG1( "void CThumbAGProcessor::RunL() Harvester or timer active, abort");
+ iIdle = IsInactive();
+ }
+
+ if( !iIdle || iHarvesting || iMPXHarvesting || iPeriodicTimer->IsActive() )
+ {
+ #ifdef _DEBUG
+ TN_DEBUG5( "iIdle = %d, iHarvesting = %d, iMPXHarvesting = %d, iPeriodicTimer->IsActive() = %d",
+ iIdle, iHarvesting, iMPXHarvesting, iPeriodicTimer->IsActive());
+ #endif
+ TN_DEBUG1( "void CThumbAGProcessor::RunL() device not idle");
return;
}
else
{
//check is server idle
- TInt idle(-1);
-
- TInt ret = RProperty::Get(KServerIdle, KIdle, idle);
-
- if(ret == KErrNone )
- {
- if(!idle)
- {
- //start wait timer and retry on after callback
- TN_DEBUG1( "CThumbAGProcessor::RunL() server not idle, wait... " );
- if( !iTimerActive)
- {
- StartTimeout();
- }
- return;
- }
- }
- else
- {
- TN_DEBUG2( "CThumbAGProcessor::RunL() get KServerIdle failed %d, continue...", ret );
- }
+ TInt serveIdle(KErrNotFound);
+ TInt ret = RProperty::Get(KServerIdle, KIdle, serveIdle);
+
+ if(ret == KErrNone )
+ {
+ if(!serveIdle)
+ {
+ //start inactivity timer and retry on after callback
+ TN_DEBUG1( "void CThumbAGProcessor::RunL() server not idle");
+ StartTimeout();
+ return;
+ }
+ }
+ TN_DEBUG1( "void CThumbAGProcessor::RunL() device and server idle, process");
}
- }
- else
- {
- TN_DEBUG1( "void CThumbAGProcessor::RunL() forced run");
- }
-
+ }
//Handle completed MDS Query
if( iQueryReady && iProcessingCount)
{
TInt err(KErrNone);
+ //if force or non forced
if((iForceRun && iModify) || (!iForceRun && !iModify))
{
TN_DEBUG1( "CThumbAGProcessor::RunL() - iQueryReady START" );
-
const CMdEObject* object = &iQuery->Result( iProcessingCount-1 );
iProcessingCount--;
@@ -771,11 +845,12 @@
TRAP( err, CreateThumbnailsL(object) );
if ( err != KErrNone )
- {
- TN_DEBUG2( "CThumbAGProcessor::RunL(), CreateThumbnailsL error == %d", err );
- }
+ {
+ TN_DEBUG2( "CThumbAGProcessor::RunL(), CreateThumbnailsL error == %d", err );
+ }
}
}
+ //force is coming, but executing non-forced query complete-> cancel old
else
{
TN_DEBUG1( "CThumbAGProcessor::RunL() - deleting query" );
@@ -803,8 +878,7 @@
else
{
iForceRun = EFalse;
- }
-
+ }
}
//keep going if processing Remove items or if Add item fails
else if( iModify || err )
@@ -813,9 +887,9 @@
}
}
//waiting for MDS query to complete
- else if( iQueryActive || iQueryForPlaceholdersActive )
+ else if( iQueryActive )
{
- if(iForceRun && !iModify && iQueryActive)
+ if(iForceRun && !iModify)
{
iQuery->Cancel();
delete iQuery;
@@ -860,23 +934,14 @@
}
else if ( iAddQueue.Count() > 0 )
{
- TN_DEBUG1( "void CThumbAGProcessor::RunL() add thumbnails");
+ TN_DEBUG1( "void CThumbAGProcessor::RunL() create thumbnails");
// query for object info
iQueryActive = ETrue;
QueryL( iAddQueue );
}
- else if ( iPresentQueue.Count() > 0 )
- {
- TN_DEBUG1( "void CThumbAGProcessor::RunL() add thumbnails for present thumbnails" );
-
- // query for object info
- iQueryActive = ETrue;
-
- QueryL( iPresentQueue );
- }
-
+
TN_DEBUG1( "CThumbAGProcessor::RunL() - end" );
}
@@ -895,62 +960,113 @@
TInt /*aItemsLeft*/ )
{
TN_DEBUG3( "CThumbAGProcessor::HarvestingUpdated -- start() aHEObserverType = %d, aHarvesterEventState = %d", aHEObserverType, aHarvesterEventState );
-
+
+ #ifdef _DEBUG
if( aHEObserverType == EHEObserverTypePlaceholder)
{
- TRAP_IGNORE( QueryForPlaceholdersL() );
- return;
- }
-
- if( aHEObserverType != EHEObserverTypeOverall)
- {
- return;
+ TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- type EHEObserverTypePlaceholder");
}
-
- switch(aHarvesterEventState)
+ else if( aHEObserverType == EHEObserverTypeOverall)
{
- case EHEStateStarted:
- case EHEStateHarvesting:
- case EHEStatePaused:
- case EHEStateResumed:
- {
- iHarvestingTemp = ETrue;
- break;
- }
- case EHEStateFinished:
- case EHEStateUninitialized:
- {
- iHarvestingTemp = EFalse;
- break;
- }
- };
-
- if(iHarvestingTemp == iHarvesting)
- {
- TN_DEBUG2( "CThumbAGProcessor::HarvestingUpdated -- no change %d", iHarvesting);
+ TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- type EHEObserverTypeOverall");
}
else
{
- iHarvesting = iHarvestingTemp;
-
- if( iHarvesting )
+ TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- type EHEObserverTypeMMC");
+ }
+ #endif
+
+ //placeholder harvesting
+ if( aHEObserverType == EHEObserverTypePlaceholder)
+ {
+ switch(aHarvesterEventState)
{
- TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS harvesterin started");
- CancelTimeout();
- }
- else
+ case EHEStateStarted:
+ case EHEStateHarvesting:
+ case EHEStateResumed:
+ {
+ iPHHarvestingTemp = ETrue;
+ break;
+ }
+ case EHEStatePaused:
+ case EHEStateFinished:
+ case EHEStateUninitialized:
+ {
+ iPHHarvestingTemp = EFalse;
+ break;
+ }
+ };
+
+ if(iPHHarvestingTemp != iPHHarvesting)
{
- TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS harvesting finished ");
- // continue processing if needed
- StartTimeout();
-
- iTempModifyQueue.Reset();
- iTempAddQueue.Reset();
- iPlaceholderIDs.Reset();
+ iPHHarvesting = iPHHarvestingTemp;
+
+ if( iPHHarvesting )
+ {
+ TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS placeholder harvesterin started");
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS placeholder harvesting finished");
+ TRAP_IGNORE(QueryPlaceholdersL());
+ }
}
}
+ //overall harvesting
+ else if ( aHEObserverType == EHEObserverTypeOverall)
+ {
+ switch(aHarvesterEventState)
+ {
+ case EHEStateStarted:
+ case EHEStateHarvesting:
+ case EHEStatePaused:
+ case EHEStateResumed:
+ {
+ iHarvestingTemp = ETrue;
+ break;
+ }
+ case EHEStateFinished:
+ case EHEStateUninitialized:
+ {
+ iHarvestingTemp = EFalse;
+ break;
+ }
+ };
+
+ if(iHarvestingTemp != iHarvesting)
+ {
+ iHarvesting = iHarvestingTemp;
+
+ if( iHarvesting )
+ {
+ TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS harvesterin started");
+ CancelTimeout();
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS harvesting finished ");
+ // continue processing if needed
+ StartTimeout();
+ }
+ }
+ }
+ else if( aHEObserverType == EHEObserverTypeMMC)
+ {
+ switch(aHarvesterEventState)
+ {
+ case EHEStateStarted:
+ case EHEStateHarvesting:
+ case EHEStateResumed:
+ TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MMC harvesting started ");
+ break;
+ case EHEStateFinished:
+ TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MMC harvesting finished ");
+ TRAP_IGNORE(QueryAllItemsL());
+ break;
+ };
+ }
- TN_DEBUG3( "CThumbAGProcessor::HarvestingUpdated -- end() iHarvesting == %d, iMPXHarvesting == %d", iHarvesting, iMPXHarvesting);
+ TN_DEBUG3( "CThumbAGProcessor::HarvestingUpdated -- end() iHarvesting == %d, iPHHarvesting == %d ", iHarvesting, iPHHarvesting);
}
// ---------------------------------------------------------------------------
@@ -959,17 +1075,13 @@
//
void CThumbAGProcessor::StartTimeout()
{
+ TN_DEBUG1( "CThumbAGProcessor::StartTimeout()");
CancelTimeout();
if(!iHarvesting && !iMPXHarvesting && !iPeriodicTimer->IsActive())
{
- iPeriodicTimer->Start( KHarvestingCompleteTimeout, KHarvestingCompleteTimeout,
+ iPeriodicTimer->Start( KHarvestingCompleteTimeout, KHarvestingCompleteTimeout,
TCallBack(PeriodicTimerCallBack, this));
- iTimerActive = ETrue;
- }
- else
- {
- iTimerActive = EFalse;
}
}
@@ -979,11 +1091,10 @@
//
void CThumbAGProcessor::CancelTimeout()
{
- if(iTimerActive)
- {
- iPeriodicTimer->Cancel();
- }
- iTimerActive = EFalse;
+ if(iPeriodicTimer->IsActive())
+ {
+ iPeriodicTimer->Cancel();
+ }
}
// ---------------------------------------------------------------------------
@@ -992,6 +1103,7 @@
//
TInt CThumbAGProcessor::RunError(TInt aError)
{
+ TN_DEBUG1( "CThumbAGProcessor::RunError()");
if (aError != KErrNone)
{
TN_DEBUG2( "CThumbAGProcessor::RunError = %d", aError );
@@ -1009,13 +1121,17 @@
//
void CThumbAGProcessor::ActivateAO()
{
+#ifdef _DEBUG
+ TN_DEBUG6( "CThumbAGProcessor::Items in queue Add = %d, Mod = %d, Del = %d, Query = %d, iPlaceholder = %d", iAddQueue.Count(), iModifyQueue.Count(), iRemoveQueue.Count(), iQueryQueue.Count(), iPlaceholderQueue.Count());
+#endif
+
if(iFormatting)
{
TN_DEBUG1( "CThumbAGProcessor::ActivateAO() - FORMATTING - DAEMON ON PAUSE");
return;
}
- if( !IsActive() && (!iHarvesting || iForceRun ))
+ if( !IsActive() )
{
#ifdef _DEBUG
if( iForceRun )
@@ -1063,15 +1179,24 @@
TBool audioFull( EFalse );
// get cenrep values
- rep->Get( KAutoCreateImageGrid, imageGrid );
- rep->Get( KAutoCreateImageList, imageList );
- rep->Get( KAutoCreateImageFullscreen, imageFull );
- rep->Get( KAutoCreateVideoGrid, videoGrid );
- rep->Get( KAutoCreateVideoList, videoList );
- rep->Get( KAutoCreateVideoFullscreen, videoFull );
- rep->Get( KAutoCreateAudioGrid, audioGrid );
- rep->Get( KAutoCreateAudioList, audioList );
- rep->Get( KAutoCreateAudioFullscreen, audioFull );
+ TInt ret = rep->Get( KAutoCreateImageGrid, imageGrid );
+ TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateImageGrid %d", ret);
+ ret = rep->Get( KAutoCreateImageList, imageList );
+ TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateImageList %d", ret);
+ ret = rep->Get( KAutoCreateImageFullscreen, imageFull );
+ TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateImageFullscreen %d", ret);
+ ret = rep->Get( KAutoCreateVideoGrid, videoGrid );
+ TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateVideoGrid %d", ret);
+ ret = rep->Get( KAutoCreateVideoList, videoList );
+ TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateVideoList %d", ret);
+ ret = rep->Get( KAutoCreateVideoFullscreen, videoFull );
+ TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateVideoFullscreen %d", ret);
+ ret = rep->Get( KAutoCreateAudioGrid, audioGrid );
+ TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateAudioGrid %d", ret);
+ ret = rep->Get( KAutoCreateAudioList, audioList );
+ TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateAudioList %d", ret);
+ ret = rep->Get( KAutoCreateAudioFullscreen, audioFull );
+ TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateAudioFullscreen %d", ret);
iAutoImage = EFalse;
iAutoVideo = EFalse;
@@ -1107,6 +1232,14 @@
for (int i=0; i< aIDArray.Count(); i++)
{
TN_DEBUG2( "CThumbAGProcessor::RemoveFromQueues() - %d", aIDArray[i]);
+
+ itemIndex = iPlaceholderQueue.Find( aIDArray[i] );
+
+ if(itemIndex >= 0)
+ {
+ iPlaceholderQueue.Remove(itemIndex);
+ TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iPlaceholderQueue" );
+ }
itemIndex = iAddQueue.Find( aIDArray[i] );
@@ -1117,41 +1250,32 @@
continue;
}
- itemIndex = iPresentQueue.Find( aIDArray[i] );
-
- if(itemIndex >= 0)
- {
- iPresentQueue.Remove(itemIndex);
- TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iPresentQueue" );
- continue;
- }
-
itemIndex = iModifyQueue.Find( aIDArray[i] );
if(itemIndex >= 0)
- {
- iModifyQueue.Remove(itemIndex);
- TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iModifyQueue" );
+ {
+ iModifyQueue.Remove(itemIndex);
+ TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iModifyQueue" );
- if( iModifyQueue.Count() == 0)
- {
- iForceRun = EFalse;
- }
+ if( iModifyQueue.Count() == 0)
+ {
+ iForceRun = EFalse;
+ }
- continue;
- }
+ continue;
+ }
if( aRemoveFromDelete )
- {
- itemIndex = iRemoveQueue.Find( aIDArray[i] );
+ {
+ itemIndex = iRemoveQueue.Find( aIDArray[i] );
- if(itemIndex >= 0)
- {
- iRemoveQueue.Remove(itemIndex);
- TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iRemoveQueue" );
- continue;
- }
- }
+ if(itemIndex >= 0)
+ {
+ iRemoveQueue.Remove(itemIndex);
+ TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iRemoveQueue" );
+ continue;
+ }
+ }
}
TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - end" );
@@ -1173,75 +1297,54 @@
}
// ---------------------------------------------------------------------------
-// CThumbAGProcessor::SetFormat()
-// ---------------------------------------------------------------------------
-//
-
-void CThumbAGProcessor::SetFormat(TBool aStatus)
- {
- TN_DEBUG2( "CThumbAGProcessor::SetFormat(%d) - end", aStatus );
-
- iFormatting = aStatus;
- if(!aStatus)
- {
- ActivateAO();
- }
- }
-
-// ---------------------------------------------------------------------------
// CThumbAGProcessor::QueryForPlaceholders()
// ---------------------------------------------------------------------------
//
-
-void CThumbAGProcessor::QueryForPlaceholdersL()
+void CThumbAGProcessor::QueryAllItemsL()
{
- TN_DEBUG1( "CThumbAGProcessor::QueryForPlaceholders" );
- if(iQueryForPlaceholdersActive)
+ TN_DEBUG1( "CThumbAGProcessor::QueryAllItemsL" );
+
+ CMdEObjectQuery::TState state(CMdEObjectQuery::EStateFirst);
+
+ if( iQueryAllItems )
{
- TN_DEBUG1( "CThumbAGProcessor::QueryForPlaceholders - skip" );
- return;
+ state = iQueryAllItems->State();
+
+ if(state == CMdEObjectQuery::EStateSearching )
+ {
+ TN_DEBUG1( "CThumbAGProcessor::QueryAllItemsL active- skip" );
+ return;
+ }
+
+ // delete old query
+ iQueryAllItems->Cancel();
+ delete iQueryAllItems;
+ iQueryAllItems = NULL;
}
- TN_DEBUG1( "CThumbAGProcessor::QueryForPlaceholders - start" );
-
- // delete old query
- if (iQueryForPlaceholders)
- {
- iQueryForPlaceholdersActive = EFalse;
- iQueryForPlaceholders->Cancel();
- delete iQueryForPlaceholders;
- iQueryForPlaceholders = NULL;
- }
+ TN_DEBUG1( "CThumbAGProcessor::QueryAllItemsL - start" );
CMdEObjectDef& imageObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Image::KImageObject );
CMdEObjectDef& videoObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Video::KVideoObject );
CMdEObjectDef& audioObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Audio::KAudioObject );
CMdEObjectDef& objDef = iDefNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject);
- iQueryForPlaceholders = iMdESession->NewObjectQueryL( *iDefNamespace, objDef, this );
+ iQueryAllItems = iMdESession->NewObjectQueryL( *iDefNamespace, objDef, this );
- iQueryForPlaceholders->SetResultMode( EQueryResultModeItem );
+ iQueryAllItems->SetResultMode( EQueryResultModeItem );
- CMdELogicCondition& rootCondition = iQueryForPlaceholders->Conditions();
+ CMdELogicCondition& rootCondition = iQueryAllItems->Conditions();
rootCondition.SetOperator( ELogicConditionOperatorOr );
CMdEObjectCondition& imagePHObjectCondition = rootCondition.AddObjectConditionL(imageObjDef);
- imagePHObjectCondition.SetPlaceholderOnly( ETrue );
- imagePHObjectCondition.SetNotPresent( ETrue );
CMdEObjectCondition& videoPHObjectCondition = rootCondition.AddObjectConditionL(videoObjDef);
- videoPHObjectCondition.SetPlaceholderOnly( ETrue );
- videoPHObjectCondition.SetNotPresent( ETrue );
CMdEObjectCondition& audioPHObjectCondition = rootCondition.AddObjectConditionL(audioObjDef);
- audioPHObjectCondition.SetPlaceholderOnly( ETrue );
- audioPHObjectCondition.SetNotPresent( ETrue );
- iQueryForPlaceholders->FindL();
+ iQueryAllItems->FindL();
- iQueryForPlaceholdersActive = ETrue;
-
- TN_DEBUG1( "CThumbAGProcessor::QueryForPlaceholders - end" );
+ TN_DEBUG1( "CThumbAGProcessor::QueryAllItemsL - end" );
}
// -----------------------------------------------------------------------------
@@ -1250,9 +1353,7 @@
// Handle collection message.
// -----------------------------------------------------------------------------
//
-
-void CThumbAGProcessor::HandleCollectionMessage( CMPXMessage* aMessage,
- TInt aError )
+void CThumbAGProcessor::HandleCollectionMessage( CMPXMessage* aMessage, TInt aError )
{
if ( aError != KErrNone || !aMessage )
{
@@ -1271,40 +1372,39 @@
{
TInt op( *aMessage->Value<TInt>( KMPXMessageGeneralType ) );
- switch( op )
- {
- //when MTP sync or music collection is started then pause processing
- case EMcMsgRefreshStart:
- case EMcMsgUSBMTPStart:
- TN_DEBUG1("CThumbAGProcessor::HandleCollectionMessage MPX refresh started" );
- iMPXHarvesting = ETrue;
- CancelTimeout();
- break;
- //when MTP sync or music collection refresh is complete then resume processing
- case EMcMsgRefreshEnd:
- case EMcMsgUSBMTPEnd:
- case EMcMsgUSBMTPNotActive:
- TN_DEBUG1("CThumbAGProcessor::HandleCollectionMessage MPX refresh finished/not active" );
- iMPXHarvesting = EFalse;
- StartTimeout();
- break;
- default:
- break;
- }
- TN_DEBUG3( "CThumbAGProcessor::HandleCollectionMessage -- end() iHarvesting == %d, iMPXHarvesting == %d", iHarvesting, iMPXHarvesting);
+ switch( op )
+ {
+ //when MTP sync or music collection is started then pause processing
+ case EMcMsgRefreshStart:
+ case EMcMsgUSBMTPStart:
+ TN_DEBUG1("CThumbAGProcessor::HandleCollectionMessage MPX refresh started" );
+ iMPXHarvesting = ETrue;
+ CancelTimeout();
+ break;
+ //when MTP sync or music collection refresh is complete then resume processing
+ case EMcMsgRefreshEnd:
+ case EMcMsgUSBMTPEnd:
+ case EMcMsgUSBMTPNotActive:
+ TN_DEBUG1("CThumbAGProcessor::HandleCollectionMessage MPX refresh finished/not active" );
+ iMPXHarvesting = EFalse;
+ StartTimeout();
+ break;
+ default:
+ break;
+ }
+ TN_DEBUG3( "CThumbAGProcessor::HandleCollectionMessage -- end() iHarvesting == %d, iMPXHarvesting == %d", iHarvesting, iMPXHarvesting);
}
}
}
+
// -----------------------------------------------------------------------------
// CThumbAGProcessor::HandleOpenL
// From MMPXCollectionObserver
// Handles the collection entries being opened.
// -----------------------------------------------------------------------------
//
-void CThumbAGProcessor::HandleOpenL( const CMPXMedia& /*aEntries*/,
- TInt /*aIndex*/,
- TBool /*aComplete*/,
- TInt /*aError*/ )
+void CThumbAGProcessor::HandleOpenL( const CMPXMedia& /*aEntries*/, TInt /*aIndex*/,
+ TBool /*aComplete*/, TInt /*aError*/ )
{
// not needed here
}
@@ -1330,5 +1430,87 @@
{
// not needed here
}
+
+// -----------------------------------------------------------------------------
+// LightStatusChanged()
+// -----------------------------------------------------------------------------
+//
+void CThumbAGProcessor::LightStatusChanged(TInt aTarget, CHWRMLight::TLightStatus aStatus)
+ {
+ TN_DEBUG3( "void CThumbAGProcessor::LightStatusChanged() aTarget == %d, aStatus == %d", aTarget, aStatus);
+
+ if( aStatus == CHWRMLight::ELightOff)
+ {
+ TN_DEBUG1( "void CThumbAGProcessor::LightStatusChanged() -- OFF");
+ iLights = EFalse;
+
+ if(iAddQueue.Count() + iModifyQueue.Count() + iRemoveQueue.Count() > 0 )
+ {
+ ActivateAO();
+ }
+ }
+ else
+ {
+ TN_DEBUG1( "void CThumbAGProcessor::LightStatusChanged() -- ON");
+ iLights = ETrue;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// IsInactive()
+// -----------------------------------------------------------------------------
+//
+TBool CThumbAGProcessor::IsInactive()
+ {
+#ifdef _DEBUG
+TN_DEBUG2( "CThumbAGProcessor::IsInactive()= %d", User::InactivityTime().Int());
+#endif
+
+ if( User::InactivityTime() < TTimeIntervalSeconds(KBackgroundGenerationIdle) )
+ {
+ return EFalse;
+ }
+ return ETrue;
+ }
+
+// -----------------------------------------------------------------------------
+// ActivityDetected()
+// -----------------------------------------------------------------------------
+//
+void CThumbAGProcessor::ActivityDetected()
+ {
+ iIdle = EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// InactivityDetected()
+// -----------------------------------------------------------------------------
+//
+void CThumbAGProcessor::InactivityDetected()
+ {
+ iIdle = ETrue;
+
+ if(iAddQueue.Count() + iModifyQueue.Count() + iRemoveQueue.Count() > 0 )
+ {
+ ActivateAO();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGProcessor::FormatNotification
+// Handles a format operation
+// ---------------------------------------------------------------------------
+//
+void CThumbAGProcessor::FormatNotification( TBool aFormat )
+ {
+ TN_DEBUG2( "CThumbAGProcessor::FormatNotification(%d)", aFormat );
+
+ iFormatting = aFormat;
+ if(!aFormat)
+ {
+ ActivateAO();
+ }
+ }
+
// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -192,6 +192,7 @@
}
}
+ iTimer->Cancel();
iTimer->Start( KClientRequestTimeout, KClientRequestTimeout,
TCallBack(TimerCallBack, this));
SetActive();
@@ -244,7 +245,7 @@
TN_DEBUG2( "CThumbnaiRequestActive::RunL() - file handle opened for %S", &iParams.iFileName );
- iSession.RequestThumbnailL( iFile, iParams.iTargetUri, iParamsPckg, iStatus );
+ iSession.RequestThumbnailL( iFile, iParams.iFileName, iParamsPckg, iStatus );
CleanupStack::PopAndDestroy( &iFile );
iTimer->Start( KClientRequestTimeout, KClientRequestTimeout,
@@ -382,10 +383,10 @@
//
void CThumbnailRequestActive::ReleaseServerBitmap()
{
- TN_DEBUG1( "CThumbnailRequestActive::ReleaseServerBitmap");
-
if ( iBitmapHandle && iSession.Handle())
{
+ TN_DEBUG1( "CThumbnailRequestActive::ReleaseServerBitmap");
+
iSession.ReleaseBitmap( iBitmapHandle );
iBitmapHandle = 0;
}
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/group/thumbnailserver.mmp Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/group/thumbnailserver.mmp Fri Feb 19 23:07:36 2010 +0200
@@ -49,19 +49,22 @@
SOURCE thumbnaildiskunmountobserver.cpp
SOURCE thumbnailcenrep.cpp
SOURCE thumbnailmemorycardobserver.cpp
-SOURCE tmshutdownobserver.cpp
SOURCE thumbnaildecodetask.cpp
#ifdef RD_MDS_2_5
SOURCE thumbnailmdsquerytask.cpp
#endif // RD_MDS_2_5
-SOURCE tnmgetimei.cc
-SOURCE thumbnailformatobserver.cpp
+SOURCE tmgetimei.cpp
+
+SOURCEPATH ../../tmcommon/src
+SOURCE tmshutdownobserver.cpp
+SOURCE tmformatobserver.cpp
// Default system include paths for middleware layer modules.
MW_LAYER_SYSTEMINCLUDE
USERINCLUDE ../inc
USERINCLUDE ../../inc
+USERINCLUDE ../../tmcommon/inc
LIBRARY fbscli.lib
LIBRARY euser.lib
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailgeneratetask.h Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailgeneratetask.h Fri Feb 19 23:07:36 2010 +0200
@@ -134,6 +134,8 @@
* @param aOriginalSize Original size of bitmap.
*/
void CreateBlackListedL( const TSize& aOriginalSize );
+
+ void DoBlacklisting( const TInt aError, const TSize& aOriginalSize );
private:
// Data
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h Fri Feb 19 23:07:36 2010 +0200
@@ -32,6 +32,7 @@
#include "thumbnailmanagerconstants.h" // TThumbnailServerRequestId
#include "thumbnailstore.h" // TThumbnailPersistentSize
#include "tmshutdownobserver.h"
+#include "tmformatobserver.h"
// Needed for creating server thread.
const TUint KDefaultHeapSize = 160 * 1024;
@@ -44,7 +45,6 @@
class CThumbnailServerSession;
class CThumbnailDiskUnmountObserver;
class CThumbnailMemoryCardObserver;
-class CThumbnailFormatObserver;
/**
* Helper function to destroy all objects which are referred to
@@ -75,7 +75,8 @@
*/
NONSHARABLE_CLASS( CThumbnailServer ): public CPolicyServer,
public MMdESessionObserver,
- public MTMShutdownObserver
+ public MTMShutdownObserver,
+ public MTMFormatObserver
{
public:
@@ -135,6 +136,9 @@
// from MTMShutdownObserver
void ShutdownNotification();
+ //From MTMFormatObserver
+ void FormatNotification(TBool aFormat);
+
/**
* Adds bitmap to bitmap pool. Server assumes ownership of the bitmap and
* implements reference counting to know when it is safe to delete
@@ -144,9 +148,10 @@
* @since S60 v5.0
* @param aSession Server side session which owns the bitmap.
* @param aBitmap Bitmap to be added to pool.
+ * @param aRequestId Session specific thumbnail request ID.
*/
void AddBitmapToPoolL( CThumbnailServerSession* aSession, CFbsBitmap*
- aBitmap );
+ aBitmap, TThumbnailServerRequestId aRequestId );
/**
* Store thumbnail.
@@ -572,6 +577,12 @@
* Not own.
*/
CFbsBitmap* iBitmap;
+
+ /**
+ * Request Id
+ */
+ TThumbnailRequestId iRequestId;
+
};
private:
@@ -650,7 +661,7 @@
CThumbnailMemoryCardObserver* iMMCObserver;
- CThumbnailFormatObserver* iFormatObserver;
+ CTMFormatObserver* iFormatObserver;
/**
* Databases for each drive, identified by drive (EDriveC, etc).
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserversession.h Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserversession.h Fri Feb 19 23:07:36 2010 +0200
@@ -256,12 +256,19 @@
/**
* Update thumbnails by Thumbnail ID.
*
- *
* @since S60 v5.0
* @param aMessage Message.
*/
void UpdateThumbnailsL( const RMessage2& aMessage );
+ /**
+ * Checks if client thread is still alive and RMessage2 handle valid.
+ *
+ * @since S60 v5.0
+ * @param aMessage Message.
+ */
+ TBool ClientThreadAlive(RMessage2& aMessage);
+
private:
// data
/**
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailsql.h Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailsql.h Fri Feb 19 23:07:36 2010 +0200
@@ -235,8 +235,8 @@
_LIT8( KThumbnailUpdateIdByPath, "UPDATE ThumbnailInfo SET TNId = :TNId WHERE Path = :Path" );
//qyery Modification timestamp by ID
-_LIT8( KThumbnailSelectModifiedByID, "SELECT Modified FROM ThumbnailInfo WHERE TNId = :TNId AND ThumbFromPath = 1 LIMIT 1" );
-_LIT8( KThumbnailSelectTempModifiedByID, "SELECT Modified FROM TempThumbnailInfo WHERE TNId = :TNId AND ThumbFromPath = 1 LIMIT 1");
+_LIT8( KThumbnailSelectModifiedByID, "SELECT Modified FROM ThumbnailInfo WHERE TNId = :TNId AND ThumbFromPath = 1" );
+_LIT8( KThumbnailSelectTempModifiedByID, "SELECT Modified FROM TempThumbnailInfo WHERE TNId = :TNId AND ThumbFromPath = 1");
//query Modification timestamp by path
_LIT8( KThumbnailSelectModifiedByPath, "SELECT Modified FROM ThumbnailInfo WHERE Path = :Path" );
@@ -251,6 +251,6 @@
_LIT8 ( KGetDataRowID, "SELECT MAX (ThumbnailInfoData.rowID) FROM ThumbnailInfoData" );
//remove KThumbnailDbFlagBlacklisted flag
-_LIT8( KThumbnailRemoveBlacklistedFlag, "UPDATE ThumbnailInfo SET Flags = Flags & ~:Flag WHERE Flags & :Flag" );
+_LIT8( KThumbnailTouchBlacklistedRows, "UPDATE ThumbnailInfo SET Modified = 0 WHERE Flags & :Flag" );
#endif // THUMBNAILSQL_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailstore.h Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailstore.h Fri Feb 19 23:07:36 2010 +0200
@@ -25,7 +25,6 @@
#include "thumbnailcenrep.h"
#include "thumbnailmanagerconstants.h"
#include "thumbnaillog.h"
-#include "thumbnailserver.h"
class RFs;
class CFbsBitmap;
@@ -551,10 +550,10 @@
void CheckModifiedByIdL( TUint32 aId, TBool aTempTable, TBool& aModified );
/**
- * Removes blacklisted flag from all entrys
+ * Touches blacklisted items
*
*/
- void RemoveDbFlagL(TThumbnailDbFlags aFlag);
+ void PrepareBlacklistedItemsForRetry();
public : // From MThumbnailStoreDiskSpaceNotifierObserver
void HandleDiskSpaceNotificationL(TBool aDiskFull);
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailtask.h Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailtask.h Fri Feb 19 23:07:36 2010 +0200
@@ -177,6 +177,14 @@
* @since S60 v5.0
*/
virtual void Continue();
+
+ /**
+ * Checks if client thread is still alive and RMessage2 handle valid.
+ *
+ * @since S60 v5.0
+ * @param aGetThread Need to get thread first.
+ */
+ TBool ClientThreadAlive(const TBool aGetThread = ETrue);
protected:
// data
@@ -205,6 +213,8 @@
* Message.
*/
RMessage2 iMessage;
+
+ RThread iClientThread;
};
#endif // THUMBNAILTASK_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/tmgetimei.h Fri Feb 19 23:07:36 2010 +0200
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2009 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: Helper class to get IMEI number.
+*
+*/
+
+#ifndef TMGETIMEI_H
+#define TMGETIMEI_H
+
+#include <e32base.h>
+#include <etel3rdparty.h>
+
+#include "thumbnailmanagerconstants.h"
+
+class CTMGetImei: public CActive
+ {
+ private:
+ CTelephony *iTelephony;
+ CTelephony::TPhoneIdV1 iV1;
+ TBuf<KImeiBufferSize> iImei;
+ CActiveSchedulerWait iAsw;
+ public:
+ virtual ~CTMGetImei();
+ static CTMGetImei* NewL();
+ static CTMGetImei* NewLC();
+ TBuf<KImeiBufferSize> GetIMEI();
+
+ void DoCancel();
+
+ void RunL();
+
+ private:
+ CTMGetImei(): CActive(EPriorityStandard), iTelephony(NULL)
+ {}
+ void ConstructL();
+ };
+
+#endif //TNMGETIMEI_H
+
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnaildecodetask.cpp Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnaildecodetask.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -141,9 +141,9 @@
return;
}
- if ( iMessage.Handle())
+ if ( ClientThreadAlive() )
{
- TRAP_IGNORE(iServer.AddBitmapToPoolL( iRequestId.iSession, aBitmap ));
+ TRAP_IGNORE(iServer.AddBitmapToPoolL( iRequestId.iSession, aBitmap, iRequestId ));
const TSize bitmapSize = aBitmap->SizeInPixels();
iBitmapHandle = aBitmap->Handle();
aBitmap = NULL;
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailgeneratetask.cpp Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailgeneratetask.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -20,7 +20,6 @@
#include <fbs.h>
#include <thumbnailmanager.h>
-
#include "thumbnailgeneratetask.h"
#include "thumbnailscaletask.h"
#include "thumbnailprovider.h"
@@ -158,17 +157,23 @@
{
iProvider->SetTargetSize( croppedTargetSize );
}
-
+
+ TInt providerErr;
+
if ( !iBuffer )
{
- iProvider->GetThumbnailL( iServer.Fs(), iFile, iMimeType, iFlags,
- iDisplayMode, iQualityPreference );
+ TRAP(providerErr, iProvider->GetThumbnailL( iServer.Fs(), iFile, iMimeType, iFlags,
+ iDisplayMode, iQualityPreference ) );
}
else
{
- iProvider->GetThumbnailL( iServer.Fs(), iBuffer, iMimeType, iFlags,
- iDisplayMode, iQualityPreference );
+ TRAP( providerErr, iProvider->GetThumbnailL( iServer.Fs(), iBuffer, iMimeType, iFlags,
+ iDisplayMode, iQualityPreference ));
}
+
+ DoBlacklisting( providerErr, TSize(0,0) );
+
+ User::LeaveIfError( providerErr );
}
@@ -277,23 +282,9 @@
{
delete aBitmap;
aBitmap = NULL;
- // Create a temporary bitmap of size 1 for storing blacklisted thumbnail
- // Because no actual bitmap data is generated, there is no reason to
- // add bitmap to server bitmap pool. Completion of client request with
- // error code just results in applications showing their default bitmap.
- if( iFilename != KNullDesC || iTargetUri != KNullDesC )
- {
- if ( aError == KErrNotSupported ||
- aError == KErrCorrupt ||
- aError == KErrCompletion)
- {
- TRAPD( err, CreateBlackListedL( aOriginalSize ) );
- if (err != KErrNone)
- {
- TN_DEBUG2( "CThumbnailGenerateTask::ThumbnailProviderReady() - blacklisting failed with code %d", err );
- }
- }
- }
+
+ DoBlacklisting( aError, aOriginalSize );
+
Complete( aError );
}
else
@@ -324,7 +315,7 @@
__ASSERT_DEBUG(( aBitmap ), ThumbnailPanic( EThumbnailNullPointer ));
CleanupStack::PushL( aBitmap );
- iServer.AddBitmapToPoolL( iRequestId.iSession, aBitmap );
+ iServer.AddBitmapToPoolL( iRequestId.iSession, aBitmap, iRequestId );
// Keep pointer so we can delete bitmap from pool
iBitmap = aBitmap;
@@ -476,6 +467,7 @@
//
void CThumbnailGenerateTask::CreateBlackListedL( const TSize& aOriginalSize )
{
+ TN_DEBUG1( "CThumbnailGenerateTask::CreateBlackListedL()");
CFbsBitmap* tempBitmap = 0;
tempBitmap = new (ELeave) CFbsBitmap();
CleanupStack::PushL( tempBitmap );
@@ -486,6 +478,7 @@
// consider blacklisting all sizes (hence the changes are needed in thumbnail fetching logic too).
// However, decoding of source to thumnail could succeed in other sizes, which makes blacklisting
// of requested size only meaningful.
+
if(iFilename != KNullDesC)
{
iServer.StoreForPathL( iFilename )->StoreThumbnailL(
@@ -499,3 +492,54 @@
CleanupStack::PopAndDestroy( tempBitmap );
}
+
+// ---------------------------------------------------------------------------
+// Checks is blacklisting needed
+// ---------------------------------------------------------------------------
+//
+void CThumbnailGenerateTask::DoBlacklisting( const TInt aError, const TSize& aOriginalSize )
+ {
+ TN_DEBUG1( "CThumbnailGenerateTask::DoBlacklisting()");
+ // Create a temporary bitmap of size 1 for storing blacklisted thumbnail
+ // Because no actual bitmap data is generated, there is no reason to
+ // add bitmap to server bitmap pool. Completion of client request with
+ // error code just results in applications showing their default bitmap.
+ if( aError != KErrNone && (iFilename != KNullDesC || iTargetUri != KNullDesC ))
+ {
+ if ( aError == KErrNotSupported ||
+ aError == KErrCorrupt ||
+ aError == KErrCompletion ||
+ aError == KErrUnderflow)
+ {
+
+ if(iMissingSizes)
+ {
+ TN_DEBUG2( "CThumbnailGenerateTask::DoBlacklisting() - blacklist missing sizes count = %d", iMissingSizes->Count() );
+
+ for ( TInt i( 0 ); i < iMissingSizes->Count(); i++ )
+ {
+ iThumbnailSize = (*iMissingSizes)[ i ].iType;
+ TRAPD( err, CreateBlackListedL( aOriginalSize ) );
+ if (err != KErrNone)
+ {
+ TN_DEBUG3( "CThumbnailGenerateTask::DoBlacklisting() - blacklisting missing size %d failed with code %d", iThumbnailSize, err );
+ }
+ }
+ return;
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbnailGenerateTask::DoBlacklisting() - blacklist single size" );
+ TRAPD( err, CreateBlackListedL( aOriginalSize ) );
+ if (err != KErrNone)
+ {
+ TN_DEBUG2( "CThumbnailGenerateTask::DoBlacklisting() - blacklisting failed with code %d", err );
+ }
+ return;
+ }
+ }
+ TN_DEBUG1( "CThumbnailGenerateTask::DoBlacklisting() - not blacklisted " );
+ }
+}
+
+
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailmdsquerytask.cpp Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailmdsquerytask.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -90,8 +90,8 @@
if( iUpdateToDb)
{
//update IDs to database by Path
- if (iMessage.Handle())
- {
+ if (ClientThreadAlive(EFalse))
+ {
TInt err = iMessage.Read( 0, iRequestParams );
if( err == KErrNone)
{
@@ -101,7 +101,7 @@
}
}
- // return path to client side
+ // return path to client side
ReturnPath(object->Uri());
}
else if (iQueryType == EId )
@@ -119,7 +119,7 @@
else
{
// add Id to message
- if (iMessage.Handle())
+ if (ClientThreadAlive(EFalse))
{
TInt ret = iMessage.Read( 0, iRequestParams );
if( ret == KErrNone)
@@ -134,36 +134,48 @@
// complete the message with a code from which client side
// knows to make a new request using the path
- Complete( KThumbnailErrThumbnailNotFound );
- ResetMessageData();
+ if (ClientThreadAlive(EFalse))
+ {
+ Complete( KThumbnailErrThumbnailNotFound );
+ ResetMessageData();
+ }
}
else
{
TN_DEBUG1( "CThumbnailMDSQueryTask::HandleQueryCompleted() - Don't ever come here" );
- Complete( KErrNotFound );
- ResetMessageData();
+ if (ClientThreadAlive(EFalse))
+ {
+ Complete( KErrNotFound );
+ ResetMessageData();
+ }
}
}
else
{
TN_DEBUG1( "CThumbnailMDSQueryTask::HandleQueryCompleted() - No results." );
- if( iQueryType == EId )
- {
- if( iUpdateToDb)
- {
- TN_DEBUG2( "CThumbnailMDSQueryTask::HandleQueryCompleted() delete %S", &iUri );
- TRAP_IGNORE( iServer.DeleteThumbnailsL( iUri ) );
- }
-
- Complete( KThumbnailErrThumbnailNotFound );
- ResetMessageData();
- }
- else
- {
- Complete( KErrNotFound );
- ResetMessageData();
- }
+ if( iQueryType == EId )
+ {
+ if( iUpdateToDb)
+ {
+ TN_DEBUG2( "CThumbnailMDSQueryTask::HandleQueryCompleted() delete %S", &iUri );
+ TRAP_IGNORE( iServer.DeleteThumbnailsL( iUri ) );
+ }
+
+ if (ClientThreadAlive(EFalse))
+ {
+ Complete( KThumbnailErrThumbnailNotFound );
+ ResetMessageData();
+ }
+ }
+ else
+ {
+ if (ClientThreadAlive(EFalse))
+ {
+ Complete( KErrNotFound );
+ ResetMessageData();
+ }
+ }
}
}
@@ -178,6 +190,15 @@
CThumbnailTask::StartL();
+ // get client thread
+ TInt err = iMessage.Client( iClientThread );
+ if (err != KErrNone)
+ {
+ TN_DEBUG2( "CThumbnailTask(0x%08x)::ClientThreadAlive() - client thread not found", this);
+
+ ResetMessageData();
+ }
+
// start query
iQuery->FindL();
}
@@ -232,20 +253,17 @@
//
void CThumbnailMDSQueryTask::ReturnPath(const TDesC& aUri)
{
- if ( iMessage.Handle())
+ if ( ClientThreadAlive(EFalse) )
{
// add path to message
- if (iMessage.Handle())
+ TInt ret = iMessage.Read( 0, iRequestParams );
+ if(ret == KErrNone)
{
- TInt ret = iMessage.Read( 0, iRequestParams );
- if(ret == KErrNone)
- {
- TThumbnailRequestParams& params = iRequestParams();
- params.iFileName = aUri;
- ret = iMessage.Write( 0, iRequestParams );
- }
+ TThumbnailRequestParams& params = iRequestParams();
+ params.iFileName = aUri;
+ ret = iMessage.Write( 0, iRequestParams );
}
-
+
// complete the message with a code from which client side
// knows to make a new request using the path
Complete( KThumbnailErrThumbnailNotFound );
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailscaletask.cpp Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailscaletask.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -86,7 +86,7 @@
//
void CThumbnailScaleTask::ConstructL()
{
- iServer.AddBitmapToPoolL( NULL, iOwnBitmap );
+ iServer.AddBitmapToPoolL( iRequestId.iSession, iOwnBitmap, iRequestId );
// Successfully added bitmap to pool, we are no longer responsible for
// deleting it directly.
@@ -362,20 +362,22 @@
}
}
- if ( iMessage.Handle() )
+ if ( ClientThreadAlive() )
{
TN_DEBUG1("CThumbnailScaleTask()::StoreAndCompleteL() scaled bitmap handle to params");
- TThumbnailRequestParams& params = iParamsBuf();
- iMessage.ReadL( 0, iParamsBuf );
- params.iBitmapHandle = iScaledBitmap->Handle();
-
+ TThumbnailRequestParams& params = iParamsBuf();
+ iMessage.ReadL( 0, iParamsBuf );
+
// if need to add scaled bitmap to pool
if (iBitmapToPool)
{
TN_DEBUG1("CThumbnailScaleTask()::StoreAndCompleteL() scaled bitmap to pool");
- iServer.AddBitmapToPoolL( iRequestId.iSession, iScaledBitmap );
+
+ params.iBitmapHandle = iScaledBitmap->Handle();
+
+ iServer.AddBitmapToPoolL( iRequestId.iSession, iScaledBitmap, iRequestId );
iScaledBitmapHandle = params.iBitmapHandle;
}
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -35,8 +35,7 @@
#include "thumbnailpanic.h"
#include "thumbnailcenrep.h"
#include "thumbnailmemorycardobserver.h"
-#include "tnmgetimei.h"
-#include "thumbnailformatobserver.h"
+#include "tmgetimei.h"
_LIT8( KThumbnailMimeWildCard, "*" );
@@ -234,10 +233,10 @@
REComSession::ListImplementationsL( TUid::Uid( THUMBNAIL_PROVIDER_IF_UID ),
iPluginInfoArray );
- CTnmgetimei * imeigetter = CTnmgetimei::NewLC();
+ CTMGetImei * imeiGetter = CTMGetImei::NewLC();
- iImei = imeigetter->GetIMEI();
- CleanupStack::PopAndDestroy(imeigetter);
+ iImei = imeiGetter->GetIMEI();
+ CleanupStack::PopAndDestroy(imeiGetter);
iFs.CreatePrivatePath(EDriveC);
iFs.SetSessionToPrivate(EDriveC);
@@ -248,7 +247,7 @@
iMMCObserver = CThumbnailMemoryCardObserver::NewL( this, iFs );
- iFormatObserver = CThumbnailFormatObserver::NewL( this );
+ iFormatObserver = CTMFormatObserver::NewL( *this );
iFormatting = EFalse;
@@ -398,6 +397,33 @@
iSessionCount--;
iProcessor->RemoveTasks(aSession);
+
+ TN_DEBUG2( "CThumbnailServer::DropSession() aSession = 0x%08x", aSession );
+
+ // clean-up bitmap pool
+
+ THashMapIter < TInt, TThumbnailBitmapRef > bpiter( iBitmapPool );
+
+ // const pointer to a non-const object
+ const TThumbnailBitmapRef* ref = bpiter.NextValue();
+
+ while ( ref )
+ {
+
+ TN_DEBUG2( "CThumbnailServer::DropSession() - ref->iSession = 0x%08x", ref->iSession );
+
+ if ( ref->iSession == aSession )
+ {
+ delete ref->iBitmap;
+ bpiter.RemoveCurrent();
+
+ TN_DEBUG2( "CThumbnailServer::DropSession() - deleted bitmap, left=%d",
+ iBitmapPool.Count());
+ }
+ ref = bpiter.NextValue();
+
+ }
+
if ( iSessionCount <= 0 )
{
// rename thread
@@ -432,7 +458,7 @@
// -----------------------------------------------------------------------------
//
void CThumbnailServer::AddBitmapToPoolL( CThumbnailServerSession* aSession,
- CFbsBitmap* aBitmap )
+ CFbsBitmap* aBitmap, TThumbnailServerRequestId aRequestId )
{
if( !aBitmap )
{
@@ -444,6 +470,8 @@
TThumbnailBitmapRef* ptr = iBitmapPool.Find( aBitmap->Handle());
+ TN_DEBUG2( "CThumbnailServer::AddBitmapToPoolL() - id = %d", aRequestId.iRequestId );
+
if ( ptr )
{
ptr->iRefCount++;
@@ -453,7 +481,9 @@
TThumbnailBitmapRef ref;
ref.iBitmap = aBitmap;
ref.iSession = aSession;
- ref.iRefCount = 1; // magic: first reference
+ ref.iRefCount = 1; // magic: first reference
+ ref.iRequestId = aRequestId.iRequestId;
+
iBitmapPool.InsertL( aBitmap->Handle(), ref );
}
@@ -528,6 +558,7 @@
delete ptr->iBitmap;
ptr->iBitmap = NULL;
iBitmapPool.Remove( aHandle );
+ TN_DEBUG2( "CThumbnailServer::DeleteBitmapFromPool -- items left %d", iBitmapPool.Count() );
}
else
{
@@ -538,6 +569,7 @@
}
else
{
+ __ASSERT_DEBUG(( EFalse ), ThumbnailPanic( EThumbnailBitmapNotReleased ));
TN_DEBUG2( "CThumbnailServer::DeleteBitmapFromPool(%d) -- not found!",
aHandle );
}
@@ -741,7 +773,35 @@
//
TInt CThumbnailServer::DequeTask( const TThumbnailServerRequestId& aRequestId )
{
- return iProcessor->RemoveTask( aRequestId );
+
+ TInt error = iProcessor->RemoveTask( aRequestId );
+
+ // clean-up bitmap pool
+
+ THashMapIter < TInt, TThumbnailBitmapRef > bpiter( iBitmapPool );
+
+ // const pointer to a non-const object
+ const TThumbnailBitmapRef* ref = bpiter.NextValue();
+
+ while ( ref )
+ {
+
+ TN_DEBUG2( "CThumbnailServer::DequeTask() - ref->iRequestId = %d", ref->iRequestId );
+
+ if ( ref->iSession == aRequestId.iSession &&
+ ref->iRequestId == aRequestId.iRequestId )
+ {
+ delete ref->iBitmap;
+ bpiter.RemoveCurrent();
+
+ TN_DEBUG2( "CThumbnailServer::DequeTask() - deleted bitmap, left=%d",
+ iBitmapPool.Count());
+ }
+ ref = bpiter.NextValue();
+
+ }
+
+ return error;
}
@@ -875,9 +935,16 @@
TN_DEBUG2( "CThumbnailServer::FetchThumbnailL() store iteration - round == %d ", roundCount++);
CThumbnailStore* const store = (CThumbnailStore*)(*pStore);
- TRAP_IGNORE( store->FetchThumbnailL( aThumbnailId, aThumbnail, aData, aThumbnailSize, aOriginalSize ));
+ TRAPD(err, store->FetchThumbnailL( aThumbnailId, aThumbnail, aData, aThumbnailSize, aOriginalSize ));
- if ( aThumbnail || aData)
+ if( err == KErrCompletion )
+ {
+ // If thumbnail of requested size is blacklisted, fetching is left with KErrCompletion
+ TN_DEBUG1(
+ "CThumbnailServer::FetchThumbnailL() - thumbnail blacklisted" );
+ User::Leave( err );
+ }
+ else if ( aThumbnail || aData)
{ // thumbnail found from DB
TN_DEBUG1( "CThumbnailServer::FetchThumbnailL() found" );
break;
@@ -1529,7 +1596,6 @@
// Closes stores for removable drives
// -----------------------------------------------------------------------------
//
-
void CThumbnailServer::CloseRemovableDrivesL()
{
TDriveList driveList;
@@ -1564,7 +1630,6 @@
// Open Stores for removable drives
// -----------------------------------------------------------------------------
//
-
void CThumbnailServer::OpenRemovableDrivesL()
{
TDriveList driveList;
@@ -1598,9 +1663,27 @@
// Is formatting ongoing
// -----------------------------------------------------------------------------
//
-
TBool CThumbnailServer::IsFormatting()
{
return iFormatting;
}
+// ---------------------------------------------------------------------------
+// CThumbnailServer::FormatNotification
+// Handles a format operation
+// ---------------------------------------------------------------------------
+//
+void CThumbnailServer::FormatNotification( TBool aFormat )
+ {
+ TN_DEBUG2( "CThumbnailServer::FormatNotification(%d)", aFormat );
+
+ if(aFormat)
+ {
+ TRAP_IGNORE( CloseRemovableDrivesL() );
+ }
+ else
+ {
+ TRAP_IGNORE( OpenRemovableDrivesL() );
+ }
+ }
+
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -245,15 +245,56 @@
TBool finished = Server()->UpdateThumbnailsL( params.iThumbnailId, params.iFileName, params.iOrientation, params.iModified );
+ RArray < TThumbnailPersistentSize >* missingSizes = NULL;
+
if (finished)
{
- TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - finished" );
+ // source type
+ TDataType mimeType;
+ TInt sourceType = 0;
+ TInt err = Server()->MimeTypeFromFileExt( params.iFileName, mimeType );
+ TBool missingIDs(EFalse);
+
+ // get missing sizes
+ if ( err == KErrNone && ( params.iControlFlags & EThumbnailGeneratePersistentSizesOnly ) != 0 )
+ {
+ sourceType = Server()->SourceTypeFromMimeType( mimeType );
+
+ missingSizes = new (ELeave) RArray < TThumbnailPersistentSize >;
+ CleanupClosePushL( *missingSizes );
- aMessage.Complete( KErrNone );
+ Server()->GetMissingSizesAndIDsL( params.iFileName, sourceType, *missingSizes, missingIDs);
+
+ if ( missingSizes->Count() == 0)
+ {
+ // all thumbs already exist
+ CleanupStack::PopAndDestroy( missingSizes );
+ delete missingSizes;
+ missingSizes = NULL;
+ }
+ }
+
+ if(!missingSizes)
+ {
+ TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - finished" );
+ aMessage.Complete( KErrNone );
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - some sizes missing..." );
+ }
}
- else
+
+ if(missingSizes || !finished)
{
- TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - need to recreate thumbs" );
+ TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - need to create (some) thumbs" );
+
+ if(missingSizes)
+ {
+ CleanupStack::PopAndDestroy( missingSizes );
+ delete missingSizes;
+ missingSizes = NULL;
+ }
if(Server()->StoreForPathL(params.iFileName)->IsDiskFull())
{
@@ -263,6 +304,10 @@
// need to create new thumbs
aMessage.Complete( KThumbnailErrThumbnailNotFound );
}
+ else
+ {
+ TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - finished" );
+ }
iMessage = RMessage2();
}
@@ -401,7 +446,15 @@
{
TRAPD( err, FetchThumbnailL());
- if ( !err && iBitmap )
+ if( err == KErrCompletion )
+ {
+ // If thumbnail of requested size is blacklisted, fetching is left with KErrCompletion
+ TN_DEBUG1(
+ "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - thumbnail blacklisted" );
+ aMessage.Complete( err );
+ iMessage = RMessage2();
+ }
+ else if ( !err && iBitmap )
{
TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - found existing thumbnail - bitmap " );
@@ -627,7 +680,7 @@
CFbsBitmap* bitmap = new( ELeave )CFbsBitmap();
CleanupStack::PushL( bitmap );
User::LeaveIfError( bitmap->Duplicate( bitmapHandle ) );
- Server()->AddBitmapToPoolL( reqId.iSession, bitmap );
+ Server()->AddBitmapToPoolL( reqId.iSession, bitmap, reqId );
CleanupStack::Pop( bitmap );
iBitmapHandle = bitmap->Handle();
@@ -1006,36 +1059,52 @@
TThumbnailRequestParams& params = iRequestParams();
// in import case store bitmap
- if (params.iTargetUri != KNullDesC)
+ if ( params.iTargetUri != KNullDesC && params.iFileName != KNullDesC &&
+ params.iFileName.CompareF(params.iTargetUri) != 0 )
{
Server()->StoreThumbnailL( params.iTargetUri, iBitmap, iOriginalSize,
- params.iFlags& CThumbnailManager::ECropToAspectRatio, params.iThumbnailSize, params.iThumbnailId );
+ params.iFlags& CThumbnailManager::ECropToAspectRatio,
+ params.iThumbnailSize, params.iThumbnailId,
+ EFalse, EFalse);
}
- // No need to scale, return iBitmap directly
- Server()->AddBitmapToPoolL( this, iBitmap );
- CFbsBitmap* bitmap = iBitmap;
- iBitmap = NULL; // owned by server now
-
- params.iBitmapHandle = bitmap->Handle();
- const TSize bitmapSize = bitmap->SizeInPixels();
+ if ( ClientThreadAlive(iMessage) )
+ {
+ // No need to scale, return iBitmap directly
+
+ TThumbnailServerRequestId &reqId = (TThumbnailServerRequestId&)params.iRequestId;
+ // No need to scale, return iBitmap directly
+ Server()->AddBitmapToPoolL( this, iBitmap, reqId );
+
+ CFbsBitmap* bitmap = iBitmap;
+
+ TN_DEBUG2("CThumbnailServerSession::ProcessBitmapL(), iBitmap handle= 0x%08x", bitmap->Handle());
+
+ iBitmap = NULL; // owned by server now
+
+ params.iBitmapHandle = bitmap->Handle();
+ const TSize bitmapSize = bitmap->SizeInPixels();
+
+ if ( params.iQualityPreference == CThumbnailManager
+ ::EOptimizeForQualityWithPreview && bitmapSize.iWidth <
+ params.iSize.iWidth && bitmapSize.iHeight < params.iSize.iHeight &&
+ bitmapSize.iWidth < iOriginalSize.iWidth && bitmapSize.iHeight <
+ iOriginalSize.iHeight )
+ {
+ // This is a non-scaled preview bitmap
+ params.iControlFlags = EThumbnailPreviewThumbnail;
+ }
- if ( params.iQualityPreference == CThumbnailManager
- ::EOptimizeForQualityWithPreview && bitmapSize.iWidth <
- params.iSize.iWidth && bitmapSize.iHeight < params.iSize.iHeight &&
- bitmapSize.iWidth < iOriginalSize.iWidth && bitmapSize.iHeight <
- iOriginalSize.iHeight )
- {
- // This is a non-scaled preview bitmap
- params.iControlFlags = EThumbnailPreviewThumbnail;
- }
-
- if ( iMessage.Handle() )
- {
iMessage.WriteL( 0, iRequestParams );
+
iMessage.Complete( KErrNone );
iMessage = RMessage2();
}
+ else
+ {
+ delete iBitmap;
+ iBitmap = NULL;
+ }
}
// -----------------------------------------------------------------------------
@@ -1346,4 +1415,48 @@
return e32Err;
}
+// ---------------------------------------------------------------------------
+// CThumbnailServerSession::ClientThreadAlive()
+// Checks if client thread is still alive and RMessage2 handle valid.
+// ---------------------------------------------------------------------------
+//
+TBool CThumbnailServerSession::ClientThreadAlive(RMessage2& aMessage)
+ {
+ if ( aMessage.Handle())
+ {
+ RThread clientThread;
+
+ // get client thread
+ TInt err = aMessage.Client( clientThread );
+ if (err != KErrNone)
+ {
+ TN_DEBUG1( "CThumbnailServerSession::ClientThreadAlive() - client thread not found");
+
+ aMessage = RMessage2();
+
+ return EFalse;
+ }
+
+ // check if client thread alive
+ TExitType exitType = clientThread.ExitType();
+ if( exitType != EExitPending )
+ {
+ TN_DEBUG1( "CThumbnailServerSession::ClientThreadAlive() - client thread died");
+
+ aMessage = RMessage2();
+
+ return EFalse;
+ }
+ else
+ {
+ // all OK
+ return ETrue;
+ }
+ }
+ else
+ {
+ return EFalse;
+ }
+ }
+
// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -194,6 +194,7 @@
pathPtr.Append( driveChar );
pathPtr.Append( KThumbnailDatabaseName );
+ //start disk space monitor
iDiskFullNotifier = CThumbnailStoreDiskSpaceNotifierAO::NewL( *this,
KDiskFullThreshold,
pathPtr );
@@ -274,8 +275,8 @@
//take ownership
UpdateImeiL();
- //Remove blacklist markings
- TRAP_IGNORE( RemoveDbFlagL( KThumbnailDbFlagBlacklisted ) );
+ //Touch blacklisted items
+ TRAP_IGNORE( PrepareBlacklistedItemsForRetry( ) );
}
//check is MMC known
@@ -283,8 +284,8 @@
{
ResetThumbnailIDs();
- //Remove blacklist markings
- TRAP_IGNORE( RemoveDbFlagL( KThumbnailDbFlagBlacklisted ) );
+ //Touch blacklisted items
+ TRAP_IGNORE( PrepareBlacklistedItemsForRetry() );
}
}
@@ -453,22 +454,28 @@
aThumbnail, const TSize& aOriginalSize, TBool /*aCropped*/, const TThumbnailSize aThumbnailSize,
const TThumbnailId aThumbnailId, const TBool aThumbFromPath, TBool aBlackListed )
{
- TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( CFbsBitmap* ) in" );
+ TSize thumbSize = aThumbnail->SizeInPixels();
+ TN_DEBUG5( "CThumbnailStore::StoreThumbnailL( CFbsBitmap ) aThumbnailId = %d, aThumbnailSize = %d, aThumbnailSize(%d,%d) IN", aThumbnailId, aThumbnailSize, thumbSize.iWidth, thumbSize.iHeight );
__ASSERT_DEBUG(( aThumbnail ), ThumbnailPanic( EThumbnailNullPointer ));
+
+ // don't store custom/unknown sizes or zero sizes
+ if(aThumbnailSize == ECustomThumbnailSize || aThumbnailSize == EUnknownThumbnailSize
+ || thumbSize.iWidth <= 0 || thumbSize.iHeight <= 0 )
+ {
+ TN_DEBUG1( "CThumbnailStore::StoreThumbnailL() not stored");
+ return;
+ }
// check for duplicates
TBool exists = FindDuplicateL(aPath, aThumbnailId, aThumbnailSize);
- TSize thumbSize = aThumbnail->SizeInPixels();
for ( TInt i = iPersistentSizes.Count(); --i >= 0; )
{
TThumbnailPersistentSize & persistentSize = iPersistentSizes[i];
- // don't store duplicates or custom/unknown sizes
- if ( !exists && (aThumbnailSize != ECustomThumbnailSize &&
- aThumbnailSize != EUnknownThumbnailSize &&
- thumbSize.iWidth > 0 && thumbSize.iHeight > 0 ))
+ // don't store duplicates or zero sizes
+ if ( !exists )
{
TInt flags = 0;
if ( persistentSize.iCrop )
@@ -1682,43 +1689,57 @@
User::LeaveIfError( stmt.BindInt( paramIndex, aItemId ));
TInt rowStatus = stmt.Next();
-
- //if not found from temp table, look from real table
- if(rowStatus != KSqlAtRow)
- {
- stmt.Close();
- CleanupStack::PopAndDestroy( &stmt );
- CleanupClosePushL( stmt );
-
- User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectModifiedByID ));
-
- paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt.BindInt( paramIndex, aItemId ));
-
- rowStatus = stmt.Next();
- }
-
- TBool modified = EFalse;
-
- if(rowStatus == KSqlAtRow)
- {
- TInt64 oldModified = stmt.ColumnInt64( column );
-
- if (oldModified < aModified)
- {
- TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- timestamp is newer than original" );
- modified = ETrue;
- }
- else if (oldModified > aModified)
- {
- TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- timestamp is older than original" );
- }
- else if (oldModified == aModified)
- {
- TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- timestamp is the same as original" );
- }
- }
+
+ TBool modified = EFalse;
+ TBool checkMain = EFalse;
+
+ TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- temp" );
+
+ while(rowStatus == KSqlAtRow || !checkMain)
+ {
+ if(rowStatus == KSqlAtRow)
+ {
+ TInt64 oldModified = stmt.ColumnInt64( column );
+
+ if (oldModified < aModified)
+ {
+ TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- timestamp is newer than original" );
+ modified = ETrue;
+ break;
+ }
+ else if (oldModified > aModified)
+ {
+ TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- timestamp is older than original" );
+ break;
+ }
+ else if (oldModified == aModified)
+ {
+ TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- timestamp is the same as original" );
+ }
+ }
+
+ rowStatus = stmt.Next();
+
+ //switch to main table if modified not found from temp
+ if(rowStatus != KSqlAtRow && !checkMain && !modified)
+ {
+ TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- main" );
+ //come here only once
+ checkMain = ETrue;
+
+ stmt.Close();
+ CleanupStack::PopAndDestroy( &stmt );
+ CleanupClosePushL( stmt );
+
+ User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailSelectModifiedByID ));
+
+ paramIndex = stmt.ParameterIndex( KThumbnailSqlParamId );
+ User::LeaveIfError( paramIndex );
+ User::LeaveIfError( stmt.BindInt( paramIndex, aItemId ));
+
+ rowStatus = stmt.Next();
+ }
+ }
stmt.Close();
CleanupStack::PopAndDestroy( &stmt );
@@ -2353,25 +2374,24 @@
}
// -----------------------------------------------------------------------------
-// RemoveDbFlagL()
+// PrepareBlacklistedItemsForRetry()
// -----------------------------------------------------------------------------
//
-void CThumbnailStore::RemoveDbFlagL(TThumbnailDbFlags aFlag)
+void CThumbnailStore::PrepareBlacklistedItemsForRetry()
{
- TN_DEBUG1( "CThumbnailStore::RemoveBlacklistedFlag()" );
+ TN_DEBUG1( "CThumbnailStore::PrepareBlacklistedItemsForRetry()" );
RSqlStatement stmt;
CleanupClosePushL( stmt );
- User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailRemoveBlacklistedFlag ));
+ User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailTouchBlacklistedRows ));
TInt paramIndex = stmt.ParameterIndex( KThumbnailSqlParamFlag );
User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt.BindInt( paramIndex, aFlag ));
-
+ User::LeaveIfError( stmt.BindInt( paramIndex, KThumbnailDbFlagBlacklisted ));
TInt err = stmt.Exec();
- TN_DEBUG2( "CThumbnailStore::RemoveBlacklistedFlag() - main table, err=%d", err );
+ TN_DEBUG2( "CThumbnailStore::PrepareBlacklistedItemsForRetry() - main table, err=%d", err );
CleanupStack::PopAndDestroy( &stmt );
}
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtask.cpp Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtask.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -51,6 +51,8 @@
{
Cancel();
CancelMessage();
+
+ iClientThread.Close();
}
@@ -225,4 +227,49 @@
}
}
+// ---------------------------------------------------------------------------
+// CThumbnailTask::ClientThreadAlive()
+// Checks if client thread is still alive and RMessage2 handle valid.
+// ---------------------------------------------------------------------------
+//
+TBool CThumbnailTask::ClientThreadAlive(const TBool aGetThread)
+ {
+ if ( iMessage.Handle())
+ {
+ if (aGetThread)
+ {
+ // get client thread
+ TInt err = iMessage.Client( iClientThread );
+ if (err != KErrNone)
+ {
+ TN_DEBUG2( "CThumbnailTask(0x%08x)::ClientThreadAlive() - client thread not found", this);
+
+ ResetMessageData();
+
+ return EFalse;
+ }
+ }
+
+ // check if client thread alive
+ TExitType exitType = iClientThread.ExitType();
+ if( exitType != EExitPending )
+ {
+ TN_DEBUG2( "CThumbnailTask(0x%08x)::ClientThreadAlive() - client thread died", this);
+
+ ResetMessageData();
+
+ return EFalse;
+ }
+ else
+ {
+ // all OK
+ return ETrue;
+ }
+ }
+ else
+ {
+ return EFalse;
+ }
+ }
+
// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtaskprocessor.cpp Tue Feb 02 00:23:15 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtaskprocessor.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -330,25 +330,6 @@
TN_DEBUG2( "CThumbnailTaskProcessor::TASKPROCESSOR-COUNTER---------- in, Tasks = %d", iTasks.Count() );
#endif
- /*
- // remove completed tasks and run priorised task
- for ( TInt i = 0; i < iTasks.Count(); i++ )
- {
- CThumbnailTask* task = iTasks[i];
- if ( task->State() == CThumbnailTask::EComplete )
- {
- // delete completed task
- delete task;
- iTasks.Remove( i );
-
- // correct the index so that no tasks are skipped
- i--;
- if(i <= -1)
- {
- i = -1;
- }
- }*/
-
// remove completed tasks and run priorised task
for ( TInt i = iTasks.Count(); --i >= 0; )
{
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/tmgetimei.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2009 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: Helper class to get IMEI number.
+*
+*/
+
+
+#include "tmgetimei.h"
+#include "thumbnailmanagerconstants.h"
+
+CTMGetImei* CTMGetImei::NewL()
+ {
+ CTMGetImei *self = CTMGetImei::NewLC();
+ CleanupStack::Pop();
+ return self;
+ }
+
+CTMGetImei* CTMGetImei::NewLC()
+ {
+ CTMGetImei *self = new (ELeave) CTMGetImei();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+void CTMGetImei::ConstructL()
+ {
+ iTelephony = CTelephony::NewL();
+ CActiveScheduler::Add(this);
+ }
+
+CTMGetImei::~CTMGetImei()
+ {
+ Cancel();
+
+ delete iTelephony;
+ }
+
+TBuf<KImeiBufferSize> CTMGetImei::GetIMEI()
+ {
+ CTelephony::TPhoneIdV1Pckg phoneIdPckg( iV1 );
+
+ iTelephony->GetPhoneId( iStatus, phoneIdPckg );
+ SetActive();
+ iAsw.Start();
+ Deque();
+ return iImei;
+ }
+
+void CTMGetImei::DoCancel()
+ {
+ iTelephony->CancelAsync(CTelephony::EGetPhoneIdCancel);
+ }
+
+void CTMGetImei::RunL()
+ {
+ if(iStatus == KErrNone)
+ {
+ iImei = iV1.iSerialNumber;
+ }
+ iAsw.AsyncStop();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/tmcommon/inc/tmactivitymanager.h Fri Feb 19 23:07:36 2010 +0200
@@ -0,0 +1,79 @@
+/*
+* 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: Activity Manager
+ *
+*/
+
+#include <e32base.h>
+
+#ifndef TMACTIVITYMANAGER_H
+#define TMACTIVITYMANAGER_H
+
+
+class MTMActivityManagerObserver
+
+{
+public :
+ virtual void ActivityDetected() = 0;
+ virtual void InactivityDetected() = 0;
+};
+
+
+class CTMActivityManager : public CActive
+
+{
+public:
+
+ /**
+ * Two-phased constructor.
+ *
+ * @since S60 v5.0
+ * @return Instance of CThumbAGProcessor.
+ */
+ static CTMActivityManager* NewL(MTMActivityManagerObserver* aObserver, TInt aTimeout = 60);
+
+ /**
+ * Destructor
+ *
+ * @since S60 v5.0
+ */
+ virtual ~CTMActivityManager();
+ void SetTimeout(TInt aTimeout);
+ void Start();
+ void Reset();
+ void Stop();
+
+
+protected: // from CActive
+ void DoCancel();
+ void RunL();
+ TInt RunError(TInt aError);
+
+protected:
+ CTMActivityManager(MTMActivityManagerObserver* aObserver, TInt aTimeout);
+ void ConstructL();
+
+
+protected:
+ enum TWatch { ENone = 0, EWaitingForInactivity, EWaitingForActivity };
+
+protected:
+ RTimer iTimer;
+ TWatch iWatch;
+ MTMActivityManagerObserver* iObserver; ///The observer of activity status
+ TInt iTimeout; ///Current inactivity period
+
+};
+
+#endif // TMACTIVITYMANAGER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/tmcommon/inc/tmformatobserver.h Fri Feb 19 23:07:36 2010 +0200
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2006 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: Monitors File system for Format events
+*
+*/
+
+
+#ifndef CTMFORMATOBSERVER_H
+#define CTMFORMATOBSERVER_H
+
+#include <babackup.h>
+#include "f32file.h"
+
+
+/**
+ * Observer interface
+ */
+class MTMFormatObserver
+ {
+public:
+
+ virtual void FormatNotification( TBool aFormat ) = 0;
+ };
+
+/**
+ * File System monitor class to monitor for format events
+ *
+ * @lib thumbnailsserver.exe
+ * @since S60 3.0
+ */
+class CTMFormatObserver: public CBase,
+ public MBackupOperationObserver
+ {
+
+public:
+
+ /**
+ * Two-phase constructor
+ * @param aObserver observer to the monitor
+ */
+ static CTMFormatObserver* NewL( MTMFormatObserver& aObserver );
+
+ /**
+ * Two-phase constructor
+ * @param aObserver observer to the monitor
+ */
+ static CTMFormatObserver* NewLC( MTMFormatObserver& aObserver );
+
+ /**
+ * Destructor
+ */
+ virtual ~CTMFormatObserver();
+
+public: // New functions
+
+ /**
+ * Polls for the current monitor status
+ * If an event is happening, it will callback the observer of the event
+ */
+ void PollStatus();
+
+protected: // Base Class
+
+ /*
+ * From MBackupOperationObserver
+ * Notifies this class of the backup event.
+ * MMC App will signal a start / end.
+ */
+ void HandleBackupOperationEventL(const TBackupOperationAttributes& aBackupOperationAttributes);
+
+private:
+
+ /**
+ * C++ constructor
+ * aObserver observer to this event
+ */
+ CTMFormatObserver ( MTMFormatObserver& aObserver );
+
+ /*
+ * Second phased constructor
+ */
+ void ConstructL();
+
+private: // data
+
+ // not own
+ MTMFormatObserver& iObserver;
+
+ CBaBackupSessionWrapper* iBackupSession;
+
+ };
+
+#endif // CTMFORMATOBSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/tmcommon/inc/tmshutdownobserver.h Fri Feb 19 23:07:36 2010 +0200
@@ -0,0 +1,108 @@
+/*
+* 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: TM Shutdown Observer
+ *
+*/
+
+
+#ifndef TMSHUTDOWNOBSERVER_H
+#define TMSHUTDOWNOBSERVER_H
+
+#include <e32base.h>
+#include <w32std.h>
+#include <e32property.h>
+
+
+/**
+ * Observer interface for signaling the need for shutdown
+ */
+class MTMShutdownObserver
+ {
+public:
+
+ virtual void ShutdownNotification() = 0;
+ };
+
+/**
+ * Active object for observing P&S keys
+ *
+ * @since S60 v5.0
+ */
+class CTMShutdownObserver: public CActive
+ {
+public:
+
+ /**
+ * Two-phased constructor.
+ *
+ * @since S60 v5.0
+ * @return Instance of CTMShutdownObserver.
+ */
+ static CTMShutdownObserver* NewL( MTMShutdownObserver& aObserver, const TUid& aKeyCategory,
+ const TInt aPropertyKey, TBool aDefineKey);
+
+ /**
+ * Destructor
+ *
+ * @since S60 v5.0
+ */
+ virtual ~CTMShutdownObserver();
+
+protected:
+
+ /**
+ * Handles an active object's request completion event.
+ *
+ * @since S60 v5.0
+ */
+ void RunL();
+
+ /**
+ * Implements cancellation of an outstanding request.
+ *
+ * @since S60 v5.0
+ */
+ void DoCancel();
+
+private:
+
+ /**
+ * C++ default constructor
+ *
+ * @since S60 v5.0
+ * @return Instance of CTMShutdownObserver.
+ */
+ CTMShutdownObserver( MTMShutdownObserver& aObserver, const TUid& aKeyCategory,
+ const TInt iPropertyKey, TBool aDefineKey);
+
+ /**
+ * Symbian 2nd phase constructor can leave.
+ *
+ * @since S60 v5.0
+ */
+ void ConstructL();
+
+private:
+
+ // not own
+ MTMShutdownObserver& iObserver;
+
+ const TUid& iKeyCategory;
+ RProperty iProperty;
+ TInt iPropertyKey;
+
+ TBool iDefineKey;
+};
+
+#endif // TMSHUTDOWNOBSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -0,0 +1,176 @@
+/*
+* 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: Activity Manager
+*
+*/
+
+#include "tmactivitymanager.h"
+#include "thumbnaillog.h"
+
+// ---------------------------------------------------------------------------
+// CTMActivityManager::NewL()
+// ---------------------------------------------------------------------------
+//
+CTMActivityManager* CTMActivityManager::NewL(MTMActivityManagerObserver* aObserver, TInt aTimeout)
+ {
+ CTMActivityManager* self = new (ELeave) CTMActivityManager(aObserver, aTimeout);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CTMActivityManager::CTMActivityManager()
+// ---------------------------------------------------------------------------
+//
+CTMActivityManager::CTMActivityManager(MTMActivityManagerObserver* aObserver, TInt aTimeout)
+: CActive(CActive::EPriorityHigh), iObserver(aObserver), iTimeout(aTimeout)
+ {
+ CActiveScheduler::Add(this);
+ }
+
+// ---------------------------------------------------------------------------
+// CTMActivityManager::~CTMActivityManager()
+// ---------------------------------------------------------------------------
+//
+CTMActivityManager::~CTMActivityManager()
+ {
+ Cancel();
+ iTimer.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// CTMActivityManager::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CTMActivityManager::ConstructL()
+ {
+ iTimer.CreateLocal();
+ }
+
+// ---------------------------------------------------------------------------
+// CTMActivityManager::SetTimeout()
+// ---------------------------------------------------------------------------
+//
+void CTMActivityManager::SetTimeout(TInt aTimeout)
+ {
+ iTimeout = aTimeout;
+ Reset();
+ }
+
+// ---------------------------------------------------------------------------
+// CTMActivityManager::Reset()
+// ---------------------------------------------------------------------------
+//
+void CTMActivityManager::Reset()
+ {
+ Cancel();
+ Start();
+ }
+
+// ---------------------------------------------------------------------------
+// CTMActivityManager::DoCancel()
+// ---------------------------------------------------------------------------
+void CTMActivityManager::DoCancel()
+ {
+ iTimer.Cancel();
+ iWatch = ENone;
+ }
+
+// ---------------------------------------------------------------------------
+// CTMActivityManager::Start()
+// ---------------------------------------------------------------------------
+//
+void CTMActivityManager::Start()
+ {
+ if (!IsActive())
+ {
+ iWatch = EWaitingForInactivity;
+ iTimer.Inactivity(iStatus, iTimeout);
+ SetActive();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CTMActivityManager::RunL()
+// ---------------------------------------------------------------------------
+//
+void CTMActivityManager::RunL()
+ {
+ if (iStatus == KErrNone)
+ {
+ if (iWatch == EWaitingForInactivity)
+ {
+ TInt inactivity = User::InactivityTime().Int();
+ if (inactivity >= iTimeout)
+ {
+ if (iObserver)
+ {
+ iObserver->InactivityDetected();
+ }
+ if (!IsActive()) //observer might have called a Reset()
+ {
+ iTimer.Inactivity(iStatus,0);
+ iWatch = EWaitingForActivity;
+ }
+ }
+ else
+ {
+ iTimer.Inactivity(iStatus,iTimeout);
+ }
+ }
+ else if (iWatch == EWaitingForActivity)
+ {
+ if (iObserver)
+ {
+ iObserver->ActivityDetected();
+ }
+
+ if (!IsActive()) //observer might have called a Reset()
+ {
+ iTimer.Inactivity(iStatus,iTimeout);
+ iWatch = EWaitingForInactivity;
+ }
+ }
+
+ if (!IsActive()) //observer might have called a Reset()
+ {
+ SetActive();
+ }
+ }
+ else
+ {
+ iWatch = ENone;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CTMActivityManager::RunError()
+// ---------------------------------------------------------------------------
+//
+TInt CTMActivityManager::RunError(TInt aError)
+ {
+ TN_DEBUG1( "CTMActivityManager::RunError()");
+
+ if (aError != KErrNone)
+ {
+ TN_DEBUG2( "CTMActivityManager::RunError = %d", aError );
+ Reset();
+ }
+
+ // nothing to do
+ return KErrNone;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmformatobserver.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2006 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: File System format monitor
+*
+*/
+
+#include "tmformatobserver.h"
+#include "thumbnaillog.h"
+
+#include <e32base.h>
+#include <f32file.h>
+
+
+// ======== MEMBER FUNCTIONS ========
+
+CTMFormatObserver::CTMFormatObserver ( MTMFormatObserver& aObserver ):
+ iObserver( aObserver )
+ {
+ TN_DEBUG1( "CTMFormatObserver::CTMFormatObserver()");
+ }
+
+
+// ---------------------------------------------------------------------------
+// Second Phase Constructor
+// ---------------------------------------------------------------------------
+//
+void CTMFormatObserver::ConstructL()
+ {
+ TN_DEBUG1("CTMFormatObserver::ConstructL");
+
+ iBackupSession = CBaBackupSessionWrapper::NewL();
+ iBackupSession->RegisterBackupOperationObserverL( *this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Two-Phased Constructor
+// ---------------------------------------------------------------------------
+//
+CTMFormatObserver* CTMFormatObserver::NewL( MTMFormatObserver& aObserver )
+ {
+ CTMFormatObserver* self = CTMFormatObserver::NewLC( aObserver );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Two-Phased Constructor
+// ---------------------------------------------------------------------------
+//
+CTMFormatObserver* CTMFormatObserver::NewLC( MTMFormatObserver& aObserver )
+ {
+ CTMFormatObserver* self = new( ELeave ) CTMFormatObserver( aObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// destructor
+// ---------------------------------------------------------------------------
+//
+CTMFormatObserver::~CTMFormatObserver()
+ {
+ if( iBackupSession )
+ {
+ iBackupSession->DeRegisterBackupOperationObserver( *this );
+ }
+
+ delete iBackupSession;
+ }
+
+// ---------------------------------------------------------------------------
+// Checks the current status
+// ---------------------------------------------------------------------------
+//
+void CTMFormatObserver::PollStatus()
+ {
+ TN_DEBUG1("CTMFormatObserver::PollStatus()");
+
+ TBool formatting = iBackupSession->IsBackupOperationRunning();
+
+ if( formatting )
+ {
+ iObserver.FormatNotification(ETrue);
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbnailFormatObserver::HandleBackupOperationEventL
+// Handles a format operation
+// ---------------------------------------------------------------------------
+//
+void CTMFormatObserver::HandleBackupOperationEventL(
+ const TBackupOperationAttributes& aBackupOperationAttributes)
+ {
+ TN_DEBUG1("CTMFormatObserver::HandleBackupOperationEventL");
+
+ if( aBackupOperationAttributes.iOperation == EStart )
+ {
+ iObserver.FormatNotification(ETrue);
+ }
+ else // TOperationType::EEnd or TOperationType::EAbort
+ {
+ iObserver.FormatNotification(EFalse);
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmshutdownobserver.cpp Fri Feb 19 23:07:36 2010 +0200
@@ -0,0 +1,119 @@
+/*
+* 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: Processor
+*
+*/
+
+
+#include <e32base.h>
+
+#include "tmshutdownobserver.h"
+#include "thumbnailmanagerconstants.h"
+
+// ---------------------------------------------------------------------------
+// CTMShutdownObserver::NewL()
+// ---------------------------------------------------------------------------
+//
+CTMShutdownObserver* CTMShutdownObserver::NewL( MTMShutdownObserver& aObserver,
+ const TUid& aKeyCategory,
+ const TInt aPropertyKey,
+ TBool aDefineKey)
+ {
+ CTMShutdownObserver* self = new( ELeave )CTMShutdownObserver( aObserver,
+ aKeyCategory,
+ aPropertyKey,
+ aDefineKey);
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CTMShutdownObserver::CTMShutdownObserver()
+// ---------------------------------------------------------------------------
+//
+CTMShutdownObserver::CTMShutdownObserver( MTMShutdownObserver& aObserver,
+ const TUid& aKeyCategory,
+ const TInt aPropertyKey,
+ TBool aDefineKey)
+ : CActive( CActive::EPriorityStandard ), iObserver( aObserver ),
+ iKeyCategory( aKeyCategory ), iPropertyKey(aPropertyKey), iDefineKey( aDefineKey )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// ---------------------------------------------------------------------------
+// CTMShutdownObserver::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CTMShutdownObserver::ConstructL()
+ {
+ // define P&S property types
+ if (iDefineKey)
+ {
+ RProperty::Define(iKeyCategory,iPropertyKey,
+ RProperty::EInt,KAllowAllPolicy,KPowerMgmtPolicy);
+ }
+
+ // attach to the property
+ TInt err = iProperty.Attach(iKeyCategory,iPropertyKey,EOwnerThread);
+ User::LeaveIfError(err);
+
+ // wait for the previously attached property to be updated
+ iProperty.Subscribe(iStatus);
+ SetActive();
+ }
+
+// ---------------------------------------------------------------------------
+// CTMShutdownObserver::~CTMShutdownObserver()
+// ---------------------------------------------------------------------------
+//
+CTMShutdownObserver::~CTMShutdownObserver()
+ {
+ Cancel();
+ iProperty.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// CTMShutdownObserver::RunL()
+// ---------------------------------------------------------------------------
+//
+void CTMShutdownObserver::RunL()
+ {
+ // resubscribe before processing new value to prevent missing updates
+ iProperty.Subscribe(iStatus);
+ SetActive();
+
+ // retrieve the value
+ TInt value = 0;
+ iProperty.Get(value);
+
+ // observer callback
+ if (value)
+ {
+ iObserver.ShutdownNotification();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CTMShutdownObserver::DoCancel()
+// ---------------------------------------------------------------------------
+//
+void CTMShutdownObserver::DoCancel()
+ {
+ iProperty.Cancel();
+ }
+
+// End of file