--- a/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager.h Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager.h Thu Jul 22 16:37:07 2010 +0100
@@ -26,6 +26,7 @@
#include <thumbnailobjectsource.h>
class MThumbnailManagerObserver;
+class MThumbnailManagerRequestObserver;
typedef TInt TThumbnailRequestId;
@@ -43,9 +44,13 @@
EAudioGridThumbnailSize,
EAudioListThumbnailSize,
EAudioFullScreenThumbnailSize,
+EContactGridThumbnailSize,
+EContactListThumbnailSize,
+EContactFullScreenThumbnailSize,
EGridThumbnailSize,
EListThumbnailSize,
-EFullScreenThumbnailSize
+EFullScreenThumbnailSize,
+EThumbnailSizeCount //last item, don't remove
} TThumbnailSize;
/**
* Thumbnail engine.
@@ -413,8 +418,7 @@
* @return Symbian OS error code or KErrNone if change was
* successful.
*/
- virtual TInt ChangePriority( TThumbnailRequestId aId, TInt aNewPriority ) =
- 0;
+ virtual TInt ChangePriority( TThumbnailRequestId aId, TInt aNewPriority ) = 0;
/**
* Get a list of supported file formats for object files.
@@ -566,6 +570,21 @@
virtual TThumbnailRequestId RenameThumbnailsL( const TDesC& aCurrentPath,
const TDesC& aNewPath, TInt aPriority = CActive::EPriorityIdle ) = 0;
+ /**
+ * Set optional request observer for getting information about completed
+ * requests that don't include a thumbnail.
+ *
+ * @since Symbian^3
+ * @param aObserver Observer to receive notifications.
+ */
+ virtual void SetRequestObserver( MThumbnailManagerRequestObserver& aObserver ) = 0;
+
+ /**
+ * Remove optional request observer.
+ *
+ * @since Symbian^3
+ */
+ virtual void RemoveRequestObserver() = 0;
};
#endif // THUMBNAILMANAGER_H
--- a/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager_qt.h Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager_qt.h Thu Jul 22 16:37:07 2010 +0100
@@ -19,14 +19,17 @@
#define THUMBNAILMANAGER_QT_H
#include <QObject>
-#include <qpixmap>
+#include <QPixmap>
#include <QImage>
+
#include <QtGlobal>
-class ThumbnailManagerPrivate;
class QString;
class QSize;
+class ThumbnailManagerPrivate;
+class TestThumbnailManager;
+
#ifdef TNMQT_DLL
# define TNM_EXPORT Q_DECL_EXPORT
#else
@@ -43,7 +46,6 @@
public:
-
/** Thumbnail size. */
enum ThumbnailSize
{
@@ -256,6 +258,25 @@
*/
TNM_EXPORT int setThumbnail( const QImage& source, const QString& fileName,
void * clientData = NULL, int priority = tnmWrapperPriorityIdle );
+
+ /**
+ * Set a thumbnail for an object file generated from source file.
+ * thumbnailReady() signal will be emited when the operation is complete.
+ *
+ * @param sourceFileName Source file name from which the thumbnail will be created
+ * @param targetFileName Target file name
+ * @param clientData Pointer to arbitrary client data.
+ * This pointer is not used by the API for
+ * anything other than returning it in the
+ * ThumbnailReady callback.
+ * @param priority Priority for this operation
+ * @return Thumbnail request ID or -1 if request failed. This can be used to
+ * cancel the request or change priority.
+ *
+ */
+ TNM_EXPORT int setThumbnail( const QString& sourceFileName, const QString& targetFileName,
+ const QString& mimeType = QString(""), void * clientData = NULL,
+ int priority = tnmWrapperPriorityIdle );
/**
* Delete all thumbnails for a given object. This is an asynchronous
@@ -300,7 +321,7 @@
* @param id Request ID for the operation
* @param errorCode error code
*/
- void thumbnailReady( QPixmap , void * , int , int );
+ TNM_EXPORT void thumbnailReady( QPixmap , void * , int , int );
/**
* Final thumbnail bitmap generation or loading is complete.
@@ -310,7 +331,7 @@
* @param id Request ID for the operation
* @param errorCode error code
*/
- void thumbnailReady( QImage , void * , int , int );
+ TNM_EXPORT void thumbnailReady( QImage , void * , int , int );
protected:
@@ -320,6 +341,9 @@
private:
ThumbnailManagerPrivate* d;
+
+ friend class ThumbnailManagerPrivate;
+ friend class TestThumbnailManager;
};
#endif // THUMBNAILMANAGER_QT
--- a/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanagerobserver.h Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanagerobserver.h Thu Jul 22 16:37:07 2010 +0100
@@ -101,4 +101,37 @@
TThumbnailRequestId aId ) = 0;
};
+/** Thumbnail request types */
+enum TThumbnailRequestType
+ {
+ ERequestDeleteThumbnails = 0
+ };
+
+/**
+ * Optional callback interface for getting information about other completed
+ * requests that don't include a thumbnail.
+ *
+ * Request types:
+ * - ERequestDeleteThumbnails
+ *
+ * Can be added using SetRequestObserver(MThumbnailManagerRequestObserver& aObserver)
+ * and removed using RemoveRequestObserver().
+ *
+ * @since Symbian^3
+ */
+class MThumbnailManagerRequestObserver
+ {
+public:
+ /**
+ * A request is complete.
+ *
+ * @since Symbian^3
+ * @param aError Error code.
+ * @param aRequestType Type of the completed request.
+ * @param aId Request ID for the operation.
+ */
+ virtual void ThumbnailRequestReady( TInt aError, TThumbnailRequestType aRequestType,
+ TThumbnailRequestId aId ) = 0;
+};
+
#endif // THUMBNAILMANAGEROBSERVER_H
--- a/imagehandling_plat/thumbnailmanager_api/inc/thumbnailobjectsource.h Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandling_plat/thumbnailmanager_api/inc/thumbnailobjectsource.h Thu Jul 22 16:37:07 2010 +0100
@@ -134,6 +134,45 @@
*/
void ConstructL( const RFile64& aFile, const TDesC& aMimeType );
+ /**
+ * Symbian 2nd phase constructor can leave.
+ *
+ * @since S60 v5.0
+ * @param aURI URI.
+ * @param aMimeType MimeType.
+ * @param aThumbnailId ThumbnailId
+ */
+ void ConstructL( const TDesC& aUri, const TDesC& aMimeType, TThumbnailId aThumbnailId );
+
+ /**
+ * Symbian 2nd phase constructor can leave.
+ *
+ * @since S60 v5.0
+ * @param aBitmap Bitmap.
+ * @param aURI URI.
+ */
+ void ConstructL( CFbsBitmap* aBitmap, const TDesC& aUri );
+
+ /**
+ * Symbian 2nd phase constructor can leave.
+ *
+ * @since S60 v5.0
+ * @param aBuffer Buffer.
+ * @param aMimeType MIME type. Optional, but should be specified if known.
+ * @param aURI URI.
+ */
+ void ConstructL( TDesC8* aBuffer, const TDesC& aMimeType, const TDesC& aUri );
+
+ /**
+ * Symbian 2nd phase constructor can leave.
+ *
+ * @since Symbian^3
+ * @param aUri Object URI or a full path to a file in the file system.
+ * @param aTargetUri For linking the thumbnail to a different URI.
+ * @param aMimeType MIME type. Optional, but should be specified if known.
+ */
+ void ConstructL( const TDesC& aUri, const TDesC& aTargetUri, const TDesC& aMimeType );
+
private:
// data
@@ -160,25 +199,19 @@
/**
* Bitmap
*/
-
CFbsBitmap* iBitmap; // own
/**
* ThumbnailId
- */
+ */
+ TThumbnailId iThumbnailId; //own
- TThumbnailId iThumbnailId; //own
+ /**
+ * Uri
+ */
+ HBufC* iTargetUri; // own
public:
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- * @param aURI URI.
- * @param aMimeType MimeType.
- * @param aThumbnailId ThumbnailId
- */
- void ConstructL( const TDesC& aUri, const TDesC& aMimeType, TThumbnailId aThumbnailId );
/**
* Construct a new CThumbnailObjectSource referring to a buffer
@@ -211,7 +244,8 @@
* @since S60 v5.0
* @return New CThumbnailObjectSource instance.
*/
- IMPORT_C static CThumbnailObjectSource* NewL( TDesC8* aBuffer, TDesC& aMimeType, const TDesC& aUri );
+ IMPORT_C static CThumbnailObjectSource* NewL( TDesC8* aBuffer, TDesC& aMimeType,
+ const TDesC& aUri );
/**
* Construct a new CThumbnailObjectSource referring to a buffer
@@ -223,7 +257,8 @@
* @since S60 v5.0
* @return New CThumbnailObjectSource instance.
*/
- IMPORT_C static CThumbnailObjectSource* NewLC( TDesC8* aBuffer, TDesC& aMimeType, const TDesC& aUri);
+ IMPORT_C static CThumbnailObjectSource* NewLC( TDesC8* aBuffer, TDesC& aMimeType,
+ const TDesC& aUri);
/**
* Construct a new CThumbnailObjectSource referring to an URI.
@@ -233,7 +268,7 @@
* @return New CThumbnailObjectSource instance.
*/
IMPORT_C static CThumbnailObjectSource* NewL( const TDesC& aUri,
- TThumbnailId aThumbnailId = 0, const TDesC& aMimeType = KNullDesC );
+ TThumbnailId aThumbnailId = 0, const TDesC& aMimeType = KNullDesC );
/**
* Construct a new CThumbnailObjectSource referring to an URI.
@@ -243,9 +278,8 @@
* @return New CThumbnailObjectSource instance.
*/
IMPORT_C static CThumbnailObjectSource* NewLC( const TDesC& aUri,
- TThumbnailId aThumbnailId = 0, const TDesC& aMimeType = KNullDesC );
-
-
+ TThumbnailId aThumbnailId = 0, const TDesC& aMimeType = KNullDesC );
+
/**
* Returns source buffer.
*
@@ -276,30 +310,8 @@
*
* @since S60 v5.0
* @return ThumbnailId
- */
-
- IMPORT_C TThumbnailId Id();
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- * @param aBitmap Bitmap.
- * @param aURI URI.
- */
- void ConstructL( CFbsBitmap* aBitmap, const TDesC&
- aUri );
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- * @param aBuffer Buffer.
- * @param aMimeType MIME type. Optional, but should be specified if known.
- * @param aURI URI.
- */
- void ConstructL( TDesC8* aBuffer, const TDesC&
- aMimeType, const TDesC& aUri );
+ */
+ IMPORT_C TThumbnailId Id();
/**
* Returns source bitmap.
@@ -317,6 +329,36 @@
* @return bitmap
*/
IMPORT_C CFbsBitmap* GetBitmapOwnership();
+
+ /**
+ * Construct a new CThumbnailObjectSource referring to an URI.
+ * @param aUri Object URI or a full path to a file in the file system.
+ * @param aTargetUri For linking the thumbnail to a different URI.
+ * @param aMimeType MIME type. Optional, but should be specified if known.
+ * @since Symbian^3
+ * @return New CThumbnailObjectSource instance.
+ */
+ IMPORT_C static CThumbnailObjectSource* NewL( const TDesC& aUri,
+ const TDesC& aTargetUri, const TDesC& aMimeType );
+
+ /**
+ * Construct a new CThumbnailObjectSource referring to an URI.
+ * @param aUri Object URI or a full path to a file in the file system.
+ * @param aTargetUri For linking the thumbnail to a different URI.
+ * @param aMimeType MIME type.
+ * @since Symbian^3
+ * @return New CThumbnailObjectSource instance.
+ */
+ IMPORT_C static CThumbnailObjectSource* NewLC( const TDesC& aUri,
+ const TDesC& aTargetUri, const TDesC& aMimeType );
+
+ /**
+ * Returns target uri.
+ *
+ * @since Symbian^3
+ * @return uri
+ */
+ IMPORT_C const TDesC& TargetUri();
};
#endif // THUMBNAILOBJECTSOURCE_H
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/conf/ThumbnailManagerTest.cfg Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandling_plat/thumbnailmanager_api/tsrc/conf/ThumbnailManagerTest.cfg Thu Jul 22 16:37:07 2010 +0100
@@ -37,23 +37,26 @@
// ---------------------------------------------------------------------------
[Define]
-KErrNotFound -1
-KErrNotSupported -5
-KErrArgument -6
+KErrNotFound -1
+KErrGeneral -2
+KErrNotSupported -5
+KErrArgument -6
KMaxTInt 2147483647
// Delay between test cases (milliseconds)
KTestDelay 1000
-KOneSecondDelay 1000
-KFiveSecondDelay 5000
-KTenSecondDelay 5000
+KOneSecondDelay 1000
+KFiveSecondDelay 5000
+KTenSecondDelay 10000
// A delay to make sure the client-server request to generate a thumbnail
// reaches the server, but doesn't have enough time to complete yet
// (milliseconds)
-KClientServerDelay 150
+KClientServerDelay 150
+KClientServerDelay2 25
+KClientServerDelay3 10
// From TDisplayMode: value for 24-bit display mode
EColor16M 8
@@ -81,7 +84,13 @@
EVideoFullScreenThumbnailSize 7
EAudioGridThumbnailSize 8
EAudioListThumbnailSize 9
-EAudioFullScreenThumbnailSize 10
+EAudioFullScreenThumbnailSize 10
+EContactGridThumbnailSize 11
+EContactListThumbnailSize 12
+EContactFullScreenThumbnailSize 13
+EGridThumbnailSize = 14
+EListThumbnailSize = 15
+EFullScreenThumbnailSize = 16
// Custom sizes
KCustomSizeX 111
@@ -600,12 +609,128 @@
pause KTestDelay
[Endtest]
+// ---------------------------------------------------------------------------
+// Create MP3 thumbnail with PNG album art
+// ---------------------------------------------------------------------------
+[Test]
+title Create MP3 thumbnail with PNG album art
+create ThumbnailManagerTest tn
+tn CreateInstanceL
+tn SetDisplayModeL EColor16M
+
+// using path
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\mp3_png.mp3
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EImageGridThumbnailSize
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL ECustomThumbnailSize
+tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
+tn DeleteThumbnails
+tn DeleteSourceInstance
+
+tn DeleteInstance
+delete tn
+pause KTestDelay
+[Endtest]
// ---------------------------------------------------------------------------
-// Thumbs from buffer
+// Create thumbnail preview from JPG with EXIF
// ---------------------------------------------------------------------------
[Test]
-title Thumbs from buffer
+title Create thumbnail preview from JPG with EXIF
+create ThumbnailManagerTest tn
+tn CreateInstanceL
+tn SetDisplayModeL EColor16M
+
+// jpg with exif
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EImageGridThumbnailSize
+tn SetQualityPreferenceL EOptimizeForQualityWithPreview
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
+tn DeleteThumbnails
+tn DeleteSourceInstance
+
+// png with exif
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\exif.png
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EImageGridThumbnailSize
+tn SetQualityPreferenceL EOptimizeForQualityWithPreview
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
+tn DeleteThumbnails
+tn DeleteSourceInstance
+
+// no exif
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\no_exif.jpg
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EImageGridThumbnailSize
+tn SetQualityPreferenceL EOptimizeForQualityWithPreview
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
+tn DeleteThumbnails
+tn DeleteSourceInstance
+
+tn DeleteInstance
+delete tn
+pause KTestDelay
+[Endtest]
+
+// ---------------------------------------------------------------------------
+// Create thumbnail from WMA PNG & empty album arts
+// ---------------------------------------------------------------------------
+[Test]
+title Create thumbnail from WMA PNG & empty album arts
+create ThumbnailManagerTest tn
+tn CreateInstanceL
+tn SetDisplayModeL EColor16M
+
+// try to create thumbnail from PNG
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\wma_png.wma
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EAudioFullScreenThumbnailSize
+tn GetThumbnailL
+allownextresult KErrNotFound
+waittestclass tn
+tn DeleteThumbnails
+tn DeleteSourceInstance
+
+// try to create thumbnail without album art
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\wma_empty.wma
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EAudioFullScreenThumbnailSize
+tn GetThumbnailL
+allownextresult KErrNotFound
+waittestclass tn
+tn DeleteThumbnails
+tn DeleteSourceInstance
+
+tn DeleteInstance
+delete tn
+pause KTestDelay
+[Endtest]
+
+
+// ---------------------------------------------------------------------------
+// Create thumbs from buffer
+// ---------------------------------------------------------------------------
+[Test]
+title Create thumbs from buffer
create ThumbnailManagerTest tn
tn CreateInstanceL
tn SetDisplayModeL EColor16M
@@ -696,6 +821,77 @@
[Endtest]
// ---------------------------------------------------------------------------
+// Create thumbs from CFbsBitmap
+// ---------------------------------------------------------------------------
+[Test]
+title Create thumbs from CFbsBitmap
+create ThumbnailManagerTest tn
+tn CreateInstanceL
+tn SetDisplayModeL EColor16M
+
+tn SetFlagsL EDefaultFlags
+tn CreateSourceInstanceBitmapL \data\ThumbnailManagerTest\TestMBM.mbm \data\ThumbnailManagerTest\camera.jpg
+tn DeleteThumbnails
+tn CreateThumbnails
+waittestclass tn
+
+pause KTenSecondDelay
+
+tn DeleteSourceInstance
+
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\camera.jpg
+tn SetFlagsL EDoNotCreate
+tn SetThumbnailEnumSizeL EImageGridThumbnailSize
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
+tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
+tn DeleteThumbnails
+tn DeleteSourceInstance
+
+tn DeleteInstance
+delete tn
+pause KTestDelay
+[Endtest]
+
+
+// ---------------------------------------------------------------------------
+// Create image/audio/video thumbs
+// ---------------------------------------------------------------------------
+[Test]
+title Create image/audio/video thumbs
+create ThumbnailManagerTest tn
+tn CreateInstanceL
+tn SetDisplayModeL EColor16M
+
+// try to create thumbnail from image
+tn CreateThumbnailsByUrlL \data\ThumbnailManagerTest\RGB_VGA.jpg
+waittestclass tn
+tn DeleteThumbnails
+tn DeleteSourceInstance
+
+// try to create thumbnail from music
+tn CreateThumbnailsByUrlL \data\ThumbnailManagerTest\mp3_png.mp3
+waittestclass tn
+tn DeleteThumbnails
+tn DeleteSourceInstance
+
+// try to create thumbnail from video
+tn CreateThumbnailsByUrlL \data\ThumbnailManagerTest\Videoclip.mp4
+waittestclass tn
+tn DeleteThumbnails
+tn DeleteSourceInstance
+
+tn DeleteInstance
+delete tn
+pause KTestDelay
+[Endtest]
+
+
+// ---------------------------------------------------------------------------
// Create thumbnails for each persistent size
// ---------------------------------------------------------------------------
[Test]
@@ -829,80 +1025,6 @@
pause KTestDelay
[Endtest]
-
-// ---------------------------------------------------------------------------
-// Thumbnail from missing or unsupported file
-// ---------------------------------------------------------------------------
-[Test]
-title Thumbnail from missing or unsupported file
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\does_not_exist.jpg
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\Unsupported.txt
-tn GetThumbnailL
-allownextresult KErrNotSupported
-waittestclass tn
-tn DeleteSourceInstance
-
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\Unsupported.txt
-tn GetThumbnailL
-allownextresult KErrNotSupported
-waittestclass tn
-tn DeleteSourceInstance
-
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\Unsupported.txt plain/text
-tn GetThumbnailL
-allownextresult KErrNotSupported
-waittestclass tn
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Thumbnail from corrupt file
-// ---------------------------------------------------------------------------
-[Test]
-title Thumbnail from corrupt file
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\not_jpg.jpg
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-tn DeleteSourceInstance
-
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\not_jpg.jpg image/jpeg
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\not_3gp.3gp
-tn GetThumbnailL
-allownextresult KErrNotSupported
-waittestclass tn
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-
// ---------------------------------------------------------------------------
// Custom size thumbs
// ---------------------------------------------------------------------------
@@ -1592,35 +1714,79 @@
// ---------------------------------------------------------------------------
-// Get thumbnail by id
+// Thumbnail from missing or unsupported file
// ---------------------------------------------------------------------------
[Test]
-title Get thumbnail by id
+title Thumbnail from missing or unsupported file
create ThumbnailManagerTest tn
tn CreateInstanceL
-tn SetDisplayModeL EColor16M
+tn SetThumbnailEnumSizeL ECustomThumbnailSize
+tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg 99999
-tn DeleteThumbnails
-tn CreateThumbnails
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\does_not_exist.jpg
+tn GetThumbnailL
+allownextresult KErrNotFound
waittestclass tn
+tn DeleteSourceInstance
-pause KTenSecondDelay
-
-tn SetFlagsL EDoNotCreate
-tn GetThumbnailByIdL 99999
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\Unsupported.txt
+tn GetThumbnailL
+allownextresult KErrNotSupported
waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
+tn DeleteSourceInstance
+tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\Unsupported.txt
+tn GetThumbnailL
+allownextresult KErrNotSupported
+waittestclass tn
tn DeleteSourceInstance
+
+tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\Unsupported.txt plain/text
+tn GetThumbnailL
+allownextresult KErrNotSupported
+waittestclass tn
+tn DeleteSourceInstance
+
tn DeleteInstance
delete tn
pause KTestDelay
[Endtest]
// ---------------------------------------------------------------------------
+// Thumbnail from corrupt file
+// ---------------------------------------------------------------------------
+[Test]
+title Thumbnail from corrupt file
+create ThumbnailManagerTest tn
+tn CreateInstanceL
+tn SetThumbnailEnumSizeL ECustomThumbnailSize
+tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
+
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\not_jpg.jpg
+tn GetThumbnailL
+allownextresult KErrNotFound
+waittestclass tn
+tn DeleteSourceInstance
+
+tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\not_jpg.jpg image/jpeg
+tn GetThumbnailL
+allownextresult KErrNotFound
+waittestclass tn
+tn DeleteSourceInstance
+
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\not_3gp.3gp
+tn GetThumbnailL
+allownextresult KErrNotSupported
+waittestclass tn
+tn DeleteSourceInstance
+
+tn DeleteInstance
+delete tn
+pause KTestDelay
+[Endtest]
+
+
+// ---------------------------------------------------------------------------
// Set thumbnail from buffer
// ---------------------------------------------------------------------------
[Test]
@@ -1678,72 +1844,47 @@
[Endtest]
// ---------------------------------------------------------------------------
-// Import thumbnail
+// Set thumbnail from path
// ---------------------------------------------------------------------------
[Test]
-title Import thumbnail
+title Set thumbnail from path
create ThumbnailManagerTest tn
tn CreateInstanceL
tn SetDisplayModeL EColor16M
+// normal uri
tn SetFlagsL EDefaultFlags
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn DeleteThumbnails
-tn ImportThumbnailL \data\ThumbnailManagerTest\imported.jpg
+tn CreateSourceInstancePathTargetL \data\ThumbnailManagerTest\RGB_VGA.jpg \data\ThumbnailManagerTest\target.jpg image/jpeg 0 0
+tn SetThumbnailL
+
waittestclass tn
+
tn DeleteSourceInstance
-
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\target.jpg
+tn SetThumbnailEnumSizeL EImageGridThumbnailSize
tn SetFlagsL EDoNotCreate
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\imported.jpg
tn GetThumbnailL
+
waittestclass tn
tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
tn DeleteThumbnails
tn DeleteSourceInstance
+// virtual uri
tn SetFlagsL EDefaultFlags
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_400x300.bmp
-tn DeleteThumbnails
-tn ImportThumbnailL \data\ThumbnailManagerTest\imported.bmp
-waittestclass tn
-tn DeleteSourceInstance
+tn CreateSourceInstancePathTargetL \data\ThumbnailManagerTest\RGB_VGA.jpg \data\ThumbnailManagerTest\target.vcf contact/x-vcard 0 1
+tn SetThumbnailL
-tn SetFlagsL EDoNotCreate
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\imported.bmp
-tn GetThumbnailL
waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-tn SetFlagsL EDefaultFlags
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\WIDE_800x400.gif
-tn DeleteThumbnails
-tn ImportThumbnailL \data\ThumbnailManagerTest\imported.gif
-waittestclass tn
tn DeleteSourceInstance
-
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\target.vcf
+tn SetThumbnailEnumSizeL EContactGridThumbnailSize
tn SetFlagsL EDoNotCreate
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\imported.gif
tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-tn SetFlagsL EDefaultFlags
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\video.3gp
-tn DeleteThumbnails
-tn ImportThumbnailL \data\ThumbnailManagerTest\imported.3gp
waittestclass tn
-tn DeleteSourceInstance
-
-tn SetFlagsL EDoNotCreate
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\imported.3gp
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
+tn CheckThumbnailCenrepL EContactGridThumbnailSize EColor16M
tn DeleteThumbnails
tn DeleteSourceInstance
@@ -1801,77 +1942,105 @@
pause KTestDelay
[Endtest]
+
// ---------------------------------------------------------------------------
-// Delete thumbnails by id
+// Run multiple tests
// ---------------------------------------------------------------------------
[Test]
-title Delete thumbnails by id
+title Run misc multiple tests
create ThumbnailManagerTest tn
tn CreateInstanceL
tn SetDisplayModeL EColor16M
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg 99999
+// using path
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
tn DeleteThumbnails
-tn CreateThumbnails
-waittestclass tn
-
-pause KTenSecondDelay
-
-tn SetFlagsL EDoNotCreate
-tn GetThumbnailByIdL 99999
+tn SetThumbnailEnumSizeL EImageGridThumbnailSize
+tn GetThumbnailL
waittestclass tn
tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL ECustomThumbnailSize
+tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
+tn DeleteThumbnails
+tn DeleteSourceInstance
-tn DeleteThumbnailsByIdL 99999
-pause KOneSecondDelay
+// mp3 using handle
+tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\mp3.mp3
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EAudioGridThumbnailSize
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EAudioGridThumbnailSize EColor16M
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL EAudioFullScreenThumbnailSize
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EAudioFullScreenThumbnailSize EColor16M
+tn DeleteThumbnails
+tn SetThumbnailEnumSizeL ECustomThumbnailSize
+tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
+tn DeleteThumbnails
+tn DeleteSourceInstance
-tn GetThumbnailByIdL 99999
+// corrupted file
+tn SetThumbnailEnumSizeL ECustomThumbnailSize
+tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\not_jpg.jpg
+tn GetThumbnailL
+allownextresult KErrNotFound
+waittestclass tn
+tn DeleteSourceInstance
+tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\not_jpg.jpg image/jpeg
+tn GetThumbnailL
+allownextresult KErrNotFound
+waittestclass tn
+tn DeleteSourceInstance
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\not_3gp.3gp
+tn GetThumbnailL
+allownextresult KErrNotSupported
+waittestclass tn
+tn DeleteSourceInstance
+
+// delete one thumbnail
+tn SetThumbnailEnumSizeL EImageGridThumbnailSize
+tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
+tn DeleteThumbnails
+tn GetThumbnailL
+waittestclass tn
+tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
+tn DeleteThumbnails
+pause KTenSecondDelay
+tn SetFlagsL EDoNotCreate
+tn GetThumbnailL
allownextresult KErrNotFound
waittestclass tn
-tn DeleteSourceInstance
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-
-// ---------------------------------------------------------------------------
-// Update path
-// ---------------------------------------------------------------------------
-[Test]
-title Update path
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg 99999
-tn DeleteThumbnails
+// delete all persistent thumbnails created
+tn SetFlagsL EDefaultFlags
tn CreateThumbnails
waittestclass tn
-tn DeleteSourceInstance
-
pause KTenSecondDelay
-
-tn UpdatePathL 99999 \data\ThumbnailManagerTest\updated_path.bmp
-
+tn DeleteThumbnails
pause KTenSecondDelay
-
tn SetFlagsL EDoNotCreate
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
tn GetThumbnailL
+allownextresult KErrNotFound
waittestclass tn
+tn DeleteThumbnails
tn DeleteSourceInstance
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\updated_path.bmp 99999
-tn GetThumbnailByIdL 99999
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteSourceInstance
-tn DeleteThumbnailsByIdL 99999
-
tn DeleteInstance
delete tn
pause KTestDelay
@@ -1934,7 +2103,7 @@
tn GetThumbnailL
tn DeleteSourceInstance
-pause KClientServerDelay
+pause KClientServerDelay2
// The server should have the two thumbnail requests queued by now.
// This should cancel the second one while letting the first one finish.
@@ -1968,25 +2137,22 @@
tn DeleteThumbnails
tn DeleteSourceInstance
-// First request with 0 priority
+// First request with 100 priority
tn SetThumbnailSizeL 80 40
tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\WIDE_800x400.gif
-tn GetThumbnailL 0 0
+tn GetThumbnailL 0 100
tn DeleteSourceInstance
-// Short delay to make sure the server starts processing this request
-pause KClientServerDelay
-
// Second request with negative priority
tn SetThumbnailSizeL 1 1
tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\TALL_400x800.bmp
-tn GetThumbnailL 0 -10
+tn GetThumbnailL 0 -100
tn DeleteSourceInstance
// Third request with positive priority
tn SetThumbnailSizeL 40 30
tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\SVG_640x480.svg
-tn GetThumbnailL 0 10
+tn GetThumbnailL 0 0
tn DeleteSourceInstance
// First request should complete first, since the server started processing
@@ -1994,8 +2160,7 @@
waittestclass tn
tn CheckThumbnailL 80 40 EColor16M
-// The third request should finish next, since it had the highest priority of
-// the other tasks.
+// The third request should finish next
waittestclass tn
tn CheckThumbnailL 40 30 EColor16M
@@ -2044,31 +2209,27 @@
tn GetThumbnailL 0 0
tn DeleteSourceInstance
-// Short delay to make sure the server starts processing this request
-pause KClientServerDelay
-
// Second request with negative priority
tn SetThumbnailSizeL 1 1
tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\TALL_400x800.bmp
-tn GetThumbnailL 0 -10
+tn GetThumbnailL 0 -50
tn DeleteSourceInstance
// Third request with positive priority
tn SetThumbnailSizeL 40 30
tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\SVG_640x480.svg
-tn GetThumbnailL 0 10
+tn GetThumbnailL 0 50
tn DeleteSourceInstance
// Change the priority of the third request to a low value
-tn ChangePreviousPriority -20
+tn ChangePreviousPriority -100
// First request should complete first, since the server started processing
// it before the other requests were done
waittestclass tn
tn CheckThumbnailL 80 40 EColor16M
-// The second request should finish next, since it had the highest priority of
-// the other tasks.
+// The second request should finish next
waittestclass tn
tn CheckThumbnailL 1 1 EColor16M
@@ -2105,40 +2266,3 @@
pause KTestDelay
[Endtest]
-// ---------------------------------------------------------------------------
-// Create thumbnails using CFbsBitmap
-// ---------------------------------------------------------------------------
-[Test]
-title Create thumbnails using CFbsBitmap
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-tn SetFlagsL EDefaultFlags
-tn CreateSourceInstanceBitmapL \data\ThumbnailManagerTest\TestMBM.mbm \data\ThumbnailManagerTest\camera.jpg
-tn DeleteThumbnails
-tn CreateThumbnails
-waittestclass tn
-
-pause KTenSecondDelay
-
-tn SetFlagsL EDoNotCreate
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn SetThumbnailEnumSizeL EImageListThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageListThumbnailSize EColor16M
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/camera.jpg has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/exif.jpg has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/exif.png has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/mp3_png.mp3 has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/no_exif.jpg has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/wma.wma has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/wma_empty.wma has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/wma_png.wma has changed
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/group/ThumbnailManagerTest.pkg Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandling_plat/thumbnailmanager_api/tsrc/group/ThumbnailManagerTest.pkg Thu Jul 22 16:37:07 2010 +0100
@@ -45,4 +45,10 @@
"..\data\mmc\ThumbnailManagerTest\WIDE_800x400.gif" - "e:\testing\data\ThumbnailManagerTest\WIDE_800x400.gif"
"..\data\mmc\ThumbnailManagerTest\TestMBM.mbm" - "e:\testing\data\ThumbnailManagerTest\TestMBM.mbm"
"..\data\mmc\ThumbnailManagerTest\mp3.mp3" - "e:\testing\data\ThumbnailManagerTest\mp3.mp3"
-
+"..\data\mmc\ThumbnailManagerTest\camera.jpg" - "e:\testing\data\ThumbnailManagerTest\camera.jpg"
+"..\data\mmc\ThumbnailManagerTest\mp3_png.mp3" - "e:\testing\data\ThumbnailManagerTest\mp3_png.mp3"
+"..\data\mmc\ThumbnailManagerTest\no_exif.jpg" - "e:\testing\data\ThumbnailManagerTest\no_exif.jpg"
+"..\data\mmc\ThumbnailManagerTest\wma.wma" - "e:\testing\data\ThumbnailManagerTest\wma.wma"
+"..\data\mmc\ThumbnailManagerTest\wma_empty.wma" - "e:\testing\data\ThumbnailManagerTest\wma_empty.wma"
+"..\data\mmc\ThumbnailManagerTest\wma_png.wma" - "e:\testing\data\ThumbnailManagerTest\wma_png.wma"
+"..\data\mmc\ThumbnailManagerTest\exif.jpg" - "e:\testing\data\ThumbnailManagerTest\exif.jpg"
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/group/bld.inf Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandling_plat/thumbnailmanager_api/tsrc/group/bld.inf Thu Jul 22 16:37:07 2010 +0100
@@ -43,5 +43,11 @@
../data/mmc/ThumbnailManagerTest/WIDE_800x400.gif /epoc32/winscw/c/data/ThumbnailManagerTest/WIDE_800x400.gif
../data/mmc/ThumbnailManagerTest/TestMBM.mbm /epoc32/winscw/c/data/ThumbnailManagerTest/TestMBM.mbm
../data/mmc/ThumbnailManagerTest/mp3.mp3 /epoc32/winscw/c/data/ThumbnailManagerTest/mp3.mp3
-
+../data/mmc/ThumbnailManagerTest/camera.jpg /epoc32/winscw/c/data/ThumbnailManagerTest/camera.jpg
+../data/mmc/ThumbnailManagerTest/mp3_png.mp3 /epoc32/winscw/c/data/ThumbnailManagerTest/mp3_png.mp3
+../data/mmc/ThumbnailManagerTest/no_exif.jpg /epoc32/winscw/c/data/ThumbnailManagerTest/no_exif.jpg
+../data/mmc/ThumbnailManagerTest/wma.wma /epoc32/winscw/c/data/ThumbnailManagerTest/wma.wma
+../data/mmc/ThumbnailManagerTest/wma_empty.wma /epoc32/winscw/c/data/ThumbnailManagerTest/wma_empty.wma
+../data/mmc/ThumbnailManagerTest/wma_png.wma /epoc32/winscw/c/data/ThumbnailManagerTest/wma_png.wma
+../data/mmc/ThumbnailManagerTest/exif.jpg /epoc32/winscw/c/data/ThumbnailManagerTest/exif.jpg
// End of File
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/inc/ThumbnailManagerTest.h Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandling_plat/thumbnailmanager_api/tsrc/inc/ThumbnailManagerTest.h Thu Jul 22 16:37:07 2010 +0100
@@ -117,6 +117,7 @@
virtual TInt DeleteInstance( CStifItemParser& aItem );
virtual TInt CreateSourceInstancePathL( CStifItemParser& aItem );
+ virtual TInt CreateSourceInstancePathTargetL( CStifItemParser& aItem );
virtual TInt CreateSourceInstanceHandleL( CStifItemParser& aItem );
virtual TInt CreateSourceInstanceBufferL( CStifItemParser& aItem );
virtual TInt CreateSourceInstanceBitmapL( CStifItemParser& aItem );
@@ -146,7 +147,7 @@
virtual TInt CheckDisplayModeL( CStifItemParser& aItem );
virtual TInt DeleteThumbnails( CStifItemParser& aItem );
- virtual TInt DeleteThumbnailsByIdL( CStifItemParser& aItem );
+ virtual TInt CreateThumbnailsByUrlL( CStifItemParser& aItem );
virtual TInt CreateThumbnails( CStifItemParser& aItem );
virtual TInt UpdatePathL( CStifItemParser& aItem );
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/inc/thumbnailcenrep.h Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandling_plat/thumbnailmanager_api/tsrc/inc/thumbnailcenrep.h Thu Jul 22 16:37:07 2010 +0100
@@ -142,7 +142,7 @@
};
public:
- enum { EUnknownSourceType, EImage, EVideo, EAudio };
+ enum { EUnknownSourceType, EImage, EVideo, EAudio, EContact };
enum { EUnknownSizeType, EGrid, EList, EFullscreen };
public:
@@ -205,7 +205,10 @@
TBool iVideoFullscreen;
TBool iAudioGrid;
TBool iAudioList;
- TBool iAudioFullscreen;
+ TBool iAudioFullscreen;
+ TBool iContactGrid;
+ TBool iContactList;
+ TBool iContactFullscreen;
};
#endif // THUMBNAILCENREP_H
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/src/ThumbnailManagerTestBlocks.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandling_plat/thumbnailmanager_api/tsrc/src/ThumbnailManagerTestBlocks.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -67,6 +67,7 @@
ENTRY( "CheckThumbnailSizeL", CThumbnailManagerTest::CheckThumbnailSizeL ),
ENTRY( "SetThumbnailEnumSizeL", CThumbnailManagerTest::SetThumbnailEnumSizeL ),
ENTRY( "CreateSourceInstancePathL", CThumbnailManagerTest::CreateSourceInstancePathL ),
+ ENTRY( "CreateSourceInstancePathTargetL", CThumbnailManagerTest::CreateSourceInstancePathTargetL ),
ENTRY( "CreateSourceInstanceHandleL", CThumbnailManagerTest::CreateSourceInstanceHandleL ),
ENTRY( "CreateSourceInstanceBufferL", CThumbnailManagerTest::CreateSourceInstanceBufferL ),
ENTRY( "CreateSourceInstanceBitmapL", CThumbnailManagerTest::CreateSourceInstanceBitmapL ),
@@ -87,7 +88,7 @@
ENTRY( "SetDisplayModeL", CThumbnailManagerTest::SetDisplayModeL ),
ENTRY( "CheckDisplayModeL", CThumbnailManagerTest::CheckDisplayModeL ),
ENTRY( "DeleteThumbnails", CThumbnailManagerTest::DeleteThumbnails ),
- ENTRY( "DeleteThumbnailsByIdL", CThumbnailManagerTest::DeleteThumbnailsByIdL ),
+ ENTRY( "CreateThumbnailsByUrlL", CThumbnailManagerTest::CreateThumbnailsByUrlL ),
ENTRY( "CreateThumbnails", CThumbnailManagerTest::CreateThumbnails ),
ENTRY( "UpdatePathL", CThumbnailManagerTest::UpdatePathL ),
ENTRY( "GetSupportedMimeTypesL", CThumbnailManagerTest::GetSupportedMimeTypesL )
@@ -300,6 +301,53 @@
return KErrNone;
}
+TInt CThumbnailManagerTest::CreateSourceInstancePathTargetL( CStifItemParser& aItem )
+ {
+ _LIT( KPanicTxt, "CreateSrcPathTarget" );
+ __ASSERT_ALWAYS( !iObjectSource, User::Panic( KPanicTxt, 0 ));
+
+ TPtrC path;
+ User::LeaveIfError( aItem.GetNextString( path ));
+
+ TPtrC target;
+ User::LeaveIfError( aItem.GetNextString( target ));
+
+ TPtrC mimeType;
+ User::LeaveIfError( aItem.GetNextString( mimeType ));
+
+ TInt virtual1 = 0;
+ aItem.GetNextInt( virtual1 );
+
+ TInt virtual2 = 0;
+ aItem.GetNextInt( virtual2 );
+
+ TFileName filePath( iDataPath );
+ filePath.Append( path );
+ filePath.ZeroTerminate();
+
+ if (virtual1)
+ {
+ filePath.Delete(2,1);
+ }
+
+ TFileName targetPath( iDataPath );
+ targetPath.Append( target );
+ targetPath.ZeroTerminate();
+
+ if (virtual2)
+ {
+ targetPath.Delete(2,1);
+ }
+
+ iLog->Log( _L( "CreateSourceInstancePathTargetL - path = %S, target = %S" ), &filePath );
+
+ delete iObjectSource;
+ iObjectSource = NULL;
+
+ iObjectSource = CThumbnailObjectSource::NewL( filePath, targetPath, mimeType );
+ return KErrNone;
+ }
+
TInt CThumbnailManagerTest::CreateSourceInstanceHandleL( CStifItemParser& aItem )
{
_LIT( KPanicTxt, "CreateSrcHandle" );
@@ -627,6 +675,7 @@
TInt CThumbnailManagerTest::CheckThumbnailCenrepL( CStifItemParser& aItem )
{
TInt err = KErrNone;
+ TBool full = EFalse;
TInt sizeType;
TInt displaymode = 0;
@@ -634,6 +683,12 @@
User::LeaveIfError( aItem.GetNextInt( displaymode ));
TThumbnailSize size = (TThumbnailSize)sizeType;
+ if (size == EImageFullScreenThumbnailSize ||
+ size == EVideoFullScreenThumbnailSize ||
+ size == EAudioFullScreenThumbnailSize)
+ {
+ full = ETrue;
+ }
if ( iThumbnail )
{
@@ -663,6 +718,10 @@
{
iLog->Log( _L( "CheckThumbnailCenrepL - ok" ));
}
+ else if (full && (thumbSize.iWidth <= width && thumbSize.iHeight <= height))
+ {
+ iLog->Log( _L( "CheckThumbnailCenrepL - fullscreen ok, not upscaled" ));
+ }
else
{
iLog->Log( _L( "CheckThumbnailCenrepL - size mismatch" ));
@@ -724,12 +783,42 @@
return KErrNone;
}
-TInt CThumbnailManagerTest::DeleteThumbnailsByIdL( CStifItemParser& aItem )
+TInt CThumbnailManagerTest::CreateThumbnailsByUrlL( CStifItemParser& aItem )
{
+ _LIT( KPanicTxt, "CreateSrcPath" );
+ __ASSERT_ALWAYS( !iObjectSource, User::Panic( KPanicTxt, 0 ));
+
+ TPtrC path;
+ User::LeaveIfError( aItem.GetNextString( path ));
+
TInt id = 0;
- User::LeaveIfError( aItem.GetNextInt( id ));
+ aItem.GetNextInt( id );
+
+ TFileName filePath( iDataPath );
+ filePath.Append( path );
+ filePath.ZeroTerminate();
+
+ iLog->Log( _L( "CreateSourceInstancePathL - path = %S" ), &filePath );
+
+ delete iObjectSource;
+ iObjectSource = NULL;
+
+ iObjectSource = CThumbnailObjectSource::NewL( filePath, id );
- iEngine->DeleteThumbnails( id );
+ id = iEngine->CreateThumbnails( *iObjectSource );
+ if (id < 0)
+ {
+ iLog->Log( _L( "CreateThumbnails - error %d" ), id );
+ return id;
+ }
+ else
+ {
+ iPreviousRequestId = id;
+ iLog->Log( _L( "CreateThumbnails - request id %d" ), iPreviousRequestId );
+ }
+
+ iCreateThumbnails = ETrue;
+
return KErrNone;
}
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/src/thumbnailcenrep.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandling_plat/thumbnailmanager_api/tsrc/src/thumbnailcenrep.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -42,6 +42,12 @@
const TUint32 KSizeAudioListHeight = 0x15;
const TUint32 KSizeAudioFullscreenWidth = 0x16;
const TUint32 KSizeAudioFullscreenHeight = 0x17;
+const TUint32 KSizeContactListWidth = 0x18;
+const TUint32 KSizeContactListHeight = 0x19;
+const TUint32 KSizeContactGridWidth = 0x20;
+const TUint32 KSizeContactGridHeight = 0x21;
+const TUint32 KSizeContactFullscreenWidth = 0x22;
+const TUint32 KSizeContactFullscreenHeight = 0x23;
const TUint32 KAutoCreateImageGrid = 0x100;
const TUint32 KAutoCreateImageList = 0x101;
@@ -52,6 +58,9 @@
const TUint32 KAutoCreateAudioGrid = 0x106;
const TUint32 KAutoCreateAudioList = 0x107;
const TUint32 KAutoCreateAudioFullscreen = 0x108;
+const TUint32 KAutoCreateContactGrid = 0x109;
+const TUint32 KAutoCreateContactList = 0x110;
+const TUint32 KAutoCreateContactFullscreen = 0x111;
// ---------------------------------------------------------------------------
@@ -94,6 +103,11 @@
case EAudioFullScreenThumbnailSize:
iSourceType = EAudio;
break;
+ case EContactGridThumbnailSize:
+ case EContactListThumbnailSize:
+ case EContactFullScreenThumbnailSize:
+ iSourceType = EContact;
+ break;
default:
iSourceType = EUnknownSourceType;
}
@@ -107,7 +121,8 @@
TThumbnailAutoCreate::TThumbnailAutoCreate()
: iImageGrid(EFalse), iImageList(EFalse), iImageFullscreen(EFalse),
iVideoGrid(EFalse), iVideoList(EFalse), iVideoFullscreen(EFalse),
- iAudioGrid(EFalse), iAudioList(EFalse), iAudioFullscreen(EFalse)
+ iAudioGrid(EFalse), iAudioList(EFalse), iAudioFullscreen(EFalse),
+ iContactGrid(EFalse), iContactList(EFalse), iContactFullscreen(EFalse)
{
// No implementation required
}
@@ -164,7 +179,7 @@
TInt ySize( 0 );
TBool flags( EFalse );
const TBool KGridAndListThumbnailCropped = ETrue;
- TInt raw_mode( EColor16M ); // always 16-bit
+ TInt raw_mode( EColor64K );
TInt format( 0 );
TBool autoCreate( EFalse );
@@ -230,6 +245,27 @@
iPersistentSizes.AppendL( TThumbnailPersistentSize( EAudioFullScreenThumbnailSize, TSize( xSize, ySize ),
flags, static_cast <TDisplayMode> (raw_mode), format, autoCreate ));
+
+ User::LeaveIfError( iRepository->Get( KSizeContactGridWidth, xSize ));
+ User::LeaveIfError( iRepository->Get( KSizeContactGridHeight, ySize ));
+ User::LeaveIfError( iRepository->Get( KAutoCreateContactGrid, autoCreate ));
+
+ iPersistentSizes.AppendL( TThumbnailPersistentSize( EContactGridThumbnailSize, TSize( xSize, ySize ),
+ KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate ));
+
+ User::LeaveIfError( iRepository->Get( KSizeContactListWidth, xSize ));
+ User::LeaveIfError( iRepository->Get( KSizeContactListHeight, ySize ));
+ User::LeaveIfError( iRepository->Get( KAutoCreateContactList, autoCreate ));
+
+ iPersistentSizes.AppendL( TThumbnailPersistentSize( EContactListThumbnailSize, TSize( xSize, ySize ),
+ KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate ));
+
+ User::LeaveIfError( iRepository->Get( KSizeContactFullscreenWidth, xSize ));
+ User::LeaveIfError( iRepository->Get( KSizeContactFullscreenHeight, ySize ));
+ User::LeaveIfError( iRepository->Get( KAutoCreateContactFullscreen, autoCreate ));
+
+ iPersistentSizes.AppendL( TThumbnailPersistentSize( EContactFullScreenThumbnailSize, TSize( xSize, ySize ),
+ flags, static_cast <TDisplayMode> (raw_mode), format, autoCreate ));
iAutoCreate = new (ELeave) TThumbnailAutoCreate();
@@ -242,6 +278,9 @@
User::LeaveIfError( iRepository->Get( KAutoCreateAudioGrid, iAutoCreate->iAudioGrid ));
User::LeaveIfError( iRepository->Get( KAutoCreateAudioList, iAutoCreate->iAudioList ));
User::LeaveIfError( iRepository->Get( KAutoCreateAudioFullscreen, iAutoCreate->iAudioFullscreen ));
+ User::LeaveIfError( iRepository->Get( KAutoCreateContactGrid, iAutoCreate->iContactGrid ));
+ User::LeaveIfError( iRepository->Get( KAutoCreateContactList, iAutoCreate->iContactList ));
+ User::LeaveIfError( iRepository->Get( KAutoCreateContactFullscreen, iAutoCreate->iContactFullscreen ));
}
// ---------------------------------------------------------------------------
--- a/imagehandlinglib/Group/IHL.mmp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlinglib/Group/IHL.mmp Thu Jul 22 16:37:07 2010 +0100
@@ -49,7 +49,7 @@
// Default system include paths for middleware layer modules.
MW_LAYER_SYSTEMINCLUDE
-SYSTEMINCLUDE /epoc32/include/icl // Needs to be removed after ICL has made SF structural changes.
+SYSTEMINCLUDE /epoc32/include/icl
LIBRARY euser.lib
Binary file imagehandlingutilities/thumbnailmanager/conf/102830B0.txt has changed
Binary file imagehandlingutilities/thumbnailmanager/conf/thumbnailmanager.confml has changed
Binary file imagehandlingutilities/thumbnailmanager/conf/thumbnailmanager_102830B0.crml has changed
--- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h Thu Jul 22 16:37:07 2010 +0100
@@ -22,7 +22,7 @@
#include <e32base.h>
#include <gdi.h>
#include <etel3rdparty.h>
-
+#include <mdccommon.h>
#include <apmstd.h>
#include "thumbnailmanager.h" // TThumbnailFlags
@@ -53,10 +53,10 @@
//actual batch size will vary and will be between min...max batch size values below
//minimum batch size
-const TUint KMInBatchItems = 3;
+const TUint KMInBatchItems = 6;
//maximum batch size
const TUint KMaxBatchItems = 60;
-//Max allowed flush time
+//Max allowed flush time ms
const TUint KMaxFlushDelay = 3000; // 3 sec
//Max allowed flush time on MTP/music collection refresh
const TUint KMaxMTPFlushDelay = 15000; // 15 seconds
@@ -64,15 +64,22 @@
//how many items daemon will query at once from MDS
const TUint KMaxQueryItems = 100;
// max items for PH & AllItems query
-const TUint KMaxQueryItems2 = 100;
+const TUint KMaxQueryBatchSize = 100;
// maximum number of active client side queue requests
const TUint KMaxClientRequests = 2;
+#ifdef __RETRY_ON_SERVERCRASH
+// maximum number of request retry
+const TUint KMaxRequestRetryCount = 2;
+#endif
+
// maximum number of active daemon requests
const TUint KMaxDaemonRequests = 2;
-const TUint KMdEReconnect = 100000; //100 ms
+const TUint KMdEReconnect = 1*1000*1000; //1 second
+
+const TUint KUnmountTimerTimeout = 5*1000*1000; //5 seconds
const TUint KClientRequestTimeout = 60000000; //60 sec
const TUint KClientRequestStartErrorTimeout = 100000; //100 ms
@@ -83,9 +90,12 @@
const TInt KThumbnailErrThumbnailNotFound = -62000;
-//give MDS 1000 msec time to settle before starting generating TNs
+//give MDS some to settle before starting generating TNs
const TInt KHarvestingCompleteTimeout = 10000000; //10 sec
+//after MMC mount wait while before count is calculated
+const TInt KMountTimeout = 5*1000*1000; //5 sec
+
const TInt KPSKeyTimeout = 10000000; //10 sec
//Store's auto flush timeout
const TInt KAutoFlushTimeout = 65; //65 sec
@@ -109,6 +119,7 @@
//default displaymode (bpp - bits per pixel) for TNs in DB
//this makes possible to provide all colour depths up to 16M aka 24 -bit full colour
+//Symbian^4 EColor16MAP
const TDisplayMode KStoreDisplayMode = EColor16MAP;
//required amount of memory to keep bitmaps on RAM in bits
@@ -138,39 +149,47 @@
const TInt KImeiBufferSize = CTelephony::KPhoneSerialNumberSize;
const TInt KCheckValue = 123456;
-_LIT8( KJpegMime, "image/jpeg" ); _LIT( KJpegExt, ".jpeg" );
-_LIT8( KJpeg2000Mime, "image/jp2" ); _LIT( KJpeg2000Ext, ".jp2" );
-_LIT8( KJpgMime, "image/jpeg" ); _LIT( KJpgExt, ".jpg" );
-_LIT8( KGifMime, "image/gif" ); _LIT( KGifExt, ".gif" );
-_LIT8( KPngMime, "image/png" ); _LIT( KPngExt, ".png" );
-_LIT8( KSvgMime, "image/svg+xml" ); _LIT( KSvgExt, ".svg" );
-_LIT8( KMpgMime1, "video/mpeg"); _LIT( KMpgExt1, ".mpg" );
-_LIT8( KMpeg4Mime, "video/mpeg4" ); _LIT( KMpeg4Ext,".mpeg4" );
-_LIT8( KMp4Mime, "video/mp4" ); _LIT( KMp4Ext, ".mp4" );
-_LIT8( KAviMime, "video/x-msvideo" ); _LIT( KAviExt, ".avi" );
-_LIT8( KMp3Mime, "audio/mpeg" ); _LIT( KMp3Ext, ".mp3" );
-_LIT8( KNonEmbeddArtMime, "audio/mpeg" ); _LIT( KNonEmbeddArtExt, ".alb" );
-_LIT8( KM4aMime, "audio/mp4" ); _LIT( KM4aExt, ".m4a" );
-_LIT8( KAacMime, "audio/aac" ); _LIT( KAacExt, ".aac" );
-_LIT8( KWmaMime, "audio/x-ms-wma" ); _LIT( KWmaExt, ".wma" );
-_LIT8( KBmpMime, "image/bmp" ); _LIT( KBmpExt, ".bmp" );
-_LIT8( KAudio3gppMime, "audio/3gpp" );
-_LIT8( KVideo3gppMime, "video/3gpp" ); _LIT( K3gpExt, ".3gp" );
-_LIT8( KAudioAmrMime, "audio/AMR" ); _LIT( KAmrExt, ".amr" );
-_LIT8( KVideoWmvMime, "video/x-ms-wmv" ); _LIT( KWmvExt, ".wmv" );
-_LIT8( KRealAudioMime, "audio/vnd.rn-realaudio" ); _LIT( KRealAudioExt, ".ra" );
-_LIT8( KPmRealAudioPluginMime, "audio/x-pn-realaudio-plugin" ); _LIT( KPmRealAudioPluginExt, ".rpm" );
-_LIT8( KPmRealVideoPluginMime, "video/x-pn-realvideo" ); _LIT( KPmRealVideoPluginExt, ".rm" );
-_LIT8( KPmRealVbVideoPluginMime, "video/x-pn-realvideo" ); _LIT( KPmRealVbVideoPluginExt, ".rmvb" );
-_LIT8( KPmRealAudioMime, "audio/x-pn-realaudio" ); _LIT( KPmRealAudioExt, ".ra" );
-_LIT8( KRealVideoMime, "video/vnd.rn-realvideo" ); _LIT( KRealVideoExt, ".rv" );
-_LIT8( KFlashVideoMime, "video/x-flv" ); _LIT( KFlashVideoExt, ".flv" );
-_LIT8( KMatroskaVideoMime, "video/x-matroska" ); _LIT( KMatroskaVideoExt, ".mkv" );
+_LIT8( KJpegMime, "image/jpeg" ); _LIT( KJpegExt, ".jpeg" );
+_LIT8( KJpeg2000Mime, "image/jp2" ); _LIT( KJpeg2000Ext, ".jp2" );
+_LIT8( KJpgMime, "image/jpeg" ); _LIT( KJpgExt, ".jpg" );
+_LIT8( KGifMime, "image/gif" ); _LIT( KGifExt, ".gif" );
+_LIT8( KPngMime, "image/png" ); _LIT( KPngExt, ".png" );
+_LIT8( KSvgMime, "image/svg+xml" ); _LIT( KSvgExt, ".svg" );
+_LIT8( KMpgMime1, "video/mpeg"); _LIT( KMpgExt1, ".mpg" );
+_LIT8( KMpeg4Mime, "video/mpeg4" ); _LIT( KMpeg4Ext,".mpeg4" );
+_LIT8( KMp4Mime, "video/mp4" ); _LIT( KMp4Ext, ".mp4" ); _LIT( KM4vExt, ".m4v" );
+_LIT8( KAviMime, "video/x-msvideo" ); _LIT( KAviExt, ".avi" );
+_LIT8( KMp3Mime, "audio/mpeg" ); _LIT( KMp3Ext, ".mp3" );
+_LIT8( KNonEmbeddArtMime, "audio/mpeg" ); _LIT( KNonEmbeddArtExt, ".alb" );
+_LIT8( KM4aMime, "audio/mp4" ); _LIT( KM4aExt, ".m4a" );
+_LIT8( KAacMime, "audio/aac" ); _LIT( KAacExt, ".aac" );
+_LIT8( KWmaMime, "audio/x-ms-wma" ); _LIT( KWmaExt, ".wma" );
+_LIT8( KBmpMime, "image/bmp" ); _LIT( KBmpExt, ".bmp" );
+_LIT8( KAudio3gppMime, "audio/3gpp" );
+_LIT8( KVideo3gppMime, "video/3gpp" ); _LIT( K3gpExt, ".3gp" ); _LIT( K3gppExt, ".3gpp" );
+_LIT8( KAudioAmrMime, "audio/AMR" ); _LIT( KAmrExt, ".amr" );
+_LIT8( KVideoWmvMime, "video/x-ms-wmv" ); _LIT( KWmvExt, ".wmv" );
+_LIT8( KRealAudioMime, "audio/vnd.rn-realaudio" ); _LIT( KRealAudioExt, ".ra" );
+_LIT8( KPmRealAudioPluginMime, "audio/x-pn-realaudio-plugin" ); _LIT( KPmRealAudioPluginExt, ".rpm" );
+_LIT8( KPmRealVideoPluginMime, "video/x-pn-realvideo" ); _LIT( KPmRealVideoPluginExt, ".rm" );
+_LIT8( KPmRealVbVideoPluginMime, "video/x-pn-realvideo" ); _LIT( KPmRealVbVideoPluginExt, ".rmvb" );
+_LIT8( KPmRealAudioMime, "audio/x-pn-realaudio" ); _LIT( KPmRealAudioExt, ".ra" );
+_LIT8( KRealVideoMime, "video/vnd.rn-realvideo" ); _LIT( KRealVideoExt, ".rv" );
+_LIT8( KFlashVideoMime, "video/x-flv" ); _LIT( KFlashVideoExt, ".flv" );
+_LIT8( KMatroskaVideoMime, "video/x-matroska" ); _LIT( KMatroskaVideoExt, ".mkv" );
+_LIT8( KContactMime, "contact/x-vcard" ); _LIT( KContactExt, ".vcf" );
+_LIT( KNonEmbeddedArtExt, ".alb" );
_LIT( KImageMime, "image/*" );
_LIT( KVideoMime, "video/*" );
_LIT( KAudioMime, "audio/*" );
-_LIT( KM4vExt, ".m4v" );
-_LIT( KNonEmbeddedArtExt, ".alb" );
+
+_LIT( KPrivateFolder, ":\\private\\");
+_LIT( KSysFolder, ":\\sys\\");
+
+_LIT( KDrv, ":");
+_LIT( KBackSlash, "\\");
+
+const TInt KExtLength = 4;
/**
* Control flags set by the server for handling specific situations
@@ -280,8 +299,7 @@
* Control flags may be modified by server to signal client side what actually was done, like preview TN
*/
TThumbnailControlFlags iControlFlags;
-
-
+
/**
* Original control flags set by the server for handling specific situations
* (for example for distinguishing between preview thumbnails and
@@ -298,6 +316,21 @@
* Thumbnail's orientation
*/
TInt iOrientation;
+
+ /**
+ * Overwrite old thumbs (SetThumbnailL)
+ */
+ TBool iOverwrite;
+
+ /**
+ * URI is virtual
+ */
+ TBool iVirtualUri;
+
+ /**
+ * Target differs from source
+ */
+ TBool iImport;
};
@@ -479,75 +512,6 @@
EThumbnailFormatJpeg
};
-struct TThumbnailDatabaseData
- {
-public:
- /**
- * Full path to object to which the imported thumb is to be linked.
- */
- TPath iPath;
- /**
- * Thumbnail ID
- */
- TInt iTnId;
- /**
- * Requested thumbnail size new requests.
- */
- TInt iSize;
- /**
- * type of data
- */
- TInt iFormat;
- /**
- * Path for the thumbnails
- */
- TPath iTnPath;
- /**
- * Data if bitmap
- */
- CFbsBitmap* iBlob;
- /**
- * Data if jpeg
- */
- TDesC8* iData;
- /**
- * Width of thumbnail
- */
- TInt iWidth;
- /**
- * Height of thumbnail
- */
- TInt iHeight;
- /**
- * Original width of thumbnail
- */
- TInt iOrigWidth;
- /**
- * Original height of thumbnail
- */
- TInt iOrigHeight;
- /**
- * flags
- */
- TInt iFlags;
- /**
- * videoposition
- */
- TInt iVideoPosition;
- /**
- * thumb oritentation
- */
- TInt iOrientation;
- /**
- * Thumb created from associated path
- */
- TInt iThumbFromPath;
- /**
- * last modified
- */
- TInt64 iModified;
-
- };
/**
* MDS query modes used during thumbnail generation
--- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerprivatecrkeys.h Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerprivatecrkeys.h Thu Jul 22 16:37:07 2010 +0100
@@ -44,6 +44,12 @@
const TUint32 KSizeAudioListHeight = 0x15;
const TUint32 KSizeAudioFullscreenWidth = 0x16;
const TUint32 KSizeAudioFullscreenHeight = 0x17;
+const TUint32 KSizeContactListWidth = 0x18;
+const TUint32 KSizeContactListHeight = 0x19;
+const TUint32 KSizeContactGridWidth = 0x20;
+const TUint32 KSizeContactGridHeight = 0x21;
+const TUint32 KSizeContactFullscreenWidth = 0x22;
+const TUint32 KSizeContactFullscreenHeight = 0x23;
const TUint32 KAutoCreateImageGrid = 0x100;
const TUint32 KAutoCreateImageList = 0x101;
@@ -54,6 +60,9 @@
const TUint32 KAutoCreateAudioGrid = 0x106;
const TUint32 KAutoCreateAudioList = 0x107;
const TUint32 KAutoCreateAudioFullscreen = 0x108;
+const TUint32 KAutoCreateContactGrid = 0x109;
+const TUint32 KAutoCreateContactList = 0x110;
+const TUint32 KAutoCreateContactFullscreen = 0x111;
const TUint32 KColorDepthGrid = 0x200;
const TUint32 KColorDepthList = 0x201;
--- a/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailaudioprovider.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailaudioprovider.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -95,6 +95,8 @@
TPtrC8 ptr = metaCont.Field8( EMetaDataJpeg );
HBufC8* data = ptr.AllocL();
+ CleanupStack::PopAndDestroy(&wantedFields);
+ CleanupStack::PopAndDestroy(metaDataUtil);
CleanupStack::PushL( data );
if(data->Length() == 0)
@@ -102,10 +104,6 @@
User::Leave( KErrNotFound );
}
- CleanupStack::Pop( data );
- CleanupStack::PopAndDestroy(&wantedFields);
- CleanupStack::PopAndDestroy(metaDataUtil);
-
if ( !iImageDecoderv3 )
{
iImageDecoderv3 = new( ELeave )CThumbnailImageDecoderv3( aFs );
@@ -115,13 +113,19 @@
iFlags = aFlags;
//set default mode displaymode from global constants
iDisplayMode = KStoreDisplayMode;
-
-//TODO currently only ARM platforms supports MAP mode
-#if !(defined(__CC_ARM) || defined(__ARMCC__))
- iDisplayMode = EColor16M;
-#endif
+ TRAPD( err, iImageDecoderv3->CreateL( data, *iObserver, iFlags, iMimeType, iTargetSize ) );
+ if (err == KErrNone)
+ {
+ CleanupStack::Pop( data );
+ }
+ else
+ {
+ // this is because data buffer is already released in CreateDecoderL
+ // and we must prevent automatic PopAndDestroy
+ CleanupStack::Pop( data );
+ User::Leave(err);
+ }
- iImageDecoderv3->CreateL( data, *iObserver, iFlags, iMimeType, iTargetSize );
iOriginalSize = iImageDecoderv3->OriginalSize();
iImageDecoderv3->DecodeL( iDisplayMode );
}
--- a/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailimagedecoderv3.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailimagedecoderv3.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -39,8 +39,8 @@
// C++ default constructor can NOT contain any code, that might leave.
// ---------------------------------------------------------------------------
//
-CThumbnailImageDecoderv3::CThumbnailImageDecoderv3( RFs& aFs ): CActive(
- EPriorityStandard ), iFs( aFs )
+CThumbnailImageDecoderv3::CThumbnailImageDecoderv3( RFs& aFs ):
+ CActive(EPriorityStandard ), iBitmap( NULL ), iFs( aFs ), iBuffer( NULL )
{
CActiveScheduler::Add( this );
}
@@ -137,8 +137,7 @@
TInt err = iBitmap->Create( loadSize, aDisplayMode );
if (err != KErrNone)
{
- delete iBitmap;
- iBitmap = NULL;
+ Release();
User::Leave(err);
}
@@ -158,8 +157,14 @@
void CThumbnailImageDecoderv3::Release()
{
Cancel();
+
delete iDecoder;
iDecoder = NULL;
+
+ delete iBitmap;
+ iBitmap = NULL;
+ delete iBuffer; // we own the buffer
+ iBuffer = NULL;
}
@@ -175,6 +180,11 @@
delete iDecoder;
iDecoder = NULL;
}
+
+ delete iBitmap;
+ iBitmap = NULL;
+ delete iBuffer; // we own the buffer
+ iBuffer = NULL;
}
@@ -188,8 +198,9 @@
iObserver->ThumbnailProviderReady( iStatus.Int(), iBitmap, iOriginalSize, EFalse, EFalse );
iBitmap = NULL; // owned by server now
- delete iBuffer;
+ delete iBuffer; // we own the buffer
iBuffer = NULL;
+
Release();
}
@@ -228,9 +239,7 @@
TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options ) );
if ( decErr != KErrNone )
{
- delete iBuffer;
- iBuffer = NULL;
-
+ Release();
TN_DEBUG2( "CThumbnailImageDecoderv3::CreateDecoderL() - CImageDecoder error %d", decErr );
User::Leave( decErr );
@@ -270,6 +279,7 @@
//no sense to try other codecs if image is corrupted
if( aError == KErrCorrupt || aError == KErrUnderflow)
{
+ Release();
User::Leave( aError );
}
}
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -52,8 +52,9 @@
// C++ default constructor can NOT contain any code, that might leave.
// ---------------------------------------------------------------------------
//
-CThumbnailImageDecoder::CThumbnailImageDecoder( RFs& aFs ): CActive(
- EPriorityStandard ), iFs( aFs )
+CThumbnailImageDecoder::CThumbnailImageDecoder( RFs& aFs ):
+ CActive(EPriorityStandard ), iBitmap( NULL ), iJpegReadBuffer( NULL ),
+ iExifThumbImage( NULL ), iFs( aFs ), iBuffer( NULL )
{
CActiveScheduler::Add( this );
}
@@ -248,12 +249,18 @@
void CThumbnailImageDecoder::Release()
{
Cancel();
+
+ delete iDecoder;
+ iDecoder = NULL;
+
+ delete iBitmap;
+ iBitmap = NULL;
delete iJpegReadBuffer;
iJpegReadBuffer = NULL;
delete iExifThumbImage;
iExifThumbImage = NULL;
- delete iDecoder;
- iDecoder = NULL;
+
+ iBuffer = NULL; // we don't own the buffer
}
@@ -266,13 +273,18 @@
if ( iDecoder )
{
iDecoder->Cancel();
- delete iJpegReadBuffer;
- iJpegReadBuffer = NULL;
- delete iExifThumbImage;
- iExifThumbImage = NULL;
delete iDecoder;
iDecoder = NULL;
}
+
+ delete iBitmap;
+ iBitmap = NULL;
+ delete iJpegReadBuffer;
+ iJpegReadBuffer = NULL;
+ delete iExifThumbImage;
+ iExifThumbImage = NULL;
+
+ iBuffer = NULL; // we don't own the buffer
}
@@ -286,6 +298,8 @@
iObserver->ThumbnailProviderReady( iStatus.Int(), iBitmap, iOriginalSize, iEXIF, iPortrait );
iBitmap = NULL; // owned by server now
+ iBuffer = NULL; // we don't own the buffer
+
Release();
}
@@ -570,8 +584,7 @@
CImageDecoder::EPreferFastDecode | CImageDecoder::EOptionAlwaysThread );
}
- TRAPD( err, iDecoder = CExtJpegDecoder::DataNewL( iFs, * iExifThumbImage,
- options ));
+ TRAPD( err, iDecoder = CExtJpegDecoder::DataNewL( iFs, * iExifThumbImage, options ));
if ( err == KErrNotFound || err == KErrNotSupported )
{
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoderv2.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoderv2.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -33,8 +33,8 @@
// C++ default constructor can NOT contain any code, that might leave.
// ---------------------------------------------------------------------------
//
-CThumbnailImageDecoderv2::CThumbnailImageDecoderv2( RFs& aFs): CActive(
- EPriorityStandard ), iFs( aFs )
+CThumbnailImageDecoderv2::CThumbnailImageDecoderv2( RFs& aFs):
+ CActive(EPriorityStandard ), iBitmap( NULL ), iFs( aFs ), iBuffer( NULL )
{
CActiveScheduler::Add( this );
}
@@ -93,10 +93,7 @@
}
iDecoder->Convert( &iStatus, * iBitmap );
- while ( iStatus == KErrUnderflow )
- {
- iDecoder->ContinueConvert( &iStatus );
- }
+
SetActive();
TN_DEBUG1( "CThumbnailImageDecoderv2::DecodeL() end" );
@@ -111,8 +108,14 @@
void CThumbnailImageDecoderv2::Release()
{
Cancel();
+
delete iDecoder;
iDecoder = NULL;
+
+ delete iBitmap;
+ iBitmap = NULL;
+
+ iBuffer = NULL; // we don't own the buffer
}
@@ -128,6 +131,11 @@
delete iDecoder;
iDecoder = NULL;
}
+
+ delete iBitmap;
+ iBitmap = NULL;
+
+ iBuffer = NULL; // we don't own the buffer
}
@@ -143,7 +151,8 @@
iObserver->ThumbnailProviderReady( iStatus.Int(), iBitmap, iOriginalSize, EFalse, EFalse);
iBitmap = NULL; // owned by server now
- iBuffer = NULL;
+ iBuffer = NULL; // we don't own the buffer
+
Release();
}
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimageprovider.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimageprovider.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -93,7 +93,8 @@
iQualityPreference = aQualityPreference;
//set default mode displaymode from global constants
iDisplayMode = KStoreDisplayMode;
-
+
+//Symbian^4 specific
if ( KJpegMime() != iMimeType.Des8() )
{
iDisplayMode = EColor16M;
@@ -132,6 +133,8 @@
iQualityPreference = aQualityPreference;
//set default mode displaymode from global constants
iDisplayMode = KStoreDisplayMode;
+
+//Symbian^4 specific
if ( KJpegMime() != iMimeType.Des8() )
{
iDisplayMode = EColor16M;
--- a/imagehandlingutilities/thumbnailmanager/plugins/video/src/thumbnailvideoprovider.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/plugins/video/src/thumbnailvideoprovider.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -134,7 +134,8 @@
iFlags = aFlags;
//set default mode displaymode from global constants
iDisplayMode = KStoreDisplayMode;
-
+
+//Symbian^4 specific
//TODO currently only ARM platforms supports MAP mode
#if !(defined(__CC_ARM) || defined(__ARMCC__))
iDisplayMode = EColor16M;
Binary file imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/ThumbnailManager_0x102830AB_v10.10.6_SA_S60.50_Euro1.sis has changed
Binary file imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/ThumbnailManager_0x102830AB_v10.10.8_SA_S60.50_Euro1.sis has changed
--- a/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/package.pkg Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/package.pkg Thu Jul 22 16:37:07 2010 +0100
@@ -17,7 +17,7 @@
&EN
; Header
-#{"Thumbnail Manager"},(0x102830AB), 10, 10, 6, TYPE=SA, RU
+#{"Thumbnail Manager"},(0x102830AB), 10, 10, 8, TYPE=SA, RU
; Localised Vendor name
%{"Nokia"}
--- a/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/stub.pkg Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/stub.pkg Thu Jul 22 16:37:07 2010 +0100
@@ -17,7 +17,7 @@
&EN
; Header
-#{"ThumbnailManager"},(0x102830AB), 10, 10, 6, TYPE=SA
+#{"ThumbnailManager"},(0x102830AB), 10, 10, 8, TYPE=SA
; Localised Vendor name
%{"Nokia"}
Binary file imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/thumbnailmanager_stub.sis has changed
--- a/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanagercenrep/package.pkg Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanagercenrep/package.pkg Thu Jul 22 16:37:07 2010 +0100
@@ -17,7 +17,7 @@
&EN
; Header
-#{"Thumbnail Manager Cenrep"},(0x10202BE9), 10, 10, 6, TYPE=SP
+#{"Thumbnail Manager Cenrep"},(0x10202BE9), 10, 10, 8, TYPE=SP
; Localised Vendor name
%{"Symbian Software Ltd."}
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/group/thumbagdaemon.mmp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/group/thumbagdaemon.mmp Thu Jul 22 16:37:07 2010 +0100
@@ -49,6 +49,12 @@
SOURCE tmformatobserver.cpp
SOURCE tmsrproptertyobserver.cpp
+SOURCEPATH ../src
+SOURCE thumbagimageobserver.cpp
+SOURCE thumbagcameraobserver.cpp
+SOURCE thumbagaudioobserver.cpp
+SOURCE thumbagvideoobserver.cpp
+
// Default system include paths for middleware layer modules.
MW_LAYER_SYSTEMINCLUDE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagaudioobserver.h Thu Jul 22 16:37:07 2010 +0100
@@ -0,0 +1,148 @@
+/*
+* 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: Thumbnail Auto Generate Daemon
+ *
+*/
+
+
+#ifndef THUMBAGAUDIOOBSERVER_H
+#define THUMBAGAUDIOOBSERVER_H
+
+#include <e32base.h>
+#include <w32std.h>
+
+#include <mdesession.h>
+
+#include "thumbagprocessor.h"
+#include "tmshutdownobserver.h"
+#include "thumbnaillog.h"
+
+
+/**
+ * ThumbAG daemon.
+ *
+ * @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CThumbAGAudioObserver ): public CBase,
+ public MMdESessionObserver,
+ public MMdEObjectObserver,
+ public MTMShutdownObserver
+ {
+public:
+
+ /**
+ * Two-phased constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGAudioObserver server.
+ */
+ static CThumbAGAudioObserver* NewLC(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Two-phased constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGAudioObserver server.
+ */
+ static CThumbAGAudioObserver* NewL(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Destructor
+ *
+ * @since S60 v5.0
+ */
+ virtual ~CThumbAGAudioObserver();
+
+
+public:
+
+ // from MMdESessionObserver
+ void HandleSessionOpened( CMdESession& aSession, TInt aError );
+ void HandleSessionError( CMdESession& aSession, TInt aError );
+
+ // from MMdEObjectObserver
+ void HandleObjectNotification(CMdESession& aSession,
+ TObserverNotificationType aType,
+ const RArray<TItemId>& aObjectIdArray);
+
+ // from MTMShutdownObserver
+ void ShutdownNotification();
+
+protected:
+
+ /**
+ * AddObserversL
+ *
+ * @since S60 v5.0
+ */
+ void AddObserversL();
+
+
+private:
+
+ /**
+ * C++ default constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGAudioObserver instance.
+ */
+ CThumbAGAudioObserver(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Symbian 2nd phase constructor can leave.
+ *
+ * @since S60 v5.0
+ */
+ void ConstructL();
+
+ /**
+ * Initilization helper
+ *
+ * @since S60 v5.2
+ */
+ void InitializeL();
+
+ /**
+ * Callback for reconnect timer
+ *
+ * @since S60 v5.0
+ */
+ static TInt ReconnectCallBack(TAny* aAny);
+
+ void Shutdown();
+
+private:
+
+ // own
+ CTMShutdownObserver* iShutdownObserver;
+ CTMShutdownObserver* iMDSShutdownObserver;
+ CMdESession* iMdESession;
+
+ //not owned
+ CThumbAGProcessor* iProcessor;
+
+ TBool iShutdown;
+
+ // reconnect timer
+ CPeriodic* iReconnect;
+
+ TBool iSessionError;
+
+#ifdef _DEBUG
+ TUint32 iAddCounter;
+ TUint32 iModCounter;
+#endif
+};
+
+#endif // THUMBAGDAEMON_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagcameraobserver.h Thu Jul 22 16:37:07 2010 +0100
@@ -0,0 +1,145 @@
+/*
+* 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: Thumbnail Auto Generate Daemon
+ *
+*/
+
+
+#ifndef THUMBAGCAMERAOBSERVER_H
+#define THUMBAGCAMERAOBSERVER_H
+
+#include <e32base.h>
+#include <w32std.h>
+
+#include <mdesession.h>
+
+#include "thumbagprocessor.h"
+#include "tmshutdownobserver.h"
+#include "thumbnaillog.h"
+
+
+/**
+ * ThumbAG daemon.
+ *
+ * @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CThumbAGCameraObserver ): public CBase,
+ public MMdESessionObserver,
+ public MMdEObjectObserver,
+ public MTMShutdownObserver
+ {
+public:
+
+ /**
+ * Two-phased constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGCameraObserver server.
+ */
+ static CThumbAGCameraObserver* NewLC(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Two-phased constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGCameraObserver server.
+ */
+ static CThumbAGCameraObserver* NewL(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Destructor
+ *
+ * @since S60 v5.0
+ */
+ virtual ~CThumbAGCameraObserver();
+
+
+public:
+
+ // from MMdESessionObserver
+ void HandleSessionOpened( CMdESession& aSession, TInt aError );
+ void HandleSessionError( CMdESession& aSession, TInt aError );
+
+ // from MMdEObjectObserver
+ void HandleObjectNotification(CMdESession& aSession,
+ TObserverNotificationType aType,
+ const RArray<TItemId>& aObjectIdArray);
+
+ // from MTMShutdownObserver
+ void ShutdownNotification();
+
+protected:
+
+ /**
+ * AddObserversL
+ *
+ * @since S60 v5.0
+ */
+ void AddObserversL();
+
+
+private:
+
+ /**
+ * C++ default constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGCameraObserver instance.
+ */
+ CThumbAGCameraObserver(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Symbian 2nd phase constructor can leave.
+ *
+ * @since S60 v5.0
+ */
+ void ConstructL();
+
+ /**
+ * Initilization helper
+ *
+ * @since S60 v5.2
+ */
+ void InitializeL();
+
+ /**
+ * Callback for reconnect timer
+ *
+ * @since S60 v5.0
+ */
+ static TInt ReconnectCallBack(TAny* aAny);
+
+private:
+
+ // own
+ CTMShutdownObserver* iShutdownObserver;
+ CTMShutdownObserver* iMDSShutdownObserver;
+ CMdESession* iMdESession;
+ //not owned
+ CThumbAGProcessor* iProcessor;
+
+ TBool iShutdown;
+
+ // reconnect timer
+ CPeriodic* iReconnect;
+
+ TBool iSessionError;
+
+#ifdef _DEBUG
+ TUint32 iAddCounter;
+ TUint32 iModCounter;
+#endif
+};
+
+#endif // THUMBAGDAEMON_H
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagdaemon.h Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagdaemon.h Thu Jul 22 16:37:07 2010 +0100
@@ -27,6 +27,10 @@
#include "thumbagprocessor.h"
#include "tmshutdownobserver.h"
#include "thumbnaillog.h"
+#include "thumbagimageobserver.h"
+#include "thumbagcameraobserver.h"
+#include "thumbagaudioobserver.h"
+#include "thumbagvideoobserver.h"
/**
@@ -173,11 +177,18 @@
// reconnect timer
CPeriodic* iReconnect;
+ TBool iSessionError;
+
#ifdef _DEBUG
TUint32 iAddCounter;
- TUint32 iModCounter;
TUint32 iDelCounter;
#endif
+
+ //observers
+ CThumbAGImageObserver* iImageObserver;
+ CThumbAGCameraObserver* iCameraObserver;
+ CThumbAGAudioObserver* iAudioObserver;
+ CThumbAGVideoObserver* iVideoObserver;
};
#endif // THUMBAGDAEMON_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagimageobserver.h Thu Jul 22 16:37:07 2010 +0100
@@ -0,0 +1,144 @@
+/*
+* 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: Thumbnail Auto Generate Daemon
+ *
+*/
+
+
+#ifndef THUMBAGIMAGEOBSERVER_H
+#define THUMBAGIMAGEOBSERVER_H
+
+#include <e32base.h>
+#include <w32std.h>
+
+#include <mdesession.h>
+
+#include "thumbagprocessor.h"
+#include "thumbnaillog.h"
+#include "tmshutdownobserver.h"
+
+/**
+ * ThumbAG daemon.
+ *
+ * @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CThumbAGImageObserver ): public CBase,
+ public MMdESessionObserver,
+ public MMdEObjectObserver,
+ public MTMShutdownObserver
+ {
+public:
+
+ /**
+ * Two-phased constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGImageObserver server.
+ */
+ static CThumbAGImageObserver* NewLC(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Two-phased constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGImageObserver server.
+ */
+ static CThumbAGImageObserver* NewL(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Destructor
+ *
+ * @since S60 v5.0
+ */
+ virtual ~CThumbAGImageObserver();
+
+
+public:
+
+ // from MMdESessionObserver
+ void HandleSessionOpened( CMdESession& aSession, TInt aError );
+ void HandleSessionError( CMdESession& aSession, TInt aError );
+
+ // from MMdEObjectObserver
+ void HandleObjectNotification(CMdESession& aSession,
+ TObserverNotificationType aType,
+ const RArray<TItemId>& aObjectIdArray);
+
+ // from MTMShutdownObserver
+ void ShutdownNotification();
+
+protected:
+
+ /**
+ * AddObserversL
+ *
+ * @since S60 v5.0
+ */
+ void AddObserversL();
+
+
+private:
+
+ /**
+ * C++ default constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGImageObserver instance.
+ */
+ CThumbAGImageObserver(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Symbian 2nd phase constructor can leave.
+ *
+ * @since S60 v5.0
+ */
+ void ConstructL();
+
+ /**
+ * Initilization helper
+ *
+ * @since S60 v5.2
+ */
+ void InitializeL();
+
+ /**
+ * Callback for reconnect timer
+ *
+ * @since S60 v5.0
+ */
+ static TInt ReconnectCallBack(TAny* aAny);
+
+private:
+
+ // own
+ CTMShutdownObserver* iShutdownObserver;
+ CTMShutdownObserver* iMDSShutdownObserver;
+ CMdESession* iMdESession;
+ //not owned
+ CThumbAGProcessor* iProcessor;
+
+ TBool iShutdown;
+
+ // reconnect timer
+ CPeriodic* iReconnect;
+
+ TBool iSessionError;
+
+#ifdef _DEBUG
+ TUint32 iAddCounter;
+ TUint32 iModCounter;
+#endif
+};
+
+#endif // THUMBAGDAEMON_H
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h Thu Jul 22 16:37:07 2010 +0100
@@ -32,10 +32,46 @@
#include "tmactivitymanager.h"
#include "tmformatobserver.h"
#include "tmrpropertyobserver.h"
+#include "thumbnailmanagerconstants.h"
//FORWARD DECLARATIONS
class MMPXCollectionUtility;
+
+enum TThumbnailGenerationItemType
+ {
+ EGenerationItemTypeUnknown,
+ EGenerationItemTypeNotFound,
+ EGenerationItemTypeCamera,
+ EGenerationItemTypeAny,
+ EGenerationItemTypeAudio,
+ EGenerationItemTypeVideo,
+ EGenerationItemTypeImage,
+ EGenerationItemTypeItemCount
+ };
+
+ enum TThumbnailGenerationItemAction
+ {
+ EGenerationItemActionAdd,
+ EGenerationItemActionDelete,
+ EGenerationItemActionModify,
+ EGenerationItemAction2ndAdd,
+ EGenerationItemActionResolveType,
+ EGenerationItemActionCount
+ };
+
+ struct TThumbnailGenerationItem
+ {
+ inline TThumbnailGenerationItem(): iItemId( KErrNotFound ), iItemType(EGenerationItemTypeUnknown), iItemAction(EGenerationItemActionAdd), iPlaceholder(EFalse), iUri(NULL){}
+ inline ~TThumbnailGenerationItem(){delete iUri; iUri = NULL;}
+
+ TItemId iItemId;
+ TThumbnailGenerationItemType iItemType;
+ TThumbnailGenerationItemAction iItemAction;
+ TBool iPlaceholder;
+ HBufC* iUri;
+ };
+
/**
* Processor object for handling thumb generation
*
@@ -43,6 +79,7 @@
*/
class CThumbAGProcessor: public CActive,
public MThumbnailManagerObserver,
+ public MThumbnailManagerRequestObserver,
public MMdEQueryObserver,
public MHarvesterEventObserver,
public MMPXCollectionObserver,
@@ -78,6 +115,8 @@
// from MThumbnailManagerObserver
void ThumbnailPreviewReady( MThumbnailData& aThumbnail, TThumbnailRequestId aId );
void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, TThumbnailRequestId aId );
+ // from MThumbnailManagerRequestObserver
+ void ThumbnailRequestReady( TInt aError, TThumbnailRequestType aRequestType, TThumbnailRequestId aId );
// from MHarvesterEventObserver
void HarvestingUpdated(
@@ -116,17 +155,18 @@
* @since S60 v5.0
* @param aMdESession MdE Session
*/
- void SetMdESession( CMdESession* aMdESession );
+ void SetMdESessionL( CMdESession* aMdESession );
/**
* Adds new IDs to queue
*
* @since S60 v5.0
* @param aType TObserverNotificationType
+ * @param TThumbnailGenerationItemType
* @param aIDArray IDs for thumbnail creation
* @param aForce pass ETrue if processor is forced to run without waiting harvesting complete
*/
- void AddToQueueL( TObserverNotificationType aType, const RArray<TItemId>& aIDArray, const RPointerArray<HBufC>& aObjectUriArray, TBool aPresent );
+ void AddToQueueL( TObserverNotificationType aType, TThumbnailGenerationItemType aItemType, const RArray<TItemId>& aIDArray, const RPointerArray<HBufC>& aObjectUriArray, TBool aPresent );
/**
* Calls Thumbnail Manager to create thumbnails
@@ -145,6 +185,9 @@
void RemoveFromQueues( const RArray<TItemId>& aIDArray, const TBool aRemoveFromDelete = EFalse);
void SetForceRun( const TBool aForceRun );
+
+ //prepare processor for shutdown
+ void Shutdown();
protected:
@@ -154,16 +197,17 @@
* QueryL
*
* @since S60 v5.0
- * @param aIDArray Item IDs to query
+ * @param TThumbnailGenerationItemAction
*/
- void QueryL( RArray<TItemId>& aIDArray );
+ void QueryL( TThumbnailGenerationItemAction aType);
/**
* QueryPlaceholdersL
*
* @since S60 v5.0
+ * @param aPresent item should not be present item
*/
- void QueryPlaceholdersL();
+ void QueryPlaceholdersL(const TBool aPresent);
/**
* DeleteAndCancelQuery
@@ -254,14 +298,58 @@
* @since S60 v5.0
* @param aDefine (re)define PS key before setting value
*/
- void UpdatePSValues(const TBool aDefine = EFalse);
+ void UpdatePSValues(const TBool aDefine, const TBool aForce);
/**
* Comparison function for logaritmic use of queue arrays
*
+ * @since S60 S^3
+ */
+ static TInt Compare(const TThumbnailGenerationItem& aLeft, const TThumbnailGenerationItem& aRight);
+
+ /**
+ * Comparison function for logaritmic use of queue arrays
+ *
+ * @since S60 S^3
+ */
+ static TInt CompareId(const TItemId& aLeft, const TItemId& aRight);
+
+ /**
+ * Recalculate item counts
+ *
+ * @since S60 S^3
+ */
+ void UpdateItemCounts();
+
+ /**
+ * Callback for mount timeout
+ *
* @since S60 v5.0
*/
- static TInt Compare(const TItemId& aLeft, const TItemId& aRight);
+ static TInt MountTimerCallBack(TAny* aAny);
+
+ /**
+ * Set item's action from type
+ *
+ * @since S^3
+ */
+ void SetGenerationItemAction( TThumbnailGenerationItem& aGenerationItem, const TThumbnailGenerationItemType aItemType );
+
+ /**
+ * Set item type property from TDedIf
+ * @param aGenerationItem TThumbnailGenerationItem
+ * @param aItemType TThumbnailGenerationItemType
+ * @since S^3
+ */
+ void SetGenerationItemType( TThumbnailGenerationItem& aGenerationItem, const TDefId aDefId );
+
+ /**
+ * Append item to processing queue or update existing
+ * @param aGenerationItem modified TThumbnailGenerationItem
+ * @param aDefId items MDS object definition ID
+ * @since S^3
+ */
+ void AppendProcessingQueue(TThumbnailGenerationItem& item );
private:
@@ -275,20 +363,19 @@
CMdEObjectQuery* iQueryAllItems;
CMdEObjectQuery* iQueryPlaceholders;
- RArray<TItemId> iAddQueue;
- RArray<TItemId> iModifyQueue;
- RPointerArray<HBufC> iRemoveQueue;
+ RArray<TThumbnailGenerationItem> iGenerationQueue;
+ //RPointerArray<HBufC> iRemoveQueue;
RArray<TItemId> iQueryQueue;
- RArray<TItemId> iPlaceholderQueue;
- //not processing queue, used to keep KItemsLeft PS correct
- RArray<TItemId> i2ndRoundGenerateQueue;
- //reference to current processing queue
- RArray<TItemId>* iLastQueue;
//background generation state
// EFalse = 1st round, create only grid size thumbnail for images and videos
// ETrue = 2nds round, create all missing sizes for all media items
TBool i2ndRound;
+
+ // query state
+ // EFalse = normal mode
+ // ETrue = querying unknown items
+ TBool iUnknown;
//MDS query issues
TBool iQueryActive;
@@ -297,7 +384,7 @@
//Processing MDS itens which are modified
TBool iModify;
- TInt iProcessingCount;
+ TUint iProcessingCount;
//MDS harvester's overall state
TBool iHarvesting;
@@ -311,8 +398,8 @@
TBool iMMCHarvesting;
TBool iMMCHarvestingTemp;
-
CPeriodic* iPeriodicTimer;
+ CPeriodic* iMountTimer;
//MDS Harvester client
RHarvesterClient iHarvesterClient;
@@ -323,7 +410,7 @@
//2nd phase init after MDE session is open
TBool iInit2;
- // auto create
+ // auto create values from centrep
TBool iAutoImage;
TBool iAutoVideo;
TBool iAutoAudio;
@@ -333,24 +420,26 @@
// controlled by Photos application to run TN generation on foreground
TBool iForegroundRun;
//request pending in TNM side
- TBool iActive;
CTMFormatObserver* iFormatObserver;
+ //formating started
TBool iFormatting;
+ //TNM server session died
TBool iSessionDied;
- TInt iActiveCount;
+ //pending request count
+ TUint iActiveCount;
MMPXCollectionUtility* iCollectionUtility; // own
//Flag is MPX harvesting or MTP synchronisation in progress
TBool iMPXHarvesting;
- //inactivity polling timer
- CPeriodic* iInactivityTimer;
+
//overall status of device
TBool iIdle;
+ //monitors device activity
CTMActivityManager* iActivityManager;
//Observer foreground generation
@@ -361,6 +450,30 @@
TBool iPreviousDaemonProcessing;
//set ETrue when QueryAllItems needs to be run after placeholder query
TBool iDoQueryAllItems;
-};
+
+ TBool iShutdown;
+
+ //item counts
+ TUint32 iModifyItemCount;
+ TUint32 iImageItemCount;
+ TUint32 iVideoItemCount;
+ TUint32 iAudioItemCount;
+ TUint32 iDeleteItemCount;
+ TUint32 iAddItemCount;
+ TUint32 iCameraItemCount;
+ TUint32 iUnknownItemCount;
+ TUint32 i2ndAddItemCount;
+ TUint32 iPlaceholderItemCount;
+
+ //for book keeping previous items left count got from MDS harvester
+ TUint32 iMMCHarvestingItemsLeftTemp;
+ TUint32 iPHHarvestingItemsLeftTemp;
+
+ //MdE object definitons used in query
+ CMdEObjectDef* iImageObjectDef;
+ CMdEObjectDef* iVideoObjectDef;
+ CMdEObjectDef* iAudioObjectDef;
+ TBool iHarvesterActivated;
+ };
#endif // THUMBAGPROCESSOR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagvideoobserver.h Thu Jul 22 16:37:07 2010 +0100
@@ -0,0 +1,145 @@
+/*
+* 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: Thumbnail Auto Generate Daemon
+ *
+*/
+
+
+#ifndef THUMBAGVIDEOBSERVER_H
+#define THUMBAGVIDEOBSERVER_H
+
+#include <e32base.h>
+#include <w32std.h>
+
+#include <mdesession.h>
+
+#include "thumbagprocessor.h"
+#include "thumbnaillog.h"
+#include "tmshutdownobserver.h"
+
+
+/**
+ * ThumbAG daemon.
+ *
+ * @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CThumbAGVideoObserver ): public CBase,
+ public MMdESessionObserver,
+ public MMdEObjectObserver,
+ public MTMShutdownObserver
+ {
+public:
+
+ /**
+ * Two-phased constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGVideoObserver server.
+ */
+ static CThumbAGVideoObserver* NewLC(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Two-phased constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGVideoObserver server.
+ */
+ static CThumbAGVideoObserver* NewL(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Destructor
+ *
+ * @since S60 v5.0
+ */
+ virtual ~CThumbAGVideoObserver();
+
+
+public:
+
+ // from MMdESessionObserver
+ void HandleSessionOpened( CMdESession& aSession, TInt aError );
+ void HandleSessionError( CMdESession& aSession, TInt aError );
+
+ // from MMdEObjectObserver
+ void HandleObjectNotification(CMdESession& aSession,
+ TObserverNotificationType aType,
+ const RArray<TItemId>& aObjectIdArray);
+
+ // from MTMShutdownObserver
+ void ShutdownNotification();
+
+protected:
+
+ /**
+ * AddObserversL
+ *
+ * @since S60 v5.0
+ */
+ void AddObserversL();
+
+
+private:
+
+ /**
+ * C++ default constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGVideoObserver instance.
+ */
+ CThumbAGVideoObserver(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Symbian 2nd phase constructor can leave.
+ *
+ * @since S60 v5.0
+ */
+ void ConstructL();
+
+ /**
+ * Initilization helper
+ *
+ * @since S60 v5.2
+ */
+ void InitializeL();
+
+ /**
+ * Callback for reconnect timer
+ *
+ * @since S60 v5.0
+ */
+ static TInt ReconnectCallBack(TAny* aAny);
+
+private:
+
+ // own
+ CTMShutdownObserver* iShutdownObserver;
+ CTMShutdownObserver* iMDSShutdownObserver;
+ CMdESession* iMdESession;
+ //not owned
+ CThumbAGProcessor* iProcessor;
+
+ TBool iShutdown;
+
+ // reconnect timer
+ CPeriodic* iReconnect;
+
+ TBool iSessionError;
+
+#ifdef _DEBUG
+ TUint32 iAddCounter;
+ TUint32 iModCounter;
+#endif
+};
+
+#endif // THUMBAGDAEMON_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagaudioobserver.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -0,0 +1,348 @@
+/*
+* 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: Thumbnail Auto Generate Daemon
+*
+*/
+
+
+#include <e32svr.h>
+#include <centralrepository.h>
+
+#include <mdesession.h>
+#include <mdeconstants.h>
+#include <mdequery.h>
+#include <mdeobject.h>
+
+#include "thumbagaudioobserver.h"
+#include "thumbnaillog.h"
+#include "thumbnailmanagerconstants.h"
+#include "thumbnailmanagerprivatecrkeys.h"
+
+
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//
+CThumbAGAudioObserver* CThumbAGAudioObserver::NewLC(CThumbAGProcessor* aProcessor)
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::NewLC() - begin" );
+
+ CThumbAGAudioObserver* self = new (ELeave) CThumbAGAudioObserver(aProcessor);
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CThumbAGAudioObserver* CThumbAGAudioObserver::NewL(CThumbAGProcessor* aProcessor)
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::NewL() - begin" );
+
+ CThumbAGAudioObserver* self = CThumbAGAudioObserver::NewLC(aProcessor);
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGAudioObserver
+// ---------------------------------------------------------------------------
+//
+CThumbAGAudioObserver::CThumbAGAudioObserver(CThumbAGProcessor* aProcessor)
+ : iShutdownObserver(NULL), iMDSShutdownObserver(NULL), iMdESession(NULL), iProcessor(aProcessor)
+ {
+ // No implementation required
+ }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CThumbAGAudioObserver::ConstructL()
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::ConstructL() - begin" );
+
+#ifdef _DEBUG
+ iAddCounter = 0;
+ iModCounter = 0;
+#endif
+
+ InitializeL();
+
+ TN_DEBUG1( "CThumbAGAudioObserver::ConstructL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// ~CThumbAGAudioObserver
+// ---------------------------------------------------------------------------
+//
+void CThumbAGAudioObserver::InitializeL()
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::InitializeL() - begin" );
+
+
+ TN_DEBUG1( "CThumbAGAudioObserver::InitializeL() - create observers" );
+
+ // create shutdown observer
+ if(iMDSShutdownObserver)
+ {
+ delete iMDSShutdownObserver;
+ iMDSShutdownObserver = NULL;
+ }
+ iMDSShutdownObserver = CTMShutdownObserver::NewL( *this, KMdSPSShutdown, KMdSShutdown, EFalse );
+
+ if(iShutdownObserver)
+ {
+ delete iShutdownObserver;
+ iShutdownObserver = NULL;
+ }
+ iShutdownObserver = CTMShutdownObserver::NewL( *this, KTAGDPSNotification, KShutdown, ETrue );
+ iShutdown = EFalse;
+
+ // MDS session reconnect timer
+ if (!iReconnect)
+ {
+ iReconnect = CPeriodic::NewL(CActive::EPriorityIdle);
+ }
+
+ TN_DEBUG1( "CThumbAGAudioObserver::InitializeL() - connect to MDS" );
+
+ if(iMdESession)
+ {
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+
+ // connect to MDS
+ delete iMdESession;
+ iMdESession = NULL;
+ }
+
+ iMdESession = CMdESession::NewL( *this );
+ iSessionError = EFalse;
+
+ TN_DEBUG1( "CThumbAGAudioObserver::InitializeL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// ~CThumbAGAudioObserver
+// ---------------------------------------------------------------------------
+//
+CThumbAGAudioObserver::~CThumbAGAudioObserver()
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::~CThumbAGAudioObserver() - begin" );
+
+ iShutdown = ETrue;
+
+ Shutdown();
+
+ TN_DEBUG1( "CThumbAGAudioObserver::~CThumbAGAudioObserver() - end" );
+ }
+
+void CThumbAGAudioObserver::Shutdown()
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::Shutdown()" );
+
+ delete iMDSShutdownObserver;
+ iMDSShutdownObserver = NULL;
+ delete iShutdownObserver;
+ iShutdownObserver = NULL;
+
+ if(iReconnect)
+ {
+ iReconnect->Cancel();
+ delete iReconnect;
+ iReconnect = NULL;
+ }
+
+ if (iMdESession)
+ {
+ // 2 observers
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+
+ delete iMdESession;
+ iMdESession = NULL;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGAudioObserver::HandleSessionOpened
+// -----------------------------------------------------------------------------
+//
+void CThumbAGAudioObserver::HandleSessionOpened( CMdESession& /* aSession */, TInt aError )
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::HandleSessionOpened");
+
+ if (aError == KErrNone)
+ {
+ TRAPD( err, AddObserversL() );
+ if (err != KErrNone)
+ {
+ TN_DEBUG2( "CThumbAGAudioObserver::HandleSessionOpened, AddObserversL error == %d", err );
+ }
+ }
+ else
+ {
+ TN_DEBUG2( "CThumbAGAudioObserver::HandleSessionOpened error == %d", aError );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGAudioObserver::HandleSessionError
+// -----------------------------------------------------------------------------
+//
+void CThumbAGAudioObserver::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
+ {
+ TN_DEBUG2( "CThumbAGAudioObserver::HandleSessionError == %d", aError );
+ if (aError != KErrNone && !iSessionError)
+ {
+ iSessionError = ETrue;
+
+ if (!iShutdown)
+ {
+ if (!iReconnect->IsActive())
+ {
+ iReconnect->Start( KMdEReconnect, KMdEReconnect,
+ TCallBack(ReconnectCallBack, this));
+
+ TN_DEBUG1( "CThumbAGAudioObserver::HandleSessionError() - reconnect timer started" );
+ }
+ }
+
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGAudioObserver::HandleObjectNotification
+// -----------------------------------------------------------------------------
+//
+void CThumbAGAudioObserver::HandleObjectNotification( CMdESession& /*aSession*/,
+ TObserverNotificationType aType,
+ const RArray<TItemId>& aObjectIdArray )
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::HandleObjectNotification() - begin" );
+
+ // no processor or shutting down
+ if ( iShutdown || !iProcessor)
+ {
+ return;
+ }
+
+#ifdef _DEBUG
+ if (aType == ENotifyAdd)
+ {
+ TN_DEBUG2( "CThumbAGAudioObserver::HandleObjectNotification() - ENotifyAdd %d", aObjectIdArray.Count() );
+ iAddCounter = aObjectIdArray.Count();
+ }
+ else if (aType == ENotifyModify)
+ {
+ TN_DEBUG2( "CThumbAGAudioObserver::HandleObjectNotification() - ENotifyModify %d", aObjectIdArray.Count() );
+ iModCounter = aObjectIdArray.Count();
+ }
+#endif
+
+ if ( (aType == ENotifyAdd || aType == ENotifyModify ) && (aObjectIdArray.Count() > 0) )
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::HandleObjectNotification() - AddToQueueL" );
+
+ // Add event to processing queue by type and enable force run
+ RPointerArray<HBufC> dummyArray;
+ TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeAudio, aObjectIdArray, dummyArray, EFalse));
+ if (err != KErrNone)
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::HandleObjectNotification() - error adding to queue" );
+ }
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::HandleObjectNotification() - bad notification" );
+ }
+
+#ifdef _DEBUG
+ TN_DEBUG3( "CThumbAGAudioObserver::IN-COUNTERS---------- Add = %d Modify = %d", iAddCounter, iModCounter );
+ iModCounter = 0;
+ iAddCounter = 0;
+#endif
+
+ TN_DEBUG1( "CThumbAGAudioObserver::HandleObjectNotification() - end" );
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGAudioObserver::ShutdownNotification
+// -----------------------------------------------------------------------------
+//
+void CThumbAGAudioObserver::ShutdownNotification()
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::ShutdownNotification()" );
+
+ if (!iShutdown)
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::ShutdownNotification() shutdown" );
+ iShutdown = ETrue;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGAudioObserver::AddObserversL
+// ---------------------------------------------------------------------------
+//
+void CThumbAGAudioObserver::AddObserversL()
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::AddObserversL() - begin" );
+
+ CMdENamespaceDef& defaultNamespace = iMdESession->GetDefaultNamespaceDefL();
+ CMdEObjectDef& audioDef = defaultNamespace.GetObjectDefL( MdeConstants::Audio::KAudioObject );
+
+ // set observing conditions
+ CMdELogicCondition* addCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
+ addCondition->AddObjectConditionL( audioDef );
+ CleanupStack::Pop( addCondition );
+
+ CMdELogicCondition* modifyCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
+ modifyCondition->AddObjectConditionL( audioDef );
+ CleanupStack::Pop( modifyCondition );
+
+ // add observer
+ iMdESession->AddObjectObserverL( *this, addCondition, ENotifyAdd );
+
+ // modify observer
+ iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify );
+
+ TN_DEBUG1( "CThumbAGAudioObserver::AddObserversL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGAudioObserver::ReconnectCallBack()
+// ---------------------------------------------------------------------------
+//
+TInt CThumbAGAudioObserver::ReconnectCallBack(TAny* aAny)
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::ReconnectCallBack() - reinitialize");
+
+ CThumbAGAudioObserver* self = static_cast<CThumbAGAudioObserver*>( aAny );
+
+ self->iReconnect->Cancel();
+
+ // reconnect to MDS
+ TRAP_IGNORE( self->InitializeL() );
+
+ TN_DEBUG1( "CThumbAGAudioObserver::ReconnectCallBack() - done");
+
+ return KErrNone;
+ }
+
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagcameraobserver.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -0,0 +1,340 @@
+/*
+* 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: Thumbnail Auto Generate Daemon
+*
+*/
+
+
+#include <e32svr.h>
+#include <centralrepository.h>
+
+#include <mdesession.h>
+#include <mdeconstants.h>
+#include <mdequery.h>
+#include <mdeobject.h>
+
+#include "thumbagcameraobserver.h"
+#include "thumbnaillog.h"
+#include "thumbnailmanagerconstants.h"
+#include "thumbnailmanagerprivatecrkeys.h"
+
+
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//
+CThumbAGCameraObserver* CThumbAGCameraObserver::NewLC(CThumbAGProcessor* aProcessor)
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::NewLC() - begin" );
+
+ CThumbAGCameraObserver* self = new (ELeave) CThumbAGCameraObserver(aProcessor);
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CThumbAGCameraObserver* CThumbAGCameraObserver::NewL(CThumbAGProcessor* aProcessor)
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::NewL() - begin" );
+
+ CThumbAGCameraObserver* self = CThumbAGCameraObserver::NewLC(aProcessor);
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGCameraObserver
+// ---------------------------------------------------------------------------
+//
+CThumbAGCameraObserver::CThumbAGCameraObserver(CThumbAGProcessor* aProcessor)
+ : iShutdownObserver(NULL), iMDSShutdownObserver(NULL), iMdESession(NULL), iProcessor(aProcessor)
+ {
+ // No implementation required
+ }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CThumbAGCameraObserver::ConstructL()
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::ConstructL() - begin" );
+
+#ifdef _DEBUG
+ iAddCounter = 0;
+ iModCounter = 0;
+#endif
+
+ InitializeL();
+
+ TN_DEBUG1( "CThumbAGCameraObserver::ConstructL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// ~CThumbAGCameraObserver
+// ---------------------------------------------------------------------------
+//
+void CThumbAGCameraObserver::InitializeL()
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::InitializeL() - begin" );
+
+
+ TN_DEBUG1( "CThumbAGCameraObserver::InitializeL() - create observers" );
+
+ // create shutdown observer
+ if(iMDSShutdownObserver)
+ {
+ delete iMDSShutdownObserver;
+ iMDSShutdownObserver = NULL;
+ }
+ iMDSShutdownObserver = CTMShutdownObserver::NewL( *this, KMdSPSShutdown, KMdSShutdown, EFalse );
+
+ if(iShutdownObserver)
+ {
+ delete iShutdownObserver;
+ iShutdownObserver = NULL;
+ }
+ iShutdownObserver = CTMShutdownObserver::NewL( *this, KTAGDPSNotification, KShutdown, ETrue );
+ iShutdown = EFalse;
+
+ // MDS session reconnect timer
+ if (!iReconnect)
+ {
+ iReconnect = CPeriodic::NewL(CActive::EPriorityIdle);
+ }
+
+ TN_DEBUG1( "CThumbAGCameraObserver::InitializeL() - connect to MDS" );
+
+ if(iMdESession)
+ {
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+
+ // connect to MDS
+ delete iMdESession;
+ iMdESession = NULL;
+ }
+
+ iMdESession = CMdESession::NewL( *this );
+ iSessionError = EFalse;
+
+ TN_DEBUG1( "CThumbAGCameraObserver::InitializeL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// ~CThumbAGCameraObserver
+// ---------------------------------------------------------------------------
+//
+CThumbAGCameraObserver::~CThumbAGCameraObserver()
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::~CThumbAGCameraObserver() - begin" );
+
+ iShutdown = ETrue;
+
+ delete iMDSShutdownObserver;
+ delete iShutdownObserver;
+
+ if(iReconnect)
+ {
+ iReconnect->Cancel();
+ delete iReconnect;
+ iReconnect = NULL;
+ }
+
+ if (iMdESession)
+ {
+ // 2 observers
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+
+ delete iMdESession;
+ iMdESession = NULL;
+ }
+
+ TN_DEBUG1( "CThumbAGCameraObserver::~CThumbAGCameraObserver() - end" );
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGCameraObserver::HandleSessionOpened
+// -----------------------------------------------------------------------------
+//
+void CThumbAGCameraObserver::HandleSessionOpened( CMdESession& /* aSession */, TInt aError )
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::HandleSessionOpened");
+
+ if (aError == KErrNone)
+ {
+ TRAPD( err, AddObserversL() );
+ if (err != KErrNone)
+ {
+ TN_DEBUG2( "CThumbAGCameraObserver::HandleSessionOpened, AddObserversL error == %d", err );
+ }
+ }
+ else
+ {
+ TN_DEBUG2( "CThumbAGCameraObserver::HandleSessionOpened error == %d", aError );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGCameraObserver::HandleSessionError
+// -----------------------------------------------------------------------------
+//
+void CThumbAGCameraObserver::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
+ {
+ TN_DEBUG2( "CThumbAGCameraObserver::HandleSessionError == %d", aError );
+ if (aError != KErrNone && !iSessionError)
+ {
+ iSessionError = ETrue;
+
+ if (!iShutdown)
+ {
+ if (!iReconnect->IsActive())
+ {
+ iReconnect->Start( KMdEReconnect, KMdEReconnect,
+ TCallBack(ReconnectCallBack, this));
+
+ TN_DEBUG1( "CThumbAGCameraObserver::HandleSessionError() - reconnect timer started" );
+ }
+ }
+
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGCameraObserver::HandleObjectNotification
+// -----------------------------------------------------------------------------
+//
+void CThumbAGCameraObserver::HandleObjectNotification( CMdESession& /*aSession*/,
+ TObserverNotificationType aType,
+ const RArray<TItemId>& aObjectIdArray )
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - begin" );
+
+ // no processor or shutting down
+ if ( iShutdown || !iProcessor)
+ {
+ return;
+ }
+
+#ifdef _DEBUG
+ if (aType == ENotifyAdd)
+ {
+ TN_DEBUG2( "CThumbAGCameraObserver::HandleObjectNotification() - ENotifyAdd %d", aObjectIdArray.Count() );
+ iAddCounter = aObjectIdArray.Count();
+ }
+ else if (aType == ENotifyModify)
+ {
+ TN_DEBUG2( "CThumbAGCameraObserver::HandleObjectNotification() - ENotifyModify %d", aObjectIdArray.Count() );
+ iModCounter = aObjectIdArray.Count();
+ }
+#endif
+
+ if ( (aType == ENotifyAdd || aType == ENotifyModify ) && (aObjectIdArray.Count() > 0) )
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - AddToQueueL" );
+
+ // Add event to processing queue by type and enable force run
+ RPointerArray<HBufC> dummyArray;
+ TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeCamera, aObjectIdArray, dummyArray, EFalse));
+ if (err != KErrNone)
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - error adding to queue" );
+ }
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - bad notification" );
+ }
+
+#ifdef _DEBUG
+ TN_DEBUG3( "CThumbAGCameraObserver::IN-COUNTERS---------- Add = %d Modify = %d", iAddCounter, iModCounter );
+ iModCounter = 0;
+ iAddCounter = 0;
+#endif
+
+ TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - end" );
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGCameraObserver::ShutdownNotification
+// -----------------------------------------------------------------------------
+//
+void CThumbAGCameraObserver::ShutdownNotification()
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::ShutdownNotification()" );
+
+ if (!iShutdown)
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::ShutdownNotification() shutdown" );
+ iShutdown = ETrue;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGCameraObserver::AddObserversL
+// ---------------------------------------------------------------------------
+//
+void CThumbAGCameraObserver::AddObserversL()
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::AddObserversL() - begin" );
+
+ CMdENamespaceDef& defaultNamespace = iMdESession->GetDefaultNamespaceDefL();
+ CMdEObjectDef& objectDef = defaultNamespace.GetObjectDefL( MdeConstants::Object::KBaseObject );
+ CMdEPropertyDef& originPropDef = objectDef.GetPropertyDefL( MdeConstants::Object::KOriginProperty );
+
+ // set observing conditions
+ CMdELogicCondition* addCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
+ addCondition->AddPropertyConditionL( originPropDef, TMdEUintEqual(MdeConstants::Object::ECamera));
+ CleanupStack::Pop( addCondition );
+
+ CMdELogicCondition* modifyCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
+ modifyCondition->AddPropertyConditionL( originPropDef, TMdEUintEqual(MdeConstants::Object::ECamera));
+ CleanupStack::Pop( modifyCondition );
+
+ // add observer
+ iMdESession->AddObjectObserverL( *this, addCondition, ENotifyAdd );
+
+ // modify observer
+ iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify );
+
+ TN_DEBUG1( "CThumbAGCameraObserver::AddObserversL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGCameraObserver::ReconnectCallBack()
+// ---------------------------------------------------------------------------
+//
+TInt CThumbAGCameraObserver::ReconnectCallBack(TAny* aAny)
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::ReconnectCallBack() - reinitialize");
+
+ CThumbAGCameraObserver* self = static_cast<CThumbAGCameraObserver*>( aAny );
+
+ self->iReconnect->Cancel();
+
+ // reconnect to MDS
+ TRAP_IGNORE( self->InitializeL() );
+
+ TN_DEBUG1( "CThumbAGCameraObserver::ReconnectCallBack() - done");
+
+ return KErrNone;
+ }
+
+
+// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -80,7 +80,6 @@
#ifdef _DEBUG
iAddCounter = 0;
- iModCounter = 0;
iDelCounter = 0;
#endif
@@ -120,6 +119,7 @@
// create processor
if(iProcessor)
{
+ iProcessor->Shutdown();
delete iProcessor;
iProcessor = NULL;
}
@@ -136,9 +136,7 @@
if(iMdESession)
{
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverWithUriL( *this ) );
TRAP_IGNORE( iMdESession->RemoveObjectPresentObserverL( * this ));
// connect to MDS
@@ -147,6 +145,23 @@
}
iMdESession = CMdESession::NewL( *this );
+ iSessionError = EFalse;
+
+ delete iImageObserver;
+ iImageObserver = NULL;
+ iImageObserver = CThumbAGImageObserver::NewL(iProcessor);
+
+ delete iCameraObserver;
+ iCameraObserver = NULL;
+ iCameraObserver = CThumbAGCameraObserver::NewL(iProcessor);
+
+ delete iAudioObserver;
+ iAudioObserver = NULL;
+ iAudioObserver = CThumbAGAudioObserver::NewL(iProcessor);
+
+ delete iVideoObserver;
+ iVideoObserver = NULL;
+ iVideoObserver = CThumbAGVideoObserver::NewL(iProcessor);
}
else
{
@@ -164,7 +179,19 @@
{
TN_DEBUG1( "CThumbAGDaemon::~CThumbAGDaemon() - begin" );
- iShutdown = ETrue;
+ iShutdown = ETrue;
+
+ delete iImageObserver;
+ iImageObserver = NULL;
+
+ delete iCameraObserver;
+ iCameraObserver = NULL;
+
+ delete iVideoObserver;
+ iVideoObserver = NULL;
+
+ delete iAudioObserver;
+ iAudioObserver = NULL;
delete iMDSShutdownObserver;
delete iShutdownObserver;
@@ -178,15 +205,13 @@
if (iProcessor)
{
+ iProcessor->Shutdown();
delete iProcessor;
iProcessor = NULL;
}
if (iMdESession)
{
- // 2 observers
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
-
#ifdef MDS_URI_OBSERVER
// remove observer with uri
TRAP_IGNORE( iMdESession->RemoveObjectObserverWithUriL( *this ) );
@@ -259,9 +284,9 @@
if (aError == KErrNone)
{
- iProcessor->SetMdESession(iMdESession);
+ TRAPD(err, iProcessor->SetMdESessionL(iMdESession));
- TRAPD( err, AddObserversL() );
+ TRAP( err, AddObserversL() );
if (err != KErrNone)
{
TN_DEBUG2( "CThumbAGDaemon::HandleSessionOpened, AddObserversL error == %d", err );
@@ -280,24 +305,36 @@
void CThumbAGDaemon::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
{
TN_DEBUG2( "CThumbAGDaemon::HandleSessionError == %d", aError );
- if (aError != KErrNone)
+ if (aError != KErrNone && !iShutdown && !iSessionError)
{
+ iSessionError = ETrue;
+
+ delete iImageObserver;
+ iImageObserver = NULL;
+
+ delete iCameraObserver;
+ iCameraObserver = NULL;
+
+ delete iVideoObserver;
+ iVideoObserver = NULL;
+
+ delete iAudioObserver;
+ iAudioObserver = NULL;
+
// kill processor right away, because it also has MdESession
if(iProcessor)
{
+ iProcessor->Shutdown();
delete iProcessor;
iProcessor = NULL;
}
- if (!iShutdown)
+ if (!iReconnect->IsActive())
{
- if (!iReconnect->IsActive())
- {
- iReconnect->Start( KMdEReconnect, KMdEReconnect,
- TCallBack(ReconnectCallBack, this));
-
- TN_DEBUG1( "CThumbAGDaemon::HandleSessionError() - reconnect timer started" );
- }
+ iReconnect->Start( KMdEReconnect, KMdEReconnect,
+ TCallBack(ReconnectCallBack, this));
+
+ TN_DEBUG1( "CThumbAGDaemon::HandleSessionError() - reconnect timer started" );
}
}
@@ -316,12 +353,18 @@
{
TN_DEBUG1( "CThumbAGDaemon::HandleUriObjectNotification() - begin" );
+ if(!iProcessor || iShutdown)
+ {
+ return;
+ }
+
if(aType == ENotifyRemove)
{
TN_DEBUG1( "CThumbAGDaemon::HandleUriObjectNotification() - removed");
TInt err(0);
- TRAP(err, iProcessor->AddToQueueL(aType, aObjectIdArray, aObjectUriArray, EFalse));
+ TRAP(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeAny, aObjectIdArray, aObjectUriArray, EFalse));
__ASSERT_DEBUG((err==KErrNone), User::Panic(_L("CThumbAGDaemon::HandleUriObjectNotification()"), err));
+
err = KErrNone;
}
TN_DEBUG1( "CThumbAGDaemon::HandleUriObjectNotification() - end" );
@@ -345,37 +388,23 @@
}
#ifdef _DEBUG
- if (aType == ENotifyAdd)
- {
- TN_DEBUG2( "CThumbAGDaemon::HandleObjectNotification() - ENotifyAdd %d", aObjectIdArray.Count() );
- iAddCounter = aObjectIdArray.Count();
- }
- else if (aType == ENotifyModify)
- {
- TN_DEBUG2( "CThumbAGDaemon::HandleObjectNotification() - ENotifyModify %d", aObjectIdArray.Count() );
- iModCounter = aObjectIdArray.Count();
- }
- else if (aType == ENotifyRemove)
+ if (aType == ENotifyRemove)
{
TN_DEBUG2( "CThumbAGDaemon::HandleObjectNotification() - ENotifyRemove %d", aObjectIdArray.Count() );
iDelCounter = aObjectIdArray.Count();
}
#endif
- if ( (aType == ENotifyAdd || aType == ENotifyModify || aType == ENotifyRemove) &&
- (aObjectIdArray.Count() > 0) )
+ if ( aType == ENotifyRemove && aObjectIdArray.Count() > 0 )
{
TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - AddToQueueL" );
// If delete event, remove IDs from Modify and Add queues
- if ( aType == ENotifyRemove )
- {
- iProcessor->RemoveFromQueues( aObjectIdArray, EFalse);
- }
+ iProcessor->RemoveFromQueues( aObjectIdArray, EFalse);
// Add event to processing queue by type and enable force run
RPointerArray<HBufC> dummyArray;
- TRAPD(err, iProcessor->AddToQueueL(aType, aObjectIdArray, dummyArray, EFalse));
+ TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeAny, aObjectIdArray, dummyArray, EFalse));
if (err != KErrNone)
{
TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - error adding to queue" );
@@ -387,12 +416,8 @@
}
#ifdef _DEBUG
- TN_DEBUG4( "CThumbAGDaemon::IN-COUNTERS---------- Add = %d Modify = %d Delete = %d",
- iAddCounter, iModCounter, iDelCounter );
- iModCounter = 0;
+ TN_DEBUG2( "CThumbAGDaemon::IN-COUNTERS---------- Delete = %d", iDelCounter );
iDelCounter = 0;
- iAddCounter = 0;
-
#endif
TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - end" );
@@ -422,10 +447,9 @@
{
// do not force run of these items
RPointerArray<HBufC> dummyArray;
- TRAP(err, iProcessor->AddToQueueL(ENotifyAdd, aObjectIdArray, dummyArray, ETrue));
+ TRAP(err, iProcessor->AddToQueueL(ENotifyAdd, EGenerationItemTypeUnknown, aObjectIdArray, dummyArray, ETrue));
- TN_DEBUG2( "CThumbAGDaemon::HandleObjectPresentNotification() - ENotifyAdd %d", aObjectIdArray.Count() );
-
+ TN_DEBUG2( "CThumbAGDaemon::HandleObjectPresentNotification() - ENotifyAdd unknown items %d", aObjectIdArray.Count() );
#ifdef _DEBUG
iAddCounter = aObjectIdArray.Count();
if (err != KErrNone)
@@ -457,11 +481,9 @@
}
#ifdef _DEBUG
- TN_DEBUG4( "CThumbAGDaemon::IN-COUNTERS---------- Add = %d Modify = %d Delete = %d",
- iAddCounter, iModCounter, iDelCounter );
- iModCounter = 0;
+ TN_DEBUG3( "CThumbAGDaemon::IN-COUNTERS---------- Add = %d Delete = %d", iAddCounter, iDelCounter );
iDelCounter = 0;
- iAddCounter = 0;
+ iAddCounter = 0;
#endif
TN_DEBUG1( "CThumbAGDaemon::HandleObjectPresentNotification() - end" );
@@ -490,31 +512,6 @@
{
TN_DEBUG1( "CThumbAGDaemon::AddObserversL() - begin" );
- CMdENamespaceDef& defaultNamespace = iMdESession->GetDefaultNamespaceDefL();
- CMdEObjectDef& imageDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject );
- CMdEObjectDef& videoDef = defaultNamespace.GetObjectDefL( MdeConstants::Video::KVideoObject );
- CMdEObjectDef& audioDef = defaultNamespace.GetObjectDefL( MdeConstants::Audio::KAudioObject );
-
- // set observing conditions
- CMdELogicCondition* addCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorOr );
- addCondition->AddObjectConditionL( imageDef );
- addCondition->AddObjectConditionL( videoDef );
- addCondition->AddObjectConditionL( audioDef );
- CleanupStack::Pop( addCondition );
-
- CMdELogicCondition* modifyCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorOr );
- modifyCondition->AddObjectConditionL( imageDef );
- modifyCondition->AddObjectConditionL( videoDef );
- modifyCondition->AddObjectConditionL( audioDef );
- CleanupStack::Pop( modifyCondition );
-
- // add observer
- iMdESession->AddObjectObserverL( *this, addCondition, ENotifyAdd );
-
- // modify observer
-#ifdef MDS_MODIFY_OBSERVER
- iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify );
-#endif
#ifdef MDS_URI_OBSERVER
// remove observer with uri
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagimageobserver.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -0,0 +1,345 @@
+/*
+* 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: Thumbnail Auto Generate Daemon
+*
+*/
+
+
+#include <e32svr.h>
+#include <centralrepository.h>
+
+#include <mdesession.h>
+#include <mdeconstants.h>
+#include <mdequery.h>
+#include <mdeobject.h>
+
+#include "thumbagimageobserver.h"
+#include "thumbnaillog.h"
+#include "thumbnailmanagerconstants.h"
+#include "thumbnailmanagerprivatecrkeys.h"
+
+
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//
+CThumbAGImageObserver* CThumbAGImageObserver::NewLC(CThumbAGProcessor* aProcessor)
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::NewLC() - begin" );
+
+ CThumbAGImageObserver* self = new (ELeave) CThumbAGImageObserver(aProcessor);
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CThumbAGImageObserver* CThumbAGImageObserver::NewL(CThumbAGProcessor* aProcessor)
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::NewL() - begin" );
+
+ CThumbAGImageObserver* self = CThumbAGImageObserver::NewLC(aProcessor);
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGImageObserver
+// ---------------------------------------------------------------------------
+//
+CThumbAGImageObserver::CThumbAGImageObserver(CThumbAGProcessor* aProcessor)
+ : iShutdownObserver(NULL), iMdESession(NULL), iProcessor(aProcessor)
+ {
+ // No implementation required
+ }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CThumbAGImageObserver::ConstructL()
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::ConstructL() - begin" );
+
+#ifdef _DEBUG
+ iAddCounter = 0;
+ iModCounter = 0;
+#endif
+
+ InitializeL();
+
+ TN_DEBUG1( "CThumbAGImageObserver::ConstructL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// ~CThumbAGImageObserver
+// ---------------------------------------------------------------------------
+//
+void CThumbAGImageObserver::InitializeL()
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::InitializeL() - begin" );
+
+
+ TN_DEBUG1( "CThumbAGImageObserver::InitializeL() - create observers" );
+
+ // create shutdown observer
+ if(iMDSShutdownObserver)
+ {
+ delete iMDSShutdownObserver;
+ iMDSShutdownObserver = NULL;
+ }
+ iMDSShutdownObserver = CTMShutdownObserver::NewL( *this, KMdSPSShutdown, KMdSShutdown, EFalse );
+
+ if(iShutdownObserver)
+ {
+ delete iShutdownObserver;
+ iShutdownObserver = NULL;
+ }
+ iShutdownObserver = CTMShutdownObserver::NewL( *this, KTAGDPSNotification, KShutdown, ETrue );
+ iShutdown = EFalse;
+
+ // MDS session reconnect timer
+ if (!iReconnect)
+ {
+ iReconnect = CPeriodic::NewL(CActive::EPriorityIdle);
+ }
+
+ TN_DEBUG1( "CThumbAGImageObserver::InitializeL() - connect to MDS" );
+
+ if(iMdESession)
+ {
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+
+ // connect to MDS
+ delete iMdESession;
+ iMdESession = NULL;
+ }
+
+ iMdESession = CMdESession::NewL( *this );
+ iSessionError = EFalse;
+
+ TN_DEBUG1( "CThumbAGImageObserver::InitializeL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// ~CThumbAGImageObserver
+// ---------------------------------------------------------------------------
+//
+CThumbAGImageObserver::~CThumbAGImageObserver()
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::~CThumbAGImageObserver() - begin" );
+
+ iShutdown = ETrue;
+
+ delete iMDSShutdownObserver;
+ delete iShutdownObserver;
+
+ if(iReconnect)
+ {
+ iReconnect->Cancel();
+ delete iReconnect;
+ iReconnect = NULL;
+ }
+
+ if (iMdESession)
+ {
+ // 2 observers
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+
+ delete iMdESession;
+ iMdESession = NULL;
+ }
+
+ TN_DEBUG1( "CThumbAGImageObserver::~CThumbAGImageObserver() - end" );
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGImageObserver::HandleSessionOpened
+// -----------------------------------------------------------------------------
+//
+void CThumbAGImageObserver::HandleSessionOpened( CMdESession& /* aSession */, TInt aError )
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::HandleSessionOpened");
+
+ if (aError == KErrNone)
+ {
+ TRAPD( err, AddObserversL() );
+ if (err != KErrNone)
+ {
+ TN_DEBUG2( "CThumbAGImageObserver::HandleSessionOpened, AddObserversL error == %d", err );
+ }
+ }
+ else
+ {
+ TN_DEBUG2( "CThumbAGImageObserver::HandleSessionOpened error == %d", aError );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGImageObserver::HandleSessionError
+// -----------------------------------------------------------------------------
+//
+void CThumbAGImageObserver::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
+ {
+ TN_DEBUG2( "CThumbAGImageObserver::HandleSessionError == %d", aError );
+ if (aError != KErrNone && !iSessionError)
+ {
+ iSessionError = ETrue;
+
+ if (!iShutdown)
+ {
+ if (!iReconnect->IsActive())
+ {
+ iReconnect->Start( KMdEReconnect, KMdEReconnect,
+ TCallBack(ReconnectCallBack, this));
+
+ TN_DEBUG1( "CThumbAGImageObserver::HandleSessionError() - reconnect timer started" );
+ }
+ }
+
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGImageObserver::HandleObjectNotification
+// -----------------------------------------------------------------------------
+//
+void CThumbAGImageObserver::HandleObjectNotification( CMdESession& /*aSession*/,
+ TObserverNotificationType aType,
+ const RArray<TItemId>& aObjectIdArray )
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::HandleObjectNotification() - begin" );
+
+ // no processor or shutting down
+ if (iShutdown || !iProcessor)
+ {
+ return;
+ }
+
+#ifdef _DEBUG
+ if (aType == ENotifyAdd)
+ {
+ TN_DEBUG2( "CThumbAGImageObserver::HandleObjectNotification() - ENotifyAdd %d", aObjectIdArray.Count() );
+ iAddCounter = aObjectIdArray.Count();
+ }
+ else if (aType == ENotifyModify)
+ {
+ TN_DEBUG2( "CThumbAGImageObserver::HandleObjectNotification() - ENotifyModify %d", aObjectIdArray.Count() );
+ iModCounter = aObjectIdArray.Count();
+ }
+#endif
+
+ if ( (aType == ENotifyAdd || aType == ENotifyModify) && aObjectIdArray.Count() > 0 )
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::HandleObjectNotification() - AddToQueueL" );
+
+ // Add event to processing queue by type and enable force run
+ RPointerArray<HBufC> dummyArray;
+ TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeImage, aObjectIdArray, dummyArray, EFalse));
+ if (err != KErrNone)
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::HandleObjectNotification() - error adding to queue" );
+ }
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::HandleObjectNotification() - bad notification" );
+ }
+
+#ifdef _DEBUG
+ TN_DEBUG3( "CThumbAGImageObserver::IN-COUNTERS---------- Add = %d Modify = %d", iAddCounter, iModCounter );
+ iModCounter = 0;
+ iAddCounter = 0;
+
+#endif
+
+ TN_DEBUG1( "CThumbAGImageObserver::HandleObjectNotification() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGImageObserver::AddObserversL
+// ---------------------------------------------------------------------------
+//
+void CThumbAGImageObserver::AddObserversL()
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::AddObserversL() - begin" );
+
+ CMdENamespaceDef& defaultNamespace = iMdESession->GetDefaultNamespaceDefL();
+ CMdEObjectDef& objectDef = defaultNamespace.GetObjectDefL( MdeConstants::Object::KBaseObject );
+ CMdEPropertyDef& originPropDef = objectDef.GetPropertyDefL( MdeConstants::Object::KOriginProperty );
+ CMdEObjectDef& imageDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject );
+
+ // set observing conditions
+ CMdELogicCondition* addCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
+ addCondition->AddObjectConditionL( imageDef );
+ addCondition->AddPropertyConditionL( originPropDef, TMdEUintNotEqual(MdeConstants::Object::ECamera));
+ CleanupStack::Pop( addCondition );
+
+ CMdELogicCondition* modifyCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
+ modifyCondition->AddObjectConditionL( imageDef );
+ addCondition->AddPropertyConditionL( originPropDef, TMdEUintNotEqual(MdeConstants::Object::ECamera));
+ CleanupStack::Pop( modifyCondition );
+
+ // add observers
+ iMdESession->AddObjectObserverL( *this, addCondition, ENotifyAdd );
+
+ // modify observer
+ iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify );
+
+ TN_DEBUG1( "CThumbAGImageObserver::AddObserversL() - end" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CThumbAGCameraObserver::ShutdownNotification
+// -----------------------------------------------------------------------------
+//
+void CThumbAGImageObserver::ShutdownNotification()
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::ShutdownNotification()" );
+
+ if (!iShutdown)
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::ShutdownNotification() shutdown" );
+ iShutdown = ETrue;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGImageObserver::ReconnectCallBack()
+// ---------------------------------------------------------------------------
+//
+TInt CThumbAGImageObserver::ReconnectCallBack(TAny* aAny)
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::ReconnectCallBack() - reinitialize");
+
+ CThumbAGImageObserver* self = static_cast<CThumbAGImageObserver*>( aAny );
+
+ self->iReconnect->Cancel();
+
+ // reconnect to MDS
+ TRAP_IGNORE( self->InitializeL() );
+
+ TN_DEBUG1( "CThumbAGImageObserver::ReconnectCallBack() - done");
+
+ return KErrNone;
+ }
+
+
+// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -50,7 +50,8 @@
// CThumbAGProcessor::CThumbAGProcessor()
// ---------------------------------------------------------------------------
//
-CThumbAGProcessor::CThumbAGProcessor(): CActive( CActive::EPriorityStandard )
+CThumbAGProcessor::CThumbAGProcessor(): CActive( CActive::EPriorityStandard ), iMMCHarvestingItemsLeftTemp(0),
+ iPHHarvestingItemsLeftTemp(0)
{
TN_DEBUG1( "CThumbAGProcessor::CThumbAGProcessor() - begin" );
@@ -65,7 +66,11 @@
{
TN_DEBUG1( "CThumbAGProcessor::ConstructL() - begin" );
+ iShutdown = EFalse;
+
iTMSession = CThumbnailManager::NewL( *this );
+ iTMSession->SetRequestObserver(*this);
+
iQueryAllItems = NULL;
iQueryPlaceholders = NULL;
iQuery = NULL;
@@ -78,10 +83,11 @@
// set auto create values from cenrep
CheckAutoCreateValuesL();
- iPeriodicTimer = CPeriodic::NewL(CActive::EPriorityIdle);
+ iPeriodicTimer = CPeriodic::NewL(CActive::EPriorityStandard);
+
+ iMountTimer = CPeriodic::NewL(CActive::EPriorityUserInput);
SetForceRun( EFalse );
- iActive = EFalse;
iFormatObserver = CTMFormatObserver::NewL( *this );
@@ -92,13 +98,7 @@
iActivityManager = CTMActivityManager::NewL( this, KBackgroundGenerationIdle);
- UpdatePSValues(ETrue);
-
- if(iForegroundGenerationObserver)
- {
- delete iForegroundGenerationObserver;
- iForegroundGenerationObserver = NULL;
- }
+ UpdatePSValues(ETrue, ETrue);
RProperty::Define(KTAGDPSNotification, KMPXHarvesting, RProperty::EInt);
@@ -116,11 +116,30 @@
{
TN_DEBUG1( "CThumbAGProcessor::~CThumbAGProcessor() - begin" );
- if(iForegroundGenerationObserver)
- {
- delete iForegroundGenerationObserver;
- iForegroundGenerationObserver = NULL;
- }
+ Shutdown();
+
+ Cancel();
+
+ if (iTMSession)
+ {
+ iTMSession->RemoveRequestObserver();
+ delete iTMSession;
+ iTMSession = NULL;
+ }
+
+ if(iMountTimer)
+ {
+ iMountTimer->Cancel();
+ delete iMountTimer;
+ iMountTimer = NULL;
+ }
+
+ if(iPeriodicTimer)
+ {
+ iPeriodicTimer->Cancel();
+ delete iPeriodicTimer;
+ iPeriodicTimer = NULL;
+ }
if(iActivityManager)
{
@@ -128,19 +147,27 @@
iActivityManager = NULL;
}
- if (iInactivityTimer)
+ if (iQuery)
{
- iInactivityTimer->Cancel();
- delete iInactivityTimer;
- iInactivityTimer = NULL;
+ iQuery->Cancel();
+ delete iQuery;
+ iQuery = NULL;
}
- if(iPeriodicTimer)
+ if(iQueryPlaceholders)
{
- iPeriodicTimer->Cancel();
- delete iPeriodicTimer;
+ iQueryPlaceholders->Cancel();
+ delete iQueryPlaceholders;
+ iQueryPlaceholders = NULL;
}
+ if (iQueryAllItems)
+ {
+ iQueryAllItems->Cancel();
+ delete iQueryAllItems;
+ iQueryAllItems = NULL;
+ }
+
if (!iInit)
{
#ifdef MDS_MODIFY_OBSERVER
@@ -149,54 +176,49 @@
#endif
}
+ if(iForegroundGenerationObserver)
+ {
+ delete iForegroundGenerationObserver;
+ iForegroundGenerationObserver = NULL;
+ }
+
+ if(iFormatObserver)
+ {
+ delete iFormatObserver;
+ iFormatObserver = NULL;
+ }
+
if ( iCollectionUtility )
{
iCollectionUtility->Close();
iCollectionUtility = NULL;
}
-
- Cancel();
- if(iQueryPlaceholders)
+ for(TInt i=0;i<iGenerationQueue.Count();i++)
{
- iQueryPlaceholders->Cancel();
- delete iQueryPlaceholders;
- iQueryPlaceholders = NULL;
- }
-
- if (iQuery)
- {
- iQuery->Cancel();
- delete iQuery;
- iQuery = NULL;
+ delete iGenerationQueue[i].iUri;
+ iGenerationQueue[i].iUri = NULL;
}
- if (iQueryAllItems)
- {
- iQueryAllItems->Cancel();
- delete iQueryAllItems;
- iQueryAllItems = NULL;
- }
-
- iAddQueue.Close();
- iModifyQueue.Close();
- iRemoveQueue.ResetAndDestroy();
+ iGenerationQueue.Reset();
+ iGenerationQueue.Close();
+
iQueryQueue.Close();
- iPlaceholderQueue.Close();
-
- i2ndRoundGenerateQueue.Close();
-
- if (iTMSession)
- {
- delete iTMSession;
- iTMSession = NULL;
- }
-
- delete iFormatObserver;
TN_DEBUG1( "CThumbAGProcessor::~CThumbAGProcessor() - end" );
}
+// ---------------------------------------------------------------------------
+// CThumbAGProcessor::Shutdown()
+// ---------------------------------------------------------------------------
+//
+void CThumbAGProcessor::Shutdown()
+ {
+ TN_DEBUG1( "CThumbAGProcessor::Shutdown()" );
+ iShutdown = ETrue;
+ UpdatePSValues(EFalse, EFalse);
+ }
+
// -----------------------------------------------------------------------------
// CThumbAGProcessor::HandleQueryNewResults()
// -----------------------------------------------------------------------------
@@ -206,6 +228,12 @@
const TInt aNewItemCount )
{
// PH & AllItems query results are handled here
+
+ if(iShutdown)
+ {
+ return;
+ }
+
if (aNewItemCount > 0)
{
if(&aQuery == iQueryPlaceholders)
@@ -228,13 +256,19 @@
}
// ignore if fails
- iPlaceholderQueue.InsertInOrder(object->Id(), Compare);
+ TThumbnailGenerationItem item;
+ item.iItemId = object->Id();
+ item.iPlaceholder = ETrue;
+
+ SetGenerationItemType( item, object->Def().Id());
+
+ AppendProcessingQueue( item );
}
}
else if(&aQuery == iQueryAllItems)
{
TN_DEBUG2( "CThumbAGProcessor::HandleQueryNewResults - QueryAllItems, %d new", aNewItemCount);
-
+
for(TInt i = aFirstNewItemIndex; i < iQueryAllItems->Count(); i++)
{
const CMdEObject* object = &iQueryAllItems->Result(i);
@@ -243,13 +277,17 @@
{
continue;
}
-
- if (iAddQueue.FindInOrder(object->Id(), Compare) == KErrNotFound &&
- iModifyQueue.FindInOrder(object->Id(), Compare) == KErrNotFound )
- {
- // ignore if fails
- iAddQueue.InsertInOrder(object->Id(), Compare);
- }
+
+ TThumbnailGenerationItem item;
+ item.iItemId = object->Id();
+
+ SetGenerationItemType(item, object->Def().Id());
+
+ TInt itemIndex = iGenerationQueue.FindInOrder(item, Compare);
+
+ item.iPlaceholder = object->Placeholder();
+
+ AppendProcessingQueue( item );
}
}
}
@@ -267,12 +305,15 @@
{
TN_DEBUG3( "CThumbAGProcessor::HandleQueryCompleted, aError == %d Count== %d", aError, aQuery.Count());
+ if(iShutdown)
+ {
+ return;
+ }
+
if(&aQuery == iQueryPlaceholders)
{
TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted - iQueryPlaceholders completed");
- iPlaceholderQueue.Reset();
-
//free query
delete iQueryPlaceholders;
iQueryPlaceholders = NULL;
@@ -310,60 +351,123 @@
{
iProcessingCount = iQuery->Count();
- if(iProcessingCount != iQueryQueue.Count())
+ if(iProcessingCount != iQueryQueue.Count() )
{
TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() some result items missing");
RArray<TItemId> queryQueueDelta;
- TInt itemIndex(KErrNotFound);
-
- //search delta items which were queried, but not found
- for(TInt queryItem =0; queryItem < iQueryQueue.Count();queryItem++)
- {
- TBool found(EFalse);
- for(TInt queryResult = 0; queryResult < iQuery->Count(); queryResult++)
- {
- const CMdEObject* object = &iQuery->Result(queryResult);
-
- if( iQueryQueue[queryItem] == object->Id())
+ //search delta items which were queried, but not found
+ for(TInt queryItem =0; queryItem < iQueryQueue.Count();queryItem++)
+ {
+ TBool found(EFalse);
+ for(TInt queryResult = 0; queryResult < iQuery->Count(); queryResult++)
+ {
+ const CMdEObject* object = &iQuery->Result(queryResult);
+
+ if( iQueryQueue[queryItem] == object->Id())
+ {
+ found = ETrue;
+ break;
+ }
+ }
+
+ if(!found)
+ {
+ TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() %d missing from query results", iQueryQueue[queryItem] );
+
+ // ignore if fails
+ queryQueueDelta.InsertInOrder(iQueryQueue[queryItem], CompareId);
+ }
+ }
+
+ TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() missing items found %d", queryQueueDelta.Count());
+ //cleanup from previous queue it item is not found from MDS
+ while(queryQueueDelta.Count())
+ {
+ TThumbnailGenerationItem item;
+ item.iItemId = queryQueueDelta[0];
+ TInt itemIndex = iQueryQueue.FindInOrder(item.iItemId, CompareId);
+
+ if(itemIndex >= 0)
+ {
+ TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() remove %d from iQueryQueue", queryQueueDelta[0]);
+ iQueryQueue.Remove( itemIndex );
+
+ //remove from procesing queue
+ itemIndex = iGenerationQueue.FindInOrder(item, Compare);
+
+ if(itemIndex >= 0)
+ {
+
+ if( iUnknown )
+ {
+ TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() mark %d as EGenerationItemTypeNotFound in iGenerationQueue", queryQueueDelta[0]);
+ //mark to be removed, cleanup is done below
+ iGenerationQueue[itemIndex].iItemType = EGenerationItemTypeNotFound;
+ }
+ else
+ {
+ TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() remove %d from iGenerationQueue", queryQueueDelta[0]);
+ iGenerationQueue.Remove( itemIndex );
+ }
+ }
+ }
+ queryQueueDelta.Remove(0);
+ }
+ queryQueueDelta.Close();
+ }
+
+ if(iUnknown)
+ {
+ for(TInt i = 0; i < iQuery->Count(); i++)
+ {
+ const CMdEObject* object = &iQuery->Result(i);
+
+ if(!object)
+ {
+ continue;
+ }
+
+ TThumbnailGenerationItem tempItem;
+ tempItem.iItemId = object->Id();
+ TInt itemIndex = iGenerationQueue.FindInOrder(tempItem, Compare);
+
+ if(itemIndex >= 0)
{
- found = ETrue;
- break;
+ TThumbnailGenerationItem& item = iGenerationQueue[itemIndex];
+
+ if(iGenerationQueue[itemIndex].iItemType == EGenerationItemTypeNotFound)
+ {
+ TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() remove EGenerationItemTypeNotFound %d item from iGenerationQueue", item.iItemId);
+ iGenerationQueue.Remove(itemIndex);
+ continue;
+ }
+
+ SetGenerationItemType(item, object->Def().Id());
+
+ if(item.iItemType == EGenerationItemTypeUnknown )
+ {
+ TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() remove unknown item %d", item.iItemId);
+ iGenerationQueue.Remove(itemIndex);
+ continue;
+ }
+
+ item.iPlaceholder = object->Placeholder();
+
}
}
-
- if(!found)
- {
- TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() missing from results item %d", iQueryQueue[queryItem] );
-
- // ignore if fails
- queryQueueDelta.InsertInOrder(iQueryQueue[queryItem], Compare);
- }
- }
-
- TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() missing items total count %d", queryQueueDelta.Count());
- //cleanup from previous queue it item is not found from MDS
- while(queryQueueDelta.Count())
- {
- itemIndex = iLastQueue->FindInOrder(queryQueueDelta[0], Compare);
-
- if(itemIndex >= 0)
- {
- TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() remove items %d", iQueryQueue[0]);
- iLastQueue->Remove( itemIndex );
- }
- queryQueueDelta.Remove(0);
- }
- queryQueueDelta.Close();
- }
+
+ iQueryQueue.Reset();
+ iProcessingCount = 0;
+ iUnknown = EFalse;
+ }
// no results, reset query
- if( !iProcessingCount)
+ if( !iProcessingCount )
{
delete iQuery;
iQuery = NULL;
- iProcessingCount = 0;
iModify = EFalse;
}
}
@@ -395,7 +499,7 @@
}
// -----------------------------------------------------------------------------
-// CThumbAGProcessor::ThumbnailReady()
+// CThumbAGProcessor::ThumbnailReady()d
// -----------------------------------------------------------------------------
//
void CThumbAGProcessor::ThumbnailReady( TInt aError, MThumbnailData& /*aThumbnail*/,
@@ -405,12 +509,6 @@
iActiveCount--;
- if(iActiveCount <= 0)
- {
- iActiveCount = 0;
- iActive = EFalse;
- }
-
// TNM server died, delete session
if( aError == KErrServerTerminated )
{
@@ -435,11 +533,28 @@
TN_DEBUG1( "CThumbAGProcessor::ThumbnailReady() - end" );
}
+// -----------------------------------------------------------------------------
+// CThumbAGProcessor::ThumbnailRequestReady()
+// -----------------------------------------------------------------------------
+//
+void CThumbAGProcessor::ThumbnailRequestReady( TInt /*aError*/, TThumbnailRequestType aRequestType,
+ TThumbnailRequestId /*aId*/ )
+ {
+ if (aRequestType == ERequestDeleteThumbnails)
+ {
+ TN_DEBUG1( "CThumbAGProcessor::ThumbnailRequestReady() - delete" );
+
+ iActiveCount--;
+
+ ActivateAO();
+ }
+ }
+
// ---------------------------------------------------------------------------
// CThumbAGProcessor::SetMdESession()
// ---------------------------------------------------------------------------
//
-void CThumbAGProcessor::SetMdESession( CMdESession* aMdESession )
+void CThumbAGProcessor::SetMdESessionL( CMdESession* aMdESession )
{
TN_DEBUG1( "CThumbAGProcessor::SetMdESession() - begin" );
@@ -451,14 +566,22 @@
if (err != KErrNone)
{
TN_DEBUG2( "CThumbAGProcessor::SetMdESession() GetDefaultNamespaceDefL() err = %d", err );
+ __ASSERT_DEBUG((iDefNamespace), User::Panic(_L("CThumbAGProcessor::SetMdESession() !iDefNamespace "), KErrBadHandle));
}
-
- __ASSERT_DEBUG((iDefNamespace), User::Panic(_L("CThumbAGProcessor::SetMdESession() !iDefNamespace "), KErrBadHandle));
-
- //do async init
- iInit = ETrue;
-
- ActivateAO();
+ else
+ {
+ iImageObjectDef = &iDefNamespace->GetObjectDefL( MdeConstants::Image::KImageObject );
+ __ASSERT_DEBUG((iImageObjectDef), User::Panic(_L("CThumbAGProcessor::SetMdESession() !iDefNamespace "), KErrBadHandle));
+ iVideoObjectDef = &iDefNamespace->GetObjectDefL( MdeConstants::Video::KVideoObject );
+ __ASSERT_DEBUG((iVideoObjectDef), User::Panic(_L("CThumbAGProcessor::SetMdESession() !iVideoObjectDef "), KErrBadHandle));
+ iAudioObjectDef = &iDefNamespace->GetObjectDefL( MdeConstants::Audio::KAudioObject );
+ __ASSERT_DEBUG((iAudioObjectDef), User::Panic(_L("CThumbAGProcessor::SetMdESession() !iAudioObjectDef "), KErrBadHandle));
+
+ //do async init
+ iInit = ETrue;
+
+ ActivateAO();
+ }
}
// ---------------------------------------------------------------------------
@@ -466,11 +589,13 @@
// ---------------------------------------------------------------------------
//
void CThumbAGProcessor::AddToQueueL( TObserverNotificationType aType,
+ TThumbnailGenerationItemType aItemType,
const RArray<TItemId>& aIDArray,
const RPointerArray<HBufC>& aObjectUriArray,
TBool /*aPresent*/ )
{
TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - begin" );
+
// update queues
if (aType == ENotifyAdd)
@@ -479,12 +604,18 @@
for (int i=0; i<aIDArray.Count(); i++)
{
- // do not to append to Add queue if exist already in Add or 2nd Add queue (just processed)
- if (iAddQueue.FindInOrder(aIDArray[i], Compare) == KErrNotFound &&
- i2ndRoundGenerateQueue.FindInOrder(aIDArray[i], Compare) == KErrNotFound)
+ TThumbnailGenerationItem item;
+ item.iItemId = aIDArray[i];
+ item.iItemType = aItemType;
+
+ SetGenerationItemAction(item, aItemType);
+
+ if(iPHHarvesting)
{
- User::LeaveIfError(iAddQueue.InsertInOrder(aIDArray[i], Compare));
+ item.iPlaceholder = ETrue;
}
+
+ AppendProcessingQueue( item );
}
}
else if (aType == ENotifyModify)
@@ -496,19 +627,24 @@
TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - PH harvesting active, treat like add" );
for (int i=0; i<aIDArray.Count(); i++)
{
- TInt itemIndex = iPlaceholderQueue.FindInOrder(aIDArray[i], Compare);
+ TThumbnailGenerationItem item;
+ item.iItemId = aIDArray[i];
+ item.iItemType = aItemType;
+
+ TInt itemIndex = iGenerationQueue.FindInOrder(item, Compare);
if (itemIndex >= 0)
{
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - remove from placeholder queue");
- iPlaceholderQueue.Remove( itemIndex );
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - set as non-placeholder");
+ iGenerationQueue[itemIndex].iPlaceholder = EFalse;
}
-
- if(iAddQueue.FindInOrder(aIDArray[i], Compare) == KErrNotFound &&
- i2ndRoundGenerateQueue.FindInOrder(aIDArray[i], Compare) == KErrNotFound)
+ else
{
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - append to add queue");
- User::LeaveIfError(iAddQueue.InsertInOrder(aIDArray[i], Compare));
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - append");
+
+ item.iPlaceholder = EFalse;
+ SetGenerationItemAction( item, aItemType );
+ AppendProcessingQueue( item );
}
}
}
@@ -520,75 +656,91 @@
for (int i=0; i<aIDArray.Count(); i++)
{
- itemIndex = iPlaceholderQueue.FindInOrder(aIDArray[i], Compare);
+ TThumbnailGenerationItem item;
+ item.iItemId = aIDArray[i];
+ item.iItemType = aItemType;
+
+ itemIndex = iGenerationQueue.FindInOrder(item, Compare);
if (itemIndex >= 0)
{
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - placeholder modify, remove from placeholder queue");
- iPlaceholderQueue.Remove( itemIndex );
+ if( iGenerationQueue[itemIndex].iPlaceholder )
+ {
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - placeholder modify");
+ iGenerationQueue[itemIndex].iPlaceholder = EFalse;
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - real modify");
+ iGenerationQueue[itemIndex].iItemAction = EGenerationItemActionModify;
+ SetForceRun( ETrue );
+ }
}
else
{
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - real modify");
- itemIndex = iAddQueue.FindInOrder(aIDArray[i], Compare);
-
- if (itemIndex >= 0)
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - remove from add queue");
- iAddQueue.Remove( itemIndex );
- }
- else
- {
- itemIndex = i2ndRoundGenerateQueue.FindInOrder(aIDArray[i], Compare);
-
- if (itemIndex >= 0)
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - remove from 2nd round add queue");
- i2ndRoundGenerateQueue.Remove( itemIndex );
- }
- }
-
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - append to modify queue");
- User::LeaveIfError(iModifyQueue.InsertInOrder(aIDArray[i], Compare));
-
- SetForceRun( ETrue );
- }
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - append");
+ SetGenerationItemAction( item, aItemType);
+ item.iPlaceholder = EFalse;
+ AppendProcessingQueue( item );
+ }
}
}
}
- else if (aType == ENotifyRemove)
+ else if (aType == ENotifyRemove && aItemType == EGenerationItemTypeAny)
{
TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - ENotifyRemove, remove IDs from all queues");
for (int i=0; i<aIDArray.Count(); i++)
{
- // can be removed from Add queue
- TInt itemIndex = iAddQueue.FindInOrder(aIDArray[i], Compare);
- if(itemIndex >= 0)
- {
- iAddQueue.Remove(itemIndex);
- }
-
- // ..and Modify Queue
- itemIndex = iModifyQueue.FindInOrder(aIDArray[i], Compare);
+ TThumbnailGenerationItem item;
+ item.iItemId = aIDArray[i];
+ item.iItemType = aItemType;
+
+ TInt itemIndex = iGenerationQueue.FindInOrder(item, Compare);
+
if(itemIndex >= 0)
{
- iModifyQueue.Remove(itemIndex);
+ iGenerationQueue[itemIndex].iItemAction = EGenerationItemActionDelete;
+ delete iGenerationQueue[itemIndex].iUri;
+ iGenerationQueue[itemIndex].iUri = NULL;
+
+ if( aObjectUriArray[i])
+ {
+ iGenerationQueue[itemIndex].iUri = aObjectUriArray[i]->AllocL();
+ }
+ else
+ {
+ //invalid URI remove from processing queue
+ iGenerationQueue.Remove(itemIndex);
+ }
}
- }
-
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - ENotifyRemove append URIs to remove queue");
- for (int i=0; i<aObjectUriArray.Count(); i++)
- {
- HBufC* temp = aObjectUriArray[i]->AllocL();
- iRemoveQueue.Append( temp );
- TN_DEBUG2( "CThumbAGProcessor::AddToQueueL() - %S", temp);
+ else
+ {
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - append");
+ item.iItemAction = EGenerationItemActionDelete;
+ delete item.iUri;
+ item.iUri = NULL;
+
+ if( aObjectUriArray[i])
+ {
+ item.iUri = aObjectUriArray[i]->AllocL();
+ CleanupStack::PushL( item.iUri );
+ User::LeaveIfError( iGenerationQueue.InsertInOrder(item, Compare) );
+ CleanupStack::Pop();
+ }
+
+ //owned by item
+ item.iUri = NULL;
+ }
+
+ TN_DEBUG2( "CThumbAGProcessor::AddToQueueL() - %S", aObjectUriArray[i]);
}
}
#ifdef _DEBUG
else
{
TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - should not come here" );
+ __ASSERT_DEBUG((EFalse), User::Panic(_L("CThumbAGProcessor::AddToQueueL()"), KErrArgument));
User::Leave( KErrArgument );
}
#endif
@@ -618,8 +770,8 @@
TInt64 modifiedVal = 0;
CMdEProperty* orientation = NULL;
- CMdEObjectDef& imageObjectDef = iDefNamespace->GetObjectDefL( MdeConstants::Image::KImageObject );
- TInt orientErr = aObject->Property( imageObjectDef.GetPropertyDefL( MdeConstants::Image::KOrientationProperty ), orientation, 0 );
+
+ TInt orientErr = aObject->Property( iImageObjectDef->GetPropertyDefL( MdeConstants::Image::KOrientationProperty ), orientation, 0 );
if (orientErr == KErrNone)
{
@@ -644,6 +796,20 @@
//generate both if needed
TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() EOptimizeForQuality ");
iTMSession->SetQualityPreferenceL( CThumbnailManager::EOptimizeForQuality );
+
+ TN_DEBUG2( "CThumbAGProcessor::CreateThumbnailsL() - 2nd round add remove from queue", aObject->Id() );
+
+ TThumbnailGenerationItem item;
+ item.iItemId = aObject->Id();
+ TInt itemIndex = iGenerationQueue.FindInOrder(item, Compare);
+
+ if(itemIndex >=0 )
+ {
+ if(iGenerationQueue[itemIndex].iItemAction == EGenerationItemAction2ndAdd)
+ {
+ iGenerationQueue.Remove(itemIndex);
+ }
+ }
}
// 1st roung generation
else
@@ -652,25 +818,29 @@
TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() EOptimizeForQualityWithPreview");
iTMSession->SetQualityPreferenceL( CThumbnailManager::EOptimizeForQualityWithPreview );
- CMdEObjectDef& videoObjectDef = iDefNamespace->GetObjectDefL( MdeConstants::Video::KVideoObject );
+ // add item to 2nd round queue
+ TN_DEBUG2( "CThumbAGProcessor::CreateThumbnailsL() - 1st round add/modify, append to 2nd round queue", aObject->Id() );
- // add item to 2nd round queue
- if(iLastQueue == &iAddQueue || iLastQueue == &iModifyQueue)
+ TThumbnailGenerationItem item;
+ item.iItemId = aObject->Id();
+ TInt itemIndex = iGenerationQueue.FindInOrder(item, Compare);
+
+ if(itemIndex >=0 )
{
- TN_DEBUG2( "CThumbAGProcessor::CreateThumbnailsL() - 1st round add/modify, append to 2nd round queue", aObject->Id() );
- if(i2ndRoundGenerateQueue.FindInOrder(aObject->Id(), Compare) == KErrNotFound)
+ if(iGenerationQueue[itemIndex].iItemAction == EGenerationItemActionModify)
{
- // ignore if fails
- i2ndRoundGenerateQueue.InsertInOrder(aObject->Id(), Compare);
+ iGenerationQueue.Remove(itemIndex);
}
- }
-
- // 10.1 specific
- if( imageObjectDef.Id() != aObject->Def().Id() )
- {
- TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() 1st round not image");
- ActivateAO();
- return;
+ //change 1st round item for 2nd round processing
+ //2nd round item can be deleted
+ else if(iGenerationQueue[itemIndex].iItemAction == EGenerationItemActionAdd)
+ {
+ iGenerationQueue[itemIndex].iItemAction = EGenerationItemAction2ndAdd;
+ }
+ else
+ {
+ iGenerationQueue.Remove(itemIndex);
+ }
}
}
@@ -682,13 +852,11 @@
TN_DEBUG2( "CThumbAGProcessor::CreateThumbnailsL, iTMSession error == %d", err );
iSessionDied = ETrue;
- iActive = EFalse;
ActivateAO();
}
else
{
iActiveCount++;
- iActive = ETrue;
}
}
else
@@ -703,14 +871,14 @@
// CThumbAGProcessor::QueryL()
// ---------------------------------------------------------------------------
//
-void CThumbAGProcessor::QueryL( RArray<TItemId>& aIDArray )
+void CThumbAGProcessor::QueryL(/*RArray<TItemId>& aIDArray*/TThumbnailGenerationItemAction aAction )
{
TN_DEBUG1( "CThumbAGProcessor::QueryL() - begin" );
__ASSERT_DEBUG((iMdESession), User::Panic(_L("CThumbAGProcessor::QueryL() !iMdeSession "), KErrBadHandle));
__ASSERT_DEBUG((iDefNamespace), User::Panic(_L("CThumbAGProcessor::QueryL() !iDefNamespace "), KErrBadHandle));
- if(!iMdESession || !iDefNamespace)
+ if(!iMdESession || !iDefNamespace || iShutdown)
{
return;
}
@@ -718,7 +886,6 @@
//reset query queue
iQueryQueue.Reset();
//set reference to current pprocessing queue
- iLastQueue = &aIDArray;
iQueryReady = EFalse;
@@ -730,18 +897,64 @@
}
//move ID from source queue to Query queue
- TInt maxCount = aIDArray.Count();
+ TInt maxCount = iGenerationQueue.Count();
- TN_DEBUG3( "CThumbAGProcessor::QueryL() - fill begin aIDArray == %d, iQueryQueue == %d", aIDArray.Count(), iQueryQueue.Count() );
+ TN_DEBUG3( "CThumbAGProcessor::QueryL() - fill begin iGenerationQueue == %d, iQueryQueue == %d", iGenerationQueue.Count(), iQueryQueue.Count() );
+
- for(TInt i=0; i < KMaxQueryItems && i < maxCount; i++)
+ TInt itemCount(0);
+ for(TInt i=0; itemCount < KMaxQueryItems && i < maxCount; i++)
{
- TN_DEBUG2( "CThumbAGProcessor::QueryL() - fill %d", aIDArray[0] );
- iQueryQueue.InsertInOrder(aIDArray[0], Compare);
- aIDArray.Remove(0);
+ TInt itemIndex(KErrNotFound);
+ switch(aAction)
+ {
+ //1st round items
+ case EGenerationItemActionAdd:
+ if(iGenerationQueue[i].iItemAction == aAction )
+ {
+ itemIndex = i;
+ }
+ break;
+ case EGenerationItemActionModify:
+ if( iGenerationQueue[i].iItemAction == aAction )
+ {
+ itemIndex = i;
+ }
+ break;
+ case EGenerationItemAction2ndAdd:
+ if( iGenerationQueue[i].iItemAction == aAction )
+ {
+ itemIndex = i;
+ }
+ break;
+ //unknown stuff
+ case EGenerationItemActionResolveType:
+ if( iGenerationQueue[i].iItemType == EGenerationItemTypeUnknown )
+ {
+ itemIndex = i;
+ }
+ break;
+ default:
+ break;
+ };
+
+ if( itemIndex >= 0 )
+ {
+ TN_DEBUG2( "CThumbAGProcessor::QueryL() - fill %d", iGenerationQueue[itemIndex].iItemId );
+ iQueryQueue.InsertInOrder(iGenerationQueue[itemIndex].iItemId, CompareId);
+ itemCount++;
+ }
}
- TN_DEBUG3( "CThumbAGProcessor::QueryL() - fill end aIDArray == %d, iQueryQueue == %d", aIDArray.Count(), iQueryQueue.Count() );
+ if(!itemCount)
+ {
+ TN_DEBUG1( "CThumbAGProcessor::QueryL() - empty query, cancel?!");
+ iQueryActive = EFalse;
+ __ASSERT_DEBUG((iMdESession), User::Panic(_L("CThumbAGProcessor::QueryL() empty! "), KErrNotFound));
+ return;
+ }
+
+ TN_DEBUG3( "CThumbAGProcessor::QueryL() - fill end iGenerationQueue == %d, iQueryQueue == %d", iGenerationQueue.Count(), iQueryQueue.Count() );
CMdEObjectDef& objDef = iDefNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject );
iQuery = iMdESession->NewObjectQueryL( *iDefNamespace, objDef, this );
@@ -756,7 +969,7 @@
CleanupStack::Pop( &iQueryQueue );
// add object type conditions
- if (!iModify)
+ if (!(iModify || iUnknown))
{
CMdELogicCondition& objDefCondition = rootCondition.AddLogicConditionL( ELogicConditionOperatorOr );
@@ -788,14 +1001,14 @@
// ---------------------------------------------------------------------------
//
-void CThumbAGProcessor::QueryPlaceholdersL()
+void CThumbAGProcessor::QueryPlaceholdersL(TBool aPresent)
{
TN_DEBUG1( "CThumbAGProcessor::QueryPlaceholdersL" );
__ASSERT_DEBUG((iMdESession), User::Panic(_L("CThumbAGProcessor::QueryPlaceholdersL() !iMdeSession "), KErrBadHandle));
__ASSERT_DEBUG((iDefNamespace), User::Panic(_L("CThumbAGProcessor::QueryPlaceholdersL() !iDefNamespace "), KErrBadHandle));
- if(!iMdESession || !iDefNamespace)
+ if(!iMdESession || !iDefNamespace || iShutdown)
{
return;
}
@@ -830,17 +1043,17 @@
CMdEObjectCondition& imagePHObjectCondition = rootCondition.AddObjectConditionL(imageObjDef);
imagePHObjectCondition.SetPlaceholderOnly( ETrue );
- imagePHObjectCondition.SetNotPresent( ETrue );
+ imagePHObjectCondition.SetNotPresent( aPresent );
CMdEObjectCondition& videoPHObjectCondition = rootCondition.AddObjectConditionL(videoObjDef);
videoPHObjectCondition.SetPlaceholderOnly( ETrue );
- videoPHObjectCondition.SetNotPresent( ETrue );
+ videoPHObjectCondition.SetNotPresent( aPresent );
CMdEObjectCondition& audioPHObjectCondition = rootCondition.AddObjectConditionL(audioObjDef);
audioPHObjectCondition.SetPlaceholderOnly( ETrue );
- audioPHObjectCondition.SetNotPresent( ETrue );
+ audioPHObjectCondition.SetNotPresent( aPresent );
- iQueryPlaceholders->FindL(KMaxTInt, KMaxQueryItems2);
+ iQueryPlaceholders->FindL(KMaxTInt, KMaxQueryBatchSize);
TN_DEBUG1( "CThumbAGProcessor::QueryPlaceholdersL - end" );
}
@@ -853,6 +1066,12 @@
void CThumbAGProcessor::RunL()
{
TN_DEBUG1( "CThumbAGProcessor::RunL() - begin" );
+
+ if(iShutdown)
+ {
+ TN_DEBUG1( "CThumbAGProcessor::RunL() - shutdown" );
+ return;
+ }
if (iSessionDied)
{
@@ -868,13 +1087,11 @@
iInit = EFalse;
iInit2 = ETrue;
- iAddQueue.Reset();
- iModifyQueue.Reset();
- iRemoveQueue.ResetAndDestroy();
+ iGenerationQueue.Reset();
iQueryQueue.Reset();
- iPlaceholderQueue.Reset();
- TRAP_IGNORE(QueryPlaceholdersL());
+ //query all not present placeholders
+ TRAP_IGNORE(QueryPlaceholdersL( ETrue ));
//query all items after PH query
iDoQueryAllItems = ETrue;
TN_DEBUG1( "CThumbAGProcessor::RunL() - Initialisation 1 done" );
@@ -894,13 +1111,20 @@
err = iHarvesterClient.Connect();
TN_DEBUG2( "CThumbAGProcessor::RunL() iHarvesterClient connect err = %d", err);
- __ASSERT_DEBUG((err==KErrNone), User::Panic(_L("CThumbAGProcessor::RunL(), !iHarvesterClient "), err));
+ __ASSERT_DEBUG((err == KErrNone), User::Panic(_L("CThumbAGProcessor::RunL(), !iHarvesterClient "), err));
if( err == KErrNone )
{
TN_DEBUG1( "CThumbAGProcessor::RunL() add iHarvesterClient observer");
- err = iHarvesterClient.AddHarvesterEventObserver( *this, EHEObserverTypeOverall | EHEObserverTypeMMC | EHEObserverTypePlaceholder, KMaxTInt );
+ err = iHarvesterClient.AddHarvesterEventObserver( *this, EHEObserverTypeOverall | EHEObserverTypeMMC | EHEObserverTypePlaceholder, 20 );
TN_DEBUG2( "CThumbAGProcessor::RunL() iHarvesterClient observer err = %d", err);
+
+ if( !err )
+ {
+ TN_DEBUG1( "CThumbAGProcessor::RunL() add iHarvesterClient observer failed");
+ // if we fail observer harvester, fake it
+ iHarvesterActivated = ETrue;
+ }
__ASSERT_DEBUG((err==KErrNone), User::Panic(_L("CThumbAGProcessor::RunL(), !iHarvesterClient "), err));
}
#endif
@@ -924,7 +1148,6 @@
if (!iTMSession)
{
TN_DEBUG1( "CThumbAGProcessor::RunL() - open TNM session");
- iActive = EFalse;
TRAPD( err, iTMSession = CThumbnailManager::NewL( *this ) );
if (err != KErrNone)
@@ -935,24 +1158,17 @@
}
else
{
+ iTMSession->SetRequestObserver(*this);
iSessionDied = EFalse;
}
}
// do not run if request is already issued to TNM server even if forced
- if( iActive)
+ if(iActiveCount >= KMaxDaemonRequests)
{
- if(iActiveCount >= KMaxDaemonRequests)
- {
- TN_DEBUG1( "CThumbAGProcessor::RunL() - waiting for previous to complete, abort..." );
- return;
- }
+ TN_DEBUG1( "CThumbAGProcessor::RunL() - waiting for previous to complete, abort..." );
+ return;
}
- else
- {
- iActiveCount = 0;
- }
-
//force run can proceed from this point
#ifdef _DEBUG
@@ -1001,7 +1217,9 @@
{
TInt err(KErrNone);
//if force or non forced
- if((iForceRun && iModify ) || (!iForceRun && !iModify ))
+ //if unknown items or mount timer is active, abort processing
+
+ if(((iForceRun && iModify ) || (!iForceRun && !iModify )) && !iUnknownItemCount && !iMountTimer->IsActive())
{
TN_DEBUG1( "CThumbAGProcessor::RunL() - iQueryReady START" );
@@ -1010,21 +1228,16 @@
if ( object )
{
- TInt itemIndex = iLastQueue->FindInOrder(object->Id(), Compare);
- if(itemIndex >= 0)
- {
- iLastQueue->Remove(itemIndex);
- }
-
//process one item at once
//remove item from queryQueue when request is issued
- itemIndex = iQueryQueue.FindInOrder(object->Id(), Compare);
+
+ TInt itemIndex = iQueryQueue.FindInOrder(object->Id(), CompareId);
if(itemIndex >= 0)
{
iQueryQueue.Remove(itemIndex);
}
- TRAP( err, CreateThumbnailsL(object) );
+ TRAP( err, CreateThumbnailsL( object ) );
TN_DEBUG2( "CThumbAGProcessor::RunL(), CreateThumbnailsL error == %d", err );
__ASSERT_DEBUG((err==KErrNone), User::Panic(_L("CThumbAGProcessor::RunL(), CreateThumbnailsL() "), err));
}
@@ -1032,7 +1245,8 @@
//force is coming, but executing non-forced query complete-> cancel old
else
{
- //cancel query and move items back to original processing queue
+ //cancel query
+ TN_DEBUG1( "CThumbAGProcessor::RunL() - cancel processing query" );
DeleteAndCancelQuery( ETrue );
ActivateAO();
return;
@@ -1052,7 +1266,7 @@
else if( iQueryActive )
{
//state mismatch
- if(iForceRun && !iModify)
+ if(iForceRun && !(iModify || iUnknown))
{
//cancel query and move items back to original processing queue
DeleteAndCancelQuery(ETrue);
@@ -1063,10 +1277,20 @@
TN_DEBUG1( "CThumbAGProcessor::RunL() - waiting for query to complete, abort..." );
}
}
+ else if ( iUnknownItemCount > 0 )
+ {
+ TN_DEBUG1( "void CThumbAGProcessor::RunL() unknown items in queue");
+
+ i2ndRound = EFalse;
+ iModify = EFalse;
+ iUnknown = ETrue;
+ iQueryActive = ETrue;
+ QueryL( EGenerationItemActionResolveType );
+ }
// no items in query queue, start new
// select queue to process, priority by type
- else if ( iModifyQueue.Count() > 0 )
+ else if ( iModifyItemCount > 0 )
{
TN_DEBUG1( "void CThumbAGProcessor::RunL() update thumbnails");
@@ -1075,53 +1299,77 @@
// query for object info
iQueryActive = ETrue;
iModify = ETrue;
- QueryL( iModifyQueue );
+ iUnknown = EFalse;
+ QueryL( EGenerationItemActionModify );
}
- else if ( iAddQueue.Count() > 0 )
+ else if ( iAddItemCount > 0 )
{
TN_DEBUG1( "void CThumbAGProcessor::RunL() update 1st round thumbnails");
i2ndRound = EFalse;
-
+ iUnknown = EFalse;
// query for object info
iQueryActive = ETrue;
- QueryL( iAddQueue );
+ QueryL( EGenerationItemActionAdd );
}
- else if ( iRemoveQueue.Count() > 0 )
+ else if ( iDeleteItemCount > 0 )
{
TN_DEBUG1( "void CThumbAGProcessor::RunL() delete thumbnails");
-
i2ndRound = EFalse;
-
+ iUnknown = EFalse;
// delete thumbs by URI
__ASSERT_DEBUG((iTMSession), User::Panic(_L("CThumbAGProcessor::RunL() !iTMSession "), KErrBadHandle));
if(iTMSession)
{
- HBufC* uri = iRemoveQueue[0];
- TN_DEBUG2( "void CThumbAGProcessor::RunL() delete %S", uri);
- CThumbnailObjectSource* source = NULL;
- TRAPD(err, source = CThumbnailObjectSource::NewL( *uri, KNullDesC));
-
- if(err == KErrNone)
- {
- iTMSession->DeleteThumbnails( *source );
+ TInt itemIndex(KErrNotFound);
+
+ for(TInt i=0;i<iGenerationQueue.Count() || itemIndex == KErrNotFound;i++)
+ {
+ if(iGenerationQueue[i].iItemAction == EGenerationItemActionDelete)
+ {
+ itemIndex = i;
+ }
}
- iRemoveQueue.Remove( 0 );
- delete source;
- delete uri;
+
+ if(itemIndex >= 0)
+ {
+ if(!iGenerationQueue[itemIndex].iUri)
+ {
+ //URI is invalid
+ TN_DEBUG1( "void CThumbAGProcessor::RunL() unable to delete URI inbalid");
+ iGenerationQueue.Remove( itemIndex );
+ ActivateAO();
+ return;
+ }
+
+ TN_DEBUG2( "void CThumbAGProcessor::RunL() delete %S", iGenerationQueue[itemIndex].iUri);
+ CThumbnailObjectSource* source = NULL;
+ TRAPD(err, source = CThumbnailObjectSource::NewL( *iGenerationQueue[itemIndex].iUri, KNullDesC));
+
+ if(err == KErrNone)
+ {
+ iTMSession->DeleteThumbnails( *source );
+ }
+ delete source;
+
+ delete iGenerationQueue[itemIndex].iUri;
+ iGenerationQueue[itemIndex].iUri = NULL;
+ iGenerationQueue.Remove( itemIndex );
+
+ iActiveCount++;
+ }
}
-
- ActivateAO();
}
- else if( i2ndRoundGenerateQueue.Count() > 0)
+ else if( i2ndAddItemCount > 0)
{
TN_DEBUG1( "void CThumbAGProcessor::RunL() update 2nd round thumbnails");
// query for object info
iQueryActive = ETrue;
i2ndRound = ETrue;
- QueryL( i2ndRoundGenerateQueue );
+ iUnknown = EFalse;
+ QueryL( EGenerationItemAction2ndAdd );
}
TN_DEBUG1( "CThumbAGProcessor::RunL() - end" );
@@ -1133,7 +1381,7 @@
//
void CThumbAGProcessor::DeleteAndCancelQuery(TBool aRestoreItems)
{
- TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() in" );
+ TN_DEBUG2( "CThumbAGProcessor::DeleteAndCancelQuery(aRestoreItems = %d) in", aRestoreItems );
if(iQuery)
{
@@ -1150,18 +1398,22 @@
//move remainig IDs in query queue back to original queue
while(iQueryQueue.Count())
{
- if(aRestoreItems && iLastQueue)
+ if(!aRestoreItems )
{
- if(iLastQueue->FindInOrder(iQueryQueue[0], Compare) == KErrNotFound)
+ TThumbnailGenerationItem item;
+ item.iItemId = iQueryQueue[0];
+ TInt itemIndex = iGenerationQueue.FindInOrder(item, Compare);
+
+ if(itemIndex >= 0)
{
- //ignore if fails
- iLastQueue->InsertInOrder(iQueryQueue[0], Compare);
+ delete iGenerationQueue[itemIndex].iUri;
+ iGenerationQueue[itemIndex].iUri = NULL;
+ iGenerationQueue.Remove(itemIndex);
}
}
iQueryQueue.Remove(0);
}
- iLastQueue = NULL;
-
+
TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() out" );
}
@@ -1177,10 +1429,20 @@
void CThumbAGProcessor::HarvestingUpdated(
HarvesterEventObserverType aHEObserverType,
HarvesterEventState aHarvesterEventState,
- TInt /*aItemsLeft*/ )
+ TInt aItemsLeft )
{
- TN_DEBUG3( "CThumbAGProcessor::HarvestingUpdated -- start() aHEObserverType = %d, aHarvesterEventState = %d", aHEObserverType, aHarvesterEventState );
+ TN_DEBUG4( "CThumbAGProcessor::HarvestingUpdated -- start() aHEObserverType = %d, aHarvesterEventState = %d, aItemsLeft = %d", aHEObserverType, aHarvesterEventState, aItemsLeft );
+
+ if(iShutdown)
+ {
+ return;
+ }
+ if(!iHarvesterActivated)
+ {
+ iHarvesterActivated = ETrue;
+ }
+
#ifdef _DEBUG
if( aHEObserverType == EHEObserverTypePlaceholder)
{
@@ -1190,6 +1452,10 @@
{
TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- type EHEObserverTypeOverall");
}
+ else if( aHEObserverType == EHEObserverTypeMMC)
+ {
+ TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- type EHEObserverTypeMMC");
+ }
#endif
//placeholder harvesting
@@ -1224,9 +1490,32 @@
else
{
TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS placeholder harvesting finished");
- TRAP_IGNORE(QueryPlaceholdersL());
+ //query present placeholders
+ TRAP_IGNORE(QueryPlaceholdersL( EFalse ));
+ iDoQueryAllItems = EFalse;
+ iPHHarvestingItemsLeftTemp = 0;
}
}
+
+ //restart mount timout if PH item count is increasing durin MMC harvesting
+ if(iMMCHarvesting && iPHHarvesting && aItemsLeft > iPHHarvestingItemsLeftTemp)
+ {
+ //if items count increasing, restart mount timeout
+ TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- PH count increasing, restart mount timeout");
+
+ if(iMountTimer->IsActive())
+ {
+ iMountTimer->Cancel();
+ }
+
+ iMountTimer->Start( KMountTimeout, KMountTimeout, TCallBack(MountTimerCallBack, this));
+ }
+
+ //we are interestead of only PHs during MMC harvesting
+ if( iMMCHarvesting )
+ {
+ iPHHarvestingItemsLeftTemp = aItemsLeft;
+ }
}
//overall harvesting
else if ( aHEObserverType == EHEObserverTypeOverall)
@@ -1255,7 +1544,7 @@
if( iHarvesting )
{
- TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS harvesterin started");
+ TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS harvesting started");
CancelTimeout();
}
else
@@ -1263,6 +1552,11 @@
TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS harvesting finished ");
// continue processing if needed
StartTimeout();
+
+ if(iMountTimer->IsActive())
+ {
+ iMountTimer->Cancel();
+ }
}
}
}
@@ -1294,17 +1588,34 @@
if( iMMCHarvesting )
{
TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS MMC harvesterin started");
- if(iPreviousItemsLeft != KErrNotReady)
- {
- iPreviousItemsLeft = KErrNotReady;
- RProperty::Set(KTAGDPSNotification, KDaemonProcessing, iPreviousItemsLeft);
- }
+ UpdatePSValues(EFalse, ETrue);
+ iMMCHarvestingItemsLeftTemp = 0;
}
else
{
+ //activate timeout if overall harvesting is not active
+ if(!iHarvesting)
+ {
+ StartTimeout();
+ }
TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS MMC harvesting finished ");
}
}
+
+ //restart mount timout if MMC item count is still increasing
+ if(iMMCHarvesting && aItemsLeft > iMMCHarvestingItemsLeftTemp)
+ {
+ TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MMC count increasing, restart mount timeout");
+
+ if(iMountTimer->IsActive())
+ {
+ iMountTimer->Cancel();
+ }
+
+ iMountTimer->Start( KMountTimeout, KMountTimeout, TCallBack(MountTimerCallBack, this));
+ }
+
+ iMMCHarvestingItemsLeftTemp = aItemsLeft;
}
TN_DEBUG4( "CThumbAGProcessor::HarvestingUpdated -- end() iHarvesting == %d, iPHHarvesting == %d iMMCHarvesting == %d ", iHarvesting, iPHHarvesting, iMMCHarvesting);
@@ -1319,7 +1630,7 @@
TN_DEBUG1( "CThumbAGProcessor::StartTimeout()");
CancelTimeout();
- if(!iHarvesting && !iMPXHarvesting && !iPeriodicTimer->IsActive())
+ if(!iHarvesting && !iMPXHarvesting && !iPeriodicTimer->IsActive() && !iShutdown)
{
iPeriodicTimer->Start( KHarvestingCompleteTimeout, KHarvestingCompleteTimeout,
TCallBack(PeriodicTimerCallBack, this));
@@ -1332,6 +1643,7 @@
//
void CThumbAGProcessor::CancelTimeout()
{
+ TN_DEBUG1( "CThumbAGProcessor::CancelTimeout()");
if(iPeriodicTimer->IsActive())
{
iPeriodicTimer->Cancel();
@@ -1350,16 +1662,10 @@
{
TN_DEBUG2( "CThumbAGrocessor::RunError() %d", aError);
- UpdatePSValues();
+ UpdatePSValues(EFalse, EFalse);
iActiveCount--;
- if(iActiveCount <= 0)
- {
- iActiveCount = 0;
- iActive = EFalse;
- }
-
ActivateAO();
// nothing to do
@@ -1372,23 +1678,16 @@
//
void CThumbAGProcessor::ActivateAO()
{
-#ifdef _DEBUG
- TN_DEBUG6( "CThumbAGProcessor::ActivateAO() items in queue Add = %d, Mod = %d, Del = %d, Query = %d, iPlaceholder = %d", iAddQueue.Count(), iModifyQueue.Count(), iRemoveQueue.Count(), iQueryQueue.Count(), iPlaceholderQueue.Count());
- TN_DEBUG2( "CThumbAGProcessor::ActivateAO() items in queue 2nd Add = %d", i2ndRoundGenerateQueue.Count());
- TN_DEBUG3( "CThumbAGProcessor::ActivateAO() iActive = %d, iActiveCount = %d", iActive, iActiveCount);
- TN_DEBUG3( "CThumbAGProcessor::ActivateAO() iHarvesting == %d, iMPXHarvesting == %d", iHarvesting, iMPXHarvesting);
- TN_DEBUG4( "CThumbAGProcessor::ActivateAO() iIdle = %d, timer = %d, iForceRun = %d", iIdle, iPeriodicTimer->IsActive(), iForceRun);
- TN_DEBUG4( "CThumbAGProcessor::ActivateAO() iModify = %d, iQueryReady = %d, iProcessingCount = %d", iModify, iQueryReady, iProcessingCount);
-#endif
+ UpdateItemCounts();
if(iFormatting)
{
TN_DEBUG1( "CThumbAGProcessor::ActivateAO() - FORMATTING - DAEMON ON PAUSE");
return;
}
-
+
//check if forced run needs to continue
- if (iModifyQueue.Count())
+ if ( iModifyItemCount || iUnknownItemCount > 0 )
{
SetForceRun( ETrue );
}
@@ -1398,7 +1697,7 @@
SetForceRun( EFalse );
}
- if( !IsActive() && ((!iActive && !iQueryActive) || iForceRun ))
+ if( !IsActive() && !iShutdown && ((iActiveCount == 0 && !iQueryActive) || iForceRun ))
{
TN_DEBUG1( "CThumbAGProcessor::ActivateAO() - Activated");
SetActive();
@@ -1406,7 +1705,7 @@
User::RequestComplete( statusPtr, KErrNone );
}
- UpdatePSValues();
+ UpdatePSValues(EFalse, EFalse);
}
// ---------------------------------------------------------------------------
@@ -1495,60 +1794,33 @@
{
TN_DEBUG2( "CThumbAGProcessor::RemoveFromQueues() aRemoveFromDelete == %d - begin", aRemoveFromDelete );
- TInt itemIndex = KErrNotFound;
+ TInt itemIndex(KErrNotFound);
for (int i=0; i< aIDArray.Count(); i++)
{
+ TThumbnailGenerationItem item;
+ item.iItemId = aIDArray[i];
TN_DEBUG2( "CThumbAGProcessor::RemoveFromQueues() - %d", aIDArray[i]);
- itemIndex = iPlaceholderQueue.FindInOrder(aIDArray[i], Compare);
- if(itemIndex >= 0)
- {
- iPlaceholderQueue.Remove(itemIndex);
- TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iPlaceholderQueue" );
- }
-
- itemIndex = iAddQueue.FindInOrder(aIDArray[i], Compare);
+ itemIndex = iGenerationQueue.FindInOrder(item, Compare);
if(itemIndex >= 0)
{
- iAddQueue.Remove(itemIndex);
- TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iAddQueue" );
- }
-
- itemIndex = i2ndRoundGenerateQueue.FindInOrder(aIDArray[i], Compare);
- if(itemIndex >= 0)
- {
- i2ndRoundGenerateQueue.Remove(itemIndex);
- TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - i2ndRoundGenerateQueue" );
+ delete iGenerationQueue[itemIndex].iUri;
+ iGenerationQueue[itemIndex].iUri = NULL;
+ iGenerationQueue.Remove(itemIndex);
+ TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iGenerationQueue" );
}
-
- itemIndex = iModifyQueue.FindInOrder(aIDArray[i], Compare);
- if(itemIndex >= 0)
- {
- iModifyQueue.Remove(itemIndex);
- TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iModifyQueue" );
-
- if( iModifyQueue.Count() == 0)
- {
- SetForceRun( EFalse );
- }
- }
-
- itemIndex = iQueryQueue.FindInOrder(aIDArray[i], Compare);
+
+ itemIndex = iQueryQueue.FindInOrder(aIDArray[i], CompareId);
if(itemIndex >= 0)
{
iQueryQueue.Remove(itemIndex);
TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iQueryQueue" );
}
-
- itemIndex = iPlaceholderQueue.FindInOrder(aIDArray[i], Compare);
- if(itemIndex >= 0)
- {
- iPlaceholderQueue.Remove(itemIndex);
- TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iPlaceholderQueue" );
- }
}
+ ActivateAO();
+
TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - end" );
}
@@ -1607,13 +1879,13 @@
CMdELogicCondition& rootCondition = iQueryAllItems->Conditions();
rootCondition.SetOperator( ELogicConditionOperatorOr );
- CMdEObjectCondition& imagePHObjectCondition = rootCondition.AddObjectConditionL(imageObjDef);
+ CMdEObjectCondition& imageObjectCondition = rootCondition.AddObjectConditionL(imageObjDef);
- CMdEObjectCondition& videoPHObjectCondition = rootCondition.AddObjectConditionL(videoObjDef);
+ CMdEObjectCondition& videoObjectCondition = rootCondition.AddObjectConditionL(videoObjDef);
- CMdEObjectCondition& audioPHObjectCondition = rootCondition.AddObjectConditionL(audioObjDef);
+ CMdEObjectCondition& audioObjectCondition = rootCondition.AddObjectConditionL(audioObjDef);
- iQueryAllItems->FindL(KMaxTInt, KMaxQueryItems2);
+ iQueryAllItems->FindL(KMaxTInt, KMaxQueryBatchSize);
TN_DEBUG1( "CThumbAGProcessor::QueryAllItemsL - end" );
}
@@ -1626,7 +1898,7 @@
//
void CThumbAGProcessor::HandleCollectionMessage( CMPXMessage* aMessage, TInt aError )
{
- if ( aError != KErrNone || !aMessage )
+ if ( aError != KErrNone || !aMessage || iShutdown )
{
return;
}
@@ -1728,7 +2000,7 @@
{
iIdle = ETrue;
- if(iAddQueue.Count() + iModifyQueue.Count() + iRemoveQueue.Count() + i2ndRoundGenerateQueue.Count() > 0 )
+ if(iGenerationQueue.Count() > 0 )
{
ActivateAO();
}
@@ -1780,55 +2052,94 @@
// Update KItemsleft PS value if changed
// ---------------------------------------------------------------------------
//
-void CThumbAGProcessor::UpdatePSValues(const TBool aDefine)
+void CThumbAGProcessor::UpdatePSValues(const TBool aDefine, const TBool aForce)
{
- TInt itemsLeft = iModifyQueue.Count() + iAddQueue.Count();
- TBool daemonProcessing = EFalse;
+ TInt itemsLeft(KErrNotReady);
+ TBool daemonProcessing = ETrue;
- if(itemsLeft + i2ndRoundGenerateQueue.Count() + iRemoveQueue.Count() > 0 )
+ if(iShutdown)
+ {
+ RProperty::Set(KTAGDPSNotification, KDaemonProcessing, EFalse);
+ RProperty::Set(KTAGDPSNotification, KItemsleft, 0 );
+ return;
+ }
+
+ if(aDefine)
{
- daemonProcessing = ETrue;
- }
-
- //adjust items left to containing also items not yet processed but removed from queue under processing
- if((iLastQueue == &iModifyQueue || iLastQueue == &iAddQueue) && !i2ndRound)
- {
- itemsLeft +=iQueryQueue.Count();
+ TInt ret = RProperty::Define(KTAGDPSNotification, KDaemonProcessing, RProperty::EInt);
+
+ if( ret != KErrNone )
+ {
+ TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() define KDaemonProcessing ret = %d", ret);
+ }
+
+ ret = RProperty::Define(KTAGDPSNotification, KItemsleft, RProperty::EInt);
+
+ if( ret != KErrNone )
+ {
+ TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() define KItemsleft ret = %d", ret);
+ }
}
- //cancel 2nd round generarion when there is items in 1st round queues
- if(itemsLeft && i2ndRound)
- {
- DeleteAndCancelQuery(ETrue);
- i2ndRound = EFalse;
- }
-
- TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() KItemsleft == %d", itemsLeft);
+ // set itemsleft = KErrNotReady (-18) and daemonProcessing = ETrue if
+ // - key is initalized
+ // - mount timer is pending
+ // - harvester observer is not yet activated
+ // - single unknown item exists in processing queue
+ // - forced
+ if( iMountTimer->IsActive() || aForce || aDefine || iUnknownItemCount
+ || !iHarvesterActivated )
+ {
+ daemonProcessing = ETrue;
+ itemsLeft = KErrNotReady;
+ }
+ else
+ {
+ itemsLeft = iAddItemCount + iModifyItemCount;
+ }
+
+ TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() KItemsleft == %d", itemsLeft);
+
+ //cancel 2nd round generarion when there is items in 1st round queues
+ if(iAddItemCount && i2ndRound)
+ {
+ DeleteAndCancelQuery(ETrue);
+ i2ndRound = EFalse;
+ }
- if(aDefine)
- {
- TN_DEBUG1( "CThumbAGProcessor::UpdatePSValues() define");
- RProperty::Define(KTAGDPSNotification, KDaemonProcessing, RProperty::EInt);
- RProperty::Set(KTAGDPSNotification, KDaemonProcessing, 0);
- daemonProcessing = EFalse;
- RProperty::Define(KTAGDPSNotification, KItemsleft, RProperty::EInt);
- RProperty::Set(KTAGDPSNotification, KItemsleft, 0);
- iPreviousItemsLeft = 0;
- }
-
- if( daemonProcessing != iPreviousDaemonProcessing)
- {
- TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() update KDaemonProcessing == %d", daemonProcessing);
- iPreviousDaemonProcessing = daemonProcessing;
- RProperty::Set(KTAGDPSNotification, KDaemonProcessing, daemonProcessing);
- }
-
- if( itemsLeft != iPreviousItemsLeft)
- {
- TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() update KItemsleft == %d", itemsLeft);
- iPreviousItemsLeft = itemsLeft;
- RProperty::Set(KTAGDPSNotification, KItemsleft, itemsLeft );
- }
+ if( iGenerationQueue.Count() )
+ {
+ daemonProcessing = ETrue;
+ }
+ else
+ {
+ daemonProcessing = EFalse;
+ }
+
+ if( daemonProcessing != iPreviousDaemonProcessing)
+ {
+ TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() update KDaemonProcessing == %d", daemonProcessing);
+ iPreviousDaemonProcessing = daemonProcessing;
+ TInt ret = RProperty::Set(KTAGDPSNotification, KDaemonProcessing, daemonProcessing);
+
+ if(ret != KErrNone )
+ {
+ TN_DEBUG3( "CThumbAGProcessor::UpdatePSValues() set KDaemonProcessing %d failed %d", daemonProcessing, ret);
+ }
+ }
+
+ if( itemsLeft != iPreviousItemsLeft)
+ {
+ TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() update KItemsleft == %d", itemsLeft);
+ iPreviousItemsLeft = itemsLeft;
+ TInt ret = RProperty::Set(KTAGDPSNotification, KItemsleft, itemsLeft );
+
+ if(ret != KErrNone )
+ {
+ TN_DEBUG3( "CThumbAGProcessor::UpdatePSValues() set KItemsleft %d failed %d", itemsLeft, ret);
+ }
+ }
+
}
// ---------------------------------------------------------------------------
@@ -1836,10 +2147,208 @@
// Comparison function for logaritmic use of queue arrays
// ---------------------------------------------------------------------------
//
-TInt CThumbAGProcessor::Compare(const TItemId& aLeft, const TItemId& aRight)
+
+TInt CThumbAGProcessor::Compare(const TThumbnailGenerationItem& aLeft, const TThumbnailGenerationItem& aRight)
+ {
+ return (aLeft.iItemId - aRight.iItemId);
+ }
+
+TInt CThumbAGProcessor::CompareId(const TItemId& aLeft, const TItemId& aRight)
{
return (aLeft - aRight);
}
+void CThumbAGProcessor::UpdateItemCounts()
+ {
+ TN_DEBUG1( "CThumbAGProcessor::UpdateItemCounts()");
+ iModifyItemCount = 0;
+ iDeleteItemCount = 0;
+ iAddItemCount = 0;
+ iUnknownItemCount = 0;
+ i2ndAddItemCount = 0;
+ iPlaceholderItemCount=0;
+ iCameraItemCount =0;
+ iImageItemCount=0;
+ iVideoItemCount=0;
+ iAudioItemCount=0;
+
+ for(TInt i=0; i < iGenerationQueue.Count(); i++)
+ {
+ TThumbnailGenerationItem& item = iGenerationQueue[i];
+
+ if(item.iItemAction == EGenerationItemActionModify)
+ {
+ iModifyItemCount++;
+ }
+
+ if(item.iItemAction == EGenerationItemActionDelete)
+ {
+ iDeleteItemCount++;
+ }
+
+ if(item.iItemType == EGenerationItemTypeUnknown)
+ {
+ iUnknownItemCount++;
+ }
+ if(item.iItemAction == EGenerationItemAction2ndAdd)
+ {
+ i2ndAddItemCount++;
+ }
+ if(item.iPlaceholder)
+ {
+ iPlaceholderItemCount++;
+ }
+ if(item.iItemType == EGenerationItemTypeCamera)
+ {
+ iCameraItemCount++;
+ }
+ if(item.iItemAction == EGenerationItemActionAdd )
+ {
+ iAddItemCount++;
+ }
+ if(item.iItemType == EGenerationItemTypeAudio)
+ {
+ iAudioItemCount++;
+ }
+ if(item.iItemType == EGenerationItemTypeVideo)
+ {
+ iVideoItemCount++;
+ }
+ if(item.iItemType == EGenerationItemTypeImage)
+ {
+ iImageItemCount++;
+ }
+ }
+
+ TN_DEBUG2( "CThumbAGProcessor::UpdateItemCounts() iActiveCount = %d",
+ iActiveCount);
+ TN_DEBUG2( "CThumbAGProcessor::UpdateItemCounts() iPreviousItemsLeft = %d",
+ iPreviousItemsLeft);
+ TN_DEBUG5( "CThumbAGProcessor::UpdateItemCounts() iHarvesting == %d, iMMCHarvesting == %d, iPHHarvesting == %d, iMPXHarvesting == %d",
+ iHarvesting, iMMCHarvesting, iPHHarvesting, iMPXHarvesting);
+ TN_DEBUG5( "CThumbAGProcessor::UpdateItemCounts() iIdle = %d, iForegroundRun = %d, timer = %d, iForceRun = %d",
+ iIdle, iForegroundRun, iPeriodicTimer->IsActive(), iForceRun);
+ TN_DEBUG4( "CThumbAGProcessor::UpdateItemCounts() iModify = %d, iQueryReady = %d, iProcessingCount = %d",
+ iModify, iQueryReady, iProcessingCount);
+ TN_DEBUG2( "CThumbAGProcessor::UpdateItemCounts() iMountTimer = %d", iMountTimer->IsActive());
+ TN_DEBUG3( "CThumbAGProcessor::UpdateItemCounts() iGenerationQueue = %d, iQueryQueue = %d",
+ iGenerationQueue.Count(), iQueryQueue.Count());
+ TN_DEBUG5( "CThumbAGProcessor::UpdateItemCounts() iAddItemCount=%d, i2ndAddItemCount=%d, iModifyItemCount=%d, iDeleteItemCount=%d",
+ iAddItemCount, i2ndAddItemCount, iModifyItemCount, iDeleteItemCount );
+ TN_DEBUG3( "CThumbAGProcessor::UpdateItemCounts() iUnknownItemCount=%d, iPlaceholderItemCount=%d",
+ iUnknownItemCount, iPlaceholderItemCount);
+ TN_DEBUG4( "CThumbAGProcessor::UpdateItemCounts() iAudioItemCount=%d, iVideoItemCount=%d, iImageItemCount=%d",
+ iAudioItemCount, iVideoItemCount, iImageItemCount);
+ TN_DEBUG2( "CThumbAGProcessor::UpdateItemCounts() iCameraItemCount=%d", iCameraItemCount);
+
+ //compress queues when empty
+ if(!iGenerationQueue.Count())
+ {
+ iGenerationQueue.Compress();
+ }
+
+ if(!iQueryQueue.Count())
+ {
+ iQueryQueue.Compress();
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// CThumbAGProcessor::MountTimerCallBack()
+// ---------------------------------------------------------------------------
+//
+TInt CThumbAGProcessor::MountTimerCallBack(TAny* aAny)
+ {
+ TN_DEBUG1( "CThumbAGProcessor::MountTimerCallBack()");
+ CThumbAGProcessor* self = static_cast<CThumbAGProcessor*>( aAny );
+
+ self->iMountTimer->Cancel();
+
+ //activate timeout if overall or mmc harvestig is not active
+ if(!self->iHarvesting && !self->iMMCHarvesting )
+ {
+ self->ActivateAO();
+ }
+
+ return KErrNone; // Return value ignored by CPeriodic
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGProcessor::SetGenerationItemAction()
+// ---------------------------------------------------------------------------
+//
+void CThumbAGProcessor::SetGenerationItemAction( TThumbnailGenerationItem& aGenerationItem, TThumbnailGenerationItemType aItemType )
+ {
+ switch( aItemType )
+ {
+ case EGenerationItemTypeAudio:
+ aGenerationItem.iItemAction = EGenerationItemAction2ndAdd;
+ break;
+ case EGenerationItemTypeCamera:
+ aGenerationItem.iItemAction = EGenerationItemAction2ndAdd;
+ aGenerationItem.iPlaceholder = ETrue;
+ break;
+ case EGenerationItemTypeImage:
+ aGenerationItem.iItemAction = EGenerationItemActionAdd;
+ break;
+ case EGenerationItemTypeVideo:
+ //S^3 EGenerationItemActionAdd
+ //S^4 EGenerationItemAction2ndAdd
+ aGenerationItem.iItemAction = EGenerationItemAction2ndAdd;
+ break;
+ default:
+ aGenerationItem.iItemAction = EGenerationItemActionResolveType;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGProcessor::SetGenerationItemType()
+// ---------------------------------------------------------------------------
+//
+void CThumbAGProcessor::SetGenerationItemType( TThumbnailGenerationItem& aGenerationItem, const TDefId aDefId )
+ {
+ if(aDefId == iImageObjectDef->Id())
+ {
+ aGenerationItem.iItemType = EGenerationItemTypeImage;
+ }
+ else if(aDefId == iAudioObjectDef->Id())
+ {
+ aGenerationItem.iItemType = EGenerationItemTypeAudio;
+ }
+ else if(aDefId == iVideoObjectDef->Id())
+ {
+ aGenerationItem.iItemType = EGenerationItemTypeVideo;
+ }
+ else
+ {
+ aGenerationItem.iItemType = EGenerationItemTypeUnknown;
+ }
+
+ SetGenerationItemAction( aGenerationItem, aGenerationItem.iItemType );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CThumbAGProcessor::AppendProcessingQueue()
+// -----------------------------------------------------------------------------
+//
+void CThumbAGProcessor::AppendProcessingQueue( TThumbnailGenerationItem& item )
+ {
+
+ TInt itemIndex = iGenerationQueue.FindInOrder( item, Compare );
+
+ if(itemIndex >= 0)
+ {
+ iGenerationQueue[itemIndex].iPlaceholder = item.iPlaceholder;
+ iGenerationQueue[itemIndex].iItemType = item.iItemType;
+ iGenerationQueue[itemIndex].iItemAction = item.iItemAction;
+ }
+ else
+ {
+ iGenerationQueue.InsertInOrder(item, Compare);
+ }
+ }
+
// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagvideoobserver.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -0,0 +1,343 @@
+/*
+* 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: Thumbnail Auto Generate Daemon
+*
+*/
+
+
+#include <e32svr.h>
+#include <centralrepository.h>
+
+#include <mdesession.h>
+#include <mdeconstants.h>
+#include <mdequery.h>
+#include <mdeobject.h>
+
+#include "thumbagvideoobserver.h"
+#include "thumbnaillog.h"
+#include "thumbnailmanagerconstants.h"
+#include "thumbnailmanagerprivatecrkeys.h"
+
+
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//
+CThumbAGVideoObserver* CThumbAGVideoObserver::NewLC(CThumbAGProcessor* aProcessor)
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::NewLC() - begin" );
+
+ CThumbAGVideoObserver* self = new (ELeave) CThumbAGVideoObserver(aProcessor);
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CThumbAGVideoObserver* CThumbAGVideoObserver::NewL(CThumbAGProcessor* aProcessor)
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::NewL() - begin" );
+
+ CThumbAGVideoObserver* self = CThumbAGVideoObserver::NewLC(aProcessor);
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGVideoObserver
+// ---------------------------------------------------------------------------
+//
+CThumbAGVideoObserver::CThumbAGVideoObserver(CThumbAGProcessor* aProcessor)
+ : iShutdownObserver(NULL), iMDSShutdownObserver(NULL), iMdESession(NULL), iProcessor(aProcessor)
+ {
+ // No implementation required
+ }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CThumbAGVideoObserver::ConstructL()
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::ConstructL() - begin" );
+
+#ifdef _DEBUG
+ iAddCounter = 0;
+ iModCounter = 0;
+#endif
+
+ InitializeL();
+
+ TN_DEBUG1( "CThumbAGVideoObserver::ConstructL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// ~CThumbAGVideoObserver
+// ---------------------------------------------------------------------------
+//
+void CThumbAGVideoObserver::InitializeL()
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::InitializeL() - begin" );
+
+
+ TN_DEBUG1( "CThumbAGVideoObserver::InitializeL() - create observers" );
+
+ // create shutdown observer
+ if(iMDSShutdownObserver)
+ {
+ delete iMDSShutdownObserver;
+ iMDSShutdownObserver = NULL;
+ }
+ iMDSShutdownObserver = CTMShutdownObserver::NewL( *this, KMdSPSShutdown, KMdSShutdown, EFalse );
+
+ if(iShutdownObserver)
+ {
+ delete iShutdownObserver;
+ iShutdownObserver = NULL;
+ }
+ iShutdownObserver = CTMShutdownObserver::NewL( *this, KTAGDPSNotification, KShutdown, ETrue );
+ iShutdown = EFalse;
+
+ // MDS session reconnect timer
+ if (!iReconnect)
+ {
+ iReconnect = CPeriodic::NewL(CActive::EPriorityIdle);
+ }
+
+ TN_DEBUG1( "CThumbAGVideoObserver::InitializeL() - connect to MDS" );
+
+ if(iMdESession)
+ {
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+
+ // connect to MDS
+ delete iMdESession;
+ iMdESession = NULL;
+ }
+
+ iMdESession = CMdESession::NewL( *this );
+ iSessionError = EFalse;
+
+ TN_DEBUG1( "CThumbAGVideoObserver::InitializeL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// ~CThumbAGVideoObserver
+// ---------------------------------------------------------------------------
+//
+CThumbAGVideoObserver::~CThumbAGVideoObserver()
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::~CThumbAGVideoObserver() - begin" );
+
+ iShutdown = ETrue;
+
+ delete iMDSShutdownObserver;
+ delete iShutdownObserver;
+
+ if(iReconnect)
+ {
+ iReconnect->Cancel();
+ delete iReconnect;
+ iReconnect = NULL;
+ }
+
+ if (iMdESession)
+ {
+ // 2 observers
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+
+ delete iMdESession;
+ iMdESession = NULL;
+ }
+
+ TN_DEBUG1( "CThumbAGVideoObserver::~CThumbAGVideoObserver() - end" );
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGVideoObserver::HandleSessionOpened
+// -----------------------------------------------------------------------------
+//
+void CThumbAGVideoObserver::HandleSessionOpened( CMdESession& /* aSession */, TInt aError )
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::HandleSessionOpened");
+
+ if (aError == KErrNone)
+ {
+ TRAPD( err, AddObserversL() );
+ if (err != KErrNone)
+ {
+ TN_DEBUG2( "CThumbAGVideoObserver::HandleSessionOpened, AddObserversL error == %d", err );
+ }
+ }
+ else
+ {
+ TN_DEBUG2( "CThumbAGVideoObserver::HandleSessionOpened error == %d", aError );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGVideoObserver::HandleSessionError
+// -----------------------------------------------------------------------------
+//
+void CThumbAGVideoObserver::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
+ {
+ TN_DEBUG2( "CThumbAGVideoObserver::HandleSessionError == %d", aError );
+ if (aError != KErrNone && !iSessionError)
+ {
+ iSessionError = ETrue;
+
+ if (!iShutdown)
+ {
+ if (!iReconnect->IsActive())
+ {
+ iReconnect->Start( KMdEReconnect, KMdEReconnect,
+ TCallBack(ReconnectCallBack, this));
+
+ TN_DEBUG1( "CThumbAGVideoObserver::HandleSessionError() - reconnect timer started" );
+ }
+ }
+
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGVideoObserver::HandleObjectNotification
+// -----------------------------------------------------------------------------
+//
+void CThumbAGVideoObserver::HandleObjectNotification( CMdESession& /*aSession*/,
+ TObserverNotificationType aType,
+ const RArray<TItemId>& aObjectIdArray )
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - begin" );
+
+ // no processor or shutting down
+ if ( iShutdown || !iProcessor)
+ {
+ return;
+ }
+
+#ifdef _DEBUG
+ if (aType == ENotifyAdd)
+ {
+ TN_DEBUG2( "CThumbAGVideoObserver::HandleObjectNotification() - ENotifyAdd %d", aObjectIdArray.Count() );
+ iAddCounter = aObjectIdArray.Count();
+ }
+ else if (aType == ENotifyModify)
+ {
+ TN_DEBUG2( "CThumbAGVideoObserver::HandleObjectNotification() - ENotifyModify %d", aObjectIdArray.Count() );
+ iModCounter = aObjectIdArray.Count();
+ }
+#endif
+
+ if ( (aType == ENotifyAdd || aType == ENotifyModify ) && (aObjectIdArray.Count() > 0) )
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - AddToQueueL" );
+
+ // Add event to processing queue by type and enable force run
+ RPointerArray<HBufC> dummyArray;
+ TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeVideo, aObjectIdArray, dummyArray, EFalse));
+ if (err != KErrNone)
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - error adding to queue" );
+ }
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - bad notification" );
+ }
+
+#ifdef _DEBUG
+ TN_DEBUG3( "CThumbAGVideoObserver::IN-COUNTERS---------- Add = %d Modify = %d", iAddCounter, iModCounter );
+ iModCounter = 0;
+ iAddCounter = 0;
+#endif
+
+ TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - end" );
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGVideoObserver::ShutdownNotification
+// -----------------------------------------------------------------------------
+//
+void CThumbAGVideoObserver::ShutdownNotification()
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::ShutdownNotification()" );
+
+ if (!iShutdown)
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::ShutdownNotification() shutdown" );
+ iShutdown = ETrue;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGVideoObserver::AddObserversL
+// ---------------------------------------------------------------------------
+//
+void CThumbAGVideoObserver::AddObserversL()
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::AddObserversL() - begin" );
+
+ CMdENamespaceDef& defaultNamespace = iMdESession->GetDefaultNamespaceDefL();
+ CMdEObjectDef& objectDef = defaultNamespace.GetObjectDefL( MdeConstants::Object::KBaseObject );
+ CMdEPropertyDef& originPropDef = objectDef.GetPropertyDefL( MdeConstants::Object::KOriginProperty );
+ CMdEObjectDef& videoDef = defaultNamespace.GetObjectDefL( MdeConstants::Video::KVideoObject );
+
+ // set observing conditions
+ CMdELogicCondition* addCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
+ addCondition->AddObjectConditionL( videoDef );
+ addCondition->AddPropertyConditionL( originPropDef, TMdEUintNotEqual(MdeConstants::Object::ECamera));
+ CleanupStack::Pop( addCondition );
+
+ CMdELogicCondition* modifyCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
+ modifyCondition->AddObjectConditionL( videoDef );
+ addCondition->AddPropertyConditionL( originPropDef, TMdEUintNotEqual(MdeConstants::Object::ECamera));
+ CleanupStack::Pop( modifyCondition );
+
+ // add observer
+ iMdESession->AddObjectObserverL( *this, addCondition, ENotifyAdd );
+
+ // modify observer
+ iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify );
+
+ TN_DEBUG1( "CThumbAGVideoObserver::AddObserversL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGVideoObserver::ReconnectCallBack()
+// ---------------------------------------------------------------------------
+//
+TInt CThumbAGVideoObserver::ReconnectCallBack(TAny* aAny)
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::ReconnectCallBack() - reinitialize");
+
+ CThumbAGVideoObserver* self = static_cast<CThumbAGVideoObserver*>( aAny );
+
+ self->iReconnect->Cancel();
+
+ // reconnect to MDS
+ TRAP_IGNORE( self->InitializeL() );
+
+ TN_DEBUG1( "CThumbAGVideoObserver::ReconnectCallBack() - done");
+
+ return KErrNone;
+ }
+
+
+// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/bwins/thumbnailmanageru.def Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/bwins/thumbnailmanageru.def Thu Jul 22 16:37:07 2010 +0100
@@ -19,4 +19,7 @@
?Uri@CThumbnailObjectSource@@QAEABVTDesC16@@XZ @ 18 NONAME ; class TDesC16 const & CThumbnailObjectSource::Uri(void)
?Bitmap@CThumbnailObjectSource@@QAEPAVCFbsBitmap@@XZ @ 19 NONAME ; class CFbsBitmap * CThumbnailObjectSource::Bitmap(void)
?GetBitmapOwnership@CThumbnailObjectSource@@QAEPAVCFbsBitmap@@XZ @ 20 NONAME ; class CFbsBitmap * CThumbnailObjectSource::GetBitmapOwnership(void)
+ ?NewLC@CThumbnailObjectSource@@SAPAV1@ABVTDesC16@@00@Z @ 21 NONAME ; class CThumbnailObjectSource * CThumbnailObjectSource::NewLC(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
+ ?TargetUri@CThumbnailObjectSource@@QAEABVTDesC16@@XZ @ 22 NONAME ; class TDesC16 const & CThumbnailObjectSource::TargetUri(void)
+ ?NewL@CThumbnailObjectSource@@SAPAV1@ABVTDesC16@@00@Z @ 23 NONAME ; class CThumbnailObjectSource * CThumbnailObjectSource::NewL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/eabi/thumbnailmanageru.def Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/eabi/thumbnailmanageru.def Thu Jul 22 16:37:07 2010 +0100
@@ -21,4 +21,7 @@
_ZN22CThumbnailObjectSource6BitmapEv @ 20 NONAME
_ZTI22CThumbnailRequestQueue @ 21 NONAME
_ZTV22CThumbnailRequestQueue @ 22 NONAME
+ _ZN22CThumbnailObjectSource4NewLERK7TDesC16S2_S2_ @ 23 NONAME
+ _ZN22CThumbnailObjectSource5NewLCERK7TDesC16S2_S2_ @ 24 NONAME
+ _ZN22CThumbnailObjectSource9TargetUriEv @ 25 NONAME
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailmanagerimpl.h Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailmanagerimpl.h Thu Jul 22 16:37:07 2010 +0100
@@ -353,6 +353,22 @@
*/
TThumbnailRequestId RenameThumbnailsL( const TDesC& aCurrentPath,
const TDesC& aNewPath, TInt aPriority = CActive::EPriorityIdle );
+
+ /**
+ * Set optional request observer for getting information about completed
+ * requests that don't include a thumbnail.
+ *
+ * @since Symbian^3
+ * @param aObserver Observer to receive notifications.
+ */
+ void SetRequestObserver( MThumbnailManagerRequestObserver& aObserver );
+
+ /**
+ * Remove optional request observer.
+ *
+ * @since Symbian^3
+ */
+ void RemoveRequestObserver();
private:
@@ -400,6 +416,11 @@
* Observer to receive notifications about completed operations.
*/
MThumbnailManagerObserver& iObserver;
+
+ /**
+ * Observer to receive notifications about completed requests.
+ */
+ MThumbnailManagerRequestObserver* iRequestObserver;
/**
* Session.
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestactive.h Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestactive.h Thu Jul 22 16:37:07 2010 +0100
@@ -32,7 +32,7 @@
class CThumbnailDataImpl;
class CThumbnailRequestQueue;
-enum TThumbnailRequestType
+enum TThumbnailReqType
{
EReqGetThumbnailHandle = 0,
EReqGetThumbnailPath = 1,
@@ -41,7 +41,8 @@
EReqUpdateThumbnails = 4,
EReqGetThumbnailHandleLater = 5,
EReqDeleteThumbnails = 6,
- EReqRenameThumbnails = 7
+ EReqRenameThumbnails = 7,
+ EReqSetThumbnailPath = 8
};
/**
@@ -66,16 +67,17 @@
* @since S60 v5.0
* @param aFs Fileserver used.
* @param aThumbnailSession Session used.
- * @param aObserver Observer to receive notifications about completed
- * operations.
+ * @param aObserver Observer to receive notifications about completed operations.
+ * @param aRequestObserver Observer to receive notifications about completed requests.
* @param aId Assigned ID of the request, session specific.
* @param aPriority assigned processing priority
* @param aQueue request processor
* @return New CThumbnailRequestActive object.
*/
static CThumbnailRequestActive* NewL( RFs& aFs, RThumbnailSession&
- aThumbnailSession, MThumbnailManagerObserver& aObserver,
- TThumbnailRequestId aId, TInt aPriority, CThumbnailRequestQueue* aQueue );
+ aThumbnailSession, MThumbnailManagerObserver& aObserver,
+ MThumbnailManagerRequestObserver* aRequestObserver, TThumbnailRequestId aId,
+ TInt aPriority, CThumbnailRequestQueue* aQueue );
/**
* Get a thumbnail created from file object.
@@ -163,12 +165,13 @@
* @param aGeneratePersistentSizesOnly
* @param aTargetUri Target URI to which the imported thumbnail is linked.
* @param aThumbnailSize Requested thumbnail size
+ * @param aOverwrite Overwrite old existing thumbs
*/
void SetThumbnailL( TDesC8* aBuffer, TThumbnailId aThumbnailId, const TDesC8& aMimeType,
CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager
::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const
TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly,
- const TDesC& aTargetUri, TThumbnailSize aThumbnailSize );
+ const TDesC& aTargetUri, TThumbnailSize aThumbnailSize, TBool aOverwrite);
/**
* Set a thumbnail
@@ -187,12 +190,13 @@
* @param aGeneratePersistentSizesOnly
* @param aTargetUri Target URI to which the imported thumbnail is linked.
* @param aThumbnailSize Requested thumbnail size
+ * @param aOverwrite Overwrite old existing thumbs
*/
void SetThumbnailL( CFbsBitmap* aBitmap, TThumbnailId aThumbnailId, const TDesC8& aMimeType,
CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager
::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const
TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly,
- const TDesC& aTargetUri, TThumbnailSize aThumbnailSize );
+ const TDesC& aTargetUri, TThumbnailSize aThumbnailSize, TBool aOverwrite);
/**
* Update thumbnails by Id.
@@ -235,6 +239,32 @@
const TInt aPriority );
/**
+ * Set thumbnail from file path.
+ *
+ * @param aPath Path to file from which the thumbnail is to be created.
+ * @param aFile File from which the thumbnail is to be created.
+ * @param aFlags Flags that control the creation of thumbnail.
+ * @param aQualityPreference Quality preference value
+ * @param aSize Requested size of the thumbnail.
+ * @param aDisplayMode Display mode.
+ * @param aPriority Priority of the request.
+ * @param aClientData Pointer to arbitrary client data.
+ * This pointer is not used by the API for
+ * anything other than returning it in the
+ * ThumbnailReady callback.
+ * @param aGeneratePersistentSizesOnly
+ * @param aOverwrite Overwrite old existing thumbs
+ * @param aTargetUri Target URI to which the imported thumbnail is linked.
+ * @param aThumbnailSize Relative thumbnail size
+ */
+ void SetThumbnailL( const TDesC& aPath, const TDesC8& aMimeType,
+ CThumbnailManager::TThumbnailFlags aFlags,
+ CThumbnailManager::TThumbnailQualityPreference aQualityPreference,
+ const TSize& aSize, const TDisplayMode aDisplayMode, const TInt aPriority,
+ TAny* aClientData, TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri,
+ TThumbnailSize aThumbnailSize, TBool aOverwrite);
+
+ /**
* Start active request.
*
* @since S60 v5.0
@@ -294,16 +324,16 @@
* @since S60 v5.0
* @param aFs Fileserver used.
* @param aThumbnailSession Session used.
- * @param aObserver Observer to receive notifications about completed
- * operations.
+ * @param aObserver Observer to receive notifications about completed operations.
+ * @param aRequestObserver Observer to receive notifications about completed requests.
* @param aId Assigned ID of the request, session specific.
* @param aPriority assigned processing priority
* @param aQueue request processor
* @return New CThumbnailRequestActive object.
*/
CThumbnailRequestActive( RFs& aFs, RThumbnailSession& aThumbnailSession,
- MThumbnailManagerObserver& aObserver, TThumbnailRequestId aId, TInt aPriority,
- CThumbnailRequestQueue* aQueue);
+ MThumbnailManagerObserver& aObserver, MThumbnailManagerRequestObserver* aRequestObserver,
+ TThumbnailRequestId aId, TInt aPriority, CThumbnailRequestQueue* aQueue);
/**
* Symbian 2nd phase constructor can leave.
@@ -363,6 +393,11 @@
* @since S60 v5.0
*/
static TInt TimerCallBack(TAny* aAny);
+
+ /**
+ * Checks if URI is virtual.
+ */
+ TBool IsVirtualUri( const TDesC& aPath );
private:
// data
@@ -386,6 +421,11 @@
* Observer to receive notifications about completed operations.
*/
MThumbnailManagerObserver& iObserver;
+
+ /**
+ * Observer to receive notifications about completed requests.
+ */
+ MThumbnailManagerRequestObserver* iRequestObserver;
/**
* Fileserver, not own
@@ -454,7 +494,7 @@
// not own
CThumbnailRequestQueue* iRequestQueue;
- TThumbnailRequestType iRequestType;
+ TThumbnailReqType iRequestType;
// request timeout timer
CPeriodic* iTimer;
@@ -463,6 +503,11 @@
// request already canceled by client
TBool iCanceled;
+#ifdef __RETRY_ON_SERVERCRASH
+ //request retry count
+ TUint iRetry;
+#endif
+
#ifdef _DEBUG
TTime iStartExecTime;
#endif
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -47,7 +47,11 @@
//
CThumbnailManagerImpl::~CThumbnailManagerImpl()
{
- delete iRequestQueue;
+ TN_DEBUG1( "CThumbnailManagerImpl::~CThumbnailManagerImpl() - start" );
+
+ delete iRequestQueue;
+ iRequestQueue = NULL;
+
iSession.Close();
iFs.Close();
@@ -65,6 +69,9 @@
}
delete iMimeTypeList;
+ iMimeTypeList = NULL;
+
+ TN_DEBUG1( "CThumbnailManagerImpl::~CThumbnailManagerImpl() - end" );
}
@@ -89,11 +96,12 @@
// ---------------------------------------------------------------------------
//
CThumbnailManagerImpl::CThumbnailManagerImpl( MThumbnailManagerObserver&
- aObserver ): iObserver( aObserver ), iDisplayMode(
+ aObserver ): iObserver( aObserver ), iRequestObserver( NULL ), iDisplayMode(
KThumbnailDefaultDisplayMode ), iFlags( EDefaultFlags ), iQualityPreference
( EOptimizeForQuality ), iRequestId( 0 )
{
// No implementation required
+ TN_DEBUG1( "CThumbnailManagerImpl::CThumbnailManagerImpl()" );
}
@@ -104,6 +112,8 @@
//
void CThumbnailManagerImpl::ConstructL()
{
+ TN_DEBUG1( "CThumbnailManagerImpl::ConstructL - start");
+
User::LeaveIfError( iSession.Connect());
User::LeaveIfError( iFs.Connect());
User::LeaveIfError( iFs.ShareProtected());
@@ -129,11 +139,14 @@
{
// Fbs connection was available in the beginning, no need to
// increase the reference count
+ TN_DEBUG1( "CThumbnailManagerImpl::ConstructL - no need to update sessionCount");
}
}
// request processor
iRequestQueue = CThumbnailRequestQueue::NewL();
+
+ TN_DEBUG1( "CThumbnailManagerImpl::ConstructL - end");
}
@@ -154,7 +167,7 @@
TInt priority = ValidatePriority(aPriority);
CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue );
+ ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
CleanupStack::PushL( getThumbnailActive );
if(aObjectSource.Id() > 0)
@@ -215,7 +228,7 @@
TInt priority = ValidatePriority(aPriority);
CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue );
+ ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
CleanupStack::PushL( getThumbnailActive );
getThumbnailActive->GetThumbnailL( KNullDesC, aThumbnailId, iFlags,
@@ -249,7 +262,7 @@
TInt priority = ValidatePriority(aPriority);
CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue );
+ ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
CleanupStack::PushL( getThumbnailActive );
if ( aObjectSource.Uri().Length())
@@ -290,16 +303,33 @@
TInt priority = ValidatePriority(aPriority);
CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue );
+ ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
CleanupStack::PushL( getThumbnailActive );
- if ( aObjectSource.Uri().Length() &&
- aObjectSource.Buffer() != NULL &&
- aObjectSource.MimeType() != KNullDesC8)
+ if (aObjectSource.Uri().Length() &&
+ aObjectSource.TargetUri().Length())
+ {
+ // from path
+ getThumbnailActive->SetThumbnailL( aObjectSource.Uri(),
+ aObjectSource.MimeType(), iFlags, iQualityPreference, iSize, iDisplayMode,
+ priority, aClientData, ETrue, aObjectSource.TargetUri(), iThumbnailSize, ETrue);
+ }
+ else if (aObjectSource.Uri().Length() &&
+ aObjectSource.Bitmap() != NULL)
{
+ // from bitmap
+ getThumbnailActive->SetThumbnailL( aObjectSource.GetBitmapOwnership(),
+ aObjectSource.Id(), KBmpMime, iFlags, iQualityPreference, iSize, iDisplayMode,
+ priority, aClientData, ETrue, aObjectSource.Uri(), iThumbnailSize, ETrue);
+ }
+ else if (aObjectSource.Uri().Length() &&
+ aObjectSource.Buffer() != NULL &&
+ aObjectSource.MimeType() != KNullDesC8)
+ {
+ // from buffer
getThumbnailActive->SetThumbnailL( aObjectSource.GetBufferOwnership(), aObjectSource.Id(),
aObjectSource.MimeType(), iFlags, iQualityPreference, iSize, iDisplayMode,
- priority, aClientData, EFalse, aObjectSource.Uri(), iThumbnailSize);
+ priority, aClientData, ETrue, aObjectSource.Uri(), iThumbnailSize, ETrue);
}
iRequestQueue->AddRequestL( getThumbnailActive );
@@ -329,7 +359,7 @@
TInt priority = ValidatePriority(aPriority);
CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue );
+ ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
CleanupStack::PushL( getThumbnailActive );
@@ -339,7 +369,7 @@
getThumbnailActive->SetThumbnailL( aObjectSource.GetBitmapOwnership(),
aObjectSource.Id(), KBmpMime, iFlags, iQualityPreference,
iSize, iDisplayMode, priority, NULL, ETrue,
- aObjectSource.Uri(), EUnknownThumbnailSize);
+ aObjectSource.Uri(), EUnknownThumbnailSize, EFalse);
}
else if( !aObjectSource.Buffer() )
{
@@ -354,7 +384,7 @@
getThumbnailActive->SetThumbnailL( aObjectSource.GetBufferOwnership(),
aObjectSource.Id(), aObjectSource.MimeType(), iFlags,
iQualityPreference, iSize, iDisplayMode, priority, NULL,
- ETrue, aObjectSource.Uri(), EUnknownThumbnailSize);
+ ETrue, aObjectSource.Uri(), EUnknownThumbnailSize, EFalse);
}
iRequestQueue->AddRequestL( getThumbnailActive );
@@ -491,7 +521,8 @@
__ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId ));
CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestId, CActive::EPriorityIdle, iRequestQueue );
+ ( iFs, iSession, iObserver, iRequestObserver, iRequestId, CActive::EPriorityIdle,
+ iRequestQueue );
CleanupStack::PushL( getThumbnailActive );
@@ -533,7 +564,8 @@
__ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId ));
CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestId, CActive::EPriorityIdle, iRequestQueue );
+ ( iFs, iSession, iObserver, iRequestObserver, iRequestId, CActive::EPriorityIdle,
+ iRequestQueue );
CleanupStack::PushL( getThumbnailActive );
@@ -620,7 +652,7 @@
TInt priority = ValidatePriority(aPriority);
CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue );
+ ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
CleanupStack::PushL( getThumbnailActive );
getThumbnailActive->UpdateThumbnailsL( aPath, aItemId, iFlags, iQualityPreference,
@@ -648,7 +680,7 @@
TInt priority = ValidatePriority(aPriority);
CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue );
+ ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
CleanupStack::PushL( getThumbnailActive );
getThumbnailActive->RenameThumbnails( aCurrentPath, aNewPath, priority );
@@ -661,6 +693,32 @@
return iRequestId;
}
+
+// ---------------------------------------------------------------------------
+// CThumbnailManagerImpl::SetRequestObserver()
+// Adds optional request observer
+// ---------------------------------------------------------------------------
+//
+void CThumbnailManagerImpl::SetRequestObserver( MThumbnailManagerRequestObserver& aObserver )
+ {
+ iRequestObserver = NULL;
+ iRequestObserver = &aObserver;
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbnailManagerImpl::RemoveRequestObserver()
+// Removes optional request observer
+// ---------------------------------------------------------------------------
+//
+void CThumbnailManagerImpl::RemoveRequestObserver()
+ {
+ if (iRequestObserver)
+ {
+ iRequestObserver = NULL;
+ }
+ }
+
+
// ---------------------------------------------------------------------------
// CThumbnailManagerImpl::ValidatePriority()
// Check that given priority is in range of CActive::TPriority
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailobjectsource.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailobjectsource.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -24,6 +24,7 @@
// ---------------------------------------------------------------------------
// CThumbnailObjectSource::NewL()
+// CThumbnailObjectSource::NewLC()
// Two-phased constructor.
// ---------------------------------------------------------------------------
//
@@ -36,12 +37,6 @@
return self;
}
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSource::NewLC()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( const TDesC&
aUri, const TDesC& aMimeType )
{
@@ -51,11 +46,6 @@
return self;
}
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSource::NewL()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( const RFile64&
aFile, const TDesC& aMimeType )
{
@@ -65,12 +55,6 @@
return self;
}
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSource::NewLC()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( const RFile64&
aFile, const TDesC& aMimeType )
{
@@ -80,15 +64,16 @@
return self;
}
-
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( CFbsBitmap* aBitmap, const TDesC& aUri )
+EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( CFbsBitmap* aBitmap,
+ const TDesC& aUri )
{
CThumbnailObjectSource* self = CThumbnailObjectSource::NewLC( aBitmap, aUri );
CleanupStack::Pop( self );
return self;
}
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( CFbsBitmap* aBitmap, const TDesC& aUri )
+EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( CFbsBitmap* aBitmap,
+ const TDesC& aUri )
{
CThumbnailObjectSource* self = new( ELeave )CThumbnailObjectSource();
CleanupStack::PushL( self );
@@ -96,21 +81,60 @@
return self;
}
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( TDesC8* aBuffer, TDesC& aMimeType, const TDesC& aUri)
+EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( TDesC8* aBuffer,
+ TDesC& aMimeType, const TDesC& aUri)
{
- CThumbnailObjectSource* self = CThumbnailObjectSource::NewLC( aBuffer, aMimeType, aUri );
+ CThumbnailObjectSource* self = CThumbnailObjectSource::NewLC( aBuffer,
+ aMimeType, aUri );
CleanupStack::Pop( self );
return self;
}
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( TDesC8* aBuffer, TDesC& aMimeType, const TDesC& aUri)
+EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( TDesC8* aBuffer,
+ TDesC& aMimeType, const TDesC& aUri)
{
CThumbnailObjectSource* self = new( ELeave )CThumbnailObjectSource();
CleanupStack::PushL( self );
self->ConstructL( aBuffer, aMimeType, aUri );
return self;
}
-
+
+EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( const TDesC&
+ aUri, const TThumbnailId aThumbnailId, const TDesC& aMimeType )
+ {
+ CThumbnailObjectSource* self = CThumbnailObjectSource::NewLC( aUri,
+ aThumbnailId, aMimeType );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( const TDesC& aUri,
+ const TThumbnailId aThumbnailId, const TDesC& aMimeType )
+ {
+ CThumbnailObjectSource* self = new( ELeave )CThumbnailObjectSource();
+ CleanupStack::PushL( self );
+ self->ConstructL( aUri, aMimeType, aThumbnailId );
+ return self;
+ }
+
+EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( const TDesC& aUri,
+ const TDesC& aTargetUri, const TDesC& aMimeType )
+ {
+ CThumbnailObjectSource* self = CThumbnailObjectSource::NewLC( aUri, aTargetUri,
+ aMimeType );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( const TDesC& aUri,
+ const TDesC& aTargetUri, const TDesC& aMimeType )
+ {
+ CThumbnailObjectSource* self = new( ELeave )CThumbnailObjectSource();
+ CleanupStack::PushL( self );
+ self->ConstructL( aUri, aTargetUri, aMimeType );
+ return self;
+ }
+
// ---------------------------------------------------------------------------
// CThumbnailObjectSource::CThumbnailObjectSource()
@@ -134,14 +158,11 @@
iUri = aUri.AllocL();
iMimeType = HBufC8::NewL( aMimeType.Length() );
iMimeType->Des().Copy( aMimeType );
+ iThumbnailId = 0;
+ iBitmap = NULL;
+ iTargetUri = NULL;
}
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSource::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// ---------------------------------------------------------------------------
-//
void CThumbnailObjectSource::ConstructL( const RFile64& aFile, const TDesC&
aMimeType )
{
@@ -149,26 +170,19 @@
iMimeType = HBufC8::NewL( aMimeType.Length() );
iMimeType->Des().Copy( aMimeType );
iThumbnailId = 0;
+ iBitmap = NULL;
+ iTargetUri = NULL;
}
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSource::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailObjectSource::ConstructL( CFbsBitmap* aBitmap, const TDesC&
- aUri )
+void CThumbnailObjectSource::ConstructL( CFbsBitmap* aBitmap, const TDesC&
+ aUri )
{
iBitmap = aBitmap;
iUri = aUri.AllocL();
iThumbnailId = 0;
+ iTargetUri = NULL;
}
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSource::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// ---------------------------------------------------------------------------
-//
void CThumbnailObjectSource::ConstructL( TDesC8* aBuffer, const TDesC&
aMimeType, const TDesC& aUri )
{
@@ -177,13 +191,10 @@
iMimeType->Des().Copy( aMimeType );
iUri = aUri.AllocL();
iThumbnailId = 0;
+ iBitmap = NULL;
+ iTargetUri = NULL;
}
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSource::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// ---------------------------------------------------------------------------
-//
void CThumbnailObjectSource::ConstructL( const TDesC& aUri, const TDesC&
aMimeType, TThumbnailId aThumbnailId )
{
@@ -191,6 +202,18 @@
iMimeType = HBufC8::NewL( aMimeType.Length() );
iMimeType->Des().Copy( aMimeType );
iThumbnailId = aThumbnailId;
+ iTargetUri = NULL;
+ }
+
+void CThumbnailObjectSource::ConstructL( const TDesC& aUri, const TDesC&
+ aTargetUri, const TDesC& aMimeType )
+ {
+ iUri = aUri.AllocL();
+ iTargetUri = aTargetUri.AllocL();
+ iMimeType = HBufC8::NewL( aMimeType.Length() );
+ iMimeType->Des().Copy( aMimeType );
+ iThumbnailId = 0;
+ iBitmap = NULL;
}
@@ -202,9 +225,13 @@
CThumbnailObjectSource::~CThumbnailObjectSource()
{
delete iUri;
+ iUri = NULL;
delete iMimeType;
+ iMimeType = NULL;
delete iBuffer;
+ iBuffer = NULL;
delete iBitmap;
+ iBitmap = NULL;
}
@@ -212,12 +239,11 @@
// CThumbnailObjectSourceImpl::FileHandle()
// ---------------------------------------------------------------------------
//
-EXPORT_C RFile64& CThumbnailObjectSource::FileHandle()
+EXPORT_C RFile64& CThumbnailObjectSource::FileHandle()
{
return iFile;
}
-
// ---------------------------------------------------------------------------
// CThumbnailObjectSourceImpl::Uri()
// ---------------------------------------------------------------------------
@@ -264,35 +290,15 @@
return KNullDesC8;
}
+// ---------------------------------------------------------------------------
+// CThumbnailObjectSourceImpl::Id()
+// ---------------------------------------------------------------------------
+//
EXPORT_C TThumbnailId CThumbnailObjectSource::Id()
{
return iThumbnailId;
}
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( const TDesC&
-aUri, const TThumbnailId aThumbnailId, const TDesC& aMimeType )
-{
-CThumbnailObjectSource* self = CThumbnailObjectSource::NewLC( aUri,
- aThumbnailId, aMimeType );
-CleanupStack::Pop( self );
-return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSource::NewLC()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( const TDesC& aUri,
- const TThumbnailId aThumbnailId, const TDesC& aMimeType )
- {
- CThumbnailObjectSource* self = new( ELeave )CThumbnailObjectSource();
- CleanupStack::PushL( self );
- self->ConstructL( aUri, aMimeType, aThumbnailId );
- return self;
- }
-
// ---------------------------------------------------------------------------
// CThumbnailObjectSourceImpl::Bitmap()
// ---------------------------------------------------------------------------
@@ -313,4 +319,18 @@
return temp;
}
+// ---------------------------------------------------------------------------
+// CThumbnailObjectSourceImpl::TargetUri()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CThumbnailObjectSource::TargetUri()
+ {
+ if ( iTargetUri )
+ {
+ return * iTargetUri;
+ }
+ return KNullDesC;
+ }
+
+
// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -48,11 +48,15 @@
iTimer->Cancel();
}
delete iTimer;
+ iTimer = NULL;
ReleaseServerBitmap();
delete iCallbackThumbnail;
+ iCallbackThumbnail = NULL;
delete iParams.iBuffer;
+ iParams.iBuffer = NULL;
delete iBitmap;
+ iBitmap = NULL;
iFile.Close();
iMyFileHandle.Close();
}
@@ -65,10 +69,11 @@
//
CThumbnailRequestActive* CThumbnailRequestActive::NewL( RFs& aFs,
RThumbnailSession& aThumbnailSession, MThumbnailManagerObserver& aObserver,
+ MThumbnailManagerRequestObserver* aRequestObserver,
TThumbnailRequestId aId, TInt aPriority, CThumbnailRequestQueue* aQueue )
{
CThumbnailRequestActive* self = new( ELeave )CThumbnailRequestActive( aFs,
- aThumbnailSession, aObserver, aId, aPriority, aQueue );
+ aThumbnailSession, aObserver, aRequestObserver, aId, aPriority, aQueue );
CleanupStack::PushL( self );
self->ConstructL();
CleanupStack::Pop( self );
@@ -83,10 +88,14 @@
//
CThumbnailRequestActive::CThumbnailRequestActive( RFs& aFs, RThumbnailSession&
aThumbnailSession, MThumbnailManagerObserver& aObserver,
+ MThumbnailManagerRequestObserver* aRequestObserver,
TThumbnailRequestId aId, TInt aPriority, CThumbnailRequestQueue* aQueue ):
CActive( aPriority ), iSession( aThumbnailSession ), iParamsPckg( iParams ),
- iObserver( aObserver ), iFs( aFs ), iBitmapHandle( 0 ), iRequestId( aId ),
- iRequestQueue( aQueue ), iCanceled( EFalse )
+ iObserver( aObserver ), iRequestObserver( aRequestObserver ), iFs( aFs ), iBitmapHandle( 0 ),
+ iRequestId( aId ), iRequestQueue( aQueue ), iCanceled( EFalse )
+#ifdef __RETRY_ON_SERVERCRASH
+ ,iRetry(0)
+#endif
{
CActiveScheduler::Add( this );
TN_DEBUG2( "CThumbnaiRequestActive::CThumbnailRequestActive() AO's priority = %d", Priority());
@@ -151,9 +160,17 @@
iFile.Close();
User::LeaveIfError( iFile.Open( iFs, iPath, EFileShareReadersOrWriters ) );
- TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iTargetUri );
+ TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iPath );
CleanupClosePushL( iFile );
+
+ if ( iParams.iQualityPreference == CThumbnailManager::EOptimizeForQualityWithPreview )
+ {
+ // We may need the file handle later for the 2nd phase thumbnail
+ iMyFileHandle.Close();
+ User::LeaveIfError( iMyFileHandle.Duplicate( iFile ));
+ }
+
iSession.RequestThumbnailL( iFile, iPath, iParamsPckg, iStatus );
CleanupStack::PopAndDestroy( &iFile );
}
@@ -188,6 +205,14 @@
TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iTargetUri );
CleanupClosePushL( iFile );
+
+ if ( iParams.iQualityPreference == CThumbnailManager::EOptimizeForQualityWithPreview )
+ {
+ // We may need the file handle later for the 2nd phase thumbnail
+ iMyFileHandle.Close();
+ User::LeaveIfError( iMyFileHandle.Duplicate( iFile ));
+ }
+
iSession.RequestThumbnailL( iFile, iTargetUri, iParamsPckg, iStatus );
CleanupStack::PopAndDestroy( &iFile );
break;
@@ -211,6 +236,29 @@
iSession.RenameThumbnails( iParamsPckg, iStatus );
break;
}
+ case EReqSetThumbnailPath:
+ {
+ // open file handle
+ iFile.Close();
+ User::LeaveIfError( iFile.Open( iFs, iParams.iFileName, EFileShareReadersOrWriters ) );
+
+ TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iParams.iFileName );
+
+ CleanupClosePushL( iFile );
+
+ if ( iParams.iQualityPreference == CThumbnailManager::EOptimizeForQualityWithPreview )
+ {
+ // We may need the file handle later for the 2nd phase thumbnail
+ iMyFileHandle.Close();
+ User::LeaveIfError( iMyFileHandle.Duplicate( iFile ));
+ }
+
+ iSession.RequestThumbnailL( iFile, iTargetUri, iParamsPckg, iStatus );
+ CleanupStack::PopAndDestroy( &iFile );
+
+ break;
+ }
+
default:
{
break;
@@ -244,10 +292,38 @@
iTimer->Cancel();
- if (iRequestType == EReqDeleteThumbnails || iCanceled ||
- iRequestType == EReqRenameThumbnails)
+ if (iRequestType == EReqDeleteThumbnails)
{
- TN_DEBUG1( "CThumbnailRequestActive::RunL() - rename/delete/canceled" );
+ TN_DEBUG1( "CThumbnailRequestActive::RunL() - delete" );
+
+ if (iRequestObserver)
+ {
+ iRequestObserver->ThumbnailRequestReady(iStatus.Int(), ERequestDeleteThumbnails ,iParams.iRequestId);
+ }
+
+ iFile.Close();
+ iMyFileHandle.Close();
+
+ // no action for delete/rename or canceled request
+ iRequestQueue->RequestComplete(this);
+
+#ifdef _DEBUG
+ TTime stop;
+ stop.UniversalTime();
+ TN_DEBUG3( "CThumbnailRequestActive::RunL() total execution time of req %d is %d ms",
+ iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 );
+#endif
+ }
+ else if (iCanceled || iRequestType == EReqRenameThumbnails)
+ {
+ if (iCanceled)
+ {
+ TN_DEBUG1( "CThumbnailRequestActive::RunL() - canceled" );
+ }
+ else if (iRequestType == EReqRenameThumbnails)
+ {
+ TN_DEBUG1( "CThumbnailRequestActive::RunL() - rename" );
+ }
iFile.Close();
iMyFileHandle.Close();
@@ -287,7 +363,7 @@
TCallBack(TimerCallBack, this));
SetActive();
}
- else if ( iStatus.Int())
+ else if ( iStatus.Int() )
{
TN_DEBUG2( "CThumbnailRequestActive::RunL() - error (%d) occured", iStatus.Int() );
// An error occurred
@@ -527,17 +603,41 @@
TN_DEBUG1( "CThumbnailRequestActive::HandleError() - session reconnected");
}
}
- iCallbackThumbnail->Set( NULL, iClientData );
+
+ if (iRequestObserver && iRequestType == EReqDeleteThumbnails)
+ {
+ TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - iRequestObserver->ThumbnailRequestReady %d", iParams.iRequestId );
+ iRequestObserver->ThumbnailRequestReady(iError, ERequestDeleteThumbnails ,iParams.iRequestId);
+ }
+ else
+ {
+ iCallbackThumbnail->Set( NULL, iClientData );
- // don't leak internal TNM codes
- if (iError == KThumbnailErrThumbnailNotFound)
- {
- iError = KErrNotFound;
+ // don't leak internal TNM codes
+ if (iError == KThumbnailErrThumbnailNotFound)
+ {
+ iError = KErrNotFound;
+ }
+
+#ifdef __RETRY_ON_SERVERCRASH
+ if(iError == KErrServerTerminated )
+ {
+
+ if(iRetry < KMaxRequestRetryCount )
+ {
+ iRetry++;
+ TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - KErrServerTerminated, retry %d", iRetry);
+ iError = KErrNone;
+ TRAPD(err, StartL());
+ return;
+ }
+ }
+#endif
+ TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - iObserver.ThumbnailReady %d", iParams.iRequestId );
+ iObserver.ThumbnailReady( iError, *iCallbackThumbnail, iParams.iRequestId );
+
}
- TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - iObserver.ThumbnailReady %d", iParams.iRequestId );
- iObserver.ThumbnailReady( iError, *iCallbackThumbnail, iParams.iRequestId );
-
iError = KErrNone;
}
@@ -589,10 +689,21 @@
iParams.iQualityPreference = aQualityPreference;
iParams.iThumbnailSize = aThumbnailSize;
iParams.iThumbnailId = aThumbnailId;
+ iParams.iOverwrite = EFalse;
+ iParams.iImport = EFalse;
User::LeaveIfError( iFile.Duplicate( aFile ));
iTargetUri = aTargetUri;
+
+ if (iParams.iFileName.Length() && IsVirtualUri(iParams.iFileName))
+ {
+ iParams.iVirtualUri = ETrue;
+ }
+ else
+ {
+ iParams.iVirtualUri = EFalse;
+ }
}
@@ -624,8 +735,19 @@
iParams.iQualityPreference = aQualityPreference;
iParams.iThumbnailSize = aThumbnailSize;
iParams.iThumbnailId = aThumbnailId;
+ iParams.iOverwrite = EFalse;
+ iParams.iImport = EFalse;
iTargetUri = aTargetUri;
+
+ if (iPath.Length() && IsVirtualUri(iPath))
+ {
+ iParams.iVirtualUri = ETrue;
+ }
+ else
+ {
+ iParams.iVirtualUri = EFalse;
+ }
}
@@ -657,9 +779,20 @@
iParams.iThumbnailSize = aThumbnailSize;
iParams.iThumbnailId = aThumbnailId;
iParams.iFileName = aPath;
+ iParams.iOverwrite = EFalse;
+ iParams.iImport = EFalse;
iPath = aPath;
iTargetUri = aTargetUri;
+
+ if (iPath.Length() && IsVirtualUri(iPath))
+ {
+ iParams.iVirtualUri = ETrue;
+ }
+ else
+ {
+ iParams.iVirtualUri = EFalse;
+ }
}
// ---------------------------------------------------------------------------
@@ -671,7 +804,8 @@
const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags,
CThumbnailManager::TThumbnailQualityPreference aQualityPreference, const TSize& aSize,
const TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData,
- TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri, TThumbnailSize aThumbnailSize )
+ TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri, TThumbnailSize aThumbnailSize,
+ TBool aOverwrite)
{
iRequestType = EReqSetThumbnailBuffer;
@@ -691,8 +825,19 @@
iParams.iFlags = aFlags;
iParams.iQualityPreference = aQualityPreference;
iParams.iThumbnailId = aThumbnailId;
+ iParams.iOverwrite = aOverwrite;
+ iParams.iImport = EFalse;
iTargetUri = aTargetUri;
+
+ if (iTargetUri.Length() && IsVirtualUri(iTargetUri))
+ {
+ iParams.iVirtualUri = ETrue;
+ }
+ else
+ {
+ iParams.iVirtualUri = EFalse;
+ }
}
// ---------------------------------------------------------------------------
@@ -704,7 +849,8 @@
const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags,
CThumbnailManager::TThumbnailQualityPreference aQualityPreference, const TSize& aSize,
const TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData,
- TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri, TThumbnailSize aThumbnailSize )
+ TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri, TThumbnailSize aThumbnailSize,
+ TBool aOverwrite)
{
iClientData = aClientData;
iParams.iControlFlags = (aGeneratePersistentSizesOnly ?
@@ -721,9 +867,20 @@
iParams.iQualityPreference = aQualityPreference;
iParams.iThumbnailId = aThumbnailId;
iParams.iFileName = aTargetUri;
+ iParams.iOverwrite = aOverwrite;
+ iParams.iImport = EFalse;
iTargetUri = aTargetUri;
+ if (iTargetUri.Length() && IsVirtualUri(iTargetUri))
+ {
+ iParams.iVirtualUri = ETrue;
+ }
+ else
+ {
+ iParams.iVirtualUri = EFalse;
+ }
+
TInt memoryFree( 0 );
HAL::Get( HALData::EMemoryRAMFree, memoryFree );
@@ -736,7 +893,7 @@
iParams.iMimeType = TDataType( aMimeType );
iRequestType = EReqSetThumbnailBitmap;
}
- else
+ else if (!iParams.iVirtualUri)
{
// memory low, create thumbs using filehandle
TN_DEBUG1( "CThumbnaiRequestActive::SetThumbnailbyBitmap() - memory low, create thumbs using filehandle!" );
@@ -745,6 +902,10 @@
iParams.iPriority = aPriority - 1;
iRequestType = EReqGetThumbnailHandleLater;
}
+ else
+ {
+ User::Leave(KErrNoMemory);
+ }
}
// ---------------------------------------------------------------------------
@@ -769,6 +930,9 @@
iParams.iFlags = aFlags;
iParams.iQualityPreference = aQualityPreference;
iParams.iThumbnailId = aThumbnailId;
+ iParams.iOverwrite = EFalse;
+ iParams.iVirtualUri = EFalse;
+ iParams.iImport = EFalse;
iPath = aPath;
iOrientation = aOrientation;
@@ -809,6 +973,51 @@
}
// ---------------------------------------------------------------------------
+// CThumbnailRequestActive::SetThumbnailL()
+// Set thumbnail from file path.
+// ---------------------------------------------------------------------------
+//
+void CThumbnailRequestActive::SetThumbnailL( const TDesC& aPath, const TDesC8& aMimeType,
+ CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager
+ ::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const
+ TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData,
+ TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri,
+ TThumbnailSize aThumbnailSize, TBool aOverwrite)
+ {
+ iRequestType = EReqSetThumbnailPath;
+
+ iClientData = aClientData;
+ iParams.iControlFlags = (aGeneratePersistentSizesOnly ?
+ EThumbnailGeneratePersistentSizesOnly :
+ EThumbnailNoControlFlags);
+ iParams.iOriginalControlFlags = iParams.iControlFlags;
+ iParams.iMimeType = TDataType( aMimeType );
+ iParams.iBitmapHandle = 0;
+ iParams.iSize = aSize;
+ iParams.iDisplayMode = aDisplayMode;
+ iParams.iFileName = aPath;
+ iParams.iRequestId = iRequestId;
+ iParams.iPriority = aPriority;
+ iParams.iFlags = aFlags;
+ iParams.iQualityPreference = aQualityPreference;
+ iParams.iThumbnailSize = aThumbnailSize;
+ iParams.iOverwrite = aOverwrite;
+
+ iTargetUri = aTargetUri;
+
+ if (iTargetUri.Length() && IsVirtualUri(iTargetUri))
+ {
+ iParams.iVirtualUri = ETrue;
+ }
+ else
+ {
+ iParams.iVirtualUri = EFalse;
+ }
+
+ iParams.iImport = ETrue;
+ }
+
+// ---------------------------------------------------------------------------
// Request 2nd phase thumbnail
// ---------------------------------------------------------------------------
//
@@ -901,4 +1110,26 @@
return KErrNone;
}
+// ---------------------------------------------------------------------------
+// CThumbnailRequestActive::IsVirtualUri()
+// Checks if URI is virtual.
+// ---------------------------------------------------------------------------
+//
+TBool CThumbnailRequestActive::IsVirtualUri( const TDesC& aPath )
+ {
+ TInt pos = aPath.Find(KBackSlash);
+
+ // normal URI
+ if ( pos == 2 )
+ {
+ return EFalse;
+ }
+ // virtual URI
+ else
+ {
+ TN_DEBUG1( "CThumbnailRequestActive::IsVirtualUri() - yes");
+ return ETrue;
+ }
+ }
+
// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestqueue.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestqueue.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -166,6 +166,11 @@
iRequests.Remove( i );
}
}
+
+ if(!iRequests.Count())
+ {
+ iRequests.Compress();
+ }
TN_DEBUG3( "CThumbnailRequestQueue::RemoveCompleted() end - requests: %d, active requests: %d",
iRequests.Count(), iActiveRequests );
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailsession.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailsession.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -31,6 +31,7 @@
RThumbnailSession::RThumbnailSession(): RSessionBase()
{
// No implementation required
+ TN_DEBUG1( "RThumbnailSession::RThumbnailSession");
}
@@ -40,6 +41,8 @@
//
TInt RThumbnailSession::Connect()
{
+ TN_DEBUG1( "RThumbnailSession::Connect - start");
+
StartServer();
// special case
@@ -54,12 +57,16 @@
// old server still alive, wait and try again
while (retry <= 10 && err != KErrNone)
{
+ TN_DEBUG1( "RThumbnailSession::Connect - retry");
+
User::After(retry * 50000);
StartServer();
err = CreateSession( KThumbnailServerName, Version(), KMessageSlots );
retry++;
}
+ TN_DEBUG1( "RThumbnailSession::Connect - end");
+
return err;
}
@@ -71,6 +78,8 @@
//
void RThumbnailSession::Close()
{
+ TN_DEBUG1( "RThumbnailSession::Close");
+
RSessionBase::Close();
}
@@ -94,23 +103,29 @@
//
TInt RThumbnailSession::StartServer()
{
+ TN_DEBUG1( "RThumbnailSession::StartServer - start");
+
TInt res( KErrNone );
// create server - if one of this name does not already exist
TFindServer findServer( KThumbnailServerName );
TFullName name;
if ( findServer.Next( name ) != KErrNone )
- // we don't exist already
+ // we don't exist already
{
+ TN_DEBUG1( "RThumbnailSession::StartServer - server process doesn't exist yet");
+
RProcess server;
// Create the server process
// KNullDesC param causes server's E32Main() to be run
res = server.Create( KThumbnailServerExe, KNullDesC );
if ( res != KErrNone )
- // thread created ok - now start it going
{
+ TN_DEBUG2( "RThumbnailSession::StartServer - error creating process: %d", res);
return res;
}
+
+ TN_DEBUG1( "RThumbnailSession::StartServer - process created");
// Process created successfully
TRequestStatus status;
@@ -122,13 +137,18 @@
if ( status != KErrNone )
{
+ TN_DEBUG2( "RThumbnailSession::StartServer - status: %d, closing", status.Int() );
+
server.Close();
return status.Int();
}
+
// Server created successfully
server.Close(); // we're no longer interested in the other process
-
}
+
+ TN_DEBUG1( "RThumbnailSession::StartServer - end");
+
return res;
}
--- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/bwins/thumbnailmanagerqt.def Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/bwins/thumbnailmanagerqt.def Thu Jul 22 16:37:07 2010 +0100
@@ -16,4 +16,7 @@
?getThumbnail@ThumbnailManager@@QAEHKPAXH@Z @ 15 NONAME ; int ThumbnailManager::getThumbnail(unsigned long, void *, int)
?mode@ThumbnailManager@@QBE?AW4ThumbnailMode@1@XZ @ 16 NONAME ; enum ThumbnailManager::ThumbnailMode ThumbnailManager::mode(void) const
?setThumbnail@ThumbnailManager@@QAEHABVQImage@@ABVQString@@PAXH@Z @ 17 NONAME ; int ThumbnailManager::setThumbnail(class QImage const &, class QString const &, void *, int)
+ ?thumbnailReady@ThumbnailManager@@IAEXVQImage@@PAXHH@Z @ 18 NONAME ; void ThumbnailManager::thumbnailReady(class QImage, void *, int, int)
+ ?thumbnailReady@ThumbnailManager@@IAEXVQPixmap@@PAXHH@Z @ 19 NONAME ; void ThumbnailManager::thumbnailReady(class QPixmap, void *, int, int)
+ ?setThumbnail@ThumbnailManager@@QAEHABVQString@@00PAXH@Z @ 20 NONAME ; int ThumbnailManager::setThumbnail(class QString const &, class QString const &, class QString const &, void *, int)
--- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/eabi/thumbnailmanagerqt.def Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/eabi/thumbnailmanagerqt.def Thu Jul 22 16:37:07 2010 +0100
@@ -19,4 +19,7 @@
_ZNK16ThumbnailManager17qualityPreferenceEv @ 18 NONAME
_ZNK16ThumbnailManager4modeEv @ 19 NONAME
_ZN16ThumbnailManager12setThumbnailERK6QImageRK7QStringPvi @ 20 NONAME
+ _ZN16ThumbnailManager14thumbnailReadyE6QImagePvii @ 21 NONAME
+ _ZN16ThumbnailManager14thumbnailReadyE7QPixmapPvii @ 22 NONAME
+ _ZN16ThumbnailManager12setThumbnailERK7QStringS2_S2_Pvi @ 23 NONAME
--- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/inc/thumbnailmanager_p_qt.h Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/inc/thumbnailmanager_p_qt.h Thu Jul 22 16:37:07 2010 +0100
@@ -116,7 +116,14 @@
* thumbnailReady() signal will be emited when the operation is complete.
*/
int setThumbnail( const QImage& source, const QString& fileName,
- void * clientData, int priority );
+ void * clientData, int priority );
+
+ /**
+ * Set a thumbnail for an object file generated from source file.
+ * thumbnailReady() signal will be emited when the operation is complete.
+ */
+ int setThumbnail( const QString& sourceFileName, const QString& targetFileName,
+ const QString& mimeType, void * clientData, int priority );
/**
* Delete all thumbnails for a given object. This is an asynchronous
@@ -192,16 +199,6 @@
private:
/**
- * Copy CFbsBitmap into a QImage.
- */
- QImage fromBitmap( CFbsBitmap* bitmap );
-
- /**
- * Copy CFbsBitmap into a QPixmap.
- */
- QPixmap fromImage( CFbsBitmap* bitmap );
-
- /**
* Limit priority to presumed range.
*/
int convertPriority(int basePriority);
@@ -214,11 +211,14 @@
int connectionCounterPixmap;
private:
+
+ ThumbnailManager *q_ptr;
CThumbnailManager* iThumbnailManager;
QByteArray* byteArray;
-
+
+ friend class ThumbnailManager;
friend class TestThumbnailManager;
};
--- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_p_qt.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_p_qt.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -29,9 +29,11 @@
const int ThumbnailMangerPriorityLowest = CActive::EPriorityIdle;
const int ThumbnailMangerPriorityHighest = CActive::EPriorityHigh;
-ThumbnailManagerPrivate::ThumbnailManagerPrivate() : iThumbnailManager( NULL ), byteArray( NULL ),
+ThumbnailManagerPrivate::ThumbnailManagerPrivate() :
connectionCounterImage( 0 ),
- connectionCounterPixmap( 0 )
+ connectionCounterPixmap( 0 ),
+ iThumbnailManager( NULL ),
+ byteArray( NULL )
{
TRAP_IGNORE(
iThumbnailManager = CThumbnailManager::NewL( *this );
@@ -121,6 +123,7 @@
CleanupClosePushL( buf );
buf.CreateL( symbFileName.length() );
buf.Copy( symbFileName.utf16(), symbFileName.length() );
+
CThumbnailObjectSource* objSrc = CThumbnailObjectSource::NewLC( buf, KNullDesC );
result = iThumbnailManager->GetThumbnailL( *objSrc, clientData, priority );
CleanupStack::PopAndDestroy( 2, &buf );
@@ -214,6 +217,53 @@
return result;
}
+int ThumbnailManagerPrivate::setThumbnail( const QString& sourceFileName, const QString& targetFileName,
+ const QString& mimeType, void * clientData, int priority )
+{
+ int result( -1 );
+ QString symbSourceFile( sourceFileName );
+ QString symbTargetFile( targetFileName );
+ RBuf sourceFile;
+ RBuf targetFile;
+ RBuf mime;
+
+ priority = convertPriority(priority);
+
+ if( symbSourceFile.contains( "/" ) )
+ symbSourceFile.replace( "/", "\\", Qt::CaseSensitive );
+
+ if( symbTargetFile.contains( "/" ) )
+ symbTargetFile.replace( "/", "\\", Qt::CaseSensitive );
+
+ TRAP_IGNORE(
+ CleanupClosePushL( sourceFile );
+ sourceFile.CreateL( symbSourceFile.length() );
+ sourceFile.Copy( symbSourceFile.utf16(), symbSourceFile.length() );
+
+ CleanupClosePushL( targetFile );
+ targetFile.CreateL( symbTargetFile.length() );
+ targetFile.Copy( symbTargetFile.utf16(), symbTargetFile.length() );
+
+ CleanupClosePushL( mime );
+
+ if (mimeType.length())
+ {
+ mime.CreateL( mimeType.length() );
+ mime.Copy( mimeType.utf16(), mimeType.length() );
+ }
+ else
+ {
+ mime.Assign(KNullDesC().AllocL());
+ }
+
+ CThumbnailObjectSource* objSrc = CThumbnailObjectSource::NewLC( sourceFile, targetFile, mime );
+ result = iThumbnailManager->SetThumbnailL( *objSrc, clientData, priority );
+ CleanupStack::PopAndDestroy( 4, &sourceFile );
+ );
+
+ return result;
+}
+
void ThumbnailManagerPrivate::deleteThumbnails( const QString& fileName )
{
QString symbFileName( fileName );
@@ -249,20 +299,6 @@
return ( iThumbnailManager->ChangePriority( id, newPriority ) == KErrNone );
}
-QImage ThumbnailManagerPrivate::fromBitmap( CFbsBitmap* bitmap )
-{
- TSize size = bitmap->SizeInPixels();
- int bytesPerLine = bitmap->ScanLineLength( size.iWidth, bitmap->DisplayMode() );
- const uchar* dataPtr = ( const uchar* ) bitmap->DataAddress();
- QImage image = QImage(dataPtr, size.iWidth, size.iHeight, bytesPerLine, QImage::Format_RGB16);
- return image.copy();
-}
-
-QPixmap ThumbnailManagerPrivate::fromImage( CFbsBitmap* bitmap )
-{
- return QPixmap::fromImage(fromBitmap(bitmap));
-}
-
int ThumbnailManagerPrivate::convertPriority(int basePriority)
{
return qBound(ThumbnailMangerPriorityLowest, basePriority, ThumbnailMangerPriorityHighest);
@@ -282,21 +318,20 @@
}
if (connectionCounterImage || connectionCounterPixmap) {
- QImage image;
+ QPixmap pixmap;
if (aError == KErrNone) {
- image = fromBitmap(aThumbnail.Bitmap());
+ pixmap = QPixmap::fromSymbianCFbsBitmap(aThumbnail.Bitmap());
} else {
- image = QImage();
+ pixmap = QPixmap();
}
if (connectionCounterImage) {
- emit thumbnailReady(image, aThumbnail.ClientData(), aId, aError);
+ emit q_ptr->thumbnailReady(pixmap.toImage(), aThumbnail.ClientData(), aId, aError);
}
if (connectionCounterPixmap) {
- QPixmap pixmap = QPixmap::fromImage(image);
- emit thumbnailReady(pixmap, aThumbnail.ClientData(), aId, aError);
+ emit q_ptr->thumbnailReady(pixmap, aThumbnail.ClientData(), aId, aError);
}
}
}
--- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_qt.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_qt.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -23,19 +23,12 @@
QObject( parentPtr ),
d( new ThumbnailManagerPrivate() )
{
- QObject::connect( d, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ),
- this, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ) );
- QObject::connect( d, SIGNAL( thumbnailReady( QImage , void * , int , int ) ),
- this, SIGNAL( thumbnailReady( QImage , void * , int , int ) ) );
+ d->q_ptr = this;
}
Q_DECL_EXPORT ThumbnailManager::~ThumbnailManager()
{
- QObject::disconnect( d, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ),
- this, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ) );
- QObject::disconnect( d, SIGNAL( thumbnailReady( QImage , void * , int , int ) ),
- this, SIGNAL( thumbnailReady( QImage , void * , int , int ) ) );
if( NULL != d ){
delete d;
}
@@ -101,6 +94,12 @@
return d->setThumbnail( source, filename, clientData, priority );
}
+Q_DECL_EXPORT int ThumbnailManager::setThumbnail( const QString& sourceFileName, const QString& targetFileName,
+ const QString& mimeType, void * clientData , int priority )
+{
+ return d->setThumbnail( sourceFileName, targetFileName, mimeType, clientData, priority );
+}
+
Q_DECL_EXPORT void ThumbnailManager::deleteThumbnails( const QString& fileName )
{
d->deleteThumbnails( fileName );
@@ -138,3 +137,4 @@
d->connectionCounterImage--;
}
}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/moc_thumbnailmanager_p_qt.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -0,0 +1,99 @@
+/****************************************************************************
+** Meta object code from reading C++ file 'thumbnailmanager_p_qt.h'
+**
+** Created: Fri 30. Apr 11:26:04 2010
+** by: The Qt Meta Object Compiler version 62 (Qt 4.6.3)
+**
+** WARNING! All changes made in this file will be lost!
+*****************************************************************************/
+
+#include "../inc/thumbnailmanager_p_qt.h"
+#if !defined(Q_MOC_OUTPUT_REVISION)
+#error "The header file 'thumbnailmanager_p_qt.h' doesn't include <QObject>."
+#elif Q_MOC_OUTPUT_REVISION != 62
+#error "This file was generated using the moc from 4.6.3. It"
+#error "cannot be used with the include files from this version of Qt."
+#error "(The moc has changed too much.)"
+#endif
+
+QT_BEGIN_MOC_NAMESPACE
+static const uint qt_meta_data_ThumbnailManagerPrivate[] = {
+
+ // content:
+ 4, // revision
+ 0, // classname
+ 0, 0, // classinfo
+ 2, 14, // methods
+ 0, 0, // properties
+ 0, 0, // enums/sets
+ 0, 0, // constructors
+ 0, // flags
+ 2, // signalCount
+
+ // signals: signature, parameters, type, tag, flags
+ 29, 25, 24, 24, 0x05,
+ 67, 25, 24, 24, 0x05,
+
+ 0 // eod
+};
+
+static const char qt_meta_stringdata_ThumbnailManagerPrivate[] = {
+ "ThumbnailManagerPrivate\0\0,,,\0"
+ "thumbnailReady(QPixmap,void*,int,int)\0"
+ "thumbnailReady(QImage,void*,int,int)\0"
+};
+
+const QMetaObject ThumbnailManagerPrivate::staticMetaObject = {
+ { &QObject::staticMetaObject, qt_meta_stringdata_ThumbnailManagerPrivate,
+ qt_meta_data_ThumbnailManagerPrivate, 0 }
+};
+
+#ifdef Q_NO_DATA_RELOCATION
+const QMetaObject &ThumbnailManagerPrivate::getStaticMetaObject() { return staticMetaObject; }
+#endif //Q_NO_DATA_RELOCATION
+
+const QMetaObject *ThumbnailManagerPrivate::metaObject() const
+{
+ return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
+}
+
+void *ThumbnailManagerPrivate::qt_metacast(const char *_clname)
+{
+ if (!_clname) return 0;
+ if (!strcmp(_clname, qt_meta_stringdata_ThumbnailManagerPrivate))
+ return static_cast<void*>(const_cast< ThumbnailManagerPrivate*>(this));
+ if (!strcmp(_clname, "MThumbnailManagerObserver"))
+ return static_cast< MThumbnailManagerObserver*>(const_cast< ThumbnailManagerPrivate*>(this));
+ return QObject::qt_metacast(_clname);
+}
+
+int ThumbnailManagerPrivate::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+{
+ _id = QObject::qt_metacall(_c, _id, _a);
+ if (_id < 0)
+ return _id;
+ if (_c == QMetaObject::InvokeMetaMethod) {
+ switch (_id) {
+ case 0: thumbnailReady((*reinterpret_cast< QPixmap(*)>(_a[1])),(*reinterpret_cast< void*(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3])),(*reinterpret_cast< int(*)>(_a[4]))); break;
+ case 1: thumbnailReady((*reinterpret_cast< QImage(*)>(_a[1])),(*reinterpret_cast< void*(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3])),(*reinterpret_cast< int(*)>(_a[4]))); break;
+ default: ;
+ }
+ _id -= 2;
+ }
+ return _id;
+}
+
+// SIGNAL 0
+void ThumbnailManagerPrivate::thumbnailReady(QPixmap _t1, void * _t2, int _t3, int _t4)
+{
+ void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)), const_cast<void*>(reinterpret_cast<const void*>(&_t3)), const_cast<void*>(reinterpret_cast<const void*>(&_t4)) };
+ QMetaObject::activate(this, &staticMetaObject, 0, _a);
+}
+
+// SIGNAL 1
+void ThumbnailManagerPrivate::thumbnailReady(QImage _t1, void * _t2, int _t3, int _t4)
+{
+ void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)), const_cast<void*>(reinterpret_cast<const void*>(&_t3)), const_cast<void*>(reinterpret_cast<const void*>(&_t4)) };
+ QMetaObject::activate(this, &staticMetaObject, 1, _a);
+}
+QT_END_MOC_NAMESPACE
--- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/test_qtnmwrapper.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/test_qtnmwrapper.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -62,6 +62,7 @@
void getThumbnailByName();
void getThumbnailById();
void setThumbnail();
+ void setThumbnailFromPath();
void cancelRequest();
void changePriority();
void deleteThumbnailsByName();
@@ -146,7 +147,7 @@
connect( wrapper, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
this, SLOT( thumbnailReady( QPixmap , void* , int , int )));
- wrapper_p = new ThumbnailManagerPrivate();
+ wrapper_p = wrapper->d; //new ThumbnailManagerPrivate();
}
void TestThumbnailManager::cleanup()
@@ -161,7 +162,7 @@
ipixmap = NULL;
}
- delete wrapper_p;
+ // delete wrapper_p;
}
// --- test ---
@@ -245,6 +246,18 @@
delete img;
}
+void TestThumbnailManager::setThumbnailFromPath()
+{
+ // normal URI
+ QVERIFY( wrapper->setThumbnail( "c:\\tnmwrapper_tsrc.png", "c:\\tnmwrapper_tsrc.vcf", "contact/x-vcard" ) != -1 );
+
+ // virtual URI
+ QVERIFY( wrapper->setThumbnail( "c:\\tnmwrapper_tsrc.png", "c:tnmwrapper_tsrc.vcf", "contact/x-vcard" ) != -1 );
+
+ // no mime
+ QVERIFY( wrapper->setThumbnail( "c:\\tnmwrapper_tsrc.png", "c:tnmwrapper_tsrc.vcf" ) != -1 );
+}
+
void TestThumbnailManager::cancelRequest()
{
wrapper->setMode( ThumbnailManager::CropToAspectRatio );
@@ -327,8 +340,7 @@
QVERIFY(td.bitmap->SizeInPixels().iHeight == TestThumbnailData::BITMAP_HEIGHT);
disconnect( wrapper_p, SIGNAL(thumbnailReady( QImage , void* , int, int ) ),
- this, SLOT( thumbnailReadyImage(QImage, void* , int , int )));
-
+ this, SLOT( thumbnailReadyImage(QImage, void* , int , int )));
}
void TestThumbnailManager::testThumbnailReadyPixmap()
@@ -355,7 +367,6 @@
disconnect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
this, SLOT( thumbnailReadyPixmap( QPixmap , void* , int , int )));
-
}
void TestThumbnailManager::testThumbnailReadyImageAndPixmap()
@@ -387,8 +398,7 @@
this, SLOT( thumbnailReadyImage( QImage , void* , int , int )));
disconnect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
- this, SLOT( thumbnailReadyPixmap( QPixmap , void* , int , int )));
-
+ this, SLOT( thumbnailReadyPixmap( QPixmap , void* , int , int )));
}
void TestThumbnailManager::testPriorities_data()
@@ -417,13 +427,18 @@
// --- private slots - callback ---
-void TestThumbnailManager::thumbnailReady( QPixmap /*pixmap*/, void * /*clientData*/, int /*id*/, int /*errorCode*/ )
+void TestThumbnailManager::thumbnailReady( QPixmap pixmap, void *clientData, int id, int errorCode )
{
//do nothing, we dont test Thumbnail Manager's functionality, we just use it
+ Q_UNUSED( pixmap );
+ Q_UNUSED( clientData );
+ Q_UNUSED( id );
+ Q_UNUSED( errorCode );
}
-void TestThumbnailManager::thumbnailReady_p( QPixmap pixmap, void * /*clientData*/, int id, int errorCode )
+void TestThumbnailManager::thumbnailReady_p( QPixmap pixmap, void * clientData, int id, int errorCode )
{
+ Q_UNUSED( clientData );
QVERIFY( pixmap.isNull() == pixmapNull );
QVERIFY( errorCode == aerrorCode );
QVERIFY( id == aid );
--- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/test_qtnmwrapper.pro Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/test_qtnmwrapper.pro Thu Jul 22 16:37:07 2010 +0100
@@ -44,7 +44,3 @@
icons.sources += tnmwrapper_tsrc.mbm
icons.path = /
DEPLOYMENT += icons
-#needed to make directory /shared/EUnit/logs/ so that test result can be written
-testres.sources += distribution.policy.s60
-testres.path = /shared/EUnit/logs/
-DEPLOYMENT += testres
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/group/thumbnailserver.mmp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/group/thumbnailserver.mmp Thu Jul 22 16:37:07 2010 +0100
@@ -82,6 +82,7 @@
LIBRARY centralrepository.lib
LIBRARY platformenv.lib
LIBRARY imageconversion.lib
+LIBRARY iclextjpegapi.lib
LIBRARY caf.lib
LIBRARY cafutils.lib
LIBRARY mdeclient.lib
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailcenrep.h Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailcenrep.h Thu Jul 22 16:37:07 2010 +0100
@@ -142,7 +142,7 @@
};
public:
- enum TThumbnailSourceType { EUnknownSourceType, EImage, EVideo, EAudio };
+ enum TThumbnailSourceType { EUnknownSourceType, EImage, EVideo, EAudio, EContact };
enum TThumbnailSizeType { EUnknownSizeType, EGrid, EList, EFullscreen };
public:
@@ -203,7 +203,10 @@
TBool iVideoFullscreen;
TBool iAudioGrid;
TBool iAudioList;
- TBool iAudioFullscreen;
+ TBool iAudioFullscreen;
+ TBool iContactGrid;
+ TBool iContactList;
+ TBool iContactFullscreen;
};
#endif // THUMBNAILCENREP_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailgeneratetask.h Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailgeneratetask.h Thu Jul 22 16:37:07 2010 +0100
@@ -33,7 +33,7 @@
* @since S60 v5.0
*/
class CThumbnailGenerateTask: public CThumbnailTask,
- public MThumbnailProviderObserver
+ public MThumbnailProviderObserver
{
public:
@@ -56,7 +56,8 @@
TDisplayMode aDisplayMode, TInt aPriority,
RArray < TThumbnailPersistentSize >* aMissingSizes, const TDesC& aTargetUri,
TThumbnailSize aThumbnailSize, const TInt64 aModified,
- const CThumbnailManager::TThumbnailQualityPreference aQualityPreference );
+ const CThumbnailManager::TThumbnailQualityPreference aQualityPreference,
+ TBool aImportVirtual );
/**
* Destructor.
@@ -143,7 +144,7 @@
* @param aOriginalSize Original size of bitmap.
*/
void DoBlacklisting( const TInt aError, const TSize& aOriginalSize );
-
+
private:
// Data
@@ -233,6 +234,9 @@
TBool iPortrait;
TInt iBitmapHandle;
+
+ // virtual uri
+ TBool iVirtualUri;
};
#endif // THUMBNAILGENERATETASK_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailscaletask.h Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailscaletask.h Thu Jul 22 16:37:07 2010 +0100
@@ -59,7 +59,7 @@
TDisplayMode aDisplayMode, TInt aPriority, const TDesC& aTargetUri,
const TThumbnailSize aThumbnailSize, const TInt64 aModified,
const TBool aBitmapToPool, const TBool aEXIF,
- const TThumbnailServerRequestId aRequestId);
+ const TThumbnailServerRequestId aRequestId, const TBool aImportVirtual);
/**
* Destructor
@@ -131,7 +131,7 @@
aDisplayMode, TInt aPriority, const TDesC& aTargetUri,
const TThumbnailSize aThumbnailSize, const TInt64 aModified,
const TBool aBitmapToPool, const TBool aEXIF,
- const TThumbnailServerRequestId aRequestId);
+ const TThumbnailServerRequestId aRequestId, const TBool aImportVirtual);
/**
* Symbian 2nd phase constructor can leave.
@@ -278,6 +278,9 @@
* Is origin EXIF.
*/
TBool iEXIF;
+
+ // virtual uri
+ TBool iVirtualUri;
};
#endif // THUMBNAILSCALETASK_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h Thu Jul 22 16:37:07 2010 +0100
@@ -168,9 +168,8 @@
*/
void StoreThumbnailL( const TDesC& aPath, CFbsBitmap* aBitmap, const TSize&
aOriginalSize, const TBool aCropped, const TThumbnailSize aThumbnailSize,
- const TInt64 aModified,
- const TBool aThumbFromPath = ETrue,
- const TBool aCheckExist = ETrue);
+ const TInt64 aModified, const TBool aThumbFromPath,
+ const TBool aCheckExist);
/**
* Fetch thumbnail image.
@@ -234,6 +233,14 @@
* @return Thumbnail provider.
*/
CThumbnailProvider* ResolveProviderL( const TDesC8& aMimeType );
+
+ /**
+ * Preload provider plugins
+ *
+ * @since S^3
+ */
+ void PreLoadProviders();
+
/**
* Add thumbnailtask to processor queue.
@@ -462,6 +469,15 @@
TBool IsFormatting();
inline CThumbnailFetchedChecker& FetchedChecker() const { return *iFetchedChecker; }
+
+ /**
+ * Check is path in public folder
+ *
+ * @param aPath
+ * @ret
+ */
+ TBool IsPublicPath( const TDesC& aPath );
+
protected: // Functions from base classes
/**
@@ -528,7 +544,21 @@
* @since S60 v5.0
*/
static TInt ReconnectCallBack(TAny* aAny);
-
+
+ /**
+ * Start unmount timer
+ *
+ * @since S60 S^3
+ */
+ void StartUnmountTimeout( const TInt aDrive);
+
+ /**
+ * Callback for unmount timer
+ *
+ * @since S60 S^3
+ */
+ static TInt UnmountCallBack(TAny* aAny);
+
private:
/**
@@ -681,15 +711,24 @@
// reconnect timer
CPeriodic* iReconnect;
+
+ // unmount timer
+ CPeriodic* iUnmount;
+
+ // array of unmounte
+ RArray < TInt > iUnmountedDrives;
#ifdef _DEBUG
TUint32 iPlaceholderCounter;
#endif
+
/**
* Fetched checker.
* Own.
*/
CThumbnailFetchedChecker* iFetchedChecker;
+
+ TBool iSessionError;
};
#endif // THUMBNAILSERVER_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailsql.h Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailsql.h Thu Jul 22 16:37:07 2010 +0100
@@ -130,6 +130,10 @@
_LIT8 ( KGetInfoRowID, "SELECT MAX (ThumbnailInfo.rowID) FROM ThumbnailInfo" );
_LIT8 ( KGetDataRowID, "SELECT MAX (ThumbnailInfoData.rowID) FROM ThumbnailInfoData" );
+// counts
+_LIT8 ( KGetInfoCount, "SELECT COUNT(*) FROM ThumbnailInfo" );
+_LIT8 ( KGetInfoDataCount, "SELECT COUNT(*) FROM ThumbnailInfoData" );
+
// flush
_LIT8( KThumbnailMoveFromTempInfoToMainTable, "INSERT INTO ThumbnailInfo SELECT * FROM TempThumbnailInfo;");
_LIT8( KThumbnailMoveFromTempDataToMainTable, "INSERT INTO ThumbnailInfoData SELECT * FROM TempThumbnailInfoData;");
@@ -204,12 +208,12 @@
_LIT8( KThumbnailTempRename, "UPDATE TempThumbnailInfo SET Path = :NewPath WHERE Path = :Path;" );
// reset blacklisted
-_LIT8( KThumbnailTouchBlacklistedRows, "UPDATE ThumbnailInfo SET Modified = 0 WHERE Flags & :Flag" );
+_LIT8( KThumbnailTouchBlacklistedRows, "UPDATE ThumbnailInfo SET Flags = 4, Modified = 0 WHERE Flags & :Flag" );
// existence check
_LIT8( KThumbnailSelectAllPaths, "SELECT ThumbnailInfo.RowID,Path FROM ThumbnailInfo "
"WHERE NOT EXISTS (SELECT Path FROM ThumbnailDeleted "
"WHERE ThumbnailInfo.Path = ThumbnailDeleted.Path) "
- "AND ThumbnailInfo.RowID > :RowID ORDER BY ThumbnailInfo.RowID ASC LIMIT :Limit;" );
+ "AND ThumbFromPath = 1 AND ThumbnailInfo.RowID > :RowID ORDER BY ThumbnailInfo.RowID ASC LIMIT :Limit;" );
#endif // THUMBNAILSQL_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailstore.h Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailstore.h Thu Jul 22 16:37:07 2010 +0100
@@ -232,9 +232,7 @@
*/
void StoreThumbnailL( const TDesC& aPath, CFbsBitmap* aThumbnail, const
TSize& aOriginalSize, TBool aCropped, const TThumbnailSize aThumbnailSize,
- const TInt64 aModified,
- const TBool aThumbFromPath = ETrue,
- TBool aBlackListed = EFalse );
+ const TInt64 aModified, const TBool aThumbFromPath, TBool aBlackListed);
/**
* Fetches thumbnail image.
@@ -442,7 +440,7 @@
void StoreThumbnailL( const TDesC& aPath, const TDes8& aData, const TSize&
aSize, const TSize& aOriginalSize, const TThumbnailFormat& aFormat, TInt aFlags,
const TThumbnailSize& aThumbnailSize, const TInt64 aModified,
- const TBool aThumbFromPath = ETrue);
+ const TBool aThumbFromPath);
/**
* Finds possible existing duplicate thumbnail.
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailcenrep.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailcenrep.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -67,6 +67,11 @@
case EAudioFullScreenThumbnailSize:
iSourceType = EAudio;
break;
+ case EContactGridThumbnailSize:
+ case EContactListThumbnailSize:
+ case EContactFullScreenThumbnailSize:
+ iSourceType = EContact;
+ break;
default:
iSourceType = EUnknownSourceType;
}
@@ -80,7 +85,8 @@
TThumbnailAutoCreate::TThumbnailAutoCreate()
: iImageGrid(EFalse), iImageList(EFalse), iImageFullscreen(EFalse),
iVideoGrid(EFalse), iVideoList(EFalse), iVideoFullscreen(EFalse),
- iAudioGrid(EFalse), iAudioList(EFalse), iAudioFullscreen(EFalse)
+ iAudioGrid(EFalse), iAudioList(EFalse), iAudioFullscreen(EFalse),
+ iContactGrid(EFalse), iContactList(EFalse), iContactFullscreen(EFalse)
{
// No implementation required
}
@@ -203,6 +209,28 @@
iPersistentSizes.AppendL( TThumbnailPersistentSize( EAudioFullScreenThumbnailSize, TSize( xSize, ySize ),
flags, static_cast <TDisplayMode> (raw_mode), format, autoCreate, TThumbnailPersistentSize::EFullscreen ));
+
+ User::LeaveIfError( iRepository->Get( KSizeContactGridWidth, xSize ));
+ User::LeaveIfError( iRepository->Get( KSizeContactGridHeight, ySize ));
+ User::LeaveIfError( iRepository->Get( KAutoCreateContactGrid, autoCreate ));
+
+ iPersistentSizes.AppendL( TThumbnailPersistentSize( EContactGridThumbnailSize, TSize( xSize, ySize ),
+ KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate, TThumbnailPersistentSize::EGrid ));
+
+ User::LeaveIfError( iRepository->Get( KSizeContactListWidth, xSize ));
+ User::LeaveIfError( iRepository->Get( KSizeContactListHeight, ySize ));
+ User::LeaveIfError( iRepository->Get( KAutoCreateContactList, autoCreate ));
+
+ iPersistentSizes.AppendL( TThumbnailPersistentSize( EContactListThumbnailSize, TSize( xSize, ySize ),
+ KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate, TThumbnailPersistentSize::EList ));
+
+ User::LeaveIfError( iRepository->Get( KSizeContactFullscreenWidth, xSize ));
+ User::LeaveIfError( iRepository->Get( KSizeContactFullscreenHeight, ySize ));
+ User::LeaveIfError( iRepository->Get( KAutoCreateContactFullscreen, autoCreate ));
+
+ iPersistentSizes.AppendL( TThumbnailPersistentSize( EContactFullScreenThumbnailSize, TSize( xSize, ySize ),
+ flags, static_cast <TDisplayMode> (raw_mode), format, autoCreate, TThumbnailPersistentSize::EFullscreen ));
+
iAutoCreate = new (ELeave) TThumbnailAutoCreate();
@@ -215,6 +243,9 @@
User::LeaveIfError( iRepository->Get( KAutoCreateAudioGrid, iAutoCreate->iAudioGrid ));
User::LeaveIfError( iRepository->Get( KAutoCreateAudioList, iAutoCreate->iAudioList ));
User::LeaveIfError( iRepository->Get( KAutoCreateAudioFullscreen, iAutoCreate->iAudioFullscreen ));
+ User::LeaveIfError( iRepository->Get( KAutoCreateContactGrid, iAutoCreate->iContactGrid ));
+ User::LeaveIfError( iRepository->Get( KAutoCreateContactList, iAutoCreate->iContactList ));
+ User::LeaveIfError( iRepository->Get( KAutoCreateContactFullscreen, iAutoCreate->iContactFullscreen ));
}
// ---------------------------------------------------------------------------
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnaildecodetask.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnaildecodetask.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -51,6 +51,7 @@
//
CThumbnailDecodeTask::~CThumbnailDecodeTask()
{
+ TN_DEBUG2( "CThumbnailDecodeTask(0x%08x)::~CThumbnailDecodeTask()", this );
if ( iProvider )
{
iProvider->CancelGetThumbnail();
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailfetchedchecker.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailfetchedchecker.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -96,12 +96,15 @@
if( iNotFetched.Count() < KMaxStoredEntries )
{
TInt err = iNotFetched.InsertInOrder( entry, CEntry::InsertCB );
- if ( err != KErrNone )
+ if ( err == KErrNone )
{
- delete entry;
+ entry = NULL; // owned by array now
}
}
}
+
+ delete entry;
+ entry = NULL;
}
}
}
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailgeneratetask.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailgeneratetask.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -43,12 +43,13 @@
const TSize& aSize, TDisplayMode aDisplayMode, TInt aPriority,
RArray < TThumbnailPersistentSize >* aMissingSizes, const TDesC& aTargetUri,
TThumbnailSize aThumbnailSize, const TInt64 aModified,
- const CThumbnailManager::TThumbnailQualityPreference aQualityPreference ):
+ const CThumbnailManager::TThumbnailQualityPreference aQualityPreference,
+ TBool aVirtualUri ):
CThumbnailTask( aProcessor, aPriority ), iServer( aServer ),
iFlags( aFlags ), iSize( aSize ), iDisplayMode( aDisplayMode ),
iMissingSizes( aMissingSizes ), iTargetUri( aTargetUri ),
iThumbnailSize( aThumbnailSize ), iModified(aModified),
- iQualityPreference( aQualityPreference )
+ iQualityPreference( aQualityPreference ), iVirtualUri( aVirtualUri )
{
TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CThumbnailGenerateTask()", this);
@@ -124,13 +125,12 @@
#ifdef _DEBUG
aStart.UniversalTime();
#endif
+
+ TBuf8< KMaxDataTypeLength > mimeType;
-
- TParsePtrC parse(iFilename);
- TPtrC ext(parse.Ext());
- TBuf8< KMaxDataTypeLength > mimeType;
- if (ext.CompareF(KNonEmbeddedArtExt)== 0)
- {
+ if ( (!iVirtualUri && iFilename.Right(KExtLength).CompareF(KNonEmbeddedArtExt) == 0) ||
+ (iVirtualUri && iTargetUri.Right(KExtLength).CompareF(KContactExt) == 0) ) // tparse panics with virtual URI
+ {
mimeType.Copy( KImageMime );
}
else
@@ -139,8 +139,7 @@
}
iProvider = iServer.ResolveProviderL(mimeType);
- TN_DEBUG3( "CThumbnailGenerateTask(0x%08x) -- provider UID 0x%08x", this,
- iProvider->Uid());
+ TN_DEBUG3( "CThumbnailGenerateTask(0x%08x) -- provider UID 0x%08x", this, iProvider->Uid());
__ASSERT_DEBUG(( iProvider ), ThumbnailPanic( EThumbnailNullPointer ));
@@ -198,6 +197,7 @@
void CThumbnailGenerateTask::DoCancel()
{
TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::DoCancel()", this );
+
if ( iProvider )
{
iProvider->CancelGetThumbnail();
@@ -240,6 +240,7 @@
size.iSize.iWidth );
aCroppedTargetSize.iHeight = Max( aCroppedTargetSize.iHeight,
size.iSize.iHeight );
+
if(iBuffer)
{
iFlags = ( CThumbnailManager::TThumbnailFlags ) (iFlags | CThumbnailManager::ECropToAspectRatio);
@@ -328,6 +329,25 @@
// compTask is the scale task which returns the bitmap to the client
CThumbnailScaleTask* complTask = NULL;
+ TInt err1 = KErrNone;
+ TInt err2 = KErrNone;
+ TBool isPublic = ETrue;
+ TBool isPublic2 = ETrue;
+
+ if(iFilename != KNullDesC)
+ {
+ TRAP(err1, iServer.StoreForPathL(iFilename));
+
+ isPublic = iServer.IsPublicPath( iFilename );
+ }
+ if(iTargetUri != KNullDesC )
+ {
+ TRAP(err2, iServer.StoreForPathL(iTargetUri));
+
+ isPublic2 = iServer.IsPublicPath( iTargetUri );
+ }
+
+ // check if need to create more than one scale task
if ( iMissingSizes )
{
const TInt count = iMissingSizes->Count();
@@ -356,44 +376,36 @@
}
}
- CThumbnailScaleTask* scaleTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename,
+ CThumbnailScaleTask* complTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename,
aBitmap, iOriginalSize, (*iMissingSizes)[ i ].iSize, (*iMissingSizes)[ i ].iCrop, iDisplayMode,
KMaxPriority, iTargetUri, (*iMissingSizes)[ i ].iType, iModified, iScaledBitmapToPool, iEXIF,
- iRequestId);
- CleanupStack::PushL( scaleTask );
+ iRequestId, iVirtualUri);
+ CleanupStack::PushL( complTask );
- TInt err1 = KErrNone;
- TInt err2 = KErrNone;
- if(iFilename != KNullDesC)
- {
- TRAP(err1, iServer.StoreForPathL(iFilename));
- }
- if(iTargetUri != KNullDesC)
- {
- TRAP(err2, iServer.StoreForPathL(iTargetUri));
- }
// if trying to access Z drive, don't try to store
// don't want to store custom sizes
- if( err1 == KErrAccessDenied || err2 == KErrAccessDenied ||
- (*iMissingSizes)[ i ].iType == ECustomThumbnailSize ||
- (*iMissingSizes)[ i ].iType == EUnknownThumbnailSize )
+ // don't store if from private directory
+ if( !isPublic || !isPublic2 ||
+ err1 == KErrAccessDenied || err2 == KErrAccessDenied ||
+ (*iMissingSizes)[ i ].iType == ECustomThumbnailSize ||
+ (*iMissingSizes)[ i ].iType == EUnknownThumbnailSize )
{
- scaleTask->SetDoStore( EFalse );
+ complTask->SetDoStore( EFalse );
TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CreateScaleTasksL() - do not store", this );
}
else
{
- scaleTask->SetDoStore( ETrue );
+ complTask->SetDoStore( ETrue );
}
- iProcessor.AddTaskL( scaleTask );
- CleanupStack::Pop( scaleTask );
+ iProcessor.AddTaskL( complTask );
+ CleanupStack::Pop( complTask );
// completion to first task, because task processor works like stack
if( i == 0 )
{
// compTask is now responsible for completing the RMessage
- scaleTask->SetMessageData( iRequestId, iMessage, iClientThread );
+ complTask->SetMessageData( iRequestId, iMessage, iClientThread );
ResetMessageData();
}
}
@@ -416,22 +428,14 @@
complTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename,
aBitmap, iOriginalSize, iSize, iFlags& CThumbnailManager
::ECropToAspectRatio, iDisplayMode, KMaxPriority, iTargetUri,
- iThumbnailSize, iModified, iScaledBitmapToPool, iEXIF, iRequestId );
+ iThumbnailSize, iModified, iScaledBitmapToPool, iEXIF, iRequestId,
+ iVirtualUri);
CleanupStack::PushL( complTask );
- TInt err1 = KErrNone;
- TInt err2 = KErrNone;
- if(iFilename != KNullDesC)
- {
- TRAP(err1, iServer.StoreForPathL(iFilename));
- }
- if(iTargetUri != KNullDesC)
- {
- TRAP(err2, iServer.StoreForPathL(iTargetUri));
- }
// if trying to access Z drive, don't try to store
// don't want to store custom sizes
- if( err1 == KErrAccessDenied || err2 == KErrAccessDenied ||
+ if( !isPublic || !isPublic2 ||
+ err1 == KErrAccessDenied || err2 == KErrAccessDenied ||
iThumbnailSize == ECustomThumbnailSize ||
iThumbnailSize == EUnknownThumbnailSize )
{
@@ -488,14 +492,14 @@
if(iFilename != KNullDesC)
{
iServer.StoreForPathL( iFilename )->StoreThumbnailL(
- iFilename, tempBitmap, aOriginalSize, EFalse, iThumbnailSize, iModified, EFalse, ETrue );
+ iFilename, tempBitmap, aOriginalSize, EFalse, iThumbnailSize, iModified, !iVirtualUri, ETrue );
//remove result from fetched checker
iServer.FetchedChecker().SetFetchResult( iFilename, KErrNone );
}
else if(iTargetUri != KNullDesC)
{
iServer.StoreForPathL( iTargetUri )->StoreThumbnailL(
- iTargetUri, tempBitmap, aOriginalSize, EFalse, iThumbnailSize, iModified, EFalse, ETrue );
+ iTargetUri, tempBitmap, aOriginalSize, EFalse, iThumbnailSize, iModified, !iVirtualUri, ETrue );
//remove result from fetched checker
iServer.FetchedChecker().SetFetchResult( iTargetUri, KErrNone );
}
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailscaletask.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailscaletask.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -42,14 +42,15 @@
aBitmap, const TSize& aOriginalSize, const TSize& aTargetSize, TBool aCrop,
TDisplayMode aDisplayMode, TInt aPriority, const TDesC& aTargetUri,
const TThumbnailSize aThumbnailSize, const TInt64 aModified,
- TBool aBitmapToPool, const TBool aEXIF, const TThumbnailServerRequestId aRequestId)
+ TBool aBitmapToPool, const TBool aEXIF, const TThumbnailServerRequestId aRequestId,
+ const TBool aImportVirtual)
{
// We take ownership of aBitmap
CleanupStack::PushL( aBitmap );
CThumbnailScaleTask* self = new( ELeave )CThumbnailScaleTask( aProcessor,
aServer, aFilename, aBitmap, aOriginalSize, aTargetSize, aCrop,
aDisplayMode, aPriority, aTargetUri, aThumbnailSize, aModified,
- aBitmapToPool, aEXIF, aRequestId);
+ aBitmapToPool, aEXIF, aRequestId, aImportVirtual);
CleanupStack::Pop( aBitmap );
CleanupStack::PushL( self );
self->ConstructL();
@@ -68,12 +69,13 @@
const TSize& aOriginalSize, const TSize& aTargetSize, TBool aCrop,
TDisplayMode aDisplayMode, TInt aPriority, const TDesC& aTargetUri,
const TThumbnailSize aThumbnailSize, const TInt64 aModified,
- TBool aBitmapToPool, const TBool aEXIF, const TThumbnailServerRequestId aRequestId):
+ TBool aBitmapToPool, const TBool aEXIF, const TThumbnailServerRequestId aRequestId,
+ const TBool aVirtualUri):
CThumbnailTask( aProcessor, aPriority ), iServer( aServer ), iOwnBitmap( aBitmap ),
iOriginalSize( aOriginalSize ), iTargetSize(aTargetSize), iTargetSizeTN( aTargetSize ), iCrop( aCrop ),
iDisplayMode( aDisplayMode ), iFilename( aFilename ), iTargetUri( aTargetUri ),
iThumbnailSize(aThumbnailSize), iModified(aModified),
- iBitmapToPool(aBitmapToPool), iEXIF(aEXIF)
+ iBitmapToPool(aBitmapToPool), iEXIF(aEXIF), iVirtualUri( aVirtualUri )
{
TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::CThumbnailScaleTask()", this );
@@ -134,11 +136,15 @@
if ( !iCrop )
{
+ TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::StartL() - cropping OFF", this );
+
// target size at max, keep aspect ratio
CalculateTargetSize();
}
else
{
+ TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::StartL() - cropping ON", this );
+
// exact target size, crop excess
CalculateCropRectangle();
}
@@ -344,17 +350,20 @@
if (iFilename != KNullDesC && iFilename.CompareF(iTargetUri) == 0)
{
// filename and target URI match, so thumb created from associated path
- iServer.StoreThumbnailL( iTargetUri, iScaledBitmap, iOriginalSize, iCrop, iThumbnailSize, iModified, ETrue );
+ iServer.StoreThumbnailL( iTargetUri, iScaledBitmap, iOriginalSize, iCrop,
+ iThumbnailSize, iModified, !iVirtualUri, !iVirtualUri );
}
else
{
// thumb not created from associated path
- iServer.StoreThumbnailL( iTargetUri, iScaledBitmap, iOriginalSize, iCrop, iThumbnailSize, iModified, EFalse, EFalse );
+ iServer.StoreThumbnailL( iTargetUri, iScaledBitmap, iOriginalSize, iCrop,
+ iThumbnailSize, iModified, !iVirtualUri, EFalse );
}
}
else if (iFilename != KNullDesC)
{
- iServer.StoreThumbnailL( iFilename, iScaledBitmap, iOriginalSize, iCrop, iThumbnailSize, iModified, ETrue );
+ iServer.StoreThumbnailL( iFilename, iScaledBitmap, iOriginalSize, iCrop,
+ iThumbnailSize, iModified, !iVirtualUri, !iVirtualUri );
}
}
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -43,6 +43,7 @@
_LIT8( KThumbnailMimeImage, "image" );
_LIT8( KThumbnailMimeVideo, "video" );
_LIT8( KThumbnailMimeAudio, "audio" );
+_LIT8( KThumbnailMimeContact, "contact" );
const TChar KThumbnailMimeSeparatorChar = '/';
const TChar KThumbnailMimeWildCardChar = '*';
@@ -224,6 +225,7 @@
// connect to MDS
iMdESession = CMdESession::NewL( *this );
+ iSessionError = EFalse;
User::LeaveIfError( iFbsSession.Connect());
User::LeaveIfError( Start( KThumbnailServerName ));
@@ -233,6 +235,9 @@
REComSession::ListImplementationsL( TUid::Uid( THUMBNAIL_PROVIDER_IF_UID ),
iPluginInfoArray );
+ //preload provide plugins
+ PreLoadProviders();
+
CTMGetImei * imeiGetter = CTMGetImei::NewLC();
iImei = imeiGetter->GetIMEI();
@@ -251,10 +256,13 @@
iFormatting = EFalse;
- //OpenStoresL();
+ OpenStoresL();
AddUnmountObserversL();
iFetchedChecker = CThumbnailFetchedChecker::NewL();
+
+ // Unmount timeout timer
+ iUnmount = CPeriodic::NewL(CActive::EPriorityIdle);
}
@@ -268,9 +276,21 @@
iShutdown = ETrue;
+ if(iUnmount)
+ {
+ iUnmount->Cancel();
+ delete iUnmount;
+ iUnmount = NULL;
+ }
+
+ iUnmountedDrives.Close();
+
delete iFetchedChecker;
+ iFetchedChecker = NULL;
delete iShutdownObserver;
+ iShutdownObserver = NULL;
delete iProcessor;
+ iProcessor = NULL;
if(iReconnect)
{
@@ -290,7 +310,9 @@
iUnmountObservers.ResetAndDestroy();
delete iMMCObserver;
+ iMMCObserver = NULL;
delete iFormatObserver;
+ iFormatObserver = NULL;
THashMapIter < TInt, TThumbnailBitmapRef > bpiter( iBitmapPool );
@@ -304,11 +326,13 @@
}
delete iScaler;
+ iScaler = NULL;
iBitmapPool.Close();
iFbsSession.Disconnect();
iRecognizer.Close();
iPluginInfoArray.ResetAndDestroy();
delete iCenrep;
+ iCenrep = NULL;
iFs.Close();
REComSession::FinalClose();
}
@@ -317,9 +341,13 @@
// CThumbnailServer::HandleSessionOpened
// -----------------------------------------------------------------------------
//
+#ifdef _DEBUG
+void CThumbnailServer::HandleSessionOpened( CMdESession& /* aSession */, TInt aError )
+#else
void CThumbnailServer::HandleSessionOpened( CMdESession& /* aSession */, TInt /*aError*/ )
+#endif
{
- TN_DEBUG1( "CThumbnailServer::HandleSessionOpened");
+ TN_DEBUG2( "CThumbnailServer::HandleSessionOpened error == %d", aError );
}
// -----------------------------------------------------------------------------
@@ -329,8 +357,10 @@
void CThumbnailServer::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
{
TN_DEBUG2( "CThumbnailServer::HandleSessionError == %d", aError );
- if (aError != KErrNone && !iShutdown)
+ if (aError != KErrNone && !iShutdown && !iSessionError)
{
+ iSessionError = ETrue;
+
if (!iReconnect->IsActive())
{
iReconnect->Start( KMdEReconnect, KMdEReconnect,
@@ -417,38 +447,35 @@
TN_DEBUG2( "CThumbnailServer::DropSession() aSession = 0x%08x", aSession );
- // clean-up bitmap pool
-
+ // clean-up bitmap pool
THashMapIter < TInt, TThumbnailBitmapRef > bpiter( iBitmapPool );
// const pointer to a non-const object
const TThumbnailBitmapRef* ref = bpiter.NextValue();
while ( ref )
- {
+ {
+ if ( ref->iSession == aSession )
+ {
+ TN_DEBUG2( "CThumbnailServer::DropSession() - ref->iSession = 0x%08x", ref->iSession );
- TN_DEBUG2( "CThumbnailServer::DropSession() - ref->iSession = 0x%08x", ref->iSession );
-
- if ( ref->iSession == aSession )
- {
delete ref->iBitmap;
bpiter.RemoveCurrent();
- TN_DEBUG2( "CThumbnailServer::DropSession() - deleted bitmap, left=%d",
- iBitmapPool.Count());
+ TN_DEBUG2( "CThumbnailServer::DropSession() - deleted bitmap, left=%d", iBitmapPool.Count());
}
- ref = bpiter.NextValue();
+ ref = bpiter.NextValue();
}
if ( iSessionCount <= 0 )
{
- // rename thread
- User::RenameThread( KThumbnailServerShutdown );
-
// server shutdown
if (!iShutdown)
{
+ // rename thread
+ User::RenameThread( KThumbnailServerShutdown );
+
CActiveScheduler::Stop();
iShutdown = ETrue;
}
@@ -461,8 +488,10 @@
//
void CThumbnailServer::ShutdownNotification()
{
+ TN_DEBUG1( "CThumbnailServer::ShutdownNotification()");
if (!iShutdown)
{
+ TN_DEBUG1( "CThumbnailServer::ShutdownNotification() shutdown");
CActiveScheduler::Stop();
iShutdown = ETrue;
}
@@ -527,12 +556,12 @@
if (!aCheckExist)
{
StoreForPathL( aPath )->StoreThumbnailL( aPath, aBitmap, aOriginalSize,
- aCropped, aThumbnailSize, aModified, aThumbFromPath );
+ aCropped, aThumbnailSize, aModified, aThumbFromPath, EFalse );
}
else if(BaflUtils::FileExists( iFs, aPath))
{
StoreForPathL( aPath )->StoreThumbnailL( aPath, aBitmap, aOriginalSize,
- aCropped, aThumbnailSize, aModified, aThumbFromPath );
+ aCropped, aThumbnailSize, aModified, aThumbFromPath, EFalse );
}
else
{
@@ -774,6 +803,22 @@
// -----------------------------------------------------------------------------
+// CThumbnailServer::PreLoadProviders()
+// -----------------------------------------------------------------------------
+//
+void CThumbnailServer::PreLoadProviders( )
+ {
+ TN_DEBUG1( "CThumbnailServer::PreLoadProvidersL()" );
+ TInt err(KErrNone);
+
+ for(TInt i=0; i< iPluginInfoArray.Count(); i++)
+ {
+ TRAP(err, GetProviderL( iPluginInfoArray[i]->ImplementationUid()));
+ }
+ }
+
+
+// -----------------------------------------------------------------------------
// CThumbnailServer::QueueTaskL()
// Adds thumbnailtask to processor queue.
// -----------------------------------------------------------------------------
@@ -791,20 +836,17 @@
// -----------------------------------------------------------------------------
//
TInt CThumbnailServer::DequeTask( const TThumbnailServerRequestId& aRequestId )
- {
-
+ {
TInt error = iProcessor->RemoveTask( aRequestId );
- // clean-up bitmap pool
-
+ // 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 &&
@@ -814,10 +856,10 @@
bpiter.RemoveCurrent();
TN_DEBUG2( "CThumbnailServer::DequeTask() - deleted bitmap, left=%d",
- iBitmapPool.Count());
+ iBitmapPool.Count());
}
- ref = bpiter.NextValue();
+ ref = bpiter.NextValue();
}
return error;
@@ -886,10 +928,16 @@
CThumbnailStore* CThumbnailServer::StoreForDriveL( const TInt aDrive )
{
TN_DEBUG2( "CThumbnailServer::StoreForDriveL() drive=%d", aDrive );
+
+ if(iUnmountedDrives.Find( aDrive ) >= KErrNone)
+ {
+ TN_DEBUG1( "CThumbnailServer::StoreForDriveL() unmount in progress, skip!");
+ User::Leave( KErrDisMounted );
+ }
+
CThumbnailStore** resPtr = iStores.Find( aDrive );
CThumbnailStore* res = NULL;
-
if ( resPtr )
{
res = * resPtr;
@@ -901,8 +949,10 @@
TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - FORMATTING! - ABORT");
User::Leave( KErrNotSupported );
}
+
TVolumeInfo volumeInfo;
TInt err = iFs.Volume( volumeInfo, aDrive );
+
if ( err || volumeInfo.iDrive.iDriveAtt& KDriveAttRom ||
volumeInfo.iDrive.iDriveAtt& KDriveAttRemote ||
volumeInfo.iDrive.iMediaAtt& KMediaAttWriteProtected ||
@@ -912,14 +962,14 @@
// must be read-write and not locked.
User::Leave( KErrAccessDenied);
}
-
+
res = CThumbnailStore::NewL( iFs, aDrive, iImei, this );
CleanupStack::PushL( res );
iStores.InsertL( aDrive, res );
res->SetPersistentSizes(iPersistentSizes);
CleanupStack::Pop( res );
- for(TInt i = 0; i<iUnmountObservers.Count(); i++)
+ for(TInt i = 0; i < iUnmountObservers.Count(); i++)
{
iUnmountObservers[i]->StartNotify();
}
@@ -1002,6 +1052,8 @@
TN_DEBUG2( "CThumbnailServer::CloseStoreForDriveL drive=%d", aDrive);
CThumbnailStore** store = iStores.Find( aDrive );
+ StartUnmountTimeout( aDrive);
+
if (store)
{
delete *store;
@@ -1098,15 +1150,44 @@
TInt err_drive = iFs.Drive(driveInfo, drive);
// mount -- if removable drive, add new store
- if (!err && !err_drive && driveInfo.iDriveAtt& KDriveAttRemovable)
+ if (!err && !err_drive
+ && driveInfo.iType != EMediaNotPresent
+ && driveInfo.iDriveAtt& KDriveAttRemovable )
{
+ TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL mount drive==%d", drive);
+
+ CThumbnailStore** resPtr = iStores.Find( drive );
+
+ if ( resPtr )
+ {
+ TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() already mounted, skip %d", drive);
+ continue;
+ }
+
// ignore errors
- //TRAP_IGNORE( StoreForDriveL( drive ));
+ TRAP_IGNORE( StoreForDriveL( drive ));
+
+ TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() update KItemsleft == %d", KErrNotReady);
+ RProperty::Set(KTAGDPSNotification, KItemsleft, KErrNotReady );
+
+ TInt index = iUnmountedDrives.Find( drive );
+
+ if(index >= KErrNone)
+ {
+ iUnmountedDrives.Remove( index );
+ }
+
+ if(!iUnmountedDrives.Count()&& iUnmount && iUnmount->IsActive())
+ {
+ TN_DEBUG1( "CThumbnailServer::MemoryCardStatusChangedL() cancel unmount timer");
+ iUnmount->Cancel();
+ }
}
//dismount -- if removable drive, close store
- else if(err && !err_drive && driveInfo.iDriveAtt& KDriveAttRemovable)
+ else if(err && !err_drive && driveInfo.iDriveAtt& KDriveAttRemovable )
{
+ TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() unmount drive==%d", drive);
CloseStoreForDriveL( drive);
}
}
@@ -1258,8 +1339,7 @@
TInt CThumbnailServer::MimeTypeFromFileExt( const TDesC& aFileName, TDataType& aMimeType )
{
TBool found = ETrue;
- TParsePtrC parse( aFileName );
- TPtrC ext( parse.Ext() );
+ TPtrC ext( aFileName.Right(KExtLength) ); // tparse panics with virtual URI
if ( ext.CompareF( KJpegExt ) == 0 || ext.CompareF( KJpgExt ) == 0)
{
@@ -1321,6 +1401,10 @@
{
aMimeType = TDataType( KVideo3gppMime );
}
+ else if ( ext.CompareF( K3gppExt ) == 0 )
+ {
+ aMimeType = TDataType( KVideo3gppMime );
+ }
else if ( ext.CompareF( KAmrExt ) == 0 )
{
aMimeType = TDataType( KAudioAmrMime );
@@ -1365,6 +1449,10 @@
{
aMimeType = TDataType( KMatroskaVideoMime );
}
+ else if ( ext.CompareF( KContactExt ) == 0 )
+ {
+ aMimeType = TDataType( KContactMime );
+ }
else
{
aMimeType = TDataType( KNullDesC8 );
@@ -1402,6 +1490,10 @@
{
return TThumbnailPersistentSize::EAudio;
}
+ else if (mediaType.Compare(KThumbnailMimeContact) == 0)
+ {
+ return TThumbnailPersistentSize::EContact;
+ }
return TThumbnailPersistentSize::EUnknownSourceType;
}
@@ -1431,6 +1523,11 @@
case EAudioFullScreenThumbnailSize:
sourceType = TThumbnailPersistentSize::EAudio;
break;
+ case EContactListThumbnailSize:
+ case EContactGridThumbnailSize:
+ case EContactFullScreenThumbnailSize:
+ sourceType = TThumbnailPersistentSize::EContact;
+ break;
default:
sourceType = TThumbnailPersistentSize::EUnknownSourceType;
}
@@ -1450,24 +1547,29 @@
mimeType.CompareF( KJpeg2000Mime ) == 0 ||
mimeType.CompareF( KGifMime ) == 0 ||
mimeType.CompareF( KPngMime ) == 0 ||
- mimeType.CompareF( KBmpMime ) == 0 ||
+ mimeType.CompareF( KSvgMime ) == 0 ||
mimeType.CompareF( KMpgMime1 ) == 0 ||
mimeType.CompareF( KMpeg4Mime ) == 0 ||
mimeType.CompareF( KMp4Mime ) == 0 ||
mimeType.CompareF( KAviMime ) == 0 ||
- mimeType.CompareF( KVideo3gppMime ) == 0 ||
- mimeType.CompareF( KVideoWmvMime ) == 0 ||
- mimeType.CompareF( KRealVideoMime ) == 0 ||
mimeType.CompareF( KMp3Mime ) == 0 ||
+ mimeType.CompareF( KNonEmbeddArtMime ) == 0 ||
+ mimeType.CompareF( KM4aMime ) == 0 ||
mimeType.CompareF( KAacMime ) == 0 ||
mimeType.CompareF( KWmaMime ) == 0 ||
+ mimeType.CompareF( KBmpMime ) == 0 ||
+ mimeType.CompareF( KAudio3gppMime ) == 0 ||
+ mimeType.CompareF( KVideo3gppMime ) == 0 ||
mimeType.CompareF( KAudioAmrMime ) == 0 ||
+ mimeType.CompareF( KVideoWmvMime ) == 0 ||
mimeType.CompareF( KRealAudioMime ) == 0 ||
- mimeType.CompareF( KM4aMime ) == 0 ||
- mimeType.CompareF( KFlashVideoMime ) == 0 ||
+ mimeType.CompareF( KPmRealAudioPluginMime ) == 0 ||
mimeType.CompareF( KPmRealVideoPluginMime ) == 0 ||
mimeType.CompareF( KPmRealVbVideoPluginMime ) == 0 ||
- mimeType.CompareF( KPmRealAudioPluginMime ) == 0 )
+ mimeType.CompareF( KRealVideoMime ) == 0 ||
+ mimeType.CompareF( KFlashVideoMime ) == 0 ||
+ mimeType.CompareF( KMatroskaVideoMime ) == 0 ||
+ mimeType.CompareF( KContactMime ) == 0 )
{
return ETrue;
}
@@ -1629,9 +1731,80 @@
// reconnect to MDS
TRAP_IGNORE( self->iMdESession = CMdESession::NewL( *self ) );
+ self->iSessionError = EFalse;
TN_DEBUG1( "CThumbAGDaemon::ReconnectCallBack() - done");
return KErrNone;
}
+// -----------------------------------------------------------------------------
+// CThumbnailServer::IsPublicPath
+// -----------------------------------------------------------------------------
+//
+
+TBool CThumbnailServer::IsPublicPath( const TDesC& aPath )
+ {
+ TInt pos = aPath.FindF(KPrivateFolder);
+
+ if ( pos == 1 )
+ {
+ TN_DEBUG1( "CThumbnailServer::IsPublicPath() NO");
+ return EFalse;
+ }
+
+ pos = aPath.FindF(KSysFolder);
+ if ( pos == 1 )
+ {
+ TN_DEBUG1( "CThumbnailServer::IsPublicPath() NO");
+ return EFalse;
+ }
+
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbnailServer::StartUnmount()
+// ---------------------------------------------------------------------------
+//
+void CThumbnailServer::StartUnmountTimeout( const TInt aDrive)
+ {
+ TN_DEBUG2( "CThumbnailServer::StartUnmountTimeout(%d)", aDrive);
+
+ if(iUnmount )
+ {
+ if(iUnmountedDrives.Find( aDrive ) == KErrNotFound)
+ {
+ iUnmountedDrives.Append( aDrive );
+ }
+
+ if(iUnmount->IsActive())
+ {
+ iUnmount->Cancel();
+ }
+
+ TN_DEBUG1( "CThumbnailServer::StartUnmountTimeout() start unmount timer");
+ iUnmount->Start( KUnmountTimerTimeout, KUnmountTimerTimeout, TCallBack(UnmountCallBack, this));
+ }
+ __ASSERT_DEBUG(( iUnmount ), ThumbnailPanic( EThumbnailNullPointer ));
+ }
+
+
+// ---------------------------------------------------------------------------
+// CThumbnailServer::UnmountCallBack()
+// ---------------------------------------------------------------------------
+//
+TInt CThumbnailServer::UnmountCallBack(TAny* aAny)
+ {
+ TN_DEBUG1( "CThumbnailServer::UnmountCallBack() - unmount finished");
+
+ CThumbnailServer* self = static_cast<CThumbnailServer*>( aAny );
+
+ self->iUnmount->Cancel();
+
+ self->iUnmountedDrives.Reset();
+
+ TN_DEBUG1( "CThumbAGDaemon::UnmountCallBack() - done");
+
+ return KErrNone;
+ }
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -55,6 +55,10 @@
CThumbnailServerSession::~CThumbnailServerSession()
{
Server()->DropSession(this);
+ delete iBitmap;
+ iBitmap = NULL;
+ delete iBuffer;
+ iBuffer = NULL;
}
@@ -156,6 +160,8 @@
//
void CThumbnailServerSession::CreateL()
{
+ TN_DEBUG2( "CThumbnailServerSession::AddSession() = 0x%08x", this );
+
Server()->AddSession();
}
@@ -442,6 +448,7 @@
const TThumbnailRequestParams& params = iRequestParams();
RFile64 file;
+ CleanupClosePushL(file);
User::LeaveIfError( file.AdoptFromClient( aMessage, 2, 3 ));
ResolveMimeTypeL(&file);
@@ -455,13 +462,20 @@
ModifyThumbnailSize(sourceType);
}
+ // delete existing
+ if(params.iImport && params.iOverwrite)
+ {
+ Server()->DeleteThumbnailsL( params.iTargetUri);
+ }
+
// CreateThumbnails
if (params.iControlFlags == EThumbnailGeneratePersistentSizesOnly)
{
TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - EThumbnailGeneratePersistentSizesOnly" );
- CleanupClosePushL( file );
CreateGenerateTaskFromFileHandleL( &file );
- CleanupStack::Pop( &file );
+
+ // ownership of the file transferred
+ CleanupStack::Pop(&file);
}
// single thumbnail request
else
@@ -471,17 +485,20 @@
if( err == KErrCompletion )
{
// If thumbnail of requested size is blacklisted, fetching is left with KErrCompletion
- TN_DEBUG1(
- "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - thumbnail blacklisted" );
+ TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - thumbnail blacklisted" );
+
aMessage.Complete( err );
iMessage = RMessage2();
+
+ // close file
+ CleanupStack::PopAndDestroy(&file);
}
else if ( !err && iBitmap )
{
TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - found existing thumbnail - bitmap " );
// Thumbnail already stored
- file.Close();
+ CleanupStack::PopAndDestroy(&file);
TN_DEBUG1("CThumbnailServerSession::RequestThumbByFileHandleAsyncL - file handle closed");
ProcessBitmapL();
@@ -491,11 +508,13 @@
{
TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - KErrNotFound & !EDoNotCreate" );
CreateGenerateTaskFromFileHandleL( &file);
+
+ // ownership of the file transferred
+ CleanupStack::Pop(&file);
}
else if (!err && iBuffer)
{
- TN_DEBUG1(
- "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - found existing thumbnail - jpeg " );
+ TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - found existing thumbnail - jpeg " );
CThumbnailDecodeTask* task = new( ELeave )CThumbnailDecodeTask( Server()
->Processor(), * Server(), iBuffer, params.iPriority, params.iDisplayMode );
@@ -510,15 +529,20 @@
//CThumbnailDecodeTask is responsible freeing
iBuffer = NULL;
- file.Close();
+
+ // close file
+ CleanupStack::PopAndDestroy(&file);
TN_DEBUG1("CThumbnailServerSession::RequestThumbByFileHandleAsyncL - file handle closed");
}
else
{
- TN_DEBUG2(
- "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - thumbnail not found, err=%d", err );
+ TN_DEBUG2( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - thumbnail not found, err=%d", err );
+
aMessage.Complete( ConvertSqlErrToE32Err( err ));
iMessage = RMessage2();
+
+ // close file
+ CleanupStack::PopAndDestroy(&file);
}
}
}
@@ -591,8 +615,8 @@
else if( err == KErrCompletion )
{
// If thumbnail of requested size is blacklisted, fetching is left with KErrCompletion
- TN_DEBUG1(
- "CThumbnailServerSession::RequestThumbByPathAsyncL() - thumbnail blacklisted" );
+ TN_DEBUG1( "CThumbnailServerSession::RequestThumbByPathAsyncL() - thumbnail blacklisted" );
+
aMessage.Complete( err );
iMessage = RMessage2();
}
@@ -601,6 +625,19 @@
TN_DEBUG2(
"CThumbnailServerSession::RequestThumbByPathAsyncL() - thumbnail not found, err = %d", err );
+ // don't try to create from virtual URI
+ if ( params.iVirtualUri )
+ {
+ User::Leave(err);
+ }
+
+ // disk space check only for stored sizes
+ if ( params.iThumbnailSize != ECustomThumbnailSize &&
+ Server()->StoreForPathL(params.iFileName)->IsDiskFull() )
+ {
+ User::Leave( KErrDiskFull );
+ }
+
if ( (err == KErrNotFound || err == KErrAccessDenied) &&
!(params.iFlags& CThumbnailManager::EDoNotCreate) )
{
@@ -608,15 +645,6 @@
// and retry the request using file handle
err = KThumbnailErrThumbnailNotFound;
}
- else
- {
- User::Leave(err);
- }
-
- if(Server()->StoreForPathL(params.iFileName)->IsDiskFull())
- {
- User::Leave( KErrDiskFull );
- }
User::Leave(err);
}
@@ -641,26 +669,31 @@
aMessage.ReadL( 0, iRequestParams );
const TThumbnailRequestParams& params = iRequestParams();
- if(params.iThumbnailSize != EUnknownThumbnailSize)
+ // delete existing
+ if(params.iOverwrite)
{
Server()->DeleteThumbnailsL( params.iTargetUri);
}
- if(params.iThumbnailSize == EFullScreenThumbnailSize ||
- params.iThumbnailSize == EGridThumbnailSize ||
- params.iThumbnailSize == EListThumbnailSize )
- {
- TInt sourceType = TThumbnailPersistentSize::EUnknownSourceType;
- TDataType mimetype;
- TInt ret = Server()->MimeTypeFromFileExt( params.iTargetUri, mimetype );
-
- if( ret == KErrNone )
+ // if only one size
+ if ((params.iControlFlags & EThumbnailGeneratePersistentSizesOnly) == 0)
+ {
+ if(params.iThumbnailSize == EFullScreenThumbnailSize ||
+ params.iThumbnailSize == EGridThumbnailSize ||
+ params.iThumbnailSize == EListThumbnailSize )
{
- sourceType = Server()->SourceTypeFromMimeType( mimetype );
- ModifyThumbnailSize(sourceType);
+ TInt sourceType = TThumbnailPersistentSize::EUnknownSourceType;
+ TDataType mimetype;
+ TInt ret = Server()->MimeTypeFromFileExt( params.iTargetUri, mimetype );
+
+ if( ret == KErrNone )
+ {
+ sourceType = Server()->SourceTypeFromMimeType( mimetype );
+ ModifyThumbnailSize(sourceType);
+ }
+ User::LeaveIfError( ret );
}
- User::LeaveIfError( ret );
- }
+ }
TInt bufferSize = aMessage.Int2();
HBufC8* buffer = HBufC8::NewMaxLC( bufferSize );
@@ -684,17 +717,44 @@
aMessage.ReadL( 0, iRequestParams );
const TThumbnailRequestParams& params = iRequestParams();
+ const TThumbnailServerRequestId reqId( this, params.iRequestId );
+
+ // delete existing
+ if(params.iOverwrite)
+ {
+ Server()->DeleteThumbnailsL( params.iTargetUri);
+ }
+
+ // if only one size
+ if ((params.iControlFlags & EThumbnailGeneratePersistentSizesOnly) == 0)
+ {
+ if(params.iThumbnailSize == EFullScreenThumbnailSize ||
+ params.iThumbnailSize == EGridThumbnailSize ||
+ params.iThumbnailSize == EListThumbnailSize )
+ {
+ TInt sourceType = TThumbnailPersistentSize::EUnknownSourceType;
+ TDataType mimetype;
+ TInt ret = Server()->MimeTypeFromFileExt( params.iTargetUri, mimetype );
+
+ if( ret == KErrNone )
+ {
+ sourceType = Server()->SourceTypeFromMimeType( mimetype );
+ ModifyThumbnailSize(sourceType);
+ }
+ User::LeaveIfError( ret );
+ }
+ }
+
TInt bitmapHandle = aMessage.Int1();
- TThumbnailServerRequestId &reqId = (TThumbnailServerRequestId&)params.iRequestId;
// get bitmap
CFbsBitmap* bitmap = new( ELeave )CFbsBitmap();
CleanupStack::PushL( bitmap );
User::LeaveIfError( bitmap->Duplicate( bitmapHandle ) );
-
+
// use pool to prevent bitmap leak
// this bitmap is shared to several scale tasks, one of which can Leave
- Server()->AddBitmapToPoolL( reqId.iSession, bitmap, reqId );
+ Server()->AddBitmapToPoolL( this, bitmap, reqId );
CleanupStack::Pop( bitmap );
iBitmapHandle = bitmap->Handle();
@@ -755,7 +815,8 @@
*Server(), params.iTargetUri, bitmap, bitmapSize,
(*missingSizes)[i].iSize, (*missingSizes)[i].iCrop, params.iDisplayMode,
KMaxPriority, KNullDesC, (*missingSizes)[i].iType, params.iModified, EFalse, EFalse,
- reqId);
+ reqId, params.iVirtualUri);
+
CleanupStack::PushL( scaleTask );
scaleTask->SetDoStore( ETrue );
Server()->Processor().AddTaskL( scaleTask );
@@ -763,7 +824,7 @@
// completion to first task, because task processor works like stack
if( i == 0 )
- {
+ {
// scaleTask is now responsible for completing the RMessage
scaleTask->SetMessageData( reqId, iMessage, iClientThread );
iMessage = RMessage2();
@@ -797,12 +858,19 @@
//
void CThumbnailServerSession::CreateGenerateTaskFromFileHandleL( RFile64* aFile)
{
- const TThumbnailRequestParams& params = iRequestParams();
+ TThumbnailRequestParams& params = iRequestParams();
TN_DEBUG2(
"CThumbnailServerSession::CreateGenerateTaskFromFileHandleL() -- create thumbnail generation task for %S", ¶ms.iFileName );
- if(Server()->StoreForPathL(params.iFileName)->IsDiskFull())
+ // disk space check only for stored sizes
+ if ( params.iImport &&
+ Server()->StoreForPathL(params.iTargetUri)->IsDiskFull() )
+ {
+ User::Leave( KErrDiskFull );
+ }
+ else if ( params.iThumbnailSize != ECustomThumbnailSize &&
+ Server()->StoreForPathL(params.iFileName)->IsDiskFull() )
{
User::Leave( KErrDiskFull );
}
@@ -817,16 +885,22 @@
missingSizes = new (ELeave) RArray < TThumbnailPersistentSize >;
CleanupClosePushL( *missingSizes );
-
TBool gridSizeOnly(EFalse);
- if ( params.iQualityPreference == CThumbnailManager
- ::EOptimizeForQualityWithPreview )
+ if ( params.iQualityPreference == CThumbnailManager::EOptimizeForQualityWithPreview )
{
gridSizeOnly = ETrue;
}
- Server()->GetMissingSizesL( params.iFileName, sourceType, *missingSizes, gridSizeOnly);
+ // import vs. normal
+ if(params.iImport)
+ {
+ Server()->GetMissingSizesL( params.iTargetUri, sourceType, *missingSizes, gridSizeOnly);
+ }
+ else
+ {
+ Server()->GetMissingSizesL( params.iFileName, sourceType, *missingSizes, gridSizeOnly);
+ }
if ( missingSizes->Count() == 0)
{
@@ -840,6 +914,25 @@
return;
}
}
+ // creating single TN on demand
+ else if( params.iThumbnailSize > ECustomThumbnailSize && params.iThumbnailSize < EThumbnailSizeCount)
+ {
+ TThumbnailPersistentSize persistentSize = Server()->PersistentSizeL(params.iThumbnailSize);
+
+ if(persistentSize.iCrop)
+ {
+ params.iFlags = ( CThumbnailManager::TThumbnailFlags ) (params.iFlags | CThumbnailManager::ECropToAspectRatio);
+ }
+ else
+ {
+ params.iFlags = ( CThumbnailManager::TThumbnailFlags ) (params.iFlags & CThumbnailManager::ECropToAspectRatio);
+ }
+
+ if( ClientThreadAlive() )
+ {
+ iMessage.Write( 0, iRequestParams );
+ }
+ }
// priority
TInt priority = params.iPriority;
@@ -858,7 +951,8 @@
CThumbnailGenerateTask* task = new( ELeave )CThumbnailGenerateTask( Server()
->Processor(), * Server(), aFile, NULL, ¶ms.iMimeType, params.iFlags,
params.iSize, params.iDisplayMode, priority, missingSizes, params.iTargetUri,
- params.iThumbnailSize, params.iModified, params.iQualityPreference );
+ params.iThumbnailSize, params.iModified, params.iQualityPreference,
+ params.iVirtualUri);
// do not store bitmaps to server pool when generating only
if( params.iControlFlags & EThumbnailGeneratePersistentSizesOnly )
@@ -881,6 +975,7 @@
// Generate task is now responsible for completing the message
iMessage = RMessage2();
}
+
// -----------------------------------------------------------------------------
// CThumbnailServerSession::CreateGenerateTaskL()
// Create a task to generate a new thumbnail
@@ -893,7 +988,9 @@
TN_DEBUG2(
"CThumbnailServerSession::CreateGenerateTaskFromBufferL() -- create thumbnail generation task for %S", ¶ms.iTargetUri );
- if(Server()->StoreForPathL(params.iTargetUri)->IsDiskFull())
+ // disk space check only for stored sizes
+ if ( params.iThumbnailSize != ECustomThumbnailSize &&
+ Server()->StoreForPathL(params.iTargetUri)->IsDiskFull() )
{
User::Leave( KErrDiskFull );
}
@@ -967,7 +1064,8 @@
CThumbnailGenerateTask* task = new( ELeave )CThumbnailGenerateTask( Server()
->Processor(), * Server(), NULL, aBuffer, ¶ms.iMimeType, params.iFlags,
params.iSize, params.iDisplayMode, priority, missingSizes, params.iTargetUri,
- params.iThumbnailSize, params.iModified, params.iQualityPreference );
+ params.iThumbnailSize, params.iModified, params.iQualityPreference,
+ params.iVirtualUri);
// do not store bitmaps to server pool when generating only
if( params.iControlFlags & EThumbnailGeneratePersistentSizesOnly )
@@ -1041,16 +1139,6 @@
{
TThumbnailRequestParams& params = iRequestParams();
- // in import case store bitmap
- 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.iModified,
- EFalse, EFalse);
- }
-
if ( ClientThreadAlive() )
{
TN_DEBUG2("CThumbnailServerSession::ProcessBitmapL(), iBitmap handle= 0x%08x", iBitmap->Handle());
@@ -1072,8 +1160,7 @@
TN_DEBUG1("CThumbnailServerSession()::ProcessBitmapL() bitmap to pool");
- TThumbnailServerRequestId &reqId = (TThumbnailServerRequestId&)params.iRequestId;
- Server()->AddBitmapToPoolL( this, iBitmap, reqId );
+ Server()->AddBitmapToPoolL( this, iBitmap, TThumbnailServerRequestId( this, params.iRequestId ) );
iMessage.Complete( KErrNone );
iMessage = RMessage2();
@@ -1175,7 +1262,6 @@
aMessage.ReadL( 0, iRequestParams );
const TThumbnailRequestParams& params = iRequestParams();
-
#ifdef RD_MDS_2_5
// try to query path from MDS
CThumbnailMDSQueryTask* task = new( ELeave )CThumbnailMDSQueryTask(
@@ -1183,9 +1269,11 @@
CleanupStack::PushL( task );
task->QueryPathByIdL(params.iThumbnailId, ETrue);
+ task->SetMessageData( TThumbnailServerRequestId( this, params.iRequestId ) );
Server()->QueueTaskL( task );
CleanupStack::Pop( task ); // owned by processor now
#endif // RD_MDS_2_5
+
aMessage.Complete( KErrNone );
iMessage = RMessage2();
}
@@ -1195,8 +1283,7 @@
// list of supported MIME types
// -----------------------------------------------------------------------------
//
-void CThumbnailServerSession::GetMimeTypeBufferSizeL( const RMessage2& aMessage
- )
+void CThumbnailServerSession::GetMimeTypeBufferSizeL( const RMessage2& aMessage )
{
TPckgBuf < TInt > buf;
buf() = Server()->GetMimeTypeBufferSize();
@@ -1272,6 +1359,21 @@
params.iThumbnailSize = EAudioListThumbnailSize;
}
}
+ else if(aSourceType == TThumbnailPersistentSize::EContact)
+ {
+ if(params.iThumbnailSize == EFullScreenThumbnailSize)
+ {
+ params.iThumbnailSize = EContactFullScreenThumbnailSize;
+ }
+ else if(params.iThumbnailSize == EGridThumbnailSize)
+ {
+ params.iThumbnailSize = EContactGridThumbnailSize;
+ }
+ else if(params.iThumbnailSize == EListThumbnailSize)
+ {
+ params.iThumbnailSize = EContactListThumbnailSize;
+ }
+ }
}
//------------------------------------------------------------------------
@@ -1285,34 +1387,42 @@
// mime type
if ( params.iMimeType.Des8() == KNullDesC8 && !Server()->SupportedMimeType(params.iMimeType) )
- {
- // try parsing from file extension
- res = Server()->MimeTypeFromFileExt( params.iFileName, params.iMimeType );
- if ( res == KErrNotFound )
- {
- if( aFile )
- {
- // parsed type not in the list, resolve from file
- params.iMimeType = Server()->ResolveMimeTypeL(*aFile);
- }
- else
- {
- Server()->Fs().ShareProtected();
- RFile64 file;
- CleanupClosePushL( file );
-
- User::LeaveIfError( file.Open( Server()->Fs(), params.iFileName, EFileShareReadersOrWriters ));
- TN_DEBUG2( "CThumbnailServerSession::ResolveMimeType - file handle opened for %S", ¶ms.iFileName );
-
- params.iMimeType = Server()->ResolveMimeTypeL(file);
-
- file.Close();
- TN_DEBUG1("CThumbnailServerSession::ResolveMimeType - file handle closed");
-
- CleanupStack::Pop( &file );
- }
- }
- }
+ {
+ // try parsing from file extension
+ if (params.iImport)
+ {
+ res = Server()->MimeTypeFromFileExt( params.iTargetUri, params.iMimeType );
+ }
+ else
+ {
+ res = Server()->MimeTypeFromFileExt( params.iFileName, params.iMimeType );
+ }
+
+ if ( res == KErrNotFound )
+ {
+ if( aFile )
+ {
+ // parsed type not in the list, resolve from file
+ params.iMimeType = Server()->ResolveMimeTypeL(*aFile);
+ }
+ else
+ {
+ Server()->Fs().ShareProtected();
+ RFile64 file;
+ CleanupClosePushL( file );
+
+ User::LeaveIfError( file.Open( Server()->Fs(), params.iFileName, EFileShareReadersOrWriters ));
+ TN_DEBUG2( "CThumbnailServerSession::ResolveMimeType - file handle opened for %S", ¶ms.iFileName );
+
+ params.iMimeType = Server()->ResolveMimeTypeL(file);
+
+ file.Close();
+ TN_DEBUG1("CThumbnailServerSession::ResolveMimeType - file handle closed");
+
+ CleanupStack::Pop( &file );
+ }
+ }
+ }
}
@@ -1323,12 +1433,20 @@
TInt CThumbnailServerSession::ConvertSqlErrToE32Err( TInt aReason )
{
TN_DEBUG2("CThumbnailServerSession::ConvertSqlErrToE32Err(%d)", aReason);
- TInt e32Err;
+ TInt e32Err(aReason);
+
if ( aReason >= - 144 )
// magic: [-1..-144] is E32 error range
{
// E32 error value or non-negative value
- e32Err = aReason;
+ switch ( aReason )
+ {
+ case KErrServerTerminated:
+ e32Err = KErrCorrupt;
+ break;
+ default:
+ e32Err = aReason;
+ }
}
else
{
@@ -1445,4 +1563,5 @@
}
}
+
// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -35,7 +35,7 @@
#include "thumbnailserver.h"
-_LIT8( KThumbnailSqlConfig, "page_size=32768; cache_size=32;" );
+_LIT8( KThumbnailSqlConfig, "page_size=32768; cache_size=64;" );
const TInt KStreamBufferSize = 1024 * 8;
const TInt KMajor = 3;
@@ -44,9 +44,9 @@
const TInt KStoreUnrecoverableErr = KErrCorrupt;
// Database path without drive letter
+//Symbian^4 v5
_LIT( KThumbnailDatabaseName, ":[102830AB]thumbnail_v5.db" );
-_LIT( KDrv, ":");
// Allow access to database only for the server process
const TSecurityPolicy KThumbnailDatabaseSecurityPolicy( TSecureId(
@@ -211,11 +211,6 @@
iMaintenanceTimer = NULL;
}
- if(!iServer->IsFormatting())
- {
- FlushCacheTable( ETrue );
- }
-
CloseStatements();
iDatabase.Close();
@@ -299,6 +294,7 @@
{
TN_DEBUG2( "CThumbnailStore::OpenDatabaseL() drive: %d", iDrive );
+ CloseStatements();
iDatabase.Close();
iUnrecoverable = ETrue;
@@ -474,6 +470,7 @@
TBuf<50> mediaid;
mediaid.Num(id);
+ CloseStatements();
iDatabase.Close();
iUnrecoverable = ETrue;
@@ -529,6 +526,7 @@
// delete db if not fully complete
if (prepareErr < 0 || mediaidErr < 0)
{
+ CloseStatements();
iDatabase.Close();
TN_DEBUG1( "CThumbnailStore::RecreateDatabaseL() delete database" );
TInt del = iDatabase.Delete(pathPtr);
@@ -549,13 +547,15 @@
TInt column = 0;
TInt rowStatus = 0;
TInt64 inforows = -1;
+ TInt64 infocount = -1;
TInt64 datarows = -1;
+ TInt64 datacount = -1;
TInt ret = stmt.Prepare( iDatabase, KGetInfoRowID );
if(ret < 0)
{
stmt.Close();
- TN_DEBUG1( "CThumbnailStore::CheckRowIDs() failed 1 %d");
+ TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetInfoRowID failed %d");
return KErrNotSupported;
}
rowStatus = stmt.Next();
@@ -567,20 +567,45 @@
stmt.Close();
- if(ret < 0)
+ if(rowStatus < 0)
{
#ifdef _DEBUG
TPtrC errorMsg2 = iDatabase.LastErrorMessage();
TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
#endif
- return ret;
+ return KErrNotSupported;
+ }
+
+ ret = stmt.Prepare( iDatabase, KGetInfoCount );
+ if(ret < 0)
+ {
+ stmt.Close();
+ TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetInfoCount failed %d");
+ return KErrNotSupported;
+ }
+ rowStatus = stmt.Next();
+
+ if ( rowStatus == KSqlAtRow)
+ {
+ infocount = stmt.ColumnInt64( column );
+ }
+
+ stmt.Close();
+
+ if(rowStatus < 0)
+ {
+#ifdef _DEBUG
+ TPtrC errorMsg2 = iDatabase.LastErrorMessage();
+ TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
+#endif
+ return KErrNotSupported;
}
ret = stmt.Prepare( iDatabase, KGetDataRowID );
if(ret < 0)
{
stmt.Close();
- TN_DEBUG1( "CThumbnailStore::CheckRowIDs() failed 2");
+ TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetDataRowID failed");
return KErrNotSupported;
}
rowStatus = stmt.Next();
@@ -592,16 +617,46 @@
stmt.Close();
- if(ret < 0)
+ if( rowStatus < 0)
{
#ifdef _DEBUG
TPtrC errorMsg2 = iDatabase.LastErrorMessage();
TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
#endif
- return ret;
+ return KErrNotSupported;
+ }
+
+ ret = stmt.Prepare( iDatabase, KGetInfoDataCount );
+ if(ret < 0)
+ {
+ stmt.Close();
+ TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetInfoDataCount failed %d");
+ return KErrNotSupported;
+ }
+ rowStatus = stmt.Next();
+
+ if ( rowStatus == KSqlAtRow)
+ {
+ datacount = stmt.ColumnInt64( column );
}
+
+ stmt.Close();
+
+ if(rowStatus < 0)
+ {
+#ifdef _DEBUG
+ TPtrC errorMsg2 = iDatabase.LastErrorMessage();
+ TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
+#endif
+ return KErrNotSupported;
+ }
+
+ TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - inforows %Ld", inforows );
+ TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - infocount %Ld", infocount );
+ TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - datarows %Ld", datarows );
+ TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - datacount %Ld", datacount );
- if( inforows != datarows)
+ if( inforows != datarows || datacount != infocount)
{
TN_DEBUG1( "CThumbnailStore::CheckRowIDsL() - tables out of sync" );
return KErrNotSupported;
@@ -644,7 +699,7 @@
stmt.Close();
- if(ret < 0 )
+ if( rowStatus < 0 )
{
#ifdef _DEBUG
TPtrC errorMsg = iDatabase.LastErrorMessage();
@@ -695,7 +750,7 @@
stmt.Close();
- if(ret < 0 )
+ if( rowStatus < 0 )
{
#ifdef _DEBUG
TPtrC errorMsg = iDatabase.LastErrorMessage();
@@ -1065,7 +1120,7 @@
const TSize& aSize, const TSize& aOriginalSize, const TThumbnailFormat& aFormat, TInt aFlags,
const TThumbnailSize& aThumbnailSize, const TInt64 aModified, const TBool aThumbFromPath )
{
- TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( const TDes8& ) in" );
+ TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( private ) in" );
#ifdef _DEBUG
TTime aStart, aStop;
@@ -1128,7 +1183,7 @@
// try getting modification time from file
TTime timeStamp;
- TN_DEBUG2( "CThumbnailStore::StoreThumbnailL() timeStamp aModified %Ld", aModified );
+ TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) timeStamp aModified %Ld", aModified );
if( aModified )
{
@@ -1150,11 +1205,11 @@
if (timeErr != KErrNone)
{
- TN_DEBUG2( "CThumbnailStore::StoreThumbnailL() error getting timeStamp: %d", timeErr );
+ TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) error getting timeStamp: %d", timeErr );
}
else
{
- TN_DEBUG2( "CThumbnailStore::StoreThumbnailL() timeStamp iFs %Ld", timeStamp.Int64() );
+ TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) timeStamp iFs %Ld", timeStamp.Int64() );
}
}
@@ -1162,11 +1217,11 @@
{
// otherwise current time
timeStamp.UniversalTime();
- TN_DEBUG2( "CThumbnailStore::StoreThumbnailL() timeStamp current %Ld", timeStamp.Int64() );
+ TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) timeStamp current %Ld", timeStamp.Int64() );
}
}
- TN_DEBUG2( "CThumbnailStore::StoreThumbnailL() timeStamp set %Ld", timeStamp.Int64());
+ TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) timeStamp set %Ld", timeStamp.Int64());
paramIndex = stmt->ParameterIndex( KThumbnailSqlParamModified );
User::LeaveIfError( paramIndex );
@@ -1200,9 +1255,9 @@
TN_DEBUG2( "CThumbnailStore::THUMBSTORE-COUNTER----------, Thumbs = %d", iThumbCounter );
aStop.UniversalTime();
- TN_DEBUG2( "CThumbnailStore::StoreThumbnailL() insert to table %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000);
+ TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) insert to table %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000);
#endif
- TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( const TDes8& ) out" );
+ TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( private ) out" );
}
@@ -1216,7 +1271,7 @@
const TInt64 aModified, TBool aThumbFromPath, TBool aBlackListed )
{
TSize thumbSize = aThumbnail->SizeInPixels();
- TN_DEBUG4( "CThumbnailStore::StoreThumbnailL( CFbsBitmap ) aThumbnailSize = %d, aThumbnailSize(%d,%d) IN", aThumbnailSize, thumbSize.iWidth, thumbSize.iHeight );
+ TN_DEBUG4( "CThumbnailStore::StoreThumbnailL( public ) aThumbnailSize = %d, aThumbnailSize(%d,%d) IN", aThumbnailSize, thumbSize.iWidth, thumbSize.iHeight );
__ASSERT_DEBUG(( aThumbnail ), ThumbnailPanic( EThumbnailNullPointer ));
@@ -1226,7 +1281,7 @@
if(aThumbnailSize == ECustomThumbnailSize || aThumbnailSize == EUnknownThumbnailSize
|| thumbSize.iWidth <= 0 || thumbSize.iHeight <= 0 )
{
- TN_DEBUG1( "CThumbnailStore::StoreThumbnailL() not stored");
+ TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) not stored");
return;
}
@@ -1258,10 +1313,44 @@
if( (aThumbnailSize == EImageFullScreenThumbnailSize || aThumbnailSize == EVideoFullScreenThumbnailSize ||
aThumbnailSize == EAudioFullScreenThumbnailSize) && !aBlackListed )
{
+ TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) - encode jpg" );
+
HBufC8* data = NULL;
CleanupStack::PushL( data );
- CImageEncoder* encoder = CImageEncoder::DataNewL( data, KJpegMime(), CImageEncoder::EOptionAlwaysThread );
+ CImageEncoder* encoder = NULL;
+ TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::EHwImplementation, data, CImageEncoder::EOptionAlwaysThread ) );
+ if ( decErr != KErrNone )
+ {
+ TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - HW CExtJpegEncoder failed %d", decErr);
+
+ TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::ESwImplementation, data, CImageEncoder::EOptionAlwaysThread ) );
+ if ( decErr != KErrNone )
+ {
+ TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - SW CExtJpegEncoder failed %d", decErr);
+
+ TRAPD( decErr, encoder = CImageEncoder::DataNewL( data, KJpegMime(), CImageEncoder::EOptionAlwaysThread ) );
+ if ( decErr != KErrNone )
+ {
+ TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - CImageEncoder failed %d", decErr);
+
+ User::Leave(decErr);
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) - CImageEncoder created" );
+ }
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) - SW CExtJpegEncoder created" );
+ }
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) - HW CExtJpegEncoder created" );
+ }
+
CleanupStack::Pop( data );
CleanupStack::PushL( encoder );
@@ -1279,9 +1368,8 @@
User::LeaveIfError(frameImageData->AppendImageData(imageData));
CleanupStack::Pop( imageData );
-
#ifdef _DEBUG
- TN_DEBUG4( "CThumbnailStore::StoreThumbnailL() size %d x %d displaymode %d ",
+ TN_DEBUG4( "CThumbnailStore::StoreThumbnailL( public ) - size: %d x %d, displaymode: %d ",
aThumbnail->SizeInPixels().iWidth,
aThumbnail->SizeInPixels().iHeight,
aThumbnail->DisplayMode());
@@ -1295,7 +1383,9 @@
CleanupStack::PopAndDestroy( encoder );
if(request == KErrNone)
- {
+ {
+ TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) - encoding ok" );
+
CleanupStack::PushL( data );
TPtr8 ptr = data->Des();
StoreThumbnailL( *path, ptr, aThumbnail->SizeInPixels(),
@@ -1303,6 +1393,10 @@
aThumbnailSize, aModified, aThumbFromPath );
CleanupStack::Pop( data );
}
+ else
+ {
+ TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - encoding failed: %d", request.Int() );
+ }
delete data;
data = NULL;
@@ -1317,7 +1411,7 @@
StoreThumbnailL( *path, buf->Ptr( 0 ), aThumbnail->SizeInPixels(),
aOriginalSize, EThumbnailFormatFbsBitmap, flags,
- aThumbnailSize, aModified);
+ aThumbnailSize, aModified, aThumbFromPath);
CleanupStack::PopAndDestroy( buf );
}
@@ -1328,7 +1422,7 @@
CleanupStack::PopAndDestroy( path );
- TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( CFbsBitmap* ) out" );
+ TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) out" );
}
// ---------------------------------------------------------------------------
@@ -1553,7 +1647,6 @@
TInt found = KErrNotFound;
TInt rowStatus = 0;
TInt column = 0;
- TBool inTempTable = ETrue;
TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() -- TEMP TABLE lookup" );
@@ -1575,7 +1668,6 @@
if(rowStatus != KSqlAtRow)
{
TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() -- MAIN TABLE lookup" );
- inTempTable = EFalse;
CleanupStack::PopAndDestroy( stmt );
stmt = &iStmt_KThumbnailSelectInfoByPath;
@@ -1602,21 +1694,23 @@
// KErrNotFound to get thumbnail regenerated.
column = 4;
TInt flags = stmt->ColumnInt( column );
- if( flags & KThumbnailDbFlagBlacklisted && (*path).Length() )
+ if( flags & KThumbnailDbFlagDeleted )
{
- TBool modified = EFalse;
- CheckModifiedByPathL( aPath, inTempTable, modified );
- if( modified )
- {
- // Close db to get deletion of thumbnails executed.
- CleanupStack::PopAndDestroy( &stmt );
- DeleteThumbnailsL( *path );
- User::Leave( KErrNotFound );
- }
- else
- {
- User::Leave( KErrCompletion );
- }
+ CleanupStack::PopAndDestroy( stmt );
+
+ // delete existing blacklisted thumbs
+ DeleteThumbnailsL(*path, ETrue);
+
+ CleanupStack::PopAndDestroy( path );
+
+ User::Leave( KErrNotFound );
+ }
+ else if( flags & KThumbnailDbFlagBlacklisted )
+ {
+ CleanupStack::PopAndDestroy( stmt );
+ CleanupStack::PopAndDestroy( path );
+
+ User::Leave( KErrCompletion );
}
else if( !(flags & KThumbnailDbFlagBlacklisted) )
{
@@ -1799,19 +1893,40 @@
}
else
{
- TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- add to Deleted" );
+ TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- MAIN TABLE lookup" );
- // only add path to deleted table
- stmt = &iStmt_KThumbnailSqlInsertDeleted;
+ stmt = &iStmt_KThumbnailSqlSelectRowIDInfoByPath;
CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
-
+
paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
User::LeaveIfError( paramIndex );
User::LeaveIfError( stmt->BindText( paramIndex, *path ));
+
+ rowStatus = stmt->Next();
+
+ CleanupStack::PopAndDestroy( stmt );
- count = stmt->Exec();
+ // there were matching rows in main table
+ if (rowStatus == KSqlAtRow)
+ {
+ TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- add to Deleted" );
- CleanupStack::PopAndDestroy( stmt );
+ // only add path to deleted table
+ stmt = &iStmt_KThumbnailSqlInsertDeleted;
+ CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
+
+ paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
+ User::LeaveIfError( paramIndex );
+ User::LeaveIfError( stmt->BindText( paramIndex, *path ));
+
+ count = stmt->Exec();
+
+ CleanupStack::PopAndDestroy( stmt );
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- no thumbs in MAIN" );
+ }
}
if (aTransaction)
@@ -1937,6 +2052,7 @@
if(iBatchItemCount <= 0 || CheckDbState() != KErrNone)
{
// cache empty or db unusable
+ TN_DEBUG1( "CThumbnailStore::FlushCacheTable() error ");
return;
}
@@ -1949,7 +2065,9 @@
}
//set init max flush delay
- TInt aMaxFlushDelay(KMaxFlushDelay);
+ TReal32 aMaxFlushDelay(KMaxFlushDelay);
+ TReal32 aPreviousFlushDelay(iPreviousFlushDelay);
+ TReal32 aBatchFlushItemCount(iBatchFlushItemCount);
if(MPXHarvesting)
{
@@ -1961,16 +2079,24 @@
//1st item in batch
if( iBatchItemCount == 1)
{
+ TN_DEBUG2("CThumbnailStore::FlushCacheTable() calculate new batch size iPreviousFlushDelay = %d", iPreviousFlushDelay);
//adjust batch size dynamically between min and max based on previous flush speed
- if(iPreviousFlushDelay > 0 )
+ if( iPreviousFlushDelay > 0 )
{
- iBatchFlushItemCount = (aMaxFlushDelay/iPreviousFlushDelay)*iBatchFlushItemCount;
+ TReal32 aNewBatchFlushItemCount = aMaxFlushDelay / aPreviousFlushDelay * aBatchFlushItemCount;
+ iBatchFlushItemCount = (TInt)aNewBatchFlushItemCount;
+
+ TN_DEBUG2("CThumbnailStore::FlushCacheTable() aMaxFlushDelay %e", aMaxFlushDelay);
+ TN_DEBUG2("CThumbnailStore::FlushCacheTable() aPreviousFlushDelay %e", aPreviousFlushDelay);
+ TN_DEBUG2("CThumbnailStore::FlushCacheTable() aBatchFlushItemCount %e", aBatchFlushItemCount);
+ TN_DEBUG2("CThumbnailStore::FlushCacheTable() aNewBatchFlushItemCount %e", aNewBatchFlushItemCount);
+ TN_DEBUG2("CThumbnailStore::FlushCacheTable() iBatchFlushItemCount %d", iBatchFlushItemCount);
- if(iBatchFlushItemCount < KMInBatchItems)
+ if( iBatchFlushItemCount < KMInBatchItems )
{
iBatchFlushItemCount = KMInBatchItems;
}
- else if(iBatchFlushItemCount > KMaxBatchItems)
+ else if( iBatchFlushItemCount > KMaxBatchItems )
{
iBatchFlushItemCount = KMaxBatchItems;
}
@@ -2177,6 +2303,8 @@
// thumbmnail deletion
if (self->iDeleteThumbs)
{
+ TN_DEBUG1( "CThumbnailStore::MaintenanceTimerCallBack() - cleanup");
+
TInt deleteCount = 0;
// delete marked rows from database
@@ -2198,19 +2326,21 @@
// file existence check
else if (self->iCheckFilesExist)
{
+ TN_DEBUG1( "CThumbnailStore::MaintenanceTimerCallBack() - file existence check");
+
TBool finished = EFalse;
TRAPD( err, finished = self->FileExistenceCheckL() );
if (err != KErrNone)
{
- TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - file existance check failed, err %d", err);
+ TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - file existence check failed, err %d", err);
return err;
}
// all files checked.
if (finished)
{
- TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - file existance check finished, store %d", self->iDrive);
+ TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - file existence check finished, store %d", self->iDrive);
self->iCheckFilesExist = EFalse;
}
}
@@ -2218,10 +2348,13 @@
// next round
if (self->iIdle && ( self->iDeleteThumbs || self->iCheckFilesExist) )
{
+ TN_DEBUG1( "CThumbnailStore::MaintenanceTimerCallBack() - continue maintenance");
self->StartMaintenance();
}
else if (!self->iDeleteThumbs && !self->iCheckFilesExist)
{
+ TN_DEBUG1( "CThumbnailStore::MaintenanceTimerCallBack() - no more maintenance");
+
// no need to monitor activity anymore
self->iActivityManager->Cancel();
}
@@ -2288,9 +2421,9 @@
{
TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- timestamp is the same as original" );
}
- }
-
- rowStatus = stmt->Next();
+
+ rowStatus = stmt->Next();
+ }
//switch to main table if modified not found from temp
if(rowStatus != KSqlAtRow && !checkMain && !modifiedChanged)
@@ -2536,11 +2669,21 @@
void CThumbnailStore::StripDriveLetterL( TDes& aPath )
{
TInt pos = aPath.Find(KDrv);
+ TInt pos2 = aPath.Find(KBackSlash);
// if URI contains drive letter
if ( pos == 1 )
{
- aPath.Delete(0,pos+1);
+ // normal URI
+ if ( pos2 == 2 )
+ {
+ aPath.Delete(0,pos+1);
+ }
+ // virtual URI
+ else
+ {
+ aPath.Replace(0,2,KBackSlash);
+ }
}
}
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtask.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtask.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -113,9 +113,9 @@
{
iState = EComplete;
- if ( iMessage.Handle())
+ if ( ClientThreadAlive() )
{
- if(iMessage.Identity() == KDaemonUid )
+ if( iMessage.Identity() == KDaemonUid )
{
iProcessor.SetDaemonAsProcess(ETrue);
}
@@ -123,10 +123,12 @@
{
iProcessor.SetDaemonAsProcess(EFalse);
}
+
iMessage.Complete( CThumbnailServerSession::ConvertSqlErrToE32Err( aReason ));
- ResetMessageData();
}
+ ResetMessageData();
+
iProcessor.TaskComplete( this );
}
}
@@ -209,7 +211,6 @@
void CThumbnailTask::ResetMessageData()
{
iMessage = RMessage2();
- iRequestId = TThumbnailServerRequestId();
}
@@ -230,15 +231,12 @@
//
void CThumbnailTask::CancelMessage()
{
- if ( iMessage.Handle())
+ if ( ClientThreadAlive() )
{
- if ( ClientThreadAlive() )
- {
- iMessage.Complete( KErrCancel );
- }
-
- ResetMessageData();
+ iMessage.Complete( KErrCancel );
}
+
+ ResetMessageData();
}
// ---------------------------------------------------------------------------
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtaskprocessor.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtaskprocessor.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -183,6 +183,11 @@
TaskComplete(NULL);
}
+ if(!iTasks.Count())
+ {
+ iTasks.Compress();
+ }
+
TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTask() - remaining task count: %d", iTasks.Count());
return res;
@@ -351,13 +356,13 @@
}
}
- if ( processingDaemonTasksOnly && task->GetMessageData().Handle())
+ if ( processingDaemonTasksOnly && task->ClientThreadAlive() )
{
- if(task->GetMessageData().Identity() != KDaemonUid )
- {
- TN_DEBUG1( "CThumbnailTaskProcessor::RunL() processingDaemonTasksOnly = EFalse" );
- processingDaemonTasksOnly = EFalse;
- }
+ if(task->GetMessageData().Identity() != KDaemonUid )
+ {
+ TN_DEBUG1( "CThumbnailTaskProcessor::RunL() processingDaemonTasksOnly = EFalse" );
+ processingDaemonTasksOnly = EFalse;
+ }
}
}
}
--- a/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -25,6 +25,7 @@
CTMActivityManager* CTMActivityManager::NewL(MTMActivityManagerObserver* aObserver, TInt aTimeout)
{
TN_DEBUG1( "CTMActivityManager::NewL()");
+
CTMActivityManager* self = new (ELeave) CTMActivityManager(aObserver, aTimeout);
CleanupStack::PushL(self);
self->ConstructL();
@@ -40,6 +41,7 @@
: CActive(CActive::EPriorityHigh), iObserver(aObserver), iTimeout(aTimeout), iPreviousStatus(KErrNotFound)
{
TN_DEBUG1( "CTMActivityManager::CTMActivityManager()");
+
CActiveScheduler::Add(this);
}
@@ -50,11 +52,16 @@
CTMActivityManager::~CTMActivityManager()
{
TN_DEBUG1( "CTMActivityManager::~CTMActivityManager()");
+
+ iObserver = NULL;
+ Cancel();
+
#ifdef MONITOR_LIGHTS
delete iLight;
iLight = NULL;
#endif
- Cancel();
+
+ iTimer.Cancel();
iTimer.Close();
}
@@ -65,6 +72,7 @@
void CTMActivityManager::ConstructL()
{
TN_DEBUG1( "CTMActivityManager::ConstructL()");
+
iTimer.CreateLocal();
iWatch = ENone;
}
@@ -76,6 +84,7 @@
void CTMActivityManager::SetTimeout(TInt aTimeout)
{
TN_DEBUG1( "CTMActivityManager::SetTimeout()");
+
iTimeout = aTimeout;
Reset();
}
@@ -87,10 +96,12 @@
void CTMActivityManager::Reset()
{
TN_DEBUG1( "CTMActivityManager::Reset()");
+
#ifdef MONITOR_LIGHTS
delete iLight;
iLight = NULL;
#endif
+
Cancel();
Start();
}
@@ -101,6 +112,12 @@
void CTMActivityManager::DoCancel()
{
TN_DEBUG1( "CTMActivityManager::DoCancel()");
+
+#ifdef MONITOR_LIGHTS
+ delete iLight;
+ iLight = NULL;
+#endif
+
iTimer.Cancel();
iWatch = ENone;
}
@@ -279,6 +296,7 @@
void CTMActivityManager::NotifyObserver()
{
TN_DEBUG1( "void CTMAActivityManager::NotifyObserver()");
+
TBool status = IsInactive();
if( iPreviousStatus != status )
--- a/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmformatobserver.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmformatobserver.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -81,6 +81,7 @@
}
delete iBackupSession;
+ iBackupSession = NULL;
}
// ---------------------------------------------------------------------------
--- a/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmshutdownobserver.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmshutdownobserver.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -20,6 +20,7 @@
#include "tmshutdownobserver.h"
#include "thumbnailmanagerconstants.h"
+#include "thumbnaillog.h"
// ---------------------------------------------------------------------------
// CTMShutdownObserver::NewL()
@@ -60,19 +61,23 @@
//
void CTMShutdownObserver::ConstructL()
{
+ TN_DEBUG1( "CTMShutdownObserver::ConstructL()" );
// define P&S property types
if (iDefineKey)
{
+ TN_DEBUG1( "CTMShutdownObserver::ConstructL() define" );
RProperty::Define(iKeyCategory,iPropertyKey,
RProperty::EInt,KAllowAllPolicy,KPowerMgmtPolicy);
}
// attach to the property
TInt err = iProperty.Attach(iKeyCategory,iPropertyKey,EOwnerThread);
+ TN_DEBUG2( "CTMShutdownObserver::ConstructL() attach err = %d", err );
User::LeaveIfError(err);
// wait for the previously attached property to be updated
iProperty.Subscribe(iStatus);
+ TN_DEBUG1( "CTMShutdownObserver::ConstructL() subscribe" );
SetActive();
}
@@ -82,6 +87,7 @@
//
CTMShutdownObserver::~CTMShutdownObserver()
{
+ TN_DEBUG1( "CTMShutdownObserver::~CTMShutdownObserver()" );
Cancel();
iProperty.Close();
}
@@ -92,13 +98,16 @@
//
void CTMShutdownObserver::RunL()
{
+ TN_DEBUG2( "CTMShutdownObserver::RunL(%d)", iStatus.Int() );
// resubscribe before processing new value to prevent missing updates
iProperty.Subscribe(iStatus);
SetActive();
// retrieve the value
TInt value = 0;
- iProperty.Get(value);
+ TInt err = iProperty.Get(value);
+
+ TN_DEBUG2( "CTMShutdownObserver::RunL() Get err = %d", err );
// observer callback
if (value)
@@ -113,6 +122,7 @@
//
void CTMShutdownObserver::DoCancel()
{
+ TN_DEBUG1( "CTMShutdownObserver::DoCancel()" );
iProperty.Cancel();
}
--- a/imagehandlingutilities/thumbnailmanager/tmiadrestart/src/tmiadrestart.cpp Tue Jun 15 14:30:57 2010 +0100
+++ b/imagehandlingutilities/thumbnailmanager/tmiadrestart/src/tmiadrestart.cpp Thu Jul 22 16:37:07 2010 +0100
@@ -19,12 +19,14 @@
#include <e32base.h>
#include <e32std.h>
#include <e32property.h>
+#include "thumbnaillog.h"
#include "thumbnailmanagerconstants.h"
LOCAL_C void MainL()
{
// delay so that cenrep has time to read new config
+ TN_DEBUG1( "MainL() after" );
User::After(5000000);
TInt res( KErrNone );
@@ -32,50 +34,66 @@
TFullName name;
// find and terminate Thumb AG Daemon
+ TN_DEBUG1( "MainL() KTAGDaemonProcess find" );
TFindProcess findProcess( KTAGDaemonProcess );
+
if ( findProcess.Next(name) == KErrNone )
{
res = process.Open(name);
+ TN_DEBUG2( "MainL() KTAGDaemonProcess open res = %d", res );
// logon to get termination signal
TRequestStatus status;
+ TN_DEBUG1( "MainL() KTAGDaemonProcess logon" );
process.Logon(status);
-
+
// shutdown using P&S key
- RProperty::Set(KTAGDPSNotification,KShutdown,1);
-
+ TN_DEBUG2( "MainL() KTAGDaemonProcess Set = %d", res );
+ res = RProperty::Set(KTAGDPSNotification,KShutdown,1);
+
// blocks here until thread is terminated
- User::WaitForRequest(status);
+ TN_DEBUG1( "MainL() KTAGDaemonProcess wait" );
+ User::WaitForRequest(status);
// reset key
- RProperty::Set(KTAGDPSNotification,KShutdown,0);
+ TN_DEBUG1( "MainL() KTAGDaemonProcess reset" );
+ res = RProperty::Set(KTAGDPSNotification, KShutdown, 0);
+ TN_DEBUG1( "MainL() KTAGDaemonProcess close" );
process.Close();
}
// find and terminate Thumbnail Server
TFindProcess findProcess2( KThumbnailServerProcess );
+ TN_DEBUG1( "MainL() KThumbnailServerProcess find" );
if ( findProcess2.Next(name) == KErrNone )
{
res = process.Open(name);
-
+ TN_DEBUG2( "MainL() KThumbnailServerProcess open res = %d", res );
+
// logon to get termination signal
TRequestStatus status;
+ TN_DEBUG1( "MainL() KThumbnailServerProcess logon" );
process.Logon(status);
// shutdown using P&S key
- RProperty::Set(KTMPSNotification,KShutdown,1);
+ TN_DEBUG2( "MainL() KThumbnailServerProcess Set res = %d", res );
+ res = RProperty::Set(KTMPSNotification,KShutdown,1);
// blocks here until thread is terminated
- User::WaitForRequest(status);
+ TN_DEBUG1( "MainL() KThumbnailServerProcess wait" );
+ User::WaitForRequest(status);
// reset key
- RProperty::Set(KTMPSNotification,KShutdown,0);
-
+ TN_DEBUG2( "MainL() KThumbnailServerProcess reset res = %d", res );
+ res = RProperty::Set(KTMPSNotification, KShutdown, 0);
+
+ TN_DEBUG1( "MainL() KThumbnailServerProcess close" );
process.Close();
}
// delay just in case old daemon hasn't died yet
+ TN_DEBUG1( "MainL() after" );
User::After(2500000);
// start new ThumbAGDaemon
@@ -84,29 +102,38 @@
// Create the server process
// KNullDesC param causes server's E32Main() to be run
+ TN_DEBUG2( "MainL() KTAGDaemonExe create res = %d", res );
res = server.Create( KTAGDaemonExe, KNullDesC );
// try again 3 times if fails
while ( res != KErrNone)
{
+ TN_DEBUG1( "MainL() KTAGDaemonExe retry" );
if (retryCount > 2)
{
+ TN_DEBUG1( "MainL() KTAGDaemonExe retry > 2" );
return;
}
+ TN_DEBUG1( "MainL() after" );
User::After(2500000);
+ TN_DEBUG2( "MainL() KTAGDaemonExe create res = %d", res );
res = server.Create( KTAGDaemonExe, KNullDesC );
-
retryCount++;
}
// Process created successfully
TRequestStatus status;
+ TN_DEBUG1( "MainL() Rendezvous" );
server.Rendezvous( status );
+ TN_DEBUG1( "MainL() Resume" );
server.Resume(); // start it going
+
// Wait until the completion of the server creation
+ TN_DEBUG1( "MainL() wait" );
User::WaitForRequest( status );
+ TN_DEBUG1( "MainL() wait done" );
// Server created successfully
server.Close(); // we're no longer interested in the other process