--- a/mpxmusicplayer/commonui/bwinscw/mpxcommonuiU.DEF Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxmusicplayer/commonui/bwinscw/mpxcommonuiU.DEF Wed Oct 13 14:28:40 2010 +0300
@@ -57,5 +57,4 @@
?SetNeedSave@MPXTlsHelper@@SAXH@Z @ 56 NONAME ; void MPXTlsHelper::SetNeedSave(int)
??1CMPXLbxExtendedFeatures@@UAE@XZ @ 57 NONAME ; CMPXLbxExtendedFeatures::~CMPXLbxExtendedFeatures(void)
?SpeedNaviUpdating@CMPXLbxExtendedFeatures@@QAEXH@Z @ 58 NONAME ; void CMPXLbxExtendedFeatures::SpeedNaviUpdating(int)
- ?IsHostCalendarL@CMPXCommonUiHelper@@QAEHXZ @ 59 NONAME ; int CMPXCommonUiHelper::IsHostCalendarL(void)
--- a/mpxmusicplayer/commonui/eabi/mpxcommonuiU.DEF Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxmusicplayer/commonui/eabi/mpxcommonuiU.DEF Wed Oct 13 14:28:40 2010 +0300
@@ -67,5 +67,4 @@
_ZTI16CMPXAlbumArtUtil @ 66 NONAME
_ZTV13CMPXImageUtil @ 67 NONAME
_ZTV16CMPXAlbumArtUtil @ 68 NONAME
- _ZN18CMPXCommonUiHelper15IsHostCalendarLEv @ 69 NONAME
--- a/mpxmusicplayer/commonui/inc/mpxcommonui.hrh Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxmusicplayer/commonui/inc/mpxcommonui.hrh Wed Oct 13 14:28:40 2010 +0300
@@ -36,7 +36,6 @@
#define KMPXBrowserUid2 0x1020724D
#define KPodcastingAppUid 0x1028190B
#define KMPXCommonMailUid 0x2001E277
-#define KMPXCalendarUid 0x10005901
#endif // MPXCOMMONUI_HRH
--- a/mpxmusicplayer/commonui/src/mpxcommonuihelper.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxmusicplayer/commonui/src/mpxcommonuihelper.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -239,21 +239,6 @@
}
return ret;
}
-
-// ---------------------------------------------------------------------------
-// Check if the host application is calendar
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TBool CMPXCommonUiHelper::IsHostCalendarL()
-{
- TBool ret( EFalse );
- TInt hostUid = MPXTlsHelper::HostUid().iUid;
- if ( hostUid == KMPXCalendarUid)
- {
- ret = ETrue;
- }
- return ret;
-}
// ---------------------------------------------------------------------------
// Check if the host application is browser
--- a/mpxmusicplayer/commonui/src/mpxfilenamequerydlg.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxmusicplayer/commonui/src/mpxfilenamequerydlg.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -236,7 +236,6 @@
{
TKeyResponse response = EKeyWasNotConsumed;
// consume 'enter' so it won't acknowledge the dialog
-
TBool vkbOpen = EFalse;
CAknQueryControl* queryControl = QueryControl();
if ( queryControl )
--- a/mpxmusicplayer/group/bld.inf Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxmusicplayer/group/bld.inf Wed Oct 13 14:28:40 2010 +0300
@@ -46,6 +46,6 @@
mpxmusicplayerstub.sis /epoc32/data/z/system/install/mpxmusicplayerstub.sis
// Secure backup & restore
-backup_registration.xml z:/private/102072c3/backup_registration.xml
-
-
+backup_registration.xml /epoc32/release/winscw/urel/z/private/102072c3/backup_registration.xml
+backup_registration.xml /epoc32/release/winscw/udeb/z/private/102072c3/backup_registration.xml
+backup_registration.xml /epoc32/data/z/private/102072c3/backup_registration.xml
Binary file mpxmusicplayer/help/data/xhtml.zip has changed
--- a/mpxplugins/serviceplugins/collectionplugins/inc/mpxdbmanager.h Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/inc/mpxdbmanager.h Wed Oct 13 14:28:40 2010 +0300
@@ -254,6 +254,12 @@
* Checks if the spefified drive is a remove drive
*/
IMPORT_C TBool IsRemoteDrive(TDriveNumber aDrive);
+
+ /**
+ * Recreate a specified database file.
+ * @param aDrive identifies the drive index ro recreate the database
+ */
+ IMPORT_C void RecreateDatabaseFileL(TInt aDrive);
protected:
@@ -316,15 +322,6 @@
IMPORT_C void EnsureRamSpaceL() ;
/**
- * overloaded function for calls where string is allready formatted
- *
- * @param aQuery data base query string
- * @return RSqlStatement
- */
- IMPORT_C RSqlStatement ExecuteSelectQueryL( const TDesC& aQuery );
-
-
- /**
* Move DBs from RAMDisk to disks
*/
//IMPORT_C void BackupDBsL();
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/bwinscw/mpxsqlitedbcommonu.def Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/bwinscw/mpxsqlitedbcommonu.def Wed Oct 13 14:28:40 2010 +0300
@@ -126,5 +126,5 @@
?ExecuteSumQueryL@CMPXDbTable@@IAEHABVTDesC16@@@Z @ 125 NONAME ; int CMPXDbTable::ExecuteSumQueryL(class TDesC16 const &)
?ExecuteSumQueryL@CMPXDbTable@@IAEHABVTDesC16@@KK@Z @ 126 NONAME ; int CMPXDbTable::ExecuteSumQueryL(class TDesC16 const &, unsigned long, unsigned long)
?AddItemAlbumChangedMessageL@MPXDbCommonUtil@@SAXAAVCMPXMediaArray@@VTMPXItemId@@W4TMPXChangeEventType@@W4TMPXGeneralCategory@@IH1@Z @ 127 NONAME ; void MPXDbCommonUtil::AddItemAlbumChangedMessageL(class CMPXMediaArray &, class TMPXItemId, enum TMPXChangeEventType, enum TMPXGeneralCategory, unsigned int, int, class TMPXItemId)
- ?ExecuteSelectQueryL@CMPXDbManager@@QAE?AVRSqlStatement@@ABVTDesC16@@@Z @ 128 NONAME ; class RSqlStatement CMPXDbManager::ExecuteSelectQueryL(class TDesC16 const &)
+ ?RecreateDatabaseFileL@CMPXDbManager@@QAEXH@Z @ 128 NONAME ; void CMPXDbManager::RecreateDatabaseFileL(int)
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/eabi/mpxsqlitedbcommonu.def Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/eabi/mpxsqlitedbcommonu.def Wed Oct 13 14:28:40 2010 +0300
@@ -139,5 +139,5 @@
_ZTV12CMPXResource @ 138 NONAME
_ZTV13CMPXDbManager @ 139 NONAME
_ZN15MPXDbCommonUtil27AddItemAlbumChangedMessageLER14CMPXMediaArray10TMPXItemId19TMPXChangeEventType19TMPXGeneralCategoryjiS2_ @ 140 NONAME
- _ZN13CMPXDbManager19ExecuteSelectQueryLERK7TDesC16 @ 141 NONAME
+ _ZN13CMPXDbManager21RecreateDatabaseFileLEi @ 141 NONAME
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/src/mpxdbcommonutil.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/src/mpxdbcommonutil.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -329,8 +329,7 @@
extractPos = KMCPathStartPos; // c:\..., include first '\' of the path
}
- HBufC* fileNameBuf = HBufC::NewLC(aName.Length()+KMCIntegerLen);
- TPtr fileName(fileNameBuf->Des());
+ TBuf<KMaxFileName+KMCIntegerLen> fileName;
if( extractPos )
{
// append volume's unique Id to path to maintain uniqueness
@@ -358,7 +357,7 @@
TInt narrowFileLen(0);
TPtrC8 narrowFileName;
#if defined(_UNICODE)
- narrowFileLen = fileNameBuf->Des().Length() * 2;
+ narrowFileLen = fileName.Length() * 2;
narrowFileName.Set((TUint8*)fileName.Ptr(), narrowFileLen);
#else
narrowFileLen = fileName.Length();
@@ -376,9 +375,6 @@
TUint32 uniqueId(0);
uniqueId = aTableId << 28;
uniqueId |= (ptr[3]&0x0F)<<24 | (ptr[2]<<16) | (ptr[1]<<8) | ptr[0];
-
- CleanupStack::PopAndDestroy(fileNameBuf);
-
return uniqueId;
}
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/src/mpxdbmanager.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/src/mpxdbmanager.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -229,10 +229,12 @@
// transforms SQL error to KErrNotReady
if( (err <= KSqlErrGeneral && err >= KSqlErrNotDb) || err == KSqlErrStmtExpired )
{
+ MPX_DEBUG2("CMPXDbManager::DoBeginL - KErrNotReady, err=%d", err);
User::Leave(KErrNotReady);
}
else
{
+ MPX_DEBUG2("CMPXDbManager::DoBeginL, err=%d", err);
User::LeaveIfError(err);
}
}
@@ -2856,18 +2858,6 @@
#endif //__RAMDISK_PERF_ENABLE
}
-// ---------------------------------------------------------------------------
-// CMPXDbManager::ExecuteSelectQueryL
-// ---------------------------------------------------------------------------
-//
-EXPORT_C RSqlStatement CMPXDbManager::ExecuteSelectQueryL( const TDesC& aQuery )
- {
- MPX_FUNC("CMPXDatabase::ExecuteSelectQueryL( const TDesC& aQuery )");
- HBufC* tmp( aQuery.AllocLC() );
- RSqlStatement statement( ExecuteSelectQueryOnAllDrivesL( tmp->Des() ) );
- CleanupStack::PopAndDestroy(tmp);
- return statement;
- }
// ---------------------------------------------------------------------------
// CMPXDbManager::EnsureDiskSpaceL
@@ -3101,4 +3091,56 @@
return filename;
}
+// ----------------------------------------------------------------------------
+// Recreate a specified database file. Delete physical file first and then
+// recreate it
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbManager::RecreateDatabaseFileL(
+ TInt aDrive)
+ {
+ MPX_FUNC("CMPXDbManager::RecreateDatabaseFileL");
+ MPX_DEBUG2("CMPXDbManager::RecreateDatabaseFileL aDrive=%d", aDrive);
+
+ TInt index = KErrNotFound;
+
+ if (aDrive == EDriveC)
+ {
+ index = iDatabaseHandles.Count();
+ }
+ else
+ {
+ TInt count(iDatabaseHandles.Count());
+ for (TInt i = 0; i < count; ++i)
+ {
+ if ( iDatabaseHandles[i].iDrive == aDrive )
+ {
+ index = i;
+ break;
+ }
+ }
+ }
+ if ( index >= 0 )
+ {
+ TInt delErr = BaflUtils::DeleteFile(iFs,
+ *iDatabaseHandles[index].iOrigFullFilePath);
+ MPX_DEBUG2("CMPXDbManager::RecreateDatabaseFileL DeleteFile delErr=%d", delErr);
+ MPX_DEBUG2("CMPXDbManager::RecreateDatabaseFileL, iTargetFullFilePath = %s",
+ iDatabaseHandles[index].iTargetFullFilePath);
+ MPX_DEBUG2("CMPXDbManager::RecreateDatabaseFileL, iOrigFullFilePath = %s",
+ iDatabaseHandles[index].iOrigFullFilePath);
+ MPX_DEBUG2("CMPXDbManager::RecreateDatabaseFileL, index = %d", index);
+
+ User::LeaveIfError( delErr );
+
+ DoCreateDatabaseL( aDrive );
+ }
+ else
+ {
+ MPX_DEBUG2("CMPXDbManager::RecreateDatabaseFileL index = %d", index);
+ User::Leave(KErrNotFound);
+ }
+ }
+
+
// End of File
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxcollectiondbdef.h Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxcollectiondbdef.h Wed Oct 13 14:28:40 2010 +0300
@@ -28,13 +28,12 @@
// Db filename
#ifdef ABSTRACTAUDIOALBUM_INCLUDED
-_LIT(KMCDbFile, "mpxv3_2.db");
-_LIT(KMCDbFileEMMC, "mpxv3_2i.db");
+_LIT(KMCDbFile, "mpxv3_1.db");
+_LIT(KMCDbFileEMMC, "mpxv3_1i.db");
#else
-_LIT(KMCDbFile, "mpxv3_2n.db");
-_LIT(KMCDbFileEMMC, "mpxv3_2in.db");
+_LIT(KMCDbFile, "mpxv3_1n.db");
+_LIT(KMCDbFileEMMC, "mpxv3_1in.db");
#endif // ABSTRACTAUDIOALBUM_INCLUDED
-
// Collection Db resource file
_LIT(KMPXCollectionDbResourceFile, "mpxcollectiondbhgres.rsc");
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxcollectiondbstd.h Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxcollectiondbstd.h Wed Oct 13 14:28:40 2010 +0300
@@ -32,8 +32,8 @@
const TInt KDBPluginUid = 0x101FFC3A;
-const TInt KMPXMaxRecentlyPlayedSongs = 40;
-const TInt KMPXMaxMostPlayedSongs = 40;
+const TInt KMPXMaxRecentlyPlayedSongs = 20;
+const TInt KMPXMaxMostPlayedSongs = 20;
const TInt KMPXRecentlyAddedInterval = 7;
const TInt KMCMaxTextLen = 255; // Maximum field size for categories is 255
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbalbum.h Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbalbum.h Wed Oct 13 14:28:40 2010 +0300
@@ -29,6 +29,8 @@
class MMPXDbAlbumObserver
{
public:
+ virtual TInt HandleIsUnknownArtistL(TUint32 aId) = 0;
+ virtual HBufC* HandleArtistForAlbumL( const TUint32 aId ) = 0;
/**
* HandleAlbumartForAlbumL.
* @param aId, The album ID.
@@ -36,24 +38,6 @@
* @returns alternative albumart retrieved in the specified Album.
*/
virtual HBufC* HandleAlbumartForAlbumL( const TUint32 aId, TPtrC aArt ) = 0;
-
- /**
- * Called when album artist is removed from an album
- * @param aCategoryId category item ID
- * @param aDrive drive the category item is on
- * @param aItemChangedMessages changed mesages array to be updated or NULL
- */
- virtual void DeleteAlbumForArtistL(TUint32 aCategoryId,
- TInt aDrive, CMPXMessageArray* aItemChangedMessages) = 0;
-
- /**
- * Called when album artist is added to an album
- * @param aName name string
- * @param aArt Album art path
- * @param aDriveId drive to add the category to
- * @return the ID of the category item (new or existing)
- */
- virtual TUint32 AddAlbumArtistL(const TDesC& aName, const TDesC& aArt, TInt aDriveId) = 0;
};
/**
* Responsible for managing all music databases
@@ -74,7 +58,7 @@
*/
static CMPXDbAlbum* NewL(CMPXDbManager& aDbManager,
TMPXGeneralCategory aCategory, MMPXDbAlbumObserver& aObserver);
-
+
/**
* Two-phased constructor.
* @param aDbManager database manager to use for database interactions
@@ -83,18 +67,18 @@
*/
static CMPXDbAlbum* NewLC(CMPXDbManager& aDbManager,
TMPXGeneralCategory aCategory, MMPXDbAlbumObserver& aObserver);
-
+
/**
* Destructor
*/
virtual ~CMPXDbAlbum();
public:
+
/**
- * Add an album item. If the record already exists, its counter will
+ * Add a category item. If the record already exists, its counter will
* be incremented.
- * @param aCategory category type
- * @param aMedia: The media object
+ * @param aName: This is the name to be entered into the row
* @param aDriveId: The Drive Id the name (category) belongs
* @param aNewRecord: indicates to the caller if a new record is created.
* ETrue if a new row is created in the table; otherwise EFalse.
@@ -102,9 +86,9 @@
* into consideration when generating the unique row id
* @return The unique id of the row added.
*/
- virtual TUint32 AddItemL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia, TInt aDriveId, TBool& aNewRecord,
+ TUint32 AddItemL(const TDesC& aName, const TDesC& aArtistName, const TDesC& aArt, TInt aDriveId, TBool& aNewRecord,
TBool aCaseSensitive = ETrue);
-
+
/**
* Decrement the number of songs for the item. If the count gets to 0, remove
* the item.
@@ -118,52 +102,43 @@
* category was deleted
* @param aItemExist Out parameter, ETrue if the category is not deleted after the delete,
* EFalse otherwise
+ * @param aArtist: The ID of the artist
* @param aArt: The albumart uri
*/
- void DecrementSongsForAlbumL(TUint32 aId, TInt aDriveId,
- CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, const TDesC& aArt );
+ void DecrementSongsForCategoryL(TUint32 aId, TInt aDriveId,
+ CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, const TUint32 aArtist, const TDesC& aArt );
/**
- * Gets the details for all category items.
- * @param aAttrs attributes to be returned
- * @param aMediaArray returns the requested attributes for all items
- */
+ * Gets the details for all category items.
+ * @param aAttrs attributes to be returned
+ * @param aMediaArray returns the requested attributes for all items
+ */
void GetAllCategoryItemsL(const TArray<TMPXAttribute>& aAttrs,
CMPXMediaArray& aMediaArray);
- /**
- * Update a category item.
- * @param aId: The ID of the category to update
- * @param aMedia: The media data
- * @param aDriveId: The Drive Id the name (category) belongs
- * @param aItemChangedMessages: if valid on return contains a updated message if the
- * category was updated
- */
+ /**
+ * Update a category item.
+ * @param aId: The ID of the category to update
+ * @param aMedia: The media data
+ * @param aDriveId: The Drive Id the name (category) belongs
+ * @param aItemChangedMessages: if valid on return contains a updated message if the
+ * category was updated
+ */
void UpdateItemL(TUint32 aId, const CMPXMedia& aMedia, TInt aDriveId, CMPXMessageArray* aItemChangedMessages);
- public:
+ public:
/**
- * Get songs count for a specified album and a specified artist
- * @param aArtistId: The ID of the artist
- * @param aAlbumId: The ID of the album
- */
+ * Get albums count for a specified artist
+ * @param aId: The ID of the artist
+ */
+ TInt GetAlbumsCountForArtistL(TUint32 aArtistId);
+
+ /**
+ * Get songs count for a specified album and a specified artist
+ * @param aArtistId: The ID of the artist
+ * @param aAlbumId: The ID of the album
+ */
TInt GetSongsCountInAlbumMatchingArtistL(TUint32 aArtistId, TUint32 aAlbumId);
- /**
- * Check if the specified album ID is an unknown album.
- * An “Unknown album” is one where the album name and album artist are unknown.
- * @param aId: The ID of the album
- * @return ETrue if it's an unknown album
- */
- TBool IsUnknownAlbumL(const TUint32 aId);
-
- /**
- * Generate Unique ID for Album
- * @param aMedia media object
- * @param aCaseSensitive indicates whether case sensitivity should be taken
- * into consideration when generating the unique row id
- * @return the ID of album
- */
- TUint32 GenerateUniqueIdL(const CMPXMedia& aMedia);
private:
/**
@@ -184,7 +159,16 @@
*/
void GenerateAlbumFieldsValuesL(const CMPXMedia& aMedia,
CDesCArray& aFields, CDesCArray& aValues);
-
+
+
+ TBool IsUnknownArtistL(TUint32 aId);
+
+ /**
+ * Get the ArtistName of song which belongs to the specified Album.
+ * @param aId The ID of the album
+ * @returns alternative artistname retrieved in the specified Album.
+ */
+ HBufC* ArtistForAlbumL(const TUint32 aId);
/**
* Get the Albumart of song which belongs to the specified Album.
* @param aId The ID of the album
@@ -192,41 +176,7 @@
* @returns alternative albumart retrieved in the specified Album.
*/
HBufC* AlbumartForAlbumL(const TUint32 aId, TPtrC aArt);
-
- /**
- * Processes a recordset by constructing media instances and adding them
- * to the specified array.
- * @param aAttrs attributes to be returned
- * @param aRecordset recordset to be processed
- * @param aMediaArray returns the media instances
- */
- void ProcessAlbumRecordSetL(const TArray<TMPXAttribute>& aAttrs,
- RSqlStatement& aRecordset, CMPXMediaArray& aMediaArray);
-
- /**
- * Retrieve AlbumArtist name from media object
- * @param aMedia media object
- * @param aName returned name
- * @return ETrue if name is available
- */
- TBool RetrieveAlbumArtistL(const CMPXMedia& aMedia, TPtrC& aName);
- /**
- * Retrieve Artist name from media object
- * @param aMedia media object
- * @param aName returned name
- */
- void RetrieveArtist(const CMPXMedia& aMedia, TPtrC& aName);
-
- /**
- * Check if Art needs to be updated
- * @param aDeletedSongArt deleted song's art
- * @param aCurrentAlbumArt Album's current art
- * @return ETrue if aDeletedSongArt is not non-embedded album art and
- * aDeleteSongArt and aCurrentAlbumArt are the same and known
- */
- TBool NeedToUpdateArt(const TDesC& aDeletedSongArt, const TDesC& aCurrentAlbumArt);
-
private: // from MMPXTable
/**
@@ -247,7 +197,7 @@
* @param aCategory identifies the category
*/
CMPXDbAlbum(CMPXDbManager& aDbManager, TMPXGeneralCategory aCategory, MMPXDbAlbumObserver& aObserver);
-
+
/**
* Second phase constructor.
*/
@@ -261,20 +211,16 @@
enum TAlbumColumns
{
EAlbumUniqueId = KMPXTableDefaultIndex,
+ EAlbumArtistName,
EAlbumName,
EAlbumSongCount,
- EAlbumArtist,
- EAlbumArtistName,
EAlbumArt,
EAlbumFieldCount
};
private: // Data
MMPXDbAlbumObserver& iObserver;
- RPointerArray<CMPXMedia> iUnknownArtists;
- RPointerArray<CMPXMedia> iUnknownAlbums;
};
-
#endif // MPXDBALBUM_H
// End of File
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbartist.h Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbartist.h Wed Oct 13 14:28:40 2010 +0300
@@ -24,6 +24,11 @@
#include "mpxdbcategory.h"
// CLASS DECLARATION
+class MMPXDbArtistObserver
+ {
+ public:
+ virtual TInt HandleGetAlbumsCountForArtistL(TUint32 aId) = 0;
+ };
/**
* Responsible for managing all music databases
@@ -42,7 +47,7 @@
* @return New CMPXDbArtist instance.
*/
static CMPXDbArtist* NewL(CMPXDbManager& aDbManager,
- TMPXGeneralCategory aCategory);
+ TMPXGeneralCategory aCategory, MMPXDbArtistObserver& aObserver);
/**
* Two-phased constructor.
@@ -51,8 +56,8 @@
* @return New CMPXDbArtist instance on the cleanup stack.
*/
static CMPXDbArtist* NewLC(CMPXDbManager& aDbManager,
- TMPXGeneralCategory aCategory);
-
+ TMPXGeneralCategory aCategory, MMPXDbArtistObserver& aObserver);
+
/**
* Destructor
*/
@@ -60,16 +65,17 @@
public:
/**
- * Add a artist item. If the record already exists, its counter will
+ * Add a category item. If the record already exists, its counter will
* be incremented.
- * @param aCategory category type
- * @param aMedia: This is the media object
+ * @param aName: This is the name to be entered into the row
* @param aDriveId: The Drive Id the name (category) belongs
* @param aNewRecord: indicates to the caller if a new record is created.
* ETrue if a new row is created in the table; otherwise EFalse.
+ * @param aCaseSensitive indicates whether case sensitivity should be taken
+ * into consideration when generating the unique row id
* @return The unique id of the row added.
*/
- virtual TUint32 AddItemL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia, TInt aDriveId, TBool& aNewRecord,
+ TUint32 AddItemL(const TDesC& aName, const TDesC& aArt, TInt aDriveId, TBool& aNewRecord,
TBool aCaseSensitive = ETrue);
/**
@@ -88,54 +94,14 @@
* @param aItemChangedMessages: if valid on return contains a updated message if the
* category was updated
*/
- virtual void UpdateItemL(TUint32 aId, const CMPXMedia& aMedia, TInt aDriveId, CMPXMessageArray* aItemChangedMessages);
-
- /**
- * Decrement the number of songs for the item. If the song and album count gets to 0,
- * remove the item.
- * @param aId: The ID of the category to delete.
- * @param aDriveId: The drive Id the name (category) belongs to. Songs on different
- * drives may belong to the same album or artist; consequently, one
- * row for each artist/album id and drive ID pair will exist in the
- * lookup table with a count existing for each row that tracks the
- * number number of songs on that drive with that album/artist.
- * @param aItemChangedMessages if valid on return contains a deleted message if the
- * category was deleted
- * @param aItemExist Out parameter, ETrue if the category is not deleted after the delete,
- * EFalse otherwise
- */
-#ifdef ABSTRACTAUDIOALBUM_INCLUDED
- virtual void DecrementSongsForCategoryL(TUint32 aId, TInt aDriveId,
- CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, TBool aMtpInUse = EFalse);
-#else
- virtual void DecrementSongsForCategoryL(TUint32 aId, TInt aDriveId,
- CMPXMessageArray* aItemChangedMessages, TBool& aItemExist);
-#endif //ABSTRACTAUDIOALBUM_INCLUDED
+ void UpdateItemL(TUint32 aId, const CMPXMedia& aMedia, TInt aDriveId, CMPXMessageArray* aItemChangedMessages);
- /**
- * Add a AlbumArtist. If the record already exists, its counter will
- * be incremented.
- * @param aName: This is the name to be entered into the row
- * @param aArt: Album art
- * @param aDriveId: The Drive Id the name (category) belongs
- * @return The unique id of the row added.
+ /*
+ * Checks if the specified artist item is unknown
+ * @param aId identifies the artist item
+ * @return ETrue if it is unknown, EFalse otherwise
*/
- TUint32 AddAlbumArtistL(const TDesC& aName, const TDesC& aArt, TInt aDriveId);
-
- /**
- * Decrement the number of albums for the item. If the song and album count gets to 0,
- * remove the item.
- * @param aId: The ID of the category to delete.
- * @param aDriveId: The drive Id the name (category) belongs to. Songs on different
- * drives may belong to the same album or artist; consequently, one
- * row for each artist/album id and drive ID pair will exist in the
- * lookup table with a count existing for each row that tracks the
- * number number of songs on that drive with that album/artist.
- * @param aItemChangedMessages if valid on return contains a deleted message if the
- * category was deleted
- */
- void DecrementAlbumsForArtistL(TUint32 aId, TInt aDriveId,
- CMPXMessageArray* aItemChangedMessages);
+ TBool IsUnknownArtistL(TUint32 aId);
private:
@@ -157,16 +123,14 @@
*/
void GenerateArtistFieldsValuesL(const CMPXMedia& aMedia,
CDesCArray& aFields, CDesCArray& aValues);
-
+
/**
- * Gets the Songs count and Albums count for a Artist item
- * @param aDrivceId The Drive Id the name (category) belongs
+ * Gets the Album counts for a Artist item
* @param aId identifies the Artist item
- * @param aSongsCount songs count
- * @param aAlbumsCount albums count
+ * @return value of the Album counts
*/
- void GetSongsAndAlbumsCountL(TInt aDriveId, TUint32 aId, TInt& aSongsCount, TInt& aAlbumsCount);
-
+ TInt GetAlbumsCountL(TUint32 aId);
+
private: // from MMPXTable
/**
@@ -186,7 +150,7 @@
* @param aDbManager database manager to use for database interactions
* @param aCategory identifies the category
*/
- CMPXDbArtist(CMPXDbManager& aDbManager, TMPXGeneralCategory aCategory);
+ CMPXDbArtist(CMPXDbManager& aDbManager, TMPXGeneralCategory aCategory, MMPXDbArtistObserver& aObserver);
/**
* Second phase constructor.
@@ -203,12 +167,13 @@
EArtistUniqueId = KMPXTableDefaultIndex,
EArtistName,
EArtistSongCount,
- EArtistAlbumCount,
EArtistArt,
EArtistFieldCount
};
+
+ private: // Data
+ MMPXDbArtistObserver& iObserver;
};
-
#endif // MPXDBARTIST_H
// End of File
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbcategory.h Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbcategory.h Wed Oct 13 14:28:40 2010 +0300
@@ -53,8 +53,7 @@
/**
* Add a category item. If the record already exists, its counter will
* be incremented.
- * @param aCategory category type
- * @param aMedia: This is the media object to be entered into the row
+ * @param aName: This is the name to be entered into the row
* @param aDriveId: The Drive Id the name (category) belongs
* @param aNewRecord: indicates to the caller if a new record is created.
* ETrue if a new row is created in the table; otherwise EFalse.
@@ -62,9 +61,14 @@
* into consideration when generating the unique row id
* @return The unique id of the row added.
*/
- virtual TUint32 AddItemL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia, TInt aDriveId, TBool& aNewRecord,
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+ virtual TUint32 AddItemL(const TDesC& aName, TInt aDriveId, TBool& aNewRecord,
TBool aCaseSensitive = ETrue);
-
+#else
+ TUint32 AddItemL(const TDesC& aName, TInt aDriveId, TBool& aNewRecord,
+ TBool aCaseSensitive = ETrue);
+#endif // ABSTRACTAUDIOALBUM_INCLUDED
+
/**
* Get the name field for a given ID.
* @param aId identifies the category item
@@ -86,7 +90,7 @@
*/
void FindAllL(const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs,
CMPXMediaArray& aMediaArray);
-
+
/**
* Decrement the number of songs for the item. If the count gets to 0, remove
* the item.
@@ -105,7 +109,7 @@
virtual void DecrementSongsForCategoryL(TUint32 aId, TInt aDriveId,
CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, TBool aMtpInUse = EFalse);
#else
- virtual void DecrementSongsForCategoryL(TUint32 aId, TInt aDriveId,
+ void DecrementSongsForCategoryL(TUint32 aId, TInt aDriveId,
CMPXMessageArray* aItemChangedMessages, TBool& aItemExist);
#endif // ABSTRACTAUDIOALBUM_INCLUDED
/**
@@ -179,8 +183,8 @@
* @param aDriveId: The Drive Id the name (category) belongs
* @param aItemChangedMessages: if valid on return contains a updated message if the
* category was updated
- */
- virtual void UpdateItemL(TUint32 aId, const CMPXMedia& aMedia, TInt aDriveId, CMPXMessageArray* aItemChangedMessages);
+ */
+ void UpdateItemL(TUint32 aId, const CMPXMedia& aMedia, TInt aDriveId, CMPXMessageArray* aItemChangedMessages);
protected:
@@ -218,15 +222,6 @@
void ProcessRecordsetL(const TArray<TMPXAttribute>& aAttrs,
RSqlStatement& aRecordset, CMPXMediaArray& aMediaArray);
- private:
- /**
- * Retrieve name from media object based on category
- * @param aCategory the category to retrieve name
- * @param aMedia media object
- * @return name
- */
- TPtrC ItemNameL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia);
-
private: // from MMPXTable
/**
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbhandler.h Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbhandler.h Wed Oct 13 14:28:40 2010 +0300
@@ -65,6 +65,7 @@
class CMPXDbHandler :
public CBase,
public MMPXDbMusicObserver,
+ public MMPXDbArtistObserver,
public MMPXDbAlbumObserver,
public MMPXDbPlaylistObserver
{
@@ -663,6 +664,11 @@
void ReCreateDatabasesL();
/**
+ * Recreate a specified database file.
+ */
+ void RecreateDatabaseFileL( TInt aDrive );
+
+ /**
* Starts a refresh operation.
*/
void RefreshStartL();
@@ -1008,30 +1014,39 @@
private: // From MMPXDbMusicObserver
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
/**
* @see MMPXDbMusicObserver
*/
-#ifdef ABSTRACTAUDIOALBUM_INCLUDED
- virtual TUint32 AddAbstractAlbumItemL(const TDesC& aName,
- TInt aDriveId, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist,
- const TDesC& aUri, const TDesC& aAlbumArtist=KNullDesC);
-#endif // ABSTRACTAUDIOALBUM_INCLUDED
-
- virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia,
- TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist);
-
- virtual void UpdateCategoryItemL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
- const CMPXMedia& aMedia, TInt aDrive, CMPXMessageArray* aItemChangedMessages);
-
- virtual TUint32 GenerateUniqueIdForAlbumL(const CMPXMedia& aMedia);
-
- virtual TBool IsUnknownAlbumL(const TUint32 aId);
+ virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory,
+ const TDesC& aName,
+ TInt aDriveId,
+ CMPXMessageArray* aItemChangedMessages, TBool& aItemExist,
+ const TDesC& aUri,
+ const TDesC& aAlbumArtist=KNullDesC);
+#else
/**
* @see MMPXDbMusicObserver
*/
- virtual void DeleteSongForCategoryL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
- TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, const TDesC& aArt = KNullDesC);
+ virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory,
+ const TDesC& aName, TInt aDriveId,
+ CMPXMessageArray* aItemChangedMessages, TBool& aItemExist);
+#endif // ABSTRACTAUDIOALBUM_INCLUDED
+
+ virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName,
+ const TDesC& aArtistName, const TDesC& aArt,
+ TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist);
+
+ virtual void UpdateCategoryItemL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
+ const CMPXMedia& aMedia, TInt aDrive, CMPXMessageArray* aItemChangedMessages);
+
+ /**
+ * @see MMPXDbMusicObserver
+ */
+ virtual void DeleteSongForCategoryL(TMPXGeneralCategory aCategory,
+ TUint32 aCategoryId, TInt aDriveId, CMPXMessageArray* aItemChangedMessages,
+ TBool& aItemExist);
/**
* @see MMPXDbMusicObserver
@@ -1048,35 +1063,41 @@
*/
virtual HBufC* HandleGetAlbumNameFromIdL(TUint32 aId);
#endif // ABSTRACTAUDIOALBUM_INCLUDED
+ private: // From MMPXDbArtistObserver
+ /**
+ * @see MMPXDbArtistObser
+ */
+ virtual TInt HandleGetAlbumsCountForArtistL(TUint32 aArtistId);
+
+ private: // From MMPXDbAlbumObserver
+ /**
+ * @see MMPXDbAlbumObserver
+ */
+ virtual TBool HandleIsUnknownArtistL(TUint32 aArtistId);
+ /**
+ * Get the Artistname of song which belongs to the specified Album.
+ * @param aId, The Album ID.
+ * @returns alternative artistname retrieved in the specified Album.
+ */
+ virtual HBufC* HandleArtistForAlbumL(const TUint32 aAlbumId);
- private: // From MMPXDbAlbumObserver
- /**
- * Get the Albumart of song which belongs to the specified Album.
- * @param aId, The Album ID.
- * @param aArt, the AlbumArt uri.
- * @returns alternative albumart retrieved in the specified Album.
- */
- virtual HBufC* HandleAlbumartForAlbumL(const TUint32 aAlbumId, TPtrC aArt);
-
- /**
- * @see MMPXDbAlbumObserver
- */
- virtual void DeleteAlbumForArtistL(TUint32 aCategoryId,
- TInt aDrive, CMPXMessageArray* aItemChangedMessages);
-
- /**
- * @see MMPXDbAlbumObserver
- */
- virtual TUint32 AddAlbumArtistL(const TDesC& aName, const TDesC& aArt, TInt aDriveId);
+ /**
+ * Get the Albumart of song which belongs to the specified Album.
+ * @param aId, The Album ID.
+ * @param aArt, the AlbumArt uri.
+ * @returns alternative albumart retrieved in the specified Album.
+ */
+ virtual HBufC* HandleAlbumartForAlbumL(const TUint32 aAlbumId, TPtrC aArt);
private: // From MMPXDbPlaylistObserver
- /**
- * @see MMPXDbPlaylistObserver
- */
+ /**
+ * @see MMPXDbPlaylistObserver
+ */
virtual TInt HandlePlaylistDurationL(TUint32 aPlaylistId);
virtual void HandlePlaylistInfoL(TUint32 aPlaylistId, TInt& aCount, TInt& aDuration);
private:
+
/**
* C++ constructor.
* @param file session
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbmusic.h Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbmusic.h Wed Oct 13 14:28:40 2010 +0300
@@ -51,33 +51,37 @@
#ifdef ABSTRACTAUDIOALBUM_INCLUDED
/**
* Called when a new category item has to be added to a category table.
- * @param aName Abstract Album art name
+ * @param aCategory category type
+ * @param aName name string
* @param aDrive drive to add the category to
* @param aItemChangedMessages changed mesages array to be updated or NULL
* @param aItemExist Out parameter, ETrue if the item already exist before the add,
* EFalse otherwise
- * @param aUri Abstract Album art Uri
* @param aAlbumArtist AlbumArtist string
+ * @param aGenre Genre string
* @return the ID of the category item (new or existing)
*/
- virtual TUint32 AddAbstractAlbumItemL(const TDesC& aName,
- TInt aDriveId, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist,
- const TDesC& aUri, const TDesC& aAlbumArtist=KNullDesC) = 0;
-#endif // ABSTRACTAUDIOALBUM_INCLUDED
-
+ virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName,
+ TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, const TDesC& aAlbumArtist=KNullDesC,
+ const TDesC& aGenre=KNullDesC) = 0;
+#else
/**
* Called when a new category item has to be added to a category table.
* @param aCategory category type
- * @param aMedia media object
+ * @param aName name string
* @param aDrive drive to add the category to
* @param aItemChangedMessages changed mesages array to be updated or NULL
* @param aItemExist Out parameter, ETrue if the item already exist before the add,
* EFalse otherwise
* @return the ID of the category item (new or existing)
*/
- virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia,
+ virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName,
TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist) = 0;
-
+#endif // ABSTRACTAUDIOALBUM_INCLUDED
+ // for Album and Artist table
+ virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName,
+ const TDesC& aArtistName, const TDesC& aArt,
+ TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist) = 0;
/**
* Called when the ID of a category item changed for a Music record, for example when
* the artist name changed for a song. The implementation is supposed to update the
@@ -88,13 +92,9 @@
* @param aItemChangedMessages changed mesages array to be updated or NULL
* @param aItemExist Out parameter, ETrue if the category is not deleted after the delete,
* EFalse otherwise
- * @param aArt Art of the music record.
- * Art needs to be given so that the cateogry can switch over to different art
- * if necessary
- *
*/
virtual void DeleteSongForCategoryL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
- TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, const TDesC& aArt = KNullDesC) = 0;
+ TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist) = 0;
/**
* Called when the play count attribute of a song is changed. Should add an item changed
@@ -121,7 +121,6 @@
*/
virtual void UpdateCategoryItemL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
const CMPXMedia& aMedia, TInt aDrive, CMPXMessageArray* aItemChangedMessages) = 0;
-
#ifdef ABSTRACTAUDIOALBUM_INCLUDED
/**
* Get title from the Id
@@ -129,23 +128,7 @@
* @return name matching the ID
*/
virtual HBufC* HandleGetAlbumNameFromIdL( TUint32 aId ) = 0;
-#endif // ABSTRACTAUDIOALBUM_INCLUDED
-
- /**
- * Generate Unique ID for Album
- * @param aMedia media object
- * @param aCaseSensitive indicates whether case sensitivity should be taken
- * into consideration when generating the unique row id
- * @return the ID of album
- */
- virtual TUint32 GenerateUniqueIdForAlbumL(const CMPXMedia& aMedia) = 0;
-
- /**
- * Check if the specified album ID is Unknown album
- * @param aId: The ID of the album
- * @return ETrue if it's Unknown album
- */
- virtual TBool IsUnknownAlbumL(const TUint32 aId) = 0;
+#endif // ABSTRACTAUDIOALBUM_INCLUDED
};
/**
@@ -166,7 +149,7 @@
*/
static CMPXDbMusic* NewL(CMPXDbManager& aDbManager, CMPXResource& aResource,
MMPXDbMusicObserver& aObserver);
-
+
/**
* Two-phased constructor.
* @param aDbManager database manager to use for database interactions
@@ -175,7 +158,7 @@
*/
static CMPXDbMusic* NewLC(CMPXDbManager& aDbManager, CMPXResource& aResource,
MMPXDbMusicObserver& aObserver);
-
+
/**
* Destructor
*/
@@ -518,13 +501,11 @@
* @param aAttrs the attributes to include for the artist(s) matching the
* selection criteria
* @param aMediaArray returns the songs
- * @param aSortByTrackOrder if TRUE sorts tracks according to their track numbers,
- * if FALSE using track titles or filename
- */
+ */
void FindSongsL(TUint32 aGeneralId, TUint32 aContainerId, TMPXGeneralType aType,
const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs,
- CMPXMediaArray& aMediaArray, TBool aSortByTrackOrder = EFalse);
-
+ CMPXMediaArray& aMediaArray);
+
/**
* Returns the track count for a given drive
* @param aDrive drive
@@ -542,6 +523,12 @@
*/
void GetMusicUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
CDesCArray& aUriArr, TInt& aLastID);
+
+ /**
+ * Get the ID of Artist which belongs to the specified Album
+ * @param aId, the ID of Album
+ */
+ TUint32 ArtistForAlbumL(const TUint32 aId);
/**
* Get the Albumart of song which belongs to the specified Album
@@ -685,12 +672,13 @@
HBufC* ConstructUriL(RSqlStatement& aMusicTable);
/**
- * Checks if the specified category field (artist/genre/composer/abstractalbum)
+ * Checks if the specified category field (artist/album/genre/composer)
* will change and notifies the observer if so.
* @param aCategory identifies the category
* @param aMedia contains the new record attributes
* @param aAttribute corresponding attribute in the media parameter
- * @param aOldId the current category item ID
+ * @param aColumnIndex column index in the recordset
+ * @param aMusicTable current record in the music table or NULL if this is an insert
* @param aDriveId drive ID the update is for
* @param aItemChangedMessages item changed messages to append to
* @param aItemId returns the category item ID
@@ -698,25 +686,9 @@
*/
TBool UpdateCategoryFieldL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia,
const TMPXAttribute& aAttribute, TUint32 aOldId, TInt aDriveId,
- CMPXMessageArray* aItemChangedMessages, TUint32& aItemId, const TDesC& aArt = KNullDesC);
+ CMPXMessageArray* aItemChangedMessages, TUint32& aItemId);
/**
- * Checks if album will change and notifies the observer if so.
- * @param aMedia contains the new record attributes
- * @param aAttribute corresponding attribute in the media parameter
- * @param aOldId the current category item ID
- * @param aDriveId drive ID the update is for
- * @param aItemChangedMessages item changed messages to append to
- * @param aItemId returns the album item ID
- * @param aArt old art of the music record
- * @param aCaseSensitive indicates whether case sensitivity should be taken
- * @return ETrue if the field was modified
- */
- TBool UpdateCategoryFieldForAlbumL(const CMPXMedia& aMedia,
- const TMPXAttribute& aAttribute, TUint32 aOldId, TInt aDriveId,
- CMPXMessageArray* aItemChangedMessages, TUint32& aItemId, const TDesC& aArt = KNullDesC);
-
- /**
* Checks if extra attributes are required. The "standard attribute set includes:
* EMPXMediaGeneralId, EMPXMediaGeneralType, EMPXMediaGeneralCategory,
* EMPXMediaGeneralTitle, EMPXMediaGeneralUri, and EMPXMediaGeneralFlags
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbpluginqueries.h Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbpluginqueries.h Wed Oct 13 14:28:40 2010 +0300
@@ -145,14 +145,11 @@
_LIT(KQueryMusicGetRecentlyAdded, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND (julianday(Music.TimeAdded)>julianday('now','-7 days')) AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY Music.TimeAdded DESC");
*/
-
#ifdef ABSTRACTAUDIOALBUM_INCLUDED
_LIT(KQueryMusicGetAllSongsMinimum, "SELECT Music.UniqueId,Music.DbFlag,Music.VolumeId,Music.Title,0,Music.Art,Music.Deleted,Music.Location,0,0,'','',0,0,0,0,0,0,0,0,'','','',0,0,0,0,0,0,'',0,'',0,0,Artist.Name FROM :dbname.Music,:dbname.Artist WHERE Deleted=0 AND Music.Artist=Artist.UniqueId ORDER BY MUSIC.Title");
#else
_LIT(KQueryMusicGetAllSongsMinimum, "SELECT Music.UniqueId,Music.DbFlag,Music.VolumeId,Music.Title,0,Music.Art,Music.Deleted,Music.Location,0,0,'','',0,0,0,0,0,0,0,0,'','','',0,0,0,0,0,0,'',0,Artist.Name FROM :dbname.Music,:dbname.Artist WHERE Deleted=0 AND Music.Artist=Artist.UniqueId ORDER BY MUSIC.Title");
#endif
-
-
_LIT(KQueryMusicGetAllSongs, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 4");
_LIT(KQueryMusicGetSongsForArtist, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Artist=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 4");
_LIT(KQueryMusicGetSongsForAlbum, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Album=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 9, 4");
@@ -209,11 +206,11 @@
_LIT(KQueryMusicGetMusicUrisFrom, "SELECT UniqueId,Location FROM :dbname.Music WHERE Deleted=0 AND UniqueId > %u ORDER BY UniqueId ASC LIMIT %u");
_LIT(KQueryMusicCount, "SELECT count(*) FROM :dbname.Music WHERE Deleted=0");
-_LIT(KQueryMusicAlbum, "SELECT DISTINCT Album FROM :dbname.Music WHERE Deleted=0 AND Artist=%u ORDER BY Album"); // deprecated, not maintained
+_LIT(KQueryMusicAlbum, "SELECT DISTINCT Album FROM :dbname.Music WHERE Deleted=0 AND Artist=%u ORDER BY Album");
_LIT(KQueryMusicVolume, "SELECT VolumeId FROM :dbname.Music WHERE Deleted=0 AND UniqueId=%u");
_LIT(KQueryMusicVolumeAll, "SELECT VolumeId FROM :dbname.Music WHERE UniqueId=%u");
_LIT(KQueryMusicInfo, "SELECT * FROM :dbname.Music WHERE Deleted=0 AND UniqueId=%u");
-_LIT(KQueryOtherSongsInArtistAlbum, "SELECT count(*) FROM :dbname.Music WHERE Deleted=0 AND UniqueId<>%u AND Artist=%u AND Album=%u"); // deprecated, not maintained
+_LIT(KQueryOtherSongsInArtistAlbum, "SELECT count(*) FROM :dbname.Music WHERE Deleted=0 AND UniqueId<>%u AND Artist=%u AND Album=%u");
_LIT(KQueryMusicDurationAll, "SELECT sum(Duration) FROM :dbname.Music WHERE Deleted=0");
_LIT(KQueryMusicDurationArtist, "SELECT sum(Duration) FROM :dbname.Music WHERE Deleted=0 AND Artist=%u");
@@ -230,15 +227,15 @@
_LIT(KQueryMusicGetDurationRecentlyAdded, "SELECT Duration FROM :dbname.Music WHERE Deleted=0 AND (julianday(TimeAdded) > julianday('now','-7 days'))");
// Select songs information from music, playlistsongs and playlistsonginfo via playlistid order by playlistsongs's ordinal
-_LIT(KQueryMusicGetAllSongsbyPl,"select mu.UniqueId,mu.DbFlag,mu.VolumeId,mu.Title,mu.Artist,mu.Art,0,mu.Location,pl.UniqueId as PlUId, pl.ordinal from :dbname.music as mu,:pldbname.playlistsongs as pl where mu.Deleted=0 AND mu.uniqueid = pl.songid and pl.playlistid =%u ORDER BY 10"); // deprecated, not maintained
+_LIT(KQueryMusicGetAllSongsbyPl,"select mu.UniqueId,mu.DbFlag,mu.VolumeId,mu.Title,mu.Artist,mu.Art,0,mu.Location,pl.UniqueId as PlUId, pl.ordinal from :dbname.music as mu,:pldbname.playlistsongs as pl where mu.Deleted=0 AND mu.uniqueid = pl.songid and pl.playlistid =%u ORDER BY 10");
#ifdef ABSTRACTAUDIOALBUM_INCLUDED
_LIT(KQueryMusicGetAllSongsInfobyPl,"SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name,pl.UniqueId as PlUId,pl.ordinal FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer,:pldbname.playlistsongs as pl WHERE Music.Deleted=0 AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId AND Music.UniqueId=pl .songid and pl .PlaylistId=%u ORDER BY 40");
#else
_LIT(KQueryMusicGetAllSongsInfobyPl,"SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name,pl.UniqueId as PlUId,pl.ordinal FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer,:pldbname.playlistsongs as pl WHERE Music.Deleted=0 AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId AND Music.UniqueId=pl .songid and pl .PlaylistId=%u ORDER BY 37");
#endif
-_LIT(KQuerySongsInArtistAlbum, "SELECT count(*) FROM :dbname.Music WHERE Deleted=0 AND Artist=%u AND Album=%u"); /// not maintaned and known to be broken due to "album artist (compilation support)"
+_LIT(KQuerySongsInArtistAlbum, "SELECT count(*) FROM :dbname.Music WHERE Deleted=0 AND Artist=%u AND Album=%u");
+_LIT(KQueryMusicGetArtistForAlbum, "SELECT Artist FROM :dbname.Music,:dbname.Artist WHERE Music.Deleted=0 AND Music.Artist=Artist.UniqueId AND Music.Album=%u");
_LIT(KQueryMusicGetAlbumartForAlbum, "SELECT Art FROM :dbname.Music WHERE Music.Deleted=0 AND Music.Album=%u");
-
// == Category table queries ==================================================
//
_LIT(KCategoryTablePlaceholder, "##table##");
@@ -279,9 +276,9 @@
_LIT(KAuxiliaryDropTable,"DROP TABLE Auxiliary");
_LIT(KAuxiliaryCheckTable, "SELECT Id,Version,TimeRefreshed,TimeSynced,Corrupt,SaveDeletedRecordCount FROM AUXILIARY");
#ifdef ABSTRACTAUDIOALBUM_INCLUDED
-_LIT(KQueryAuxiliaryInsert, "INSERT INTO Auxiliary(Id,Version,Corrupt) VALUES(0,'6.8.0',%u)");
+_LIT(KQueryAuxiliaryInsert, "INSERT INTO Auxiliary(Id,Version,Corrupt) VALUES(0,'6.7.0',%u)");
#else
-_LIT(KQueryAuxiliaryInsert, "INSERT INTO Auxiliary(Id,Version,Corrupt) VALUES(0,'6.8.1',%u)");
+_LIT(KQueryAuxiliaryInsert, "INSERT INTO Auxiliary(Id,Version,Corrupt) VALUES(0,'6.7.1',%u)");
#endif // ABSTRACTAUDIOALBUM_INCLUDED
_LIT(KQueryAuxiliarySetTime, "UPDATE :dbname.Auxiliary SET TimeRefreshed='%S', Corrupt=0");
_LIT(KQueryAuxiliaryGetTime, "SELECT TimeRefreshed FROM :dbname.Auxiliary");
@@ -436,17 +433,17 @@
//
_LIT(KAlbumCreateTable,"CREATE TABLE Album("
L"UniqueId INTEGER PRIMARY KEY,"
+ L"ArtistName TEXT COLLATE NOCASE,"
L"Name TEXT COLLATE NOCASE,"
L"SongCount INTEGER,"
- L"Artist INTEGER,"
- L"ArtistName TEXT COLLATE NOCASE,"
- L"Art TEXT)");
+ L"Art TEXT)");
-_LIT(KAlbumCheckTable,"SELECT UniqueId,Name,SongCount,Artist,ArtistName,Art FROM Album");
+_LIT(KAlbumCheckTable,"SELECT UniqueId,ArtistName,Name,SongCount,Art FROM Album");
-_LIT(KQueryAlbumInsert, "INSERT INTO :dbname.Album(UniqueId,Name,SongCount,Artist,ArtistName,Art) VALUES(%u,'%S',%u,%u,'%S','%S')");
+_LIT(KQueryAlbumInsert, "INSERT INTO :dbname.Album(UniqueId,ArtistName,Name,SongCount,Art) VALUES(%u,'%S','%S',%u,'%S')");
_LIT(KQueryAlbumUpdate, "UPDATE :dbname.Album SET %S WHERE UniqueId=%u");
+_LIT(KQueryAlbumItem, "SELECT Album.*,Artist.Name FROM :dbname.Album,:dbname.Artist WHERE Album.Artist=Artist.UniqueId AND UniqueId=%u");
_LIT(KQueryAlbumAll, "SELECT Album.* FROM :dbname.Album ORDER BY ArtistName, Name");
_LIT(KCriterionArtistName, "ArtistName='%S'");
_LIT(KCriterionArt, "Art='%S'");
@@ -457,22 +454,16 @@
L"UniqueId INTEGER PRIMARY KEY,"
L"Name TEXT COLLATE NOCASE,"
L"SongCount INTEGER,"
- L"AlbumCount INTEGER,"
L"Art TEXT)");
-_LIT(KArtistCheckTable,"SELECT UniqueId,Name,SongCount,AlbumCount,Art FROM Artist");
+_LIT(KArtistCheckTable,"SELECT UniqueId,Name,SongCount,Art FROM Artist");
-_LIT(KQueryArtistInsert, "INSERT INTO :dbname.Artist(UniqueId,Name,SongCount,AlbumCount,Art) VALUES(%u,'%S',%u,%u,'%S')");
+_LIT(KQueryArtistInsert, "INSERT INTO :dbname.Artist(UniqueId,Name,SongCount,Art) VALUES(%u,'%S',%u,'%S')");
_LIT(KQueryArtistUpdate, "UPDATE :dbname.Artist SET %S WHERE UniqueId=%u");
-_LIT(KQueryArtistAll, "SELECT Artist.* FROM :dbname.Artist WHERE SongCount > 0 ORDER BY 2");
+_LIT(KQueryArtistAll, "SELECT Artist.* FROM :dbname.Artist ORDER BY 2");
_LIT(KQueryArtistName, "SELECT Artist.Name FROM :dbname.Artist WHERE UniqueId=%u");
-_LIT(KQueryArtistIncrementAlbumCount, "UPDATE :dbname.Artist SET AlbumCount=AlbumCount+1 WHERE UniqueId=%u");
-_LIT(KQueryArtistDecrementAlbumCount, "UPDATE :dbname.Artist SET AlbumCount=AlbumCount-1 WHERE UniqueId=%u");
-_LIT(KQueryArtistGetSongCountAndAlbumCount, "SELECT SongCount,AlbumCount FROM :dbname.Artist WHERE UniqueId=%u");
-_LIT(KQueryArtistItems, "SELECT * FROM :dbname.Artist WHERE %S AND SongCount > 0 ORDER BY Name ASC");
-
#ifdef ABSTRACTAUDIOALBUM_INCLUDED
// == AbstractAlbum table queries ==========================================
//
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbabstractalbum.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbabstractalbum.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -510,7 +510,7 @@
void CMPXDbAbstractAlbum::GetAllItemsWithNoSongL(RArray<TUint32>& aItemsIds)
{
MPX_FUNC("CMPXDbAbstractAlbum::GetAllItemsWithNoSongL");
- RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAbstractAlbumsWithNoSong()));
+ RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAbstractAlbumsWithNoSong));
CleanupClosePushL(recordset);
TInt err(KErrNone);
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbalbum.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbalbum.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -37,11 +37,6 @@
_LIT( KAbstractAlbumExt, ".alb" );
#endif // ABSTRACTAUDIOALBUM_INCLUDED
-_LIT( KAlbumAlbumArtistSeperator, "\t1");
-_LIT( KAlbumArtistSeperator, "\t2");
-
-const TInt KUnknownAlbumsGranularity = 250;
-
// ============================ MEMBER FUNCTIONS ==============================
// ----------------------------------------------------------------------------
@@ -84,9 +79,6 @@
CMPXDbAlbum::~CMPXDbAlbum()
{
MPX_FUNC("CMPXDbAlbum::~CMPXDbAlbum");
-
- iUnknownArtists.ResetAndDestroy();
- iUnknownAlbums.ResetAndDestroy();
}
// ----------------------------------------------------------------------------
@@ -98,9 +90,7 @@
TMPXGeneralCategory aCategory,
MMPXDbAlbumObserver& aObserver) :
CMPXDbCategory(aDbManager, aCategory),
- iObserver(aObserver),
- iUnknownArtists(KUnknownAlbumsGranularity),
- iUnknownAlbums(KUnknownAlbumsGranularity)
+ iObserver(aObserver)
{
MPX_FUNC("CMPXDbAlbum::CMPXDbAlbum");
}
@@ -121,81 +111,79 @@
// ----------------------------------------------------------------------------
//
TUint32 CMPXDbAlbum::AddItemL(
- TMPXGeneralCategory /*aCategory*/,
- const CMPXMedia& aMedia,
+ const TDesC& aName,
+ const TDesC& aArtistName,
+ const TDesC& aArt,
TInt aDriveId,
TBool& aNewRecord,
TBool aCaseSensitive)
{
MPX_FUNC("CMPXDbAlbum::AddItemL");
- TPtrC album(KNullDesC);
- TPtrC albumArtist(KNullDesC);
- TPtrC artist(KNullDesC);
- TPtrC albumArt(KNullDesC);
-
// try to find the item first
- TUint32 rowId(GenerateUniqueIdL(aMedia));
-
- // retrieve the existing record
- HBufC* query = PreProcessStringLC(KQueryCategoryItem);
- RSqlStatement recordset(
- iDbManager.ExecuteSelectQueryL(aDriveId, *query, rowId));
- CleanupStack::PopAndDestroy(query);
- CleanupClosePushL(recordset);
-
- TInt result = recordset.Next();
- if (result == KSqlAtEnd)
+ TUint32 rowId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), iCategory,
+ aName, aCaseSensitive));
+ aNewRecord = !CategoryItemExistsL(aDriveId, rowId);
+
+ if (aNewRecord)
+ {
+ // insert new
+ HBufC* query = PreProcessStringLC(KQueryAlbumInsert);
+ HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(aName);
+ HBufC* artistname = MPXDbCommonUtil::ProcessSingleQuotesLC(aArtistName);
+ HBufC* art = MPXDbCommonUtil::ProcessSingleQuotesLC(aArt);
+
+ iDbManager.ExecuteQueryL(aDriveId, *query, rowId, artistname, name, 1, art);
+
+ CleanupStack::PopAndDestroy(art);
+ CleanupStack::PopAndDestroy(artistname);
+ CleanupStack::PopAndDestroy(name);
+ CleanupStack::PopAndDestroy(query);
+ }
+ else
{
- aNewRecord = result;
-
- // check Album attribute
- if (aMedia.IsSupported(KMPXMediaMusicAlbum))
+ // retrieve the existing record
+ HBufC* query = NULL;
+ query = PreProcessStringLC(KQueryCategoryItem);
+ RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, rowId));
+ CleanupStack::PopAndDestroy(query);
+
+ CleanupClosePushL(recordset);
+
+ if (recordset.Next() != KSqlAtRow)
{
- album.Set(aMedia.ValueText(KMPXMediaMusicAlbum).Left(KMCMaxTextLen));
- }
-
- // check AlbumArt attirbute
- if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName))
+ User::Leave(KErrNotFound);
+ }
+
+ // Artist
+ TPtrC artistname(KNullDesC);
+ artistname.Set(MPXDbCommonUtil::GetColumnTextL(recordset, EAlbumArtistName));
+
+
+ // the current one is Unknown and the new one is Not Unknown.
+ if ( artistname == KNullDesC && aArtistName!= KNullDesC )
{
- albumArt.Set(aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen));
+ HBufC* artistnameReplaceSingleQuote =
+ MPXDbCommonUtil::ProcessSingleQuotesLC( aArtistName );
+ TPtrC criteria(KCriterionArtistName);
+ HBufC* setStr = HBufC::NewLC(criteria.Length() + artistnameReplaceSingleQuote->Length());
+ setStr->Des().Format( KCriterionArtistName, artistnameReplaceSingleQuote );
+
+ iDbManager.ExecuteQueryL(aDriveId, KQueryAlbumUpdate, setStr, rowId);
+ CleanupStack::PopAndDestroy(setStr);
+ CleanupStack::PopAndDestroy(artistnameReplaceSingleQuote);
+
}
- // insert new
- HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(album);
- TUint32 artistId(0);
- HBufC* artistName = NULL;
- if (RetrieveAlbumArtistL(aMedia, albumArtist))
- {
- artistId = iObserver.AddAlbumArtistL(albumArtist, albumArt, aDriveId);
- artistName = MPXDbCommonUtil::ProcessSingleQuotesLC(albumArtist);
- }
- else
- {
- RetrieveArtist(aMedia, artist);
- artistId = iObserver.AddAlbumArtistL(artist, albumArt, aDriveId);
- artistName = MPXDbCommonUtil::ProcessSingleQuotesLC(artist);
- }
-
- HBufC* art = MPXDbCommonUtil::ProcessSingleQuotesLC(albumArt);
-
- iDbManager.ExecuteQueryL(aDriveId, KQueryAlbumInsert, rowId, name, 1, artistId, artistName,art);
-
- CleanupStack::PopAndDestroy(art);
- CleanupStack::PopAndDestroy(artistName);
- CleanupStack::PopAndDestroy(name);
- }
- else if (result == KSqlAtRow)
- {
- // retrieve Art from Album table
+ // Album Art
TPtrC art(KNullDesC);
art.Set(MPXDbCommonUtil::GetColumnTextL(recordset, EAlbumArt));
// the current one is Unknown and the new one is Not Unknown
- if ( art == KNullDesC && albumArt != KNullDesC )
+ if ( art == KNullDesC && aArt != KNullDesC )
{
HBufC* artReplaceSingleQuote =
- MPXDbCommonUtil::ProcessSingleQuotesLC( albumArt );
+ MPXDbCommonUtil::ProcessSingleQuotesLC( aArt );
TPtrC criteria(KCriterionArt);
HBufC* setStr = HBufC::NewLC(criteria.Length() + artReplaceSingleQuote->Length());
@@ -206,57 +194,35 @@
CleanupStack::PopAndDestroy(artReplaceSingleQuote);
}
+ CleanupStack::PopAndDestroy(&recordset);
+
// increment the number of songs for the category
query = PreProcessStringLC(KQueryCategoryIncrementSongCount);
iDbManager.ExecuteQueryL(aDriveId, *query, rowId);
CleanupStack::PopAndDestroy(query);
- } // existing record
- else
- {
- MPX_DEBUG2("SQL error %d", result);
- User::Leave(result);
}
- CleanupStack::PopAndDestroy(&recordset);
-
return rowId;
}
// ----------------------------------------------------------------------------
-// CMPXDbAlbum::DecrementSongsForAlbumL
+// CMPXDbAlbum::DecrementSongsForCategoryL
// ----------------------------------------------------------------------------
//
-void CMPXDbAlbum::DecrementSongsForAlbumL(
+void CMPXDbAlbum::DecrementSongsForCategoryL(
const TUint32 aId,
TInt aDriveId,
CMPXMessageArray* aItemChangedMessages,
TBool& aItemExist,
- const TDesC& aArt)
+ const TUint32 aArtist,
+ const TDesC& aArt)
{
- MPX_FUNC("CMPXDbAlbum::DecrementSongsForAlbumL");
-
- // retrieve the existing record
- HBufC* query = PreProcessStringLC(KQueryCategoryItem);
- RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, aId));
- CleanupStack::PopAndDestroy(query);
-
- CleanupClosePushL(recordset);
-
- if (recordset.Next() != KSqlAtRow)
- {
- User::Leave(KErrNotFound);
- }
+ MPX_FUNC("CMPXDbAlbum::DecrementSongsForCategoryL");
// if just one song uses this category. Use <= just in case
- if (recordset.ColumnInt64(EAlbumSongCount) <= 1)
+ if (GetSongsCountL(aDriveId, aId) <= 1)
{
aItemExist = EFalse;
-
- // Decrement albums count on artist
- TUint32 albumArtistId = recordset.ColumnInt64(EAlbumArtist);
- iObserver.DeleteAlbumForArtistL(albumArtistId, aDriveId, aItemChangedMessages);
- CleanupStack::PopAndDestroy(&recordset);
-
// delete the category
DeleteCategoryL(aId, aDriveId);
@@ -271,10 +237,63 @@
{
aItemExist = ETrue;
+ // retrieve the existing record
+ HBufC* query = PreProcessStringLC(KQueryCategoryItem);
+ RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, aId));
+ CleanupStack::PopAndDestroy(query);
+
+ CleanupClosePushL(recordset);
+
+ if (recordset.Next() != KSqlAtRow)
+ {
+ User::Leave(KErrNotFound);
+ }
+
TBool itemModified = EFalse;
-
- TPtrC art(MPXDbCommonUtil::GetColumnTextL(recordset, EAlbumArt));
- if (NeedToUpdateArt(aArt, art))
+ TPtrC artistname(MPXDbCommonUtil::GetColumnTextL(recordset, EAlbumArtistName));
+ TUint32 artistId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXArtist,
+ artistname, ETrue);
+
+ // the current artist is equal to deleted song's artist
+ if ( artistId == aArtist )
+ {
+ HBufC* newArtistname = ArtistForAlbumL(aId);
+
+ CleanupStack::PushL(newArtistname);
+ if (newArtistname && newArtistname->CompareF(artistname)!=0)
+ {
+ HBufC* artistnameReplaceSingleQuote = MPXDbCommonUtil::ProcessSingleQuotesLC( *newArtistname );
+ TPtrC criteria(KCriterionArtistName);
+ HBufC* setStr = HBufC::NewLC(criteria.Length() + artistnameReplaceSingleQuote->Length());
+ setStr->Des().Format( KCriterionArtistName, artistnameReplaceSingleQuote );
+
+ iDbManager.ExecuteQueryL(aDriveId, KQueryAlbumUpdate, setStr, aId);
+ CleanupStack::PopAndDestroy(setStr);
+ CleanupStack::PopAndDestroy(artistnameReplaceSingleQuote);
+ itemModified = ETrue;
+ }
+ CleanupStack::PopAndDestroy(newArtistname);
+ }
+
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+ TBool nonEmbeddedArt = EFalse;
+ if (aArt.Length()>0)
+ {
+ TParsePtrC parse(aArt);
+ TPtrC ext(parse.Ext());
+ //set flag to false, so .alb will not overwrite art field in album, artist table
+ // when song with embedded art
+ if (ext.CompareF(KAbstractAlbumExt)== 0)
+ {
+ nonEmbeddedArt = ETrue;
+ }
+ }
+ if (!nonEmbeddedArt)
+ {
+#endif // ABSTRACTAUDIOALBUM_INCLUDED
+ TPtrC art(MPXDbCommonUtil::GetColumnTextL(recordset, EAlbumArt));
+ // the current art is equal to deleted song's art
+ if(aArt.Length()>0 && art.Length()>0 && aArt.CompareF(art) ==0 )
{
MPX_DEBUG2("AlbumArt of the Song to be deleted is [%S]", &aArt);
@@ -285,7 +304,7 @@
//update Album table only if alternative albumart found
if (newArt)
{
- MPX_DEBUG1("CMPXDbAlbum::DecrementSongsForAlbumL, get newArt");
+ MPX_DEBUG1("CMPXDbAlbum::DecrementSongsForCategoryL, get newArt");
HBufC* artReplaceSingleQuote = MPXDbCommonUtil::ProcessSingleQuotesLC( *newArt );
TPtrC criteria(KCriterionArt);
HBufC* setStr = HBufC::NewLC(criteria.Length() + artReplaceSingleQuote->Length());
@@ -296,15 +315,17 @@
CleanupStack::PopAndDestroy(artReplaceSingleQuote);
itemModified = ETrue;
}
- CleanupStack::PopAndDestroy(newArt);
- }
-
+ CleanupStack::PopAndDestroy(newArt);
+ }
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+ }
+#endif // ABSTRACTAUDIOALBUM_INCLUDED
if (aItemChangedMessages && itemModified)
- {
- // add the item changed message
- MPXDbCommonUtil::AddItemAlbumChangedMessageL(*aItemChangedMessages, aId, EMPXItemModified,
- EMPXAlbum, KDBPluginUid, ETrue, 0 );
- }
+ {
+ // add the item changed message
+ MPXDbCommonUtil::AddItemAlbumChangedMessageL(*aItemChangedMessages, aId, EMPXItemModified,
+ EMPXAlbum, KDBPluginUid, ETrue, 0 );
+ }
CleanupStack::PopAndDestroy(&recordset);
// decrement the number of songs for the category
@@ -324,16 +345,12 @@
{
MPX_FUNC("CMPXDbAlbum::GetAllCategoryItemsL");
- RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAlbumAll()));
+ HBufC* query = PreProcessStringLC(KQueryAlbumAll);
+ RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query));
+ CleanupStack::PopAndDestroy(query);
CleanupClosePushL(recordset);
- TRAPD(err, ProcessAlbumRecordSetL(aAttrs, recordset, aMediaArray));
- if (err != KErrNone)
- {
- iUnknownArtists.ResetAndDestroy();
- iUnknownAlbums.ResetAndDestroy();
- User::LeaveIfError(err);
- }
+ ProcessRecordsetL(aAttrs, recordset, aMediaArray);
CleanupStack::PopAndDestroy(&recordset);
}
@@ -374,6 +391,39 @@
}
// ----------------------------------------------------------------------------
+// CMPXDbAlbum::GetAlbumsCountForArtistL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbAlbum::GetAlbumsCountForArtistL(TUint32 aArtistId)
+ {
+ RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryCategorySubcategoryItems, aArtistId));
+
+ TInt prevId(0);
+ TInt count(0);
+ TInt err(KErrNone);
+
+ while ((err = recordset.Next()) == KSqlAtRow)
+ {
+ TUint32 rowId(recordset.ColumnInt64(EAlbumUniqueId));
+ if (prevId == rowId)
+ {
+ continue;
+ }
+
+ count++;
+ prevId = rowId;
+ }
+
+ if (err != KSqlAtEnd)
+ {
+ User::Leave(err);
+ }
+
+ return count;
+
+ }
+
+// ----------------------------------------------------------------------------
// CMPXDbAlbum::GetSongsCountInAlbumMatchingArtistL
// ----------------------------------------------------------------------------
//
@@ -435,7 +485,14 @@
{
MPX_DEBUG1(" EMPXMediaMusicArtist");
- TPtrC artistName(MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumArtistName));
+ TPtrC artistName(KNullDesC);
+
+ // if album is unknown, ignore arist name
+ if (MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName) != KNullDesC)
+ {
+ artistName.Set(MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumArtistName));
+ }
+
aMedia.SetTextValueL(KMPXMediaMusicArtist, artistName);
MPX_DEBUG2(" Artist[%S]", &artistName);
}
@@ -461,7 +518,14 @@
{
MPX_DEBUG1(" EMPXMediaMusicAlbumArtFileName");
- TPtrC art(MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumArt));
+ TPtrC art(KNullDesC);
+
+ // if album is unknown, ignore album art name
+ if (MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName) != KNullDesC)
+ {
+ art.Set(MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumArt));
+ }
+
aMedia.SetTextValueL(KMPXMediaMusicAlbumArtFileName, art);
MPX_DEBUG2(" Art[%S]", &art);
}
@@ -482,10 +546,34 @@
{
const TDesC& albumArtFilename = aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen);
MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArt, albumArtFilename);
- }
+ }
+
+ if (aMedia.IsSupported(KMPXMediaMusicArtist))
+ {
+ const TDesC& artistName = aMedia.ValueText(KMPXMediaMusicArtist).Left(KMCMaxTextLen);
+ MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCAlbumArtistName, artistName);
+ }
}
// ----------------------------------------------------------------------------
+// CMPXDbAlbum::IsUnknownArtistL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbAlbum::IsUnknownArtistL(TUint32 aId)
+ {
+ return iObserver.HandleIsUnknownArtistL(aId);
+ }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::ArtistForAlbumL
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbAlbum::ArtistForAlbumL(const TUint32 aId)
+ {
+ return iObserver.HandleArtistForAlbumL(aId);
+ }
+
+// ----------------------------------------------------------------------------
// CMPXDbAlbum::AlbumartForAlbumL
// ----------------------------------------------------------------------------
//
@@ -495,361 +583,6 @@
}
// ----------------------------------------------------------------------------
-// CMPXDbAlbum::ProcessAlbumRecordSetL
-// Unknown album or Unknown artist are stored in the database as NULL (Name field and ArtistName field).
-// The available unknown album is saved for later and will be appended to the array
-// as the last item among items which have the same artist.
-// The available unknown artists are saved for later and will be appended to the array
-// as the last items after all known artists are appended.
-// The unknown album and unknown artist is saved for later and will be appended to the array
-// as the last item.
-//
-// NOTE: putting unknown album to the end of the array only takes place when title
-// field is requested. normal sorting algorithm occurs if title isn't
-// requested.
-//
-// Example:
-// Album X of artist A
-// Album Y of artist A
-// Unknown album of artist A
-// Album X of artist B
-// Album Z of artist B
-// Unknown album of artist B
-// Album X of unknown artist
-// Album Y of unknown artist
-// Unknown album of unknown artist
-// ----------------------------------------------------------------------------
-//
-void CMPXDbAlbum::ProcessAlbumRecordSetL(
- const TArray<TMPXAttribute>& aAttrs,
- RSqlStatement& aRecordset,
- CMPXMediaArray& aMediaArray)
- {
- // populate the array
- TBool firstRecord(ETrue);
- CMPXMedia* unknownAlbumUnknownArtistMedia(NULL);
- CMPXMedia* unknownMedia(NULL);
- TUint32 prevId(0);
- TUint32 artistId(0);
- TUint32 prevArtistId(0);
- TInt count(0);
- TInt err(KErrNone);
-
- // Reset array for unknown artists
- if (iUnknownArtists.Count() > 0)
- {
- iUnknownArtists.ResetAndDestroy();
- }
-
- // Reset array for unknown albums
- if (iUnknownAlbums.Count() > 0)
- {
- iUnknownAlbums.ResetAndDestroy();
- }
-
- TInt pPath(0);
- if (aMediaArray.Count())
- {
- CMPXMedia* pMedia = aMediaArray[0];
- if (pMedia->IsSupported(KMPXMediaGeneralValue))
- { // Query excuted by OpenL
- pPath = pMedia->ValueTObjectL<TInt>(KMPXMediaGeneralValue);
- MPX_ASSERT(pPath);
- }
- }
-
- RArray<TMPXItemId> ids;
- CleanupClosePushL(ids);
-
- while ((err = aRecordset.Next()) == KSqlAtRow)
- {
- TUint32 rowId(aRecordset.ColumnInt64(EAlbumUniqueId));
- if (prevId == rowId)
- {
- continue;
- }
-
- prevId = rowId;
- CMPXMedia* media = CMPXMedia::NewL();
- CleanupStack::PushL(media);
-
- UpdateMediaL(aRecordset, aAttrs, *media);
-
- artistId = aRecordset.ColumnInt64(EAlbumArtist);
-
- // Append Known artist and Unknown albums
- count = iUnknownAlbums.Count();
- if (prevArtistId != artistId && count > 0)
- {
- unknownMedia = NULL;
-
- for (TInt i = 0; i < count; i++)
- {
- unknownMedia = iUnknownAlbums[i];
- if (unknownMedia->IsSupported(KMPXMediaGeneralId) && pPath)
- {
- ids.Append(unknownMedia->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
- }
- aMediaArray.AppendL(*unknownMedia);
- }
-
- iUnknownAlbums.ResetAndDestroy();
- }
-
- // for Unknown artist and Unknown album
- if (firstRecord && (MPXDbCommonUtil::GetColumnTextL(aRecordset, EAlbumName).Length() == 0) &&
- (MPXDbCommonUtil::GetColumnTextL(aRecordset, EAlbumArtistName).Length() == 0))
- {
- unknownAlbumUnknownArtistMedia = media;
- }
- // for Unknown artists and Known albums
- else if (MPXDbCommonUtil::GetColumnTextL(aRecordset, EAlbumArtistName).Length() == 0)
- {
- iUnknownArtists.Append(media);
- CleanupStack::Pop(media);
- }
- // for Known artist and Unknown album
- else if (MPXDbCommonUtil::GetColumnTextL(aRecordset, EAlbumName).Length() == 0)
- {
- iUnknownAlbums.Append(media);
- CleanupStack::Pop(media);
- prevArtistId = artistId;
- }
- else
- {
- if (media->IsSupported(KMPXMediaGeneralId) && pPath)
- {
- ids.AppendL(media->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
- }
- aMediaArray.AppendL(*media);
- CleanupStack::PopAndDestroy(media);
- }
-
- firstRecord = EFalse;
- } // end while
-
- if (err != KSqlAtEnd)
- {
- User::LeaveIfError(err);
- }
-
- // Append Known artist and Unknown albums
- count = iUnknownAlbums.Count();
- if ( count > 0)
- {
- unknownMedia = NULL;
-
- for (TInt i = 0; i < count; i++)
- {
- unknownMedia = iUnknownAlbums[i];
- if (unknownMedia->IsSupported(KMPXMediaGeneralId) && pPath)
- {
- ids.Append(unknownMedia->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
- }
- aMediaArray.AppendL(*unknownMedia);
- }
-
- iUnknownAlbums.ResetAndDestroy();
- }
-
- // Append Unknown artists to MediaArray
- count = iUnknownArtists.Count();
- if ( count > 0)
- {
- CMPXMedia* unknownMedia = NULL;
-
- for (TInt i = 0; i < count; i++)
- {
- unknownMedia = iUnknownArtists[i];
- if (unknownMedia->IsSupported(KMPXMediaGeneralId) && pPath)
- {
- ids.Append(unknownMedia->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
- }
- aMediaArray.AppendL(*unknownMedia);
- }
-
- iUnknownArtists.ResetAndDestroy();
- }
-
- // the last item in the list
- if (unknownAlbumUnknownArtistMedia)
- {
- if (unknownAlbumUnknownArtistMedia->IsSupported(KMPXMediaGeneralId) && pPath)
- {
- ids.AppendL(unknownAlbumUnknownArtistMedia->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
- }
- aMediaArray.AppendL(*unknownAlbumUnknownArtistMedia);
- CleanupStack::PopAndDestroy(unknownAlbumUnknownArtistMedia);
- }
-
- // Append ids to the returned path
- if (pPath)
- {
- ((CMPXCollectionPath*)pPath)->AppendL(ids.Array());
- }
- CleanupStack::PopAndDestroy(&ids);
- }
-
-// ----------------------------------------------------------------------------
-// CMPXDbAlbum::GenerateUniqueIdL
-// ----------------------------------------------------------------------------
-//
-TUint32 CMPXDbAlbum::GenerateUniqueIdL(const CMPXMedia& aMedia)
- {
- TPtrC album(KNullDesC);
- TPtrC albumArtist(KNullDesC);
- TPtrC artist(KNullDesC);
-
- // check Album attirbute
- if (aMedia.IsSupported(KMPXMediaMusicAlbum))
- {
- album.Set(aMedia.ValueText(KMPXMediaMusicAlbum).Left(KMCMaxTextLen));
- }
-
- HBufC* buf(NULL);
- if (RetrieveAlbumArtistL(aMedia, albumArtist))
- {
- buf = HBufC::NewLC(album.Length() + albumArtist.Length() + KAlbumAlbumArtistSeperator().Length());
-
- buf->Des().Append(album);
- buf->Des().Append(KAlbumAlbumArtistSeperator);
- buf->Des().Append(albumArtist);
- }
- else
- {
- RetrieveArtist(aMedia, artist);
-
- buf = HBufC::NewLC(album.Length() + artist.Length() + KAlbumArtistSeperator().Length());
-
- buf->Des().Append(album);
- buf->Des().Append(KAlbumArtistSeperator);
- buf->Des().Append(artist);
- }
-
- // try to find the item first
- TUint32 id(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXAlbum,
- *buf, ETrue));
- CleanupStack::PopAndDestroy(buf);
-
- return id;
- }
-
-// ----------------------------------------------------------------------------
-// CMPXDbAlbum::IsUnknownAlbumL
-// ----------------------------------------------------------------------------
-//
-TBool CMPXDbAlbum::IsUnknownAlbumL(const TUint32 aId)
- {
- HBufC* query = PreProcessStringLC(KQueryCategoryItem);
- RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, aId));
- CleanupStack::PopAndDestroy(query);
- CleanupClosePushL(recordset);
-
- if (recordset.Next() != KSqlAtRow)
- {
- User::Leave(KErrNotFound);
- }
-
- TPtrC album(MPXDbCommonUtil::GetColumnTextL(recordset, EAlbumName));
- TPtrC artistName(MPXDbCommonUtil::GetColumnTextL(recordset, EAlbumArtistName));
-
- TBool ret = EFalse;
- if (album.Length() == 0 || artistName.Length() == 0)
- {
- ret = ETrue;
- }
- else
- {
- ret = EFalse;
- }
-
- CleanupStack::PopAndDestroy(&recordset);
-
- return ret;
- }
-
-// ----------------------------------------------------------------------------
-// CMPXDbAlbum::RetrieveAlbumArtistL
-// ----------------------------------------------------------------------------
-//
-TBool CMPXDbAlbum::RetrieveAlbumArtistL(const CMPXMedia& aMedia, TPtrC& aName)
- {
- // check AlbumArtist attribute
- if (aMedia.IsSupported(KMPXMediaMusicAlbumArtist))
- {
- aName.Set(aMedia.ValueText(KMPXMediaMusicAlbumArtist).Left(KMCMaxTextLen));
- }
- else
- {
- aName.Set(KNullDesC);
- }
-
- if (aName.Length() > 0 )
- {
- return ETrue;
- }
- else
- {
- return EFalse;
- }
- }
-
-// ----------------------------------------------------------------------------
-// CMPXDbAlbum::RetrieveArtist
-// ----------------------------------------------------------------------------
-//
-void CMPXDbAlbum::RetrieveArtist(const CMPXMedia& aMedia, TPtrC& aName)
- {
- // check Artist attribute
- if (aMedia.IsSupported(KMPXMediaMusicArtist))
- {
- aName.Set(aMedia.ValueText(KMPXMediaMusicArtist).Left(KMCMaxTextLen));
- }
- else
- {
- aName.Set(KNullDesC);
- }
- }
-
-// ----------------------------------------------------------------------------
-// CMPXDbAlbum::NeedToUpdateArt
-// ----------------------------------------------------------------------------
-//
-TBool CMPXDbAlbum::NeedToUpdateArt(const TDesC& aDeletedSongArt, const TDesC& aCurrentAlbumArt)
- {
- if (aDeletedSongArt.Length() == 0)
- {
- // Deleted song's art has default album art
- return EFalse;
- }
-#ifdef ABSTRACTAUDIOALBUM_INCLUDED
- else
- if (aDeletedSongArt.Length() > 0)
- {
- TParsePtrC parse(aDeletedSongArt);
- TPtrC ext(parse.Ext());
- //set flag to false, so .alb will not overwrite art field in album, artist table
- // when song with embedded art
- if (ext.CompareF(KAbstractAlbumExt) == 0)
- {
- // Deleted song's art is Non-embedded album art
- return EFalse;
- }
- }
- else
-#endif
- if (aDeletedSongArt.Length() > 0 && aCurrentAlbumArt.Length() > 0 && aDeletedSongArt.CompareF(aCurrentAlbumArt) == 0)
- {
- // Deleted song's art is Embedded album art and it is the same as Album's current art
- return ETrue;
- }
- else
- {
- return EFalse;
- }
- }
-
-// ----------------------------------------------------------------------------
// CMPXDbAlbum::CreateTableL
// ----------------------------------------------------------------------------
//
@@ -860,7 +593,9 @@
MPX_FUNC("CMPXDbCategory::CreateTableL");
// create the table
- User::LeaveIfError(aDatabase.Exec(KAlbumCreateTable));
+ HBufC* query = PreProcessStringLC(KAlbumCreateTable);
+ User::LeaveIfError(aDatabase.Exec(*query));
+ CleanupStack::PopAndDestroy(query);
// do not create an index on the Name field
// as it only slows down the insert/update queries overall
@@ -875,7 +610,9 @@
{
MPX_FUNC("CMPXDbCategory::CheckTableL");
- TBool check(DoCheckTable(aDatabase, KAlbumCheckTable));
+ HBufC* query = PreProcessStringLC(KAlbumCheckTable);
+ TBool check(DoCheckTable(aDatabase, *query));
+ CleanupStack::PopAndDestroy(query);
return check;
}
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbartist.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbartist.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -42,11 +42,12 @@
//
CMPXDbArtist* CMPXDbArtist::NewL(
CMPXDbManager& aDbManager,
- TMPXGeneralCategory aCategory)
+ TMPXGeneralCategory aCategory,
+ MMPXDbArtistObserver& aObserver)
{
MPX_FUNC("CMPXDbArtist::NewL");
- CMPXDbArtist* self = CMPXDbArtist::NewLC(aDbManager, aCategory);
+ CMPXDbArtist* self = CMPXDbArtist::NewLC(aDbManager, aCategory, aObserver);
CleanupStack::Pop(self);
return self;
}
@@ -57,11 +58,12 @@
//
CMPXDbArtist* CMPXDbArtist::NewLC(
CMPXDbManager& aDbManager,
- TMPXGeneralCategory aCategory)
+ TMPXGeneralCategory aCategory,
+ MMPXDbArtistObserver& aObserver)
{
MPX_FUNC("CMPXDbArtist::NewLC");
- CMPXDbArtist* self = new (ELeave) CMPXDbArtist(aDbManager, aCategory);
+ CMPXDbArtist* self = new (ELeave) CMPXDbArtist(aDbManager, aCategory, aObserver);
CleanupStack::PushL(self);
self->ConstructL();
return self;
@@ -82,8 +84,10 @@
//
CMPXDbArtist::CMPXDbArtist(
CMPXDbManager& aDbManager,
- TMPXGeneralCategory aCategory) :
- CMPXDbCategory(aDbManager, aCategory)
+ TMPXGeneralCategory aCategory,
+ MMPXDbArtistObserver& aObserver) :
+ CMPXDbCategory(aDbManager, aCategory),
+ iObserver(aObserver)
{
MPX_FUNC("CMPXDbArtist::CMPXDbArtist");
}
@@ -104,63 +108,58 @@
// ----------------------------------------------------------------------------
//
TUint32 CMPXDbArtist::AddItemL(
- TMPXGeneralCategory /*aCategory*/,
- const CMPXMedia& aMedia,
+ const TDesC& aName,
+ const TDesC& aArt,
TInt aDriveId,
TBool& aNewRecord,
TBool aCaseSensitive)
{
MPX_FUNC("CMPXDbArtist::AddItemL");
- TPtrC artist(KNullDesC);
- TPtrC albumArt(KNullDesC);
-
- if (aMedia.IsSupported(KMPXMediaMusicArtist))
- {
- artist.Set(aMedia.ValueText(KMPXMediaMusicArtist).Left(KMCMaxTextLen));
- }
-
- if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName))
- {
- albumArt.Set(aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen));
- }
-
// try to find the item first
TUint32 rowId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), iCategory,
- artist, aCaseSensitive));
+ aName, aCaseSensitive));
+ aNewRecord = !CategoryItemExistsL(aDriveId, rowId);
- HBufC* query = PreProcessStringLC(KQueryCategoryItem);
- RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aDriveId, *query, rowId));
- CleanupStack::PopAndDestroy(query);
- CleanupClosePushL(recordset);
-
- TInt result(recordset.Next());
- if (result == KSqlAtEnd)
+ if (aNewRecord)
{
- aNewRecord = result;
-
// insert new
- HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(artist);
- HBufC* art = MPXDbCommonUtil::ProcessSingleQuotesLC(albumArt);
+ HBufC* query = PreProcessStringLC(KQueryArtistInsert);
+ HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(aName);
+ HBufC* art = MPXDbCommonUtil::ProcessSingleQuotesLC(aArt);
- iDbManager.ExecuteQueryL(aDriveId, KQueryArtistInsert, rowId, name, 1, 0, art);
+ iDbManager.ExecuteQueryL(aDriveId, *query, rowId, name, 1, art);
CleanupStack::PopAndDestroy(art);
CleanupStack::PopAndDestroy(name);
+ CleanupStack::PopAndDestroy(query);
}
- else if (result == KSqlAtRow)
+ else
{
- // retrieve Art from Artist table
+ // retrieve the existing record
+ HBufC* query = NULL;
+ query = PreProcessStringLC(KQueryCategoryItem);
+ RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, rowId));
+ CleanupStack::PopAndDestroy(query);
+
+ CleanupClosePushL(recordset);
+
+ if (recordset.Next() != KSqlAtRow)
+ {
+ User::Leave(KErrNotFound);
+ }
+
+ // Album Art
TPtrC art(KNullDesC);
art.Set(MPXDbCommonUtil::GetColumnTextL(recordset, EArtistArt));
// the current one is Unknown and the new one is Not Unknown
- if ( art == KNullDesC && albumArt != KNullDesC )
+ if ( art == KNullDesC && aArt != KNullDesC )
{
HBufC* artReplaceSingleQuote =
- MPXDbCommonUtil::ProcessSingleQuotesLC( albumArt );
+ MPXDbCommonUtil::ProcessSingleQuotesLC( aArt );
_LIT( KFormatArt, "Art=\'%S\'" );
- HBufC* setStr = HBufC::NewLC(KMaxFileName);
+ HBufC* setStr = HBufC::NewLC(256);
setStr->Des().Format( KFormatArt, artReplaceSingleQuote );
iDbManager.ExecuteQueryL(aDriveId, KQueryArtistUpdate, setStr, rowId);
@@ -168,68 +167,35 @@
CleanupStack::PopAndDestroy(artReplaceSingleQuote);
}
+ CleanupStack::PopAndDestroy(&recordset);
+
// increment the number of songs for the category
query = PreProcessStringLC(KQueryCategoryIncrementSongCount);
iDbManager.ExecuteQueryL(aDriveId, *query, rowId);
CleanupStack::PopAndDestroy(query);
}
- else
- {
- MPX_DEBUG2("SQL error %d", result);
- User::Leave(result);
- }
-
- CleanupStack::PopAndDestroy(&recordset);
-
+
return rowId;
}
-
+
// ----------------------------------------------------------------------------
-// CMPXDbArtist::DecrementSongsForCategoryL
+// CMPXDbArtist::IsUnknownArtistL
// ----------------------------------------------------------------------------
//
-void CMPXDbArtist::DecrementSongsForCategoryL(
- const TUint32 aId,
- TInt aDriveId,
- CMPXMessageArray* aItemChangedMessages,
- TBool& aItemExist
-#ifdef ABSTRACTAUDIOALBUM_INCLUDED
- ,
- TBool /*aMTPInUse*/
-#endif //ABSTRACTAUDIOALBUM_INCLUDED
- )
+TBool CMPXDbArtist::IsUnknownArtistL(TUint32 aId)
{
- MPX_FUNC("CMPXDbArtist::DecrementSongsForCategoryL");
-
- TInt songsCount(0);
- TInt albumsCount(0);
-
- GetSongsAndAlbumsCountL(aDriveId, aId, songsCount, albumsCount);
-
- MPX_DEBUG4("id %d, songsCount %d, albumsCount %d", aId, songsCount, albumsCount);
-
- // if just one song uses this category. Use <= just in case
- if (songsCount <= 1 && albumsCount == 0)
- {
- aItemExist = EFalse;
- // delete the category
- DeleteCategoryL(aId, aDriveId);
+ MPX_FUNC("CMPXDbArtist::IsUnknownArtistL");
+
+ HBufC* name = GetNameL(aId);
- if (aItemChangedMessages)
- {
- // add the item changed message
- MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aId, EMPXItemDeleted,
- iCategory, KDBPluginUid);
- }
- }
- else if (songsCount > 0)
- {
- aItemExist = ETrue;
- // decrement the number of songs for the category
- HBufC* query = PreProcessStringLC(KQueryCategoryDecrementSongCount);
- iDbManager.ExecuteQueryL(aDriveId, *query, aId);
- CleanupStack::PopAndDestroy(query);
- }
+ TInt ret = EFalse;
+ if (*name == KNullDesC)
+ {
+ ret = ETrue;
+ }
+ delete name;
+
+ return ret;
}
// ----------------------------------------------------------------------------
@@ -271,6 +237,10 @@
}
if (attributeId & EMPXMediaGeneralCount)
{
+// TInt albumCount = GetAlbumsCountL(aRecord.ColumnInt64(EArtistUniqueId));
+// aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount,albumCount);
+// MPX_DEBUG1(" EMPXMediaGeneralCount");
+// MPX_DEBUG2(" AlbumCount[%d]", albumCount);
// get songs count from all drives
TInt songCount = GetSongsCountL( KDbManagerAllDrives,
aRecord.ColumnInt64( EArtistUniqueId ) );
@@ -311,6 +281,17 @@
}
// ----------------------------------------------------------------------------
+// CMPXDbArtist::GetAlbumsCountL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbArtist::GetAlbumsCountL(TUint32 aId)
+ {
+ MPX_FUNC("CMPXDbArtist::GetAlbumsCountL");
+
+ return iObserver.HandleGetAlbumsCountForArtistL(aId);
+ }
+
+// ----------------------------------------------------------------------------
// CMPXDbArtist::GetAllCategoryItemsL
// ----------------------------------------------------------------------------
//
@@ -319,7 +300,9 @@
CMPXMediaArray& aMediaArray)
{
MPX_FUNC("CMPXDbArtist::GetAllCategoryItemsL");
- RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryArtistAll()));
+ HBufC* query = PreProcessStringLC(KQueryArtistAll);
+ RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query));
+ CleanupStack::PopAndDestroy(query);
CleanupClosePushL(recordset);
ProcessRecordsetL(aAttrs, recordset, aMediaArray);
CleanupStack::PopAndDestroy(&recordset);
@@ -360,169 +343,37 @@
CleanupStack::PopAndDestroy(values);
CleanupStack::PopAndDestroy(fields);
}
-
// ----------------------------------------------------------------------------
-// CMPXDbArtist::AddAlbumArtistL
-// ----------------------------------------------------------------------------
-//
-TUint32 CMPXDbArtist::AddAlbumArtistL(
- const TDesC& aName,
- const TDesC& aArt,
- TInt aDriveId)
- {
- MPX_FUNC("CMPXDbArtist::AddAlbumArtistL");
-
- // try to find the item first
- TUint32 rowId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), iCategory,
- aName, ETrue));
- HBufC* query = PreProcessStringLC(KQueryCategoryItem);
- RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aDriveId, *query, rowId));
- CleanupStack::PopAndDestroy(query);
- CleanupClosePushL(recordset);
-
- TInt result(recordset.Next());
- if (result == KSqlAtEnd)
- {
- // insert new
- HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(aName);
- HBufC* art = MPXDbCommonUtil::ProcessSingleQuotesLC(aArt);
-
- iDbManager.ExecuteQueryL(aDriveId, KQueryArtistInsert, rowId, name, 0, 1, art);
-
- CleanupStack::PopAndDestroy(art);
- CleanupStack::PopAndDestroy(name);
- }
- else if (result == KSqlAtRow)
- {
- // retrieve Art from Artist table
- TPtrC art(KNullDesC);
- art.Set(MPXDbCommonUtil::GetColumnTextL(recordset, EArtistArt));
-
- // the current one is Unknown and the new one is Not Unknown
- if ( art == KNullDesC && aArt != KNullDesC )
- {
- HBufC* artReplaceSingleQuote =
- MPXDbCommonUtil::ProcessSingleQuotesLC( aArt );
- _LIT( KFormatArt, "Art=\'%S\'" );
- HBufC* setStr = HBufC::NewLC(KMaxFileName);
- setStr->Des().Format( KFormatArt, artReplaceSingleQuote );
-
- iDbManager.ExecuteQueryL(aDriveId, KQueryArtistUpdate, setStr, rowId);
- CleanupStack::PopAndDestroy(setStr);
- CleanupStack::PopAndDestroy(artReplaceSingleQuote);
- }
-
- // increment the number of songs for the category
- iDbManager.ExecuteQueryL(aDriveId, KQueryArtistIncrementAlbumCount, rowId);
- }
- else
- {
- MPX_DEBUG2("SQL error %d", result);
- User::Leave(result);
- }
-
- CleanupStack::PopAndDestroy(&recordset);
-
- return rowId;
- }
-
-// ----------------------------------------------------------------------------
-// CMPXDbArtist::DecrementAlbumsForArtistL
-// ----------------------------------------------------------------------------
-//
-void CMPXDbArtist::DecrementAlbumsForArtistL(
- const TUint32 aId,
- TInt aDriveId,
- CMPXMessageArray* aItemChangedMessages
- )
- {
- MPX_FUNC("CMPXDbArtist::DecrementAlbumsForCategoryL");
-
- TInt songsCount(0);
- TInt albumsCount(0);
-
- GetSongsAndAlbumsCountL(aDriveId, aId, songsCount, albumsCount);
-
- MPX_DEBUG4("id %d, songsCount %d, albumsCount %d", aId, songsCount, albumsCount);
-
- // if just one album uses this category. Use <= just in case
- if (songsCount == 0 && albumsCount <= 1)
- {
- // delete the category
- DeleteCategoryL(aId, aDriveId);
-
- if (aItemChangedMessages)
- {
- // add the item changed message
- MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aId, EMPXItemDeleted,
- iCategory, KDBPluginUid);
- }
- }
- else if (albumsCount > 0)
- {
- // decrement the number of albums for the category
- iDbManager.ExecuteQueryL(aDriveId, KQueryArtistDecrementAlbumCount, aId);
- }
- }
-
-// ----------------------------------------------------------------------------
-// CMPXDbArtist::GetSongsAndAlbumsCountL
-// ----------------------------------------------------------------------------
-//
-void CMPXDbArtist::GetSongsAndAlbumsCountL(
- TInt aDriveId,
- TUint32 aId,
- TInt& aSongCount,
- TInt& aAlbumCount)
- {
- MPX_FUNC("CMPXDbArtist::GetSongsAndAlbumsCountL");
-
- RSqlStatement recordset(
- iDbManager.ExecuteSelectQueryL(aDriveId, KQueryArtistGetSongCountAndAlbumCount, aId));
- CleanupClosePushL(recordset);
-
- TInt err(KErrNone);
- while ((err = recordset.Next()) == KSqlAtRow)
- {
- aSongCount += recordset.ColumnInt(KMPXTableDefaultIndex);
- aAlbumCount += recordset.ColumnInt(KMPXTableDefaultIndex+1);
- }
-
- if (err != KSqlAtEnd)
- {
- User::Leave(err);
- }
-
- CleanupStack::PopAndDestroy(&recordset);
- }
-
-// ----------------------------------------------------------------------------
-// CMPXDbArtist::CreateTableL
+// CMPXDbAlbum::CreateTableL
// ----------------------------------------------------------------------------
//
void CMPXDbArtist::CreateTableL(
RSqlDatabase& aDatabase,
TBool /* aCorruptTable */)
{
- MPX_FUNC("CMPXDbArtist::CreateTableL");
+ MPX_FUNC("CMPXDbCategory::CreateTableL");
// create the table
- User::LeaveIfError(aDatabase.Exec(KArtistCreateTable));
+ HBufC* query = PreProcessStringLC(KArtistCreateTable);
+ User::LeaveIfError(aDatabase.Exec(*query));
+ CleanupStack::PopAndDestroy(query);
// do not create an index on the Name field
// as it only slows down the insert/update queries overall
}
// ----------------------------------------------------------------------------
-// CMPXDbArtist::CheckTableL
+// CMPXDbAlbum::CheckTableL
// ----------------------------------------------------------------------------
//
TBool CMPXDbArtist::CheckTableL(
RSqlDatabase& aDatabase)
{
- MPX_FUNC("CMPXDbArtist::CheckTableL");
+ MPX_FUNC("CMPXDbCategory::CheckTableL");
- TBool check(DoCheckTable(aDatabase, KArtistCheckTable));
+ HBufC* query = PreProcessStringLC(KArtistCheckTable);
+ TBool check(DoCheckTable(aDatabase, *query));
+ CleanupStack::PopAndDestroy(query);
return check;
}
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbauxiliary.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbauxiliary.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -111,7 +111,7 @@
{
MPX_FUNC("CMPXDbAuxiliary::LastRefreshedTimeL");
- RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAuxiliaryGetTime()));
+ RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAuxiliaryGetTime));
CleanupClosePushL(recordset);
if (recordset.Next() != KSqlAtRow)
@@ -195,7 +195,7 @@
TBool refreshed(ETrue);
- RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAuxiliaryGetTime()));
+ RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAuxiliaryGetTime));
CleanupClosePushL(recordset);
TInt count(0);
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbcategory.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbcategory.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -30,7 +30,6 @@
#include "mpxdbpluginqueries.h"
#include "mpxdbutil.h"
#include "mpxdbcategory.h"
-#include "mpxmediamusicdefs.h"
// CONSTANTS
@@ -80,26 +79,23 @@
// ----------------------------------------------------------------------------
//
TUint32 CMPXDbCategory::AddItemL(
- TMPXGeneralCategory aCategory,
- const CMPXMedia& aMedia,
+ const TDesC& aName,
TInt aDriveId,
TBool& aNewRecord,
TBool aCaseSensitive)
{
MPX_FUNC("CMPXDbCategory::AddItemL");
- TPtrC itemName(ItemNameL(aCategory, aMedia));
-
// try to find the item first
TUint32 rowId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), iCategory,
- itemName, aCaseSensitive));
+ aName, aCaseSensitive));
aNewRecord = !CategoryItemExistsL(aDriveId, rowId);
if (aNewRecord)
{
// insert new
HBufC* query = PreProcessStringLC(KQueryCategoryInsert);
- HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(itemName);
+ HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(aName);
iDbManager.ExecuteQueryL(aDriveId, *query, rowId, name, 1);
@@ -116,7 +112,7 @@
return rowId;
}
-
+
// ----------------------------------------------------------------------------
// CMPXDbCategory::GetNameL
// ----------------------------------------------------------------------------
@@ -244,37 +240,20 @@
}
// construct criteria string
- HBufC* criteriaStr = NULL;
- if (criteriaArray->Count() > 0)
- {
- criteriaStr = MPXDbCommonUtil::StringFromArrayLC(*criteriaArray, KMCAndKeyword);
- }
- else
- {
- _LIT(KCriteriaTrue, "1");
- criteriaStr = KCriteriaTrue().AllocLC();
- }
-
- RSqlStatement recordset;
- if (iCategory == EMPXArtist)
- {
- recordset = iDbManager.ExecuteSelectQueryL(KQueryArtistItems, criteriaStr);
- CleanupStack::PopAndDestroy(2, criteriaArray); //criteriaStr, criteriaArray
- }
- else
- {
- HBufC* query = PreProcessStringLC(KQueryCategoryItems);
- recordset = iDbManager.ExecuteSelectQueryL(*query, criteriaStr);
- CleanupStack::PopAndDestroy(3, criteriaArray); //query, criteriaStr, criteriaArray
- }
+ HBufC* criteriaStr = MPXDbCommonUtil::StringFromArrayLC(*criteriaArray, KMCAndKeyword);
+ // either get all items or items filtered based on criteria
+ HBufC* query = PreProcessStringLC(criteriaStr->Length() ?
+ KQueryCategoryItems() : KQueryCategoryAll());
+ RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, criteriaStr));
+ CleanupStack::PopAndDestroy(3, criteriaArray); // query, criteriaStr, criteriaArray
CleanupClosePushL(recordset);
// process the results
ProcessRecordsetL(aAttrs, recordset, aMediaArray);
CleanupStack::PopAndDestroy(&recordset);
}
-
+
// ----------------------------------------------------------------------------
// CMPXDbCategory::DecrementSongsForCategoryL
// ----------------------------------------------------------------------------
@@ -507,9 +486,7 @@
TInt /*aDriveId*/,
CMPXMessageArray* /*aItemChangedMessages*/)
{
- MPX_FUNC("CMPXDbCategory::UpdateItemL");
-
- // do nothing
+ // nothing
}
// ----------------------------------------------------------------------------
@@ -597,7 +574,7 @@
// ----------------------------------------------------------------------------
// CMPXDbCategory::ProcessRecordsetL
-// Unknown item is stored in the database as empty string (name field). This ensures the
+// Unknown item is stored in the database as NULL (name field). This ensures the
// unknown item to be the 1st found record if it exists. This will save time in
// searching for the unknown record among the results and avoid performing
// descriptor comparison. If the 1st record is the unknown item, it won't be
@@ -689,46 +666,6 @@
}
// ----------------------------------------------------------------------------
-// CMPXDbCategory::ItemNameL
-// ----------------------------------------------------------------------------
-//
-TPtrC CMPXDbCategory::ItemNameL(
- TMPXGeneralCategory aCategory,
- const CMPXMedia& aMedia)
- {
- MPX_FUNC("CMPXDbCategory::ItemNameL");
-
- TMPXAttribute attribute;
- switch(aCategory)
- {
- case EMPXGenre:
- {
- attribute = KMPXMediaMusicGenre;
- break;
- }
- case EMPXComposer:
- {
- attribute = KMPXMediaMusicComposer;
- break;
- }
- default:
- {
- User::Leave(KErrArgument);
- break;
- }
- }
-
- if (aMedia.IsSupported(attribute))
- {
- return aMedia.ValueText(attribute).Left(KMCMaxTextLen);
- }
- else
- {
- return KNullDesC();
- }
- }
-
-// ----------------------------------------------------------------------------
// CMPXDbCategory::CreateTableL
// ----------------------------------------------------------------------------
//
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbhandler.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbhandler.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -174,7 +174,7 @@
//
iDbMusic = CMPXDbMusic::NewL(*iDbManager, iResource, *this);
iDbPlaylist = CMPXDbPlaylist::NewL(*iDbManager, *this);
- iDbArtist = CMPXDbArtist::NewL(*iDbManager, EMPXArtist);
+ iDbArtist = CMPXDbArtist::NewL(*iDbManager, EMPXArtist, *this);
iDbAlbum = CMPXDbAlbum::NewL(*iDbManager, EMPXAlbum, *this);
iDbGenre = CMPXDbGenre::NewL(*iDbManager, EMPXGenre);
iDbComposer = CMPXDbComposer::NewL(*iDbManager, EMPXComposer);
@@ -987,18 +987,18 @@
{
MPX_DEBUG1(" EMPXMediaGeneralCount");
- attributes.AppendL(TMPXAttribute(KMPXMediaIdGeneral, attributeId & ~EMPXMediaGeneralCount));
+ attributes.Append(TMPXAttribute(KMPXMediaIdGeneral, attributeId & ~EMPXMediaGeneralCount));
tryGetSongCount = ETrue;
break;
}
- attributes.AppendL(aAttrs[i]);
+ attributes.Append(aAttrs[i]);
}
for (TInt j = i+1; j < attrCount; j++)
{
- attributes.AppendL(aAttrs[j]);
+ attributes.Append(aAttrs[j]);
}
iDbAlbum->GetSubCategoryItemsL(EMPXArtist, aArtistId, attributes.Array(), aMediaArray);
CleanupStack::PopAndDestroy(&attributes);
@@ -1519,6 +1519,18 @@
}
// ----------------------------------------------------------------------------
+// Re-create a specified database file
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::RecreateDatabaseFileL( TInt aDrive )
+ {
+ MPX_FUNC("CMPXDbHandler::RecreateDatabaseFileL");
+ MPX_DEBUG2( "CMPXDbHandler::RecreateDatabaseFileL drive: %i", aDrive );
+ iDbManager->RecreateDatabaseFileL( aDrive );
+ }
+
+
+// ----------------------------------------------------------------------------
// Set handler refresh status
// ----------------------------------------------------------------------------
//
@@ -2148,7 +2160,7 @@
// Update the category records
TBool categoryExist( EFalse );
iDbArtist->DecrementSongsForCategoryL(artistID, drive, &aItemChangedMessages, categoryExist);
- iDbAlbum->DecrementSongsForAlbumL(albumID, drive, &aItemChangedMessages, categoryExist, *art);
+ iDbAlbum->DecrementSongsForCategoryL(albumID, drive, &aItemChangedMessages, categoryExist, artistID, *art);
iDbGenre->DecrementSongsForCategoryL(genreID, drive, &aItemChangedMessages, categoryExist);
iDbComposer->DecrementSongsForCategoryL(composerID, drive, &aItemChangedMessages, categoryExist);
CleanupStack::PopAndDestroy(art);
@@ -2551,16 +2563,7 @@
//////////////////////////////////////////////////////////////////////
else
{
- TBool sortByTrackOrder = EFalse;
-
- // construct the sort order depending on category. Albums are always sorted by track,
- // then name, except for unknown album. Songs are sorted by name for unknown album.
- // NULL track number is stored as KMaxTInt so that they will be sorted to the end
- if ((type == EMPXGroup) && (MPX_ITEM_CATEGORY(id) == EMPXAlbum) && !iDbAlbum->IsUnknownAlbumL(id))
- {
- sortByTrackOrder = ETrue;
- }
- iDbMusic->FindSongsL(id, containerId, type, aCriteria, aAttrs, aMediaArray, sortByTrackOrder);
+ iDbMusic->FindSongsL(id, containerId, type, aCriteria, aAttrs, aMediaArray);
}
}
@@ -3046,63 +3049,103 @@
#endif // RD_MULTIPLE_DRIVE
// ----------------------------------------------------------------------------
-// CMPXDbHandler::AddAbstractAlbumItemL
-// ----------------------------------------------------------------------------
-//
-#ifdef ABSTRACTAUDIOALBUM_INCLUDED
-TUint32 CMPXDbHandler::AddAbstractAlbumItemL(
- const TDesC& aName,
- TInt aDriveId,
- CMPXMessageArray* aItemChangedMessages,
- TBool& aItemExist,
- const TDesC& aUri,
- const TDesC& aAlbumArtist
- )
- {
- MPX_FUNC("CMPXDbHandler::AddAbstractAlbumItemL()");
-
- MPX_PERF_START(CMPXDbHandler_AddAbstractAlbumItemL);
-
- TBool newRecord(EFalse);
- TUint32 id(0);
-
- //AbstractAlbum is not case sensitive
- id = iDbAbstractAlbum->AddItemL(aUri, aName, aAlbumArtist, aDriveId, newRecord, EFalse);
- MPX_PERF_END(CMPXDbHandler_AddAbstractAlbumItemL);
-
- return id;
- }
-#endif
-
-// ----------------------------------------------------------------------------
// CMPXDbHandler::AddCategoryItemL
// ----------------------------------------------------------------------------
//
TUint32 CMPXDbHandler::AddCategoryItemL(
TMPXGeneralCategory aCategory,
- const CMPXMedia& aMedia,
+ const TDesC& aName,
TInt aDriveId,
CMPXMessageArray* aItemChangedMessages,
- TBool& aItemExist)
+ TBool& aItemExist
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+ ,const TDesC& aUri
+ ,const TDesC& aAlbumArtist
+#endif // ABSTRACTAUDIOALBUM_INCLUDED
+ )
{
MPX_FUNC("CMPXDbHandler::AddCategoryItemL()");
-
+
MPX_PERF_START(CMPXDbHandler_AddCategoryItemL);
- ASSERT(aCategory != EMPXAbstractAlbum);
-
TBool newRecord(EFalse);
-
- TUint32 id = DbCategoryL(aCategory)->AddItemL(aCategory, aMedia, aDriveId, newRecord, aCategory != EMPXGenre);
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+ TUint32 id(0);
+ //for AbstractAlbum, SetAbstractAlbum, associate songs with abstractalbum.
+ //only called with newRecord as EFalse
+ //increment songCount if id exist in AbstractAlbum table, otherwise do nothing.
+
+ //only Genre, AbstractAlbum are not case sensitive
+ TBool caseSensitive = ETrue;
+ if ((aCategory == EMPXGenre) || (aCategory == EMPXAbstractAlbum))
+ caseSensitive = EFalse;
+
+ if (aCategory == EMPXAbstractAlbum)
+ {
+ id = iDbAbstractAlbum->AddItemL(aUri, aName, aAlbumArtist, aDriveId, newRecord, caseSensitive);
+ }
+ else
+ {
+ id = DbCategoryL(aCategory)->AddItemL(aName, aDriveId, newRecord, caseSensitive);
+#else
+ TUint32 id(DbCategoryL(aCategory)->AddItemL(aName, aDriveId, newRecord, (aCategory != EMPXGenre)));
+#endif // ABSTRACTAUDIOALBUM_INCLUDED
if (newRecord && aItemChangedMessages)
{
MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, id, EMPXItemInserted,
aCategory, KDBPluginUid);
}
- // when the added item's category is Genre, Composer or Artist, and it is NOT a new record,
+ // when the added item's category is Genre or Composer,
+ // and it is NOT a new record,
// we should send the item number changed message
- else if ( ( aCategory == EMPXGenre || aCategory == EMPXComposer || aCategory == EMPXArtist) &&
+ else if ( ( aCategory == EMPXGenre || aCategory == EMPXComposer ) &&
+ !newRecord && aItemChangedMessages )
+ {
+ MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, id, EMPXItemModified,
+ aCategory, KDBPluginUid);
+ }
+ aItemExist = !newRecord;
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+ }
+#endif // ABSTRACTAUDIOALBUM_INCLUDED
+ MPX_PERF_END(CMPXDbHandler_AddCategoryItemL);
+ return id;
+ }
+
+TUint32 CMPXDbHandler::AddCategoryItemL(
+ TMPXGeneralCategory aCategory,
+ const TDesC& aName,
+ const TDesC& aArtistName,
+ const TDesC& aArt,
+ TInt aDriveId,
+ CMPXMessageArray* aItemChangedMessages,
+ TBool& aItemExist)
+ {
+ MPX_FUNC("CMPXDbHandler::AddCategoryItemL()");
+
+ MPX_PERF_START(CMPXDbHandler_AddCategoryItemL);
+
+ TBool newRecord(EFalse);
+
+ TUint32 id = 0;
+ if(aCategory == EMPXAlbum)
+ {
+ id = iDbAlbum->AddItemL(aName, aArtistName, aArt, aDriveId, newRecord, (aCategory != EMPXGenre));
+ }
+ else
+ {
+ id = iDbArtist->AddItemL(aName, aArt, aDriveId, newRecord, (aCategory != EMPXGenre));
+ }
+
+ if (newRecord && aItemChangedMessages)
+ {
+ MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, id, EMPXItemInserted,
+ aCategory, KDBPluginUid);
+ }
+ // when the added item's category is Artist, and it is NOT a new record,
+ // we should send the item number changed message
+ else if ( aCategory == EMPXArtist &&
!newRecord && aItemChangedMessages )
{
MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, id, EMPXItemModified,
@@ -3111,23 +3154,31 @@
aItemExist = !newRecord;
MPX_PERF_END(CMPXDbHandler_AddCategoryItemL);
- return id;
+ return id;
}
-// ----------------------------------------------------------------------------
-// CMPXDbHandler::UpdateCategoryItemL
-// ----------------------------------------------------------------------------
-//
void CMPXDbHandler::UpdateCategoryItemL(
- TMPXGeneralCategory aCategory,
- TUint32 aCategoryId,
- const CMPXMedia& aMedia,
- TInt aDrive,
- CMPXMessageArray* aItemChangedMessages)
+ TMPXGeneralCategory aCategory,
+ TUint32 aCategoryId,
+ const CMPXMedia& aMedia,
+ TInt aDrive,
+ CMPXMessageArray* aItemChangedMessages)
{
- DbCategoryL(aCategory)->UpdateItemL(aCategoryId, aMedia, aDrive, aItemChangedMessages);
+ switch(aCategory)
+ {
+ case EMPXAlbum:
+ iDbAlbum->UpdateItemL(aCategoryId, aMedia, aDrive, aItemChangedMessages);
+ break;
+
+ case EMPXArtist:
+ iDbArtist->UpdateItemL(aCategoryId, aMedia, aDrive, aItemChangedMessages);
+ break;
+
+ default:
+ DbCategoryL(aCategory)->UpdateItemL(aCategoryId, aMedia, aDrive, aItemChangedMessages);
+ break;
+ }
}
-
// ----------------------------------------------------------------------------
// CMPXDbHandler::DeleteSongForCategoryL
// ----------------------------------------------------------------------------
@@ -3137,21 +3188,11 @@
TUint32 aCategoryId,
TInt aDriveId,
CMPXMessageArray* aItemChangedMessages,
- TBool& aItemExist,
- const TDesC& aArt
- )
+ TBool& aItemExist)
{
MPX_FUNC("CMPXDbHandler::DeleteSongForCategoryL");
- switch(aCategory)
- {
- case EMPXAlbum:
- iDbAlbum->DecrementSongsForAlbumL(aCategoryId, aDriveId, aItemChangedMessages, aItemExist, aArt);
- break;
- default:
- DbCategoryL(aCategory)->DecrementSongsForCategoryL(aCategoryId, aDriveId,
- aItemChangedMessages, aItemExist);
- break;
- }
+ DbCategoryL(aCategory)->DecrementSongsForCategoryL(aCategoryId, aDriveId,
+ aItemChangedMessages, aItemExist);
}
// ----------------------------------------------------------------------------
@@ -3192,6 +3233,7 @@
SetTObjectValueL<TMPXItemId>(KMPXMessageMediaDeprecatedId, plId);
}
+
// ---------------------------------------------------------------------------
// CMPXDbHandler::IsRemoteDrive
// ---------------------------------------------------------------------------
@@ -3237,6 +3279,28 @@
CleanupStack::PopAndDestroy(&attributes);
}
+TInt CMPXDbHandler::HandleGetAlbumsCountForArtistL(TUint32 aArtistId)
+ {
+ return iDbAlbum->GetAlbumsCountForArtistL(aArtistId);
+ }
+
+TBool CMPXDbHandler::HandleIsUnknownArtistL(TUint32 aArtistId)
+ {
+ return iDbArtist->IsUnknownArtistL(aArtistId);
+ }
+
+// ---------------------------------------------------------------------------
+// CMPXDbHandler::HandleArtistForAlbumL
+// ---------------------------------------------------------------------------
+//
+HBufC* CMPXDbHandler::HandleArtistForAlbumL(const TUint32 aAlbumId)
+ {
+
+ TUint32 artistId = iDbMusic->ArtistForAlbumL(aAlbumId);
+ HBufC* artistname = GetNameMatchingIdL(artistId);
+ return artistname;
+ }
+
// ---------------------------------------------------------------------------
// CMPXDbHandler::HandleAlbumartForAlbumL
// ---------------------------------------------------------------------------
@@ -3245,7 +3309,6 @@
{
return iDbMusic->AlbumartForAlbumL(aAlbumId, aArt);
}
-
#ifdef ABSTRACTAUDIOALBUM_INCLUDED
// ----------------------------------------------------------------------------------------------------------
// CMPXDbHandler::HandleGetAlbumNameForSongL
@@ -3256,43 +3319,4 @@
return iDbAbstractAlbum->GetUriL(aId);
}
#endif // ABSTRACTAUDIOALBUM_INCLUDED
-
-// ----------------------------------------------------------------------------
-// CMPXDbHandler::DeleteAlbumForArtistL
-// ----------------------------------------------------------------------------
-//
-void CMPXDbHandler::DeleteAlbumForArtistL(TUint32 aCategoryId,
- TInt aDrive, CMPXMessageArray* aItemChangedMessages)
- {
- MPX_FUNC("CMPXDbHandler::DeleteAlbumForArtistL");
- iDbArtist->DecrementAlbumsForArtistL(aCategoryId, aDrive, aItemChangedMessages);
- }
-
-// ----------------------------------------------------------------------------
-// CMPXDbHandler::AddAlbumArtistL
-// ----------------------------------------------------------------------------
-//
-TUint32 CMPXDbHandler::AddAlbumArtistL(const TDesC& aName, const TDesC& aArt, TInt aDriveId)
- {
- MPX_FUNC("CMPXDbHandler::AddAlbumArtistL");
- return iDbArtist->AddAlbumArtistL(aName, aArt, aDriveId);
- }
-
-// ----------------------------------------------------------------------------
-// CMPXDbHandler::GenerateUniqueIdForAlbumL
-// ----------------------------------------------------------------------------
-//
-TUint32 CMPXDbHandler::GenerateUniqueIdForAlbumL(const CMPXMedia& aMedia)
- {
- return iDbAlbum->GenerateUniqueIdL(aMedia);
- }
-
-// ----------------------------------------------------------------------------
-// CMPXDbHandler::IsUnknownAlbumL
-// ----------------------------------------------------------------------------
-//
-TBool CMPXDbHandler::IsUnknownAlbumL(const TUint32 aId)
- {
- return iDbAlbum->IsUnknownAlbumL(aId);
- }
// End of file
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbmusic.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbmusic.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -42,6 +42,12 @@
// CONSTANTS
+// This is what KNullDesC album computes to for the hash
+// to-do: generate this Id through
+// MPXDbUtil::GenerateUniqueIdL(EMPXAlbum, KNullDesC, EFalse)
+// instead of hard-coding the number so if GenerateUniqueIdL
+// is modified, this constant doesn't need to be redefined
+const TInt KUnknownAlbumID = 1770790356;
// UniqueID column in Uris requests
const TInt KColUniqueID = 0;
// URI column in Uris requests
@@ -248,25 +254,22 @@
User::Leave(KErrNotFound);
}
-#ifdef ABSTRACTAUDIOALBUM_INCLUDED
- iArtNeedUpdated = ETrue; // reset flag
-#endif
TDriveUnit driveUnit(MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
recordset.ColumnInt64(EMusicVolumeId)));
visible = DoUpdateSongL(aSongId, aMedia, driveUnit, aItemChangedMessages,
recordset);
-
+
#ifdef ABSTRACTAUDIOALBUM_INCLUDED
if(iArtNeedUpdated)
{
#endif // ABSTRACTAUDIOALBUM_INCLUDED
// Update Album table
- if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName))
+ if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName) || aMedia.IsSupported(KMPXMediaMusicArtist))
{
TUint32 albumId = recordset.ColumnInt64(EMusicAlbum);
iObserver.UpdateCategoryItemL(EMPXAlbum, albumId, aMedia, driveUnit, aItemChangedMessages);
}
-
+
// Update Artist table
if ( aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName) )
{
@@ -275,6 +278,7 @@
}
#ifdef ABSTRACTAUDIOALBUM_INCLUDED
}
+ iArtNeedUpdated = ETrue; //reset flag
#endif // ABSTRACTAUDIOALBUM_INCLUDED
CleanupStack::PopAndDestroy(&recordset);
}
@@ -708,7 +712,7 @@
// Run query and add result media objects to the cache array.
MPX_FUNC("CMPXDbMusic::ExecuteQueryAllSongsL");
- RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetAllSongsMinimum()));
+ RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetAllSongsMinimum));
CleanupClosePushL(recordset);
TInt err(KErrNone);
@@ -809,7 +813,7 @@
MPX_FUNC("CMPXDbMusic::GetSongsForAlbumL");
TPtrC query;
- if (iObserver.IsUnknownAlbumL(aAlbumId))
+ if (aAlbumId == KUnknownAlbumID)
{
query.Set(ExtraFieldsRequired(aAttrs) ? KQueryMusicGetSongsForUnknownAlbum() :
KQueryMusicGetSongsForUnknownAlbumNoCategories());
@@ -990,9 +994,7 @@
TMPXGeneralType aType,
const CMPXMedia& aCriteria,
const TArray<TMPXAttribute>& aAttrs,
- CMPXMediaArray& aMediaArray,
- TBool aSortByTrackOrder
- )
+ CMPXMediaArray& aMediaArray)
{
MPX_FUNC("CMPXDbMusic::FindSongsL");
@@ -1000,8 +1002,12 @@
HBufC* criteriaStr = GenerateMusicMatchingCriteriaLC(aGeneralId, aContainerId, aType,
aCriteria);
- TPtrC sortOrder;
- if (aSortByTrackOrder)
+ // construct the sort order depending on category. Albums are always sorted by track,
+ // then name, except for unknown album. Songs are sorted by name for unknown album.
+ // NULL track number is stored as KMaxTInt so that they will be sorted to the end
+ TPtrC sortOrder;
+ if ((aType == EMPXGroup) && (MPX_ITEM_CATEGORY(aGeneralId) == EMPXAlbum) &&
+ (aGeneralId != MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXAlbum, KNullDesC, EFalse)))
{
sortOrder.Set(KQueryMusicFindAllSortOrderTrack);
}
@@ -1009,7 +1015,7 @@
{
sortOrder.Set(KQueryMusicFindAllSortOrderTitle);
}
-
+
// construct the query
HBufC* query = HBufC::NewLC(KQueryMusicFindAll().Length() + criteriaStr->Length() +
sortOrder.Length());
@@ -1094,13 +1100,32 @@
}
// ----------------------------------------------------------------------------
+// CMPXDbMusic::ArtistForAlbumL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbMusic::ArtistForAlbumL(const TUint32 aId)
+ {
+ RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetArtistForAlbum, aId));
+
+ CleanupClosePushL(recordset);
+ if (recordset.Next() != KSqlAtRow)
+ {
+ User::Leave(KErrNotFound);
+ }
+
+ TUint32 artistId = recordset.ColumnInt64(KMPXTableDefaultIndex);
+ CleanupStack::PopAndDestroy(&recordset);
+
+ return artistId;
+ }
+
+// ----------------------------------------------------------------------------
// CMPXDbMusic::AlbumartForAlbumL
// ----------------------------------------------------------------------------
//
HBufC* CMPXDbMusic::AlbumartForAlbumL(const TUint32 aAlbumId, TPtrC aArt)
{
- MPX_FUNC("CMPXDbMusic::AlbumartForAlbumL");
-
+ MPX_FUNC("CMPXDbMusic::AlbumartForAlbumL");
RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetAlbumartForAlbum, aAlbumId));
HBufC* albumart(NULL);
@@ -2093,8 +2118,6 @@
#ifdef ABSTRACTAUDIOALBUM_INCLUDED
TUint32 abstractAlbumId(0);
#endif // ABSTRACTAUDIOALBUM_INCLUDED
- //need to get song art for updating art field in Album and Artist tables
- TPtrC art(KNullDesC);
if (aMusicTable)
{
artistId = aMusicTable->ColumnInt64(EMusicArtist);
@@ -2104,23 +2127,23 @@
#ifdef ABSTRACTAUDIOALBUM_INCLUDED
abstractAlbumId = aMusicTable->ColumnInt64(EMusicAbstractAlbum);
#endif // ABSTRACTAUDIOALBUM_INCLUDED
- art.Set(MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicArt));
}
// update the artist field
TUint32 id(0);
+ TUint32 artistIdForAlbum(artistId);
if (UpdateCategoryFieldL(EMPXArtist, aMedia, KMPXMediaMusicArtist, artistId,
- aDrive, aItemChangedMessages, id, art))
+ aDrive, aItemChangedMessages, id))
{
MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArtist, id);
metaDataModified = (aMusicTable != NULL);
visibleChange = CMPXDbActiveTask::EAllVisible;
- iArtNeedUpdated = EFalse;
+ artistIdForAlbum = id;
}
// update the album field
if (UpdateCategoryFieldL(EMPXAlbum, aMedia, KMPXMediaMusicAlbum, albumId,
- aDrive, aItemChangedMessages, id, art))
+ aDrive, aItemChangedMessages, id))
{
MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicAlbum, id);
metaDataModified = (aMusicTable != NULL);
@@ -2141,7 +2164,6 @@
MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, albumId,
EMPXItemInserted, EMPXAlbum, KDBPluginUid);
}
- iArtNeedUpdated = EFalse;
}
// update the genre field
@@ -2443,17 +2465,8 @@
TUint32 aOldId,
TInt aDriveId,
CMPXMessageArray* aItemChangedMessages,
- TUint32& aItemId,
- const TDesC& aArt)
+ TUint32& aItemId)
{
- MPX_FUNC("CMPXDbMusic::UpdateCategoryFieldL");
-
- if (aCategory == EMPXAlbum)
- {
- return UpdateCategoryFieldForAlbumL(aMedia, aAttribute, aOldId,
- aDriveId, aItemChangedMessages, aItemId, aArt);
- }
-
TBool updated(EFalse);
TBool itemNotRemoved( EFalse );
TBool itemAdded( EFalse );
@@ -2480,6 +2493,7 @@
aItemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), aCategory,
name, caseSensitive);
+
#else
// only genre is not case sensitive
aItemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), aCategory,
@@ -2494,8 +2508,8 @@
{
if (aMedia.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory) == EMPXSong )
{
- iObserver.AddAbstractAlbumItemL(KNullDesC, aDriveId,
- aItemChangedMessages, itemAdded, name, KNullDesC);
+ iObserver.AddCategoryItemL(aCategory, KNullDesC, aDriveId,
+ aItemChangedMessages, itemAdded, name, KNullDesC);
}
else
{
@@ -2506,40 +2520,42 @@
albumartist.Set(aMedia.ValueText(KMPXMediaMusicAlbumArtist).Left(KMCMaxTextLen));
//get AlbumArt AbstractAlbum
MPX_DEBUG2(" albumartist[%S]", &albumartist);
- }
+ }
if (aMedia.IsSupported(KMPXMediaGeneralTitle) )
- {
- abstractAlbumName.Set(aMedia.ValueText(KMPXMediaGeneralTitle).Left(KMCMaxTextLen));
- MPX_DEBUG2(" abstractAlbumName[%S]", &abstractAlbumName);
- }
-
- // ignore the return value
- iObserver.AddAbstractAlbumItemL(abstractAlbumName, aDriveId,
- aItemChangedMessages, itemAdded, name, albumartist);
+ {
+ abstractAlbumName.Set(aMedia.ValueText(KMPXMediaGeneralTitle).Left(KMCMaxTextLen));
+ MPX_DEBUG2(" abstractAlbumName[%S]", &abstractAlbumName);
+ }
+ // ignore the return value
+
+ iObserver.AddCategoryItemL(aCategory, abstractAlbumName, aDriveId,
+ aItemChangedMessages, itemAdded, name, albumartist);
}
}
else
#endif // ABSTRACTAUDIOALBUM_INCLUDED
- if (aCategory == EMPXArtist)
+ if (aCategory == EMPXArtist || aCategory == EMPXAlbum)
{
- //for the update case, need to maintain art field for Artist/Album table.
- if (aOldId && (aOldId != aItemId))
+ TPtrC art(KNullDesC);
+ TPtrC artistname(KNullDesC);
+
+ if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName))
{
- CMPXMedia* media = CMPXMedia::NewL(aMedia);
- CleanupStack::PushL(media);
- media->SetTextValueL(KMPXMediaMusicAlbumArtFileName, aArt);
- iObserver.AddCategoryItemL(aCategory, *media, aDriveId, aItemChangedMessages, itemAdded);
- CleanupStack::PopAndDestroy(media);
- }
- else
- {
- iObserver.AddCategoryItemL(aCategory, aMedia, aDriveId, aItemChangedMessages, itemAdded);
+ art.Set(aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen));
}
+ if (aCategory == EMPXAlbum)
+ {
+ if (aMedia.IsSupported(KMPXMediaMusicArtist))
+ {
+ artistname.Set(aMedia.ValueText(KMPXMediaMusicArtist).Left(KMCMaxTextLen));
+ }
+ }
+ iObserver.AddCategoryItemL(aCategory, name, artistname, art, aDriveId, aItemChangedMessages, itemAdded);
}
else
{
// ignore the return value
- iObserver.AddCategoryItemL(aCategory, aMedia, aDriveId,
+ iObserver.AddCategoryItemL(aCategory, name, aDriveId,
aItemChangedMessages, itemAdded);
}
updated = ETrue;
@@ -2567,18 +2583,37 @@
TPtrC abstractAlbumName(aMedia.ValueText(KMPXMediaGeneralTitle).Left(KMCMaxTextLen));
MPX_DEBUG2(" Music abstractAlbumName[%S]", &abstractAlbumName);
// ignore the return value
- iObserver.AddAbstractAlbumItemL(abstractAlbumName, aDriveId,
- aItemChangedMessages, itemAdded, KNullDesC, albumartist);
+ iObserver.AddCategoryItemL(aCategory, abstractAlbumName, aDriveId,
+ aItemChangedMessages, itemAdded, KNullDesC, albumartist);
}
else
#endif // ABSTRACTAUDIOALBUM_INCLUDED
+ if (aCategory == EMPXArtist || aCategory == EMPXAlbum)
+ {
+ TPtrC art(KNullDesC);
+ TPtrC artistname(KNullDesC);
+ if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName))
+ {
+ art.Set(aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen));
+ }
+ if (aCategory == EMPXAlbum)
+ {
+ if (aMedia.IsSupported(KMPXMediaMusicArtist))
+ {
+ artistname.Set(aMedia.ValueText(KMPXMediaMusicArtist).Left(KMCMaxTextLen));
+ }
+ }
+ iObserver.AddCategoryItemL(aCategory, KNullDesC, artistname, art, aDriveId,
+ aItemChangedMessages, itemAdded);
+ }
+ else
{
// ignore the return value
- iObserver.AddCategoryItemL(aCategory, aMedia, aDriveId,
- aItemChangedMessages, itemAdded);
- }
- updated = ETrue;
- }
+ iObserver.AddCategoryItemL(aCategory, KNullDesC, aDriveId,
+ aItemChangedMessages, itemAdded);
+ }
+ updated = ETrue;
+ }
}
if (aOldId && (aOldId != aItemId))
@@ -2644,6 +2679,7 @@
return updated;
}
+
// ----------------------------------------------------------------------------
// CMPXDbMusic::ExtraFieldsRequired
// ----------------------------------------------------------------------------
@@ -2724,120 +2760,4 @@
;
}
-// ----------------------------------------------------------------------------
-// CMPXDbMusic::UpdateCategoryFieldForAlbumL
-// ----------------------------------------------------------------------------
-//
-TBool CMPXDbMusic::UpdateCategoryFieldForAlbumL(
- const CMPXMedia& aMedia,
- const TMPXAttribute& aAttribute,
- TUint32 aOldId,
- TInt aDriveId,
- CMPXMessageArray* aItemChangedMessages,
- TUint32& aItemId,
- const TDesC& aArt)
- {
- MPX_FUNC("CMPXDbMusic::UpdateCategoryFieldForAlbumL");
-
- TBool updated(EFalse);
- TBool itemNotRemoved( EFalse );
- TBool itemAdded( EFalse );
-
- // update category table and add category Id to the music table
- if (!aOldId || aMedia.IsSupported(aAttribute))
- {
- TInt changeMsgCount( 0 );
- if( aItemChangedMessages )
- {
- changeMsgCount = aItemChangedMessages->Count();
- }
-
- // construct the new ID for the category record
- aItemId = iObserver.GenerateUniqueIdForAlbumL(aMedia);
-
- if (!aOldId || (aOldId != aItemId))
- {
- // only add if the ID changed,
- // otherwise the song was updated but the artist name was not
-
- //for the update case, need to maitain art field for Artist/Album table.
- if (aOldId && (aOldId != aItemId))
- {
- CMPXMedia* media = CMPXMedia::NewL(aMedia);
- CleanupStack::PushL(media);
- media->SetTextValueL(KMPXMediaMusicAlbumArtFileName, aArt);
-
- iObserver.AddCategoryItemL(EMPXAlbum, *media, aDriveId, aItemChangedMessages, itemAdded);
- CleanupStack::PopAndDestroy(media);
- }
- else // !aOldId
- {
- iObserver.AddCategoryItemL(EMPXAlbum, aMedia, aDriveId, aItemChangedMessages, itemAdded);
- }
- updated = ETrue;
- }
-
- if (aOldId && (aOldId != aItemId))
- {
- iObserver.DeleteSongForCategoryL(EMPXAlbum, aOldId, aDriveId,
- aItemChangedMessages, itemNotRemoved, aArt);
- updated = ETrue;
- }
-
- // Special case where the item(s) has been renamed.
- // In this case, a new category is created +1 change msg
- // a old category is removed +1 change msg
- // We merge these 2 change messages into one using the deprecated ID
- //
- if( aItemChangedMessages )
- {
- TInt newChangeMsgCount( aItemChangedMessages->Count() );
- if( newChangeMsgCount - changeMsgCount > 0 )
- {
- TInt oldId = KErrNotFound;
- TInt newId = KErrNotFound;
- for( TInt i=0; i<newChangeMsgCount; ++i )
- {
- CMPXMessage& msg = *(*aItemChangedMessages)[i];
-
- TMPXItemId id = msg.ValueTObjectL<TMPXItemId>(KMPXMessageMediaGeneralId);
- TMPXChangeEventType changeType = msg.ValueTObjectL<TMPXChangeEventType>(KMPXMessageChangeEventType);
-
- // Look for the added and deleted category IDs
- //
- if( id == aOldId && changeType == EMPXItemDeleted )
- {
- oldId = i;
- }
- else if( id == aItemId && changeType == EMPXItemInserted )
- {
- newId = i;
- }
- }// for
-
- if( oldId != KErrNotFound &&
- newId != KErrNotFound )
- {
- aItemChangedMessages->Remove(oldId); // category removed
- aItemChangedMessages->Remove(newId); // category added
- MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aItemId, EMPXItemModified,
- EMPXAlbum, KDBPluginUid, aOldId );
- }
- else if ( oldId !=KErrNotFound && itemAdded ) // old item removed, new item already exist
- {
- MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aItemId, EMPXItemModified,
- EMPXAlbum, KDBPluginUid, aOldId );
- }
- else if ( newId !=KErrNotFound && itemNotRemoved ) // new item added, old item still exist
- {
- MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aOldId, EMPXItemModified,
- EMPXAlbum, KDBPluginUid, aItemId );
- }
- }
- }// aItemChangedMessages
- }// if (!aOldId || aMedia.IsSupported(aAttribute))
-
- return updated;
- }
-
// End of File
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbplugin.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbplugin.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -3989,13 +3989,38 @@
switch(table)
{
case EMPXCollectionCountTrack:
- count = (TInt)iDbHandler->GetMusicCountL(drive);
+ TRAPD( trackerr, count = (TInt)iDbHandler->GetMusicCountL(drive) );
+ MPX_DEBUG2( "CMPXDbPlugin::DoGetCollectionCountL, trackerr =%d", trackerr );
+ if ( trackerr == KErrCorrupt )
+ {
+ iDbHandler->CloseDatabaseL( drive );
+ iDbHandler->RecreateDatabaseFileL( drive );
+ iDbHandler->OpenDatabaseL( drive );
+ count = (TInt)iDbHandler->GetMusicCountL(drive);
+ }
+
break;
case EMPXCollectionCountPlaylist:
- count = (TInt)iDbHandler->GetPlaylistCountL(drive);
+ TRAPD( playlisterr, count = (TInt)iDbHandler->GetPlaylistCountL(drive) );
+ MPX_DEBUG2( "CMPXDbPlugin::DoGetCollectionCountL, playlisterr =%d", playlisterr );
+ if ( playlisterr == KErrCorrupt )
+ {
+ iDbHandler->CloseDatabaseL( drive );
+ iDbHandler->RecreateDatabaseFileL( drive );
+ iDbHandler->OpenDatabaseL( drive );
+ count = (TInt)iDbHandler->GetPlaylistCountL(drive);
+ }
break;
case EMPXCollectionCountTotal:
- count = (TInt)iDbHandler->GetTotalCountL(drive);
+ TRAPD( totalerr, count = (TInt)iDbHandler->GetTotalCountL(drive) );
+ MPX_DEBUG2( "CMPXDbPlugin::DoGetCollectionCountL, totalerr =%d", totalerr );
+ if ( totalerr == KErrCorrupt )
+ {
+ iDbHandler->CloseDatabaseL( drive );
+ iDbHandler->RecreateDatabaseFileL( drive );
+ iDbHandler->OpenDatabaseL( drive );
+ count = (TInt)iDbHandler->GetTotalCountL(drive);
+ }
break;
default:
User::Leave(KErrArgument);
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbauxiliary.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbauxiliary.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -111,7 +111,7 @@
{
MPX_FUNC("CMPXDbAuxiliary::LastRefreshedTimeL");
- RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAuxiliaryGetTime()));
+ RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAuxiliaryGetTime));
CleanupClosePushL(recordset);
if (recordset.Next() != KSqlAtRow)
@@ -195,7 +195,7 @@
TBool refreshed(ETrue);
- RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAuxiliaryGetTime()));
+ RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAuxiliaryGetTime));
CleanupClosePushL(recordset);
TInt count(0);
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxpodcastdbhandler.h Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxpodcastdbhandler.h Wed Oct 13 14:28:40 2010 +0300
@@ -317,7 +317,12 @@
* Recreate all podcast databases
*/
void ReCreateDatabasesL();
-
+
+ /**
+ * Recreate a specified database file.
+ */
+ void RecreateDatabaseFileL( TInt aDrive );
+
/**
* Start a refresh operation
*/
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxdbauxiliary.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxdbauxiliary.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -112,7 +112,7 @@
{
MPX_FUNC("CMPXDbAuxiliary::LastRefreshedTimeL");
- RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAuxiliaryGetTime()));
+ RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAuxiliaryGetTime));
CleanupClosePushL(recordset);
if (recordset.Next() != KSqlAtRow)
@@ -195,7 +195,7 @@
TBool refreshed(ETrue);
- RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAuxiliaryGetTime()));
+ RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAuxiliaryGetTime));
CleanupClosePushL(recordset);
TInt count(0);
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbhandler.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbhandler.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -819,6 +819,18 @@
iDbManager->RecreateAllDatabasesL();
}
+
+// ----------------------------------------------------------------------------
+// Re-create a specified database file
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::RecreateDatabaseFileL( TInt aDrive )
+ {
+ MPX_FUNC("CMPXPodcastDbHandler::RecreateDatabaseFileL");
+ MPX_DEBUG2( "CMPXPodcastDbHandler::RecreateDatabaseFileL drive: %i", aDrive );
+ iDbManager->RecreateDatabaseFileL( aDrive );
+ }
+
// ----------------------------------------------------------------------------
// Set handler refresh status
// ----------------------------------------------------------------------------
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbplugin.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbplugin.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -3050,7 +3050,18 @@
}
TInt drive = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionCountDrive);
- TInt count = (TInt)iDbHandler->GetTotalCountL(drive);
+
+ TInt count = 0;
+ TRAPD( totalerr, count = (TInt)iDbHandler->GetTotalCountL(drive) );
+ MPX_DEBUG2( "CMPXPodcastDbPlugin::DoGetCollectionCountL, totalerr =%d", totalerr );
+ if ( totalerr == KErrCorrupt )
+ {
+ iDbHandler->CloseDatabaseL( drive );
+ iDbHandler->RecreateDatabaseFileL( drive );
+ iDbHandler->OpenDatabaseL( drive );
+ count = (TInt)iDbHandler->GetTotalCountL(drive);
+ }
+
((CMPXMedia&)aCmd).SetTObjectValueL<TInt>(KMPXCommandCollectionCountValue, count);
}
--- a/mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/src/mpxscreensaverplugincontainer.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/src/mpxscreensaverplugincontainer.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -532,15 +532,11 @@
{
clockTimePtr = KNullDesC;
}
- // time digifont does not contain arabic / indic etc numbers.
- // If clock font is changed, or digifont starts supporting language-
- // specific numbers, the commented-out call below should be restored
- /*
else
{
AknTextUtils::LanguageSpecificNumberConversion( clockTimePtr );
}
- */
+
// AM/PM text
HBufC* ampmFormat = StringLoader::LoadLC( R_MPX_SCREENSAVER_AMPM );
--- a/mpxplugins/viewplugins/inc/mpxcommonplaybackviewimp.h Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/viewplugins/inc/mpxcommonplaybackviewimp.h Wed Oct 13 14:28:40 2010 +0300
@@ -12,7 +12,7 @@
* Contributors:
*
* Description: MPX common playback view implementation
-* Version : %version: da1mmcf#41.1.6.1.1.1.14 % << Don't touch! Updated by Synergy at check-out.
+* Version : %version: e003sa33#41.1.6.1.1.1.13 % << Don't touch! Updated by Synergy at check-out.
*
*/
@@ -759,7 +759,6 @@
// Indicate FF button pressed or not
TBool iIsffButtonPressed;
TBool iBacking;
- TBool iErrorOccured;
#ifdef IAD_INCLUDE_UPNP
CUpnpCopyCommand* iUpnpCopyCommand;
#endif
--- a/mpxplugins/viewplugins/inc/mpxmetadataeditordialog.h Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/viewplugins/inc/mpxmetadataeditordialog.h Wed Oct 13 14:28:40 2010 +0300
@@ -80,8 +80,7 @@
public MMPXCollectionObserver,
public MMPXCollectionFindObserver,
public MMPXPlaybackCallback,
- public MMPXCHelperObserver,
- public MMPXPlaybackObserver
+ public MMPXCHelperObserver
{
public:
// File Details headings
@@ -202,26 +201,7 @@
const CMPXMedia& aMedia,
TInt aError);
-private:
-
- /**
- * From MMPXPlaybackObserver
- * Handle playback message
- *
- * @param aMessage playback message
- * @param aErr system error code.
- */
- void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
-
- /**
- * Handle playback message
- *
- * @param aMessage playback message
- */
- void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
-
private: // Constructor
-
/**
* Default constructor.
*/
--- a/mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhgcontainer.h Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhgcontainer.h Wed Oct 13 14:28:40 2010 +0300
@@ -208,13 +208,6 @@
* @since 3.1
*/
TInt TopLbxItemIndex() const;
- /**
- * Gets first listbox item index on screen(relative to the original listbox).
- * @return first listbox item index on screen
- *
- *
- */
- TInt FirstIndexOnScreen() const;
/**
* Gets bottom listbox item index (relative to the original listbox).
@@ -1029,7 +1022,6 @@
TUid iPreviousViewId;
TBool iPreviousOrientation;
TBool iDrawBackGround;
- TBool iIsNowPlayingView;
};
#endif // CMPXCOLLECTIONVIEWHGCONTAINER_H
--- a/mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhgimp.h Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhgimp.h Wed Oct 13 14:28:40 2010 +0300
@@ -122,7 +122,13 @@
* @ since 3.1
*/
void LaunchMusicShopL();
-
+
+ /**
+ * Launch Ovi music application.
+ *
+ */
+ void LaunchOviMusicShopL();
+
/**
* Saves selected album.
*
@@ -891,6 +897,15 @@
*/
void DimAllOptions( TInt aResourceId, CEikMenuPane* aMenuPane );
+ /*
+ * Check if MusicApp is present
+ */
+ TBool IsMusicAppInstalledL( const TUid& aAppUid );
+
+ /*
+ * Display correct MusicShop option
+ */
+ void DisplayMusicShopOptions( CEikMenuPane* aMenuPane );
private: // Data
MMPXCollectionUtility* iCollectionUtility;
@@ -930,7 +945,7 @@
TInt iCurrentPlaylistOp;
TInt iNumSongAddedToPlaylist;
TMPXItemId iPlaylistId;
- TInt iFirstIndexOnScreen;
+
TInt iCurrentMediaLOp; // current mediaL operation
TInt iCurrentFindAllLOp; // current FindAllL operation
TInt iLastDepth;
@@ -1003,6 +1018,8 @@
TInt iOperatorMusicStoreType;
TInt iMusicStoreWebPage;
HBufC16* iOperatorMusicStoreURI;
+ TBool iMusicStoreAppInstalled; //flag for music store application availability
+
HBufC16* iEducateUserURI;
TInt iEducatingPopupState ;
TBool iPopuponRefresh;
--- a/mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgcontainer.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgcontainer.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -164,8 +164,7 @@
iSetEmptyTextNeeded(EFalse),
iPopupListRect(TRect(0,0,0,0)),
iPreviousViewId(TUid::Uid(0)),
- iDrawBackGround(EFalse),
- iIsNowPlayingView(EFalse)
+ iDrawBackGround(EFalse)
{
}
@@ -801,15 +800,8 @@
SetRect( clientRect );
iBgContext->SetRect(((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect());
- if ( iCurrentViewType == EMPXViewMediawall )
- {
- PrepareTboneViewL();
- }
- else
- {
- // call HandleLbxItemAdditionL
- HandleLbxItemAdditionL();
- }
+ // call HandleLbxItemAdditionL
+ HandleLbxItemAdditionL();
}
);
if(iMediaWall)
@@ -1013,22 +1005,6 @@
// -----------------------------------------------------------------------------
-// Gets first listbox item index on screen(relative to the original listbox).
-// -----------------------------------------------------------------------------
-//
-TInt CMPXCollectionViewHgContainer::FirstIndexOnScreen() const
- {
- MPX_FUNC( "CMPXCollectionViewHgContainer::FirstIndexOnScreen" );
- TInt index = 0;
- if ( iListWidget )
- {
- index = iListWidget->FirstIndexOnScreen();
- }
- return index;
- }
-
-
-// -----------------------------------------------------------------------------
// Gets bottom listbox item index (relative to the original listbox).
// -----------------------------------------------------------------------------
//
@@ -1283,7 +1259,6 @@
TBool pbv = (iPreviousViewId == TUid::Uid(KMPXPluginTypePlaybackUid)) ? ETrue : EFalse;
if ( pbv )
{
- iIsNowPlayingView = ETrue;
iPreviousViewId = TUid::Uid(0);
SetupTransitionType(KMPXInterviewTransition, pbv);
}
@@ -1311,6 +1286,11 @@
{
RestoreSelectedAlbumItemL(mediaArray);
PrepareMediaWallWithListL( mediaArray, count );
+ // We need to adjust the CBA for this view.
+ if( iCbaHandler )
+ {
+ iCbaHandler->UpdateCba();
+ }
break;
}
case EMPXViewList:
@@ -1642,14 +1622,7 @@
// TODO. check if this is correct for all lists
iListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
iListWidget->SetFocus(ETrue);
- if( iContext == EContextItemPlaylist )
- {
- iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar);
- }
- else
- {
- iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerLetterStripLite );
- }
+ iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerLetterStripLite );
iListWidget->DrawableWindow()->SetOrdinalPosition( -1 );
iListWidget->DrawableWindow()->SetFaded(((CAknAppUi*)iCoeEnv->AppUi())->IsFaded(), RWindowTreeNode::EFadeIncludeChildren);
ProvideDataWithoutThumbnailsL(aMediaArray);
@@ -1659,14 +1632,6 @@
iListWidget->Reset();
iListWidget->ResizeL( aCount );
iListWidget->SetFocus(ETrue);
- if( iContext == EContextItemPlaylist )
- {
- iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar);
- }
- else
- {
- iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerLetterStripLite );
- }
ProvideDataWithoutThumbnailsL(aMediaArray);
iListWidget->MakeVisible(ETrue);
iListWidget->InitScreenL(clientRect);
@@ -1728,10 +1693,7 @@
((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(EFalse);
iThumbnailManager->SetSizeL( EAudioGridThumbnailSize );
- if( iCbaHandler )
- {
- iCbaHandler->UpdateCba();
- }
+
TRect clientRect = ((CAknView*)iView)->ClientRect();
TAknLayoutRect mediawallLayout;
@@ -1861,10 +1823,7 @@
else if ( iMediaWall && iPrevViewType == EMPXViewTBone )
{
switchBuffer = CMPXCollectionViewHgSwitchBuffer::CreateBufferLC( *iMediaWall );
- if (aMediaArray.Count()>1)
- {
- switchBuffer->SetIndexOffset(1);
- }
+ switchBuffer->SetIndexOffset(1);
}
if( iMediaWall )
{
@@ -1876,28 +1835,14 @@
if (!iMediaWall)
{
- if ( iIsNowPlayingView )
- {
- // back from now playing view, create mediawall with empty albumart icon to avoid flickering
- iMediaWall = CHgVgMediaWall::NewL(
- appRect,
- aCount,
- CHgVgMediaWall::EHgVgMediaWallStyleCoverflowFullScreen,
- ETrue,
- this,
- CGulIcon::NewL( new CFbsBitmap()) );
- }
- else
- {
- iMediaWall = CHgVgMediaWall::NewL(
- appRect,
- aCount,
- CHgVgMediaWall::EHgVgMediaWallStyleCoverflowFullScreen,
- ETrue,
- this,
- DefaultIconL() );
- }
-
+ iMediaWall = CHgVgMediaWall::NewL(
+ appRect,
+ aCount,
+ CHgVgMediaWall::EHgVgMediaWallStyleCoverflowFullScreen,
+ ETrue,
+ this,
+ DefaultIconL() );
+
if( !iIsForeground )
iMediaWall->HandleLosingForeground();
@@ -1975,16 +1920,7 @@
CleanupStack::PopAndDestroy( switchBuffer );
switchBuffer = NULL;
}
-
- if ( iIsNowPlayingView )
- {
- iDefaultIconSet = EFalse;
- iIsNowPlayingView = EFalse;
- }
- else
- {
- iDefaultIconSet = ETrue;
- }
+ iDefaultIconSet = ETrue;
CleanPrevView();
}
@@ -2343,7 +2279,6 @@
{
// To open the selected album.
iView->ProcessCommandL( EMPXCmdCommonEnterKey );
- iPlaybackUtility->SetL( EPbPropertyRandomMode, EFalse );
}
// Disable transition in reorder mode
@@ -4143,13 +4078,11 @@
}
else
{
- iPlaybackUtility->SetL( EPbPropertyRandomMode, EFalse );
cpath->Set(aIndex-1); // actual selection
}
}
else
{
- iPlaybackUtility->SetL( EPbPropertyRandomMode, EFalse );
cpath->Set(aIndex);
}
}
@@ -4737,7 +4670,7 @@
SetupTransitionType(KMPXInterviewTransition);
BeginFullScreenAnimation();
}
- else if( !iLayoutSwitch && iMediaWall && ( iCurrentViewType == EMPXViewMediawall ) )
+ else if( !iLayoutSwitch && iMediaWall )
{
// Close mediawall "flip animation"
iMediaWall->StartOpeningAnimationL( EFalse );
@@ -4773,7 +4706,6 @@
listSize++;
indexAddition = 1;
}
- currentList->Reset(); //clears any selection along with list reset
// Add space for shuffle item if list contains more than one item.
currentList->ResizeL( listSize );
--- a/mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgimp.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgimp.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -308,7 +308,6 @@
delete iCurrentCba;
delete iIncrementalOpenUtil;
delete iCachedSelectionIndex;
- delete iCurrentSelectedIndex;
FeatureManager::UnInitializeLib();
delete iOperatorMusicStoreName ;
if ( iOperatorMusicStoreURI )
@@ -460,8 +459,8 @@
delete repository;
iGoToMusicShopOptionHidden =
!static_cast<TBool>( flags & KMPXEnableGoToMusicShopOption );
- iUsingNokiaService =
- static_cast<TBool>( flags & KMPXEnableFindInMusicShopOption );
+ iUsingNokiaService = flags & KMPXEnableFindInMusicShopOption ? ETrue : EFalse;
+
MPX_DEBUG2( "CMPXCollectionViewHgImp::ConstructL(): iUsingNokiaService: %d", iUsingNokiaService );
iDisablePodcasting = flags&KMPXDisablePodcastingOption ? ETrue : EFalse;
@@ -523,7 +522,10 @@
KMPlayerRemoteReadPolicy,
KMPlayerRemoteWritePolicy );
}
-
+ // Check if Music Store dll is in ROM
+ iMusicStoreAppInstalled = IsMusicAppInstalledL( TUid::Uid( iMusicStoreUID ) );
+ iUsingNokiaService&=iMusicStoreAppInstalled;
+
iCachedSelectionIndex = new ( ELeave )CArrayFixFlat<TInt>( KMPXArrayGranularity );
iIncrementalOpenUtil = CMPXCollectionOpenUtility::NewL( this );
@@ -1095,7 +1097,6 @@
{
iIsDeleting = ETrue;
iCollectionUiHelper->DeleteL( *path, this );
- iFirstIndexOnScreen = iContainer->FirstIndexOnScreen();
}
else if( iContainer )
{
@@ -1272,7 +1273,7 @@
else if ( ( aIndex > 0 )
&& ( aIndex < iContainer->CurrentListItemCount() ) )
{
- iContainer->SetLbxCurrentItemIndexAndDraw( aIndex );
+ // No need to do anything here
}
else
{
@@ -4289,16 +4290,7 @@
}
else
{
- TInt topIndex = aIndex;
- if ( iFirstIndexOnScreen > 0 )
- {
- topIndex = iFirstIndexOnScreen;
- if ( aComplete )
- {
- iFirstIndexOnScreen = 0;
- }
- }
- UpdateListBoxL( aEntries, topIndex, aComplete );
+ UpdateListBoxL( aEntries, aIndex, aComplete );
}
#else
UpdateListBoxL( aEntries, aIndex, aComplete );
@@ -5572,7 +5564,7 @@
}
case EMPXCmdGoToNokiaMusicShop:
{
- LaunchMusicShopL();
+ LaunchOviMusicShopL();
break;
}
case EMPXCmdGoToOperatorMusicShop:
@@ -6376,16 +6368,7 @@
}
}
- //If Operator Music store exist, show the cascade menu with Nokia and Operator music store.
- if ( iOperatorMusicStore )
- {
- aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
- }
- else
- {
- aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
- }
-
+ DisplayMusicShopOptions(aMenuPane);
break;
}
@@ -6508,15 +6491,7 @@
aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
}
}
- if ( iOperatorMusicStore )
- {
- aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
- }
- else
- {
- aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
- }
-
+ DisplayMusicShopOptions(aMenuPane);
break;
}
@@ -6630,14 +6605,7 @@
}
}
- if ( iOperatorMusicStore )
- {
- aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
- }
- else
- {
- aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
- }
+ DisplayMusicShopOptions(aMenuPane);
break;
}
@@ -6714,14 +6682,7 @@
aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
}
}
- if ( iOperatorMusicStore )
- {
- aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
- }
- else
- {
- aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
- }
+ DisplayMusicShopOptions(aMenuPane);
break;
}
@@ -6980,20 +6941,7 @@
CEikMenuPane* aMenuPane )
{
MPX_FUNC( "CMPXCollectionViewHgImp::DynInitMenuPaneL" );
-
- if ( iContainer->IsTBoneView() )
- {
- //makesure mediawall is not flicking before handling long tap
- TInt currentIndex( iContainer->CurrentLbxItemIndex() );
- MPX_DEBUG2( "CMPXCollectionViewHgImp::DynInitMenuPaneL currentIndex = %d", currentIndex );
- if (currentIndex == KErrNotFound)
- {
- MPX_DEBUG1( "DynInitMenuPaneL NOT handling stylus popup menu when flicking");
- DimAllOptions(aResourceId, aMenuPane);
- return;
- }
- }
-
+
CMPXCollectionViewListBoxArray* array =
static_cast<CMPXCollectionViewListBoxArray*>(
iContainer->ListBoxArray() );
@@ -7498,33 +7446,27 @@
void CMPXCollectionViewHgImp::LaunchMusicShopL()
{
MPX_FUNC( "CMPXCollectionViewHgImp::LaunchMusicShopL" );
-
- if ( iMusicStoreUID != 0)
- {
- TApaTaskList taskList( iCoeEnv->WsSession() );
- TApaTask task = taskList.FindApp( TUid::Uid(iMusicStoreUID) );
-
- if ( task.Exists() )
- {
- GfxTransEffect::BeginFullScreen(
- AknTransEffect::EApplicationStart,
- TRect(),
- AknTransEffect::EParameterType,
- AknTransEffect::GfxTransParam( TUid::Uid(iMusicStoreUID),
- AknTransEffect::TParameter::EActivateExplicitContinue ));
- task.BringToForeground();
- }
- else
- {
- RApaLsSession session;
- if ( KErrNone == session.Connect() )
- {
- CleanupClosePushL( session );
- TThreadId threadId;
- session.CreateDocument( KNullDesC, TUid::Uid(iMusicStoreUID), threadId );
- CleanupStack::PopAndDestroy(&session);
- }
- }
+ if (iOperatorMusicStore && !iMusicStoreAppInstalled) //Launch Operator Store
+ {
+ if (iMusicStoreWebPage)
+ {
+ LaunchOperatorURLMusicShopL();
+ }
+ else
+ {
+ if (iOperatorMusicStoreType)
+ {
+ LaunchOperatorJavaMusicShopL(iOperatorMusicStoreUID);
+ }
+ else
+ {
+ LaunchOperatorNativeMusicShopL();
+ }
+ }
+ }
+ else //Launch Ovi Music Store
+ {
+ LaunchOviMusicShopL();
}
}
@@ -8546,7 +8488,6 @@
aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
- aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
break;
}
case R_AVKON_MENUPANE_MARKABLE_LIST:
@@ -8556,4 +8497,94 @@
}
}
}
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::IsMusicAppInstalledL
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewHgImp::IsMusicAppInstalledL( const TUid& aAppUid )
+{
+ MPX_FUNC( "CMPXCollectionViewHgImp::IsMusicAppInstalledL" );
+ TBool response = EFalse;
+
+ RApaLsSession apaSession;
+ CleanupClosePushL( apaSession );
+ User::LeaveIfError( apaSession.Connect() );
+ apaSession.GetAllApps();
+
+ TApaAppInfo appInfo;
+ TInt err = apaSession.GetAppInfo( appInfo, aAppUid );
+ CleanupStack::PopAndDestroy( &apaSession );
+
+ if ( !err )
+ {
+ // app was found
+ response = ETrue;
+ }
+ MPX_DEBUG2( "CMPXCollectionViewHgImp::IsMusicAppInstalledL response = %d", response );
+ return response;
+}
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::DisplayMusicShopOptions
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DisplayMusicShopOptions(CEikMenuPane* aMenuPane)
+ {
+ if (iOperatorMusicStore && iMusicStoreAppInstalled)
+ {
+ aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
+ aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, EFalse); //Show the cascade menu with Ovi and operator store
+ }
+ else if ((iOperatorMusicStore && !iMusicStoreAppInstalled)
+ || (!iOperatorMusicStore && iMusicStoreAppInstalled))
+ {
+ aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
+ aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, EFalse); //Show "Go to Music Store"
+ }
+ else
+ {
+ aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
+ aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
+ }
+ }
+
+
+ // -----------------------------------------------------------------------------
+ // CMPXCollectionViewHgImp::LaunchOviMusicShopL
+ // Launch Ovi music shop application
+ // -----------------------------------------------------------------------------
+ //
+void CMPXCollectionViewHgImp::LaunchOviMusicShopL()
+ {
+ MPX_FUNC( "CMPXCollectionViewHgImp::LaunchOviMusicShopL" );
+ if (iMusicStoreUID != 0)
+ {
+ TApaTaskList taskList(iCoeEnv->WsSession());
+ TApaTask task = taskList.FindApp(TUid::Uid(iMusicStoreUID));
+
+ if (task.Exists())
+ {
+ GfxTransEffect::BeginFullScreen(
+ AknTransEffect::EApplicationStart,
+ TRect(),
+ AknTransEffect::EParameterType,
+ AknTransEffect::GfxTransParam( TUid::Uid(iMusicStoreUID),
+ AknTransEffect::TParameter::EActivateExplicitContinue));
+ task.BringToForeground();
+ }
+ else
+ {
+ RApaLsSession session;
+ if (KErrNone == session.Connect())
+ {
+ CleanupClosePushL(session);
+ TThreadId threadId;
+ session.CreateDocument(KNullDesC, TUid::Uid(iMusicStoreUID),
+ threadId);
+ CleanupStack::PopAndDestroy(&session);
+ }
+ }
+ }
+ }
// End of File
--- a/mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgplaylisthelper.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgplaylisthelper.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -184,6 +184,7 @@
CMPXCollectionPlaylist* playlist = CMPXCollectionPlaylist::NewL( aPath );
CleanupStack::PushL( playlist );
+ playlist->SetShuffleEnabledL( aEnableShuffle );
iPlaybackUtility->SetL( EPbPropertyRandomMode, aEnableShuffle );
iPlaybackUtility->InitL( *playlist, ETrue );
CleanupStack::PopAndDestroy( playlist );
--- a/mpxplugins/viewplugins/views/commonplaybackview/src/mpxcommonplaybackviewimp.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/viewplugins/views/commonplaybackview/src/mpxcommonplaybackviewimp.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -113,7 +113,6 @@
// CONSTANTS
const TInt KMPXOneSecInMilliSecs( 1000 );
const TUid KMPXEqualizerViewImplementationId = { 0x101FFC77 };
-const TUid KMPXMetadataEditorDialogImplementationId = { 0x101FFC83 };
const TInt KMPXPostponeForHandleDelayedError( 1000000 ); // 1S
const TInt KMPXPlaybackViewWindowBackground = -1;
const TInt KMPXDelayForTNRequest( 3000000 ); // 3S
@@ -1633,7 +1632,7 @@
MPX_DEBUG1("CMPXPlaybackViewImp::HandleErrorL()");
MPX_DEBUG1(" > Reset New Item Opened Flag");
iNewItemOpened = EFalse;
- iErrorOccured = EFalse;
+
MPX_DEBUG1( "CMPXCommonPlaybackViewImp::HandleErrorL: Exiting");
}
@@ -1982,7 +1981,6 @@
}
else if ( aError != KErrNone && iLastPBViewActivated )
{
- iErrorOccured = ETrue;
TRAP_IGNORE( DoHandleErrorPlaybackMessageL( aError ) );
}
MPX_DEBUG2("<--CMPXCommonPlaybackViewImp::HandlePlaybackMessage(): aError = %d", aError);
@@ -2174,11 +2172,7 @@
}
case EMPXPbvCmdSongDetails:
{
- if( !iErrorOccured )
- {
- LaunchFileDetailsDialogL();
- }
-
+ LaunchFileDetailsDialogL();
break;
}
case EMPXPbvCmdPlay:
@@ -2723,6 +2717,7 @@
{
MPX_DEBUG1( "CMPXCommonPlaybackViewImp::HandleForegroundEventL requesting media" );
RequestMediaL();
+ UpdateTitlePaneL();
}
}
}
@@ -2766,12 +2761,6 @@
{
case R_MPX_PLAYBACK_VIEW_MENU:
{
- if( iErrorOccured )
- {
- MPX_DEBUG2( "iErrorOccured %d" , iErrorOccured);
- aMenuPane->SetItemDimmed( EMPXPbvCmdSongDetails, ETrue );
- }
-
if ( iIsffButtonPressed )
{
iIsffButtonPressed = EFalse;
@@ -3019,8 +3008,7 @@
// since it'll mess up equilizer's screen
if ( StatusPane()->CurrentLayoutResId() !=
R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT &&
- activeView != KMPXEqualizerViewImplementationId &&
- activeView != KMPXMetadataEditorDialogImplementationId )
+ activeView != KMPXEqualizerViewImplementationId )
{
TRAP_IGNORE(
StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ));
@@ -3079,10 +3067,6 @@
{
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::HandleViewActivation VF" );
iPBViewToBeActivated = ( KMPXPluginTypePlaybackUid == aCurrentViewType.iUid );
- if(iPBViewToBeActivated)
- {
- HandleLayoutChange();
- }
MPX_DEBUG2( "CMPXCommonPlaybackViewImp::HandleViewActivation iPBViewToBeActivated %d", iPBViewToBeActivated );
}
// ---------------------------------------------------------------------------
@@ -3942,13 +3926,11 @@
if( pausePlayControl )
{
TMPXPlaybackState state = iPlaybackUtility->StateL();
- if ( state == EPbStatePlaying )
+ if ((state == EPbStateInitialising) || (state == EPbStatePlaying))
{
pausePlayControl->SetCurrentState(0, ETrue);
}
- //get EPbStateInitialising when skipping to next, ignore it to remove play/pause key flicker
- //It is showing the state that was previously shown when EPbStateInitializing
- else if ( state != EPbStateInitialising )
+ else
{
pausePlayControl->SetCurrentState(1, ETrue);
}
--- a/mpxplugins/viewplugins/views/embeddedplaybackview/inc/mpxembeddedplaybackview.hlp.hrh Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/viewplugins/views/embeddedplaybackview/inc/mpxembeddedplaybackview.hlp.hrh Wed Oct 13 14:28:40 2010 +0300
@@ -20,8 +20,8 @@
#ifndef MPXEMBEDDEDPLAYBACKVIEW_HLP_HRH
#define MPXEMBEDDEDPLAYBACKVIEW_HLP_HRH
-_LIT( KMUS_HLP_EMBED_GENERAL, "MUS_HLP_PLAYBACK_VIEW" );
-_LIT( KMUS_HLP_EMBED_BROWSER, "MUS_HLP_PLAYBACK_VIEW" );
+_LIT( KMUS_HLP_EMBED_GENERAL, "MUS_HLP_EMBED_GENERAL" );
+_LIT( KMUS_HLP_EMBED_BROWSER, "MUS_HLP_EMBED_BROWSER" );
_LIT( KMUS_HLP_EMBED_MESSAGING, "MUS_HLP_PLAYBACK_VIEW" );
#endif // MPXEMBEDDEDPLAYBACKVIEW_HLP_HRH
--- a/mpxplugins/viewplugins/views/embeddedplaybackview/src/mpxembeddedplaybackviewimp.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/viewplugins/views/embeddedplaybackview/src/mpxembeddedplaybackviewimp.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -549,7 +549,7 @@
fileParse.Path().Left(
KMPXMusicplayerPrivateFolder().Length())));
- if ( (iCommonUiHelper->IsHostMessagingL() || iCommonUiHelper->IsHostCalendarL() )
+ if ( iCommonUiHelper->IsHostMessagingL()
&& mediapath.CompareF(savedpath) && isPrivate )
{
HandleSaveL( (TMPXNpvSaveMode)aCommand );
--- a/mpxplugins/viewplugins/views/equalizerview/group/bld.inf Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/viewplugins/views/equalizerview/group/bld.inf Wed Oct 13 14:28:40 2010 +0300
@@ -10,7 +10,6 @@
* Nokia Corporation - initial contribution.
*
* Contributors:
-* NTT DOCOMO, INC - BUG 2358
*
* Description: Build information file for project mpxequalizerview.
*
@@ -23,7 +22,8 @@
PRJ_EXPORTS
// Empty sound file
-../data/nullsound.mp3 z:/system/data/nullsound.mp3
+../data/nullsound.mp3 /epoc32/release/winscw/udeb/z/system/data/nullsound.mp3
+../data/nullsound.mp3 /epoc32/data/z/system/data/nullsound.mp3
PRJ_MMPFILES
mpxequalizerview.mmp
--- a/mpxplugins/viewplugins/views/metadataeditordialog/data/mpxmetadataeditordialog.rss Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/viewplugins/views/metadataeditordialog/data/mpxmetadataeditordialog.rss Wed Oct 13 14:28:40 2010 +0300
@@ -313,24 +313,17 @@
},
DLG_LINE
{
- type = EEikCtEdwin;
+ type = EAknCtPopupField;
prompt = qtn_nmp_song_details_genre;
id = EMPXMetadataEditorDlgCtrlIdGenre;
itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;
- control = EDWIN
+ control = POPUP_FIELD
{
- flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
- width = KMPXSongDetailsTextWidth;
- lines = KMPXSongDetailsTextLines;
- maxlength = KMPXSongDetailsTextMaxLen;
- // added to limit expanding in forms.
- // If you want full screen use 6 here
- max_view_height_in_lines = 6;
- // if you have the line above, you must have this.
- // It is calculable from LAF
- base_line_delta = 21;
+ width = KMPXSongDetailsTextMaxLen;
+ // other = qtn_aknexpopfield_list_other;
};
- },
+ tooltip = qtn_aknexpopfield_hint_text;
+ },
DLG_LINE
{
type = EEikCtEdwin;
@@ -371,7 +364,20 @@
base_line_delta = 21;
};
},
- DLG_LINE
+ DLG_LINE
+ {
+ type = EAknCtPopupField;
+ prompt = qtn_nmp_episode_details_library;
+ id = EMPXMetadataEditorDlgCtrlIdLibrary;
+ itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;
+ control = POPUP_FIELD
+ {
+ width = KMPXSongDetailsTextMaxLen;
+ // other = qtn_aknexpopfield_list_other;
+ };
+ tooltip = qtn_aknexpopfield_hint_text;
+ },
+ DLG_LINE
{
type = EEikCtEdwin;
prompt = qtn_nmp_song_details_licences;
@@ -868,23 +874,16 @@
},
DLG_LINE
{
- type = EEikCtEdwin;
+ type = EAknCtPopupField;
prompt = qtn_nmp_episode_details_genre;
id = EMPXMetadataEditorDlgCtrlIdGenre;
itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;
- control = EDWIN
+ control = POPUP_FIELD
{
- flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
- width = KMPXSongDetailsTextWidth;
- lines = KMPXSongDetailsTextLines;
- maxlength = KMPXSongDetailsTextMaxLen;
- // added to limit expanding in forms.
- // If you want full screen use 6 here
- max_view_height_in_lines = 6;
- // if you have the line above, you must have this.
- // It is calculable from LAF
- base_line_delta = 21;
+ width = KMPXSongDetailsTextMaxLen;
+ // other = qtn_aknexpopfield_list_other;
};
+ tooltip = qtn_aknexpopfield_hint_text;
},
DLG_LINE
{
@@ -906,6 +905,19 @@
base_line_delta = 21;
};
},
+ DLG_LINE
+ {
+ type = EAknCtPopupField;
+ prompt = qtn_nmp_episode_details_library;
+ id = EMPXMetadataEditorDlgCtrlIdLibrary;
+ itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;
+ control = POPUP_FIELD
+ {
+ width = KMPXSongDetailsTextMaxLen;
+ // other = qtn_aknexpopfield_list_other;
+ };
+ tooltip = qtn_aknexpopfield_hint_text;
+ },
DLG_LINE
{
type = EEikCtEdwin;
--- a/mpxplugins/viewplugins/views/metadataeditordialog/src/mpxmetadataeditordialog.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/viewplugins/views/metadataeditordialog/src/mpxmetadataeditordialog.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -69,17 +69,13 @@
#include <mpxcollectionplugin.hrh>
#include <mpxinternalcrkeys.h>
#include <mpxuser.h>
-#include <drmuihandling.h>
-#include <mpxplaybackutility.h>
-
#include "mpxcommonuihelper.h"
#include "mpxmetadataeditordialog.h"
#include "mpxmetadataeditordialog.hrh"
#include "mpxmetadataeditordialog.hlp.hrh"
#include "mpxlog.h"
-#include <mpxmessagegeneraldefs.h>
-#include <mpxplaybackmessage.h>
-#include <caf/caferr.h>
+#include <drmuihandling.h>
+#include <mpxplaybackutility.h>
// CONSTANTS
const TInt KMPXFileDetailsMaxTitleLen = 32;
@@ -197,7 +193,6 @@
delete iDrmInfo;
if ( iPlaybackUtility )
{
- iPlaybackUtility->RemoveObserverL( *this );
iPlaybackUtility->CancelRequest();
iPlaybackUtility->Close();
}
@@ -620,10 +615,6 @@
SetControlNumberL( EMPXMetadataEditorDlgCtrlIdTrackNumber,
iMedia->ValueText( KMPXMediaMusicAlbumTrack ),
KMPXSongDetailsTrackNumMin, KMPXSongDetailsTrackNumMax );
-
- // Fetch the genre
- SetControlTextL( EMPXMetadataEditorDlgCtrlIdGenre,
- iMedia->ValueText( KMPXMediaMusicGenre ), KNullDesC );
// Fetch the year
TInt64 year(0);
@@ -634,15 +625,14 @@
TTime yearTime( year);
iYear = yearTime.DateTime().Year ( );
HBufC* yearBuf = HBufC::NewLC ( KMPXMaxTimeLength );
- if ( iYear > 0)
- {
- yearBuf->Des().AppendNum ( iYear );
- }
+ yearBuf->Des().AppendNum ( iYear );
SetControlNumberL ( EMPXMetadataEditorDlgCtrlIdYear, *yearBuf,
KMPXSongDetailsYearMin, KMPXSongDetailsYearMax );
CleanupStack::PopAndDestroy ( yearBuf );
-
+ // Fetch genre
+ FetchGenreL();
+
// Fetch the comment
SetControlTextL( EMPXMetadataEditorDlgCtrlIdComment,
iMedia->ValueText( KMPXMediaGeneralComment ), KNullDesC );
@@ -2462,7 +2452,6 @@
{
// Get the playback utility instance from engine.
iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault );
- iPlaybackUtility->AddObserverL( *this );
MMPXSource* s = iPlaybackUtility->Source();
if ( s )
{
@@ -2482,6 +2471,28 @@
CleanupStack::PopAndDestroy( &attrs );
}
}
+
+
+ // Podcasting is enabled
+ if ( !iDisablePodcasting )
+ {
+ iPopup = static_cast<CAknPopupField*>
+ ( ControlOrNull( EMPXMetadataEditorDlgCtrlIdLibrary ) );
+ iLibraryArr = new (ELeave) CDesCArrayFlat( 1 );
+ HBufC* custTxt = StringLoader::LoadLC( R_MPX_CUI_GENRE_SELECTION_MUSIC_TEXT );
+ iLibraryArr->AppendL( *custTxt );
+ CleanupStack::PopAndDestroy( custTxt );
+ custTxt = StringLoader::LoadLC( R_MPX_CUI_GENRE_SELECTION_PODCAST_TEXT );
+ iLibraryArr->AppendL( *custTxt );
+ CleanupStack::PopAndDestroy( custTxt );
+ iLibraryValueTextArray = CAknQueryValueTextArray::NewL();
+ iLibraryValueTextArray->SetArray( *iLibraryArr );
+ iLibraryTextValues = CAknQueryValueText::NewL();
+ iLibraryTextValues->SetArrayL( iLibraryValueTextArray );
+ iLibraryTextValues->SetCurrentValueIndex( iCurrentLibrary );
+ // Set values into popup fields
+ iPopup->SetQueryValueL( iLibraryTextValues ); // Moved up from below
+ }
}
// ----------------------------------------------------------------------------
@@ -2497,46 +2508,6 @@
}
// -----------------------------------------------------------------------------
-// CMPXMetadataEditorDialog::HandlePlaybackMessage
-// Handle playback message.
-// ---------------------------------------------------------------------------
-//
-void CMPXMetadataEditorDialog::HandlePlaybackMessage(
- CMPXMessage* aMessage, TInt aError )
- {
- MPX_DEBUG2 ( "CMPXMetadataEditorDialog::HandlePlaybackMessage aError %d " ,aError );
- if ( aError == KErrNone && aMessage )
- {
- TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
- }
- else if ( aError != KErrNone )
- {
- TryExitL( EAknSoftkeyExit );
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// CMPXMetadataEditorDialog::HandlePlaybackMessage
-// Handle playback message.
-// ---------------------------------------------------------------------------
-//
-void CMPXMetadataEditorDialog::DoHandlePlaybackMessageL(
- const CMPXMessage& aMessage )
- {
- MPX_FUNC( "CMPXMetadataEditorDialog::DoHandlePlaybackMessageL(CMPXMessage)" );
-
- TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
- TInt value = aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent );
- if ( KMPXMessageGeneral == id &&
- ( ( value == TMPXPlaybackMessage::EMediaChanged ) || ( value == TMPXPlaybackMessage::ESkipping ) ) )
- {
- MPX_DEBUG1( "CMPXMetadataEditorDialog::DoHandlePlaybackMessageL Dismissing Details view - change in playing media" );
- TryExitL( EAknSoftkeyExit );
- }
- }
-
-// -----------------------------------------------------------------------------
// CMPXMetadataEditorDialog::SaveMediaPropertiesL
// Saves media back to collection engine
// -----------------------------------------------------------------------------
--- a/musichomescreen/data/themes/default/install/musicwidget/group/bld.inf Wed Sep 15 12:09:46 2010 +0300
+++ b/musichomescreen/data/themes/default/install/musicwidget/group/bld.inf Wed Oct 13 14:28:40 2010 +0300
@@ -10,7 +10,6 @@
* Nokia Corporation - initial contribution.
*
* Contributors:
-* NTT DOCOMO, INC - BUG 2358
*
* Description: The information required for building
*
@@ -26,14 +25,23 @@
PRJ_EXPORTS
// Support for R&D builds
//***********************
-// For WINSCW UDEB emulator & IBY exports (engineering versions)
-../hsps/00/manifest.dat Z:/private/200159c0/install/musicwidget/hsps/00/manifest.dat
-../hsps/00/widgetconfiguration.xml Z:/private/200159c0/install/musicwidget/hsps/00/widgetconfiguration.xml
-../hsps/00/musicwidgetconfiguration.dtd Z:/private/200159c0/install/musicwidget/hsps/00/musicwidgetconfiguration.dtd
-../xuikon/00/musicwidget.o0000 Z:/private/200159c0/install/musicwidget/xuikon/00/musicwidget.o0000
-../xuikon/00/MusicWidget.dat Z:/private/200159c0/install/musicwidget/xuikon/00/MusicWidget.dat
-../xuikon/00/MusicWidget.css Z:/private/200159c0/install/musicwidget/xuikon/00/MusicWidget.css
-../xuikon/00/MusicWidget.xml Z:/private/200159c0/install/musicwidget/xuikon/00/MusicWidget.xml
+// For WINSCW UDEB emulator
+../hsps/00/manifest.dat /epoc32/release/winscw/udeb/Z/private/200159c0/install/musicwidget/hsps/00/manifest.dat
+../hsps/00/widgetconfiguration.xml /epoc32/release/winscw/udeb/Z/private/200159c0/install/musicwidget/hsps/00/widgetconfiguration.xml
+../hsps/00/musicwidgetconfiguration.dtd /epoc32/release/winscw/udeb/Z/private/200159c0/install/musicwidget/hsps/00/musicwidgetconfiguration.dtd
+../xuikon/00/musicwidget.o0000 /epoc32/release/winscw/udeb/Z/private/200159c0/install/musicwidget/xuikon/00/musicwidget.o0000
+../xuikon/00/MusicWidget.dat /epoc32/release/winscw/udeb/Z/private/200159c0/install/musicwidget/xuikon/00/MusicWidget.dat
+../xuikon/00/MusicWidget.css /epoc32/release/winscw/udeb/Z/private/200159c0/install/musicwidget/xuikon/00/MusicWidget.css
+../xuikon/00/MusicWidget.xml /epoc32/release/winscw/udeb/Z/private/200159c0/install/musicwidget/xuikon/00/MusicWidget.xml
+
+// For IBY exports (engineering versions)
+../hsps/00/manifest.dat /epoc32/data/Z/private/200159c0/install/musicwidget/hsps/00/manifest.dat
+../hsps/00/widgetconfiguration.xml /epoc32/data/Z/private/200159c0/install/musicwidget/hsps/00/widgetconfiguration.xml
+../hsps/00/musicwidgetconfiguration.dtd /epoc32/data/Z/private/200159c0/install/musicwidget/hsps/00/musicwidgetconfiguration.dtd
+../xuikon/00/musicwidget.o0000 /epoc32/data/Z/private/200159c0/install/musicwidget/xuikon/00/musicwidget.o0000
+../xuikon/00/MusicWidget.dat /epoc32/data/Z/private/200159c0/install/musicwidget/xuikon/00/MusicWidget.dat
+../xuikon/00/MusicWidget.css /epoc32/data/Z/private/200159c0/install/musicwidget/xuikon/00/MusicWidget.css
+../xuikon/00/MusicWidget.xml /epoc32/data/Z/private/200159c0/install/musicwidget/xuikon/00/MusicWidget.xml
// Support for productization and Carbide.Ui customization
//********************************************************
--- a/musichomescreen/group/bld.inf Wed Sep 15 12:09:46 2010 +0300
+++ b/musichomescreen/group/bld.inf Wed Oct 13 14:28:40 2010 +0300
@@ -10,7 +10,6 @@
* Nokia Corporation - initial contribution.
*
* Contributors:
-* NTT DOCOMO, INC - BUG 2358
*
* Description: Build information file for MusicHomeScreen.
*
@@ -31,11 +30,11 @@
-../data/suite.xml z:/private/101F4CD2/import/suites/musicsuite/suite.xml
-../data/music_matrix_items.xml z:/private/101F4CD2/import/suites/musicsuite/music_matrix_items.xml
+../data/suite.xml /epoc32/release/winscw/udeb/z/private/101F4CD2/import/suites/musicsuite/suite.xml
+../data/music_matrix_items.xml /epoc32/release/winscw/udeb/z/private/101F4CD2/import/suites/musicsuite/music_matrix_items.xml
-
-
+../data/suite.xml /epoc32/data/z/private/101F4CD2/import/suites/musicsuite/suite.xml
+../data/music_matrix_items.xml /epoc32/data/z/private/101F4CD2/import/suites/musicsuite/music_matrix_items.xml
PRJ_EXTENSIONS
--- a/musichomescreen/musiccontentpublisher/src/musiccontentpublisher.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/musichomescreen/musiccontentpublisher/src/musiccontentpublisher.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -140,7 +140,7 @@
MPX_DEBUG1("CMusicContentPublisher::ConstructL resources loaded");
// connect to the skin server, to receive skin changed event.
- User::LeaveIfError(iAknsSrvSession.Connect(this));
+ iAknsSrvSession.Connect(this);
// enable skin.
AknsUtils::InitSkinSupportL();
--- a/musichomescreen_multiview/mcpmusicplayer/src/aiplayerpluginengine.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/musichomescreen_multiview/mcpmusicplayer/src/aiplayerpluginengine.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -382,15 +382,9 @@
case TMPXPlaybackMessage::EMediaChanged:
case TMPXPlaybackMessage::EPlaylistUpdated:
{
- MMPXSource* s = iPlaybackUtility->Source();
- if ( s )
- {
- RequestMediaL();
- }
- else
- {
- iObserver->PlaylisIsEmpty();
- }
+ iPlaybackUtility->PropertyL( *this, EPbPropertyPosition );
+ iPlaybackUtility->PropertyL( *this, EPbPropertyDuration );
+ RequestMediaL();
break;
}
case TMPXPlaybackMessage::ECommandReceived:
@@ -546,5 +540,9 @@
s->MediaL( attrs.Array(), *this );
CleanupStack::PopAndDestroy( &attrs );
}
+ else
+ {
+ iObserver->PlaylisIsEmpty();
+ }
}
// End of File
--- a/musichomescreen_multiview/mcpmusicplayer/src/mcpmusicplayer.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/musichomescreen_multiview/mcpmusicplayer/src/mcpmusicplayer.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -1085,7 +1085,7 @@
//
void CMCPMusicPlayer::PlaylisIsEmpty()
{
- TRAP_IGNORE( DoHandlePlaylisIsEmptyL() );
+ //TRAP_IGNORE( DoHandlePlaylisIsEmptyL() );
}
// ---------------------------------------------------------------------------
// From MAiPlayerPluginEngineObserver
--- a/musichomescreen_multiview/musiccontentpublisher/src/musiccontentpublisher.cpp Wed Sep 15 12:09:46 2010 +0300
+++ b/musichomescreen_multiview/musiccontentpublisher/src/musiccontentpublisher.cpp Wed Oct 13 14:28:40 2010 +0300
@@ -150,7 +150,7 @@
MPX_DEBUG1("CMusicContentPublisher::ConstructL resources loaded");
// connect to the skin server, to receive skin changed event.
- User::LeaveIfError(iAknsSrvSession.Connect(this));
+ iAknsSrvSession.Connect(this);
// enable skin.
AknsUtils::InitSkinSupportL();
--- a/musicplayer_plat/mpx_music_player_app_api/inc/mpxcommonuihelper.h Wed Sep 15 12:09:46 2010 +0300
+++ b/musicplayer_plat/mpx_music_player_app_api/inc/mpxcommonuihelper.h Wed Oct 13 14:28:40 2010 +0300
@@ -91,13 +91,6 @@
* @return ETrue if host is messaging, EFalse otherwise
*/
IMPORT_C TBool IsHostMessagingL();
-
- /**
- * Check if the host application is calendar
- * @since Symbian^3
- * @return ETrue if host is calendar, EFalse otherwise
- */
- IMPORT_C TBool IsHostCalendarL();
/**
* Check if the host application is browser