--- a/app/app.pro Mon May 03 12:29:20 2010 +0300
+++ b/app/app.pro Fri May 14 15:49:53 2010 +0300
@@ -110,5 +110,7 @@
" DATATYPE { priority=EDataTypePrioritySystem; type=\"audio/x-wav\"; }," \
" DATATYPE { priority=EDataTypePrioritySystem; type=\"audio/x-au\"; }," \
" DATATYPE { priority=EDataTypePrioritySystem; type=\"audio/au\"; }, " \
-" DATATYPE { priority=EDataTypePrioritySystem; type=\"application/vnd.nokia.ringing-tone\"; }" \
+" DATATYPE { priority=EDataTypePrioritySystem; type=\"application/vnd.nokia.ringing-tone\"; }, " \
+" DATATYPE { priority=EDataTypePrioritySystem; type=\"audio/x-mpegurl\"; }, " \
+" DATATYPE { priority=EDataTypePrioritySystem; type=\"audio/mpegurl\"; }" \
" };" \
\ No newline at end of file
--- a/app/src/mpmainwindow.cpp Mon May 03 12:29:20 2010 +0300
+++ b/app/src/mpmainwindow.cpp Fri May 14 15:49:53 2010 +0300
@@ -137,7 +137,7 @@
activateView(CollectionView);
connect(this, SIGNAL( orientationChanged( Qt::Orientation ) ), SLOT( switchView( Qt::Orientation ) ) );
- connect( engine, SIGNAL( libraryRefreshed() ), SLOT( handleLibraryUpdated() ) );
+ connect( engine, SIGNAL( libraryUpdated() ), SLOT( handleLibraryUpdated() ) );
engine->checkForSystemEvents();
loadView( PlaybackView );
}
@@ -293,7 +293,7 @@
loadView(PlaybackView, MpCommon::FetchView );
MpViewBase* playbackView = reinterpret_cast<MpViewBase*>(mPlaybackViewPlugin->getView());
connect(playbackView, SIGNAL(songSelected(QString)), mMusicServices, SLOT(itemSelected(QString)));
- connect( engine, SIGNAL( libraryRefreshed() ), this, SLOT( handleLibraryUpdated() ) );
+ connect( engine, SIGNAL( libraryUpdated() ), this, SLOT( handleLibraryUpdated() ) );
engine->checkForSystemEvents();
break;
}
--- a/inc/mpengine.h Mon May 03 12:29:20 2010 +0300
+++ b/inc/mpengine.h Fri May 14 15:49:53 2010 +0300
@@ -26,7 +26,7 @@
class QStringList;
class QTranslator;
-class HbProgressDialog;
+class HbPopup;
class MpMpxHarvesterFrameworkWrapper;
class MpSongScanner;
class MpMediaKeyHandler;
@@ -67,7 +67,6 @@
void close();
// Harvester related
- void refreshLibrary();
bool verifyUsbBlocking( bool showMessage = false );
void checkForSystemEvents();
@@ -97,8 +96,8 @@
signals:
// Harvester related
- void libraryAboutToRefresh();
- void libraryRefreshed();
+ void libraryAboutToUpdate();
+ void libraryUpdated();
void usbBlocked( bool blocked );
// Collection related
@@ -112,11 +111,12 @@
public slots:
// Harvester related
+ void refreshLibrary();
void handleScanStarted();
void handleScanEnded( int count, int error );
void handleDiskEvent( MpxDiskEvents event );
void handleUsbEvent( MpxUsbEvents event );
- void handleBlockingNoteClosing();
+ void handleOutstandingNoteClosing();
// Collection related
void reopenCollection();
@@ -144,6 +144,7 @@
void changeUsbBlockingState( UsbBlockingState state );
void launchBlockingNote();
+ void setOutstandingPopup( HbPopup *popup );
private:
@@ -153,7 +154,7 @@
MpMpxHarvesterFrameworkWrapper *mMpxHarvesterWrapper; // Own
MpSongScanner *mSongScanner; // Own
MpMediaKeyHandler *mMediaKeyHandler; // Own
- HbProgressDialog *mUsbBlockingNote; // Own
+ HbPopup *mUsbOutstandingNote; // Own
// Collection related
MpMpxCollectionFrameworkWrapper *mMpxCollectionWrapper; //Own
--- a/mpengine/bwins/mpengineu.def Mon May 03 12:29:20 2010 +0300
+++ b/mpengine/bwins/mpengineu.def Fri May 14 15:49:53 2010 +0300
@@ -9,17 +9,17 @@
?saveToCurrentPlaylist@MpEngine@@QAEXAAV?$QList@H@@PAVMpMpxCollectionData@@@Z @ 8 NONAME ; void MpEngine::saveToCurrentPlaylist(class QList<int> &, class MpMpxCollectionData *)
?getStaticMetaObject@MpEngine@@SAABUQMetaObject@@XZ @ 9 NONAME ; struct QMetaObject const & MpEngine::getStaticMetaObject(void)
?renamePlaylist@MpEngine@@QAEXAAVQString@@@Z @ 10 NONAME ; void MpEngine::renamePlaylist(class QString &)
- ?setRepeat@MpEngine@@QAEX_N@Z @ 11 NONAME ; void MpEngine::setRepeat(bool)
- ?collectionData@MpEngine@@QAEPAVMpMpxCollectionData@@XZ @ 12 NONAME ; class MpMpxCollectionData * MpEngine::collectionData(void)
- ?createPlaylist@MpEngine@@QAEXAAVQString@@AAV?$QList@H@@PAVMpMpxCollectionData@@@Z @ 13 NONAME ; void MpEngine::createPlaylist(class QString &, class QList<int> &, class MpMpxCollectionData *)
- ?collectionPlaylistOpened@MpEngine@@IAEXXZ @ 14 NONAME ; void MpEngine::collectionPlaylistOpened(void)
- ?playlistsRenamed@MpEngine@@IAEX_N@Z @ 15 NONAME ; void MpEngine::playlistsRenamed(bool)
- ?playPause@MpEngine@@QAEXXZ @ 16 NONAME ; void MpEngine::playPause(void)
- ?checkForSystemEvents@MpEngine@@QAEXXZ @ 17 NONAME ; void MpEngine::checkForSystemEvents(void)
- ?renamePlaylist@MpEngine@@QAEXAAVQString@@H@Z @ 18 NONAME ; void MpEngine::renamePlaylist(class QString &, int)
- ?handleUsbMtpEndEvent@MpEngine@@AAEXXZ @ 19 NONAME ; void MpEngine::handleUsbMtpEndEvent(void)
- ?playEmbedded@MpEngine@@QAEXABVXQSharableFile@@@Z @ 20 NONAME ; void MpEngine::playEmbedded(class XQSharableFile const &)
- ?libraryAboutToRefresh@MpEngine@@IAEXXZ @ 21 NONAME ; void MpEngine::libraryAboutToRefresh(void)
+ ?libraryUpdated@MpEngine@@IAEXXZ @ 11 NONAME ; void MpEngine::libraryUpdated(void)
+ ?setRepeat@MpEngine@@QAEX_N@Z @ 12 NONAME ; void MpEngine::setRepeat(bool)
+ ?collectionData@MpEngine@@QAEPAVMpMpxCollectionData@@XZ @ 13 NONAME ; class MpMpxCollectionData * MpEngine::collectionData(void)
+ ?createPlaylist@MpEngine@@QAEXAAVQString@@AAV?$QList@H@@PAVMpMpxCollectionData@@@Z @ 14 NONAME ; void MpEngine::createPlaylist(class QString &, class QList<int> &, class MpMpxCollectionData *)
+ ?collectionPlaylistOpened@MpEngine@@IAEXXZ @ 15 NONAME ; void MpEngine::collectionPlaylistOpened(void)
+ ?playlistsRenamed@MpEngine@@IAEX_N@Z @ 16 NONAME ; void MpEngine::playlistsRenamed(bool)
+ ?playPause@MpEngine@@QAEXXZ @ 17 NONAME ; void MpEngine::playPause(void)
+ ?checkForSystemEvents@MpEngine@@QAEXXZ @ 18 NONAME ; void MpEngine::checkForSystemEvents(void)
+ ?renamePlaylist@MpEngine@@QAEXAAVQString@@H@Z @ 19 NONAME ; void MpEngine::renamePlaylist(class QString &, int)
+ ?handleUsbMtpEndEvent@MpEngine@@AAEXXZ @ 20 NONAME ; void MpEngine::handleUsbMtpEndEvent(void)
+ ?playEmbedded@MpEngine@@QAEXABVXQSharableFile@@@Z @ 21 NONAME ; void MpEngine::playEmbedded(class XQSharableFile const &)
?skipForward@MpEngine@@QAEXXZ @ 22 NONAME ; void MpEngine::skipForward(void)
?staticMetaObject@MpEngine@@2UQMetaObject@@B @ 23 NONAME ; struct QMetaObject const MpEngine::staticMetaObject
?setShuffle@MpEngine@@QAEX_N@Z @ 24 NONAME ; void MpEngine::setShuffle(bool)
@@ -32,35 +32,36 @@
?handleScanStarted@MpEngine@@QAEXXZ @ 31 NONAME ; void MpEngine::handleScanStarted(void)
?initialize@MpEngine@@QAEXW4MpViewMode@MpCommon@@VTUid@@@Z @ 32 NONAME ; void MpEngine::initialize(enum MpCommon::MpViewMode, class TUid)
?playbackData@MpEngine@@QAEPAVMpPlaybackData@@XZ @ 33 NONAME ; class MpPlaybackData * MpEngine::playbackData(void)
- ?stop@MpEngine@@QAEXXZ @ 34 NONAME ; void MpEngine::stop(void)
- ?back@MpEngine@@QAEXXZ @ 35 NONAME ; void MpEngine::back(void)
- ?openCollection@MpEngine@@QAEXW4TCollectionContext@@@Z @ 36 NONAME ; void MpEngine::openCollection(enum TCollectionContext)
- ?trUtf8@MpEngine@@SA?AVQString@@PBD0H@Z @ 37 NONAME ; class QString MpEngine::trUtf8(char const *, char const *, int)
- ?reopenCollection@MpEngine@@QAEXXZ @ 38 NONAME ; void MpEngine::reopenCollection(void)
- ?handleUsbEvent@MpEngine@@QAEXW4MpxUsbEvents@@@Z @ 39 NONAME ; void MpEngine::handleUsbEvent(enum MpxUsbEvents)
- ?songsDeleted@MpEngine@@IAEX_N@Z @ 40 NONAME ; void MpEngine::songsDeleted(bool)
- ?handleUsbMassStorageStartEvent@MpEngine@@AAEXXZ @ 41 NONAME ; void MpEngine::handleUsbMassStorageStartEvent(void)
- ?qt_metacast@MpEngine@@UAEPAXPBD@Z @ 42 NONAME ; void * MpEngine::qt_metacast(char const *)
- ?handleDiskEvent@MpEngine@@QAEXW4MpxDiskEvents@@@Z @ 43 NONAME ; void MpEngine::handleDiskEvent(enum MpxDiskEvents)
- ?verifyUsbBlocking@MpEngine@@QAE_N_N@Z @ 44 NONAME ; bool MpEngine::verifyUsbBlocking(bool)
- ?saveToPlaylist@MpEngine@@QAEXHAAV?$QList@H@@@Z @ 45 NONAME ; void MpEngine::saveToPlaylist(int, class QList<int> &)
- ?handleUsbMassStorageEndEvent@MpEngine@@AAEXXZ @ 46 NONAME ; void MpEngine::handleUsbMassStorageEndEvent(void)
- ?usbBlocked@MpEngine@@IAEX_N@Z @ 47 NONAME ; void MpEngine::usbBlocked(bool)
- ??0MpEngine@@AAE@XZ @ 48 NONAME ; MpEngine::MpEngine(void)
- ?handleUsbMtpNotActive@MpEngine@@AAEXXZ @ 49 NONAME ; void MpEngine::handleUsbMtpNotActive(void)
- ?libraryRefreshed@MpEngine@@IAEXXZ @ 50 NONAME ; void MpEngine::libraryRefreshed(void)
- ?tr@MpEngine@@SA?AVQString@@PBD0H@Z @ 51 NONAME ; class QString MpEngine::tr(char const *, char const *, int)
- ?trUtf8@MpEngine@@SA?AVQString@@PBD0@Z @ 52 NONAME ; class QString MpEngine::trUtf8(char const *, char const *)
- ?findPlaylists@MpEngine@@QAEXAAVQStringList@@@Z @ 53 NONAME ; void MpEngine::findPlaylists(class QStringList &)
- ?close@MpEngine@@QAEXXZ @ 54 NONAME ; void MpEngine::close(void)
- ?isolatedCollectionOpened@MpEngine@@IAEXPAVMpMpxCollectionData@@@Z @ 55 NONAME ; void MpEngine::isolatedCollectionOpened(class MpMpxCollectionData *)
- ?handleScanEnded@MpEngine@@QAEXHH@Z @ 56 NONAME ; void MpEngine::handleScanEnded(int, int)
- ?previewItem@MpEngine@@QAEXH@Z @ 57 NONAME ; void MpEngine::previewItem(int)
- ?skipBackward@MpEngine@@QAEXXZ @ 58 NONAME ; void MpEngine::skipBackward(void)
- ??1MpEngine@@UAE@XZ @ 59 NONAME ; MpEngine::~MpEngine(void)
- ??_EMpEngine@@UAE@I@Z @ 60 NONAME ; MpEngine::~MpEngine(unsigned int)
- ?changeUsbBlockingState@MpEngine@@AAEXW4UsbBlockingState@1@@Z @ 61 NONAME ; void MpEngine::changeUsbBlockingState(enum MpEngine::UsbBlockingState)
- ?handleBlockingNoteClosing@MpEngine@@QAEXXZ @ 62 NONAME ; void MpEngine::handleBlockingNoteClosing(void)
- ?deleteSongs@MpEngine@@QAEXAAV?$QList@H@@@Z @ 63 NONAME ; void MpEngine::deleteSongs(class QList<int> &)
- ?reorderPlaylist@MpEngine@@QAEXHHHH@Z @ 64 NONAME ; void MpEngine::reorderPlaylist(int, int, int, int)
+ ?handleOutstandingNoteClosing@MpEngine@@QAEXXZ @ 34 NONAME ; void MpEngine::handleOutstandingNoteClosing(void)
+ ?stop@MpEngine@@QAEXXZ @ 35 NONAME ; void MpEngine::stop(void)
+ ?setOutstandingPopup@MpEngine@@AAEXPAVHbPopup@@@Z @ 36 NONAME ; void MpEngine::setOutstandingPopup(class HbPopup *)
+ ?back@MpEngine@@QAEXXZ @ 37 NONAME ; void MpEngine::back(void)
+ ?libraryAboutToUpdate@MpEngine@@IAEXXZ @ 38 NONAME ; void MpEngine::libraryAboutToUpdate(void)
+ ?openCollection@MpEngine@@QAEXW4TCollectionContext@@@Z @ 39 NONAME ; void MpEngine::openCollection(enum TCollectionContext)
+ ?trUtf8@MpEngine@@SA?AVQString@@PBD0H@Z @ 40 NONAME ; class QString MpEngine::trUtf8(char const *, char const *, int)
+ ?reopenCollection@MpEngine@@QAEXXZ @ 41 NONAME ; void MpEngine::reopenCollection(void)
+ ?handleUsbEvent@MpEngine@@QAEXW4MpxUsbEvents@@@Z @ 42 NONAME ; void MpEngine::handleUsbEvent(enum MpxUsbEvents)
+ ?songsDeleted@MpEngine@@IAEX_N@Z @ 43 NONAME ; void MpEngine::songsDeleted(bool)
+ ?handleUsbMassStorageStartEvent@MpEngine@@AAEXXZ @ 44 NONAME ; void MpEngine::handleUsbMassStorageStartEvent(void)
+ ?qt_metacast@MpEngine@@UAEPAXPBD@Z @ 45 NONAME ; void * MpEngine::qt_metacast(char const *)
+ ?handleDiskEvent@MpEngine@@QAEXW4MpxDiskEvents@@@Z @ 46 NONAME ; void MpEngine::handleDiskEvent(enum MpxDiskEvents)
+ ?verifyUsbBlocking@MpEngine@@QAE_N_N@Z @ 47 NONAME ; bool MpEngine::verifyUsbBlocking(bool)
+ ?saveToPlaylist@MpEngine@@QAEXHAAV?$QList@H@@@Z @ 48 NONAME ; void MpEngine::saveToPlaylist(int, class QList<int> &)
+ ?handleUsbMassStorageEndEvent@MpEngine@@AAEXXZ @ 49 NONAME ; void MpEngine::handleUsbMassStorageEndEvent(void)
+ ?usbBlocked@MpEngine@@IAEX_N@Z @ 50 NONAME ; void MpEngine::usbBlocked(bool)
+ ??0MpEngine@@AAE@XZ @ 51 NONAME ; MpEngine::MpEngine(void)
+ ?handleUsbMtpNotActive@MpEngine@@AAEXXZ @ 52 NONAME ; void MpEngine::handleUsbMtpNotActive(void)
+ ?tr@MpEngine@@SA?AVQString@@PBD0H@Z @ 53 NONAME ; class QString MpEngine::tr(char const *, char const *, int)
+ ?trUtf8@MpEngine@@SA?AVQString@@PBD0@Z @ 54 NONAME ; class QString MpEngine::trUtf8(char const *, char const *)
+ ?findPlaylists@MpEngine@@QAEXAAVQStringList@@@Z @ 55 NONAME ; void MpEngine::findPlaylists(class QStringList &)
+ ?close@MpEngine@@QAEXXZ @ 56 NONAME ; void MpEngine::close(void)
+ ?isolatedCollectionOpened@MpEngine@@IAEXPAVMpMpxCollectionData@@@Z @ 57 NONAME ; void MpEngine::isolatedCollectionOpened(class MpMpxCollectionData *)
+ ?handleScanEnded@MpEngine@@QAEXHH@Z @ 58 NONAME ; void MpEngine::handleScanEnded(int, int)
+ ?previewItem@MpEngine@@QAEXH@Z @ 59 NONAME ; void MpEngine::previewItem(int)
+ ?skipBackward@MpEngine@@QAEXXZ @ 60 NONAME ; void MpEngine::skipBackward(void)
+ ??1MpEngine@@UAE@XZ @ 61 NONAME ; MpEngine::~MpEngine(void)
+ ??_EMpEngine@@UAE@I@Z @ 62 NONAME ; MpEngine::~MpEngine(unsigned int)
+ ?changeUsbBlockingState@MpEngine@@AAEXW4UsbBlockingState@1@@Z @ 63 NONAME ; void MpEngine::changeUsbBlockingState(enum MpEngine::UsbBlockingState)
+ ?deleteSongs@MpEngine@@QAEXAAV?$QList@H@@@Z @ 64 NONAME ; void MpEngine::deleteSongs(class QList<int> &)
+ ?reorderPlaylist@MpEngine@@QAEXHHHH@Z @ 65 NONAME ; void MpEngine::reorderPlaylist(int, int, int, int)
--- a/mpengine/eabi/mpengineu.def Mon May 03 12:29:20 2010 +0300
+++ b/mpengine/eabi/mpengineu.def Fri May 14 15:49:53 2010 +0300
@@ -18,15 +18,15 @@
_ZN8MpEngine14collectionDataEv @ 17 NONAME
_ZN8MpEngine14createPlaylistER7QStringR5QListIiEP19MpMpxCollectionData @ 18 NONAME
_ZN8MpEngine14handleUsbEventE12MpxUsbEvents @ 19 NONAME
- _ZN8MpEngine14openCollectionE18TCollectionContext @ 20 NONAME
- _ZN8MpEngine14refreshLibraryEv @ 21 NONAME
- _ZN8MpEngine14renamePlaylistER7QString @ 22 NONAME
- _ZN8MpEngine14renamePlaylistER7QStringi @ 23 NONAME
- _ZN8MpEngine14saveToPlaylistEiR5QListIiE @ 24 NONAME
- _ZN8MpEngine15handleDiskEventE13MpxDiskEvents @ 25 NONAME
- _ZN8MpEngine15handleScanEndedEii @ 26 NONAME
- _ZN8MpEngine15reorderPlaylistEiiii @ 27 NONAME
- _ZN8MpEngine16libraryRefreshedEv @ 28 NONAME
+ _ZN8MpEngine14libraryUpdatedEv @ 20 NONAME
+ _ZN8MpEngine14openCollectionE18TCollectionContext @ 21 NONAME
+ _ZN8MpEngine14refreshLibraryEv @ 22 NONAME
+ _ZN8MpEngine14renamePlaylistER7QString @ 23 NONAME
+ _ZN8MpEngine14renamePlaylistER7QStringi @ 24 NONAME
+ _ZN8MpEngine14saveToPlaylistEiR5QListIiE @ 25 NONAME
+ _ZN8MpEngine15handleDiskEventE13MpxDiskEvents @ 26 NONAME
+ _ZN8MpEngine15handleScanEndedEii @ 27 NONAME
+ _ZN8MpEngine15reorderPlaylistEiiii @ 28 NONAME
_ZN8MpEngine16playlistsRenamedEb @ 29 NONAME
_ZN8MpEngine16reopenCollectionEv @ 30 NONAME
_ZN8MpEngine16staticMetaObjectE @ 31 NONAME DATA 16
@@ -35,32 +35,33 @@
_ZN8MpEngine18launchBlockingNoteEv @ 34 NONAME
_ZN8MpEngine18openCollectionItemEi @ 35 NONAME
_ZN8MpEngine19getStaticMetaObjectEv @ 36 NONAME
- _ZN8MpEngine20checkForSystemEventsEv @ 37 NONAME
- _ZN8MpEngine20handleUsbMtpEndEventEv @ 38 NONAME
- _ZN8MpEngine21handleUsbMtpNotActiveEv @ 39 NONAME
- _ZN8MpEngine21libraryAboutToRefreshEv @ 40 NONAME
- _ZN8MpEngine21saveToCurrentPlaylistER5QListIiEP19MpMpxCollectionData @ 41 NONAME
- _ZN8MpEngine22changeUsbBlockingStateENS_16UsbBlockingStateE @ 42 NONAME
- _ZN8MpEngine22handleUsbMtpStartEventEv @ 43 NONAME
- _ZN8MpEngine22openIsolatedCollectionE18TCollectionContext @ 44 NONAME
- _ZN8MpEngine24collectionPlaylistOpenedEv @ 45 NONAME
- _ZN8MpEngine24isolatedCollectionOpenedEP19MpMpxCollectionData @ 46 NONAME
- _ZN8MpEngine25handleBlockingNoteClosingEv @ 47 NONAME
+ _ZN8MpEngine19setOutstandingPopupEP7HbPopup @ 37 NONAME
+ _ZN8MpEngine20checkForSystemEventsEv @ 38 NONAME
+ _ZN8MpEngine20handleUsbMtpEndEventEv @ 39 NONAME
+ _ZN8MpEngine20libraryAboutToUpdateEv @ 40 NONAME
+ _ZN8MpEngine21handleUsbMtpNotActiveEv @ 41 NONAME
+ _ZN8MpEngine21saveToCurrentPlaylistER5QListIiEP19MpMpxCollectionData @ 42 NONAME
+ _ZN8MpEngine22changeUsbBlockingStateENS_16UsbBlockingStateE @ 43 NONAME
+ _ZN8MpEngine22handleUsbMtpStartEventEv @ 44 NONAME
+ _ZN8MpEngine22openIsolatedCollectionE18TCollectionContext @ 45 NONAME
+ _ZN8MpEngine24collectionPlaylistOpenedEv @ 46 NONAME
+ _ZN8MpEngine24isolatedCollectionOpenedEP19MpMpxCollectionData @ 47 NONAME
_ZN8MpEngine25releaseIsolatedCollectionEv @ 48 NONAME
- _ZN8MpEngine28handleUsbMassStorageEndEventEv @ 49 NONAME
- _ZN8MpEngine30handleUsbMassStorageStartEventEv @ 50 NONAME
- _ZN8MpEngine4backEv @ 51 NONAME
- _ZN8MpEngine4stopEv @ 52 NONAME
- _ZN8MpEngine5closeEv @ 53 NONAME
- _ZN8MpEngine8instanceEv @ 54 NONAME
- _ZN8MpEngine9playPauseEv @ 55 NONAME
- _ZN8MpEngine9setRepeatEb @ 56 NONAME
- _ZN8MpEngineC1Ev @ 57 NONAME
- _ZN8MpEngineC2Ev @ 58 NONAME
- _ZN8MpEngineD0Ev @ 59 NONAME
- _ZN8MpEngineD1Ev @ 60 NONAME
- _ZN8MpEngineD2Ev @ 61 NONAME
- _ZNK8MpEngine10metaObjectEv @ 62 NONAME
- _ZTI8MpEngine @ 63 NONAME
- _ZTV8MpEngine @ 64 NONAME
+ _ZN8MpEngine28handleOutstandingNoteClosingEv @ 49 NONAME
+ _ZN8MpEngine28handleUsbMassStorageEndEventEv @ 50 NONAME
+ _ZN8MpEngine30handleUsbMassStorageStartEventEv @ 51 NONAME
+ _ZN8MpEngine4backEv @ 52 NONAME
+ _ZN8MpEngine4stopEv @ 53 NONAME
+ _ZN8MpEngine5closeEv @ 54 NONAME
+ _ZN8MpEngine8instanceEv @ 55 NONAME
+ _ZN8MpEngine9playPauseEv @ 56 NONAME
+ _ZN8MpEngine9setRepeatEb @ 57 NONAME
+ _ZN8MpEngineC1Ev @ 58 NONAME
+ _ZN8MpEngineC2Ev @ 59 NONAME
+ _ZN8MpEngineD0Ev @ 60 NONAME
+ _ZN8MpEngineD1Ev @ 61 NONAME
+ _ZN8MpEngineD2Ev @ 62 NONAME
+ _ZNK8MpEngine10metaObjectEv @ 63 NONAME
+ _ZTI8MpEngine @ 64 NONAME
+ _ZTV8MpEngine @ 65 NONAME
--- a/mpengine/src/mpengine.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpengine/src/mpengine.cpp Fri May 14 15:49:53 2010 +0300
@@ -19,6 +19,7 @@
#include <QLocale>
#include <hbmessagebox.h>
#include <hbprogressdialog.h>
+#include <hbaction.h>
#include <hbinstance.h>
#include <xqsharablefile.h>
@@ -66,7 +67,7 @@
*/
/*!
- \fn void libraryRefreshed()
+ \fn void libraryUpdated()
This signal is emitted when MpSongScannerHelper ends scanning,
or USB-MTP Synchronization finishes.
@@ -182,7 +183,7 @@
: mMpxHarvesterWrapper(0),
mSongScanner(0),
mMediaKeyHandler(0),
- mUsbBlockingNote(0),
+ mUsbOutstandingNote(0),
mMpxCollectionWrapper(0),
mMpxPlaybackWrapper(0),
mMpTranslator(0),
@@ -284,8 +285,8 @@
mSongScanner = 0;
delete mMediaKeyHandler;
mMediaKeyHandler = 0;
- delete mUsbBlockingNote;
- mUsbBlockingNote = 0;
+ delete mUsbOutstandingNote;
+ mUsbOutstandingNote = 0;
delete mMpxPlaybackWrapper;
mMpxPlaybackWrapper = 0;
delete mMpxHarvesterWrapper;
@@ -301,20 +302,6 @@
*/
/*!
- Refresh library by starting the scan.
- If scanning is already ongoing, this request is ignored.
- */
-void MpEngine::refreshLibrary()
-{
- TX_ENTRY
- if ( !verifyUsbBlocking( true ) ) {
- emit libraryAboutToRefresh();
- mSongScanner->scan();
- }
- TX_EXIT
-}
-
-/*!
\
Used to verify if an action can be executed depending on USB blocking state.
If not, a notification note might be displayed.
@@ -326,10 +313,11 @@
if ( mUsbBlockingState == USB_Connected ) {
result = true;
if ( showMessage ) {
- HbMessageBox dialog ( HbMessageBox::MessageTypeInformation );
- dialog.setText( QString( tr( "USB connection in progress. Cannot proceed with operation" ) ) );
- dialog.setModal( true );
- dialog.exec();
+ HbMessageBox *dialog = new HbMessageBox( HbMessageBox::MessageTypeInformation );
+ dialog->setText( hbTrId( "txt_mus_info_usb_conn_in_progress" ) );
+ dialog->setModal( true );
+ setOutstandingPopup( dialog );
+ mUsbOutstandingNote->show();;
}
}
TX_EXIT
@@ -348,6 +336,20 @@
}
/*!
+ Slot to be called to start Refresh library process.
+ If scanning is already ongoing, this request is ignored.
+ */
+void MpEngine::refreshLibrary()
+{
+ TX_ENTRY
+ if ( !verifyUsbBlocking( true ) ) {
+ emit libraryAboutToUpdate();
+ mSongScanner->scan();
+ }
+ TX_EXIT
+}
+
+/*!
Slot to be called when song scanning starts.
*/
void MpEngine::handleScanStarted() {
@@ -364,7 +366,7 @@
Q_UNUSED( count );
Q_UNUSED( error );
mMediaKeyHandler->setEnabled(true);
- emit libraryRefreshed();
+ emit libraryUpdated();
TX_EXIT
}
@@ -383,7 +385,7 @@
break;
case DiskRemoved:
if ( mUsbBlockingState != USB_Synchronizing ) {
- emit libraryRefreshed();
+ emit libraryUpdated();
}
break;
case DiskInserted:
@@ -391,7 +393,7 @@
refreshLibrary();
}
else if ( mUsbBlockingState == USB_Connected ) {
- emit libraryRefreshed();
+ emit libraryUpdated();
}
break;
default:
@@ -428,12 +430,12 @@
}
/*!
- Slot to be called when mUsbBlockingNote is about to close.
+ Slot to be called when mUsbOutstandingNote is about to close.
*/
-void MpEngine::handleBlockingNoteClosing()
+void MpEngine::handleOutstandingNoteClosing()
{
TX_ENTRY
- mUsbBlockingNote = 0;
+ mUsbOutstandingNote = 0;
TX_EXIT
}
@@ -463,18 +465,20 @@
changeUsbBlockingState( USB_NotConnected );
emit usbBlocked(false);
-
- if ( mUsbBlockingNote ) {
- mUsbBlockingNote->close();
- }
- HbMessageBox promptRefresh( HbMessageBox::MessageTypeQuestion );
- promptRefresh.setText( QString( tr( "List may need refreshing due to recent USB synchronisation. Refresh now?" ) ) );
- promptRefresh.setTimeout( HbPopup::NoTimeout );
- promptRefresh.setModal( true );
- HbAction *action = promptRefresh.exec();
- if ( action == promptRefresh.primaryAction() ) {
- refreshLibrary();
- }
+
+ HbAction *action;
+ HbMessageBox *promptRefresh = new HbMessageBox( HbMessageBox::MessageTypeQuestion );
+ promptRefresh->setText( hbTrId( "txt_mus_info_music_may_need_to_be_refreshed" ) );
+ promptRefresh->setTimeout( HbPopup::NoTimeout );
+ promptRefresh->setModal( true );
+ promptRefresh->clearActions();
+ action = new HbAction( hbTrId( "txt_common_button_yes" ) );
+ connect( action, SIGNAL( triggered() ), this, SLOT( refreshLibrary() ) );
+ promptRefresh->addAction( action );
+ action = new HbAction( hbTrId( "txt_common_button_no" ) );
+ promptRefresh->addAction( action );
+ setOutstandingPopup( promptRefresh );
+ mUsbOutstandingNote->show();
TX_EXIT
}
@@ -490,7 +494,7 @@
emit usbBlocked(true);
//Cancel any ongoing operation.
- emit libraryAboutToRefresh();
+ emit libraryAboutToUpdate();
launchBlockingNote();
@@ -508,11 +512,11 @@
changeUsbBlockingState( USB_NotConnected );
emit usbBlocked(false);
- if ( mUsbBlockingNote ) {
- mUsbBlockingNote->close();
+ if ( mUsbOutstandingNote ) {
+ mUsbOutstandingNote->close();
}
if ( mPreviousUsbState == USB_Synchronizing ) {
- emit libraryRefreshed();
+ emit libraryUpdated();
}
TX_EXIT
}
@@ -547,19 +551,38 @@
void MpEngine::launchBlockingNote()
{
TX_ENTRY
- if ( !mUsbBlockingNote ) {
- mUsbBlockingNote = new HbProgressDialog( HbProgressDialog::WaitDialog );
- mUsbBlockingNote->setModal( true );
- mUsbBlockingNote->setPrimaryAction( 0 );
- mUsbBlockingNote->setTextAlignment( Qt::AlignCenter );
- mUsbBlockingNote->setAttribute( Qt::WA_DeleteOnClose );
- mUsbBlockingNote->setDismissPolicy( HbPopup::NoDismiss );
- mUsbBlockingNote->setText( QString( tr( "USB connection in progress" ) ) );
- connect( mUsbBlockingNote, SIGNAL( aboutToClose() ), this, SLOT( handleBlockingNoteClosing() ) );
+
+ HbProgressDialog *usbBlockingNote = new HbProgressDialog( HbProgressDialog::WaitDialog );
+ usbBlockingNote->setModal( true );
+ if ( usbBlockingNote->actions().count() ) {
+ //Hide cancel action.
+ usbBlockingNote->actions().at( 0 )->setVisible( false );
}
-
- mUsbBlockingNote->show();
+ usbBlockingNote->setDismissPolicy( HbPopup::NoDismiss );
+ usbBlockingNote->setText( hbTrId( "txt_mus_info_usb_conn_in_progress" ) );
+ setOutstandingPopup( usbBlockingNote );
+ mUsbOutstandingNote->show();
+
+ TX_EXIT
+}
+/*!
+ \internal
+ sets \a popup as the current outstanding popup and cancels any other active popup.
+ */
+void MpEngine::setOutstandingPopup( HbPopup *popup )
+{
+ TX_ENTRY
+ //Close previous popup (Normally blocking usb note)
+ if ( mUsbOutstandingNote ) {
+ disconnect( mUsbOutstandingNote, SIGNAL( aboutToClose() ), this, SLOT( handleOutstandingNoteClosing() ) );
+ mUsbOutstandingNote->close();
+ }
+
+ //Set new outstanding popup
+ popup->setAttribute( Qt::WA_DeleteOnClose );
+ connect( popup, SIGNAL( aboutToClose() ), this, SLOT( handleOutstandingNoteClosing() ) );
+ mUsbOutstandingNote = popup;
TX_EXIT
}
--- a/mpengine/src/mpmpxcollectionframeworkwrapper_p.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpengine/src/mpmpxcollectionframeworkwrapper_p.cpp Fri May 14 15:49:53 2010 +0300
@@ -711,8 +711,13 @@
CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() );
CleanupStack::PushL( path );
- for ( TInt i = 0; i < count; i++ ) {
- path->SelectL( selection.at( i ) );
+ if (count > 1) {
+ for ( TInt i = 0; i < count; i++ ){
+ path->SelectL( selection.at( i ) );
+ }
+ }
+ else {
+ path->Set( selection.at(0) );
}
iCollectionUiHelper->DeleteL( *path, this );
CleanupStack::PopAndDestroy( path );
@@ -893,23 +898,30 @@
TMPXItemId collectionId( path->Id( 0 ) );
CleanupStack::PopAndDestroy( path );
- if ( collectionData->context() == ECollectionContextAlbums ) {
+ if ( ( collectionData->context() == ECollectionContextAlbums ) ||
+ ( collectionData->context() == ECollectionContextArtistAlbums ) ||
+ ( collectionData->context() == ECollectionContextArtists ) ) {
for ( TInt i = 0; i < count; i++ ) {
CMPXMedia* results;
- CMPXMedia* album( containerArray->AtL( selection[i] ) );
+ CMPXMedia* container( containerArray->AtL( selection[i] ) );
// Fetch the songs for the selected album
- TMPXItemId albumId = album->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
+ TMPXItemId containerId = container->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
CMPXMedia* findCriteria = CMPXMedia::NewL();
CleanupStack::PushL( findCriteria );
findCriteria->SetTObjectValueL<TMPXGeneralType>( KMPXMediaGeneralType, EMPXGroup );
findCriteria->SetTObjectValueL<TMPXGeneralCategory>( KMPXMediaGeneralCategory, EMPXSong );
- findCriteria->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, albumId );
+ findCriteria->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, containerId );
RArray<TMPXAttribute> attrs;
CleanupClosePushL( attrs );
attrs.Append( TMPXAttribute( KMPXMediaIdGeneral,
EMPXMediaGeneralTitle |
EMPXMediaGeneralId ) );
- attrs.Append( KMPXMediaMusicAlbumTrack );
+ if ( collectionData->context() == ECollectionContextArtists ){
+ attrs.Append( KMPXMediaMusicArtist );
+ }
+ else {
+ attrs.Append( KMPXMediaMusicAlbumTrack );
+ }
results = iCollectionUtility->Collection().FindAllL( *findCriteria, attrs.Array() );
CleanupStack::PopAndDestroy( &attrs );
CleanupStack::PopAndDestroy( findCriteria );
--- a/mpengine/src/mpsongscanner.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpengine/src/mpsongscanner.cpp Fri May 14 15:49:53 2010 +0300
@@ -113,7 +113,6 @@
title->setFontSpec(HbFontSpec(HbFontSpec::Primary));
mScanProgressNote->setHeadingWidget( title );
- mScanProgressNote->setTextAlignment( Qt::AlignCenter );
mScanProgressNote->setText( QString("") );
mScanProgressNote->setAttribute( Qt::WA_DeleteOnClose );
mScanProgressNote->show();
@@ -133,7 +132,8 @@
diskFullDialog->setIcon( HbIcon( QString("qtg_small_fail") ) );
diskFullDialog->setText( hbTrId( "txt_mus_title_refresh_cancelled" ) );
diskFullDialog->setTimeout( HbPopup::NoTimeout);
- diskFullDialog->exec();
+ diskFullDialog->setAttribute( Qt::WA_DeleteOnClose );
+ diskFullDialog->show();
mScanning = false;
}
--- a/mpengine/tsrc/unittest_mpmpxcollectionframeworkwrapper/src/unittest_mpmpxcollectionframeworkwrapper.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpengine/tsrc/unittest_mpmpxcollectionframeworkwrapper/src/unittest_mpmpxcollectionframeworkwrapper.cpp Fri May 14 15:49:53 2010 +0300
@@ -588,7 +588,10 @@
{
QList<int> selection;
selection.append(1);
+ mTest->deleteSongs(selection);
+ QCOMPARE(mTestPrivate->iCollectionUiHelper->iDelete, TBool(ETrue));
selection.append(3);
+ selection.append(4);
selection.append(5);
mTest->deleteSongs(selection);
QCOMPARE(mTestPrivate->iCollectionUiHelper->iDelete, TBool(ETrue));
--- a/mpserviceplugins/audioeffects/group/mpxaudioeffectengine.mmp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/audioeffects/group/mpxaudioeffectengine.mmp Fri May 14 15:49:53 2010 +0300
@@ -52,7 +52,6 @@
LIBRARY mediaclientaudio.lib
LIBRARY loudnesseffect.lib
LIBRARY audioequalizerutility.lib
-LIBRARY equalizer.lib
LIBRARY customcommandutility.lib
LIBRARY mpxcommon.lib
LIBRARY centralrepository.lib
--- a/mpserviceplugins/audioeffects/src/mpxaudioeffectengine.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/audioeffects/src/mpxaudioeffectengine.cpp Fri May 14 15:49:53 2010 +0300
@@ -36,10 +36,10 @@
#include "mpxaudioeffectengine.h"
+// Music setting
const TUid KMPCenRepSettingsFeature = {0x10207C92};
const TUint32 KMPCenRepSettingPresetIdKey = 0x00000004;
-
// ================= MEMBER FUNCTIONS =======================
// -----------------------------------------------------------------------------
@@ -207,7 +207,7 @@
{
if(!iStereoEffect) // If stereo widening is ON and not constructed
{
- TUint stereoLevel = 100;
+ TUint stereoLevel = 30;
// cmdUtil ownership passed into new object
MPX_TRAPD(error,
iStereoEffect = CStereoWidening::NewL(*iMdaPlayer,
@@ -220,7 +220,7 @@
}
iStereoEffect->EnableL();
- TUint8 level = 100;
+ TUint8 level = 30;
iStereoEffect->SetStereoWideningLevelL( level );
iStereoEffect->ApplyL();
}
@@ -328,7 +328,7 @@
TInt presetId( KEqualizerPresetNone );
TRAP_IGNORE(
{
- CRepository* repository = CRepository::NewL( KMPCenRepSettingsFeature );
+ CRepository* repository = CRepository::NewL( KMPCenRepSettingsFeature );
repository->Get( KMPCenRepSettingPresetIdKey, presetId );
delete repository;
repository = NULL;
--- a/mpserviceplugins/inc/mpxdbmanager.h Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/inc/mpxdbmanager.h Fri May 14 15:49:53 2010 +0300
@@ -340,21 +340,22 @@
*
* @return ETrue if the dummy file is created successfully, EFalse otherwise
*/
- TBool BlockDiskSpace( TDriveUnit aDrive, TInt aOrigDbSize, TBool aIsMTPInUse = EFalse );
+ TBool BlockDiskSpace( TInt aIndex, TBool aIsMTPInUse = EFalse );
/**
* To copy db from regular drive to RAM
*
* @return ETrue if succeed
- * @leave KErrDiskFull if there is any difficulty copying files
+ *
+ * No-operation if fails
*/
- TBool DoCopyDBToRamL( TDriveUnit aDrive, TBool aIsMTPInUse );
+ TBool DoCopyDBToRam( TInt aIndex, TBool aIsMTPInUse );
/**
* To copy db back regular drive from RAM
*
*/
- void DoCopyDBFromRamL( TInt aIndex );
+ void DoCopyDBFromRam( TInt aIndex );
/**
* To replace dummy file with new content
@@ -390,7 +391,7 @@
* @param aSize - On return, the total size of the databases on the RAM drive.
* @return TInt System error.
*/
- TInt GetTotalRamDatabasesSize(TInt& aSize);
+ TInt GetTotalRamDatabasesSizeL(TInt& aSize);
/**
* Remove dummy file
@@ -399,9 +400,7 @@
*/
void RemoveDummyFile( TInt index );
-
-
-/**
+ /**
* Check if disksapce is enough to operatte. If not, it leaves with KErrDiskFull
*
*/
@@ -417,6 +416,12 @@
*/
void DoCommitL();
+ /**
+ * Create full path and filename on a specified drive unit.
+ * @param aDrive identifies the drive unit
+ */
+ HBufC* CreateFullFilenameL(TDriveUnit aDrive);
+
protected: // Types
typedef struct
@@ -449,10 +454,9 @@
void CreateTablesL(RSqlDatabase& aDatabase, TBool aCorrupt);
/**
- * Opens a specified database.
- * @param aDrive identifies the drive unit of the database to open
+ * Opens root database at C-drive.
*/
- void OpenDatabaseL(TDriveUnit aDrive);
+ void OpenRootDatabaseL();
/**
* Creates a specified database.
@@ -462,15 +466,27 @@
/**
* Attached a specified database.
- * @param aDrive identifies the drive unit of the database to attach
+ * @param aIndex Index to iDatabaseHandles
*/
- void AttachDatabaseL(TDriveUnit aDrive);
+ void AttachDatabaseL(TInt aIndex);
/**
* Detach a specified database.
- * @param aDrive identifies the drive unit of the database to detach
+ * @param aIndex Index to iDatabaseHandles
+ */
+ void DetachDatabaseL(TInt aIndex);
+
+ /**
+ * Open database
+ * @param aIndex Index to iDatabaseHandles
*/
- void DetachDatabaseL(TDriveUnit aDrive);
+ void OpenDatabaseAtIndexL( TInt aIndex );
+
+ /**
+ * Close database
+ * @param aIndex Index to iDatabaseHandles
+ */
+ void CloseDatabaseAtIndexL(TInt aIndex);
/**
* Create filename on a specified drive unit.
--- a/mpserviceplugins/localaudio/src/mpxlocalaudioplayback.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/localaudio/src/mpxlocalaudioplayback.cpp Fri May 14 15:49:53 2010 +0300
@@ -50,8 +50,6 @@
// CONSTANTS
const TUid KLocalPlaybackUid={0x101FFC06};
-//_LIT(KWmaExtension, ".wma");
-//_LIT(KRaExtension, ".ra");
// ============================ LOCAL FUNCTIONS ==============================
@@ -435,10 +433,28 @@
{
// Re-init audio effects
MPX_DEBUG1("CMPXLocalAudioPlayback::CommandL EPbApplyEffect");
+ iAudioEffects->DestroyAudioEffect();
if( ( aData == KAudioEffectsID || aData == KEqualizerID ) &&
( EStateInitialised == iState ) )
{
- TRAP_IGNORE( iAudioEffects->CreateAudioEffectsL() );
+ TRAPD(err, iAudioEffects->CreateAudioEffectsL() );
+ if(err)
+ {
+ MPX_DEBUG2("EPbApplyEffect err = %d", err);
+ TRAPD(err, iAudioEffects->CreateAudioEffectsL() );
+ if(err)
+ {
+ MPX_DEBUG2("EPbApplyEffect again err = %d", err);
+ }
+ else
+ {
+ MPX_DEBUG1("EPbApplyEffect again set");
+ }
+ }
+ else
+ {
+ MPX_DEBUG1("EPbApplyEffect set");
+ }
iAudioEffectsOn = ETrue;
}
break;
--- a/mpserviceplugins/m3uplaylistplugin/group/mpxm3uplaylistparsers.mmp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/m3uplaylistplugin/group/mpxm3uplaylistparsers.mmp Fri May 14 15:49:53 2010 +0300
@@ -29,7 +29,6 @@
VERSION 15.0
USERINCLUDE ../inc
-USERINCLUDE ../../inc
APP_LAYER_SYSTEMINCLUDE
--- a/mpserviceplugins/m3uplaylistplugin/group/mpxm3uplaylistplugin.mmp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/m3uplaylistplugin/group/mpxm3uplaylistplugin.mmp Fri May 14 15:49:53 2010 +0300
@@ -38,7 +38,6 @@
END
USERINCLUDE ../inc
-USERINCLUDE ../../inc
APP_LAYER_SYSTEMINCLUDE
SYSTEMINCLUDE /epoc32/include/ecom
--- a/mpserviceplugins/m3uplaylistplugin/inc/mpxm3uplaylistdefs.h Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/m3uplaylistplugin/inc/mpxm3uplaylistdefs.h Fri May 14 15:49:53 2010 +0300
@@ -55,6 +55,6 @@
EMPXM3UPlaylistLineTypeCorrupted = 4
};
-#endif // MPXM3UPLAYLISTDEFS_H
-
+#endif // MPXM3UPLAYLISTDEFS_H
+
// End of File
--- a/mpserviceplugins/m3uplaylistplugin/inc/mpxm3uplaylistexporter.h Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/m3uplaylistplugin/inc/mpxm3uplaylistexporter.h Fri May 14 15:49:53 2010 +0300
@@ -35,7 +35,7 @@
class CMPXM3uPlaylistExporter : public CActive
{
public: // Constructors and destructor
-
+
/**
* Two-phased constructor
*
@@ -58,7 +58,7 @@
*/
IMPORT_C virtual ~CMPXM3uPlaylistExporter();
-
+
protected:
/**
@@ -68,22 +68,22 @@
* @param aObserver reference to the playlist plugin observer
* @param aPlaylist playlist to be externalized
* @param aStatus caller's request status
- * @return object of constructed
+ * @return object of constructed
*/
IMPORT_C CMPXM3uPlaylistExporter(
RFs* aFs,
MMPXPlaylistPluginObserver* aObserver,
const CMPXMedia& aPlaylist,
TRequestStatus& aStatus );
-
+
/**
* 2nd phase constructor
*
* @param aFilePath File path for where the playlist should be placed
*/
IMPORT_C virtual void ConstructL(
- const TDesC& aFilePath);
-
+ const TDesC& aFilePath);
+
/**
* From CActive
* Handles an active object's request completion event
@@ -100,7 +100,7 @@
* Does a step of the task
*/
IMPORT_C virtual void DoTaskStep();
-
+
private:
/**
@@ -108,7 +108,7 @@
* the given medias have been processed
*/
void ExternalizeL();
-
+
/**
* Populates iLines with HBufC8's each representing one line of playlist
* file.
@@ -135,7 +135,7 @@
/**
* Creates a string containing iItem's relative or absolute path (path
- * is relative if the audio clip is stored to the same directory, or
+ * is relative if the audio clip is stored to the same directory, or
* it's sub-directories, as the playlist file). The stirng is stored to
* iLine.
*/
@@ -166,7 +166,7 @@
* interface
*/
void NotifyClient(TInt aError);
-
+
protected: // Data
const CMPXMedia& iPlaylist;
@@ -181,13 +181,13 @@
RFs* iFs; // not owned
MMPXPlaylistPluginObserver* iObserver; // not owned
-
+
TInt iCurrentMedia;
TBool iMoreToDo;
- TRequestStatus* iCallerStatus;
+ TRequestStatus* iCallerStatus;
};
#endif // MPXM3UPLAYLISTIMPORTER_H
+
-
--- a/mpserviceplugins/m3uplaylistplugin/inc/mpxm3uplaylistimporter.h Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/m3uplaylistplugin/inc/mpxm3uplaylistimporter.h Fri May 14 15:49:53 2010 +0300
@@ -39,7 +39,7 @@
class CMPXM3uPlaylistImporter : public CActive
{
public: // Constructors and destructor
-
+
/**
* Two-phased constructor
*
@@ -63,7 +63,7 @@
* Destructor
*/
IMPORT_C virtual ~CMPXM3uPlaylistImporter();
-
+
protected:
/**
@@ -81,14 +81,14 @@
const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aTopCharacterSet,
const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aAvailableCharacterSet,
TRequestStatus& aStatus );
-
+
/**
* 2nd phase constructor
*
* @param aPlaylistUri URI of the playlist file to be internalized
*/
IMPORT_C virtual void ConstructL( const TDesC& aPlaylistUri );
-
+
/**
* From CActive
* Handles an active object's request completion event
@@ -105,7 +105,7 @@
* Does a step of the task
*/
IMPORT_C virtual void DoTaskStep();
-
+
/**
* Does a step of the task, leave if there is an error
*/
@@ -117,7 +117,7 @@
* Reads data from playlist file to the buffer
*/
void ReadPlaylistFileToBufferL();
-
+
/**
* Auto detects the character encoding from the supplied character
* set
@@ -132,7 +132,7 @@
const TDesC8& aSample,
const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aCharacterSet,
TUint& aCharSetId);
-
+
/**
* Parses the buffer where playlist file was read to.
*/
@@ -175,12 +175,12 @@
* compose CMPXMedia to be sent back to the client
*/
void ComposePlaylistL();
-
+
/**
* Reset data members for after completing the current request
*/
void Cleanup();
-
+
/**
* Notify client of the specified error through MMPXPlaylistPluginObserver
* interface
@@ -195,7 +195,7 @@
EMPXM3UParseWithAutoDetectEncoding,
EMPXM3UComposePlaylistMedia
};
-
+
protected: // Data
HBufC* iBuffer;
@@ -207,12 +207,12 @@
RFs* iFs; // not owned
MMPXPlaylistPluginObserver* iObserver;// not owned
-
+
TBool iExtendedFormat;
-
+
TRequestStatus* iCallerStatus;
- TInt iEndLineNumber;
+ TInt iEndLineNumber;
TInt iCurrentLineNumber;
TBool iMoreToDo;
TBool iEndOfFile;
@@ -220,15 +220,15 @@
CMPXMediaArray* iAutoEncodingPlaylistArray;
TInt iAutoEncodingInvalidItems;
-
+
CMPXMedia* iPlaylist;
-
+
TMPXM3UImporterState iState;
-
+
const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& iTopCharacterSet;
const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& iAvailableCharacterSet;
};
#endif // MPXM3UPLAYLISTIMPORTER_H
+
-
--- a/mpserviceplugins/m3uplaylistplugin/inc/mpxm3uplaylistplugin.h Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/m3uplaylistplugin/inc/mpxm3uplaylistplugin.h Fri May 14 15:49:53 2010 +0300
@@ -33,12 +33,12 @@
/**
* CMPXM3uPlaylistPlugin implements CMPXPlaylistPlugin to provide m3u
-* playlist importing and exporting services.
+* playlist importing and exporting services.
*/
NONSHARABLE_CLASS(CMPXM3uPlaylistPlugin) : public CMPXPlaylistPlugin
{
public: // Constructors and destructor
-
+
/**
* Two-phased constructor
*
@@ -51,10 +51,10 @@
* Destructor
*/
~CMPXM3uPlaylistPlugin();
-
+
public: // from base clase CMPXPlaylistPlugin
- /**
+ /**
* Internalize a playlist
*
* @param aStatus caller's request status
@@ -64,7 +64,7 @@
TRequestStatus& aStatus,
const TDesC& aPlaylistUri);
- /**
+ /**
* Externalize a playlist
*
* @param aStatus caller's request status
@@ -105,7 +105,7 @@
* cancel a client request
*/
void Cancel();
-
+
private:
/**
@@ -115,9 +115,9 @@
/**
* 2nd phase constructor
- */
+ */
void ConstructL();
-
+
private:
CMPXM3uPlaylistImporter* iImporter;
@@ -127,5 +127,5 @@
};
#endif // MPXM3UPLAYLISTPLUGIN_H
+
-
--- a/mpserviceplugins/m3uplaylistplugin/src/mpxm3uplaylistimporter.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/m3uplaylistplugin/src/mpxm3uplaylistimporter.cpp Fri May 14 15:49:53 2010 +0300
@@ -36,7 +36,7 @@
// ============================ MEMBER FUNCTIONS ==============================
// ----------------------------------------------------------------------------
-// Constructor.
+// Constructor.
// ----------------------------------------------------------------------------
EXPORT_C CMPXM3uPlaylistImporter::CMPXM3uPlaylistImporter(
RFs* aFs,
@@ -71,19 +71,19 @@
iPlaylistFilePath.Set(aPlaylistUri);
iAutoEncodingPlaylistArray = CMPXMediaArray::NewL();
-
+
*iCallerStatus = KRequestPending;
TRequestStatus* status = &iStatus;
*status = KRequestPending;
- User::RequestComplete(status, KErrNone);
+ User::RequestComplete(status, KErrNone);
SetActive();
-
+
MPX_DEBUG1("CMPXM3uPlaylistImporter::ConstructL() exiting");
}
-
+
// ----------------------------------------------------------------------------
-// Two-phased constructor.
+// Two-phased constructor.
// ----------------------------------------------------------------------------
EXPORT_C CMPXM3uPlaylistImporter* CMPXM3uPlaylistImporter::NewL(
RFs* aFs,
@@ -91,7 +91,7 @@
const TDesC& aPlaylistUri,
const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aTopCharacterSet,
const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aAvailableCharacterSet,
- TRequestStatus& aStatus )
+ TRequestStatus& aStatus )
{
CMPXM3uPlaylistImporter* self =
new(ELeave)CMPXM3uPlaylistImporter(
@@ -103,7 +103,7 @@
}
// ----------------------------------------------------------------------------
-// Destructor.
+// Destructor.
// ----------------------------------------------------------------------------
//
EXPORT_C CMPXM3uPlaylistImporter::~CMPXM3uPlaylistImporter()
@@ -119,7 +119,7 @@
EXPORT_C void CMPXM3uPlaylistImporter::RunL()
{
MPX_DEBUG1("CMPXM3uPlaylistImporter::RunL");
-
+
if ( iMoreToDo && iStatus.Int() == KErrNone )
{
DoTaskStep();
@@ -127,12 +127,12 @@
}
else
{
- User::RequestComplete( iCallerStatus, iStatus.Int() );
- NotifyClient(iStatus.Int());
- Cleanup();
+ User::RequestComplete( iCallerStatus, iStatus.Int() );
+ NotifyClient(iStatus.Int());
+ Cleanup();
}
}
-
+
// ----------------------------------------------------------------------------
// Implements cancellation of an outstanding request.
// ----------------------------------------------------------------------------
@@ -142,12 +142,12 @@
MPX_DEBUG1("CMPXM3uPlaylistImporter::DoCancel");
TInt error( KErrCancel );
-
+
// notify client that the request has been cancelled
NotifyClient(error);
Cleanup();
-
+
if ( iCallerStatus )
{
User::RequestComplete( iCallerStatus, error );
@@ -161,17 +161,17 @@
EXPORT_C void CMPXM3uPlaylistImporter::DoTaskStep()
{
MPX_DEBUG1("CMPXM3uPlaylistImporter::DoTaskStep()");
-
+
TRequestStatus* status = &iStatus;
*status = KRequestPending;
TInt error( KErrNone );
-
+
MPX_TRAP( error, DoTaskStepL() );
User::RequestComplete( status, error );
}
-
+
// ----------------------------------------------------------------------------
// Performs one step of the task. Leaves when an error is encountered
// ----------------------------------------------------------------------------
@@ -179,21 +179,21 @@
EXPORT_C void CMPXM3uPlaylistImporter::DoTaskStepL()
{
MPX_DEBUG1("CMPXM3uPlaylistImporter::DoTaskStepL()");
-
+
switch( iState )
- {
+ {
case EMPXM3UReadBufferWithAutoDetectEncoding:
{
ReadPlaylistFileToBufferL();
iState = EMPXM3UParseWithAutoDetectEncoding;
}
break;
-
+
case EMPXM3UParseWithAutoDetectEncoding:
{
ParsePlaylistBufferL(
*iAutoEncodingPlaylistArray, iAutoEncodingInvalidItems );
-
+
// If at the moment, we know that there is at least one error parsing
// with auto detect encoding, we don't need to proceed until end of
// file anymore, this playlist file is concluded to be corrupted
@@ -201,17 +201,17 @@
{
delete iAutoEncodingPlaylistArray;
iAutoEncodingPlaylistArray = NULL;
-
+
User::Leave(KErrCorrupt);
}
// we've finished parsing with auto detect encoding we will return
// the playlist parsed with auto encoding
else if ( iEndOfFile )
- {
+ {
iState = EMPXM3UComposePlaylistMedia;
}
- }
+ }
break;
case EMPXM3UComposePlaylistMedia:
@@ -220,7 +220,7 @@
iMoreToDo = EFalse;
}
break;
-
+
default:
{
User::Leave(KErrAbort);
@@ -235,23 +235,23 @@
//
void CMPXM3uPlaylistImporter::ReadPlaylistFileToBufferL()
{
- MPX_DEBUG2("Before reading playlist to buffer: heap size = %d", User::Heap().Size());
+ MPX_DEBUG2("Before reading playlist to buffer: heap size = %d", User::Heap().Size());
delete iBuffer;
iBuffer = NULL;
- iBufferPtr.Set(KNullDesC);
+ iBufferPtr.Set(KNullDesC);
//
// leave with KErrNotFound if the playlist file does not exist
- //
+ //
if (!BaflUtils::FileExists(*iFs, iPlaylistFilePath))
{
User::Leave(KErrNotFound);
}
-
+
TEntry entry;
User::LeaveIfError(iFs->Entry(iPlaylistFilePath, entry));
-
+
HBufC* buffer = HBufC::NewLC(entry.iSize);
TPtr ptr = buffer->Des();
@@ -271,13 +271,13 @@
TUint charSetId(0);
TInt error = DetectCharacterSetL(*buf8, iTopCharacterSet, charSetId);
MPX_DEBUG3("encoding detected using top character set is 0x%x, error %d", charSetId, error);
-
+
// when we fail to detect the encoding, use all available character set in the
// system to try again. If that also fails, abandon the operation.
if (error)
{
User::LeaveIfError(DetectCharacterSetL(*buf8, iAvailableCharacterSet, charSetId));
- MPX_DEBUG2("encoding detected using available character set is 0x%x", charSetId);
+ MPX_DEBUG2("encoding detected using available character set is 0x%x", charSetId);
}
// read the whole file if the sample taken isn't the whole file
@@ -286,7 +286,7 @@
User::LeaveIfError(iFs->ReadFileSection(
iPlaylistFilePath, 0, ptr8, entry.iSize));
}
-
+
// perform character conversion using the selected encoding
TInt state(CCnvCharacterSetConverter::KStateDefault);
TInt numOfUnconvertibleChars(0);
@@ -306,14 +306,14 @@
charSetConv->PrepareToConvertToOrFromL(charSetId, iAvailableCharacterSet, *iFs);
retVal = charSetConv->ConvertToUnicode(ptr, *buf8, state, numOfUnconvertibleChars);
}
-
+
if (retVal > 0 || numOfUnconvertibleChars > 0)
{
MPX_DEBUG3("Unable to find character encoding for the playlist file. retVal = %d, numOfUnconvertibleChars = %d",
- retVal, numOfUnconvertibleChars);
+ retVal, numOfUnconvertibleChars);
User::Leave(KErrNotSupported);
}
-
+
// remove the byte order mark (BOM) character prepended at the beginning
// of the stream if encoded with unicode as per Unicode section 2.4
if ((charSetId == KCharacterSetIdentifierUnicodeLittle ||
@@ -323,20 +323,20 @@
{
ptr.Delete(0,1);
}
-
+
iBuffer = buffer;
iBufferPtr.Set(*iBuffer);
-
- CleanupStack::PopAndDestroy(2, buf8); // charSetConv & buf8
+
+ CleanupStack::PopAndDestroy(2, buf8); // charSetConv & buf8
CleanupStack::Pop(buffer);
-
+
// brand new buffer which hasn't been read, reset iCurrentLineNumber and
// iEndLineNumber, and iEndOfFile
iCurrentLineNumber = 0;
iEndLineNumber = KMPXM3UNumOfLinesToProcess;
iEndOfFile = EFalse;
- MPX_DEBUG2("After reading playlist to buffer: heap size = %d", User::Heap().Size());
+ MPX_DEBUG2("After reading playlist to buffer: heap size = %d", User::Heap().Size());
}
// -----------------------------------------------------------------------------
@@ -354,7 +354,7 @@
{
User::Leave(KErrNotSupported);
}
-
+
TInt confidence(0);
TInt highestConfidence(0);
TUint charSetId(0);
@@ -385,7 +385,7 @@
return KErrNone;
}
}
-
+
// -----------------------------------------------------------------------------
// CMPXM3uPlaylistPlugin::ParsePlaylistBufferL
// -----------------------------------------------------------------------------
@@ -402,7 +402,7 @@
aPlaylist.Count() < KMPXM3UPlaylistMaxItemCount &&
ReadNextLineL())
{
- ProcessLineL(aPlaylist, aInvalidItemCount);
+ ProcessLineL(aPlaylist, aInvalidItemCount);
}
if ( aPlaylist.Count() == KMPXM3UPlaylistMaxItemCount )
@@ -414,7 +414,7 @@
// haven't finished processing all lines in the file, but have processed
// KMPXM3UNumOfLinesToProcess number of lines. Set up iEndLineNumber for
// the next iteration
- //
+ //
if ( !iEndOfFile && iCurrentLineNumber == iEndLineNumber )
{
iEndLineNumber += KMPXM3UNumOfLinesToProcess;
@@ -442,7 +442,7 @@
// Try to find line change
TInt offset = iBufferPtr.FindF(KMPXM3ULineChange);
-
+
if (offset == KErrNotFound)
{
// No line change was found --> last line had no line change
@@ -454,7 +454,7 @@
{
// Found line change
TInt length(offset);
- if ((offset > KMPXM3UNoOffset) &&
+ if ((offset > KMPXM3UNoOffset) &&
(iBufferPtr[length - 1] == KMPXM3UCarriageReturn)) // magic
{
--length;
@@ -473,7 +473,7 @@
iCurrentLineNumber++;
return ETrue;
}
-
+
// -----------------------------------------------------------------------------
// CMPXM3uPlaylistImporter::ProcessLineL()
// -----------------------------------------------------------------------------
@@ -497,7 +497,7 @@
// The file is in the extented format
iExtendedFormat = ETrue;
return;
- }
+ }
}
if (!iItem)
@@ -506,22 +506,22 @@
iItem->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem);
iItem->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXSong);
}
-
+
// Parse line and then decide what to do with it
switch (ParseLineL(iItem, aInvalidItemCount))
{
case EMPXM3UPlaylistLineTypeExtinf:
// Continue to next round
break;
-
+
case EMPXM3UPlaylistLineTypePath:
{
// Line was a path => add item to playlist
aPlaylist.AppendL(iItem);
iItem = NULL; // item now owned by aPlaylist
}
- break;
-
+ break;
+
case EMPXM3UPlaylistLineTypeNotSupported:
case EMPXM3UPlaylistLineTypeCorrupted:
default:
@@ -534,7 +534,7 @@
break;
}
}
-
+
// -----------------------------------------------------------------------------
// CMPXM3uPlaylistImporter::ParseLineL
// -----------------------------------------------------------------------------
@@ -588,7 +588,7 @@
CleanupStack::PopAndDestroy( title );
return EMPXM3UPlaylistLineTypeExtinf; // line type extinf
- }
+ }
}
}
@@ -599,7 +599,7 @@
case KMPXM3UNoOffset:
// Unsupported extended info tag found from this line
return EMPXM3UPlaylistLineTypeNotSupported;
-
+
case KErrNotFound:
default:
// Extended info not found from the beginning of line => line is
@@ -608,7 +608,7 @@
// Get absolute path
TInt error(KErrNone);
HBufC* uri = ParseAbsolutePathLC(*iLine, error);
-
+
if (error)
{
if (error == KErrPathNotFound)
@@ -622,9 +622,9 @@
{
CleanupStack::PopAndDestroy( uri );
}
-
+
++aInvalidItemCount;
-
+
// All other errors are considered to mean playlist is
// corrupt.
return EMPXM3UPlaylistLineTypeCorrupted;
@@ -633,7 +633,7 @@
aItem->SetTextValueL(KMPXMediaGeneralUri, *uri);
MPX_DEBUG2(" uri %S", uri);
-
+
// if title isn't supplied by the m3u file, extract file name from
// URI as the title
if (!aItem->IsSupported(KMPXMediaGeneralTitle))
@@ -645,7 +645,7 @@
}
CleanupStack::PopAndDestroy( uri );
-
+
return EMPXM3UPlaylistLineTypePath; // line type path
}
}
@@ -660,10 +660,10 @@
TInt& aError)
{
HBufC* path = NULL;
-
+
TBool isAbsolute( EFalse );
-
- if (aPath.Length() > KPathStartingChars &&
+
+ if (aPath.Length() > KPathStartingChars &&
!aPath.Mid(1, 2).CompareF(KMPXM3UAbsPath)) // magic: the 2nd and 3rd chars
// are always ":\"
// for absolute paths
@@ -698,7 +698,7 @@
aError = iFs->IsValidName(*path) ? KErrNone : KErrBadName;
}
-
+
// It is possible that a song exists in the filesystem but isn't added to
// the database because it's not a supported type. If such song is included
// in a playlist, it will be added to the database when the playlist is added.
@@ -715,7 +715,7 @@
return path;
}
-
+
// -----------------------------------------------------------------------------
// CMPlayerM3UPlaylistParser::ComposePlaylistL
// -----------------------------------------------------------------------------
@@ -727,50 +727,50 @@
// contain the CMPXMediaArray
//
iPlaylist = CMPXMedia::NewL();
-
+
// set playlist title
TParsePtrC parser(iPlaylistFilePath);
iPlaylist->SetTextValueL(KMPXMediaGeneralTitle, parser.Name());
-
+
// set playlist URI
iPlaylist->SetTextValueL(KMPXMediaGeneralUri, iPlaylistFilePath);
-
+
// set type
iPlaylist->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem);
-
+
// set category
- iPlaylist->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXPlaylist);
+ iPlaylist->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXPlaylist);
// set playlist array
iPlaylist->SetCObjectValueL(KMPXMediaArrayContents, iAutoEncodingPlaylistArray);
-
+
// set array acount
iPlaylist->SetTObjectValueL(KMPXMediaArrayCount, iAutoEncodingPlaylistArray->Count());
-
+
// playlist makes a copy of the array, we can now free the medias
// array
delete iAutoEncodingPlaylistArray;
iAutoEncodingPlaylistArray = NULL;
}
-
+
// ----------------------------------------------------------------------------
-// Cleanup.
+// Cleanup.
// ----------------------------------------------------------------------------
//
void CMPXM3uPlaylistImporter::Cleanup()
{
delete iBuffer;
iBuffer = NULL;
-
+
delete iLine;
- iLine = NULL;
+ iLine = NULL;
delete iItem;
iItem = NULL;
-
+
delete iAutoEncodingPlaylistArray;
iAutoEncodingPlaylistArray = NULL;
-
+
delete iPlaylist;
iPlaylist = NULL;
}
@@ -783,7 +783,7 @@
{
MPX_DEBUG3("CMPXM3uPlaylistImporter::NotifyClient - iAutoEncodingInvalidItems=%d error=%d",
iAutoEncodingInvalidItems, aError);
-
+
if ( iObserver )
{
if (aError)
@@ -801,11 +801,11 @@
// notify client. return the playlist media
CMPXMedia* playlist = iPlaylist;
iPlaylist = NULL; // client takes over the ownership
-
+
// to-do: change HandlePlaylistL to HandlePlaylist
TRAP_IGNORE(iObserver->HandlePlaylistL( playlist, aError, ETrue ));
}
- }
+ }
}
-
+
// End of file
--- a/mpserviceplugins/m3uplaylistplugin/src/mpxm3uplaylistplugin.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/m3uplaylistplugin/src/mpxm3uplaylistplugin.cpp Fri May 14 15:49:53 2010 +0300
@@ -33,10 +33,10 @@
#include "mpxm3uplaylistdefs.h"
#include "mpxm3uplaylistdefs.hrh"
-
+
// ============================ MEMBER FUNCTIONS ==============================
// ----------------------------------------------------------------------------
-// Constructor.
+// Constructor.
// ----------------------------------------------------------------------------
CMPXM3uPlaylistPlugin::CMPXM3uPlaylistPlugin()
{
@@ -48,13 +48,13 @@
void CMPXM3uPlaylistPlugin::ConstructL()
{
iRequiredAttributes.AppendL(KMPXMediaGeneralUri);
-
+
iOptionalAttributes.AppendL(KMPXMediaGeneralTitle);
iOptionalAttributes.AppendL(KMPXMediaGeneralDuration);
}
-
+
// ----------------------------------------------------------------------------
-// Two-phased constructor.
+// Two-phased constructor.
// ----------------------------------------------------------------------------
CMPXM3uPlaylistPlugin* CMPXM3uPlaylistPlugin::NewL(TAny* /*aInitParams*/)
{
@@ -66,7 +66,7 @@
}
// ----------------------------------------------------------------------------
-// Destructor.
+// Destructor.
// ----------------------------------------------------------------------------
CMPXM3uPlaylistPlugin::~CMPXM3uPlaylistPlugin()
{
@@ -90,7 +90,7 @@
iImporter = NULL;
// processing starts as soon as object is instantiated. When request completes,
- // client is notified through MMPXPlaylistPlugibObserver interface
+ // client is notified through MMPXPlaylistPlugibObserver interface
iImporter =
CMPXM3uPlaylistImporter::NewL(
iFs, iObserver, aPlaylistUri, *iTopCharacterSet, *iAvailableCharacterSet, aStatus );
@@ -104,14 +104,14 @@
const CMPXMedia& aPlaylist,
const TDesC& aFilePath)
{
- MPX_DEBUG1("CMPXM3uPlaylistPlugin::ExternalizePlaylistL");
+ MPX_DEBUG1("CMPXM3uPlaylistPlugin::ExternalizePlaylistL");
// instantiate a new CMPXM3uPlaylistExporter to handle this request
delete iExporter;
iExporter = NULL;
-
+
// processing starts as soon as object is instantiated. When request completes,
- // client is notified through MMPXPlaylistPlugibObserver interface
+ // client is notified through MMPXPlaylistPlugibObserver interface
iExporter =
CMPXM3uPlaylistExporter::NewL(
iFs, iObserver, aPlaylist, aFilePath, aStatus );
@@ -123,7 +123,7 @@
// ----------------------------------------------------------------------------
const TArray<TMPXAttribute> CMPXM3uPlaylistPlugin::RequiredAttributes() const
{
- return iRequiredAttributes.Array();
+ return iRequiredAttributes.Array();
}
// ----------------------------------------------------------------------------
@@ -132,7 +132,7 @@
// ----------------------------------------------------------------------------
const TArray<TMPXAttribute> CMPXM3uPlaylistPlugin::OptionalAttributes() const
{
- return iOptionalAttributes.Array();
+ return iOptionalAttributes.Array();
}
// ----------------------------------------------------------------------------
@@ -152,7 +152,7 @@
{
iImporter->Cancel();
}
-
+
if ( iExporter )
{
iExporter->Cancel();
@@ -163,7 +163,7 @@
// ----------------------------------------------------------------------------
// The list of implementations
// ----------------------------------------------------------------------------
-const TImplementationProxy ImplementationTable[] =
+const TImplementationProxy ImplementationTable[] =
{ IMPLEMENTATION_PROXY_ENTRY(KMPXM3uPlaylistImplUid, CMPXM3uPlaylistPlugin::NewL) };
// ----------------------------------------------------------------------------
@@ -174,5 +174,5 @@
aTableCount=sizeof(ImplementationTable)/sizeof(TImplementationProxy);
return ImplementationTable;
}
-
+
// End of file
--- a/mpserviceplugins/mpxinmemoryplugin/src/mpxinmemoryplugin.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxinmemoryplugin/src/mpxinmemoryplugin.cpp Fri May 14 15:49:53 2010 +0300
@@ -514,6 +514,7 @@
if( index != KErrNotFound )
{
iEmbeddedContext.Remove( index );
+ delete iTemporaryData[index];
iTemporaryData.Remove( index );
iEmbeddedContext.Compress();
iTemporaryData.Compress();
--- a/mpserviceplugins/mpxsqlitedbcommon/src/mpxdbmanager.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbcommon/src/mpxdbmanager.cpp Fri May 14 15:49:53 2010 +0300
@@ -193,13 +193,6 @@
CloseAllDatabases();
delete iDbFile;
-#ifdef __RAMDISK_PERF_ENABLE
- TInt count(iDatabaseHandles.Count());
- for (TInt i = 0; i < count; ++i)
- {
- RemoveDummyFile(i);
- }
-#endif //__RAMDISK_PERF_ENABLE
iDatabaseHandles.Close();
}
@@ -278,7 +271,7 @@
}
TInt count(iDatabaseHandles.Count());
- TBool ret = EFalse;
+ //TBool ret = EFalse;
for ( TInt i = 0; i < count ; ++i )
{
if ( iDatabaseHandles[i].iUseRAMdb )
@@ -287,23 +280,25 @@
MPX_DEBUG1("CMPXDbManager::CopyDBsToRamL iUseRAMdb already ETrue");
continue;
}
- iDatabaseHandles[i].iUseRAMdb = ETrue;
- TRAPD(err, ret = DoCopyDBToRamL( iDatabaseHandles[i].iDrive, aIsMTPInUse ))
+ CloseDatabaseAtIndexL( i ); // let leave: not much we can't do if we can't close the original DB
+ DoCopyDBToRam( i, aIsMTPInUse ); // copies if it can
+ TRAPD( err, OpenDatabaseAtIndexL( i ) );
if ( err != KErrNone )
{
- MPX_DEBUG2("CMPXDbManager::CopyDBsToRamL error=%d", err);
- // remove dymmy file
+ MPX_DEBUG2("CMPXDbManager::CopyDBsToRamL OpenDatabaseAtIndexL leave=%d", err);
RemoveDummyFile(i);
- // try to close database that is opened from RAM disk
- TRAP_IGNORE(CloseDatabaseL( iDatabaseHandles[i].iDrive ));
- iDatabaseHandles[i].iUseRAMdb = EFalse;
- // reopen database from drive not from RAM
- OpenDatabaseL( iDatabaseHandles[i].iDrive );
- continue; // continue to copy for next drive
- }
- if ( !ret )
- {
- iDatabaseHandles[i].iUseRAMdb = EFalse;
+ if ( iDatabaseHandles[i].iUseRAMdb )
+ {
+ // go back to disk DB
+ TRAP_IGNORE(CloseDatabaseAtIndexL( i ));
+ iDatabaseHandles[i].iUseRAMdb = EFalse;
+ OpenDatabaseAtIndexL( i );
+ continue;
+ }
+ else
+ {
+ User::Leave( err );
+ }
}
}
@@ -322,73 +317,51 @@
// ----------------------------------------------------------------------------
-// CMPXDbManager::DoCopyDBsToRamL
+// CMPXDbManager::DoCopyDBToRam
// ----------------------------------------------------------------------------
//
-TBool CMPXDbManager::DoCopyDBToRamL( TDriveUnit aDrive, TBool aIsMTPInUse )
+TBool CMPXDbManager::DoCopyDBToRam( TInt aIndex, TBool aIsMTPInUse )
{
#ifdef __RAMDISK_PERF_ENABLE
- MPX_DEBUG2("-->CMPXDbManager::DoCopyDBsToRamL drive=%d", (TInt)aDrive);
- TFileName dst;
- TFileName src;
- dst.Append(iRAMFolder);
- src.Append(aDrive.Name());
- src.Append(KDBFilePath);
- TRAPD( err, BaflUtils::EnsurePathExistsL( iFs, dst ));
- if ( err != KErrNone )
+ MPX_DEBUG2("-->CMPXDbManager::DoCopyDBsToRam drive=%d", (TInt)iDatabaseHandles[aIndex].iDrive);
+ DatabaseHandle& database = iDatabaseHandles[aIndex];
+ TInt err = KErrNone;
+
+ delete database.iOrigFullFilePath;
+ database.iOrigFullFilePath = 0;
+ delete database.iTargetFullFilePath;
+ database.iTargetFullFilePath = 0;
+ TRAP (err,
+ database.iOrigFullFilePath = CreateFullFilenameL( database.iDrive );
+ database.iUseRAMdb = ETrue; // must turn this on to create RAM filename
+ database.iTargetFullFilePath = CreateFullFilenameL( database.iDrive );
+ BaflUtils::EnsurePathExistsL( iFs, *database.iTargetFullFilePath ));
+ database.iUseRAMdb = EFalse;
+ if (err != KErrNone)
{
+ MPX_DEBUG1("CMPXDbManager::DoCopyDBsToRamL() CreateFilenameL or EnsurePathExistsL failed");
return EFalse;
}
- TFileName filename;
- filename.Format(KSecurePath, User::Identity().iUid, iDbFile); //x:\private\10281e17\[sldfdsf]mpxv2_5.db
- src.Append(filename);
- MPX_DEBUG2("RAMDisk src path=%S", &src);
- TEntry entry;
- iFs.Entry( src, entry );
- if (!BlockDiskSpace( aDrive, entry.iSize, aIsMTPInUse ) )
+ MPX_DEBUG2("RAMDisk src path=%S", database.iOrigFullFilePath);
+ MPX_DEBUG2("RAMDisk dst path=%S", database.iTargetFullFilePath);
+
+ if (!BlockDiskSpace( aIndex, aIsMTPInUse ) )
{
MPX_DEBUG1("CMPXDbManager::DoCopyDBsToRamL() BlockDiskSpace failed");
return EFalse; // continue for next drive
}
- TBuf<2> d;
- d.Append(aDrive.Name());
- HBufC* temp = HBufC::NewLC(KMaxFileName);
- temp->Des().Append(d.Left(1));
- temp->Des().Append(iDbFile->Des());
- filename.Format(KSecurePath, User::Identity().iUid, temp);
- CleanupStack::PopAndDestroy(temp);
- dst.Append(filename);
- MPX_DEBUG2("RAMDisk dst path=%S", &dst);
- TInt index( GetDatabaseIndex((TInt)aDrive) );
- delete iDatabaseHandles[index].iOrigFullFilePath;
- iDatabaseHandles[index].iOrigFullFilePath = 0;
- delete iDatabaseHandles[index].iTargetFullFilePath;
- iDatabaseHandles[index].iTargetFullFilePath = 0;
-
- // Save these path so it is convenient to copy back
- iDatabaseHandles[index].iOrigFullFilePath = HBufC::NewL(src.Length());
- iDatabaseHandles[index].iTargetFullFilePath = HBufC::NewL(dst.Length());
-
- iDatabaseHandles[index].iOrigFullFilePath->Des().Append(src);
- iDatabaseHandles[index].iTargetFullFilePath->Des().Append(dst);
- TRAP(err, CloseDatabaseL(aDrive));
- if ( err != KErrNone )
+ if ( BaflUtils::CopyFile(iFs, *database.iOrigFullFilePath, *database.iTargetFullFilePath ) != KErrNone )
{
- MPX_DEBUG2("<--CMPXDbManager::DoCopyDBsToRamL error=%d", err);
- TInt index(GetDatabaseIndex((TInt)aDrive));
- if ( index >= 0 )
- {
- RemoveDummyFile( index );
- }
+ RemoveDummyFile( aIndex );
return EFalse;
}
- User::LeaveIfError( BaflUtils::CopyFile(iFs, src, dst ));
- OpenDatabaseL((TInt)aDrive);
-
- MPX_DEBUG2("RAMDisk Database opened=%d", (TInt)aDrive);
+ MPX_DEBUG2("RAMDisk Database copied=%d", (TInt)database.iDrive);
+ database.iUseRAMdb = ETrue; // succeeded moving DB to RAM
MPX_DEBUG1("<--CMPXDbManager::DoCopyDBsToRamL");
- return ETrue;
+ return ETrue;
+#else
+ return EFalse;
#endif //__RAMDISK_PERF_ENABLE
}
@@ -398,34 +371,52 @@
//
EXPORT_C void CMPXDbManager::CopyDBsFromRamL()
{
+ MPX_FUNC("CMPXDbManager::CopyDBsFromRamL");
#ifdef __RAMDISK_PERF_ENABLE
- MPX_DEBUG1("-->CMPXDbManager::CopyDBsFromRamL");
if( iRAMDiskPerfEnabled )
{
TInt transactionCount = iTransactionCount;
if (iTransactionCount > 0)
{
iTransactionCount = 0;
- DoCommitL();
+ TRAP_IGNORE( DoCommitL() );
}
TInt count(iDatabaseHandles.Count());
- for (TInt i = 0; i < count && iDatabaseHandles[i].iUseRAMdb; ++i)
+ TInt leaveError = KErrNone;
+ iRAMInUse = EFalse;
+ // Should not leave until all the databases have been copied from RAM drive.
+ for (TInt i = 0; i < count; ++i)
{
- TRAPD(err, DoCopyDBFromRamL(i));
- if ( err != KErrNone )
+ if ( !iDatabaseHandles[i].iUseRAMdb )
{
- MPX_DEBUG2("<--CMPXDbManager::CopyDBsFromRamL error=%d", err);
- //anyting wrong, delete the temp file and open database from drive
+ continue;
+ }
+ TRAPD( error, CloseDatabaseAtIndexL( i ) );
+ if ( error )
+ {
+ // Can't close db on RAM drive, so cleanup.
+ MPX_DEBUG2("CMPXDbManager::CopyDBsFromRamL CloseDatabaseAtIndexL fail: error = %d", error);
+ // Delete database on RAM drive.
+ BaflUtils::DeleteFile(iFs, *iDatabaseHandles[i].iTargetFullFilePath);
+ // Delete dummy file
RemoveDummyFile(i);
- // delete Db on RAM
- User::LeaveIfError( BaflUtils::DeleteFile(iFs,
- *iDatabaseHandles[i].iTargetFullFilePath));
+ }
+ else
+ {
+ DoCopyDBFromRam(i);
}
iDatabaseHandles[i].iUseRAMdb = EFalse;
// open db from drive
- OpenDatabaseL( iDatabaseHandles[i].iDrive );
+ TRAP( error, OpenDatabaseAtIndexL( i ) );
+ if ( error && !leaveError )
+ {
+ leaveError = error;
+ }
}
+
+ // leave if error
+ User::LeaveIfError(leaveError);
if (transactionCount > 0)
{
@@ -433,47 +424,52 @@
iTransactionCount = transactionCount;
}
}
- iRAMInUse = EFalse;
-
- MPX_DEBUG1("<--CMPXDbManager::CopyDBsFromRamL");
#endif //__RAMDISK_PERF_ENABLE
}
// ----------------------------------------------------------------------------
-// CMPXDbManager::DoCopyDBsToRamL
+// CMPXDbManager::DoCopyDBsToRam
// ----------------------------------------------------------------------------
//
-void CMPXDbManager::DoCopyDBFromRamL( TInt aIndex )
+void CMPXDbManager::DoCopyDBFromRam( TInt aIndex )
{
#ifdef __RAMDISK_PERF_ENABLE
- MPX_DEBUG1("-->CMPXDbManager::DoCopyDBsFromRamL");
- MPX_DEBUG2("-->CMPXDbManager::DoCopyDBsFromRamL Drive %d will be closed before copying db from RAM.",
- iDatabaseHandles[aIndex].iDrive);
-
- CloseDatabaseL(iDatabaseHandles[aIndex].iDrive);
-
- // Delete existing DB on drive
- User::LeaveIfError( BaflUtils::DeleteFile(iFs,
- *iDatabaseHandles[aIndex].iOrigFullFilePath));
- MPX_DEBUG1("CMPXDbManager::DoCopyDBsFromRamL old DB on drive deleted");
-
- // Rename dummy file to be orignal file name
- User::LeaveIfError( BaflUtils::RenameFile(iFs,
- iDatabaseHandles[aIndex].iDummyFilePath,
- *iDatabaseHandles[aIndex].iOrigFullFilePath) );
- MPX_DEBUG1("CMPXDbManager::CopyDBsFromRamL RAMDisk renamed.");
+ MPX_DEBUG1("-->CMPXDbManager::DoCopyDBsFromRam");
+ DatabaseHandle& database = iDatabaseHandles[aIndex];
//Copy Db from RAM to replace dummy file
- ReplaceFileL( *iDatabaseHandles[aIndex].iTargetFullFilePath, *iDatabaseHandles[aIndex].iOrigFullFilePath);
-
- MPX_DEBUG1("CMPXDbManager::CopyDBsFromRamL RAMDisk copied back.");
+ TRAPD(error, ReplaceFileL( *database.iTargetFullFilePath, database.iDummyFilePath));
+ MPX_DEBUG2("CMPXDbManager::CopyDBsFromRam RAMDisk copied over dummy, error=%d", error);
+
+ // done with RAM DB (whether copying succeeded or not) so can delete it
+ // can ignore errors since we cannot do anything if this fails
+ BaflUtils::DeleteFile(iFs, *database.iTargetFullFilePath);
+ MPX_DEBUG1("CMPXDbManager::DoCopyDBsFromRam RAM DB deleted");
+
+ if ( error == KErrNone )
+ {
+ // Delete old DB on drive
+ // Can ignore error: either original does not exist or something is wrong and can't help it
+ BaflUtils::DeleteFile(iFs, *database.iOrigFullFilePath);
+ MPX_DEBUG1("CMPXDbManager::DoCopyDBsFromRam old DB on drive deleted");
- // Delete existing DB on RAM
- User::LeaveIfError( BaflUtils::DeleteFile(iFs, *iDatabaseHandles[aIndex].iTargetFullFilePath));
- MPX_DEBUG1("CMPXDbManager::DoCopyDBsFromRamL RAMDisk deleted");
+ // Rename dummy file to be original file name
+ error = BaflUtils::RenameFile(iFs, database.iDummyFilePath, *database.iOrigFullFilePath);
+ MPX_DEBUG2("CMPXDbManager::CopyDBsFromRam dummy file renamed, error=%d", error);
+ if ( error )
+ {
+ // Error renaming dummy file, delete dummy file.
+ RemoveDummyFile(aIndex);
+ }
+ }
+ else
+ {
+ RemoveDummyFile(aIndex);
+ MPX_DEBUG1("CMPXDbManager::DoCopyDBsFromRam dummy file deleted");
+ }
- MPX_DEBUG1("<--CMPXDbManager::DoCopyDBsFromRamL");
+ MPX_DEBUG1("<--CMPXDbManager::DoCopyDBsFromRam");
#endif //__RAMDISK_PERF_ENABLE
}
@@ -484,7 +480,7 @@
// Leaves on error.
// Implementation follows CFileMan::Copy except that
// - we don't resize target file to zero
-// - we can assume that files already exist
+// - we can assume that source file already exists
// - we don't copy file attributes & timestamp
// ----------------------------------------------------------------------------
//
@@ -496,7 +492,12 @@
CleanupClosePushL( srcFile );
RFile dstFile;
- User::LeaveIfError( dstFile.Open(iFs, aDstName, EFileWrite|EFileWriteDirectIO|EFileShareExclusive) );
+ TInt error = dstFile.Open(iFs, aDstName, EFileWrite|EFileWriteDirectIO|EFileShareExclusive);
+ if (error == KErrNotFound)
+ {
+ error = dstFile.Create(iFs, aDstName, EFileWrite|EFileWriteDirectIO|EFileShareExclusive);
+ }
+ User::LeaveIfError ( error );
CleanupClosePushL( dstFile );
// resize destination file
@@ -551,11 +552,8 @@
if ( iDatabaseHandles[index].iDummyFilePath.Length() )
{
- TInt err = BaflUtils::DeleteFile(iFs, iDatabaseHandles[index].iDummyFilePath);
- if ( !err )
- {
- iDatabaseHandles[index].iDummyFilePath.Zero();
- }
+ BaflUtils::DeleteFile(iFs, iDatabaseHandles[index].iDummyFilePath);
+ iDatabaseHandles[index].iDummyFilePath.Zero();
}
MPX_DEBUG1("<--CMPXDbManager::RemoveDummyFile");
#endif //__RAMDISK_PERF_ENABLE
@@ -652,7 +650,7 @@
TDriveUnit cdrive(KRootDrive());
CreateDatabaseL(cdrive);
- OpenDatabaseL(cdrive);
+ OpenRootDatabaseL();
TInt count(aDrives.Count());
for (TInt i = 0; i < count; ++i)
@@ -675,13 +673,14 @@
handle.iUseRAMdb = EFalse;
#endif //__RAMDISK_PERF_ENABLE
+ TInt index = iDatabaseHandles.Count();
iDatabaseHandles.AppendL(handle);
TVolumeInfo vol;
if (iFs.Volume(vol, drive) == KErrNone)
{
CreateDatabaseL(drive);
- AttachDatabaseL(drive);
+ AttachDatabaseL( index );
}
}
}
@@ -715,16 +714,18 @@
if (iDatabaseHandles[i].iDrive == aDrive)
{
MPX_DEBUG2("CMPXDbManager::OpenDatabaseL found %d", aDrive);
- if (!iDatabaseHandles[i].iOpen)
+ TInt transactionCount = iTransactionCount;
+ if (iTransactionCount > 0)
{
- MPX_DEBUG1("CMPXDbManager::OpenDatabaseL not open found");
- // make sure the database is created
- CreateDatabaseL(drive);
-
- // attach
- AttachDatabaseL(drive);
+ iTransactionCount = 0;
+ DoCommitL();
}
-
+ OpenDatabaseAtIndexL( i );
+ if (transactionCount > 0)
+ {
+ DoBeginL();
+ iTransactionCount = transactionCount;
+ }
found = ETrue;
break;
}
@@ -740,6 +741,18 @@
//
ResetPreparedQueries();
}
+
+void CMPXDbManager::OpenDatabaseAtIndexL( TInt aIndex )
+ {
+ DatabaseHandle & database = iDatabaseHandles[aIndex];
+ if (!database.iOpen)
+ {
+ MPX_DEBUG1("CMPXDbManager::OpenDatabaseAtIndexL not open");
+ // make sure the database is created
+ CreateDatabaseL( TDriveUnit(database.iDrive) );
+ AttachDatabaseL( aIndex );
+ }
+ }
// ----------------------------------------------------------------------------
// Closes a specified database.
@@ -754,11 +767,7 @@
{
User::Leave(KErrNotReady);
}
-
- // Close all prepared statements if a db is closed
- //
- ResetPreparedQueries();
-
+
TDriveUnit drive(aDrive);
TDriveUnit cdrive(KRootDrive());
TBool found(EFalse);
@@ -770,11 +779,54 @@
{
if (iDatabaseHandles[i].iDrive == aDrive)
{
- MPX_DEBUG2("CMPXDbManager::CloseDatabaseL found %d", aDrive);
- if (iDatabaseHandles[i].iOpen)
+ TBool inTransaction = InTransaction();
+ TInt transactionCount = iTransactionCount;
+ iTransactionCount = 0;
+
+ if (inTransaction) //if the transaction is ongoing, try committing
{
- MPX_DEBUG1("CMPXDbManager::CloseDatabaseL found open");
- DetachDatabaseL(drive);
+ //if transaction committing fails, try roll-back
+ TInt error = iDatabase.Exec( KCommitTransaction );
+ if ( error != KErrNone )
+ {
+ //The error is ignored since we can't do nothing about it
+ iDatabase.Exec( KRollbackTransaction );
+ }
+ }
+
+#ifdef __RAMDISK_PERF_ENABLE
+ if ( iRAMDiskPerfEnabled && iDatabaseHandles[i].iUseRAMdb )
+ {
+ MPX_DEBUG2("CMPXDbManager::CloseDatabaseL found %d at RAM", aDrive);
+ TRAPD( err, CloseDatabaseAtIndexL( i ) );
+ if ( err != KErrNone )
+ {
+ // Can't close db on RAM drive, so cleanup.
+ MPX_DEBUG2("CMPXDbManager::CloseDatabaseL CloseDatabaseAtIndexL fail: error = %d", err);
+ // Delete dummy file
+ RemoveDummyFile(i);
+ iDatabaseHandles[i].iUseRAMdb = EFalse;
+ // Delete database on RAM drive.
+ User::LeaveIfError( BaflUtils::DeleteFile(iFs, *iDatabaseHandles[i].iTargetFullFilePath) );
+ }
+ else
+ {
+ DoCopyDBFromRam(i);
+ }
+ iDatabaseHandles[i].iUseRAMdb = EFalse;
+ }
+ else
+#endif
+ {
+ MPX_DEBUG2("CMPXDbManager::CloseDatabaseL found %d", aDrive);
+ CloseDatabaseAtIndexL( i );
+ }
+
+ //Let MTP handle the transcation if there is any
+ if ( inTransaction )
+ {
+ DoBeginL();
+ iTransactionCount = transactionCount;
}
found = ETrue;
@@ -790,6 +842,19 @@
}
+void CMPXDbManager::CloseDatabaseAtIndexL( TInt aIndex )
+ {
+ // Close all prepared statements if a db is closed
+ //
+ ResetPreparedQueries();
+
+ if (iDatabaseHandles[aIndex].iOpen)
+ {
+ MPX_DEBUG1("CMPXDbManager::CloseDatabaseAtIndexL found open");
+ DetachDatabaseL( aIndex );
+ }
+}
+
// ----------------------------------------------------------------------------
// Closes all databases.
// ----------------------------------------------------------------------------
@@ -808,10 +873,13 @@
for (TInt i = 0; i < count; ++i)
{
delete iDatabaseHandles[i].iAliasname;
+ iDatabaseHandles[i].iAliasname = 0;
#ifdef __RAMDISK_PERF_ENABLE
+ RemoveDummyFile(i);
delete iDatabaseHandles[i].iOrigFullFilePath;
+ iDatabaseHandles[i].iOrigFullFilePath = 0;
delete iDatabaseHandles[i].iTargetFullFilePath;
- iDatabaseHandles[i].iDummyFilePath.Zero();
+ iDatabaseHandles[i].iTargetFullFilePath = 0;
#endif //__RAMDISK_PERF_ENABLE
}
@@ -831,8 +899,7 @@
if (!iInitialized)
{
- TDriveUnit cdrive(KRootDrive());
- OpenDatabaseL(cdrive);
+ OpenRootDatabaseL();
}
TInt count(iDatabaseHandles.Count());
@@ -841,7 +908,7 @@
TVolumeInfo vol;
if (iFs.Volume(vol, iDatabaseHandles[i].iDrive) == KErrNone)
{
- AttachDatabaseL(iDatabaseHandles[i].iDrive);
+ AttachDatabaseL( i );
}
}
iInitialized = ETrue;
@@ -939,11 +1006,11 @@
User::Leave(KErrNotReady);
}
- TBool found(EFalse);
+ TInt index = KErrNotFound;
if (aDrive == EDriveC)
{
- found = ETrue;
+ index = iDatabaseHandles.Count();
}
else
{
@@ -952,12 +1019,12 @@
{
if ((iDatabaseHandles[i].iDrive == aDrive) && (iDatabaseHandles[i].iOpen))
{
- found = ETrue;
+ index = i;
break;
}
}
}
- if (found)
+ if ( index >= 0 )
{
HBufC * filename = CreateFilenameL(aDrive);
CleanupStack::PushL(filename);
@@ -980,12 +1047,12 @@
}
else
{
- DetachDatabaseL(drive_unit);
+ DetachDatabaseL( index );
RSqlDatabase::Delete(*filename);
CreateDatabaseL(drive_unit);
- AttachDatabaseL(drive_unit);
+ AttachDatabaseL( index );
}
}
@@ -1637,6 +1704,7 @@
//
void CMPXDbManager::ResetPreparedQueries()
{
+ MPX_FUNC("CMPXDbManager::ResetPreparedQueries");
iPreparedStatements.Reset();
TInt c( iStatements.Count() );
@@ -1675,17 +1743,16 @@
}
// ----------------------------------------------------------------------------
-// Opens a specified database.
+// Opens root database on C-drive
// ----------------------------------------------------------------------------
//
-void CMPXDbManager::OpenDatabaseL(
- TDriveUnit aDrive)
+void CMPXDbManager::OpenRootDatabaseL()
{
- MPX_FUNC("CMPXDbManager::OpenDatabaseL");
-
- HBufC * filename = CreateFilenameL(aDrive);
+ MPX_FUNC("CMPXDbManager::OpenRootDatabaseL");
+ TDriveUnit cdrive(KRootDrive());
+ HBufC * filename = CreateFilenameL(cdrive);
CleanupStack::PushL(filename);
- User::LeaveIfError(iDatabase.Open(filename->Des()));
+ User::LeaveIfError(iDatabase.Open(*filename));
CleanupStack::PopAndDestroy(filename);
}
@@ -1746,67 +1813,50 @@
// Attaches a specified database.
// ----------------------------------------------------------------------------
//
-void CMPXDbManager::AttachDatabaseL(
- TDriveUnit aDrive)
+void CMPXDbManager::AttachDatabaseL( TInt aIndex )
{
MPX_FUNC("CMPXDbManager::AttachDatabaseL");
-
- TBool found(EFalse);
-
- TInt count(iDatabaseHandles.Count());
- for (TInt i = 0; i < count; ++i)
+ ASSERT( aIndex < iDatabaseHandles.Count() );
+ DatabaseHandle & database = iDatabaseHandles[ aIndex ];
+ if (!database.iOpen)
{
- if (iDatabaseHandles[i].iDrive == aDrive)
- {
- if (!iDatabaseHandles[i].iOpen)
- {
- HBufC* filename = CreateFilenameL(aDrive);
- CleanupStack::PushL(filename);
+ HBufC* filename = CreateFilenameL( database.iDrive );
+ CleanupStack::PushL(filename);
#ifdef __RAMDISK_PERF_ENABLE
- if( iDatabaseHandles[i].iUseRAMdb )
- {
- delete iDatabaseHandles[i].iAliasname;
- iDatabaseHandles[i].iAliasname = HBufC::NewL(KAliasName().Length());
- HBufC* temp = HBufC::NewLC(2); // form of DE, DF, DX,...
- temp->Des().Append(iRAMDrive); // length == 2
- TDriveUnit pdrive(aDrive);
- temp->Des().Append(pdrive.Name().Left(1)); //length == 2+ 1
- iDatabaseHandles[i].iAliasname->Des().Format(KRAMAliasName, temp);
- MPX_DEBUG2("CMPXDbManager::AttachDatabaseL - RAM change aliasname of %S", iDatabaseHandles[i].iAliasname );
- CleanupStack::PopAndDestroy(temp);
- }
- else
+ if( database.iUseRAMdb )
+ {
+ delete database.iAliasname;
+ database.iAliasname = HBufC::NewL(KAliasName().Length());
+ HBufC* temp = HBufC::NewLC(2); // form of DE, DF, DX,...
+ temp->Des().Append(iRAMDrive); // length == 2
+ TDriveUnit pdrive( database.iDrive );
+ temp->Des().Append(pdrive.Name().Left(1)); //length == 2+ 1
+ database.iAliasname->Des().Format(KRAMAliasName, temp);
+ MPX_DEBUG2("CMPXDbManager::AttachDatabaseL - RAM change aliasname of %S", database.iAliasname );
+ CleanupStack::PopAndDestroy(temp);
+ }
+ else
#endif //__RAMDISK_PERF_ENABLE
- {
- delete iDatabaseHandles[i].iAliasname;
- TDriveUnit drive(aDrive);
- const TDesC& driveName = drive.Name();
- iDatabaseHandles[i].iAliasname = HBufC::NewL(KAliasName().Length());
- iDatabaseHandles[i].iAliasname->Des().Format(KAliasName, &driveName);
- MPX_DEBUG2("CMPXDbManager::AttachDatabaseL - normal change aliasname of %S", iDatabaseHandles[i].iAliasname);
- }
-
- TInt err = iDatabase.Attach(filename->Des(), *(iDatabaseHandles[i].iAliasname));
- MPX_DEBUG2("CMPXDbManager::AttachDatabaseL - Attach Error =%d", err);
- User::LeaveIfError(err);
- iDatabaseHandles[i].iOpen = ETrue;
+ {
+ delete database.iAliasname;
+ TDriveUnit drive( database.iDrive );
+ const TDesC& driveName = drive.Name();
+ database.iAliasname = HBufC::NewL(KAliasName().Length());
+ database.iAliasname->Des().Format(KAliasName, &driveName);
+ MPX_DEBUG2("CMPXDbManager::AttachDatabaseL - normal change aliasname of %S", database.iAliasname);
+ }
- CleanupStack::PopAndDestroy(filename);
- }
- else
- {
- MPX_DEBUG1("CMPXDbManager::AttachDatabaseL - found already open");
- }
-
- found = ETrue;
- break;
- }
+ TInt err = iDatabase.Attach( *filename, *database.iAliasname );
+ MPX_DEBUG2("CMPXDbManager::AttachDatabaseL - Attach Error =%d", err);
+ User::LeaveIfError(err);
+ database.iOpen = ETrue;
+
+ CleanupStack::PopAndDestroy(filename);
}
- if (!found)
+ else
{
- MPX_DEBUG1("CMPXDbManager::AttachDatabaseL - not found");
- User::Leave(KErrNotFound);
+ MPX_DEBUG1("CMPXDbManager::AttachDatabaseL - found already open");
}
}
@@ -1814,48 +1864,22 @@
// Detaches a specified database.
// ----------------------------------------------------------------------------
//
-void CMPXDbManager::DetachDatabaseL(
- TDriveUnit aDrive)
+void CMPXDbManager::DetachDatabaseL( TInt aIndex )
{
MPX_FUNC("CMPXDbManager::DetachDatabaseL");
- ASSERT(iInitialized);
- TBool found(EFalse);
-
- TInt count(iDatabaseHandles.Count());
- for (TInt i = 0; i < count; ++i)
+ ASSERT( iInitialized && aIndex < iDatabaseHandles.Count() );
+ DatabaseHandle & database = iDatabaseHandles[ aIndex ];
+ if ( database.iOpen )
{
- if (iDatabaseHandles[i].iDrive == aDrive)
+ MPX_DEBUG2("CMPXDbManager::DetachDatabaseL iAliasname=%S is open",database.iAliasname );
+ TInt err = iDatabase.Detach(*(database.iAliasname));
+ if ( err )
{
-#ifdef __RAMDISK_PERF_ENABLE
- if ( iDatabaseHandles[i].iOpen || iDatabaseHandles[i].iUseRAMdb )
-#else //__RAMDISK_PERF_ENABLE
- if ( iDatabaseHandles[i].iOpen )
-#endif //__RAMDISK_PERF_ENABLE
-
- {
- MPX_DEBUG1("CMPXDbManager::DetachDatabaseL found drive that is opening");
- TInt err = iDatabase.Detach(*(iDatabaseHandles[i].iAliasname));
- if ( err )
- {
- MPX_DEBUG2("CMPXDbManager::DetachDatabaseL detach failed Error=%d", err);
- }
- else
- {
- MPX_DEBUG2("CMPXDbManager::DetachDatabaseL iAliasname=%S", iDatabaseHandles[i].iAliasname);
- }
- User::LeaveIfError(err);
- iDatabaseHandles[i].iOpen = EFalse;
- }
-
- found = ETrue;
- break;
+ MPX_DEBUG2("CMPXDbManager::DetachDatabaseL detach failed Error=%d", err);
}
- }
- if (!found)
- {
- MPX_DEBUG1("CMPXDbManager::DetachDatabaseL drive not found in iDatabaseHandlers");
- User::Leave(KErrNotFound);
+ User::LeaveIfError(err);
+ database.iOpen = EFalse;
}
}
@@ -1883,12 +1907,11 @@
path.Append(_L(":"));
TBuf<2> d;
d.Append(aDrive.Name());
- HBufC* temp = HBufC::NewLC(KMaxFileName);
- temp->Des().Append(d.Left(1)); // attach original drive name
- temp->Des().Append(iDbFile->Des());
- filename->Des().Format(securefilePath, &path, User::Identity().iUid, temp);
+ TFileName temp;
+ temp.Append(d.Left(1)); // attach original drive name
+ temp.Append(iDbFile->Des());
+ filename->Des().Format(securefilePath, &path, User::Identity().iUid, &temp);
MPX_DEBUG3("CMPXDbManager::CreateFilenameL - path=%S filename=%S", &path, filename);
- CleanupStack::PopAndDestroy(temp);
}
else
#endif //__RAMDISK_PERF_ENABLE
@@ -1896,7 +1919,6 @@
MPX_DEBUG1("CMPXDbManager::CreateFilenameL - use normal drive");
const TDesC& driveName = aDrive.Name();
filename->Des().Format(securefilePath, &driveName, User::Identity().iUid, iDbFile);
-
}
MPX_DEBUG2("CMPXDbManager::CreateFilenameL filename = %S", filename);
@@ -2054,7 +2076,7 @@
TDriveUnit drive(iDatabaseHandles[i].iDrive);
CreateDatabaseL(drive);
MPX_DEBUG1("RegenerateAllDatabasesL: Attaching new DB");
- AttachDatabaseL(drive);
+ AttachDatabaseL( i );
MPX_DEBUG1("RegenerateAllDatabasesL: DB regeneration complete");
CleanupStack::PopAndDestroy(filename);
}
@@ -2607,41 +2629,36 @@
// CMPXDbManager::BlockDiskSpaceL
// ---------------------------------------------------------------------------
//
-TBool CMPXDbManager::BlockDiskSpace( TDriveUnit aDrive, TInt aOrigDbSize, TBool aIsMTPInUse )
+TBool CMPXDbManager::BlockDiskSpace( TInt aIndex, TBool aIsMTPInUse )
{
#ifdef __RAMDISK_PERF_ENABLE
- MPX_DEBUG2("-->CMPXDbManager::BlockDiskSpaceL %d", (TInt)aDrive );
-
+ MPX_DEBUG2("-->CMPXDbManager::BlockDiskSpaceL %d", aIndex );
+ DatabaseHandle & database = iDatabaseHandles[aIndex];
// if current DB size can not fit in RAM, abort now
TInt ramDrive;
RFs::CharToDrive(iRAMDrive, ramDrive);
TVolumeInfo vol;
TInt err = iFs.Volume( vol, ramDrive );
- if ( vol.iFree <= aOrigDbSize + KMPMinimumRAMSizeToRun )
+ TEntry origDb;
+ iFs.Entry( *database.iOrigFullFilePath, origDb );
+ if ( vol.iFree <= origDb.iSize + KMPMinimumRAMSizeToRun )
{
MPX_DEBUG1("-->CMPXDbManager::BlockDiskSpaceL Not enough even for copy original DB file, leave" );
return EFalse;
}
// ensure you have the disk volume and database
- err = iFs.Volume( vol, (TInt)aDrive );
+ err = iFs.Volume( vol, database.iDrive );
if (err != KErrNone)
{
- MPX_DEBUG2("CMPXDbManager::BlockDiskSpaceL Volume not available on drive %d", (TInt)aDrive);
- return EFalse;
- }
-
- TInt index( GetDatabaseIndex((TInt)aDrive) );
- if (index < 0)
- {
- MPX_DEBUG2("CMPXDbManager::BlockDiskSpaceL Database not available for drive %d", (TInt)aDrive);
+ MPX_DEBUG2("CMPXDbManager::BlockDiskSpaceL Volume not available on drive %d", database.iDrive);
return EFalse;
}
// Check if the drive has enough space to block
MPX_DEBUG2("CMPXDbManager::BlockDiskSpaceL Disk total free space in bytes =%Lu", vol.iFree);
- TInt64 blockingSize( CalculateInitalDummyDBSize( vol, aOrigDbSize, aIsMTPInUse ));
+ TInt64 blockingSize( CalculateInitalDummyDBSize( vol, origDb.iSize, aIsMTPInUse ));
MPX_DEBUG2("CMPXDbManager::BlockDiskSpaceL Disk blocking size =%Lu", blockingSize);
if ( vol.iFree <= blockingSize + 1*KMPMegaByte )
{
@@ -2650,15 +2667,15 @@
}
// Create and resize the dummy file
- TFileName dummyDbFileName;
TChar ch;
- RFs::DriveToChar((TInt)aDrive, ch );
- dummyDbFileName.Format( KDummyDbFile, (TUint)ch);
+ RFs::DriveToChar(database.iDrive, ch );
+ database.iDummyFilePath.Format( KDummyDbFile, (TUint)ch);
RFile dummyDb;
- err = dummyDb.Replace( iFs, dummyDbFileName, EFileWrite );
+ err = dummyDb.Replace( iFs, database.iDummyFilePath, EFileWrite );
if (err != KErrNone)
{
MPX_DEBUG2("CMPXDbManager::BlockDiskSpaceL Can't open dummy file %d", err);
+ database.iDummyFilePath.Zero();
return EFalse;
}
err = dummyDb.SetSize( blockingSize );
@@ -2666,13 +2683,12 @@
{
MPX_DEBUG2("CMPXDbManager::BlockDiskSpaceL Can't resize dummy file %d", err);
dummyDb.Close();
+ RemoveDummyFile(aIndex);
return EFalse;
}
dummyDb.Close();
MPX_DEBUG1("CMPXDbManager::BlockDiskSpaceL Ok to block");
-
- iDatabaseHandles[index].iDummyFilePath.Copy(dummyDbFileName);
MPX_DEBUG1("<--CMPXDbManager::BlockDiskSpace");
return ETrue;
@@ -2801,7 +2817,7 @@
else
{
TInt size=0;
- TInt err = GetTotalRamDatabasesSize(size);
+ TInt err = GetTotalRamDatabasesSizeL(size);
if ( err || (size > iMaximumAllowedRAMDiskSpaceToCopy) )
{
// Databases using too much RAM space, copy back to normal drive and continue to harvest.
@@ -2889,7 +2905,7 @@
TInt count(iDatabaseHandles.Count());
for (TInt i = 0; i < count && iDatabaseHandles[i].iUseRAMdb ; ++i)
{
- CloseDatabaseL( iDatabaseHandles[i].iDrive );
+ CloseDatabaseAtIndexL( i );
TInt err= BaflUtils::CopyFile(iFs,
iDatabaseHandles[i].iTargetFullFilePath->Des(),
@@ -2897,7 +2913,7 @@
MPX_DEBUG2("CMPXDbManager::BackupDBsL err = %d", err);
- OpenDatabaseL( iDatabaseHandles[i].iDrive );
+ OpenDatabaseAtIndexL( i );
}
if (transactionCount > 0)
@@ -2960,7 +2976,7 @@
// CMPXDbManager::GetTotalRamDatabasesSize
// ---------------------------------------------------------------------------
//
-TInt CMPXDbManager::GetTotalRamDatabasesSize(TInt& aSize)
+TInt CMPXDbManager::GetTotalRamDatabasesSizeL(TInt& aSize)
{
MPX_FUNC("CMPXDbManager::GetTotalRamDatabasesSize");
TInt err = KErrNotSupported;
@@ -2988,22 +3004,65 @@
filename.Format(KSecurePath, User::Identity().iUid, temp);
CleanupStack::PopAndDestroy(temp);
dbFilename.Append(filename);
- MPX_DEBUG2("CMPXDbManager::GetTotalRamDatabasesSize - Database name = %S", &dbFilename);
+ MPX_DEBUG2("CMPXDbManager::GetTotalRamDatabasesSizeL - Database name = %S", &dbFilename);
TEntry entry;
err = iFs.Entry( dbFilename, entry );
if ( (err != KErrNone) && (err != KErrNotFound) )
{
break;
}
- MPX_DEBUG3("CMPXDbManager::GetTotalRamDatabasesSize - Size of Db %S = %d", &dbFilename, entry.iSize);
+ MPX_DEBUG3("CMPXDbManager::GetTotalRamDatabasesSizeL - Size of Db %S = %d", &dbFilename, entry.iSize);
// sum up size
size += entry.iSize;
}
aSize = size;
- MPX_DEBUG2("CMPXDbManager::GetTotalRamDatabasesSize - Total Size of Dbs = %d", size);
+ MPX_DEBUG2("CMPXDbManager::GetTotalRamDatabasesSizeL - Total Size of Dbs = %d", size);
#endif //__RAMDISK_PERF_ENABLE
- MPX_DEBUG2("CMPXDbManager::GetTotalRamDatabasesSize - Return err = %d", err);
+ MPX_DEBUG2("CMPXDbManager::GetTotalRamDatabasesSizeL - Return err = %d", err);
return err;
}
+
+// ----------------------------------------------------------------------------
+// Creates the absolute database filename on a specified drive.
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbManager::CreateFullFilenameL(TDriveUnit aDrive)
+ {
+ MPX_FUNC("CMPXDbManager::CreateFullFilenameL");
+
+ HBufC* filename = HBufC::NewL(KMaxFileName);
+ const TDesC& securefilePath = KSecureFilePath;
+ TDriveUnit cdrive(KRootDrive());
+
+#ifdef __RAMDISK_PERF_ENABLE
+ TInt index(GetDatabaseIndex((TInt)aDrive));
+ if ( index >=0 && iDatabaseHandles[index].iUseRAMdb && aDrive != cdrive )
+ {
+ MPX_DEBUG1("CMPXDbManager::CreateFullFilenameL - use RAMDisk");
+ TFileName path;
+ path.Append(iRAMDrive);
+ path.Append(_L(":"));
+ path.Append(KDBFilePath);
+ TBuf<2> d;
+ d.Append(aDrive.Name());
+ TFileName temp;
+ temp.Append(d.Left(1)); // attach original drive name
+ temp.Append(iDbFile->Des());
+ filename->Des().Format(securefilePath, &path, User::Identity().iUid, &temp);
+ MPX_DEBUG3("CMPXDbManager::CreateFullFilenameL - path=%S filename=%S", &path, filename);
+ }
+ else
+#endif //__RAMDISK_PERF_ENABLE
+ {
+ MPX_DEBUG1("CMPXDbManager::CreateFullFilenameL - use normal drive");
+ TFileName dbPath;
+ dbPath.Append(aDrive.Name());
+ dbPath.Append(KDBFilePath);
+ filename->Des().Format(securefilePath, &dbPath, User::Identity().iUid, iDbFile);
+ }
+ MPX_DEBUG2("CMPXDbManager::CreateFullFilenameL filename = %S", filename);
+ return filename;
+ }
+
// End of File
--- a/mpserviceplugins/mpxsqlitedbhgplugin/data/mpxcollectiondbhgres.rss Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/data/mpxcollectiondbhgres.rss Fri May 14 15:49:53 2010 +0300
@@ -22,7 +22,6 @@
#include <pathconfiguration.hrh>
#include "mpxcollectiondb.hrh"
-
STRUCT MENU_ITEM
{
LONG id;
@@ -236,7 +235,7 @@
{
txt = qtn_mus_pl_recently_downloaded;
}
-
+
// ---------------------------------------------------------------------------
// r_mpx_qtn_mus_music_num_songs
// Number of songs text
--- a/mpserviceplugins/mpxsqlitedbhgplugin/group/mpxdbpluginiconshg.mk Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/group/mpxdbpluginiconshg.mk Fri May 14 15:49:53 2010 +0300
@@ -37,15 +37,15 @@
CLEANLIB : ;
RESOURCE :
- mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
- /Ficonlist.txt
+ mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+ /Ficonlist.txt
FREEZE : ;
SAVESPACE : ;
RELEASABLES :
- @echo $(HEADERFILENAME)&& \
- @echo $(ICONTARGETFILENAME)
+ @echo $(HEADERFILENAME)&& \
+ @echo $(ICONTARGETFILENAME)
FINAL : ;
--- a/mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbabstractalbum.h Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbabstractalbum.h Fri May 14 15:49:53 2010 +0300
@@ -50,7 +50,7 @@
* @return New CMPXDbCategory instance.
*/
static CMPXDbAbstractAlbum* NewL(CMPXDbManager& aDbManager,
- TMPXGeneralCategory aCategory);
+ TMPXGeneralCategory aCategory, RFs& aFs);
/**
* Two-phased constructor.
@@ -59,7 +59,7 @@
* @return New CMPXDbCategory instance on the cleanup stack.
*/
static CMPXDbAbstractAlbum* NewLC(CMPXDbManager& aDbManager,
- TMPXGeneralCategory aCategory);
+ TMPXGeneralCategory aCategory, RFs& aFs);
/**
* Destructor
@@ -84,9 +84,17 @@
* into consideration when generating the unique row id
* @return The unique id of the row added.
*/
- TUint32 AddItemL( const TDesC& aName, const TDesC& aAlbumArtist, const TDesC& aGenre, TInt aDriveId, TBool& aNewRecord,
- TBool aCaseSensitive = ETrue);
-
+ TUint32 AddItemL( const TDesC& aUri, const TDesC& aName, const TDesC& aAlbumArtist, TInt aDriveId, TBool& aNewRecord,
+ TBool aCaseSensitive = EFalse);
+
+ /**
+ * Add existing item to table with same entry fields values except new Uri.
+ * @param aOldId: existing item Id
+ * @param newUri: new Uri
+ * @return The unique id of the row added.
+ */
+ TUint32 AddUpdatedItemL(TUint32 aOldId, const TDesC& newUri);
+
/**
* Decrement the number of songs for the item. If the count gets to 0, remove
* the item.
@@ -103,13 +111,17 @@
*/
void DecrementSongsForCategoryL(TUint32 aId, TInt aDriveId,
CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, TBool aMtpInUse);
-
+
/**
- * Remove a abstractalbum and return its URI
- * @param aAbstractAlbumId identifies the abstractalbum
- * @return HBufC containing the URI. Ownership is transferred.
+ * Remove a abstractalbum, remove entry from AbstractAlbum table,
+ * Thumbnail table, corresponding alb from file system
+ * @param aAbstractAlbumId ID of the abstractalbum to remove
+ * @param aItemChangedMessages a list of change events as a result of the
+ * abstractalbum removal
+ * @param aFileDeleted indicate if alb file already deleted from file system
*/
- HBufC* DeleteAbstractAlbumL(TUint32 aAbstractAlbumId, TInt aDriveId = 0);
+ void RemoveAbstractAlbumL(TUint32 aAbstractalbumId,
+ CMPXMessageArray& aItemChangedMessages, TBool aFileDeleted);
/**
* Update a category item.
@@ -120,6 +132,29 @@
* category was updated
*/
void UpdateItemL(TUint32 aId, const CMPXMedia& aMedia, TInt aDriveId, CMPXMessageArray* aItemChangedMessages);
+
+ /**
+ * Delete or Rename Thumbnail from TN DB by calling Thumbnail manager
+ * Rename Thumbnail if aNewPath is not NULL, otherwise Delete Thumbnail
+ * @param aOldPath: old Uri
+ * @param aNewPath: new Uri
+ * @param aPriority: priority pass to Thumbnail manager
+ */
+ void HandleTNL( const TDesC& aOldPath, const TDesC& aNewPath = KNullDesC, TInt aPriority =0 );
+
+ /**
+ * Get the uri field for a given ID.
+ * @param aId identifies the abstractalbum item
+ * @return uri that matches aId. Ownership is abandoned.
+ */
+ HBufC* GetUriL(TUint32 aId);
+
+ /**
+ * Get Ids of albstractalbum with no song associated.
+ * Rename Thumbnail if aNewPath is not NULL, otherwise Delete Thumbnail
+ * @param aItemsIds: array of Ids for abstractalbums which have no song associated.
+ */
+ void GetAllItemsWithNoSongL(RArray<TUint32>& aItemsIds);
private:
@@ -142,35 +177,37 @@
*/
void GenerateAbstractAlbumFieldsValuesL(const CMPXMedia& aMedia,
CDesCArray& aFields, CDesCArray& aValues);
-
+
+ /**
+ * Remove a abstractalbum from AbstractAlbum table
+ * @param aAbstractAlbumId identifies the abstractalbum
+ * @param aDriveId drive Id
+ */
+ void DeleteAbstractAlbumEntryL(TUint32 aAbstractAlbumId, TInt aDriveId = 0);
+
/**
* @see MMPXTable
*/
virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable);
-
-
/**
* @see MMPXTable
*/
virtual TBool CheckTableL(RSqlDatabase& aDatabase);
-
-
-
+
/**
* C++ constructor.
* @param aDbManager database manager to use for database interactions
* @param aCategory identifies the category
*/
- CMPXDbAbstractAlbum(CMPXDbManager& aDbManager, TMPXGeneralCategory aCategory);
+ CMPXDbAbstractAlbum(CMPXDbManager& aDbManager, TMPXGeneralCategory aCategory, RFs& aFs);
/**
* Second phase constructor.
*/
void ConstructL();
-
-
+
/**
* MThumbnailManagerObserver
*/
@@ -180,7 +217,7 @@
* MThumbnailManagerObserver
*/
void ThumbnailReady(
- TInt aError,
+ TInt aError,
MThumbnailData& aThumbnail, TThumbnailRequestId aId );
public:
@@ -191,9 +228,9 @@
enum TAbstractAlbumColumns
{
EAbstractAlbumUniqueId = KMPXTableDefaultIndex,
+ EAbstractAlbumUri,
EAbstractAlbumName,
EAbstractAlbumArtist,
- EAbstractAlbumGenre,
EAbstractAlbumSongCount,
EAbstractAlbumVolumeId,
EAbstractAlbumFieldCount
@@ -201,6 +238,8 @@
private: // Data
CThumbnailManager* iTNManager;
+ TBool iRenameTN;
+ RFs& iFs;
};
#endif // MPXDBAbstractAlbum_H
--- a/mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbalbum.h Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbalbum.h Fri May 14 15:49:53 2010 +0300
@@ -29,7 +29,7 @@
class MMPXDbAlbumObserver
{
public:
- virtual TInt HandleIsUnknownArtistL(TUint32 aId) = 0;
+ virtual TInt HandleIsUnknownArtistL(TUint32 aId) = 0;
virtual TUint32 HandleArtistForAlbumL( const TUint32 aId ) = 0;
};
/**
@@ -99,7 +99,7 @@
*/
void DecrementSongsForCategoryL(TUint32 aId, TInt aDriveId,
CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, const TUint32 aArtist);
-
+
/**
* Gets the details for all category items.
* @param aAttrs attributes to be returned
@@ -109,7 +109,7 @@
CMPXMediaArray& aMediaArray);
/**
- * Update a category item.
+ * 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
@@ -122,17 +122,17 @@
/**
* 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);
-
- private:
+
+ private:
/**
* Updates the media with information from the table
* @param aRecord record containing the source fields
@@ -149,12 +149,12 @@
* @param aValues values of each field of Album table
* @return a string containing the selection criteria. The ownership is passed to the caller.
*/
- void GenerateAlbumFieldsValuesL(const CMPXMedia& aMedia,
+ void GenerateAlbumFieldsValuesL(const CMPXMedia& aMedia,
CDesCArray& aFields, CDesCArray& aValues);
TBool IsUnknownArtistL(TUint32 aId);
-
+
TUint32 ArtistForAlbumL(const TUint32 aId);
private: // from MMPXTable
--- a/mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbartist.h Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbartist.h Fri May 14 15:49:53 2010 +0300
@@ -62,7 +62,7 @@
* Destructor
*/
virtual ~CMPXDbArtist();
-
+
public:
/**
* Add a category item. If the record already exists, its counter will
@@ -77,7 +77,7 @@
*/
TUint32 AddItemL(const TDesC& aName, const TDesC& aArt, TInt aDriveId, TBool& aNewRecord,
TBool aCaseSensitive = ETrue);
-
+
/**
* Gets the details for all category items.
* @param aAttrs attributes to be returned
@@ -85,9 +85,9 @@
*/
void GetAllCategoryItemsL(const TArray<TMPXAttribute>& aAttrs,
CMPXMediaArray& aMediaArray);
-
+
/**
- * Update a category item.
+ * 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
@@ -95,14 +95,14 @@
* category was updated
*/
void UpdateItemL(TUint32 aId, const CMPXMedia& aMedia, TInt aDriveId, CMPXMessageArray* aItemChangedMessages);
-
+
/*
* Checks if the specified artist item is unknown
* @param aId identifies the artist item
* @return ETrue if it is unknown, EFalse otherwise
- */
+ */
TBool IsUnknownArtistL(TUint32 aId);
-
+
private:
/**
@@ -121,9 +121,9 @@
* @param aValues values of each field of Artist table
* @return a string containing the selection criteria. The ownership is passed to the caller.
*/
- void GenerateArtistFieldsValuesL(const CMPXMedia& aMedia,
+ void GenerateArtistFieldsValuesL(const CMPXMedia& aMedia,
CDesCArray& aFields, CDesCArray& aValues);
-
+
/**
* Gets the Album counts for a Artist item
* @param aId identifies the Artist item
@@ -142,7 +142,7 @@
* @see MMPXTable
*/
virtual TBool CheckTableL(RSqlDatabase& aDatabase);
-
+
private:
/**
--- a/mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbautoplaylist.h Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbautoplaylist.h Fri May 14 15:49:53 2010 +0300
@@ -99,7 +99,7 @@
void GetAllPlaylistsL(CMPXMediaArray& aMediaArray);
private:
-
+
/**
* Get count and duration information of the auto-playlist
* @param aType the type of the auto-playlist
--- a/mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbcategory.h Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbcategory.h Fri May 14 15:49:53 2010 +0300
@@ -176,16 +176,16 @@
*/
TInt GetSongsCountL(TInt aDriveId, TUint32 aId);
- /**
- * 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
+ /**
+ * 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);
-
+ void UpdateItemL(TUint32 aId, const CMPXMedia& aMedia, TInt aDriveId, CMPXMessageArray* aItemChangedMessages);
+
protected:
/**
--- a/mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbhandler.h Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbhandler.h Fri May 14 15:49:53 2010 +0300
@@ -110,7 +110,7 @@
* @return TUint32 id of the item added
*/
TUint32 AddSongWithNoTransactionL(const CMPXMedia& aMedia, CMPXMessageArray* aMessageArray=NULL);
-
+
/**
* Add a playlist to the collection
* @param aMedia playlist media object with title and URI of the playlist.
@@ -124,12 +124,13 @@
* @return playlist Id of the playlist
*/
TUint32 AddSongToPlaylistL(const CMPXMedia& aMedia);
-#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
/**
* Add an abstractalbum to the collection
* @param aMedia abstractalbum media object with URI of the abstractalbum.
+ * @param aMessageArray change event message to notify client of the changes
* @return abstractalbum Id of the abstractalbum created
- */
+ */
TUint32 AddAbstractAlbumL(const CMPXMedia& aMedia, CMPXMessageArray* aMessageArray=NULL);
#endif // ABSTRACTAUDIOALBUM_INCLUDED
/**
@@ -142,19 +143,30 @@
*/
CMPXDbActiveTask::TChangeVisibility UpdateSongL(const CMPXMedia& aMedia,
CMPXMessageArray& aItemChangedMessages);
-#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
/**
- * Update songs info for songs associated with abstractalbum
+ * Update abstractalbum info to AbstractAlbum table and Songs associated with abstractalbum
* in the music collection database
- * @param aMedia songDetails object which contains file path,
+ * @param aMedia media object
+ * @param aItemChangedMessages a list of change events as a result of the
+ * song update
+ * @return ETrue if UI visible change else EFalse
+ */
+ CMPXDbActiveTask::TChangeVisibility UpdateAbstractAlbumL(const CMPXMedia& aMedia,
+ CMPXMessageArray& aItemChangedMessages);
+
+ /**
+ * Update all songs which associate with AbstractAlbum to new AbstractAlbum info
+ * in the collection
+ * @param aMedia media object which contains file path,
* artist, composer, name(title), track, etc...
* @param aItemChangedMessages a list of change events as a result of the
* song update
* @return ETrue if UI visible change else EFalse
- */
- CMPXDbActiveTask::TChangeVisibility UpdateAbstractAlbumSongsL(const CMPXMedia& aMedia,
+ */
+ CMPXDbActiveTask::TChangeVisibility UpdateSongsAbstractAlbumInfoL(const CMPXMedia& aMedia,
CMPXMessageArray& aItemChangedMessages);
-#endif // ABSTRACTAUDIOALBUM_INCLUDED
+#endif // ABSTRACTAUDIOALBUM_INCLUDED
/**
* Update playlist info in the music collection database
* @param aMedia playlist details object which contains file path,
@@ -241,15 +253,16 @@
CMPXMessageArray& aItemChangedMessages);
#ifdef ABSTRACTAUDIOALBUM_INCLUDED
/**
- * Remove a abstractalbum This will remove all the songs from the abstractalbum
+ * Remove a abstractalbum, remove entry from AbstractAlbum table,
+ * Thumbnail table, corresponding alb from file system
* @param aAbstractAlbumId ID of the abstractalbum to remove
- * @param aUriArray a descriptor array to contain the URI of the deleted file
* @param aItemChangedMessages a list of change events as a result of the
* abstractalbum removal
+ * @param aFileDeleted indicate if alb file already deleted from file system
*/
- void RemoveAbstractAlbumL(TUint32 aAbstractAlbumId, CDesCArray& aUriArray,
- CMPXMessageArray& aItemChangedMessages);
-#endif // ABSTRACTAUDIOALBUM_INCLUDED
+ void RemoveAbstractAlbumL(TUint32 aAbstractAlbumId,
+ CMPXMessageArray& aItemChangedMessages, TBool aFileDeleted);
+#endif // ABSTRACTAUDIOALBUM_INCLUDED
/**
* Remove a song from the specified playlist.
@@ -659,7 +672,7 @@
* Ends a refresh operation.
*/
void RefreshEndL();
-
+
/**
* Notification of mtp start
*/
@@ -737,21 +750,11 @@
*/
void PreCloseCollectionL();
- /**
- * Notifies the handler that the collection was closed.
- */
- void CollectionClosed();
-
- /**
- * Notifies the handler that the collection was opened.
- */
- void CollectionOpenedL();
-
/**
* Checks if the spefified drive is a remove drive
- */
+ */
TBool IsRemoteDrive(TDriveNumber aDrive);
-
+
/**
* Checks if there is a drive that has a low disk space
* @leave KErrDiskFull if the space on one of the drives is below the
@@ -888,17 +891,8 @@
*/
void DoRemovePlaylistL(TUint32 aPlaylistId, CDesCArray& aUriArray,
CMPXMessageArray& aItemChangedMessages);
-#ifdef ABSTRACTAUDIOALBUM_INCLUDED
- /**
- * Deletes a specified abstractalbum.
- * @param aAbstractAlbumId the abstractalbum to be deleted.
- * @param aUriArray on return contains the URIs of the items deleted.
- * @param aItemChangedMessages on return contains changed messages for all
- * affected items
- */
- void DoRemoveAbstractAlbumL(TUint32 aAbstractalbumId, CDesCArray& aUriArray,
- CMPXMessageArray& aItemChangedMessages);
-#endif // ABSTRACTAUDIOALBUM_INCLUDED
+
+
/**
* Deletes a song from a playlist.
* @param aPlaylistId identifies the playlist.
@@ -911,6 +905,22 @@
void DoRemoveSongFromPlaylistL(TUint32 aPlaylistId, const TMPXItemId& aSongId,
TInt aOrdinal, CMPXMessageArray& aItemChangedMessages);
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+ /**
+ * Remove all abstractalbum items with no songs associated,
+ * TN and .alb files also removed.
+ *
+ */
+ void RemoveAbstractAlbumsWithNoSongL();
+
+ /**
+ /* When refresh library, Remove .alb entry from AbstractAlnum table, TN table if .alb files deleted
+ /* from file manager
+ */
+ void AbstractAlbumCleanUpL();
+
+#endif // ABSTRACTAUDIOALBUM_INCLUDED
+
/**
* Deletes all song records marked as deleted.
*/
@@ -1018,10 +1028,11 @@
* @see MMPXDbMusicObserver
*/
virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory,
- const TDesC& aName, TInt aDriveId,
+ const TDesC& aName,
+ TInt aDriveId,
CMPXMessageArray* aItemChangedMessages, TBool& aItemExist,
- const TDesC& aAlbumArtist=KNullDesC,
- const TDesC& aGenre=KNullDesC);
+ const TDesC& aUri,
+ const TDesC& aAlbumArtist=KNullDesC);
#else
/**
@@ -1032,13 +1043,13 @@
CMPXMessageArray* aItemChangedMessages, TBool& aItemExist);
#endif // ABSTRACTAUDIOALBUM_INCLUDED
- virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName,
- TUint32 aArtist, const TDesC& aArt,
- TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist);
+ virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName,
+ TUint32 aArtist, const TDesC& aArt,
+ TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist);
- virtual void UpdateCategoryItemL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
- const CMPXMedia& aMedia, TInt aDrive, CMPXMessageArray* aItemChangedMessages);
-
+ virtual void UpdateCategoryItemL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
+ const CMPXMedia& aMedia, TInt aDrive, CMPXMessageArray* aItemChangedMessages);
+
/**
* @see MMPXDbMusicObserver
*/
@@ -1055,7 +1066,7 @@
* @see MMPXDbMusicObserver
*/
virtual void HandlePlaybackTimeModifiedL(CMPXMessageArray& aItemChangedMessages);
-#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
/**
* @see MMPXDbMusicObserver
*/
@@ -1073,7 +1084,7 @@
*/
virtual TBool HandleIsUnknownArtistL(TUint32 aArtistId);
virtual TUint32 HandleArtistForAlbumL(const TUint32 aAlbumId);
-
+
private: // From MMPXDbPlaylistObserver
/**
* @see MMPXDbPlaylistObserver
@@ -1121,8 +1132,6 @@
RFs& iFs;
CMPXResource& iResource;
TBool iOutOfDisk; // Are we in out of disk mode?
- TBool iSynchronizeBasicTable; // Basic music table was not updated during last refresh
- TBool iCollectionOpen; // Databases opened
TBool iRefresh; // Refresh operation currently performed
TBool iMtpInUse; // Flag for MTP operation
TInt iOpOnDbCount; // Count to provide a min op amount in one transaction
--- a/mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbmusic.h Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbmusic.h Fri May 14 15:49:53 2010 +0300
@@ -318,7 +318,7 @@
* @param aMedia returns the song information
*/
void GetSongL(TInt aSongId, const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aMedia);
-
+
/**
* Returns all songs in the playlist.
* @param aDrive identifies in db
@@ -421,14 +421,13 @@
#ifdef ABSTRACTAUDIOALBUM_INCLUDED
- /**
+ /**
* Returns all songs for a given abstractalbum.
- * @param aDrive drive ID AbstractAlbum stored
* @param aAbstractAlbumId abstractalbum to get the songs for
* @param aAttrs attributes to be retrieved
* @param aMediaArray returns the song attributes.
*/
- void GetAllSongsForAbstractAlbumL(TInt aDrive, TInt aAbstractAlbumId,
+ void GetAllSongsForAbstractAlbumL(TUint aAbstractAlbumId,
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
#endif // ABSTRACTAUDIOALBUM_INCLUDED
/**
@@ -525,24 +524,9 @@
/**
* Get the ID of Artist which belongs to the specified Album
- * @param aId, the ID of Album
+ * @param aId, the ID of Album
*/
TUint32 CMPXDbMusic::ArtistForAlbumL(const TUint32 aId);
-
- /**
- * Signals the start of a refresh operation
- */
- void RefreshStartL();
-
- /**
- * Signals the end of a refresh operation
- */
- void RefreshEndL();
-
- /*
- * Refresh music basic table
- */
- void RefreshBasicTableL();
/*
* Check the integrity of the music basic table
@@ -693,9 +677,9 @@
const TMPXAttribute& aAttribute, TUint32 aOldId, TInt aDriveId,
CMPXMessageArray* aItemChangedMessages, TUint32& aItemId);
- TBool UpdateCategoryFieldL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia,
- const TMPXAttribute& aAttribute, TUint32 aOldId, TInt aDriveId,
- CMPXMessageArray* aItemChangedMessages, TUint32& aItemId, TUint32 aArtistId);
+ TBool UpdateCategoryFieldL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia,
+ const TMPXAttribute& aAttribute, TUint32 aOldId, TInt aDriveId,
+ CMPXMessageArray* aItemChangedMessages, TUint32& aItemId, TUint32 aArtistId);
/**
* Checks if extra attributes are required. The "standard attribute set includes:
* EMPXMediaGeneralId, EMPXMediaGeneralType, EMPXMediaGeneralCategory,
@@ -711,7 +695,7 @@
* @return ETrue if the media contains one or more supported attribute;
* otherwise EFalse.
*/
- TBool IsSupported(const CMPXMedia& aMedia);
+ TBool IsSupported(const CMPXMedia& aMedia);
private: // from MMPXTable
@@ -749,8 +733,8 @@
* Column indexes in the music table
*/
enum TMusicColumns
- {
- EMusicUniqueId = KMPXTableDefaultIndex,
+ {
+ EMusicUniqueId = KMPXTableDefaultIndex,
EMusicDbFlag,
EMusicVolumeId,
EMusicTitle,
@@ -811,7 +795,9 @@
// file extensions to check DRM type, owned
CDesCArrayFlat* iExtensionsDrm;
MMPXDbMusicObserver& iObserver;
- TBool iRefresh;
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+ TBool iArtNeedUpdated;
+#endif // ABSTRACTAUDIOALBUM_INCLUDED
};
#endif // MPXDBMUSIC_H
--- a/mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbpluginqueries.h Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbpluginqueries.h Fri May 14 15:49:53 2010 +0300
@@ -155,7 +155,7 @@
_LIT(KQueryMusicGetMostPlayed, "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.PlayCount<>0 AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY PlayCount DESC, TimePlayed DESC LIMIT %u");
_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 11 DESC");
#ifdef ABSTRACTAUDIOALBUM_INCLUDED
-_LIT(KQueryMusicGetSongsForAbstractAlbum,"SELECT Music.*,AbstractAlbum.Name FROM :dbname.Music,:dbname.AbstractAlbum WHERE Music.Deleted=0 AND Music.AbstractAlbum=AbstractAlbum.UniqueId AND AbstractAlbum.UniqueId=%u");
+_LIT(KQueryMusicGetSongsForAbstractAlbum,"SELECT Music.*,AbstractAlbum.Uri FROM :dbname.Music,:dbname.AbstractAlbum WHERE Music.Deleted=0 AND Music.AbstractAlbum=AbstractAlbum.UniqueId AND AbstractAlbum.UniqueId=%u");
#endif // ABSTRACTAUDIOALBUM_INCLUDED
_LIT(KQueryMusicSong, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location FROM :dbname.Music WHERE %S");
_LIT(KQueryMusicFindAll, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE %S AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId %S");
@@ -222,8 +222,11 @@
// 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");
+#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");
_LIT(KQueryMusicGetArtistForAlbum, "SELECT Artist FROM :dbname.Music,:dbname.Artist WHERE Music.Deleted=0 AND Music.Artist=Artist.UniqueId AND Music.Album=%u");
@@ -268,7 +271,7 @@
_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.5.0',%u)");
-#else
+#else
_LIT(KQueryAuxiliaryInsert, "INSERT INTO Auxiliary(Id,Version,Corrupt) VALUES(0,'6.4.0',%u)");
#endif // ABSTRACTAUDIOALBUM_INCLUDED
_LIT(KQueryAuxiliarySetTime, "UPDATE :dbname.Auxiliary SET TimeRefreshed='%S', Corrupt=0");
@@ -351,7 +354,7 @@
_LIT(KQueryPlaylistSongsGetSongInfo, "SELECT PlaylistSongs.UniqueId,PlaylistSongs.SongId,PlaylistSongs.PlaylistId,PlaylistSongs.Ordinal,PlaylistSongInfo.VolumeId,PlaylistSongInfo.DbFlag,PlaylistSongInfo.Uri,PlaylistSongInfo.Title FROM :dbname.PlaylistSongs,:dbname.PlaylistSongInfo WHERE PlaylistSongs.UniqueId=%u AND PlaylistSongs.SongId=%u AND PlaylistSongs.SongId=PlaylistSongInfo.SongId");
_LIT(KQueryPlaylistSongsUpdateSongOrdinalAfterDelete, "UPDATE :dbname.PlaylistSongs SET Ordinal=Ordinal-1 WHERE PlaylistId=%u AND Ordinal>%u");
-_LIT(KQueryPlaylistSongsUpdateSongOrdinal, "UPDATE :dbname.PlaylistSongs SET Ordinal=%u WHERE SongId=%u");
+_LIT(KQueryPlaylistSongsUpdateSongOrdinal, "UPDATE :dbname.PlaylistSongs SET Ordinal=%u WHERE UniqueId=%u");
_LIT(KQueryPlaylistSongsMoveSongUp, "UPDATE :dbname.PlaylistSongs SET Ordinal=Ordinal+1 WHERE PlaylistId=%u AND Ordinal>=%u AND Ordinal<%u");
_LIT(KQueryPlaylistSongsMoveSongDown, "UPDATE :dbname.PlaylistSongs SET Ordinal=Ordinal-1 WHERE PlaylistId=%u AND Ordinal<=%u AND Ordinal>%u");
@@ -427,7 +430,7 @@
L"Name TEXT COLLATE NOCASE,"
L"SongCount INTEGER,"
L"Artist INTEGER,"
- L"Art TEXT)");
+ L"Art TEXT)");
_LIT(KAlbumCheckTable,"SELECT UniqueId,Name,SongCount,Artist,Art FROM Album");
@@ -458,16 +461,17 @@
//
_LIT(KAbstractAlbumCreateTable,"CREATE TABLE AbstractAlbum("
L"UniqueId INTEGER PRIMARY KEY,"
+ L"Uri TEXT,"
L"Name TEXT COLLATE NOCASE,"
L"AlbumArtist TEXT,"
- L"Genre TEXT,"
L"SongCount INTEGER,"
L"VolumeId INTEGER)");
-_LIT(KAbstractAlbumCheckTable,"SELECT UniqueId,Name,SongCount,VolumeId FROM AbstractAlbum");
+_LIT(KAbstractAlbumCheckTable,"SELECT UniqueId,Uri,Name,AlbumArtist,SongCount,VolumeId FROM AbstractAlbum");
_LIT(KCriterionAbstractAlbumVolumeId, "VolumeId=%u");
-_LIT(KQueryAbstractAlbumInsert, "INSERT INTO :dbname.AbstractAlbum(UniqueId,Name,AlbumArtist,Genre,SongCount,VolumeId) VALUES(%u,'%S','%S','%S',%u,%u)");
+_LIT(KQueryAbstractAlbumInsert, "INSERT INTO :dbname.AbstractAlbum(UniqueId,Uri,Name,AlbumArtist,SongCount,VolumeId) VALUES(%u,'%S','%S','%S',%u,%u)");
_LIT(KQueryAbstractAlbumUpdate, "UPDATE :dbname.AbstractAlbum SET %S WHERE UniqueId=%u");
_LIT(KCriterionCategoryVolumeId, "SELECT VolumeId FROM :dbname.AbstractAlbum WHERE UniqueId=%u");
+_LIT(KQueryAbstractAlbumsWithNoSong, "SELECT * FROM :dbname.AbstractAlbum WHERE SongCount=0");
#endif // ABSTRACTAUDIOALBUM_INCLUDED
#endif // MPXDBPLUGINQUERIES_H
--- a/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbabstractalbum.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbabstractalbum.cpp Fri May 14 15:49:53 2010 +0300
@@ -14,6 +14,7 @@
* Description: Responsible for interation with the category tables:
* Artist, Album, Genre, Composer and AbstractAlbum
*
+*
*/
@@ -36,9 +37,6 @@
// CONSTANTS
-
-
-
// ============================ MEMBER FUNCTIONS ==============================
// ----------------------------------------------------------------------------
@@ -47,11 +45,11 @@
//
CMPXDbAbstractAlbum* CMPXDbAbstractAlbum::NewL(
CMPXDbManager& aDbManager,
- TMPXGeneralCategory aCategory)
+ TMPXGeneralCategory aCategory, RFs& aFs)
{
MPX_FUNC("CMPXDbAbstractAlbum::NewL");
- CMPXDbAbstractAlbum* self = CMPXDbAbstractAlbum::NewLC(aDbManager, aCategory);
+ CMPXDbAbstractAlbum* self = CMPXDbAbstractAlbum::NewLC(aDbManager, aCategory, aFs);
CleanupStack::Pop(self);
return self;
}
@@ -62,11 +60,11 @@
//
CMPXDbAbstractAlbum* CMPXDbAbstractAlbum::NewLC(
CMPXDbManager& aDbManager,
- TMPXGeneralCategory aCategory)
+ TMPXGeneralCategory aCategory, RFs& aFs)
{
MPX_FUNC("CMPXDbAbstractAlbum::NewLC");
- CMPXDbAbstractAlbum* self = new (ELeave) CMPXDbAbstractAlbum(aDbManager, aCategory);
+ CMPXDbAbstractAlbum* self = new (ELeave) CMPXDbAbstractAlbum(aDbManager, aCategory, aFs);
CleanupStack::PushL(self);
self->ConstructL();
return self;
@@ -102,9 +100,9 @@
// ----------------------------------------------------------------------------
//
TUint32 CMPXDbAbstractAlbum::AddItemL(
+ const TDesC& aUri,
const TDesC& aName,
const TDesC& aAlbumArtist,
- const TDesC& aGenre,
TInt aDriveId,
TBool& aNewRecord,
TBool aCaseSensitive)
@@ -112,19 +110,21 @@
MPX_FUNC("CMPXDbAbstractAlbum::AddItemL");
TUint32 rowId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXAbstractAlbum,
- aName, aCaseSensitive));
-
+ aUri, aCaseSensitive));
+ aNewRecord = !CategoryItemExistsL(aDriveId, rowId);
+
if ( aNewRecord )
{
+ HBufC* uri = MPXDbCommonUtil::ProcessSingleQuotesLC(aUri);
HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(aName);
HBufC* albumartist = MPXDbCommonUtil::ProcessSingleQuotesLC(aAlbumArtist);
- HBufC* genre = MPXDbCommonUtil::ProcessSingleQuotesLC(aGenre);
-
- iDbManager.ExecuteQueryL(aDriveId, KQueryAbstractAlbumInsert, rowId, name, albumartist, genre, 0, MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), aDriveId));
- CleanupStack::PopAndDestroy(3, name);
+
+ iDbManager.ExecuteQueryL(aDriveId, KQueryAbstractAlbumInsert, rowId, uri, name, albumartist, 0, MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), aDriveId));
+ CleanupStack::PopAndDestroy(3, uri);
}
else
{
+ MPX_DEBUG1("CMPXDbAbstractAlbum::AddItemL, increase song count for abstractalbum");
// increment the number of songs for the category
HBufC* query = PreProcessStringLC(KQueryCategoryIncrementSongCount);
iDbManager.ExecuteQueryL(aDriveId, *query, rowId);
@@ -134,7 +134,36 @@
return rowId;
}
+// ----------------------------------------------------------------------------
+// CMPXDbAbstractAlbum::AddUpdatedItemL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbAbstractAlbum::AddUpdatedItemL(TUint32 aOldId, const TDesC& newUri)
+ {
+ MPX_FUNC("CMPXDbAbstractAlbum::AddUpdatedItemL");
+ iRenameTN = ETrue;
+
+ //get the existing item based on aOldId
+ HBufC* query = NULL;
+ query = PreProcessStringLC(KQueryCategoryItem);
+ RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, aOldId));
+ CleanupStack::PopAndDestroy(query);
+
+ CleanupClosePushL(recordset);
+ TBool newRecord(ETrue);
+ if (recordset.Next() != KSqlAtRow)
+ {
+ User::Leave(KErrNotFound);
+ }
+ //save the existing entry fields values for renaming purpose
+ const TDesC& name(MPXDbCommonUtil::GetColumnTextL (recordset, EAbstractAlbumName));
+ const TDesC& albumartist(MPXDbCommonUtil::GetColumnTextL (recordset, EAbstractAlbumArtist));
+ TUint32 itemId = AddItemL(newUri, name, albumartist, GetDriveIdL(aOldId), newRecord, EFalse);
+ CleanupStack::PopAndDestroy(&recordset);
+
+ return itemId;
+ }
// ----------------------------------------------------------------------------
// CMPXDbAbstractAlbum::DecrementSongsForCategoryL
@@ -150,8 +179,7 @@
MPX_FUNC("CMPXDbAbstractAlbum::DecrementSongsForCategoryL");
TInt songCount = GetSongsCountL(aDriveId, aId);
- // if just one song uses this category. Use <= just in case
- //while MTP connection, just decrease songCount in DB, do not do deletion.
+ //while MTP connection, just decrease songCount in DB, do not do deletion.
if ( songCount > 0 )
{
aItemExist = ETrue;
@@ -161,74 +189,92 @@
CleanupStack::PopAndDestroy(query);
songCount--;
}
-
- if ((songCount == 0) && !aMtpInUse)
+ if (songCount == 0)
{
- HBufC* uri = DeleteAbstractAlbumL(aId, aDriveId);
- MPX_DEBUG1("CMPXDbAbstractAlbum::DeleteAbstractAlbumL,implicitly delete AbstractAlbum Object when it has 0 references");
- aItemExist = EFalse;
- if (aItemChangedMessages)
+ //get uri
+ HBufC* uri = GetUriL(aId);
+ CleanupStack::PushL(uri);
+
+ if (!aMtpInUse)
+ {
+ DeleteAbstractAlbumEntryL(aId, aDriveId);
+ MPX_DEBUG1("CMPXDbAbstractAlbum::DecrementSongsForCategoryL,implicitly delete AbstractAlbum Object when it has 0 references");
+ aItemExist = EFalse;
+ if (aItemChangedMessages)
+ {
+ // add the item changed message
+ MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aId, EMPXItemDeleted,
+ EMPXAbstractAlbum, KDBPluginUid);
+ }
+ //delete .alb file from file system
+ TInt err = BaflUtils::DeleteFile(iFs, *uri);
+ if(KErrNone != err)
+ {
+ MPX_DEBUG2("CMPXDbAbstractAlbum::DecrementSongsForCategoryL,File not deleted from file system with err=%d", err);
+ }
+ }
+ if(!iRenameTN)
+ {
+ HandleTNL(*uri);
+ }
+ CleanupStack::PopAndDestroy(uri);
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAbstractAlbum::RemoveAbstractAlbumL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAbstractAlbum::RemoveAbstractAlbumL(TUint32 aAbstractAlbumId,
+ CMPXMessageArray& aItemChangedMessages, TBool aFileDeleted)
+ {
+ MPX_FUNC("CMPXDbAbstractAlbum::RemoveAbstractAlbumL");
+ HBufC* uri = GetUriL(aAbstractAlbumId);
+ CleanupStack::PushL(uri);
+
+ DeleteAbstractAlbumEntryL(aAbstractAlbumId);
+ HandleTNL(*uri);
+ if (!aFileDeleted)
+ {
+ TInt err = BaflUtils::DeleteFile(iFs, *uri);
+ if(KErrNone != err)
{
- // add the item changed message
- MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aId, EMPXItemDeleted,
- EMPXAbstractAlbum, KDBPluginUid);
- }
- delete uri;
- }
+ MPX_DEBUG2("CMPXDbAbstractAlbum::RemoveAbstractAlbumL,File not deleted from file system with err=%d", err);
+ }
+ }
+ MPXDbCommonUtil::AddItemChangedMessageL(aItemChangedMessages, aAbstractAlbumId, EMPXItemDeleted, EMPXAbstractAlbum, KDBPluginUid);
+ CleanupStack::PopAndDestroy(uri);
}
// ----------------------------------------------------------------------------
-// CMPXDbAbstractAlbum::DeleteAbstractAlbumL
+// CMPXDbAbstractAlbum::HandleTNL
// ----------------------------------------------------------------------------
//
-HBufC* CMPXDbAbstractAlbum::DeleteAbstractAlbumL(
- TUint32 aAbstractAlbumId, TInt aDriveId)
- {
- MPX_FUNC("CMPXDbAbstractAlbum::DeleteAbstractAlbumL");
+void CMPXDbAbstractAlbum::HandleTNL( const TDesC& aOldPath,
+ const TDesC& aNewPath, TInt aPriority )
+ {
+ MPX_FUNC("CMPXDbAbstractAlbum::HandleTNL");
- //before delete category, get the abstract album path
- HBufC* uri = GetNameL(aAbstractAlbumId);
- // delete the category
- if (uri)
- {
- CleanupStack::PushL(uri);
-
- if (aDriveId)
- DeleteCategoryL(aAbstractAlbumId, aDriveId);
- else
- {
- TInt drive = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
- ExecuteIntQueryL(KCriterionCategoryVolumeId, aAbstractAlbumId));
- DeleteCategoryL(aAbstractAlbumId, drive);
- }
-//delete abstract album .alb from TN table
-#ifdef RD_MPX_TNM_INTEGRATION
- // remove from thumbnail database table
- CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC(
- *uri, KImageFileType );
- iTNManager->DeleteThumbnails( *source );
- CleanupStack::PopAndDestroy( source );
-#endif //RD_MPX_TNM_INTEGRATION
-
-
- //delete abstract album .alb file from file system
- RFs rFs;
- User::LeaveIfError( rFs.Connect() );
- CleanupClosePushL( rFs );
-
- TInt err = BaflUtils::DeleteFile(rFs, *uri);
- if(KErrNone != err)
- {
- MPX_DEBUG2("CMPXDbAbstractAlbum::DeleteAbstractAlbumL,File not deleted from file system with err=%d", err);
- }
-
- CleanupStack::PopAndDestroy( &rFs );
- }
-
- CleanupStack::Pop(uri);
- return uri;
- }
+ if (aNewPath.Compare(KNullDesC)==0 && aOldPath.Compare(KNullDesC)!=0)
+ {
+ // remove from thumbnail database table
+ MPX_DEBUG1("CMPXDbAbstractAlbum::HandleTNL, delete TN");
+ CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC(
+ aOldPath, KImageFileType );
+ iTNManager->DeleteThumbnails( *source );
+ CleanupStack::PopAndDestroy( source );
+ }
+ else if (aNewPath.Compare(KNullDesC)!=0)
+ {
+ //rename thumbnail
+ MPX_DEBUG1("CMPXDbAbstractAlbum::HandleTNL, rename TN");
+ // TODO: uncomment when RenameThumbnailsL is supported.
+ //iTNManager->RenameThumbnailsL( aOldPath, aNewPath, aPriority );
+ //after rename, reset flag
+ iRenameTN = EFalse;
+ }
+ }
// ----------------------------------------------------------------------------
@@ -261,12 +307,34 @@
MPXDbCommonUtil::AddItemAlbumChangedMessageL(*aItemChangedMessages, aId, EMPXItemModified,
EMPXAbstractAlbum, KDBPluginUid, ETrue, 0 );
}
-
CleanupStack::PopAndDestroy(setStr);
CleanupStack::PopAndDestroy(values);
CleanupStack::PopAndDestroy(fields);
}
+
+// ----------------------------------------------------------------------------
+// CMPXDbAbstractAlbum::GetUriL
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbAbstractAlbum::GetUriL(
+ TUint32 aId)
+ {
+ MPX_FUNC("CMPXDbAbstractAlbum::GetUriL");
+
+ RSqlStatement recordset(GetCategoryRecordL(aId));
+ CleanupClosePushL(recordset);
+
+ if (recordset.Next() != KSqlAtRow)
+ {
+ User::LeaveIfError(KErrNotFound);
+ }
+ HBufC* uri = MPXDbCommonUtil::GetColumnTextL(recordset, EAbstractAlbumUri).AllocL();
+ CleanupStack::PopAndDestroy(&recordset);
+ return uri;
+ }
+
+
// ----------------------------------------------------------------------------
// CMPXDbAbstractAlbum::UpdateMediaL
// ----------------------------------------------------------------------------
@@ -276,41 +344,41 @@
const TArray<TMPXAttribute>& aAttrs,
CMPXMedia& aMedia)
{
- MPX_FUNC("CMPXDbAbstractAlbum::UpdateMediaL");
+ MPX_FUNC("CMPXDbAbstractAlbum::UpdateMediaL");
- TInt count(aAttrs.Count());
- for (TInt i = 0; i < count; ++i)
- {
- TInt contentId(aAttrs[i].ContentId());
- TUint attributeId(aAttrs[i].AttributeId());
+ TInt count(aAttrs.Count());
+ for (TInt i = 0; i < count; ++i)
+ {
+ TInt contentId(aAttrs[i].ContentId());
+ TUint attributeId(aAttrs[i].AttributeId());
if (contentId == KMPXMediaIdGeneral)
{
if (attributeId & EMPXMediaGeneralId)
{
+ MPX_DEBUG1(" EMPXMediaGeneralId");
aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId,
aRecord.ColumnInt64(EAbstractAlbumUniqueId));
}
if (attributeId & EMPXMediaGeneralTitle)
{
+ MPX_DEBUG1(" EMPXMediaGeneralTitle");
TPtrC title(MPXDbCommonUtil::GetColumnTextL(aRecord, EAbstractAlbumName));
aMedia.SetTextValueL(KMPXMediaGeneralTitle, title);
MPX_DEBUG2(" AbstractAlbumName[%S]", &title);
- }
+ }
if (attributeId & EMPXMediaGeneralCount)
{
+ MPX_DEBUG1(" EMPXMediaGeneralCount");
TInt songCount = GetSongsCountL(KDbManagerAllDrives,
aRecord.ColumnInt64(EAbstractAlbumUniqueId));
aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount, songCount );
}
- if (attributeId & EMPXMediaGeneralDrive)
- {
+ if (attributeId & EMPXMediaGeneralDrive ||
+ (attributeId & EMPXMediaGeneralUri))
+ {
TUint32 volId(aRecord.ColumnInt64(EAbstractAlbumVolumeId));
TInt driveId = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), volId);
-
- // LTAN-7GH6BZ, crash if eject memory card when adding song to existing AbstractAlbum
- // due to special timing issue, it is possible drive number is -1 and create a
- // panic when use for TDriveUnit
MPX_DEBUG3("volId = %d, driveId = %d", volId, driveId);
// handle possibly delay from framework notification
@@ -320,63 +388,100 @@
User::Leave(KErrNotReady);
}
TDriveUnit driveUnit(driveId);
-
- aMedia.SetTextValueL(KMPXMediaGeneralDrive, driveUnit.Name());
+ if (attributeId & EMPXMediaGeneralUri)
+ {
+ TPtrC uri(MPXDbCommonUtil::GetColumnTextL(aRecord, EAbstractAlbumUri));
+ aMedia.SetTextValueL(KMPXMediaGeneralUri, uri);
+ MPX_DEBUG2(" AbstractAlbum URI[%S]", &uri);
+ }
+ if (attributeId & EMPXMediaGeneralDrive)
+ {
+ aMedia.SetTextValueL(KMPXMediaGeneralDrive, driveUnit.Name());
+ }
+ }
+ } // end if contentId == KMPXMediaIdGeneral
- }
- } // end if contentId == KMPXMediaIdGeneral
else if ( contentId == KMPXMediaIdMusic)
{
if (attributeId & EMPXMediaMusicAlbumArtist)
- {
+ {
+ MPX_DEBUG1(" EMPXMediaMusicAlbumArtist");
TPtrC albumartist(MPXDbCommonUtil::GetColumnTextL(aRecord, EAbstractAlbumArtist));
aMedia.SetTextValueL(KMPXMediaMusicAlbumArtist, albumartist);
-
-
-
MPX_DEBUG2(" albumartist[%S]", &albumartist);
- }
- if (attributeId & EMPXMediaMusicGenre)
- {
- TPtrC genre(MPXDbCommonUtil::GetColumnTextL(aRecord, EAbstractAlbumGenre));
- aMedia.SetTextValueL(KMPXMediaMusicGenre, genre);
- MPX_DEBUG2(" Genre[%S]", &genre);
}
}
-
+
} // end for
aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, EMPXAbstractAlbum);
}
+// ----------------------------------------------------------------------------
+// CMPXDbAbstractAlbum::GetAllItemsWithNoSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAbstractAlbum::GetAllItemsWithNoSongL(RArray<TUint32>& aItemsIds)
+ {
+ MPX_FUNC("CMPXDbAbstractAlbum::GetAllItemsWithNoSongL");
+ RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAbstractAlbumsWithNoSong));
+ CleanupClosePushL(recordset);
+
+ TInt err(KErrNone);
+ while ((err = recordset.Next()) == KSqlAtRow)
+ {
+ TUint32 uniqueID(recordset.ColumnInt64(EAbstractAlbumUniqueId));
+ aItemsIds.AppendL(uniqueID);
+ }
+ CleanupStack::PopAndDestroy(&recordset);
+ if (err!= KSqlAtEnd)
+ {
+ User::Leave(KErrCorrupt);
+ }
+ }
+
// ----------------------------------------------------------------------------
-// CMPXDbAbstractAlbum::GenerateAlbumFieldsValuesL
+// CMPXDbAbstractAlbum::GenerateAbstractAlbumFieldsValuesL
// ----------------------------------------------------------------------------
//
void CMPXDbAbstractAlbum::GenerateAbstractAlbumFieldsValuesL(const CMPXMedia& aMedia, CDesCArray& aFields, CDesCArray& aValues)
{
MPX_FUNC("CMPXDbAbstractAlbum::GenerateAbstractAlbumFieldsValuesL");
-//support Winlogo use case
- if (aMedia.IsSupported(KMPXMediaGeneralTitle))
+ //support Winlogo use case
+ if (aMedia.IsSupported(KMPXMediaGeneralTitle))
{
TPtrC truncatedName(aMedia.ValueText(KMPXMediaGeneralTitle).Left(KMCMaxTextLen));
MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCCategoryName, truncatedName);
}
-//support Winlogo use case
- if (aMedia.IsSupported(KMPXMediaMusicAlbumArtist))
+ //support Winlogo use case
+ if (aMedia.IsSupported(KMPXMediaMusicAlbumArtist))
{
TPtrC truncatedAlbumArtist(aMedia.ValueText(KMPXMediaMusicAlbumArtist).Left(KMCMaxTextLen));
MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicAlbumArtist, truncatedAlbumArtist);
}
- if (aMedia.IsSupported(KMPXMediaMusicGenre))
+ }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAbstractAlbum::DeleteAbstractAlbumEntryL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAbstractAlbum::DeleteAbstractAlbumEntryL(
+ TUint32 aAbstractAlbumId, TInt aDriveId)
+ {
+ MPX_FUNC("CMPXDbAbstractAlbum::DeleteAbstractAlbumEntryL");
+
+ //delete entry from table
+ if (aDriveId)
+ DeleteCategoryL(aAbstractAlbumId, aDriveId);
+ else
{
- TPtrC truncatedGenre(aMedia.ValueText(KMPXMediaMusicGenre).Left(KMCMaxTextLen));
- MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicGenre, truncatedGenre);
+ TInt drive = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+ ExecuteIntQueryL(KCriterionCategoryVolumeId, aAbstractAlbumId));
+ DeleteCategoryL(aAbstractAlbumId, drive);
}
}
-
// ----------------------------------------------------------------------------
// CMPXDbAlbum::CreateTableL
// ----------------------------------------------------------------------------
@@ -419,8 +524,9 @@
//
CMPXDbAbstractAlbum::CMPXDbAbstractAlbum(
CMPXDbManager& aDbManager,
- TMPXGeneralCategory aCategory) :
- CMPXDbCategory(aDbManager, aCategory)
+ TMPXGeneralCategory aCategory, RFs& aFs) :
+ CMPXDbCategory(aDbManager, aCategory),
+ iFs(aFs)
{
MPX_FUNC("CMPXDbAbstractAlbum::CMPXDbAbstractAlbum");
}
@@ -437,26 +543,27 @@
#ifdef RD_MPX_TNM_INTEGRATION
// Create Thumbnail Manager instance. This object is the observer.
iTNManager = CThumbnailManager::NewL( *this );
+ iRenameTN = EFalse;
#endif //RD_MPX_TNM_INTEGRATION
}
// ---------------------------------------------------------------------------
-// CMPXDbAbstractAlbum::ThumbnailReady
+// CMPXDbAbstractAlbum::ThumbnailReady
// Callback but not used here
// ---------------------------------------------------------------------------
-void CMPXDbAbstractAlbum::ThumbnailPreviewReady(
+void CMPXDbAbstractAlbum::ThumbnailPreviewReady(
MThumbnailData& /*aThumbnail*/, TThumbnailRequestId /*aId*/ )
{
}
-
+
// ---------------------------------------------------------------------------
// CMPXDbAbstractAlbum::ThumbnailReady
// Callback but not used here
// ---------------------------------------------------------------------------
-void CMPXDbAbstractAlbum::ThumbnailReady( TInt /*aError*/,
+void CMPXDbAbstractAlbum::ThumbnailReady( TInt /*aError*/,
MThumbnailData& /*aThumbnail*/, TThumbnailRequestId /*aId*/ )
{
}
--- a/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbalbum.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbalbum.cpp Fri May 14 15:49:53 2010 +0300
@@ -116,14 +116,14 @@
TBool aCaseSensitive)
{
MPX_FUNC("CMPXDbAlbum::AddItemL");
-
+
// try to find the item first
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);
@@ -142,9 +142,9 @@
query = PreProcessStringLC(KQueryCategoryItem);
RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, rowId));
CleanupStack::PopAndDestroy(query);
-
+
CleanupClosePushL(recordset);
-
+
if (recordset.Next() != KSqlAtRow)
{
User::Leave(KErrNotFound);
@@ -152,22 +152,22 @@
// Artist
TUint32 artistId = recordset.ColumnInt64(EAlbumArtist);
-
+
// the current one is Unknown and the new one is Not Unknown.
if ( IsUnknownArtistL( artistId ) && !IsUnknownArtistL( aArtist ) )
{
_LIT( KFormatArtistId, "Artist=%d" );
HBufC* setStr = HBufC::NewLC(KFormatArtistId().Length() + KMCIntegerLen);
setStr->Des().Format( KFormatArtistId, aArtist );
-
+
iDbManager.ExecuteQueryL(aDriveId, KQueryAlbumUpdate, setStr, rowId);
- CleanupStack::PopAndDestroy(setStr);
+ CleanupStack::PopAndDestroy(setStr);
}
-
+
// 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 && aArt != KNullDesC )
{
@@ -181,9 +181,9 @@
CleanupStack::PopAndDestroy(setStr);
CleanupStack::PopAndDestroy(artReplaceSingleQuote);
}
-
+
CleanupStack::PopAndDestroy(&recordset);
-
+
// increment the number of songs for the category
query = PreProcessStringLC(KQueryCategoryIncrementSongCount);
iDbManager.ExecuteQueryL(aDriveId, *query, rowId);
@@ -223,43 +223,45 @@
else
{
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);
}
TUint32 artistId = recordset.ColumnInt64(EAlbumArtist);
-
+
CleanupStack::PopAndDestroy(&recordset);
-
+
// the current artist is equal to deleted song's artist
if ( artistId == aArtist )
{
TUint32 newArtistId = ArtistForAlbumL(aId);
-
- _LIT( KFormatArtistId, "Artist=%d" );
- HBufC* setStr = HBufC::NewLC(KFormatArtistId().Length() + KMCIntegerLen);
- setStr->Des().Format(KFormatArtistId, newArtistId);
-
- iDbManager.ExecuteQueryL(aDriveId, KQueryAlbumUpdate, setStr, aId);
- CleanupStack::PopAndDestroy(setStr);
-
- if (aItemChangedMessages)
+ if ( artistId != newArtistId )
{
- // add the item changed message
- MPXDbCommonUtil::AddItemAlbumChangedMessageL(*aItemChangedMessages, aId, EMPXItemModified,
- EMPXAlbum, KDBPluginUid, ETrue, 0 );
+ _LIT( KFormatArtistId, "Artist=%d" );
+ HBufC* setStr = HBufC::NewLC(KFormatArtistId().Length() + KMCIntegerLen);
+ setStr->Des().Format(KFormatArtistId, newArtistId);
+
+ iDbManager.ExecuteQueryL(aDriveId, KQueryAlbumUpdate, setStr, aId);
+ CleanupStack::PopAndDestroy(setStr);
+
+ if (aItemChangedMessages)
+ {
+ // add the item changed message
+ MPXDbCommonUtil::AddItemAlbumChangedMessageL(*aItemChangedMessages, aId, EMPXItemModified,
+ EMPXAlbum, KDBPluginUid, ETrue, 0 );
+ }
}
}
-
+
// decrement the number of songs for the category
query = PreProcessStringLC(KQueryCategoryDecrementSongCount);
iDbManager.ExecuteQueryL(aDriveId, *query, aId);
@@ -291,9 +293,9 @@
// ----------------------------------------------------------------------------
//
void CMPXDbAlbum::UpdateItemL(
- TUint32 aId,
- const CMPXMedia& aMedia,
- TInt aDriveId,
+ TUint32 aId,
+ const CMPXMedia& aMedia,
+ TInt aDriveId,
CMPXMessageArray* aItemChangedMessages)
{
MPX_FUNC("CMPXDbAlbum::UpdateItemL");
@@ -333,7 +335,7 @@
TInt prevId(0);
TInt count(0);
TInt err(KErrNone);
-
+
while ((err = recordset.Next()) == KSqlAtRow)
{
TUint32 rowId(recordset.ColumnInt64(EAlbumUniqueId));
@@ -341,7 +343,7 @@
{
continue;
}
-
+
count++;
prevId = rowId;
}
@@ -362,7 +364,7 @@
TInt CMPXDbAlbum::GetSongsCountInAlbumMatchingArtistL(TUint32 aArtistId, TUint32 aAlbumId)
{
MPX_FUNC("CMPXDbAlbum::GetSongsCountInAlbumMatchingArtistL");
-
+
return ExecuteSumQueryL(KQuerySongsInArtistAlbum, aArtistId, aAlbumId);
}
@@ -388,14 +390,14 @@
if (attributeId & EMPXMediaGeneralId)
{
MPX_DEBUG1(" EMPXMediaGeneralId");
-
+
aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId,
aRecord.ColumnInt64(EAlbumUniqueId));
}
if (attributeId & EMPXMediaGeneralTitle)
{
MPX_DEBUG1(" EMPXMediaGeneralTitle");
-
+
TPtrC album( MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName) );
aMedia.SetTextValueL(KMPXMediaGeneralTitle,
MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName));
@@ -414,17 +416,17 @@
else if ( contentId == KMPXMediaIdMusic )
{
if (attributeId & EMPXMediaMusicArtist)
- {
+ {
MPX_DEBUG1(" EMPXMediaMusicArtist");
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);
}
@@ -451,13 +453,13 @@
MPX_DEBUG1(" EMPXMediaMusicAlbumArtFileName");
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);
}
@@ -479,13 +481,13 @@
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);
TUint32 artistId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXArtist,
artistName, ETrue);
- MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArtist, artistId);
+ MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArtist, artistId);
}
}
--- a/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbartist.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbartist.cpp Fri May 14 15:49:53 2010 +0300
@@ -86,7 +86,7 @@
CMPXDbManager& aDbManager,
TMPXGeneralCategory aCategory,
MMPXDbArtistObserver& aObserver) :
- CMPXDbCategory(aDbManager, aCategory),
+ CMPXDbCategory(aDbManager, aCategory),
iObserver(aObserver)
{
MPX_FUNC("CMPXDbArtist::CMPXDbArtist");
@@ -122,7 +122,7 @@
aNewRecord = !CategoryItemExistsL(aDriveId, rowId);
if (aNewRecord)
- {
+ {
// insert new
HBufC* query = PreProcessStringLC(KQueryArtistInsert);
HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(aName);
@@ -141,18 +141,18 @@
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 && aArt != KNullDesC )
{
@@ -166,9 +166,9 @@
CleanupStack::PopAndDestroy(setStr);
CleanupStack::PopAndDestroy(artReplaceSingleQuote);
}
-
+
CleanupStack::PopAndDestroy(&recordset);
-
+
// increment the number of songs for the category
query = PreProcessStringLC(KQueryCategoryIncrementSongCount);
iDbManager.ExecuteQueryL(aDriveId, *query, rowId);
@@ -185,16 +185,16 @@
TBool CMPXDbArtist::IsUnknownArtistL(TUint32 aId)
{
MPX_FUNC("CMPXDbArtist::IsUnknownArtistL");
-
+
HBufC* name = GetNameL(aId);
-
+
TInt ret = EFalse;
if (*name == KNullDesC)
{
ret = ETrue;
}
delete name;
-
+
return ret;
}
@@ -220,7 +220,7 @@
if (attributeId & EMPXMediaGeneralId)
{
MPX_DEBUG1(" EMPXMediaGeneralId");
-
+
aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId,
aRecord.ColumnInt64(EArtistUniqueId));
MPX_DEBUG2(" Id[%d]", aRecord.ColumnInt64(EArtistUniqueId));
@@ -228,7 +228,7 @@
if (attributeId & EMPXMediaGeneralTitle)
{
MPX_DEBUG1(" EMPXMediaGeneralTitle");
-
+
TPtrC artist( MPXDbCommonUtil::GetColumnTextL(aRecord, EArtistName) );
aMedia.SetTextValueL(KMPXMediaGeneralTitle,
MPXDbCommonUtil::GetColumnTextL(aRecord, EArtistName));
@@ -245,7 +245,7 @@
TInt songCount = GetSongsCountL( KDbManagerAllDrives,
aRecord.ColumnInt64( EArtistUniqueId ) );
aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount, songCount); // mod by anjokela
-
+
MPX_DEBUG1(" EMPXMediaGeneralCount");
MPX_DEBUG2(" SongCount[%d]", songCount);
}
@@ -255,7 +255,7 @@
if (attributeId & EMPXMediaMusicAlbumArtFileName)
{
MPX_DEBUG1(" EMPXMediaMusicAlbumArtFileName");
- TPtrC art(KNullDesC);
+ TPtrC art(KNullDesC);
art.Set(MPXDbCommonUtil::GetColumnTextL(aRecord, EArtistArt));
aMedia.SetTextValueL(KMPXMediaMusicAlbumArtFileName, art);
MPX_DEBUG2(" Art[%S]", &art);
@@ -279,7 +279,7 @@
MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArt, albumArtFilename);
}
}
-
+
// ----------------------------------------------------------------------------
// CMPXDbArtist::GetAlbumsCountL
// ----------------------------------------------------------------------------
@@ -287,14 +287,14 @@
TInt CMPXDbArtist::GetAlbumsCountL(TUint32 aId)
{
MPX_FUNC("CMPXDbArtist::GetAlbumsCountL");
-
+
return iObserver.HandleGetAlbumsCountForArtistL(aId);
}
-
+
// ----------------------------------------------------------------------------
// CMPXDbArtist::GetAllCategoryItemsL
// ----------------------------------------------------------------------------
-//
+//
void CMPXDbArtist::GetAllCategoryItemsL(
const TArray<TMPXAttribute>& aAttrs,
CMPXMediaArray& aMediaArray)
@@ -313,9 +313,9 @@
// ----------------------------------------------------------------------------
//
void CMPXDbArtist::UpdateItemL(
- TUint32 aId,
- const CMPXMedia& aMedia,
- TInt aDriveId,
+ TUint32 aId,
+ const CMPXMedia& aMedia,
+ TInt aDriveId,
CMPXMessageArray* aItemChangedMessages)
{
MPX_FUNC("CMPXDbAlbum::UpdateItemL");
--- a/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbautoplaylist.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbautoplaylist.cpp Fri May 14 15:49:53 2010 +0300
@@ -301,7 +301,7 @@
MPX_FUNC("CMPXDbAutoPlaylist::GetPlaylistDetails");
HBufC* query = NULL;
-
+
switch ( aType )
{
case EMPXMostPlayedPlaylist:
@@ -320,7 +320,7 @@
User::Leave(KErrArgument);
break;
}
-
+
RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query));
CleanupClosePushL(recordset);
@@ -331,10 +331,10 @@
aCount++;
sum += recordset.ColumnInt64(KMPXTableDefaultIndex);
}
-
+
CleanupStack::PopAndDestroy(&recordset);
CleanupStack::PopAndDestroy(query);
-
+
if (err != KSqlAtEnd)
{
User::Leave(KErrCorrupt);
--- a/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbcategory.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbcategory.cpp Fri May 14 15:49:53 2010 +0300
@@ -189,7 +189,7 @@
else if (criterion == KMPXMediaGeneralTitle)
{
#ifdef RD_MPX_COLLECTION_CACHE
-
+
if (aCriteria.ValueText(KMPXMediaGeneralTitle).Length() <= 0)
{
TUint32 itemId = MPXDbCommonUtil::GenerateUniqueIdL(
@@ -212,14 +212,19 @@
#endif //RD_MPX_COLLECTION_CACHE
}
#ifdef ABSTRACTAUDIOALBUM_INCLUDED
- else if (criterion == KMPXMediaGeneralUri)
- {
- TUint32 itemId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), iCategory,
- aCriteria.ValueText(KMPXMediaGeneralUri), (iCategory != EMPXGenre)));
- HBufC* critStr = PreProcessStringLC(KCriterionCategoryUniqueId);
- MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, *critStr, itemId);
- CleanupStack::PopAndDestroy(critStr);
- }
+ else if (criterion == KMPXMediaGeneralUri)
+ {
+ //only Genre and AbstractAlbum are not case sensitive
+ TBool caseSensitive = ETrue;
+ if ((iCategory == EMPXGenre) || (iCategory == EMPXAbstractAlbum))
+ caseSensitive = EFalse;
+
+ TUint32 itemId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), iCategory,
+ aCriteria.ValueText(KMPXMediaGeneralUri), caseSensitive));
+ HBufC* critStr = PreProcessStringLC(KCriterionCategoryUniqueId);
+ MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, *critStr, itemId);
+ CleanupStack::PopAndDestroy(critStr);
+ }
else if (criterion == KMPXMediaGeneralDrive)
{
const TDesC& drive(aCriteria.ValueText(KMPXMediaGeneralDrive));
@@ -257,8 +262,12 @@
const TUint32 aId,
TInt aDriveId,
CMPXMessageArray* aItemChangedMessages,
- TBool& aItemExist,
- TBool /*aMTPInUse*/)
+ TBool& aItemExist
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+ ,
+ TBool /*aMTPInUse*/
+#endif //ABSTRACTAUDIOALBUM_INCLUDED
+)
{
MPX_FUNC("CMPXDbCategory::DecrementSongsForCategoryL");
@@ -472,9 +481,9 @@
}
void CMPXDbCategory::UpdateItemL(
- TUint32 /*aId*/,
- const CMPXMedia& /*aMedia*/,
- TInt /*aDriveId*/,
+ TUint32 /*aId*/,
+ const CMPXMedia& /*aMedia*/,
+ TInt /*aDriveId*/,
CMPXMessageArray* /*aItemChangedMessages*/)
{
// nothing
--- a/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbcomposer.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbcomposer.cpp Fri May 14 15:49:53 2010 +0300
@@ -21,6 +21,8 @@
#include <mpxlog.h>
#include "mpxdbcomposer.h"
+// CONSTANTS
+
// ============================ MEMBER FUNCTIONS ==============================
// ----------------------------------------------------------------------------
--- a/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbgenre.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbgenre.cpp Fri May 14 15:49:53 2010 +0300
@@ -21,6 +21,8 @@
#include <mpxlog.h>
#include "mpxdbgenre.h"
+// CONSTANTS
+
// ============================ MEMBER FUNCTIONS ==============================
// ----------------------------------------------------------------------------
--- a/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbhandler.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbhandler.cpp Fri May 14 15:49:53 2010 +0300
@@ -154,10 +154,10 @@
iExtensions = iResource.ReadDesCArrayL(R_MC_MUSIC_FILE_EXTENSIONS);
iExtensionsMime = iResource.ReadDesCArrayL(R_MC_FILE_EXTENSIONS_MIME);
iExtensionsDrm = iResource.ReadDesCArrayL(R_MC_FILE_EXTENSIONS_DRM);
-
+
// make sure all databases are created and valid
iDbManager = CMPXCollectionDbManager::NewL(iFs);
-
+
CDesCArrayFlat* musicFolders =
#ifdef RD_MULTIPLE_DRIVE
GetMusicFoldersL();
@@ -170,22 +170,21 @@
ProcessMusicFoldersL(*musicFolders);
CleanupStack::PopAndDestroy(musicFolders);
- // Create the db infrastructure,
+ // Create the db infrastructure,
//
iDbMusic = CMPXDbMusic::NewL(*iDbManager, iResource, *this);
iDbPlaylist = CMPXDbPlaylist::NewL(*iDbManager, *this);
iDbArtist = CMPXDbArtist::NewL(*iDbManager, EMPXArtist, *this);
- iDbAlbum = CMPXDbAlbum::NewL(*iDbManager, EMPXAlbum, *this);
+ iDbAlbum = CMPXDbAlbum::NewL(*iDbManager, EMPXAlbum, *this);
iDbGenre = CMPXDbGenre::NewL(*iDbManager, EMPXGenre);
iDbComposer = CMPXDbComposer::NewL(*iDbManager, EMPXComposer);
-#ifdef ABSTRACTAUDIOALBUM_INCLUDED
- iDbAbstractAlbum = CMPXDbAbstractAlbum::NewL(*iDbManager, EMPXAbstractAlbum);
-#endif // ABSTRACTAUDIOALBUM_INCLUDED
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+ iDbAbstractAlbum = CMPXDbAbstractAlbum::NewL(*iDbManager, EMPXAbstractAlbum, iFs);
+#endif // ABSTRACTAUDIOALBUM_INCLUDED
iAutoPlaylist = CMPXDbAutoPlaylist::NewL(*iDbManager, iFs, iResource);
iDbAuxiliary = CMPXDbAuxiliary::NewL(*iDbManager);
MPX_TRAPD(err, iDbManager->InitDatabasesL(iDbDrives));
- iCollectionOpen = ETrue;
// If KErrCorrupt is returned, a database file was found to be corrupted
// and was replaced with a new one. The db plugin can ignore this error and continue
@@ -316,24 +315,22 @@
MPX_FUNC("CMPXDbHandler::AddAbstractAlbumL");
BeginTransactionL();
- // TUint32 abstractAlbumId(0);
TBool newRecord(EFalse);
TInt err(KErrNone);
TDriveUnit drive(aMedia.ValueText(KMPXMediaGeneralUri));
- TPtrC name(aMedia.ValueText(KMPXMediaGeneralUri).Left(KMCMaxTextLen));
+ TPtrC uri(aMedia.ValueText(KMPXMediaGeneralUri).Left(KMCMaxTextLen));
+ TPtrC name(aMedia.ValueText(KMPXMediaGeneralTitle).Left(KMCMaxTextLen));
TPtrC albumartist(aMedia.ValueText(KMPXMediaMusicAlbumArtist).Left(KMCMaxTextLen));
- TPtrC genre(aMedia.ValueText(KMPXMediaMusicGenre).Left(KMCMaxTextLen));
-
- //only insert to AbstractAlbum table when it is new item
- TUint32 abstractAlbumId(MPXDbCommonUtil::GenerateUniqueIdL(iFs, EMPXAbstractAlbum, name, (EMPXAbstractAlbum!=EMPXGenre)));
-
+
+ //only insert to AbstractAlbum table when it is new item
+ TUint32 abstractAlbumId(MPXDbCommonUtil::GenerateUniqueIdL(iFs, EMPXAbstractAlbum, uri, EFalse));
+
newRecord = !iDbAbstractAlbum->CategoryItemExistsL(drive, abstractAlbumId);
-
-
- if (newRecord)
+
+ if (newRecord)
{
- MPX_TRAP(err, abstractAlbumId = iDbAbstractAlbum->AddItemL( name, albumartist, genre, drive, newRecord, (EMPXAbstractAlbum != EMPXGenre)));
+ MPX_TRAP(err, abstractAlbumId = iDbAbstractAlbum->AddItemL(uri, name, albumartist, drive, newRecord, EFalse));
if (iOutOfDisk && (err == KErrNotFound))
{
err = KErrDiskFull;
@@ -346,57 +343,134 @@
}
EndTransactionL(err);
- return abstractAlbumId;
+ return abstractAlbumId;
}
// ----------------------------------------------------------------------------
-// Update all songs which associate with AbstractAlbum in the collection
+// Update abstractalbum info to AbstractAlbum table and all songs which associate
+// with AbstractAlbum in the collection
// ----------------------------------------------------------------------------
//
-CMPXDbActiveTask::TChangeVisibility CMPXDbHandler::UpdateAbstractAlbumSongsL(
+CMPXDbActiveTask::TChangeVisibility CMPXDbHandler::UpdateAbstractAlbumL(
const CMPXMedia& aMedia,
CMPXMessageArray& aItemChangedMessages)
{
- MPX_FUNC("CMPXDbHandler::UpdateAbstractAlbumSongsL");
+ MPX_FUNC("CMPXDbHandler::UpdateAbstractAlbumL");
CMPXDbActiveTask::TChangeVisibility visibleChange(CMPXDbActiveTask::ENotVisibile);
-
+ TUint32 itemId(0);
if (aMedia.IsSupported(KMPXMediaGeneralUri))
{
- const TDesC& art(aMedia.ValueText (KMPXMediaGeneralUri));
-
- TBool existRecord(EFalse);
+ const TDesC& uri(aMedia.ValueText (KMPXMediaGeneralUri));
TDriveUnit drive(aMedia.ValueText(KMPXMediaGeneralUri));
- TUint32 rowId(MPXDbCommonUtil::GenerateUniqueIdL(iFs, EMPXAbstractAlbum, art, (EMPXAbstractAlbum != EMPXGenre)));
- //check if abstractAlbum in ABSTRACTALBUM table before update songs
- existRecord = iDbAbstractAlbum->CategoryItemExistsL(drive, rowId);
-
- //update songs associated with abstractalbum only when abstractalbum associated already
- //in the AbstractAlbum table
- if (existRecord)
- {
- if (aMedia.IsSupported(KMPXMediaArrayContents))
+
+ //get Id based on new uri
+ itemId = MPXDbCommonUtil::GenerateUniqueIdL(iFs, EMPXAbstractAlbum, uri, EFalse);
+ if (!itemId)
+ {
+ User::Leave(KErrNotSupported);
+ }
+
+ //if updating to new item, need do renaming for AbstractAlbum: delete old one and insert a new entry to AbstractAlbum table
+ //if a new item, need update songs associated and renaming albstractalbum table
+ if (aMedia.IsSupported(KMPXMediaGeneralId))
+ {
+ MPX_DEBUG1("CMPXDbHandler::UpdateAbstractAlbumL, rename case");
+
+ BeginTransactionL();
+ //get old id, for renaming
+ TInt err(KErrNone);
+ TUint32 oldId = (aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+ if (oldId && (oldId != itemId) ) //pass the old UID for renaming, do not care if new itemId exist or not
{
-
- CMPXMediaArray* mediaArray = aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents);
- User::LeaveIfNull(mediaArray);
+ //get old Uri based on old Id
+ HBufC* oldUri = iDbAbstractAlbum->GetUriL(oldId);
+ CleanupStack::PushL(oldUri);
+
+ //add and update new item to AbstractAlbum table
+ //old existing item field values need to be saved and added when adding new item
+ MPX_TRAP(err, itemId = iDbAbstractAlbum->AddUpdatedItemL(oldId, uri ));
+
+ if (iOutOfDisk && (err == KErrNotFound))
+ {
+ err = KErrDiskFull;
+ }
+
+ MPXDbCommonUtil::AddItemChangedMessageL(aItemChangedMessages, itemId, EMPXItemInserted,
+ EMPXAbstractAlbum, KDBPluginUid);
+
+ //find and update all songs associated with oldId
+ RArray<TMPXAttribute> songAttributes;
+ CleanupClosePushL(songAttributes);
+ songAttributes.AppendL(KMPXMediaGeneralId);
+
+ CMPXMediaArray* mediaArray = CMPXMediaArray::NewL();
+ CleanupStack::PushL(mediaArray);
+
+ //get all songs associated
+ MPX_TRAP(err, iDbMusic->GetAllSongsForAbstractAlbumL(oldId, songAttributes.Array(), *mediaArray));
+ if (err == KErrNotFound)
+ {
+ // Leave with KErrNotFound
+ MPX_DEBUG1("CMPXDbHandler::UpdateAbstractAlbumL, leave with not found");
+ User::Leave(KErrNotFound);
+ }
+
TInt count(mediaArray->Count());
+ MPX_DEBUG2("CMPXDbHandler::UpdateAbstractAlbumL, [%d] songs associated", count);
+ //go through all songs for updating
for (TInt i = 0; i < count; i++)
{
- CMPXMedia* element = mediaArray->AtL(i);
- element->SetTextValueL(KMPXMediaMusicAlbumArtFileName, art );
- visibleChange = UpdateSongL(*element, aItemChangedMessages);
+ CMPXMedia* song = mediaArray->AtL(i);
+ song->SetTextValueL(KMPXMediaMusicAlbumArtFileName, uri );
+ visibleChange = UpdateSongL(*song, aItemChangedMessages);
}
- }
- else
- {
- iDbAbstractAlbum->UpdateItemL(rowId, aMedia, drive, &aItemChangedMessages);
+ CleanupStack::PopAndDestroy(mediaArray);
+ CleanupStack::PopAndDestroy(&songAttributes);
+
+ //rename TN
+ iDbAbstractAlbum->HandleTNL(*oldUri, uri, 0);
+ CleanupStack::PopAndDestroy(oldUri);
}
- }
+ EndTransactionL(err);
+ }//renaming
+
+ //check if abstractAlbum exist in ABSTRACTALBUM table before update it
+ else if (iDbAbstractAlbum->CategoryItemExistsL(drive, itemId))
+ {
+ //support updating Name, AlbumArtist fields for AbstractAlbum table
+ iDbAbstractAlbum->UpdateItemL(itemId, aMedia, drive, &aItemChangedMessages);
+ }
}
return visibleChange;
-}
+ }
+
+// ----------------------------------------------------------------------------
+// Update all songs which associate with AbstractAlbum to new AbstractAlbum info
+// in the collection
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXDbHandler::UpdateSongsAbstractAlbumInfoL(
+ const CMPXMedia& aMedia,
+ CMPXMessageArray& aItemChangedMessages)
+ {
+ MPX_FUNC("CMPXDbHandler::UpdateSongsAbstractAlbumInfoL");
+ const TDesC& uri(aMedia.ValueText (KMPXMediaGeneralUri));
+ //need to update songs information to music table
+ CMPXMediaArray* mediaArray = aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents);
+ User::LeaveIfNull(mediaArray);
+ TInt count(mediaArray->Count());
+ CMPXDbActiveTask::TChangeVisibility visibleChange(CMPXDbActiveTask::ENotVisibile);
+ for (TInt i = 0; i < count; i++)
+ {
+ CMPXMedia* mediaSong = mediaArray->AtL(i);
+ mediaSong->SetTextValueL(KMPXMediaMusicAlbumArtFileName, uri );
+ visibleChange = UpdateSongL(*mediaSong, aItemChangedMessages);
+ }
+ return visibleChange;
+ }
#endif // ABSTRACTAUDIOALBUM_INCLUDED
+
// ----------------------------------------------------------------------------
// Update a song in the collection
// ----------------------------------------------------------------------------
@@ -590,40 +664,10 @@
//
void CMPXDbHandler::RemoveAbstractAlbumL(
TUint32 aAbstractAlbumId,
- CDesCArray& aUriArray,
- CMPXMessageArray& aItemChangedMessages)
+ CMPXMessageArray& aItemChangedMessages, TBool aFileDeleted)
{
MPX_FUNC("CMPXDbHandler::RemoveAbstractAlbumL");
-
- BeginTransactionL();
- MPX_TRAPD(err, DoRemoveAbstractAlbumL(aAbstractAlbumId, aUriArray, aItemChangedMessages));
- EndTransactionL(err);
- }
-
-// ----------------------------------------------------------------------------
-// Remove specified abstractalbum
-// ----------------------------------------------------------------------------
-//
-void CMPXDbHandler::DoRemoveAbstractAlbumL(
- TUint32 aAbstractAlbumId,
- CDesCArray& aUriArray,
- CMPXMessageArray& aItemChangedMessages)
- {
- MPX_FUNC("CMPXDbHandler::DoRemoveAbstractAlbumL");
-
-
- HBufC* uri(iDbAbstractAlbum->DeleteAbstractAlbumL(aAbstractAlbumId));
- if (uri)
- {
- CleanupStack::PushL(uri);
- aUriArray.AppendL(*uri);
- CleanupStack::PopAndDestroy(uri);
- }
-
- MPXDbCommonUtil::AddItemChangedMessageL(aItemChangedMessages, aAbstractAlbumId, EMPXItemDeleted,
- EMPXAbstractAlbum, KDBPluginUid);
-
-
+ iDbAbstractAlbum->RemoveAbstractAlbumL(aAbstractAlbumId, aItemChangedMessages, aFileDeleted);
}
#endif // ABSTRACTAUDIOALBUM_INCLUDED
@@ -890,7 +934,7 @@
const TDesC& aUri)
{
MPX_FUNC("CMPXDbHandler::GetAbstractAlbumIdMatchingUriL");
- return MPXDbCommonUtil::GenerateUniqueIdL(iFs, EMPXAbstractAlbum, aUri, ETrue);
+ return MPXDbCommonUtil::GenerateUniqueIdL(iFs, EMPXAbstractAlbum, aUri, EFalse);
}
#endif // ABSTRACTAUDIOALBUM_INCLUDED
@@ -930,7 +974,7 @@
MPX_FUNC("CMPXDbHandler::GetAlbumsMatchingArtistL");
RArray<TMPXAttribute> attributes;
CleanupClosePushL( attributes );
-
+
TBool tryGetSongCount = EFalse;
TInt attrCount(aAttrs.Count());
TInt i = 0;
@@ -948,17 +992,17 @@
tryGetSongCount = ETrue;
break;
}
-
+
attributes.Append(aAttrs[i]);
}
-
+
for (TInt j = i+1; j < attrCount; j++)
{
attributes.Append(aAttrs[j]);
}
iDbAlbum->GetSubCategoryItemsL(EMPXArtist, aArtistId, attributes.Array(), aMediaArray);
CleanupStack::PopAndDestroy(&attributes);
-
+
TInt pPath(0);
if (aMediaArray.Count())
{
@@ -969,20 +1013,20 @@
MPX_ASSERT(pPath);
}
}
-
+
TInt albumCount(aMediaArray.Count());
if (albumCount)
{
if ( tryGetSongCount )
{
TInt startIndex = pPath ? 1 : 0;
-
+
for (TInt i = startIndex; i < albumCount; i++)
{
CMPXMedia* media = aMediaArray[i];
TUint32 albumId((media->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)));
- TInt songCount = iDbAlbum->GetSongsCountInAlbumMatchingArtistL(aArtistId, albumId);
+ TInt songCount = iDbAlbum->GetSongsCountInAlbumMatchingArtistL(aArtistId, albumId);
media->SetTObjectValueL<TInt>(KMPXMediaGeneralCount, songCount );
MPX_DEBUG2(" SongCount[%d]", songCount );
@@ -1487,14 +1531,6 @@
// This is needed for the case where we were OOD before, but user
// has cleared some space but now try to refresh
MPX_TRAPD(err, iDbManager->InitDatabasesL(iDbDrives));
- iCollectionOpen = ETrue;
- // Update (synchronize) music basic table if it's not
- // in sync with music table
- if(iSynchronizeBasicTable)
- {
- iDbMusic->RefreshEndL();
- }
- iSynchronizeBasicTable = ETrue;
if(err == KErrDiskFull)
{
@@ -1510,11 +1546,9 @@
iOutOfDisk = ETrue;
}
}
-
#ifdef __RAMDISK_PERF_ENABLE
- iDbManager->CopyDBsToRamL();
+ iDbManager->CopyDBsToRamL();
#endif //__RAMDISK_PERF_ENABLE
- iDbMusic->RefreshStartL();
BeginTransactionL();
iRefresh = ETrue;
@@ -1537,14 +1571,13 @@
curTime.HomeTime();
SetLastRefreshedTimeL(curTime);
}
- iDbMusic->RefreshEndL();
- //Update of music basic table fails when the collection is not open
- //Next time the collection is opened the music basic table must be updated
- if (iCollectionOpen )
- {
- iSynchronizeBasicTable = EFalse;
- }
-
+
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+ //for AbstractAlbum garbage collection
+ //can not leave
+ TRAP_IGNORE( AbstractAlbumCleanUpL() );
+#endif
+
#ifdef __RAMDISK_PERF_ENABLE
iDbManager->CopyDBsFromRamL();
#endif //__RAMDISK_PERF_ENABLE
@@ -1585,15 +1618,24 @@
iMtpInUse = EFalse;
iOpOnDbCount = 0;
iDbManager->CommitL();
+ TInt err = KErrNone;
+
#ifdef __RAMDISK_PERF_ENABLE
- TRAPD(err, iDbManager->CopyDBsFromRamL());
+ TRAP(err, iDbManager->CopyDBsFromRamL());
if ( err != KErrNone )
{
MPX_DEBUG2("CMPXDbHandler::MtpEndL error=%d", err);
}
#endif //__RAMDISK_PERF_ENABLE
-
+
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+ TRAP(err, RemoveAbstractAlbumsWithNoSongL());
+ if ( err != KErrNone )
+ {
+ MPX_DEBUG2("CMPXDbHandler::MtpEndL error happened when cleanup albstractalbum with no songs association[%d]", err);
+ }
+#endif
MPX_DEBUG1("<--CMPXDbHandler::MtpEndL");
}
@@ -1709,14 +1751,14 @@
iDbManager->RollbackL();
User::Leave(aError);
}
-
+
if(iOpOnDbCount >= KMaxOpInTransaction)
{
MPX_DEBUG2("CMPXDbHandler::EndTransactionL - %d>KMaxOpInTransaction Commiting",iOpOnDbCount);
iOpOnDbCount = 0;
iDbManager->CommitL();
iDbManager->BeginL();
- }
+ }
}
else
{
@@ -1725,7 +1767,7 @@
MPX_DEBUG2("CMPXDbHandler::EndTransactionL - Rollback [%d]", aError);
iDbManager->RollbackL();
-
+
// KSqlDbCorrupted indicates DB corrupted, need to recreate.
if ( aError != KSqlDbCorrupted )
{
@@ -1775,35 +1817,6 @@
}
// ----------------------------------------------------------------------------
-// Notifies the handler that the collection was closed.
-// ----------------------------------------------------------------------------
-//
-void CMPXDbHandler::CollectionClosed()
- {
- MPX_FUNC("CMPXDbHandler::CollectionClosed");
-
- iCollectionOpen = EFalse;
- }
-
-// ----------------------------------------------------------------------------
-//Notifies the handler that the collection was opened.
-// ----------------------------------------------------------------------------
-//
-void CMPXDbHandler::CollectionOpenedL()
- {
- MPX_FUNC("CMPXDbHandler::CollectionOpened");
-
- iCollectionOpen = ETrue;
- // Update (synchronize) music basic table if it's not
- // in sync with music table
- if(iSynchronizeBasicTable)
- {
- iDbMusic->RefreshEndL();
- iSynchronizeBasicTable = EFalse;
- }
- }
-
-// ----------------------------------------------------------------------------
// Add song to collection
// ----------------------------------------------------------------------------
//
@@ -1826,7 +1839,7 @@
// update the playlist tables
// make sure the song db flags are reset and not just updated
iDbPlaylist->UpdateSongL(aMedia, ETrue);
-
+
if(iMtpInUse)
{
++iOpOnDbCount;
@@ -2166,7 +2179,7 @@
// add the item changed message
MPXDbCommonUtil::AddItemChangedMessageL(aItemChangedMessages, aSongId, EMPXItemDeleted,
EMPXSong, KDBPluginUid);
-
+
if(iMtpInUse)
{
@@ -2349,6 +2362,84 @@
MPXDbCommonUtil::AddItemChangedMessageL(aItemChangedMessages, aSongId, EMPXItemDeleted,
EMPXSong, KDBPluginUid);
}
+
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+// ----------------------------------------------------------------------------
+// Remove abstractalbums which have no songs associated.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::RemoveAbstractAlbumsWithNoSongL()
+ {
+ MPX_FUNC("CMPXDbHandler::RemoveAbstractAlbumsWithNoSongL");
+
+ BeginTransactionL();
+ RArray<TUint32> iItemsIds;
+ CleanupClosePushL(iItemsIds);
+ //get all abstractalbum with no songs associated.
+ iDbAbstractAlbum->GetAllItemsWithNoSongL(iItemsIds);
+ TInt count = iItemsIds.Count();
+ TInt err = KErrNone;
+ if (count)
+ {
+ MPX_DEBUG2("CMPXDbHandler::RemoveAbstractAlbumsWithNoSongL, abstractalbum count[%d] ", iItemsIds.Count());
+ CMPXMessageArray* itemChangedMessages = CMPXMediaArray::NewL();
+ CleanupStack::PushL(itemChangedMessages);
+
+ //go through each one to delete
+ for (TInt i=0; i< count; i++)
+ {
+ TRAP(err, RemoveAbstractAlbumL(iItemsIds[i], *itemChangedMessages, EFalse));
+ if (err != KErrNone)
+ {
+ MPX_DEBUG2("CMPXDbHandler::RemoveAbstractAlbumsWithNoSongL, error happens when delete abstractalbum, err ", err);
+ }
+ }
+ CleanupStack::PopAndDestroy(itemChangedMessages);
+ }
+ CleanupStack::PopAndDestroy(&iItemsIds);
+ EndTransactionL(err);
+ }
+
+// ----------------------------------------------------------------------------
+// Remove .alb entry from AbstractAlnum table, TN table if .alb files deleted
+// from file manager when refresh library
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::AbstractAlbumCleanUpL()
+ {
+ MPX_FUNC("CMPXDbHandler::AbstractAlbumCleanUpL");
+ RArray<TMPXAttribute> attributes;
+ CleanupClosePushL(attributes);
+ attributes.AppendL(KMPXMediaGeneralUri);
+ CMPXMediaArray* mediaArray = CMPXMediaArray::NewL();
+ CleanupStack::PushL(mediaArray);
+
+ iDbAbstractAlbum->GetAllCategoryItemsL(attributes.Array(), *mediaArray);
+
+ TInt count(mediaArray->Count());
+ if (count)
+ {
+ CMPXMessageArray* itemChangedMessages = CMPXMediaArray::NewL();
+ CleanupStack::PushL(itemChangedMessages);
+ for (TInt i = 0; i < count; i++)
+ {
+ CMPXMedia* element = mediaArray->AtL(i);
+ const TDesC& uri = element->ValueText(KMPXMediaGeneralUri);
+
+ //check if the file exists in file system
+ if (!(BaflUtils::FileExists(iFs, uri)))
+ {
+ //generate abstractalbum UID with the Uri
+ TUint32 abstractAlbumId(MPXDbCommonUtil::GenerateUniqueIdL(iFs, EMPXAbstractAlbum, uri, EFalse));
+ RemoveAbstractAlbumL(abstractAlbumId, *itemChangedMessages, ETrue);
+ }
+ }
+ CleanupStack::PopAndDestroy(itemChangedMessages);
+ }
+ CleanupStack::PopAndDestroy(mediaArray);
+ CleanupStack::PopAndDestroy(&attributes);
+ }
+#endif //ABSTRACTAUDIOALBUM_INCLUDED
// ----------------------------------------------------------------------------
// CMPXDbHandler::DoCleanupDeletedRecordsL
@@ -2472,8 +2563,7 @@
TInt attrCount(aAttrs.Count());
if ( attrCount > 1 || (attrCount == 1 && !(aAttrs[0] == KMPXMediaGeneralId)) )
{
- TInt abstractAlbumDrive(iDbAbstractAlbum->GetDriveIdL(abstractAlbumId));
- MPX_TRAPD(err, iDbMusic->GetAllSongsForAbstractAlbumL(abstractAlbumDrive, abstractAlbumId, aAttrs, aMediaArray));
+ MPX_TRAPD(err, iDbMusic->GetAllSongsForAbstractAlbumL( abstractAlbumId, aAttrs, aMediaArray));
if (err == KErrNotFound)
{
//
@@ -3034,9 +3124,9 @@
TInt aDriveId,
CMPXMessageArray* aItemChangedMessages,
TBool& aItemExist
-#ifdef ABSTRACTAUDIOALBUM_INCLUDED
- ,const TDesC& aAlbumArtist,
- const TDesC& aGenre
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+ ,const TDesC& aUri
+ ,const TDesC& aAlbumArtist
#endif // ABSTRACTAUDIOALBUM_INCLUDED
)
{
@@ -3045,21 +3135,28 @@
MPX_PERF_START(CMPXDbHandler_AddCategoryItemL);
TBool newRecord(EFalse);
-#ifdef ABSTRACTAUDIOALBUM_INCLUDED
- TUint32 id(0);
+#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( aName, aAlbumArtist, aGenre, aDriveId, newRecord, (aCategory != EMPXGenre));
- }
+ {
+ id = iDbAbstractAlbum->AddItemL(aUri, aName, aAlbumArtist, aDriveId, newRecord, caseSensitive);
+ }
else
{
- id = DbCategoryL(aCategory)->AddItemL(aName, aDriveId, newRecord, (aCategory != EMPXGenre));
-#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,
@@ -3069,7 +3166,7 @@
// and it is NOT a new record,
// we should send the item number changed message
else if ( ( aCategory == EMPXGenre || aCategory == EMPXComposer ) &&
- !newRecord && aItemChangedMessages )
+ !newRecord && aItemChangedMessages )
{
MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, id, EMPXItemModified,
aCategory, KDBPluginUid);
@@ -3079,7 +3176,6 @@
}
#endif // ABSTRACTAUDIOALBUM_INCLUDED
MPX_PERF_END(CMPXDbHandler_AddCategoryItemL);
-
return id;
}
@@ -3107,7 +3203,7 @@
{
id = iDbArtist->AddItemL(aName, aArt, aDriveId, newRecord, (aCategory != EMPXGenre));
}
-
+
if (newRecord && aItemChangedMessages)
{
MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, id, EMPXItemInserted,
@@ -3125,30 +3221,30 @@
MPX_PERF_END(CMPXDbHandler_AddCategoryItemL);
return id;
- }
+ }
void CMPXDbHandler::UpdateCategoryItemL(
- TMPXGeneralCategory aCategory,
- TUint32 aCategoryId,
- const CMPXMedia& aMedia,
- TInt aDrive,
- CMPXMessageArray* aItemChangedMessages)
- {
- switch(aCategory)
- {
- case EMPXAlbum:
+ TMPXGeneralCategory aCategory,
+ TUint32 aCategoryId,
+ const CMPXMedia& aMedia,
+ TInt aDrive,
+ CMPXMessageArray* aItemChangedMessages)
+ {
+ switch(aCategory)
+ {
+ case EMPXAlbum:
iDbAlbum->UpdateItemL(aCategoryId, aMedia, aDrive, aItemChangedMessages);
- break;
-
- case EMPXArtist:
- iDbArtist->UpdateItemL(aCategoryId, aMedia, aDrive, aItemChangedMessages);
- break;
-
- default:
+ break;
+
+ case EMPXArtist:
+ iDbArtist->UpdateItemL(aCategoryId, aMedia, aDrive, aItemChangedMessages);
+ break;
+
+ default:
DbCategoryL(aCategory)->UpdateItemL(aCategoryId, aMedia, aDrive, aItemChangedMessages);
- break;
- }
- }
+ break;
+ }
+ }
// ----------------------------------------------------------------------------
// CMPXDbHandler::DeleteSongForCategoryL
// ----------------------------------------------------------------------------
@@ -3250,9 +3346,9 @@
}
TInt CMPXDbHandler::HandleGetAlbumsCountForArtistL(TUint32 aArtistId)
- {
- return iDbAlbum->GetAlbumsCountForArtistL(aArtistId);
- }
+ {
+ return iDbAlbum->GetAlbumsCountForArtistL(aArtistId);
+ }
TBool CMPXDbHandler::HandleIsUnknownArtistL(TUint32 aArtistId)
{
@@ -3267,10 +3363,10 @@
// ----------------------------------------------------------------------------------------------------------
// CMPXDbHandler::HandleGetAlbumNameForSongL
// ----------------------------------------------------------------------------------------------------------
-//
+//
HBufC* CMPXDbHandler::HandleGetAlbumNameFromIdL(TUint32 aId)
{
- return iDbAbstractAlbum->GetNameL(aId);
+ return iDbAbstractAlbum->GetUriL(aId);
}
#endif // ABSTRACTAUDIOALBUM_INCLUDED
// End of file
--- a/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbmusic.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbmusic.cpp Fri May 14 15:49:53 2010 +0300
@@ -110,6 +110,9 @@
MMPXDbMusicObserver& aObserver) :
CMPXDbTable(aDbManager),
iObserver(aObserver)
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+ ,iArtNeedUpdated(ETrue)
+#endif
{
MPX_FUNC("CMPXDbMusic::CMPXDbMusic");
}
@@ -148,7 +151,7 @@
}
// add the song
DoAddSongL(songId, aMedia, aDrive, aMessageArray);
-
+
return songId;
}
@@ -238,7 +241,7 @@
oldSongId = (aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
if ( oldSongId <= 0 )
{
- oldSongId = aSongId;
+ oldSongId = aSongId;
}
RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetSong, oldSongId));
CleanupClosePushL(recordset);
@@ -253,20 +256,27 @@
visible = DoUpdateSongL(aSongId, aMedia, driveUnit, aItemChangedMessages,
recordset);
- // Update Album table
- 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) )
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+ if(iArtNeedUpdated)
{
- TUint32 artistId = recordset.ColumnInt64(EMusicArtist);
- iObserver.UpdateCategoryItemL(EMPXArtist, artistId, aMedia, driveUnit, aItemChangedMessages);
+#endif // ABSTRACTAUDIOALBUM_INCLUDED
+ // Update Album table
+ 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) )
+ {
+ TUint32 artistId = recordset.ColumnInt64(EMusicArtist);
+ iObserver.UpdateCategoryItemL(EMPXArtist, artistId, aMedia, driveUnit, aItemChangedMessages);
+ }
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
}
-
+ iArtNeedUpdated = ETrue; //reset flag
+#endif // ABSTRACTAUDIOALBUM_INCLUDED
CleanupStack::PopAndDestroy(&recordset);
}
@@ -295,7 +305,7 @@
oldSongId = (aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
if ( oldSongId <= 0 )
{
- oldSongId = aSongId;
+ oldSongId = aSongId;
}
// process the media parameter and construct the fields and values array
CMPXDbActiveTask::TChangeVisibility visible(GenerateMusicFieldsValuesL(oldSongId, aMedia, aItemChangedMessages,
@@ -665,11 +675,11 @@
// CMPXDbMusic::GetAllSongsLimitedL
// ----------------------------------------------------------------------------
//
-void CMPXDbMusic::GetAllSongsLimitedL(const TArray<TMPXAttribute>& aAttrs,
+void CMPXDbMusic::GetAllSongsLimitedL(const TArray<TMPXAttribute>& aAttrs,
CMPXMediaArray& aMediaArray, TInt aLimit)
{
MPX_FUNC("CMPXDbMusic::GetAllSongsLimitedL");
-
+
// Gets a subset of the data from all songs ordered by title
HBufC* query = HBufC::NewLC( KQueryMusicGetSongsLimited().Length() + KMCIntegerLen );
query->Des().Format( KQueryMusicGetSongsLimited, aLimit );
@@ -684,8 +694,8 @@
void CMPXDbMusic::GetSongsInBlockL(
const TArray<TMPXAttribute>& aAttrs,
CMPXMediaArray& aMediaArray,
- TPtrC aTitle,
- TUint aNumOfSongs,
+ TPtrC aTitle,
+ TUint aNumOfSongs,
TBool aAsc)
{
MPX_FUNC("CMPXDbMusic::GetSongsInBlockL");
@@ -812,13 +822,12 @@
// ----------------------------------------------------------------------------
//
void CMPXDbMusic::GetAllSongsForAbstractAlbumL(
- TInt aDrive,
- TInt aAbstractAlbumId,
+ TUint aAbstractAlbumId,
const TArray<TMPXAttribute>& aAttrs,
CMPXMediaArray& aMediaArray)
{
- MPX_FUNC("CMPXDbMusic::GetAllSongsL");
- ExecuteMediaQueryL(aDrive, aAttrs, aMediaArray, KQueryMusicGetSongsForAbstractAlbum(), aAbstractAlbumId);
+ MPX_FUNC("CMPXDbMusic::GetAllSongsForAbstractAlbumL");
+ ExecuteMediaQueryL(aAttrs, aMediaArray, KQueryMusicGetSongsForAbstractAlbum(), aAbstractAlbumId);
}
#endif // ABSTRACTAUDIOALBUM_INCLUDED
@@ -969,7 +978,7 @@
TUint CMPXDbMusic::GetDriveTrackCountL(TInt aDrive)
{
TUint count(0);
-
+
RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aDrive,KQueryMusicCount));
CleanupClosePushL(recordset);
@@ -980,7 +989,7 @@
count = TUint(recordset.ColumnInt64(KMPXTableDefaultIndex));
CleanupStack::PopAndDestroy(&recordset);
-
+
return count;
}
@@ -992,7 +1001,7 @@
CDesCArray& aUriArr, TInt& aLastID)
{
MPX_FUNC("CMPXDbMusic::GetMusicUriArrayL");
-
+
HBufC* query = NULL;
if(aFromID == 0)
{
@@ -1006,11 +1015,11 @@
}
RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aDrive,*query));
-
+
CleanupStack::PopAndDestroy(query);
-
+
CleanupClosePushL(recordset);
-
+
TInt lastID = 0;
TInt err(KErrNone);
while((err = recordset.Next()) == KSqlAtRow)
@@ -1040,37 +1049,17 @@
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;
- }
+ TUint32 artistId = recordset.ColumnInt64(KMPXTableDefaultIndex);
+ CleanupStack::PopAndDestroy(&recordset);
-// ----------------------------------------------------------------------------
-// CMPXDbMusic::RefreshStartL
-// ----------------------------------------------------------------------------
-//
-void CMPXDbMusic::RefreshStartL()
- {
- iRefresh = ETrue;
- MPX_FUNC("CMPXDbMusic::RefreshStartL");
- }
-
-// ----------------------------------------------------------------------------
-// CMPXDbMusic::RefreshEndL
-// ----------------------------------------------------------------------------
-//
-void CMPXDbMusic::RefreshEndL()
- {
- MPX_FUNC("CMPXDbMusic::RefreshEndL");
- iRefresh = EFalse;
+ return artistId;
}
// ----------------------------------------------------------------------------
@@ -1161,15 +1150,23 @@
MPX_DEBUG1(" !aMedia.IsSupported(KMPXMediaGeneralId)");
TUint32 songId(aMusicTable.ColumnInt64(EMusicUniqueId));
TInt columnCount(aMusicTable.ColumnCount());
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+ if(columnCount == 40 && aMusicTable.ColumnIndex(_L("PlUId"))==38)
+ {
+ TUint32 pListUId(aMusicTable.ColumnInt64(38));
+ aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, TMPXItemId(pListUId, songId));
+ }
+#else
if(columnCount == 37 && aMusicTable.ColumnIndex(_L("PlUId"))==35)
{
TUint32 pListUId(aMusicTable.ColumnInt64(35));
aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, TMPXItemId(pListUId, songId));
- }
+ }
+#endif
else
- {
- aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, songId);
- }
+ {
+ aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, songId);
+ }
MPX_DEBUG2(" SongId[%d]", songId);
}
// FIX ME temporary always fetch URI
@@ -1184,7 +1181,7 @@
}
if (aAttrId & EMPXMediaGeneralDrive)
{
- MPX_DEBUG1(" EMPXMediaGeneralDrive");
+ MPX_DEBUG1(" EMPXMediaGeneralDrive");
TDriveUnit driveUnit;
if (aMedia.IsSupported(KMPXMediaGeneralUri))
{
@@ -1194,10 +1191,10 @@
}
else
{
- MPX_DEBUG1(" !aMedia.IsSupported(KMPXMediaGeneralUri)");
+ MPX_DEBUG1(" !aMedia.IsSupported(KMPXMediaGeneralUri)");
driveUnit = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
aMusicTable.ColumnInt64(EMusicVolumeId));
- MPX_DEBUG2(" driveUnit=%d", (TInt)driveUnit);
+ MPX_DEBUG2(" driveUnit=%d", (TInt)driveUnit);
}
TPtrC driveName(driveUnit.Name());
@@ -1206,12 +1203,12 @@
}
if (aAttrId & EMPXMediaGeneralSize)
{
- MPX_DEBUG1(" EMPXMediaGeneralSize");
+ MPX_DEBUG1(" EMPXMediaGeneralSize");
// to-do: store this in the DB
}
if (aAttrId & EMPXMediaGeneralDuration)
{
- MPX_DEBUG1(" EMPXMediaGeneralDuration");
+ MPX_DEBUG1(" EMPXMediaGeneralDuration");
TInt32 duration(aMusicTable.ColumnInt(EMusicDuration));
aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralDuration, duration);
MPX_DEBUG2(" Duration[%d]", duration);
@@ -1224,42 +1221,42 @@
MPX_DEBUG2(" Title[%S]", &title);
}
if ( aAttrId & EMPXMediaGeneralDate)
- {
- MPX_DEBUG1(" EMPXMediaGeneralDate");
- const TDesC& dateStr(MPXDbCommonUtil::GetColumnTextL (aMusicTable,
- EMusicTimeAdded));
- if ( dateStr.Compare (KNullDesC)!= 0)
- {
- TTime dateTime(MPXDbCommonUtil::DesToTTimeL (dateStr));
- aMedia.SetTObjectValueL<TInt64> (KMPXMediaGeneralDate,
- dateTime.Int64 ());
- }
- MPX_DEBUG2(" Date[%S]", &dateStr);
- }
+ {
+ MPX_DEBUG1(" EMPXMediaGeneralDate");
+ const TDesC& dateStr(MPXDbCommonUtil::GetColumnTextL (aMusicTable,
+ EMusicTimeAdded));
+ if ( dateStr.Compare (KNullDesC)!= 0)
+ {
+ TTime dateTime(MPXDbCommonUtil::DesToTTimeL (dateStr));
+ aMedia.SetTObjectValueL<TInt64> (KMPXMediaGeneralDate,
+ dateTime.Int64 ());
+ }
+ MPX_DEBUG2(" Date[%S]", &dateStr);
+ }
if (aAttrId & EMPXMediaGeneralComment)
{
- MPX_DEBUG1(" EMPXMediaGeneralComment");
+ MPX_DEBUG1(" EMPXMediaGeneralComment");
TPtrC comment(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicComment));
aMedia.SetTextValueL(KMPXMediaGeneralComment, comment);
MPX_DEBUG2(" Comment[%S]", &comment);
}
if (aAttrId & EMPXMediaGeneralMimeType)
{
- MPX_DEBUG1(" EMPXMediaGeneralMimeType");
+ MPX_DEBUG1(" EMPXMediaGeneralMimeType");
TPtrC mimeType(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicMimeType));
aMedia.SetTextValueL(KMPXMediaGeneralMimeType, mimeType);
MPX_DEBUG2(" MimeType[%S]", &mimeType);
}
if (aAttrId & EMPXMediaGeneralSynchronized)
{
- MPX_DEBUG1(" EMPXMediaGeneralSynchronized");
+ MPX_DEBUG1(" EMPXMediaGeneralSynchronized");
TInt sync(aMusicTable.ColumnInt(EMusicSync));
aMedia.SetTObjectValueL<TBool>(KMPXMediaGeneralSynchronized, sync);
MPX_DEBUG2(" Synchronized[%d]", sync);
}
if (aAttrId & EMPXMediaGeneralDeleted)
{
- MPX_DEBUG1(" EMPXMediaGeneralDeleted");
+ MPX_DEBUG1(" EMPXMediaGeneralDeleted");
TInt del(aMusicTable.ColumnInt(EMusicDeleted));
aMedia.SetTObjectValueL<TBool>(KMPXMediaGeneralDeleted, del);
MPX_DEBUG2(" Deleted[%d]", del);
@@ -1278,20 +1275,20 @@
}
if (aAttrId & EMPXMediaGeneralCollectionId)
{
- MPX_DEBUG1(" EMPXMediaGeneralCollectionId");
+ MPX_DEBUG1(" EMPXMediaGeneralCollectionId");
aMedia.SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId,
TUid::Uid(KDBPluginUid));
}
if(aAttrId & EMPXMediaGeneralCopyright)
{
- MPX_DEBUG1(" EMPXMediaGeneralCopyright");
+ MPX_DEBUG1(" EMPXMediaGeneralCopyright");
TPtrC copyright(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicCopyright));
aMedia.SetTextValueL(KMPXMediaGeneralCopyright, copyright);
MPX_DEBUG2(" Copyright[%S]", ©right);
}
if (aAttrId & EMPXMediaGeneralFlags)
{
- MPX_DEBUG1(" EMPXMediaGeneralFlags");
+ MPX_DEBUG1(" EMPXMediaGeneralFlags");
TUint32 dbFlags(aMusicTable.ColumnInt64(EMusicDbFlag));
MPX_DEBUG2(" dbFlags=%b", dbFlags);
TDriveUnit driveUnit;
@@ -1306,16 +1303,16 @@
else
{
driveUnit = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
- aMusicTable.ColumnInt64(EMusicVolumeId));
+ aMusicTable.ColumnInt64(EMusicVolumeId));
}
MPX_DEBUG2(" driveUnit=%d", (TInt)driveUnit);
}
else
{
- MPX_DEBUG1(" !aMedia.IsSupported(KMPXMediaGeneralUri)");
+ MPX_DEBUG1(" !aMedia.IsSupported(KMPXMediaGeneralUri)");
driveUnit = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
aMusicTable.ColumnInt64(EMusicVolumeId));
- MPX_DEBUG2(" driveUnit=%d", (TInt)driveUnit);
+ MPX_DEBUG2(" driveUnit=%d", (TInt)driveUnit);
}
TInt driveId = driveUnit & KMPXMediaGeneralFlagsDriveInfo; // 5 bits
@@ -1326,12 +1323,12 @@
}
if (aAttrId & EMPXMediaGeneralPlayCount)
{
- MPX_DEBUG1(" EMPXMediaGeneralPlayCount");
+ MPX_DEBUG1(" EMPXMediaGeneralPlayCount");
TUint32 playcount(aMusicTable.ColumnInt(EMusicPlayCount));
aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralPlayCount, playcount);
MPX_DEBUG2(" PlayCount[%d]", playcount);
}
-
+
MPX_DEBUG1("<--CMPXDbMusic::UpdateMediaGeneralL");
}
@@ -1365,18 +1362,18 @@
MPX_DEBUG2(" Album[%S]", &album);
}
if ( aAttrId & EMPXMediaMusicYear)
- {
- const TDesC& dateStr(MPXDbCommonUtil::GetColumnTextL (aMusicTable,
- EMusicReleaseDate));
- if ( dateStr.Compare (KNullDesC)!= 0)
- {
- TTime dateTime(MPXDbCommonUtil::DesToTTimeL (dateStr));
- aMedia.SetTObjectValueL<TInt64> (KMPXMediaMusicYear,
- dateTime.Int64 ());
- MPX_DEBUG2(" Year[%d]", dateTime.Int64());
- }
- MPX_DEBUG2(" ReleaseDate[%S]", &dateStr);
- }
+ {
+ const TDesC& dateStr(MPXDbCommonUtil::GetColumnTextL (aMusicTable,
+ EMusicReleaseDate));
+ if ( dateStr.Compare (KNullDesC)!= 0)
+ {
+ TTime dateTime(MPXDbCommonUtil::DesToTTimeL (dateStr));
+ aMedia.SetTObjectValueL<TInt64> (KMPXMediaMusicYear,
+ dateTime.Int64 ());
+ MPX_DEBUG2(" Year[%d]", dateTime.Int64());
+ }
+ MPX_DEBUG2(" ReleaseDate[%S]", &dateStr);
+ }
if (aAttrId & EMPXMediaMusicAlbumTrack)
{
TInt32 track(aMusicTable.ColumnInt(EMusicAlbumTrack));
@@ -1456,13 +1453,19 @@
}
}
#ifdef ABSTRACTAUDIOALBUM_INCLUDED
- if (aAttrId & EMPXMediaMusicAlbumArtist)
+ if (aAttrId & EMPXMediaMusicAlbumArtist)
{
TPtrC albumartist(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicAlbumArtist));
aMedia.SetTextValueL(KMPXMediaMusicAlbumArtist, albumartist);
MPX_DEBUG2(" Music AlbumArtist[%S]", &albumartist);
}
#endif // ABSTRACTAUDIOALBUM_INCLUDED
+ if (aAttrId & EMPXMediaMusicAlbumId)
+ {
+ TUint32 albumId(aMusicTable.ColumnInt64(EMusicAlbum));
+ aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaMusicAlbumId, albumId);
+ MPX_DEBUG2(" AlbumId[%d]", albumId);
+ }
}
// ----------------------------------------------------------------------------
@@ -1546,7 +1549,7 @@
songChangedMessage = CMPXMedia::NewL();
CleanupStack::PushL(songChangedMessage);
MPXDbCommonUtil::FillItemChangedMessageL(*songChangedMessage, aSongId,
- aMusicTable ? EMPXItemModified : EMPXItemInserted, EMPXSong, KDBPluginUid);
+ aMusicTable ? EMPXItemModified : EMPXItemInserted, EMPXSong, KDBPluginUid);
}
// NOTE: Attributes being processed here should be listed in IsSupported()
@@ -1577,7 +1580,7 @@
{
curFlag = aMusicTable->ColumnInt64(EMusicDbFlag);
}
- TUint32 oldFlag(curFlag);
+ TUint32 oldFlag(curFlag);
if (flag & KMPXMediaGeneralFlagsSetOrUnsetBit)
{
@@ -1717,10 +1720,10 @@
if (aItemChangedMessages)
{
iObserver.HandlePlayCountModifiedL(*aItemChangedMessages);
- }
+ }
addSongChangedMessage = EFalse;
}
-
+
MPX_DEBUG2(" PlayCount[%d]", curCount);
}
@@ -1737,7 +1740,7 @@
if (aItemChangedMessages)
{
iObserver.HandlePlaybackTimeModifiedL(*aItemChangedMessages);
- }
+ }
addSongChangedMessage = EFalse;
}
MPX_DEBUG2(" PlaybackTime[%S]", time);
@@ -1876,6 +1879,12 @@
#ifdef ABSTRACTAUDIOALBUM_INCLUDED
TParsePtrC parse(albumArtFilename);
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) && containEmbeddedArt)
+ {
+ iArtNeedUpdated = EFalse;
+ }
if ( ((ext.CompareF(KAbstractAlbumExt)== 0) && !containEmbeddedArt) || (ext.CompareF(KAbstractAlbumExt)!= 0))
{
@@ -1968,18 +1977,18 @@
}
MPX_DEBUG2(" DRM type[%d]", drmType);
}
-
+
if (attributeId & KMPXMediaDrmRightsStatus.iAttributeId)
{
if (aMusicTable)
{
- TMPXMediaDrmRightsStatus status =
+ TMPXMediaDrmRightsStatus status =
aMedia.ValueTObjectL<TMPXMediaDrmRightsStatus>(KMPXMediaDrmRightsStatus);
-
+
//.Set the db flag
TUint32 curFlag(aMusicTable->ColumnInt64(EMusicDbFlag));
TUint32 oldFlag(curFlag);
-
+
if ((status != EMPXDrmRightsFull) && (status != EMPXDrmRightsRestricted))
{
// No rights
@@ -1990,18 +1999,18 @@
// Rights valid
curFlag &= (KMPXMediaGeneralFlagsIsDrmLicenceInvalid ^ 0xFFFFFFFF);
}
-
+
// The field is written ONLY if the flag value is changing
if (((curFlag ^ oldFlag) & 0x7FFFFFFF) != 0)
{
MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicDbFlag, curFlag);
visibleChange = CMPXDbActiveTask::EAllVisible;
}
-
+
MPX_DEBUG2(" Rights Status[%d]", curFlag);
}
}
-
+
break;
}
@@ -2024,7 +2033,7 @@
} // end switch
} // end for
- // get the current artist/album/genre/composer
+ // get the current artist/album/genre/composer/abstractalbum
// this is required because the recordset may be reused by the code below
TUint32 artistId(0);
TUint32 albumId(0);
@@ -2057,26 +2066,26 @@
}
// update the album field
- if (UpdateCategoryFieldL(EMPXAlbum, aMedia, KMPXMediaMusicAlbum, albumId,
- aDrive, aItemChangedMessages, id, artistIdForAlbum))
+ if (UpdateCategoryFieldL(EMPXAlbum, aMedia, KMPXMediaMusicAlbum, albumId,
+ aDrive, aItemChangedMessages, id, artistIdForAlbum))
{
MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicAlbum, id);
metaDataModified = (aMusicTable != NULL);
visibleChange = CMPXDbActiveTask::EAllVisible;
-
+
//
// added to handle error EALU-73WDJN. If the album name of the last song
// in the album for the artist is changed to an existing album name from
// artist view, a change message needs to be sent in order for UI to
// correctly refresh.
//
- // Fix for EDXU-7BBALS, remove check for HasOtherSongsInArtistAlbumL
+ // Fix for EDXU-7BBALS, remove check for HasOtherSongsInArtistAlbumL
// Always send a Album Inserted message when Album change to get Artist updated
if (aItemChangedMessages)
{
// send album added m essage instead of album deleted or modified
// to avoid collection paths of other clients being modified
- MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, albumId,
+ MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, albumId,
EMPXItemInserted, EMPXAlbum, KDBPluginUid);
}
}
@@ -2136,7 +2145,7 @@
}
CleanupStack::PopAndDestroy(songChangedMessage);
}
-
+
return visibleChange;
}
@@ -2262,7 +2271,7 @@
const TDesC& uri = aCriteria.ValueText(KMPXMediaGeneralUri);
TUint32 itemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXCollection,
uri, EFalse);
-
+
MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionMusicUniqueId, itemId);
}
else if (criterion == KMPXMediaGeneralDrive)
@@ -2271,7 +2280,13 @@
{
// validate the drive letter, TDriveUnit panics if given drive isn't between
// 'A' to 'Z'
- TDriveUnit driveUnit(aCriteria.ValueText(KMPXMediaGeneralDrive));
+ const TDesC& drive = aCriteria.ValueText(KMPXMediaGeneralDrive);
+ TInt driveInt = 0;
+ if( drive == KNullDesC || RFs::CharToDrive( drive[0], driveInt )!= KErrNone )
+ {
+ User::Leave(KErrArgument);
+ }
+ TDriveUnit driveUnit(drive);
MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionMusicVolume,
MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), driveUnit));
volumeAdded = ETrue;
@@ -2390,17 +2405,28 @@
TInt changeMsgCount( 0 );
if( aItemChangedMessages )
{
- changeMsgCount = aItemChangedMessages->Count();
+ changeMsgCount = aItemChangedMessages->Count();
}
-
+
if (aMedia.IsSupported(aAttribute))
{
TPtrC name(aMedia.ValueText(aAttribute).Left(KMCMaxTextLen));
// construct the new ID for the category record
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+ // genre and abstractalbum are not case sensitive
+ TBool caseSensitive = ETrue;
+ if ((aCategory == EMPXGenre) || (aCategory == EMPXAbstractAlbum))
+ caseSensitive = EFalse;
+
+ aItemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), aCategory,
+ name, caseSensitive);
+
+#else
// only genre is not case sensitive
aItemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), aCategory,
name, (aCategory != EMPXGenre));
+#endif
if (!aOldId || (aOldId != aItemId))
{
// only add if the ID changed,
@@ -2410,20 +2436,28 @@
{
if (aMedia.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory) == EMPXSong )
{
- iObserver.AddCategoryItemL(aCategory, name, aDriveId,
- aItemChangedMessages, itemAdded, KNullDesC, KNullDesC);
+ iObserver.AddCategoryItemL(aCategory, KNullDesC, aDriveId,
+ aItemChangedMessages, itemAdded, name, KNullDesC);
}
else
- {
- TPtrC albumartist(aMedia.ValueText(KMPXMediaMusicAlbumArtist).Left(KMCMaxTextLen));
- //get AlbumArt, Genre for AbstractAlbum
- MPX_DEBUG2(" Music albumartist[%S]", &albumartist);
- TPtrC genre(aMedia.ValueText(KMPXMediaMusicGenre).Left(KMCMaxTextLen));
- MPX_DEBUG2(" Music Genre[%S]", &genre);
-
- // ignore the return value
- iObserver.AddCategoryItemL(aCategory, name, aDriveId,
- aItemChangedMessages, itemAdded, albumartist, genre);
+ {
+ TPtrC albumartist(KNullDesC);
+ TPtrC abstractAlbumName(KNullDesC);
+ if (aMedia.IsSupported(KMPXMediaMusicAlbumArtist) )
+ {
+ 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.AddCategoryItemL(aCategory, abstractAlbumName, aDriveId,
+ aItemChangedMessages, itemAdded, name, albumartist);
}
}
else
@@ -2438,24 +2472,29 @@
}
else
{
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+ // genre and abstractalbum are not case sensitive
+ aItemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), aCategory, KNullDesC,
+ (aCategory != EMPXGenre)&&(aCategory != EMPXAbstractAlbum));
+#else
// only genre is not case sensitive
aItemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), aCategory, KNullDesC,
(aCategory != EMPXGenre));
+#endif
if (!aOldId || (aOldId != aItemId))
{
#ifdef ABSTRACTAUDIOALBUM_INCLUDED
if(aCategory == EMPXAbstractAlbum)
- {
- //get AlbumArt, Genre for AbstractAlbum
+ {
+ //get AlbumArt for AbstractAlbum
TPtrC albumartist(aMedia.ValueText(KMPXMediaMusicAlbumArtist).Left(KMCMaxTextLen));
- MPX_DEBUG2(" Music albumartist[%S]", &albumartist);
- TPtrC genre(aMedia.ValueText(KMPXMediaMusicGenre).Left(KMCMaxTextLen));
- MPX_DEBUG2(" Music Genre[%S]", &genre);
-
+ MPX_DEBUG2(" Music albumartist[%S]", &albumartist);
+ TPtrC abstractAlbumName(aMedia.ValueText(KMPXMediaGeneralTitle).Left(KMCMaxTextLen));
+ MPX_DEBUG2(" Music abstractAlbumName[%S]", &abstractAlbumName);
// ignore the return value
- iObserver.AddCategoryItemL(aCategory, KNullDesC, aDriveId,
- aItemChangedMessages, itemAdded, albumartist, genre);
- }
+ iObserver.AddCategoryItemL(aCategory, abstractAlbumName, aDriveId,
+ aItemChangedMessages, itemAdded, KNullDesC, albumartist);
+ }
else
#endif // ABSTRACTAUDIOALBUM_INCLUDED
{
@@ -2466,18 +2505,14 @@
updated = ETrue;
}
}
-#ifdef ABSTRACTAUDIOALBUM_INCLUDED
- //no need to delete old item for abstractalbum
- if (aOldId && (aOldId != aItemId) && (aCategory != EMPXAbstractAlbum))
-#else
- if (aOldId && (aOldId != aItemId))
-#endif // ABSTRACTAUDIOALBUM_INCLUDED
+
+ if (aOldId && (aOldId != aItemId))
{
- iObserver.DeleteSongForCategoryL(aCategory, aOldId, aDriveId,
+ iObserver.DeleteSongForCategoryL(aCategory, aOldId, aDriveId,
aItemChangedMessages, itemNotRemoved);
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
@@ -2493,10 +2528,10 @@
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 )
@@ -2508,8 +2543,8 @@
newId = i;
}
}
-
- if( oldId != KErrNotFound &&
+
+ if( oldId != KErrNotFound &&
newId != KErrNotFound )
{
aItemChangedMessages->Remove(oldId); // category removed
@@ -2541,7 +2576,7 @@
TUint32 aOldId,
TInt aDriveId,
CMPXMessageArray* aItemChangedMessages,
- TUint32& aItemId,
+ TUint32& aItemId,
TUint32 aArtistId)
{
TBool updated(EFalse);
@@ -2554,9 +2589,9 @@
TInt changeMsgCount( 0 );
if( aItemChangedMessages )
{
- changeMsgCount = aItemChangedMessages->Count();
+ changeMsgCount = aItemChangedMessages->Count();
}
-
+
if (aMedia.IsSupported(aAttribute))
{
TPtrC name(aMedia.ValueText(aAttribute).Left(KMCMaxTextLen));
@@ -2569,13 +2604,13 @@
{
// only add if the ID changed,
// otherwise the song was updated but the artist name was not
- TPtrC art(KNullDesC);
- if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName))
- {
- art.Set(aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen));
- }
+ TPtrC art(KNullDesC);
+ if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName))
+ {
+ art.Set(aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen));
+ }
- iObserver.AddCategoryItemL(aCategory, name, aArtistId, art, aDriveId, aItemChangedMessages, itemAdded);
+ iObserver.AddCategoryItemL(aCategory, name, aArtistId, art, aDriveId, aItemChangedMessages, itemAdded);
updated = ETrue;
}
}
@@ -2592,7 +2627,7 @@
art.Set(aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen));
}
- iObserver.AddCategoryItemL(aCategory, KNullDesC, aArtistId, art, aDriveId,
+ iObserver.AddCategoryItemL(aCategory, KNullDesC, aArtistId, art, aDriveId,
aItemChangedMessages, itemAdded);
updated = ETrue;
}
@@ -2600,11 +2635,11 @@
if (aOldId && (aOldId != aItemId))
{
- iObserver.DeleteSongForCategoryL(aCategory, aOldId, aDriveId,
+ iObserver.DeleteSongForCategoryL(aCategory, aOldId, aDriveId,
aItemChangedMessages, itemNotRemoved);
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
@@ -2620,10 +2655,10 @@
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 )
@@ -2635,8 +2670,8 @@
newId = i;
}
}
-
- if( oldId != KErrNotFound &&
+
+ if( oldId != KErrNotFound &&
newId != KErrNotFound )
{
aItemChangedMessages->Remove(oldId); // category removed
@@ -2676,7 +2711,7 @@
EMPXMediaGeneralTitle |
EMPXMediaGeneralUri |
EMPXMediaGeneralFlags);
-
+
TBool extraRequired(EFalse);
TInt count(aAttrs.Count());
for (TInt i = 0; i < count; ++i)
@@ -2705,7 +2740,7 @@
TBool CMPXDbMusic::IsSupported(
const CMPXMedia& aMedia)
{
- MPX_FUNC("CMPXDbMusic::IsSupported");
+ MPX_FUNC("CMPXDbMusic::IsSupported");
// this checklist should match the attributes processed in DoFillInDatabaseInfoL
return aMedia.IsSupported(KMPXMediaGeneralTitle) ||
--- a/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbplaylist.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbplaylist.cpp Fri May 14 15:49:53 2010 +0300
@@ -86,7 +86,7 @@
// ----------------------------------------------------------------------------
//
CMPXDbPlaylist::CMPXDbPlaylist(
- CMPXDbManager& aDbManager,
+ CMPXDbManager& aDbManager,
MMPXDbPlaylistObserver& aObserver) :
CMPXDbTable(aDbManager),
iObserver(aObserver)
@@ -794,10 +794,10 @@
MPXDbCommonUtil::GetColumnTextL(aRecord, EPlaylistTime)).Int64());
}
if ( attributeId & EMPXMediaGeneralDuration )
- {
+ {
// make sure the PlaylistSongs query is executed after all fields
// from the current record have been processed, otherwise the recordset
- // may point to something else
+ // may point to something else
durationRequested = ETrue;
}
--- a/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbplaylistsongs.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbplaylistsongs.cpp Fri May 14 15:49:53 2010 +0300
@@ -525,7 +525,7 @@
attributes.AppendL(KMPXMediaGeneralType);
attributes.AppendL(KMPXMediaGeneralCategory);
attributes.AppendL(KMPXMediaGeneralId);
-
+
// cannot execute a joined query to the music table
// because the song records in the music table may be on a different drive
ExecuteMediaQueryL(attributes.Array(), aMediaArray, KQueryPlaylistSongsGetSongs, aPlaylistId);
@@ -546,7 +546,7 @@
{
MPX_DEBUG2("-->CMPXDbPlaylistSongs::GetSongsL(playlist 0x%x)", aPlaylistId);
TBool valid(EFalse);
-
+
RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPlaylistSongsGetSongsInfo,
aPlaylistId));
CleanupClosePushL(recordset);
--- a/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbplugin.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbplugin.cpp Fri May 14 15:49:53 2010 +0300
@@ -153,6 +153,7 @@
iMusicMenuTitle = iResource->ReadHBufCL(R_MPX_QTN_MUS_TITLE_MUSIC_MENU);
#endif // __ENABLE_MUSIC_TEXT_ALIGNMENT
+
iActiveTask = CMPXDbActiveTask::NewL(*this);
CRepository* cenrep(NULL);
@@ -335,9 +336,11 @@
break;
}
case EMcCmdClose:
+ // called before destructing this plug-in: no actions required
+ break;
case EMcCloseCollection:
{
- MPX_DEBUG1("CMPXDbPlugin::CommandL - EMcCloseCollection");
+ MPX_DEBUG2("CMPXDbPlugin::CommandL - EMcCloseCollection %d", aArg);
// Close the specified database
TRAP_IGNORE(iDbHandler->PreCloseCollectionL());
#ifdef RD_MULTIPLE_DRIVE
@@ -350,7 +353,7 @@
for (TInt i=0; i<count; ++i)
{
MPX_DEBUG2("At drive %i", driveArray[i]);
- if (( driveArray[i] != EDriveC) && (!iDbHandler->IsRemoteDrive(static_cast<TDriveNumber>(driveArray[i]))))
+ if (( driveArray[i] != EDriveC) && (!iDbHandler->IsRemoteDrive(static_cast<TDriveNumber>(driveArray[i]))))
{
MPX_DEBUG2("Closing database %i", driveArray[i]);
TRAP_IGNORE( iDbHandler->CloseDatabaseL( driveArray[i] ) );
@@ -359,12 +362,11 @@
}
else
{
- iDbHandler->CloseDatabaseL(aArg);
+ TRAP_IGNORE( iDbHandler->CloseDatabaseL(aArg) ); //Closing can fail if physical media has been removed or forced disk dismount has occurred.
}
#else
iDbHandler->CloseDatabaseL(aArg);
#endif // RD_MULTIPLE_DRIVE
- iDbHandler->CollectionClosed();
break;
}
case EMcReOpenCollection:
@@ -379,7 +381,7 @@
for( TInt i=0; i<count; ++i )
{
MPX_DEBUG2("At drive %i", driveArray[i]);
- if( (driveArray[i] != EDriveC) && (!iDbHandler->IsRemoteDrive(static_cast<TDriveNumber>(driveArray[i]))))
+ if( (driveArray[i] != EDriveC) && (!iDbHandler->IsRemoteDrive(static_cast<TDriveNumber>(driveArray[i]))))
{
TUint driveStatus(0);
User::LeaveIfError( DriveInfo::GetDriveStatus(
@@ -394,7 +396,6 @@
#else
iDbHandler->OpenDatabaseL(aArg);
#endif // RD_MULTIPLE_DRIVE
- TRAP_IGNORE(iDbHandler->CollectionOpenedL());
break;
}
case EMcRefreshStarted:
@@ -438,12 +439,12 @@
case EMcCmdMtpStart:
iDbHandler->CheckDiskSpaceOnDrivesL();
iMtpInUse = ETrue;
- iDbHandler->MtpStartL();
+ iDbHandler->MtpStartL();
break;
case EMcCmdMtpEnd:
iDbHandler->CheckDiskSpaceOnDrivesL();
iMtpInUse = EFalse;
- iDbHandler->MtpEndL();
+ iDbHandler->MtpEndL();
break;
default:
{
@@ -785,7 +786,6 @@
CMPXMediaArray* array = CMPXMediaArray::NewL();
CleanupStack::PushL(array);
-// TInt count(0);
TInt levels(aPath.Levels());
TBool isASong(EFalse);
@@ -1146,9 +1146,9 @@
// Add "all" item under an artist
MPXDbCommonUtil::PrependMediaL(*aArray, *iAllSongsForArtistTitle, EMPXItem, EMPXAlbum,
aPath.Id(idIndex), 0, 0, 1);
-
+
(*aArray)[1]->SetTObjectValueL<TInt>(KMPXMediaGeneralCount, total);
-
+
TMPXItemId allId = ((*aArray)[1]->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
if (aArray->Count() > 2)
{ // path media, all id and at least one media
@@ -1398,6 +1398,7 @@
iDbHandler->GetSongsMatchingPlaylistL(aPath.Id (idIndex).iId2, aAttrs, aArray);
}
+
SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXPlaylist, aPath.Id(idIndex).iId2);
// populate EMPXMediaGeneralNonPermissibleActions
@@ -2589,11 +2590,11 @@
mediaId = iDbHandler->GetPlaylistIdMatchingUriL(uri);
iDbHandler->RemovePlaylistL(mediaId, *fp, *itemChangedMessages);
}
-#ifdef ABSTRACTAUDIOALBUM_INCLUDED
+#ifdef ABSTRACTAUDIOALBUM_INCLUDED
else if (category == EMPXAbstractAlbum )
{
mediaId = iDbHandler->GetAbstractAlbumIdMatchingUriL(uri);
- iDbHandler->RemoveAbstractAlbumL(mediaId, *fp, *itemChangedMessages);
+ iDbHandler->RemoveAbstractAlbumL(mediaId, *itemChangedMessages, EFalse);
}
#endif // ABSTRACTAUDIOALBUM_INCLUDED
else
@@ -3445,11 +3446,11 @@
CMPXMessageArray* changeMsgAry = CMPXMessageArray::NewL();
CleanupStack::PushL(changeMsgAry);
- // start a transaction here
- if (!iDbHandler->InTransaction())
- {
- iDbHandler->BeginTransactionL();
- }
+ // start a transaction here
+ if (!iDbHandler->InTransaction())
+ {
+ iDbHandler->BeginTransactionL();
+ }
// Group of items
if (aMedia.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType) == EMPXGroup)
@@ -3471,8 +3472,8 @@
itemId = DoAddItemL(aMedia, *changeMsgAry);
}
- // end transaction here.
- iDbHandler->EndTransactionL(KErrNone);
+ // end transaction here.
+ iDbHandler->EndTransactionL(KErrNone);
iActiveTask->SetVisibleChange(CMPXDbActiveTask::EAllVisible);
DoHandleChangeL(changeMsgAry);
@@ -3529,18 +3530,14 @@
case EMPXAbstractAlbum:
{
if (aMedia.IsSupported(KMPXMediaGeneralUri))
- {
-
+ {
+ //add abstractalbum to AbstractAlbum table
itemId = iDbHandler->AddAbstractAlbumL(aMedia, &aMessageArray);
-
+
+ //in case aMedia as mediaArray which contains songs as arrayContents, need to update all songs associated
if ( aMedia.IsSupported(KMPXMediaArrayContents))
{
- //need to update songs information to music table
- CMPXMediaArray* array = aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents);
- if (array->Count())
- {
- iDbHandler->UpdateAbstractAlbumSongsL(aMedia, aMessageArray);
- }
+ iDbHandler->UpdateSongsAbstractAlbumInfoL(aMedia, aMessageArray);
}
}
else
@@ -3553,7 +3550,7 @@
case EMPXSong:
{
// For the use case of adding thousands of songs at once,
- // we do not create a new database transaction for each song;
+ // we do not create a new database transaction for each song;
// Instead DoAddL() will batch 100 songs under a single transaction.
// This enhancement improves performance with MMC-based databases.
if (aBatchCommit)
@@ -3564,7 +3561,7 @@
{
itemId = iDbHandler->AddSongL(aMedia, &aMessageArray);
}
-
+
MPXDbCommonUtil::AddItemChangedMessageL(aMessageArray, itemId, EMPXItemInserted,
EMPXSong, KDBPluginUid);
}
@@ -3718,7 +3715,20 @@
#ifdef ABSTRACTAUDIOALBUM_INCLUDED
case EMPXAbstractAlbum:
{
- visibleChange = iDbHandler->UpdateAbstractAlbumSongsL(aMedia, aMessageArray);
+ //update all songes which associate with ABSTRACTALBUM
+ if (aMedia.IsSupported(KMPXMediaGeneralUri))
+ {
+ //in case aMedia as mediaArray which contains songs as arrayContents, need to update all songs associated
+ if ( aMedia.IsSupported(KMPXMediaArrayContents))
+ {
+ iDbHandler->UpdateSongsAbstractAlbumInfoL(aMedia, aMessageArray);
+ }
+ //only update field values in abstractalbum table, or renaming (change uri) for abstractalbum table
+ else
+ {
+ visibleChange = iDbHandler->UpdateAbstractAlbumL(aMedia, aMessageArray);
+ }
+ }
}
break;
#endif // ABSTRACTAUDIOALBUM_INCLUDED
@@ -4382,9 +4392,9 @@
case EBrowseComposer:
{
aAttrs.AppendL( TMPXAttribute(KMPXMediaIdMusic,
-// EMPXMediaMusicArtist | EMPXMediaMusicAlbumArtFileName ) );
+// EMPXMediaMusicArtist | EMPXMediaMusicAlbumArtFileName ) );
//added ganes
- EMPXMediaMusicArtist | EMPXMediaMusicAlbumArtFileName | EMPXMediaMusicAlbum) );
+ EMPXMediaMusicArtist | EMPXMediaMusicAlbumArtFileName | EMPXMediaMusicAlbum) );
aSupportedIds.AppendL( KMPXMediaIdMusic );
break;
}
--- a/mpserviceplugins/mpxsqlitepodcastdbplugin/inc/mpxdbpodcast.h Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitepodcastdbplugin/inc/mpxdbpodcast.h Fri May 14 15:49:53 2010 +0300
@@ -148,13 +148,16 @@
* @param aEpisodeId the ID of the episode to be removed
* @param aUriArray on return contains the URI of the deleted episode
* @param aItemChangedMessages on return contains changed messages
+ * @param IsAdd denotes whether DeleteEpisodeL is called as part of
+ * adding an episode or deleting an episode ,if called as part of adding
+ * pass ETrue else if part of deletion pass EFalse.
* @param aDeleteRecord indicates whether the client has explictly requested
* to delete the records from the database. If ETrue, records
* associated with the media will be deleted from the database;
* if EFalse, the record will be marked as deleted only.
*/
void DeleteEpisodeL(TUint32 aEpisodeId, CDesCArray& aUriArray,
- CMPXMessageArray& aItemChangedMessages, TBool aDeleteRecord);
+ CMPXMessageArray& aItemChangedMessages, TBool IsAdd, TBool aDeleteRecord);
/**
* Remove episodes matching a category from the Podcast table
@@ -618,6 +621,8 @@
* @param aRecordset episode record to be removed
* @param aUriArray, on return will be filled with all the paths that were removed
* @param aItemChangedMessages: change events as result of the episode removal
+ * @param IsAdd denotes whether DoDeleteEpisodeL is called as part of
+ * adding an episode or deleting an episode.
* @param aDeleteRecord: indicates whether the client has explictly requested
* to delete the records from the database. If ETrue, records
* associated with the media will be deleted from the database;
@@ -626,7 +631,7 @@
* @return Error code.
*/
void DoDeleteEpisodeL(RSqlStatement& aRecordset, CDesCArray& aUriArray,
- CMPXMessageArray& aItemChangedMessages, TBool aDeleteRecord = EFalse);
+ CMPXMessageArray& aItemChangedMessages, TBool IsAdd, TBool aDeleteRecord = EFalse);
/**
* Constructs the fields and corresponding values to be written into the Podcast
--- a/mpserviceplugins/mpxsqlitepodcastdbplugin/inc/mpxpodcastcollectiondbdef.h Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitepodcastdbplugin/inc/mpxpodcastcollectiondbdef.h Fri May 14 15:49:53 2010 +0300
@@ -15,7 +15,6 @@
*
*/
-
#ifndef MPXPODCASTCOLLECTIONDBDEF_H
#define MPXPODCASTCOLLECTIONDBDEF_H
--- a/mpserviceplugins/mpxsqlitepodcastdbplugin/src/mpxdbcategory.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitepodcastdbplugin/src/mpxdbcategory.cpp Fri May 14 15:49:53 2010 +0300
@@ -588,13 +588,17 @@
iDbManager.ExecuteSelectQueryL(aDriveId, *query, aId));
CleanupClosePushL(recordset);
- if (recordset.Next() != KSqlAtRow)
+ TInt err(KSqlAtEnd);
+ TInt ret(0) ;
+ while((err = recordset.Next()) == KSqlAtRow)
+ {
+ ret += recordset.ColumnInt(KMPXTableDefaultIndex);
+ }
+ if(err != KSqlAtEnd)
{
User::Leave(KErrNotFound);
}
-
- TInt ret = recordset.ColumnInt(KMPXTableDefaultIndex);
-
+ MPX_DEBUG2("CMPXDbCategory::GetEpisodeCountL Count %d" , ret);
CleanupStack::PopAndDestroy(&recordset);
CleanupStack::PopAndDestroy(query);
--- a/mpserviceplugins/mpxsqlitepodcastdbplugin/src/mpxdbpodcast.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitepodcastdbplugin/src/mpxdbpodcast.cpp Fri May 14 15:49:53 2010 +0300
@@ -144,7 +144,16 @@
CMPXMessageArray* itemChangedMessages = CMPXMediaArray::NewL();
CleanupStack::PushL( itemChangedMessages );
- DeleteEpisodeL( episodeId, *fp, *itemChangedMessages, ETrue );
+ //Isadd is passed as true as its called from AddEpisodeL
+ //IsAdd true means dont decrement the episode count from tables like
+ //Artist Genere, Album, and Composer , which is not needed when
+ //DeleteEpisodeL is called as part of Add operation
+ TRAPD( err, DeleteEpisodeL( episodeId, *fp, *itemChangedMessages, ETrue, ETrue ) );
+
+ if ( err != KErrNone ) // EpisodeExistL has found a record from a previously deleted episode, cleanup it now
+ {
+ iDbManager.ExecuteQueryL( aDrive, KQueryPodcastDelete(), episodeId );
+ }
CleanupStack::PopAndDestroy( itemChangedMessages );
CleanupStack::PopAndDestroy( fp );
@@ -187,7 +196,7 @@
void CMPXDbPodcast::DeleteEpisodeL(
TUint32 aEpisodeId,
CDesCArray& aUriArray,
- CMPXMessageArray& aItemChangedMessages,
+ CMPXMessageArray& aItemChangedMessages, TBool IsAdd,
TBool aDeleteRecord)
{
MPX_FUNC("CMPXDbPodcast::DeleteEpisodeL");
@@ -199,7 +208,7 @@
{
User::Leave(KErrNotFound);
}
- DoDeleteEpisodeL(recordset, aUriArray, aItemChangedMessages, aDeleteRecord);
+ DoDeleteEpisodeL(recordset, aUriArray, aItemChangedMessages, IsAdd, aDeleteRecord);
CleanupStack::PopAndDestroy(&recordset);
}
@@ -1224,7 +1233,7 @@
void CMPXDbPodcast::DoDeleteEpisodeL(
RSqlStatement& aRecordset,
CDesCArray& aUriArray,
- CMPXMessageArray& aItemChangedMessages,
+ CMPXMessageArray& aItemChangedMessages, TBool IsAdd ,
TBool aDeleteRecord)
{
MPX_FUNC("CMPXDbPodcast::DoDeleteEpisodeL");
@@ -1235,22 +1244,28 @@
aUriArray.AppendL(*uri);
TDriveUnit driveUnit(*uri);
CleanupStack::PopAndDestroy(uri);
-
- // process the author
- iObserver.DeleteEpisodeForCategoryL(EMPXArtist, aRecordset.ColumnInt64(EPodcastArtist),
- driveUnit, &aItemChangedMessages);
+
+ //if adding then dont delete episode category
+ if(!IsAdd)
+ {
+ // process the author
+ iObserver.DeleteEpisodeForCategoryL(EMPXArtist, aRecordset.ColumnInt64(EPodcastArtist),
+ driveUnit, &aItemChangedMessages );
+
+ // process the title
+ iObserver.DeleteEpisodeForCategoryL(EMPXAlbum, aRecordset.ColumnInt64(EPodcastAlbum),
+ driveUnit, &aItemChangedMessages);
+
+ // process the genre
+ iObserver.DeleteEpisodeForCategoryL(EMPXGenre, aRecordset.ColumnInt64(EPodcastGenre),
+ driveUnit, &aItemChangedMessages);
+
+ // process the composer
+ iObserver.DeleteEpisodeForCategoryL(EMPXComposer, aRecordset.ColumnInt64(EPodcastComposer),
+ driveUnit, &aItemChangedMessages);
+ }
+
- // process the title
- iObserver.DeleteEpisodeForCategoryL(EMPXAlbum, aRecordset.ColumnInt64(EPodcastAlbum),
- driveUnit, &aItemChangedMessages);
-
- // process the genre
- iObserver.DeleteEpisodeForCategoryL(EMPXGenre, aRecordset.ColumnInt64(EPodcastGenre),
- driveUnit, &aItemChangedMessages);
-
- // process the composer
- iObserver.DeleteEpisodeForCategoryL(EMPXComposer, aRecordset.ColumnInt64(EPodcastComposer),
- driveUnit, &aItemChangedMessages);
// add a change event for removing the episode itself
TUint32 episodeId(aRecordset.ColumnInt64(EPodcastUniqueId));
--- a/mpserviceplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbhandler.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbhandler.cpp Fri May 14 15:49:53 2010 +0300
@@ -1211,8 +1211,9 @@
}
#endif
- // delete the episode
- iDbPodcast->DeleteEpisodeL(aEpisodeId, aUriArray, aItemChangedMessages, deleteRecord);
+ // delete the episode
+ // IsAdd is passed EFalse to ensure the episode count will be decremented
+ iDbPodcast->DeleteEpisodeL(aEpisodeId, aUriArray, aItemChangedMessages, EFalse, deleteRecord);
}
// ----------------------------------------------------------------------------
--- a/mpserviceplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbplugin.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpserviceplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbplugin.cpp Fri May 14 15:49:53 2010 +0300
@@ -22,7 +22,6 @@
#include <bautils.h>
#include <data_caging_path_literals.hrh>
-//#include <mpxpodcastdbplugin.mbg>
#include <mpxcmn.h>
#include <mpxcollectionpluginobserver.h>
#include <mpxmediacontainerdefs.h>
@@ -338,7 +337,7 @@
for (TInt i=0; i<count; ++i)
{
MPX_DEBUG2("At drive %i", driveArray[i]);
- if ((driveArray[i] != EDriveC) && (!iDbHandler->IsRemoteDrive(static_cast<TDriveNumber>(driveArray[i]))))
+ if ((driveArray[i] != EDriveC) && (!iDbHandler->IsRemoteDrive(static_cast<TDriveNumber>(driveArray[i]))))
{
MPX_DEBUG2("Closing database %i", driveArray[i]);
TRAP_IGNORE( iDbHandler->CloseDatabaseL( driveArray[i] ) );
@@ -366,7 +365,7 @@
for( TInt i=0; i<count; ++i )
{
MPX_DEBUG2("At drive %i", driveArray[i]);
- if (( driveArray[i] != EDriveC ) && (!iDbHandler->IsRemoteDrive(static_cast<TDriveNumber>(driveArray[i]))))
+ if (( driveArray[i] != EDriveC ) && (!iDbHandler->IsRemoteDrive(static_cast<TDriveNumber>(driveArray[i]))))
{
TUint driveStatus(0);
User::LeaveIfError( DriveInfo::GetDriveStatus(
@@ -738,7 +737,6 @@
CMPXMediaArray* array = CMPXMediaArray::NewL();
CleanupStack::PushL(array);
-// TInt count(0);
TInt levels(aPath.Levels());
TBool isEpisode(EFalse);
@@ -2285,7 +2283,7 @@
fp->AppendL(*uri);
CleanupStack::PopAndDestroy(uri);
iSelections.Remove(0);
-
+
}
aCmd.SetNoNewLCObjectL (KMPXCommandCollectionRetrieveMediaUriArray, fp);
if (iFirstDeleteStep)
@@ -2723,8 +2721,8 @@
}
else // Single item
{
- if ( iDbHandler )
- {
+ if(iDbHandler)
+ {
visibleChange = iDbHandler->UpdateEpisodeL(*task, msgArray);
done = ETrue;
}
@@ -2863,7 +2861,7 @@
}
iDbHandler->EndTransactionL( err );
}
-
+
// Broadcase change messages
//
if (iActiveTask->GetVisibleChange())
@@ -2877,9 +2875,9 @@
if (aErr != KErrCancel)
{
iObs->HandleCommandComplete(NULL, aErr);
- }
+ }
}
-
+
// ----------------------------------------------------------------------------------------------------------
// Complete a delete operation
@@ -3096,7 +3094,7 @@
EMPXMediaGeneralUri | EMPXMediaGeneralFlags | EMPXMediaGeneralCount |
EMPXMediaGeneralPlayCount | EMPXMediaGeneralLastPlaybackPosition |
EMPXMediaGeneralCollectionId | EMPXMediaGeneralDate));
-
+
aAttrs.AppendL(TMPXAttribute(KMPXMediaIdPodcast,
EMPXMediaPodcastType | EMPXMediaPodcastCategoryGroup | EMPXMediaPodcastIsPlaying));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mpviewplugins/mpcollectionviewplugin/inc/mpcollectioncontainerartists.h Fri May 14 15:49:53 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Music Player collection container definition - Artists.
+*
+*/
+
+#ifndef MPCOLLECTIONCONTAINERARTISTS_H
+#define MPCOLLECTIONCONTAINERARTISTS_H
+
+#include "mpcollectionlistcontainer.h"
+
+class HbGroupBox;
+
+class MpCollectionContainerArtists : public MpCollectionListContainer
+{
+ Q_OBJECT
+
+public:
+
+ explicit MpCollectionContainerArtists( HbDocumentLoader *loader, QGraphicsItem *parent=0 );
+ virtual ~MpCollectionContainerArtists();
+
+public slots:
+
+ void itemActivated( const QModelIndex &index );
+
+private:
+
+ void setupContainer();
+
+private:
+
+ HbGroupBox *mInfoBar; // Own
+
+ QString mArtist;
+ QString mAlbum;
+
+};
+
+#endif // MPCOLLECTIONCONTAINERARTISTS_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mpviewplugins/mpcollectionviewplugin/inc/mpcollectionpopuphandler.h Fri May 14 15:49:53 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Music Player popup handler.
+*
+*/
+
+#ifndef MPCOLLECTIONPOPUPHANDLER_H
+#define MPCOLLECTIONPOPUPHANDLER_H
+
+#include <QObject>
+
+class MpCollectionView;
+class HbPopup;
+class HbAction;
+class MpEngine;
+class QAbstractItemModel;
+class MpMpxCollectionData;
+class QPointF;
+
+class MpCollectionPopupHandler : public QObject
+{
+ Q_OBJECT
+
+public:
+ MpCollectionPopupHandler( MpCollectionView *parent );
+ virtual ~MpCollectionPopupHandler();
+
+ void openDefaultViewContextMenu( int index, const QPointF &coords );
+ void openFetchViewContextMenu( int index, const QPointF &coords );
+ void openRenamePlaylistContainerDialog( const QString ¤tName );
+ void openRenamePlaylistItemDialog( const QString ¤tName );
+ void openAddSongsToPlaylist( QAbstractItemModel* model );
+ void openDeleteSongs( QAbstractItemModel* model );
+ void openAddToCurrentPlaylist( MpMpxCollectionData* collectionData );
+ void openCreateNewPlaylist( MpMpxCollectionData* collectionData );
+ void openArrangeSongs( MpMpxCollectionData* collectionData );
+ void cancelOngoingPopup();
+
+ bool showingPopup();
+
+public slots:
+ //Context Menus
+ void defaultContextMenuOptionSelected( HbAction *selectedAction );
+ void fetcherContextMenuOptionSelected( HbAction *selectedAction );
+
+ //Dialogs
+ void handleAddToPlaylistDialogFinished( HbAction *selectedAction );
+ void handleAddToPlaylistGetTextFinished( HbAction *selectedAction );
+ void handleRenamePlaylistContainer( HbAction *selectedAction );
+ void handleRenamePlaylistItem( HbAction *selectedAction );
+ void handleAddSongsToPlayList( HbAction *selectedAction );
+ void handleDeleteSongs( HbAction *selectedAction );
+ void handleAddToCurrentPlaylist( HbAction *selectedAction );
+ void handleCreateNewPlaylistGetTextFinished( HbAction *selectedAction );
+ void handleCreateNewPlaylistGetModelIndexesFinished( HbAction *selectedAction );
+ void handleArrangeSongs( HbAction *selectedAction );
+ void handleRequestDelete( HbAction *selectedAction );
+
+ void outstandingPopupClosing();
+
+private:
+ void setOutstandingPopup( HbPopup *popup );
+ void clearOutstandingPopup( HbPopup *popup );
+ void launchAddToPlaylistDialog( QList<int> &selection );
+ void queryNewPlaylistName(const QStringList &playlists, const char *handler );
+ void getText(const QString &label, const QString &text, const char *handler );
+ void getModelIndexes( const QString &label, QAbstractItemModel* model, const char *handler );
+ void launchArrangeSongsDialog( MpMpxCollectionData* collectionData );
+ void requestDelete( QList<int> &selection );
+
+private:
+ MpCollectionView *mView; // Not own
+ HbPopup *mOutstandingPopup; // Own
+ MpEngine *mMpEngine; // Not own
+
+ class MpPopupHandlerPermanentData : public QObject
+ {
+ public:
+ MpPopupHandlerPermanentData( QObject *parent=0 );
+ virtual ~MpPopupHandlerPermanentData();
+ void clear();
+ public:
+ MpMpxCollectionData *mIsolatedCollectionData; // Not own
+ QAbstractItemModel *mAbstractItemModel; // Own
+ QList<int> mSelectedItems;
+ QString mOriginalName;
+ int mContextMenuIndex;
+ };
+
+ MpPopupHandlerPermanentData *mPermanentData; // Own
+};
+
+#endif // MPCOLLECTIONPOPUPHANDLER_H
+
--- a/mpviewplugins/mpcollectionviewplugin/inc/mpcollectionview.h Mon May 03 12:29:20 2010 +0300
+++ b/mpviewplugins/mpcollectionviewplugin/inc/mpcollectionview.h Fri May 14 15:49:53 2010 +0300
@@ -38,8 +38,8 @@
class MpMpxCollectionData;
class MpNowPlayingWidget;
class MpSnapshotWidget;
+class MpCollectionPopupHandler;
class QTranslator;
-class HbPopup;
class MpCollectionView : public MpViewBase
{
@@ -54,6 +54,8 @@
void activateView();
void deactivateView();
void setDefaultView();
+ bool isActivated();
+ void openItem( int index );
signals:
@@ -65,6 +67,7 @@
void openSongs();
void openArtists();
+ void openAlbums();
void openPlaylists();
void openGenres();
void find();
@@ -91,11 +94,8 @@
void prepareToAddToPlaylist();
void handleIsolatedCollectionOpened( MpMpxCollectionData* collectionData );
- void addToCurrentPlaylist( MpMpxCollectionData* collectionData );
- void createNewPlaylist( MpMpxCollectionData* collectionData );
void arrangeSongs();
void openContextMenu( int index, const QPointF &coords );
- void outstandingPopupClosing();
void handleUsbBlocked( bool blocked );
void handleLibraryAboutToUpdate();
@@ -103,9 +103,6 @@
private:
- void openDefaultViewContextMenu( int index, const QPointF &coords );
- void openFetchViewContextMenu( int index, const QPointF &coords );
-
void setMainToolBar();
void setPlaylistToolBar();
@@ -118,13 +115,8 @@
void setBannerVisibility( bool visible );
int generateShuffleIndex();
- void launchAddToPlaylistDialog( QList<int> &selection );
void startContainerTransition( TCollectionContext contextFrom, TCollectionContext contextTo );
- void requestDelete( QList<int> &selection );
- QModelIndexList getModelIndexes( const QString &label, QAbstractItemModel* model, bool &ok );
- QString getText(const QString &label,const QString &text, bool &ok);
- void setOutstandingPopup(HbPopup *popup);
- bool queryNewPlaylistName(QString &newPlaylistName , const QStringList &playlists );
+ void cancelOngoingOperation();
private:
@@ -142,8 +134,8 @@
bool mBannerAttached;
HbMainWindow *mWindow; // Not own
- HbAction *mSoftKeyQuit; // Not own
- HbAction *mSoftKeyBack; // Not own
+ HbAction *mNavigationQuit; // Not own
+ HbAction *mNavigationBack; // Not own
MpCollectionDocumentLoader *mDocumentLoader; // Own
HbWidget *mMainContainer; // Own
@@ -157,7 +149,7 @@
QTranslator *mCommonTranslator; // Own
bool mActivationWaiting;
- HbPopup *mOutstandingPopup; // Not own
+ MpCollectionPopupHandler *mMpPopupHandler; // Own
bool mUsbBlocked;
--- a/mpviewplugins/mpcollectionviewplugin/mpcollectionviewplugin.pro Mon May 03 12:29:20 2010 +0300
+++ b/mpviewplugins/mpcollectionviewplugin/mpcollectionviewplugin.pro Fri May 14 15:49:53 2010 +0300
@@ -47,10 +47,12 @@
src/mpcollectioncontainer.cpp \
src/mpcollectionlistcontainer.cpp \
src/mpcollectioncontainerallsongs.cpp \
+ src/mpcollectioncontainerartists.cpp \
src/mpcollectioncontaineralbums.cpp \
src/mpcollectioncontainerplaylists.cpp \
src/mpcollectioncontainergenres.cpp \
- src/mpsnapshotwidget.cpp
+ src/mpsnapshotwidget.cpp \
+ src/mpcollectionpopuphandler.cpp
HEADERS = ../../inc/mpviewbase.h \
inc/mpcollectionviewplugin.h \
@@ -60,9 +62,11 @@
inc/mpcollectioncontainer.h \
inc/mpcollectionlistcontainer.h \
inc/mpcollectioncontainerallsongs.h \
+ inc/mpcollectioncontainerartists.h \
inc/mpcollectioncontaineralbums.h \
inc/mpcollectioncontainerplaylists.h \
inc/mpcollectioncontainergenres.h \
- inc/mpsnapshotwidget.h
+ inc/mpsnapshotwidget.h \
+ inc/mpcollectionpopuphandler.h
RESOURCES += resources/mpcollectionviewresources.qrc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mpviewplugins/mpcollectionviewplugin/resources/musiccollection.docml Fri May 14 15:49:53 2010 +0300
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="0.9">
+ <widget name="mainContainer" type="HbWidget">
+ <widget name="nowPlaying" type="MpNowPlayingWidget">
+ <sizehint type="MAXIMUM" height="0.0" />
+ </widget>
+ <widget name="container" type="HbWidget">
+ <sizehint height="expr(var(hb-param-screen-height) - var(hb-param-widget-chrome-height) - var(hb-param-widget-toolbar-height))" type="PREFERRED" width="var(hb-param-screen-width)"/>
+ </widget>
+ <layout orientation="Vertical" spacing="0un" type="linear">
+ <contentsmargins bottom="0.0un" left="var(hb-param-margin-view-left)" right="var(hb-param-margin-view-right)" top="0.0un"/>
+ <linearitem itemname="container" spacing="0.0un"/>
+ <linearitem itemname="nowPlaying" spacing="0.0un"/>
+ </layout>
+ </widget>
+
+ <section name="showBanner">
+ <widget name="nowPlaying">
+ <sizehint type="MAXIMUM" height="expr(2*var(hb-param-margin-gene-middle-vertical) + var(hb-param-text-height-primary) + var(hb-param-text-height-secondary))" />
+ <sizehint type="MINIMUM" height="expr(2*var(hb-param-margin-gene-middle-vertical) + var(hb-param-text-height-primary) + var(hb-param-text-height-secondary))" />
+ <sizehint type="PREFERRED" height="expr(2*var(hb-param-margin-gene-middle-vertical) + var(hb-param-text-height-primary) + var(hb-param-text-height-secondary))" />
+ </widget>
+ </section>
+
+ <section name="hideBanner">
+ <widget name="nowPlaying">
+ <sizehint type="MAXIMUM" height="0.0" />
+ <sizehint type="MINIMUM" height="0.0" />
+ <sizehint type="PREFERRED" height="0.0" />
+ </widget>
+ </section>
+
+ <section name="allSongs">
+ <widget name="container">
+ <widget name="allSongsDetail" type="HbGroupBox">
+ <bool name="collapsable" value="FALSE"/>
+ <real name="z" value="1.0"/>
+ </widget>
+ <widget name="allSongsList" type="HbListView">
+ <sizehint height="expr(var(hb-param-screen-height) - var(hb-param-widget-chrome-height) - var(hb-param-widget-toolbar-height))" type="PREFERRED" width="var(hb-param-screen-width)"/>
+ </widget>
+ <layout orientation="Vertical" spacing="0un" type="linear">
+ <contentsmargins bottom="0.0" left="var(hb-param-margin-view-left)" right="var(hb-param-margin-view-right)" top="0.0"/>
+ <linearitem itemname="allSongsDetail" spacing="0.0"/>
+ <linearitem itemname="allSongsList" spacing="0.0"/>
+ </layout>
+ </widget>
+ </section>
+
+ <section name="artists">
+ <widget name="container">
+ <widget name="artistsList" type="HbListView">
+ <sizehint height="expr(var(hb-param-screen-height) - var(hb-param-widget-chrome-height) - var(hb-param-widget-toolbar-height))" type="PREFERRED" width="var(hb-param-screen-width)"/>
+ </widget>
+ <layout orientation="Vertical" spacing="0un" type="linear">
+ <contentsmargins bottom="0.0" left="var(hb-param-margin-view-left)" right="var(hb-param-margin-view-right)" top="0.0"/>
+ <linearitem itemname="artistsList" spacing="0.0"/>
+ </layout>
+ </widget>
+ </section>
+
+ <section name="artistSongs">
+ <widget name="container">
+ <widget name="artistSongsDetail" type="HbGroupBox">
+ <bool name="collapsable" value="FALSE"/>
+ <real name="z" value="1.0"/>
+ </widget>
+ <layout orientation="Vertical" spacing="0un" type="linear">
+ <contentsmargins bottom="0.0" left="var(hb-param-margin-view-left)" right="var(hb-param-margin-view-right)" top="0.0"/>
+ <linearitem itemname="artistSongsDetail" spacing="0.0"/>
+ <linearitem itemname="artistsList" spacing="0.0"/>
+ </layout>
+ </widget>
+ </section>
+
+ <section name="albums">
+ <widget name="container">
+ <widget name="albumsList" type="HbListView">
+ <sizehint height="expr(var(hb-param-screen-height) - var(hb-param-widget-chrome-height) - var(hb-param-widget-toolbar-height))" type="PREFERRED" width="var(hb-param-screen-width)"/>
+ </widget>
+ <layout orientation="Vertical" spacing="0un" type="linear">
+ <contentsmargins bottom="0.0" left="var(hb-param-margin-view-left)" right="var(hb-param-margin-view-right)" top="0.0"/>
+ <linearitem itemname="albumsList" spacing="0.0"/>
+ </layout>
+ </widget>
+ </section>
+
+ <section name="albumSongs">
+ <widget name="container">
+ <widget name="albumSongsDetail" type="HbGroupBox">
+ <bool name="collapsable" value="FALSE"/>
+ <real name="z" value="1.0"/>
+ </widget>
+ <layout orientation="Vertical" spacing="0un" type="linear">
+ <contentsmargins bottom="0.0" left="var(hb-param-margin-view-left)" right="var(hb-param-margin-view-right)" top="0.0"/>
+ <linearitem itemname="albumSongsDetail" spacing="0.0"/>
+ <linearitem itemname="albumsList" spacing="0.0"/>
+ </layout>
+ </widget>
+ </section>
+
+ <section name="playlists">
+ <widget name="container">
+ <widget name="playlistsList" type="HbListView">
+ <sizehint height="expr(var(hb-param-screen-height) - var(hb-param-widget-chrome-height) - var(hb-param-widget-toolbar-height))" type="PREFERRED" width="var(hb-param-screen-width)"/>
+ </widget>
+ <layout orientation="Vertical" spacing="0un" type="linear">
+ <contentsmargins bottom="0.0" left="var(hb-param-margin-view-left)" right="var(hb-param-margin-view-right)" top="0.0"/>
+ <linearitem itemname="playlistsList" spacing="0.0"/>
+ </layout>
+ </widget>
+ </section>
+
+ <section name="playlistSongs">
+ <widget name="container">
+ <widget name="playlistSongsDetail" type="HbGroupBox">
+ <bool name="collapsable" value="FALSE"/>
+ </widget>
+ <layout orientation="Vertical" spacing="0un" type="linear">
+ <contentsmargins bottom="0.0" left="var(hb-param-margin-view-left)" right="var(hb-param-margin-view-right)" top="0.0"/>
+ <linearitem itemname="playlistSongsDetail" spacing="0.0"/>
+ <linearitem itemname="playlistsList" spacing="0.0"/>
+ </layout>
+ </widget>
+ </section>
+
+ <section name="emptyList">
+ <widget name="container">
+ <widget name="noMusic" type="HbLabel">
+ <string name="plainText" locid="txt_mus_info_no_music"/>
+ <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <fontspec name="fontSpec" role="Primary"/>
+ </widget>
+
+ <layout type="linear" orientation="Vertical" >
+ <contentsmargins bottom="0.0" left="var(hb-param-margin-view-left)" right="var(hb-param-margin-view-right)" top="0.0"/>
+ <stretchitem stretchfactor="1"/>
+ <linearitem itemname="noMusic" spacing="0.0"/>
+ <stretchitem stretchfactor="1"/>
+ </layout>
+ </widget>
+ </section>
+
+</hbdocument>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mpviewplugins/mpcollectionviewplugin/src/mpcollectioncontainerartists.cpp Fri May 14 15:49:53 2010 +0300
@@ -0,0 +1,193 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Music Player collection container definition - Artists.
+*
+*/
+
+#include <QtCore>
+
+#include <hbdocumentloader.h>
+#include <hblistview.h>
+#include <hbgroupbox.h>
+#include <hbindexfeedback.h>
+
+#include "mpcollectioncontainerartists.h"
+#include "mpmpxcollectiondata.h"
+#include "mptrace.h"
+
+/*!
+ \class MpCollectionContainerArtists
+ \brief Music Player collection container definition - Artists.
+
+ 'Artists' collection container implements the interface specified
+ by MpCollectionContainer. It provides a layout and widgets for the
+ 'Artists' view.
+
+ This container handles the following contexts:
+ \li ECollectionContextArtists
+ \li ECollectionContextArtistAlbums
+ \li ECollectionContextArtistSongs
+
+ \sa MpCollectionContainer
+*/
+
+/*!
+ Constructs the collection container.
+ */
+MpCollectionContainerArtists::MpCollectionContainerArtists( HbDocumentLoader *loader, QGraphicsItem *parent )
+ : MpCollectionListContainer(loader, parent),
+ mInfoBar(0)
+{
+ TX_LOG
+}
+
+/*!
+ Destructs the collection container.
+ */
+MpCollectionContainerArtists::~MpCollectionContainerArtists()
+{
+ TX_ENTRY
+ delete mInfoBar;
+ delete mList;
+ TX_EXIT
+}
+
+/*!
+ Slot to be called when an item is selected by the user.
+ */
+void MpCollectionContainerArtists::itemActivated( const QModelIndex &index )
+{
+ int row = index.row();
+ TX_ENTRY_ARGS("index=" << row);
+
+ if ( mCollectionContext == ECollectionContextArtists ) {
+ mArtist = mCollectionData->itemData(row, MpMpxCollectionData::Title);
+ if ( mArtist.isEmpty() ) {
+ mArtist = hbTrId("txt_mus_subtitle_unknown");
+ }
+ }
+ else if ( mCollectionContext == ECollectionContextArtistAlbums ) {
+ mAlbum = mCollectionData->itemData(row, MpMpxCollectionData::Title);
+ if ( mAlbum.isEmpty() ) {
+ mAlbum = hbTrId("txt_mus_dblist_val_unknown3");
+ }
+ }
+ MpCollectionListContainer::itemActivated(index);
+ TX_EXIT
+}
+
+/*!
+ Sets up the container by organizing widgets according to its layout.
+
+ \reimp
+ */
+void MpCollectionContainerArtists::setupContainer()
+{
+ TX_ENTRY_ARGS("mCollectionContext=" << mCollectionContext);
+ if ( mCollectionData->count() ) {
+ bool ok = false;
+ QGraphicsWidget *widget;
+ if ( mCollectionContext == ECollectionContextArtists ) {
+ mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "artists", &ok);
+ if ( !ok ) {
+ TX_LOG_ARGS("Error: invalid xml file.");
+ Q_ASSERT_X(ok, "MpCollectionContainerArtists::setupContainer", "invalid xml file");
+ }
+ if ( !mList ) {
+ widget = mDocumentLoader->findWidget(QString("artistsList"));
+ mList = qobject_cast<HbListView*>(widget);
+ mIndexFeedback->setItemView(mList);
+ initializeList();
+ }
+ if ( mInfoBar ) {
+ delete mInfoBar;
+ mInfoBar = 0;
+ }
+ }
+ else if ( mCollectionContext == ECollectionContextArtistAlbums ) {
+ mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "artistSongs", &ok);
+ if ( !ok ) {
+ TX_LOG_ARGS("Error: invalid xml file.");
+ Q_ASSERT_X(ok, "MpCollectionContainerArtists::setupContainer", "invalid xml file");
+ }
+
+ widget = mDocumentLoader->findWidget(QString("artistSongsDetail"));
+ mInfoBar = qobject_cast<HbGroupBox*>(widget);
+
+ QString details;
+ if ( mViewMode == MpCommon::FetchView ) {
+ details = "Select a song";
+ }
+ else {
+ details = mArtist;
+ }
+ mInfoBar->setHeading(details);
+ }
+ else if ( mCollectionContext == ECollectionContextAlbumSongs ) {
+ mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "artistSongs", &ok);
+ if ( !ok ) {
+ TX_LOG_ARGS("Error: invalid xml file.");
+ Q_ASSERT_X(ok, "MpCollectionContainerArtists::setupContainer", "invalid xml file");
+ }
+
+ widget = mDocumentLoader->findWidget(QString("artistSongsDetail"));
+ mInfoBar = qobject_cast<HbGroupBox*>(widget);
+
+ QString details;
+ if ( mViewMode == MpCommon::FetchView ) {
+ details = "Select a song";
+ }
+ else {
+ details = mArtist;
+ details.append(" - ");
+ details.append(mAlbum);
+ }
+ mInfoBar->setHeading(details);
+ }
+ else if ( mCollectionContext == ECollectionContextArtistSongs ) {
+ mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "artistSongs", &ok);
+ if ( !ok ) {
+ TX_LOG_ARGS("Error: invalid xml file.");
+ Q_ASSERT_X(ok, "MpCollectionContainerArtists::setupContainer", "invalid xml file");
+ }
+
+ widget = mDocumentLoader->findWidget(QString("artistSongsDetail"));
+ mInfoBar = qobject_cast<HbGroupBox*>(widget);
+
+ QString details;
+ if ( mViewMode == MpCommon::FetchView ) {
+ details = "Select a song";
+ }
+ else if ( mArtist.isEmpty() ) {
+ details = hbTrId("txt_mus_subtitle_unknown_all");
+ }
+ else{
+ details = hbTrId( "txt_mus_subtitle_1_all" ).arg(mArtist);
+
+ }
+ mInfoBar->setHeading(details);
+ }
+ }
+ else {
+ if ( mInfoBar ) {
+ // When last song in an album is deleted and album list is reloaded
+ delete mInfoBar;
+ mInfoBar = 0;
+ }
+ // Call empty list from base class
+ setupEmptyListContainer();
+ }
+ TX_EXIT
+}
+
--- a/mpviewplugins/mpcollectionviewplugin/src/mpcollectioncontainerfactory.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpviewplugins/mpcollectionviewplugin/src/mpcollectioncontainerfactory.cpp Fri May 14 15:49:53 2010 +0300
@@ -21,6 +21,7 @@
#include "mpcollectionview.h"
#include "mpcollectioncontainer.h"
#include "mpcollectioncontainerallsongs.h"
+#include "mpcollectioncontainerartists.h"
#include "mpcollectioncontaineralbums.h"
#include "mpcollectioncontainerplaylists.h"
#include "mpcollectioncontainergenres.h"
@@ -75,6 +76,16 @@
connect( mCurrentContainer, SIGNAL(itemActivated(int)), mView, SLOT(openIndex(int)) );
connect( mCurrentContainer, SIGNAL(itemLongPressed(int, QPointF)), mView, SLOT(openContextMenu(int, QPointF)) );
break;
+ case ECollectionContextArtists:
+ if ( ( mCurrentContext != ECollectionContextArtistAlbums ) && ( mCurrentContext != ECollectionContextAlbumSongs) )
+ {
+ deleteCurrentContainer();
+ mCurrentContainer = new MpCollectionContainerArtists(mDocumentLoader);
+ mCurrentContainer->initialize();
+ connect( mCurrentContainer, SIGNAL(itemActivated(int)), mView, SLOT(openIndex(int)) );
+ connect( mCurrentContainer, SIGNAL(itemLongPressed(int, QPointF)), mView, SLOT(openContextMenu(int, QPointF)) );
+ }
+ break;
case ECollectionContextAlbums:
if ( mCurrentContext != ECollectionContextAlbumSongs ) {
deleteCurrentContainer();
@@ -103,6 +114,8 @@
}
break;
case ECollectionContextAlbumSongs:
+ case ECollectionContextArtistAlbums:
+ case ECollectionContextArtistSongs:
case ECollectionContextPlaylistSongs:
case ECollectionContextGenreSongs:
// For this contexts, reuse the same container.
@@ -123,6 +136,11 @@
case ECollectionContextAllSongs:
delete static_cast<MpCollectionContainerAllSongs *>(mCurrentContainer);
break;
+ case ECollectionContextArtists:
+ case ECollectionContextArtistAlbums:
+ case ECollectionContextArtistSongs:
+ delete static_cast<MpCollectionContainerArtists *>(mCurrentContainer);
+ break;
case ECollectionContextAlbums:
case ECollectionContextAlbumSongs:
delete static_cast<MpCollectionContainerAlbums *>(mCurrentContainer);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mpviewplugins/mpcollectionviewplugin/src/mpcollectionpopuphandler.cpp Fri May 14 15:49:53 2010 +0300
@@ -0,0 +1,1039 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Music Player collection popup handler.
+*
+*/
+
+// INCLUDE FILES
+#include <hbaction.h>
+#include <hbmenu.h>
+#include <hbmessagebox.h>
+#include <hbselectiondialog.h>
+#include <hbinputdialog.h>
+#include <hblabel.h>
+#include <hblistview.h>
+#include <hbscrollbar.h>
+
+#include "mpengine.h"
+#include "mpcollectionview.h"
+#include "mpmpxcollectiondata.h"
+#include "mpcollectiondatamodel.h"
+#include "mpmpxcollectionviewdefs.h"
+#include "mpcollectionpopuphandler.h"
+#include "mptrace.h"
+
+const int KNullIndex = -1;
+
+/*!
+ \class MpCollectionPopupHandler
+ \brief Music Player collection popup handler.
+
+ This class controls the asynchronous operation of all dialogs
+ used by collection view.
+*/
+
+/*!
+ Constructs the collection popup handler.
+ */
+MpCollectionPopupHandler::MpCollectionPopupHandler( MpCollectionView *parent )
+ : QObject( parent ),
+ mView( parent ),
+ mOutstandingPopup( 0 ),
+ mMpEngine( 0 ),
+ mPermanentData( 0 )
+{
+ TX_ENTRY
+ mMpEngine = MpEngine::instance();
+ mPermanentData = new MpPopupHandlerPermanentData( this );
+ TX_EXIT
+}
+
+/*!
+ Destructs the collection popup handler.
+ */
+MpCollectionPopupHandler::~MpCollectionPopupHandler()
+{
+ TX_ENTRY
+ delete mOutstandingPopup;
+ TX_EXIT
+}
+
+/*!
+ Default view context menu.
+ */
+void MpCollectionPopupHandler::openDefaultViewContextMenu( int index, const QPointF &coords )
+{
+ TX_ENTRY
+ HbMenu *contextMenu = 0;
+ HbAction *action;
+ bool usbBlocked = mMpEngine->verifyUsbBlocking();
+
+ switch ( mMpEngine->collectionData()->context() ) {
+ case ECollectionContextAllSongs:
+ case ECollectionContextArtistSongs:
+ case ECollectionContextAlbumSongs:
+ contextMenu = new HbMenu();
+ action = contextMenu->addAction( hbTrId( "txt_common_menu_play_music" ) );
+ action->setObjectName( "open" );
+ action = contextMenu->addAction( hbTrId( "txt_mus_menu_add_to_playlist" ) );
+ action->setObjectName( "add" );
+ action->setEnabled( !usbBlocked );
+ action = contextMenu->addAction( hbTrId( "txt_common_menu_delete" ) );
+ action->setObjectName( "delete" );
+ action->setEnabled( !usbBlocked );
+ break;
+ case ECollectionContextAlbums:
+ case ECollectionContextArtists:
+ case ECollectionContextArtistAlbums:
+ contextMenu = new HbMenu();
+ action = contextMenu->addAction( hbTrId( "txt_common_menu_open" ) );
+ action->setObjectName( "open" );
+ action = contextMenu->addAction( hbTrId( "txt_mus_menu_add_to_playlist" ) );
+ action->setObjectName( "add" );
+ action->setEnabled( !usbBlocked );
+ action = contextMenu->addAction( hbTrId( "txt_common_menu_delete" ) );
+ action->setObjectName( "delete" );
+ action->setEnabled( !usbBlocked );
+ break;
+ case ECollectionContextPlaylists:
+ if ( !mMpEngine->collectionData()->isAutoPlaylist( index ) ) {
+ contextMenu = new HbMenu();
+ action = contextMenu->addAction( hbTrId( "txt_common_menu_open" ) );
+ action->setObjectName( "open" );
+ action = contextMenu->addAction( hbTrId( "txt_common_menu_delete" ) );
+ action->setObjectName("delete");
+ action->setEnabled( !usbBlocked );
+ action = contextMenu->addAction( hbTrId( "txt_common_menu_rename_item" ) );
+ action->setObjectName( "rename playlist" );
+ action->setEnabled( !usbBlocked );
+ }
+ break;
+ case ECollectionContextPlaylistSongs:
+ if ( !mMpEngine->collectionData()->isAutoPlaylist() ) {
+ contextMenu = new HbMenu();
+ action = contextMenu->addAction( hbTrId( "txt_common_menu_play_music" ) );
+ action->setObjectName( "open" );
+ action = contextMenu->addAction( hbTrId( "txt_common_menu_remove" ) );
+ action->setObjectName( "delete" );
+ action->setEnabled( !usbBlocked );
+ }
+ break;
+ default:
+ break;
+ }
+
+ if ( contextMenu ) {
+ if ( mView->isActivated() ) {
+ mPermanentData->mContextMenuIndex = index;
+ contextMenu->setPreferredPos( coords );
+ contextMenu->setAttribute( Qt::WA_DeleteOnClose );
+ setOutstandingPopup( contextMenu );
+ contextMenu->open( this, SLOT( defaultContextMenuOptionSelected( HbAction* ) ) );
+ }
+ else {
+ delete contextMenu;
+ contextMenu = 0;
+ }
+ }
+
+ TX_EXIT
+}
+
+/*!
+ Fetch view context menu
+ */
+void MpCollectionPopupHandler::openFetchViewContextMenu( int index, const QPointF &coords )
+{
+ TX_ENTRY_ARGS( "index=" << index );
+
+ HbAction *action;
+ HbMenu *contextMenu = 0;
+
+ switch ( mMpEngine->collectionData()->context() ) {
+ case ECollectionContextAllSongs:
+ case ECollectionContextArtistSongs:
+ case ECollectionContextAlbumSongs:
+ case ECollectionContextPlaylistSongs:
+ case ECollectionContextGenreSongs:
+ contextMenu = new HbMenu();
+ action = contextMenu->addAction( hbTrId("txt_common_menu_play_music") );
+ action->setEnabled( mMpEngine->verifyUsbBlocking() );
+ break;
+ default:
+ break;
+ }
+
+ if ( contextMenu ) {
+ if ( mView->isActivated() ) {
+ mPermanentData->mContextMenuIndex = index;
+ contextMenu->setPreferredPos( coords );
+ contextMenu->setAttribute( Qt::WA_DeleteOnClose );
+ setOutstandingPopup( contextMenu );
+ contextMenu->open( this, SLOT( fetcherContextMenuOptionSelected( HbAction* ) ) );
+ }
+ else {
+ delete contextMenu;
+ contextMenu = 0;
+ }
+ }
+
+ TX_EXIT
+}
+
+/*!
+ Request a string to rename the playlist container.
+ */
+void MpCollectionPopupHandler::openRenamePlaylistContainerDialog( const QString ¤tName )
+{
+ TX_ENTRY_ARGS( "Current name=" << currentName );
+ mPermanentData->mOriginalName = currentName;
+ getText( hbTrId( "txt_mus_dialog_enter_name" ), currentName,
+ SLOT( handleRenamePlaylistContainer( HbAction* ) ) );
+ TX_EXIT
+}
+
+/*!
+ Request a string to rename the playlist item.
+ */
+void MpCollectionPopupHandler::openRenamePlaylistItemDialog( const QString ¤tName )
+{
+ TX_ENTRY_ARGS( "Current name=" << currentName );
+ mPermanentData->mOriginalName = currentName;
+ getText( hbTrId( "txt_mus_dialog_enter_name" ), currentName,
+ SLOT( handleRenamePlaylistItem( HbAction* ) ) );
+ TX_EXIT
+}
+
+/*!
+ Request to select songs to add to the playlist
+ */
+void MpCollectionPopupHandler::openAddSongsToPlaylist( QAbstractItemModel* model )
+{
+ TX_ENTRY
+ getModelIndexes( hbTrId( "txt_mus_title_select_songs" ), model,
+ SLOT( handleAddSongsToPlayList( HbAction* ) ) );
+ TX_EXIT
+}
+
+/*!
+ Request to select songs to be deleted
+ */
+void MpCollectionPopupHandler::openDeleteSongs( QAbstractItemModel* model )
+{
+ TX_ENTRY
+ getModelIndexes( hbTrId( "txt_mus_title_select_songs" ), model,
+ SLOT( handleDeleteSongs( HbAction* ) ) );
+ TX_EXIT
+}
+
+/*!
+ Request to select songs to be added to the current play list
+ */
+void MpCollectionPopupHandler::openAddToCurrentPlaylist( MpMpxCollectionData* collectionData )
+{
+ TX_ENTRY
+ mPermanentData->mIsolatedCollectionData = collectionData;
+ MpCollectionDataModel *collectionDataModel;
+ collectionDataModel = new MpCollectionDataModel( collectionData );
+ collectionDataModel->refreshModel();
+
+ getModelIndexes( hbTrId( "txt_mus_title_select_songs" ), collectionDataModel,
+ SLOT( handleAddToCurrentPlaylist( HbAction* ) ) );
+ TX_EXIT
+}
+
+/*!
+ Request to create a new play list and then add songs to it.
+ */
+void MpCollectionPopupHandler::openCreateNewPlaylist( MpMpxCollectionData* collectionData )
+{
+ TX_ENTRY
+ mPermanentData->mIsolatedCollectionData = collectionData;
+
+ MpCollectionDataModel *collectionDataModel;
+ collectionDataModel = new MpCollectionDataModel( collectionData );
+ collectionDataModel->refreshModel();
+ mPermanentData->mAbstractItemModel = collectionDataModel;
+
+ QStringList playlists;
+ mMpEngine->findPlaylists( playlists );
+ queryNewPlaylistName( playlists, SLOT( handleCreateNewPlaylistGetTextFinished( HbAction* ) ) );
+ TX_EXIT
+}
+
+/*!
+ Request to reorder songs
+ */
+void MpCollectionPopupHandler::openArrangeSongs( MpMpxCollectionData* collectionData )
+{
+ TX_ENTRY
+ launchArrangeSongsDialog( collectionData );
+ TX_EXIT
+}
+
+/*!
+ Closes any active popup
+ */
+void MpCollectionPopupHandler::cancelOngoingPopup()
+{
+ TX_ENTRY
+ if ( mOutstandingPopup ) {
+ mOutstandingPopup->close();
+
+ //Delete/Clear permanent data until current popup gets deleted
+ mPermanentData->setParent( mOutstandingPopup );
+ //Generate new permanent data for future popups
+ mPermanentData = new MpPopupHandlerPermanentData( this );
+ }
+ else {
+ mPermanentData->clear();
+ }
+
+ TX_EXIT
+}
+
+/*!
+ TODO: Workaround for HbListView multiple events: longPress and activated. Remove once HbListView get fixed (wk16)
+ */
+bool MpCollectionPopupHandler::showingPopup()
+{
+ return mOutstandingPopup;
+}
+
+/*!
+ Slot to be called when an option has been selected from default context menu.
+ */
+void MpCollectionPopupHandler::defaultContextMenuOptionSelected( HbAction *selectedAction )
+{
+ TX_ENTRY
+ if ( selectedAction ) {
+ QString objectName = selectedAction->objectName();
+ QList<int> selection;
+ selection.append( mPermanentData->mContextMenuIndex );
+ if ( objectName == "open" ) {
+ mView->openItem( mPermanentData->mContextMenuIndex );
+ }
+ if ( objectName == "add" ) {
+ launchAddToPlaylistDialog( selection );
+ }
+ else if ( objectName == "delete" ) {
+ requestDelete( selection );
+ }
+ else if ( objectName == "rename playlist" ) {
+ QString currentName;
+ currentName = mMpEngine->collectionData()->itemData(
+ mPermanentData->mContextMenuIndex, MpMpxCollectionData::Title );
+ openRenamePlaylistItemDialog( currentName );
+ }
+ }
+ TX_EXIT
+}
+
+/*!
+ Slot to be called when play option has been selected from fetcher context menu.
+ */
+void MpCollectionPopupHandler::fetcherContextMenuOptionSelected( HbAction *selectedAction )
+{
+ TX_ENTRY
+ if ( selectedAction ) {
+ // Start the playback process. View will switch to playbackview.
+ mMpEngine->previewItem( mPermanentData->mContextMenuIndex );
+ }
+ TX_EXIT
+}
+
+/*!
+ Slot to be called when AddToPlaylist dialog has finished
+ */
+void MpCollectionPopupHandler::handleAddToPlaylistDialogFinished( HbAction *selectedAction )
+{
+ TX_ENTRY
+ HbSelectionDialog *dialog = qobject_cast<HbSelectionDialog *>( sender() );
+ clearOutstandingPopup( dialog );
+ bool operationCompleted( true );
+
+ if ( selectedAction ) {
+ QString objectName = selectedAction->objectName();
+ if ( objectName == "new" ) {
+ QStringList playlists;
+ mMpEngine->findPlaylists( playlists );
+ queryNewPlaylistName( playlists, SLOT( handleAddToPlaylistGetTextFinished( HbAction* ) ) );
+ operationCompleted = false;
+ }
+ }
+ else if ( dialog->selectedItems().count() ) {//this only works for SingleSelection
+ // User selected existing playlist.
+ mMpEngine->saveToPlaylist( dialog->selectedItems().at( 0 ).toInt(), mPermanentData->mSelectedItems );
+ }
+
+ if ( operationCompleted ) {
+ mPermanentData->clear();
+ }
+ TX_EXIT
+}
+
+/*!
+ Slot to be called when input dialog (getText) has finished, comming from AddToPlayList.
+ */
+void MpCollectionPopupHandler::handleAddToPlaylistGetTextFinished( HbAction *selectedAction )
+{
+ TX_ENTRY
+ HbInputDialog *dialog = qobject_cast<HbInputDialog *>( sender() );
+ clearOutstandingPopup( dialog );
+ bool operationCompleted( true );
+
+ if ( selectedAction ) {
+ QString objectName = selectedAction->objectName();
+ if ( objectName == "ok" ) {
+ QString newPlaylistName = dialog->value().toString();
+ if ( newPlaylistName.length() ) {
+ //Create new playlist with given name
+ mMpEngine->createPlaylist( newPlaylistName, mPermanentData->mSelectedItems );
+ }
+ else {
+ //No valid name, prompt for one again.
+ getText( hbTrId( "txt_mus_dialog_enter_name" ), newPlaylistName,
+ SLOT( handleAddToPlaylistGetTextFinished( HbAction* ) ) );
+ operationCompleted = false;
+ }
+ }
+ else {
+ // user decided to not provide a new name, go back to playlist list selection
+ QStringList playlists;
+ mMpEngine->findPlaylists( playlists );
+ if ( playlists.count() ) {
+ //are saved playlists, back to playlist selection dialog
+ launchAddToPlaylistDialog( mPermanentData->mSelectedItems );
+ operationCompleted = false;
+ }
+ }
+ }
+
+ if ( operationCompleted ) {
+ mPermanentData->clear();
+ }
+ TX_EXIT
+}
+
+/*!
+ Slot to be called when input dialog (getText) has finished, comming from RenamePlaylistContainer.
+ */
+void MpCollectionPopupHandler::handleRenamePlaylistContainer( HbAction *selectedAction )
+{
+ TX_ENTRY
+ HbInputDialog *dialog = qobject_cast<HbInputDialog *>( sender() );
+ clearOutstandingPopup( dialog );
+ bool operationCompleted( true );
+
+ if ( selectedAction ) {
+ QString objectName = selectedAction->objectName();
+ if ( objectName == "ok" ) {
+ QString newPlaylistName = dialog->value().toString();
+ if ( newPlaylistName.length() ) {
+ if ( newPlaylistName != mPermanentData->mOriginalName ) {
+ mMpEngine->renamePlaylist( newPlaylistName );
+ }
+ }
+ else {
+ //No valid name, prompt for one again.
+ getText( hbTrId( "txt_mus_dialog_enter_name" ), newPlaylistName,
+ SLOT( handleRenamePlaylistContainer( HbAction* ) ) );
+ operationCompleted = false;
+ }
+ }
+ }
+
+ if ( operationCompleted ) {
+ mPermanentData->clear();
+ }
+ TX_EXIT
+}
+
+/*!
+ Slot to be called when input dialog (getText) has finished, comming from RenamePlaylist ContextMenu.
+ */
+void MpCollectionPopupHandler::handleRenamePlaylistItem( HbAction *selectedAction )
+{
+ TX_ENTRY
+ HbInputDialog *dialog = qobject_cast<HbInputDialog *>( sender() );
+ clearOutstandingPopup( dialog );
+ bool operationCompleted( true );
+
+ if ( selectedAction ) {
+ QString objectName = selectedAction->objectName();
+ if ( objectName == "ok" ) {
+ QString newPlaylistName = dialog->value().toString();
+ if ( newPlaylistName.length() ) {
+ if ( newPlaylistName != mPermanentData->mOriginalName ) {
+ mMpEngine->renamePlaylist( newPlaylistName, mPermanentData->mContextMenuIndex );
+ }
+ }
+ else {
+ //No valid name, prompt for one again.
+ getText( hbTrId( "txt_mus_dialog_enter_name" ), newPlaylistName,
+ SLOT( handleRenamePlaylistItem( HbAction* ) ) );
+ operationCompleted = false;
+ }
+ }
+ }
+
+ if ( operationCompleted ) {
+ mPermanentData->clear();
+ }
+ TX_EXIT
+}
+
+/*!
+ Slot to be called when select songs dialog (getModelIndexes) has finished, coming from AddSongsToPlayList.
+ */
+void MpCollectionPopupHandler::handleAddSongsToPlayList( HbAction *selectedAction )
+{
+ TX_ENTRY
+ HbSelectionDialog *dialog = qobject_cast<HbSelectionDialog *>( sender() );
+ clearOutstandingPopup( dialog );
+
+ if ( selectedAction ) {
+ QString objectName = selectedAction->objectName();
+ if ( objectName == "ok" ) {
+ QModelIndexList selectedModelIndexes;
+ selectedModelIndexes = dialog->selectedModelIndexes();
+ if ( selectedModelIndexes.count() ) {
+ QList<int> selection;
+ for ( int i = 0; i < selectedModelIndexes.size(); ++i ) {
+ selection.append( selectedModelIndexes.at( i ).row() );
+ }
+ launchAddToPlaylistDialog( selection );
+ }
+ }
+ }
+
+ //Dialog is using CollectionView main model, avoid dialog destructor to alter it.
+ dialog->setModel( 0 );
+
+ TX_EXIT
+}
+
+/*!
+ Slot to be called when select songs dialog (getModelIndexes) has finished, coming from DeleteSongs.
+ */
+void MpCollectionPopupHandler::handleDeleteSongs( HbAction *selectedAction )
+{
+ TX_ENTRY
+ HbSelectionDialog *dialog = qobject_cast<HbSelectionDialog *>( sender() );
+ clearOutstandingPopup( dialog );
+
+ if ( selectedAction ) {
+ QString objectName = selectedAction->objectName();
+ if ( objectName == "ok" ) {
+ QModelIndexList selectedModelIndexes;
+ selectedModelIndexes = dialog->selectedModelIndexes();
+ if ( selectedModelIndexes.count() ) {
+ QList<int> selection;
+ for ( int i = 0; i < selectedModelIndexes.size(); ++i ) {
+ selection.append( selectedModelIndexes.at( i ).row() );
+ }
+ requestDelete( selection );
+ }
+ }
+ }
+
+ //Dialog is using CollectionView main model, avoid dialog destructor to alter it.
+ dialog->setModel( 0 );
+
+ TX_EXIT
+}
+
+/*!
+ Slot to be called when select songs dialog (getModelIndexes) has finished, coming from AddToCurrentPlaylist.
+ */
+void MpCollectionPopupHandler::handleAddToCurrentPlaylist( HbAction *selectedAction )
+{
+ TX_ENTRY
+ HbSelectionDialog *dialog = qobject_cast<HbSelectionDialog *>( sender() );
+ clearOutstandingPopup( dialog );
+
+ if ( selectedAction ) {
+ QString objectName = selectedAction->objectName();
+ if ( objectName == "ok" ) {
+ QModelIndexList selectedModelIndexes;
+ selectedModelIndexes = dialog->selectedModelIndexes();
+ if ( selectedModelIndexes.count() ) {
+ QList<int> selection;
+ for ( int i = 0; i < selectedModelIndexes.size(); ++i ) {
+ selection.append( selectedModelIndexes.at( i ).row() );
+ }
+ mMpEngine->saveToCurrentPlaylist( selection,
+ mPermanentData->mIsolatedCollectionData );
+ }
+ }
+ }
+
+ //Pull the model to delete it. Dialog destructor only removes items from model, but doesn't delete them.
+ mPermanentData->mAbstractItemModel = dialog->model();
+ dialog->setModel( 0 );
+
+ mPermanentData->clear();
+
+ TX_EXIT
+}
+
+/*!
+ Slot to be called when the input dialog (getText) has finished, comming from CreateNewPlaylist.
+ */
+void MpCollectionPopupHandler::handleCreateNewPlaylistGetTextFinished( HbAction *selectedAction )
+{
+ TX_ENTRY
+ HbInputDialog *dialog = qobject_cast<HbInputDialog *>( sender() );
+ clearOutstandingPopup( dialog );
+ bool operationCompleted( true );
+
+ if ( selectedAction ) {
+ QString objectName = selectedAction->objectName();
+ if ( objectName == "ok" ) {
+ QString newPlaylistName = dialog->value().toString();
+ if ( newPlaylistName.length() ) {
+ //Store the new playlist name and query for the items to be added
+ mPermanentData->mOriginalName = newPlaylistName;
+ getModelIndexes( hbTrId( "txt_mus_title_select_songs" ),
+ mPermanentData->mAbstractItemModel,
+ SLOT( handleCreateNewPlaylistGetModelIndexesFinished( HbAction* ) ) );
+ }
+ else {
+ //No valid name, prompt for one again.
+ getText( hbTrId( "txt_mus_dialog_enter_name" ), newPlaylistName,
+ SLOT( handleCreateNewPlaylistGetTextFinished( HbAction* ) ) );
+ }
+ operationCompleted = false;
+ }
+ }
+
+ if ( operationCompleted ) {
+ mPermanentData->clear();
+ }
+ TX_EXIT
+}
+
+/*!
+ Slot to be called when the select songs dialog (getModelIndexes) has finished, coming from CreateNewPlaylist-GetText.
+ */
+void MpCollectionPopupHandler::handleCreateNewPlaylistGetModelIndexesFinished( HbAction *selectedAction )
+{
+ TX_ENTRY
+ HbSelectionDialog *dialog = qobject_cast<HbSelectionDialog *>( sender() );
+ clearOutstandingPopup( dialog );
+
+ if ( selectedAction ) {
+ QString objectName = selectedAction->objectName();
+ if ( objectName == "ok" ) {
+ QList<int> selection;
+ QModelIndexList selectedModelIndexes;
+ selectedModelIndexes = dialog->selectedModelIndexes();
+ if ( selectedModelIndexes.count() ) {
+ for ( int i = 0; i < selectedModelIndexes.size(); ++i ) {
+ selection.append( selectedModelIndexes.at( i ).row() );
+ }
+ }
+ //Creating Playlist even when there is no selection.
+ mMpEngine->createPlaylist( mPermanentData->mOriginalName, selection,
+ mPermanentData->mIsolatedCollectionData );
+ }
+ }
+
+ dialog->setModel( 0 );
+
+ mPermanentData->clear();
+
+ TX_EXIT
+}
+
+/*!
+ Slot to be called when arrange songs dialog has finished.
+ */
+void MpCollectionPopupHandler::handleArrangeSongs( HbAction *selectedAction )
+{
+ TX_ENTRY
+ Q_UNUSED( selectedAction );
+ HbDialog *dialog = qobject_cast<HbDialog *>( sender() );
+ clearOutstandingPopup( dialog );
+
+ //Reopen the collection so the ordinals get fixed on the view list, if we
+ //delete items the index will not match to the item on the collection.
+ mMpEngine->reopenCollection();
+
+ TX_EXIT
+}
+
+/*!
+ Slot to be called when delete confirmation dialog has finished.
+ */
+void MpCollectionPopupHandler::handleRequestDelete( HbAction *selectedAction )
+{
+ TX_ENTRY
+ HbMessageBox *dialog = qobject_cast<HbMessageBox *>( sender() );
+ clearOutstandingPopup( dialog );
+
+ if ( selectedAction ) {
+ QString objectName = selectedAction->objectName();
+ if ( objectName == "ok" ) {
+ mMpEngine->deleteSongs( mPermanentData->mSelectedItems );
+ }
+ selectedAction->setEnabled( false );
+ }
+
+ mPermanentData->clear();
+
+ TX_EXIT
+}
+
+/*!
+ Slot to be called when a popup is getting closed. Usefull when a dialog is closed before it finishes
+ (dialog not closed by a direct user action).
+ */
+void MpCollectionPopupHandler::outstandingPopupClosing()
+{
+ TX_ENTRY
+ HbPopup *popup = qobject_cast<HbPopup *>( sender() );
+ if ( popup ) {
+ Q_ASSERT( popup == mOutstandingPopup );
+ mOutstandingPopup = 0;
+ }
+ TX_EXIT
+}
+
+/*!
+ \internal
+ sets \a popup as the current outstanding popup and cancels any other previous popup.
+ */
+void MpCollectionPopupHandler::setOutstandingPopup( HbPopup *popup )
+{
+ TX_ENTRY
+ if ( mOutstandingPopup ) {
+ TX_LOG_ARGS( "Warning: Multiple popups attempted to be displayed" );
+ mOutstandingPopup->close();
+ }
+
+ connect( popup, SIGNAL( aboutToClose() ), this, SLOT( outstandingPopupClosing() ) );
+ mOutstandingPopup = popup;
+ TX_EXIT
+}
+
+/*!
+ \internal
+ clears and disconnects \a popup. In some cases it's needed to open a new dialog when a current one has just finished.
+ */
+void MpCollectionPopupHandler::clearOutstandingPopup( HbPopup *popup )
+{
+ TX_ENTRY
+ disconnect( popup, SIGNAL( aboutToClose() ), this, SLOT( outstandingPopupClosing() ) );
+ mOutstandingPopup = 0;
+ TX_EXIT
+}
+
+/*!
+ \internal
+ Launches the 'Add to playlist' dialog.
+ */
+void MpCollectionPopupHandler::launchAddToPlaylistDialog( QList<int> &selection )
+{
+ TX_ENTRY
+ if (!mView->isActivated()) {
+ mPermanentData->clear();
+ return;
+ }
+
+ QStringList playlists;
+ mPermanentData->mSelectedItems = selection;
+ mMpEngine->findPlaylists( playlists );
+ if ( playlists.count() ) {
+ //There are saved playlists, query for a saved playlist or new.
+ HbAction *action;
+ HbSelectionDialog *dialog = new HbSelectionDialog();
+ dialog->setStringItems( playlists );
+ dialog->setSelectionMode( HbAbstractItemView::SingleSelection );
+ dialog->setHeadingWidget(new HbLabel( hbTrId( "txt_mus_title_select_playlist" ) ) );
+ dialog->clearActions();
+ action = new HbAction( hbTrId( "txt_mus_button_new" ) );
+ action->setObjectName( "new" );
+ dialog->addAction( action );
+ action = new HbAction( hbTrId( "txt_common_button_cancel" ) );
+ action->setObjectName( "cancel" );
+ dialog->addAction( action );
+ dialog->setAttribute( Qt::WA_DeleteOnClose );
+ setOutstandingPopup( dialog );
+ dialog->open( this, SLOT( handleAddToPlaylistDialogFinished( HbAction* ) ) );
+ }
+ else {
+ //querying for a new playlist name.
+ queryNewPlaylistName( playlists, SLOT( handleAddToPlaylistGetTextFinished( HbAction* ) ) );
+ }
+ TX_EXIT
+}
+
+/*!
+ \internal
+ Trigger an imput text dialog with a suggested playlist name.
+ uses \a playlists to generate a suggested playlist name
+ \handler Slot that should be called when input dialog finished
+ */
+void MpCollectionPopupHandler::queryNewPlaylistName(const QStringList &playlists,
+ const char *handler )
+{
+ TX_ENTRY
+ int i = 0;
+ for ( ;
+ playlists.contains( hbTrId( "txt_mus_dialog_enter_name_entry_playlist_l1" ).arg( i ) ) ;
+ i++ ) {};
+ QString suggestedPlaylistName = hbTrId( "txt_mus_dialog_enter_name_entry_playlist_l1" ).arg( i );
+ getText( hbTrId( "txt_mus_dialog_enter_name" ), suggestedPlaylistName, handler );
+ TX_EXIT
+}
+
+/*!
+ \internal
+ Launches an input text dialog.
+ \a label Dialog title.
+ \a text Suggested text.
+ \a handler Slot to be called when input dialog finishes.
+ */
+void MpCollectionPopupHandler::getText( const QString &label, const QString &text,
+ const char *handler )
+{
+ TX_ENTRY
+ if ( !mView->isActivated() ) {
+ mPermanentData->clear();
+ return;
+ }
+
+ HbAction *action;
+ HbInputDialog *dialog = new HbInputDialog();
+ dialog->setPromptText( label );
+ dialog->setInputMode( HbInputDialog::TextInput );
+ dialog->setValue( text );
+ dialog->clearActions();
+ action = new HbAction( hbTrId( "txt_common_button_ok" ) );
+ action->setObjectName( "ok" );
+ dialog->addAction( action );
+ action = new HbAction( hbTrId( "txt_common_button_cancel" ) );
+ action->setObjectName( "cancel" );
+ dialog->addAction( action );
+ dialog->setAttribute( Qt::WA_DeleteOnClose );
+ setOutstandingPopup( dialog );
+ dialog->open( this, handler );
+ TX_EXIT
+}
+
+/*!
+ \internal
+ Launches a list dialog to select items.
+ \a label Dialog title.
+ \a model List model.
+ \a handler Slot to be called when list dialog finishes.
+ */
+void MpCollectionPopupHandler::getModelIndexes( const QString &label, QAbstractItemModel* model,
+ const char *handler)
+{
+ TX_ENTRY
+
+ if ( !mView->isActivated() ) {
+ mPermanentData->clear();
+ return;
+ }
+
+ HbAction *action;
+ HbSelectionDialog *dialog = new HbSelectionDialog();
+ dialog->setHeadingWidget( new HbLabel( label ) );
+ dialog->setSelectionMode( HbAbstractItemView::MultiSelection );
+ dialog->setModel( model );
+ dialog->clearActions();
+ action = new HbAction( hbTrId( "txt_common_button_ok" ) );
+ action->setObjectName( "ok" );
+ dialog->addAction( action );
+ action = new HbAction( hbTrId( "txt_common_button_cancel" ) );
+ action->setObjectName( "cancel" );
+ dialog->addAction( action );
+ dialog->setAttribute( Qt::WA_DeleteOnClose );
+ setOutstandingPopup( dialog );
+ dialog->open( this, handler );
+
+ TX_EXIT
+}
+
+/*!
+ \internal
+ Launches a list dialog to reorder them.
+ \a collectionData Base to generate dialog's model.
+ */
+void MpCollectionPopupHandler::launchArrangeSongsDialog( MpMpxCollectionData* collectionData )
+{
+ TX_ENTRY
+
+ if ( !mView->isActivated() ) {
+ return;
+ }
+
+ HbListView *listView = new HbListView();
+ listView->setItemRecycling( true );
+ listView->setScrollingStyle( HbListView::PanOrFlick );
+ listView->setClampingStyle( HbListView::BounceBackClamping );
+ HbScrollBar *scrollbar = listView->verticalScrollBar();
+ scrollbar->show();
+ scrollbar->setInteractive( true);
+ listView->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAsNeeded);
+ MpCollectionDataModel *model;
+ //Ownership of the model is passed to the listView as a child object.
+ model = new MpCollectionDataModel( collectionData, listView );
+ model->refreshModel();
+ connect( model,
+ SIGNAL( orderChanged( int, int, int, int ) ),
+ mMpEngine,
+ SLOT( reorderPlaylist( int, int, int, int ) ) );
+ listView->setModel( model );
+ listView->setArrangeMode( true );
+ HbDialog *dialog = new HbDialog();
+ dialog->setDismissPolicy( HbPopup::NoDismiss );
+ dialog->setTimeout( HbPopup::NoTimeout );
+
+ HbLabel *label = new HbLabel( hbTrId( "txt_mus_title_arrange" ) );
+ dialog->setHeadingWidget( label );
+ dialog->setContentWidget( listView );
+ dialog->clearActions();
+ HbAction *action;
+ action = new HbAction( hbTrId( "txt_common_button_ok" ) );
+ dialog->addAction( action );
+ dialog->setAttribute( Qt::WA_DeleteOnClose );
+ setOutstandingPopup(dialog);
+ dialog->open( this, SLOT( handleArrangeSongs( HbAction* ) ) );
+
+ TX_EXIT
+}
+
+/*!
+ \internal
+ Request a delete operation always it has been confirmed.
+ \a selection Items selected to be deleted.
+ */
+void MpCollectionPopupHandler::requestDelete( QList<int> &selection )
+{
+ TX_ENTRY
+ QString message;
+ mPermanentData->mSelectedItems = selection;
+ bool needsConfirmation = true;
+
+ switch ( mMpEngine->collectionData()->context() ) {
+ case ECollectionContextAllSongs:
+ case ECollectionContextArtistSongs:
+ case ECollectionContextAlbumSongs:
+ message = hbTrId( "txt_mus_delete_song" );
+ break;
+ case ECollectionContextArtists:
+ message = hbTrId( "txt_mus_delete_artist" );
+ break;
+ case ECollectionContextAlbums:
+ case ECollectionContextArtistAlbums:
+ message = hbTrId( "txt_mus_delete_album" );
+ break;
+ case ECollectionContextPlaylists:
+ message = hbTrId( "txt_mus_delete_playlist" );
+ break;
+ case ECollectionContextPlaylistSongs:
+ case ECollectionContextGenres:
+ case ECollectionContextGenreSongs:
+ needsConfirmation = false;
+ mMpEngine->deleteSongs( mPermanentData->mSelectedItems );
+ mPermanentData->clear();
+ break;
+ case ECollectionContextUnknown:
+ default:
+ // We shouldn't be here
+ needsConfirmation = false;
+ mPermanentData->clear();
+ TX_LOG_ARGS( "Invalid Collection Context" );
+ break;
+ }
+
+ if ( needsConfirmation ) {
+ if ( !mView->isActivated() ) {
+ mPermanentData->clear();
+ return;
+ }
+
+ HbAction *action;
+ HbMessageBox *dialog = new HbMessageBox( HbMessageBox::MessageTypeQuestion );
+
+ dialog->setText( message );
+ dialog->setTimeout( HbPopup::NoTimeout );
+ dialog->clearActions();
+ action = new HbAction( hbTrId( "txt_common_button_yes" ) );
+ action->setObjectName( "ok" );
+ dialog->addAction( action );
+ action = new HbAction( hbTrId( "txt_common_button_no" ) );
+ action->setObjectName( "cancel" );
+ dialog->addAction( action );
+ dialog->setAttribute( Qt::WA_DeleteOnClose );
+ setOutstandingPopup( dialog );
+ dialog->open( this, SLOT( handleRequestDelete( HbAction* ) ) );
+ }
+
+ TX_EXIT
+}
+
+
+//------------------------------------------------------------------
+// MpPopupHandlerPermanentData
+//------------------------------------------------------------------
+/*!
+ Constructs the popup handler permanent data.
+ */
+MpCollectionPopupHandler::MpPopupHandlerPermanentData::MpPopupHandlerPermanentData( QObject *parent )
+ : QObject( parent ),
+ mIsolatedCollectionData( 0 ),
+ mAbstractItemModel( 0 ),
+ mContextMenuIndex( KNullIndex )
+{
+ TX_ENTRY
+ mSelectedItems.clear();
+ mOriginalName.clear();
+ TX_EXIT
+}
+
+/*!
+ Destructs the popup handler permanent data.
+ */
+MpCollectionPopupHandler::MpPopupHandlerPermanentData::~MpPopupHandlerPermanentData()
+{
+ TX_ENTRY
+ clear();
+ TX_EXIT
+}
+
+/*!
+ \internal
+ Clears all permanent data.
+ */
+void MpCollectionPopupHandler::MpPopupHandlerPermanentData::clear()
+{
+ TX_ENTRY
+ mSelectedItems.clear();
+ mOriginalName.clear();
+ mContextMenuIndex = KNullIndex;
+ if ( mIsolatedCollectionData ) {
+ MpEngine::instance()->releaseIsolatedCollection();
+ mIsolatedCollectionData = 0;
+ }
+ if ( mAbstractItemModel ) {
+ delete mAbstractItemModel;
+ mAbstractItemModel = 0;
+ }
+ TX_EXIT
+}
--- a/mpviewplugins/mpcollectionviewplugin/src/mpcollectionview.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpviewplugins/mpcollectionviewplugin/src/mpcollectionview.cpp Fri May 14 15:49:53 2010 +0300
@@ -26,8 +26,6 @@
#include <hbtoolbar.h>
#include <hbmenu.h>
#include <hbmessagebox.h>
-#include <hblistdialog.h>
-#include <hbinputdialog.h>
#include <hblabel.h>
#include <QTranslator>
#include <QLocale>
@@ -47,6 +45,7 @@
#include "mpsnapshotwidget.h"
#include "mpsettingsmanager.h"
#include "mpcollectionlistcontainer.h"
+#include "mpcollectionpopuphandler.h"
const char*MUSIC_COLLECTION_DOCML = ":/docml/musiccollection.docml";
@@ -55,7 +54,7 @@
const int KMainToolBarAll = 0;
const int KMainToolBarArtists = 1;
-
+const int KMainToolBarAlbums = 2;
const int KMainToolBarPlaylists = 3;
const int KPlaylistToolBarAdd = 0;
@@ -91,8 +90,8 @@
mActivated( false ),
mNowPlayingBanner( 0 ),
mBannerAttached( false ),
- mSoftKeyQuit( 0 ),
- mSoftKeyBack( 0 ),
+ mNavigationQuit( 0 ),
+ mNavigationBack( 0 ),
mDocumentLoader( 0 ),
mMainContainer( 0 ),
mMainToolBar( 0 ),
@@ -101,7 +100,7 @@
mMpTranslator( 0 ),
mCommonTranslator( 0 ),
mActivationWaiting( false ),
- mOutstandingPopup( 0 ),
+ mMpPopupHandler( 0 ),
mUsbBlocked( false )
{
TX_LOG
@@ -114,8 +113,8 @@
{
TX_ENTRY
delete mSnapshot;
- delete mSoftKeyQuit;
- delete mSoftKeyBack;
+ delete mNavigationQuit;
+ delete mNavigationBack;
HbToolBar *toolBar = takeToolBar();
if ( mMainToolBar != toolBar && mPlaylistToolBar != toolBar ) {
@@ -166,11 +165,11 @@
mWindow = mainWindow();
// Create softkey actions
- mSoftKeyQuit = new HbAction( Hb::QuitAction, this );
- connect( mSoftKeyQuit, SIGNAL( triggered() ), this, SLOT( back() ) );
+ mNavigationQuit = new HbAction( Hb::QuitNaviAction, this );
+ connect( mNavigationQuit, SIGNAL( triggered() ), this, SLOT( back() ) );
- mSoftKeyBack = new HbAction( Hb::BackAction, this );
- connect( mSoftKeyBack, SIGNAL( triggered() ), this, SLOT( back() ) );
+ mNavigationBack = new HbAction( Hb::BackNaviAction, this );
+ connect( mNavigationBack, SIGNAL( triggered() ), this, SLOT( back() ) );
mMpEngine = MpEngine::instance();
@@ -255,12 +254,14 @@
}
mContainerFactory = new MpCollectionContainerFactory( this, mDocumentLoader );
+
+ mMpPopupHandler = new MpCollectionPopupHandler( this );
connect( mMpEngine, SIGNAL( usbBlocked(bool) ),
this, SLOT( handleUsbBlocked(bool) ) );
- connect( mMpEngine, SIGNAL( libraryAboutToRefresh() ),
+ connect( mMpEngine, SIGNAL( libraryAboutToUpdate() ),
this, SLOT( handleLibraryAboutToUpdate() ) );
- connect( mMpEngine, SIGNAL( libraryRefreshed() ),
+ connect( mMpEngine, SIGNAL( libraryUpdated() ),
this, SLOT( handleLibraryUpdated() ) );
mUsbBlocked = mMpEngine->verifyUsbBlocking();
@@ -301,10 +302,7 @@
TX_ENTRY
mActivated = false;
- if ( mOutstandingPopup ) {
- mOutstandingPopup->close();
- }
- menu()->close();
+ cancelOngoingOperation();
setNavigationAction( 0 );
TX_EXIT
@@ -324,7 +322,27 @@
if ( mBannerAttached ) {
setBannerVisibility( false );
}
+ TX_EXIT
+}
+/*!
+ Returns view activation status.
+ */
+bool MpCollectionView::isActivated()
+{
+ TX_LOG_ARGS( "View activated = " << mActivated );
+ return mActivated;
+}
+
+/*!
+ Opens or plays an item through collection container in order to keep track of the Artist / Album data used by infobar.
+ */
+void MpCollectionView::openItem( int index )
+{
+ TX_ENTRY_ARGS( "index = " << index );
+ QModelIndex modelIndex;
+ modelIndex = mCollectionDataModel->index( index );
+ qobject_cast<MpCollectionListContainer*>(mCollectionContainer)->itemActivated( modelIndex );
TX_EXIT
}
@@ -371,6 +389,19 @@
void MpCollectionView::openArtists()
{
TX_ENTRY
+ if ( mCollectionContext != ECollectionContextArtists ) {
+ mMpEngine->openCollection( ECollectionContextArtists );
+ }
+ TX_EXIT
+}
+
+
+/*!
+ Slot to be called when 'Albums' action is triggered from the toolbar.
+ */
+void MpCollectionView::openAlbums()
+{
+ TX_ENTRY
if ( mCollectionContext != ECollectionContextAlbums ) {
mMpEngine->openCollection( ECollectionContextAlbums );
}
@@ -407,8 +438,9 @@
void MpCollectionView::find()
{
// Todo
- HbMessageBox messageBox( "Not ready!", HbMessageBox::MessageTypeInformation );
- messageBox.exec();
+ HbMessageBox *messageBox = new HbMessageBox( "Not ready!", HbMessageBox::MessageTypeInformation );
+ messageBox->setAttribute( Qt::WA_DeleteOnClose );
+ messageBox->show();
updateToolBar();
}
@@ -418,8 +450,9 @@
void MpCollectionView::openMusicStore()
{
// Todo
- HbMessageBox messageBox( "Not ready!", HbMessageBox::MessageTypeInformation );
- messageBox.exec();
+ HbMessageBox *messageBox = new HbMessageBox( "Not ready!", HbMessageBox::MessageTypeInformation );
+ messageBox->setAttribute( Qt::WA_DeleteOnClose );
+ messageBox->show();
updateToolBar();
}
@@ -434,6 +467,7 @@
QString songUri;
switch ( mCollectionContext ) {
case ECollectionContextAllSongs:
+ case ECollectionContextArtistSongs:
case ECollectionContextAlbumSongs:
case ECollectionContextPlaylistSongs:
case ECollectionContextGenreSongs:
@@ -446,7 +480,11 @@
}
}
if ( doOpen ) {
- mMpEngine->openCollectionItem( index );
+ // TODO: "if" used as workaround for HbListView multiple events: longPress and activated.
+ // Remove once HbListView get fixed (wk14 or 16)
+ if ( !mMpPopupHandler->showingPopup() ) {
+ mMpEngine->openCollectionItem( index );
+ }
}
TX_EXIT
}
@@ -460,6 +498,7 @@
bool doExit( false );
switch ( mCollectionContext ) {
case ECollectionContextAllSongs:
+ case ECollectionContextArtists:
case ECollectionContextAlbums:
case ECollectionContextPlaylists:
case ECollectionContextGenres:
@@ -467,6 +506,8 @@
doExit = true;
break;
case ECollectionContextAlbumSongs:
+ case ECollectionContextArtistAlbums:
+ case ECollectionContextArtistSongs:
case ECollectionContextPlaylistSongs:
case ECollectionContextGenreSongs:
mMpEngine->back();
@@ -559,21 +600,7 @@
*/
void MpCollectionView::addToPlaylist()
{
- if ( !mMpEngine->verifyUsbBlocking( true ) ) {
- QModelIndexList SelectedModelIndexes;
- bool ok;
- SelectedModelIndexes = getModelIndexes( hbTrId( "txt_mus_title_select_songs" ),
- mCollectionDataModel,
- ok);
-
- if ( ok && SelectedModelIndexes.count() ) {
- QList<int> selection;
- for ( int i = 0; i < SelectedModelIndexes.size(); ++i ) {
- selection.append( SelectedModelIndexes.at( i ).row() );
- }
- launchAddToPlaylistDialog( selection );
- }
- }
+ mMpPopupHandler->openAddSongsToPlaylist( mCollectionDataModel );
}
/*!
@@ -581,20 +608,7 @@
*/
void MpCollectionView::deleteSongs()
{
- QModelIndexList SelectedModelIndexes;
- bool ok;
- SelectedModelIndexes = getModelIndexes( hbTrId( "txt_mus_title_select_songs" ),
- mCollectionDataModel,
- ok);
-
- if ( ok && SelectedModelIndexes.count() ) {
- QList<int> selection;
- for ( int i = 0; i < SelectedModelIndexes.size(); ++i ) {
- selection.append( SelectedModelIndexes.at( i ).row() );
- }
- requestDelete( selection );
- updateMenu();
- }
+ mMpPopupHandler->openDeleteSongs( mCollectionDataModel );
}
/*!
@@ -602,16 +616,9 @@
*/
void MpCollectionView::renameCurrentPlaylistContainer()
{
- if ( !mMpEngine->verifyUsbBlocking( true ) ) {
- QString currentName;
- currentName = mCollectionData->collectionTitle();
- bool ok = false;
- QString newName;
- newName = getText( hbTrId( "txt_mus_dialog_enter_name" ), currentName, ok );
- if ( ok && ( currentName != newName ) ) {
- mMpEngine->renamePlaylist( newName );
- }
- }
+ QString currentName;
+ currentName = mCollectionData->collectionTitle();
+ mMpPopupHandler->openRenamePlaylistContainerDialog( currentName );
}
@@ -652,9 +659,7 @@
*/
void MpCollectionView::prepareToAddToPlaylist()
{
- TX_ENTRY
- //We dismiss dialogs here since after open is complete we are triggering a dialog.
- setOutstandingPopup( 0 );
+ TX_ENTRY
mMpEngine->openIsolatedCollection( ECollectionContextAllSongs );
TX_EXIT
}
@@ -665,115 +670,24 @@
void MpCollectionView::handleIsolatedCollectionOpened( MpMpxCollectionData* collectionData )
{
TX_ENTRY
- if ( mActivated && !mOutstandingPopup ) {
+ if ( mActivated ) {
if (ECollectionContextPlaylistSongs == mCollectionContext) {
- addToCurrentPlaylist( collectionData );
+ mMpPopupHandler->openAddToCurrentPlaylist( collectionData );
}
else if (ECollectionContextPlaylists == mCollectionContext) {
- createNewPlaylist( collectionData );
+ mMpPopupHandler->openCreateNewPlaylist( collectionData );
}
}
- //Playlist is saved asynchronosly by the default collection, it is OK to release now.
- mMpEngine->releaseIsolatedCollection();
TX_EXIT
}
-
-/*!
- Slot to be called to add items to current playlist.
- */
-void MpCollectionView::addToCurrentPlaylist( MpMpxCollectionData* collectionData )
-{
- MpCollectionDataModel *collectionDataModel;
- collectionDataModel = new MpCollectionDataModel( collectionData );
- collectionDataModel->refreshModel();
- QModelIndexList SelectedModelIndexes;
- bool ok;
- SelectedModelIndexes = getModelIndexes( hbTrId( "txt_mus_title_select_songs" ),
- collectionDataModel,
- ok);
-
- if ( ok && SelectedModelIndexes.count() ) {
- QList<int> selection;
- for ( int i = 0; i < SelectedModelIndexes.size(); ++i ) {
- selection.append( SelectedModelIndexes.at( i ).row() );
- }
- mMpEngine->saveToCurrentPlaylist( selection, collectionData );
- }
- delete collectionDataModel;
-}
-
-/*!
- Slot to be called to add items to new playlist.
- */
-void MpCollectionView::createNewPlaylist( MpMpxCollectionData* collectionData )
-{
- MpCollectionDataModel *collectionDataModel;
- collectionDataModel = new MpCollectionDataModel( collectionData );
- collectionDataModel->refreshModel();
-
- QString newPlaylistName;
- bool ok;
- QStringList playlists;
- mMpEngine->findPlaylists( playlists );
- ok = queryNewPlaylistName(newPlaylistName , playlists);
- if ( ok ) {
- QModelIndexList SelectedModelIndexes;
- SelectedModelIndexes = getModelIndexes( hbTrId( "txt_mus_title_select_songs" ),
- collectionDataModel,
- ok);
- QList<int> selection;
- if ( ok && SelectedModelIndexes.count() ) {
- for ( int i = 0; i < SelectedModelIndexes.size(); ++i ) {
- selection.append( SelectedModelIndexes.at( i ).row() );
- }
- }
- //Creating Playlist even when there is no selection.
- mMpEngine->createPlaylist( newPlaylistName, selection, collectionData );
- }
- delete collectionDataModel;
-}
-
/*!
Slot to be called to arrange songs in a playlist.
*/
void MpCollectionView::arrangeSongs( )
{
- HbListView *listView = new HbListView();
- listView->setItemRecycling(true);
- listView->setScrollingStyle( HbListView::PanOrFlick );
- listView->setClampingStyle( HbListView::BounceBackClamping );
- HbScrollBar *scrollbar = listView->verticalScrollBar();
- scrollbar->show();
- scrollbar->setInteractive(true);
- listView->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAsNeeded);
- MpCollectionDataModel *model;
- //Ownership of the model is passed to the listView as a child object.
- model = new MpCollectionDataModel( mCollectionData, listView );
- model->refreshModel();
- connect( model,
- SIGNAL( orderChanged( int, int, int, int ) ),
- mMpEngine,
- SLOT( reorderPlaylist( int, int, int, int ) ) );
- listView->setModel( model );
- listView->setArrangeMode( true );
- HbDialog *popup = new HbDialog();
- popup->setAttribute( Qt::WA_DeleteOnClose );
- popup->setDismissPolicy( HbPopup::NoDismiss );
- popup->setTimeout( HbPopup::NoTimeout );
-
- HbLabel *label = new HbLabel( hbTrId( "txt_mus_title_arrange" ) );
- popup->setHeadingWidget( label );
- popup->setContentWidget( listView );
- popup->setPrimaryAction( new HbAction( hbTrId( "txt_common_button_ok" ), popup ) );
- popup->setModal( true );
- connect( popup, SIGNAL( aboutToClose() ), this, SLOT( outstandingPopupClosing() ) );
- //Reopen the collection so the ordinals get fixed on the view list, if we
- //delete items the index will not match to the item on the collection.
- connect( popup, SIGNAL( aboutToClose() ), mMpEngine, SLOT( reopenCollection() ) );
- setOutstandingPopup(popup);
- popup->show();
+ mMpPopupHandler->openArrangeSongs( mCollectionData );
}
/*!
@@ -784,10 +698,10 @@
TX_ENTRY_ARGS( "index=" << index );
switch ( mViewMode ) {
case MpCommon::DefaultView:
- openDefaultViewContextMenu( index, coords );
+ mMpPopupHandler->openDefaultViewContextMenu( index, coords );
break;
case MpCommon::FetchView:
- openFetchViewContextMenu( index, coords );
+ mMpPopupHandler->openFetchViewContextMenu( index, coords );
break;
default:
break;
@@ -796,29 +710,14 @@
}
/*!
- Slot to be called when a dialog is about to close.
- */
-void MpCollectionView::outstandingPopupClosing()
-{
- HbPopup *popup = qobject_cast<HbPopup *>( sender() );
- if ( popup ) {
- Q_ASSERT( popup != mOutstandingPopup );
- mOutstandingPopup = 0;
- }
-}
-
-/*!
Slot to be called when USB blocking status changes.
*/
void MpCollectionView::handleUsbBlocked( bool blocked )
{
TX_ENTRY_ARGS( "blocked=" << blocked );
mUsbBlocked = blocked;
-
- if ( mActivated && mUsbBlocked && mOutstandingPopup ) {
- mOutstandingPopup->close();
- mMpEngine->verifyUsbBlocking( true );
- }
+
+ cancelOngoingOperation();
updateMenu();
if ( mCollectionContext == ECollectionContextPlaylistSongs ) {
@@ -833,13 +732,7 @@
void MpCollectionView::handleLibraryAboutToUpdate()
{
TX_ENTRY
-
- if ( mActivated ) {
- if ( mOutstandingPopup ) {
- mOutstandingPopup->close();
- }
- menu()->close();
- }
+ cancelOngoingOperation();
TX_EXIT
}
@@ -854,141 +747,16 @@
activateView();
}
else {
+ cancelOngoingOperation();
+
//Update cache, even if collection is in background.
- //Library refreshing could be triggered at any point due USB connect./disconnect.
+ //Library refreshing could be triggered at any point due USB/MMC events.
mMpEngine->reopenCollection();
}
TX_EXIT
}
/*!
- Default view context menu.
- */
-void MpCollectionView::openDefaultViewContextMenu( int index, const QPointF &coords )
-{
- HbMenu *contextMenu = 0;
- HbAction *action;
- switch ( mCollectionContext ) {
- case ECollectionContextAllSongs:
- case ECollectionContextAlbumSongs:
- contextMenu = new HbMenu();
- action = contextMenu->addAction( hbTrId( "txt_common_menu_play_music" ) );
- action->setObjectName( "play" );
- action = contextMenu->addAction( hbTrId( "txt_mus_menu_add_to_playlist" ) );
- action->setObjectName( "add" );
- action->setEnabled( !mUsbBlocked );
- action = contextMenu->addAction( hbTrId( "txt_common_menu_delete" ) );
- action->setObjectName( "delete" );
- action->setEnabled( !mUsbBlocked );
- break;
- case ECollectionContextAlbums:
- contextMenu = new HbMenu();
- action = contextMenu->addAction( hbTrId( "txt_common_menu_open" ) );
- action->setObjectName( "open" );
- action = contextMenu->addAction( hbTrId( "txt_mus_menu_add_to_playlist" ) );
- action->setObjectName( "add" );
- action->setEnabled( !mUsbBlocked );
- action = contextMenu->addAction( hbTrId( "txt_common_menu_delete" ) );
- action->setObjectName( "delete" );
- action->setEnabled( !mUsbBlocked );
- break;
- case ECollectionContextPlaylists:
- if ( !mCollectionData->isAutoPlaylist( index ) ) {
- contextMenu = new HbMenu();
- action = contextMenu->addAction( hbTrId( "txt_common_menu_open" ) );
- action->setObjectName( "open" );
- action = contextMenu->addAction( hbTrId( "txt_common_menu_delete" ) );
- action->setObjectName("delete");
- action->setEnabled( !mUsbBlocked );
- action = contextMenu->addAction( hbTrId( "txt_common_menu_rename_item" ) );
- action->setObjectName( "rename playlist" );
- action->setEnabled( !mUsbBlocked );
- }
- break;
- case ECollectionContextPlaylistSongs:
- if ( !mCollectionData->isAutoPlaylist() ) {
- contextMenu = new HbMenu();
- action = contextMenu->addAction( hbTrId( "txt_common_menu_play_music" ) );
- action->setObjectName( "play" );
- action = contextMenu->addAction( hbTrId( "txt_common_menu_remove" ) );
- action->setObjectName( "delete" );
- action->setEnabled( !mUsbBlocked );
- }
- break;
- default:
- break;
- }
-
- if ( contextMenu ) {
- setOutstandingPopup( contextMenu );
- HbAction *selectedAction = mActivated ? contextMenu->exec( coords ) : 0;
- setOutstandingPopup( 0 );
- if ( selectedAction ) {
- QString objectName = selectedAction->objectName();
- QList<int> selection;
- selection.append( index );
- if ( objectName == "open" || objectName == "play" ) {
- QModelIndex modelIndex;
- modelIndex = mCollectionDataModel->index(index);
- qobject_cast<MpCollectionListContainer*>(mCollectionContainer)->itemActivated( modelIndex );
- }
- else if ( !mMpEngine->verifyUsbBlocking( true ) ) {
- if ( objectName == "add" ) {
- launchAddToPlaylistDialog( selection );
- }
- else if ( objectName == "delete" ) {
- requestDelete( selection );
- }
- else if ( objectName == "rename playlist" ) {
- QString currentName;
- currentName = mCollectionData->itemData( index, MpMpxCollectionData::Title );
- bool ok = false;
- QString newName;
- newName = getText( hbTrId("txt_mus_dialog_enter_name" ), currentName, ok );
- if ( ok && ( currentName != newName ) ) {
- mMpEngine->renamePlaylist( newName, index );
- }
- }
- }
- }
- }
- contextMenu->deleteLater();
- TX_EXIT
-}
-
-/*!
- Fetch view context menu
- */
-void MpCollectionView::openFetchViewContextMenu( int index, const QPointF &coords )
-{
- TX_ENTRY_ARGS( "index=" << index );
-
- HbMenu *contextMenu = 0;
- switch ( mCollectionContext ) {
- case ECollectionContextAllSongs:
- case ECollectionContextAlbumSongs:
- case ECollectionContextPlaylistSongs:
- case ECollectionContextGenreSongs:
- contextMenu = new HbMenu();
- contextMenu->addAction( hbTrId("txt_common_menu_play_music") );
- break;
- default:
- break;
- }
-
- if ( contextMenu ) {
- setOutstandingPopup( contextMenu );
- if ( mActivated ? contextMenu->exec( coords ) : 0 ) {
- // Start the playback process. View will switch to playbackview.
- mMpEngine->previewItem( index );
- }
- setOutstandingPopup( 0 );
- }
- contextMenu->deleteLater();
- TX_EXIT
-}
-
-/*!
\internal
Sets the main ( default ) toolbar for the view.
*/
@@ -1006,10 +774,15 @@
action = createToolBarAction( actionsGroup, "qtg_mono_songs_all" );
connect( action, SIGNAL( triggered( bool ) ), this, SLOT( openSongs() ) );
mMainToolBar->addAction( action );
+
+ // Artists
+ action = createToolBarAction( actionsGroup, "qtg_mono_artists" );
+ connect( action, SIGNAL( triggered( bool ) ), this, SLOT( openArtists() ) );
+ mMainToolBar->addAction( action );
// Albums
- action = createToolBarAction( actionsGroup, "qtg_mono_artists_albums" );
- connect( action, SIGNAL( triggered( bool ) ), this, SLOT( openArtists() ) );
+ action = createToolBarAction( actionsGroup, "qtg_mono_music_albums" );
+ connect( action, SIGNAL( triggered( bool ) ), this, SLOT( openAlbums() ) );
mMainToolBar->addAction( action );
// Playlists
@@ -1034,9 +807,13 @@
case ECollectionContextAllSongs:
action = qobject_cast<HbAction*>( mMainToolBar->actions()[KMainToolBarAll] );
break;
+ case ECollectionContextArtists:
+ case ECollectionContextArtistAlbums:
+ action = qobject_cast<HbAction*>( mMainToolBar->actions()[KMainToolBarArtists] );
+ break;
case ECollectionContextAlbums:
case ECollectionContextAlbumSongs:
- action = qobject_cast<HbAction*>( mMainToolBar->actions()[KMainToolBarArtists] );
+ action = qobject_cast<HbAction*>( mMainToolBar->actions()[KMainToolBarAlbums] );
break;
case ECollectionContextPlaylists:
case ECollectionContextPlaylistSongs:
@@ -1162,6 +939,18 @@
else {
menuAction->setDisabled( true );
}
+
+ connect( myMenu->addAction(hbTrId("txt_common_opt_exit")), SIGNAL(triggered()), this, SLOT(exit()) );
+ break;
+
+ case ECollectionContextArtists:
+ menuAction = myMenu->addAction( hbTrId( "txt_mus_opt_refresh_library" ) );
+ if ( !mUsbBlocked ) {
+ connect( menuAction, SIGNAL( triggered() ), this, SLOT( refreshLibrary() ) );
+ }
+ else {
+ menuAction->setDisabled( true );
+ }
connect( myMenu->addAction(hbTrId("txt_common_opt_exit")), SIGNAL(triggered()), this, SLOT(exit()) );
break;
case ECollectionContextAlbums:
@@ -1176,6 +965,7 @@
}
connect( myMenu->addAction(hbTrId("txt_common_opt_exit")), SIGNAL(triggered()), this, SLOT(exit()) );
break;
+ case ECollectionContextArtistSongs:
case ECollectionContextAlbumSongs:
menuAction = myMenu->addAction( hbTrId( "txt_mus_opt_add_to_playlist" ) );
if ( !mUsbBlocked ) {
@@ -1259,6 +1049,8 @@
setToolBar( new HbToolBar );
}
break;
+ case ECollectionContextArtistAlbums:
+ case ECollectionContextArtistSongs:
case ECollectionContextAlbumSongs:
case ECollectionContextGenreSongs:
if ( !toolBar()->actions().empty() ) {
@@ -1282,18 +1074,19 @@
if ( mViewMode == MpCommon::FetchView ) {
// 'Back' is used in all views in fetch mode because we must
// appear as an embedded application.
- setNavigationAction( mSoftKeyBack );
+ setNavigationAction( mNavigationBack );
}
else {
switch ( mCollectionContext ) {
case ECollectionContextAllSongs:
+ case ECollectionContextArtists:
case ECollectionContextAlbums:
case ECollectionContextPlaylists:
case ECollectionContextGenres:
- setNavigationAction( mSoftKeyQuit );
+ setNavigationAction( mNavigationQuit );
break;
default:
- setNavigationAction( mSoftKeyBack );
+ setNavigationAction( mNavigationBack );
break;
}
}
@@ -1340,58 +1133,6 @@
/*!
\internal
- Launches the 'Add to playlist' dialog.
- */
-void MpCollectionView::launchAddToPlaylistDialog( QList<int> &selection )
-{
- if (!mActivated) {
- return;
- }
- QString newPlaylistName;
- QStringList playlists;
- mMpEngine->findPlaylists( playlists );
- HbListDialog dialog;
- dialog.setStringItems( playlists );
- dialog.setSelectionMode( HbAbstractItemView::SingleSelection );
- dialog.setHeadingWidget(new HbLabel( hbTrId( "txt_mus_title_select_playlist" ) ) );
- dialog.setPrimaryAction(new HbAction( hbTrId( "txt_mus_button_new" ) ) );
- dialog.setSecondaryAction(new HbAction( hbTrId( "txt_common_button_cancel" ) ) );
-
- forever {
- if ( playlists.count() ) {
- //There are saved playlists, query for a saved playlist or new.
- setOutstandingPopup( &dialog );
- HbAction *selectedAction = mActivated ? dialog.exec() : 0;
- setOutstandingPopup( 0 );
- if ( selectedAction == dialog.primaryAction() ) {
- //User selected pimaryAction "new", fall trough to new playlyst query.
- }
- else if ( dialog.selectedItems().count() ) {//this only works for SingleSelection
- // User selected existing playlist, add songs and exit the loop.
- mMpEngine->saveToPlaylist( dialog.selectedItems().at( 0 ), selection );
- break;
- }
- else {
- //Cancel was pressed or dialog was closed or never executed, exit the loop.
- break;
- }
- }
- //querying for a new playlist name.
- if ( queryNewPlaylistName(newPlaylistName , playlists) ) {
- // user selected a new playlist, save and exit the loop.
- mMpEngine->createPlaylist( newPlaylistName, selection );
- break;
- }
- else if (!playlists.count()) {
- // user decided to not provide a new name and there are no saved playlists, exit the loop
- break;
- }
- // user decided to not provide a new name and there are saved playlists, back to the top.
- } //forever
-}
-
-/*!
- \internal
starts a transition of the main container with a decoy snapshot.
*/
void MpCollectionView::startContainerTransition( TCollectionContext contextFrom, TCollectionContext contextTo )
@@ -1408,6 +1149,9 @@
if ( ( contextFrom == ECollectionContextAlbums && contextTo == ECollectionContextAlbumSongs ) ||
+ ( contextFrom == ECollectionContextArtists && contextTo == ECollectionContextArtistAlbums ) ||
+ ( contextFrom == ECollectionContextArtistAlbums && contextTo == ECollectionContextAlbumSongs ) ||
+ ( contextFrom == ECollectionContextArtistAlbums && contextTo == ECollectionContextArtistSongs ) ||
( contextFrom == ECollectionContextPlaylists && contextTo == ECollectionContextPlaylistSongs ) ||
( contextFrom == ECollectionContextGenres && contextTo == ECollectionContextGenreSongs ) ) {
HbEffect::start( mSnapshot,
@@ -1425,6 +1169,9 @@
QString( "mainContainer_effect") );
}
else if( ( contextFrom == ECollectionContextAlbumSongs && contextTo == ECollectionContextAlbums ) ||
+ ( contextFrom == ECollectionContextArtistAlbums && contextTo == ECollectionContextArtists ) ||
+ ( contextFrom == ECollectionContextAlbumSongs && contextTo == ECollectionContextArtistAlbums ) ||
+ ( contextFrom == ECollectionContextArtistSongs && contextTo == ECollectionContextArtistAlbums ) ||
( contextFrom == ECollectionContextPlaylistSongs && contextTo == ECollectionContextPlaylists ) ||
( contextFrom == ECollectionContextGenreSongs && contextTo == ECollectionContextGenres ) ) {
HbEffect::start( mSnapshot,
@@ -1461,168 +1208,13 @@
/*!
\internal
- request a delete operation always it has been confirmed.
+ Closes any active dialog or menu.
*/
-void MpCollectionView::requestDelete( QList<int> &selection )
+void MpCollectionView::cancelOngoingOperation()
{
- bool confirmation( false );
- // Todo: Use HbMessageBox::question when time-out removed from it
- HbMessageBox dialog( HbMessageBox::MessageTypeQuestion );
-
- QString message;
- HbAction *action = 0;
-
- switch ( mCollectionContext ) {
- case ECollectionContextAllSongs:
- case ECollectionContextAlbumSongs:
- message = hbTrId( "txt_mus_delete_song" );
- dialog.setText( message );
- dialog.setTimeout( HbPopup::NoTimeout );
- setOutstandingPopup( &dialog );
- action = mActivated ? dialog.exec() : 0;
- setOutstandingPopup( 0 );
- if ( action && action == dialog.primaryAction() ) {
- confirmation = true;
- }
- break;
- case ECollectionContextAlbums:
- message = hbTrId( "txt_mus_delete_album" );
- dialog.setText( message );
- dialog.setTimeout( HbPopup::NoTimeout );
- setOutstandingPopup( &dialog );
- action = mActivated ? dialog.exec() : 0;
- setOutstandingPopup( 0 );
- if ( action && action == dialog.primaryAction() ) {
- confirmation = true;
- }
- break;
- case ECollectionContextPlaylists:
- message = hbTrId( "txt_mus_delete_playlist" );
- dialog.setText( message );
- dialog.setTimeout( HbPopup::NoTimeout );
- setOutstandingPopup( &dialog );
- action = mActivated ? dialog.exec() : 0;
- setOutstandingPopup( 0 );
- if ( action && action == dialog.primaryAction() ) {
- confirmation = true;
- }
- break;
- case ECollectionContextPlaylistSongs:
- case ECollectionContextGenres:
- case ECollectionContextGenreSongs:
- confirmation = true;
- break;
- case ECollectionContextUnknown:
- default:
- // We shouldn't be here
- TX_LOG_ARGS( "Invalid Collection Context:" << mCollectionContext );
- break;
- }
-
- if ( confirmation ) {
- mMpEngine->deleteSongs( selection );
+ if ( mActivated ) {
+ mMpPopupHandler->cancelOngoingPopup();
+ menu()->close();
}
}
-/*!
- \internal
- Returns a list of itmes selected.
- */
-QModelIndexList MpCollectionView::getModelIndexes( const QString &label, QAbstractItemModel* model, bool &ok )
-{
- QModelIndexList result;
-
- if ( !mActivated ) {
- ok = false;
- return result;
- }
-
- HbListDialog *dlg = new HbListDialog();
- dlg->setHeadingWidget( new HbLabel( label ) );
- dlg->setSelectionMode( HbAbstractItemView::MultiSelection );
- dlg->setModel( model );
- setOutstandingPopup( dlg );
- HbAction* action = mActivated ? dlg->exec() : 0;
- setOutstandingPopup( 0 );
- if( action == dlg->primaryAction() ){ //OK was pressed
- ok = true;
- result = dlg->selectedModelIndexes();
- }
- else{ //Cancel was pressed or dialog was closed or never executed.
- ok = false;
- }
- dlg->setModel( 0 );
- delete dlg;
- return result;
-}
-
-/*!
- \internal
- Returns a string from user input.
- */
-QString MpCollectionView::getText( const QString &label,const QString &text,
- bool &ok )
-{
-
- QString result;
-
- if ( !mActivated ) {
- ok = false;
- return result;
- }
-
- HbInputDialog *dlg = new HbInputDialog();
- dlg->setPromptText( label );
- dlg->setInputMode( HbInputDialog::TextInput );
- dlg->setValue( text );
- setOutstandingPopup( dlg );
- HbAction* action = mActivated ? dlg->exec() : 0;
- setOutstandingPopup( 0 );
- if( action == dlg->primaryAction() ) { //OK was pressed
- ok = true;
- result = dlg->value().toString();
- } else { //Cancel was pressed or dialog was closed or never executed.
- ok = false;
- }
- delete dlg;
- return result;
-}
-
-/*!
- \internal
- sets \a popup as the current outstanding popup and cancels any otstanding popup.
- */
-void MpCollectionView::setOutstandingPopup( HbPopup *popup )
-{
- if ( mOutstandingPopup ) {
- mOutstandingPopup->close();
- }
- mOutstandingPopup = popup;
-}
-
-/*!
- \internal
- sets \a newPlaylistName with imput name from the user, uses \a playlists to
- generate a suggested playlist name, retrns true if the user confirmed the query.
- */
-bool MpCollectionView::queryNewPlaylistName(QString &newPlaylistName , const QStringList &playlists )
-{
- bool ret= false;
- if (!mActivated) {
- return ret;
- }
- int i = 0;
- for ( ;
- playlists.contains( hbTrId( "txt_mus_dialog_enter_name_entry_playlist_l1" ).arg( i ) ) ;
- i++ ) {};
- QString suggestedPlaylistName = hbTrId( "txt_mus_dialog_enter_name_entry_playlist_l1" ).arg( i );
- QString suggestedText;
- bool ok = false;
- suggestedText = getText( hbTrId("txt_mus_dialog_enter_name" ), suggestedPlaylistName, ok);
- if ( ok ) {
- newPlaylistName = suggestedText;
- ret = true;
- }
- return ret;
-}
-
--- a/mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/src/unittest_mpcollectioncontainers.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/src/unittest_mpcollectioncontainers.cpp Fri May 14 15:49:53 2010 +0300
@@ -36,6 +36,7 @@
#include "mpcollectioncontainer.h"
#include "mpcollectionlistcontainer.h"
#include "mpcollectioncontainerallsongs.h"
+#include "mpcollectioncontainerartists.h"
#include "mpcollectioncontaineralbums.h"
#include "mpcollectioncontainerplaylists.h"
#include "mpcollectioncontainergenres.h"
@@ -116,15 +117,32 @@
QVERIFY(static_cast<MpCollectionContainerAllSongs*>(mTest)->mList == 0);
QVERIFY(static_cast<MpCollectionContainerAllSongs*>(mTest)->mInfoBar == 0);
QVERIFY(static_cast<MpCollectionContainerAllSongs*>(mTest)->mNoMusic == 0);
+ QVERIFY(static_cast<MpCollectionContainerAllSongs*>(mTest)->mIndexFeedback != 0);
+ QVERIFY(static_cast<MpCollectionContainerAllSongs*>(mTest)->mIndexFeedback->indexFeedbackPolicy() == HbIndexFeedback::IndexFeedbackSingleCharacter);
+
QCOMPARE(mTest->mCollectionContext,ECollectionContextUnknown);
delete mTest;
mTest = 0;
+ mTest = new MpCollectionContainerArtists(mView->mDocumentLoader);
+ QVERIFY(static_cast<MpCollectionContainerArtists*>(mTest)->mList == 0);
+ QVERIFY(static_cast<MpCollectionContainerArtists*>(mTest)->mInfoBar == 0);
+ QVERIFY(static_cast<MpCollectionContainerArtists*>(mTest)->mNoMusic == 0);
+ QVERIFY(static_cast<MpCollectionContainerArtists*>(mTest)->mIndexFeedback != 0);
+ QVERIFY(static_cast<MpCollectionContainerAllSongs*>(mTest)->mIndexFeedback->indexFeedbackPolicy() == HbIndexFeedback::IndexFeedbackSingleCharacter);
+
+ QCOMPARE(mTest->mCollectionContext,ECollectionContextUnknown);
+
+ delete mTest;
+ mTest = 0;
+
mTest = new MpCollectionContainerAlbums(mView->mDocumentLoader);
QVERIFY(static_cast<MpCollectionContainerAlbums*>(mTest)->mList == 0);
QVERIFY(static_cast<MpCollectionContainerAlbums*>(mTest)->mInfoBar == 0);
QVERIFY(static_cast<MpCollectionContainerAlbums*>(mTest)->mNoMusic == 0);
+ QVERIFY(static_cast<MpCollectionContainerAlbums*>(mTest)->mIndexFeedback != 0);
+ QVERIFY(static_cast<MpCollectionContainerAllSongs*>(mTest)->mIndexFeedback->indexFeedbackPolicy() == HbIndexFeedback::IndexFeedbackSingleCharacter);
QCOMPARE(mTest->mCollectionContext,ECollectionContextUnknown);
delete mTest;
@@ -134,6 +152,8 @@
QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mList == 0);
QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mInfoBar == 0);
QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mNoMusic == 0);
+ QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mIndexFeedback != 0);
+ QVERIFY(static_cast<MpCollectionContainerAllSongs*>(mTest)->mIndexFeedback->indexFeedbackPolicy() == HbIndexFeedback::IndexFeedbackSingleCharacter);
QCOMPARE(mTest->mCollectionContext,ECollectionContextUnknown);
delete mTest;
@@ -143,6 +163,8 @@
QVERIFY(static_cast<MpCollectionContainerAllSongs*>(mTest)->mList == 0);
QVERIFY(static_cast<MpCollectionContainerAllSongs*>(mTest)->mInfoBar == 0);
QVERIFY(static_cast<MpCollectionContainerAllSongs*>(mTest)->mNoMusic == 0);
+ QVERIFY(static_cast<MpCollectionContainerAllSongs*>(mTest)->mIndexFeedback != 0);
+ QVERIFY(static_cast<MpCollectionContainerAllSongs*>(mTest)->mIndexFeedback->indexFeedbackPolicy() == HbIndexFeedback::IndexFeedbackSingleCharacter);
QCOMPARE(mTest->mCollectionContext,ECollectionContextUnknown);
QCOMPARE(mView->mContainerFactory->mCurrentContext, ECollectionContextAllSongs);
@@ -151,6 +173,8 @@
QVERIFY(static_cast<MpCollectionContainerAlbums*>(mTest)->mList == 0);
QVERIFY(static_cast<MpCollectionContainerAlbums*>(mTest)->mInfoBar == 0);
QVERIFY(static_cast<MpCollectionContainerAlbums*>(mTest)->mNoMusic == 0);
+ QVERIFY(static_cast<MpCollectionContainerAlbums*>(mTest)->mIndexFeedback != 0);
+ QVERIFY(static_cast<MpCollectionContainerAllSongs*>(mTest)->mIndexFeedback->indexFeedbackPolicy() == HbIndexFeedback::IndexFeedbackSingleCharacter);
QCOMPARE(mTest->mCollectionContext,ECollectionContextUnknown);
QCOMPARE(mView->mContainerFactory->mCurrentContext, ECollectionContextAlbums);
@@ -159,6 +183,8 @@
QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mList == 0);
QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mInfoBar == 0);
QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mNoMusic == 0);
+ QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mIndexFeedback != 0);
+ QVERIFY(static_cast<MpCollectionContainerAllSongs*>(mTest)->mIndexFeedback->indexFeedbackPolicy() == HbIndexFeedback::IndexFeedbackSingleCharacter);
QCOMPARE(mTest->mCollectionContext,ECollectionContextUnknown);
QCOMPARE(mView->mContainerFactory->mCurrentContext, ECollectionContextPlaylists);
}
@@ -180,9 +206,54 @@
QCOMPARE(static_cast<MpCollectionContainerAllSongs*>(mTest)->mList->longPressEnabled(), true);
QCOMPARE(static_cast<MpCollectionContainerAllSongs*>(mTest)->mList->verticalScrollBarPolicy(), HbScrollArea::ScrollBarAsNeeded);
QCOMPARE(static_cast<MpCollectionContainerAllSongs*>(mTest)->mList->listItemPrototype()->graphicsSize(), HbListViewItem::Thumbnail);
+ QVERIFY(static_cast<MpCollectionContainerAllSongs*>(mTest)->mIndexFeedback->itemView() == static_cast<MpCollectionContainerAllSongs*>(mTest)->mList);
QCOMPARE(mView->mContainerFactory->mCurrentContext, ECollectionContextAllSongs);
mTest = 0;
+ mTest = mView->mContainerFactory->createContainer(ECollectionContextArtists);
+ mCollectionData->mContext = ECollectionContextArtists;
+ mTest->setDataModel(mCollectionDataModel);
+
+ QVERIFY(static_cast<MpCollectionContainerArtists*>(mTest)->mList != 0);
+ QVERIFY(static_cast<MpCollectionContainerArtists*>(mTest)->mInfoBar == 0);
+ QCOMPARE(static_cast<MpCollectionContainerArtists*>(mTest)->mList->itemRecycling(), true);
+ QCOMPARE(static_cast<MpCollectionContainerArtists*>(mTest)->mList->scrollingStyle(), HbListView::PanOrFlick);
+ QCOMPARE(static_cast<MpCollectionContainerArtists*>(mTest)->mList->clampingStyle(), HbListView::BounceBackClamping);
+ QCOMPARE(static_cast<MpCollectionContainerArtists*>(mTest)->mList->longPressEnabled(), true);
+ QCOMPARE(static_cast<MpCollectionContainerArtists*>(mTest)->mList->verticalScrollBarPolicy(), HbScrollArea::ScrollBarAsNeeded);
+ QCOMPARE(static_cast<MpCollectionContainerArtists*>(mTest)->mList->listItemPrototype()->graphicsSize(), HbListViewItem::Thumbnail);
+ QVERIFY(static_cast<MpCollectionContainerArtists*>(mTest)->mIndexFeedback->itemView() == static_cast<MpCollectionContainerArtists*>(mTest)->mList);
+ QCOMPARE(mView->mContainerFactory->mCurrentContext, ECollectionContextArtists);
+
+ mCollectionData->mContext = ECollectionContextArtistAlbums;
+ mTest->setDataModel(mCollectionDataModel);
+
+ QVERIFY(static_cast<MpCollectionContainerArtists*>(mTest)->mList != 0);
+ QVERIFY(static_cast<MpCollectionContainerArtists*>(mTest)->mInfoBar != 0);
+ QCOMPARE(static_cast<MpCollectionContainerArtists*>(mTest)->mList->itemRecycling(), true);
+ QCOMPARE(static_cast<MpCollectionContainerArtists*>(mTest)->mList->scrollingStyle(), HbListView::PanOrFlick);
+ QCOMPARE(static_cast<MpCollectionContainerArtists*>(mTest)->mList->clampingStyle(), HbListView::BounceBackClamping);
+ QCOMPARE(static_cast<MpCollectionContainerArtists*>(mTest)->mList->longPressEnabled(), true);
+ QCOMPARE(static_cast<MpCollectionContainerArtists*>(mTest)->mList->verticalScrollBarPolicy(), HbScrollArea::ScrollBarAsNeeded);
+ QCOMPARE(static_cast<MpCollectionContainerArtists*>(mTest)->mList->listItemPrototype()->graphicsSize(), HbListViewItem::Thumbnail);
+ QVERIFY(static_cast<MpCollectionContainerArtists*>(mTest)->mIndexFeedback->itemView() == static_cast<MpCollectionContainerArtists*>(mTest)->mList);
+ QCOMPARE(mView->mContainerFactory->mCurrentContext, ECollectionContextArtists);
+
+ mCollectionData->mContext = ECollectionContextArtistSongs;
+ mTest->setDataModel(mCollectionDataModel);
+
+ QVERIFY(static_cast<MpCollectionContainerArtists*>(mTest)->mList != 0);
+ QVERIFY(static_cast<MpCollectionContainerArtists*>(mTest)->mInfoBar != 0);
+ QCOMPARE(static_cast<MpCollectionContainerArtists*>(mTest)->mList->itemRecycling(), true);
+ QCOMPARE(static_cast<MpCollectionContainerArtists*>(mTest)->mList->scrollingStyle(), HbListView::PanOrFlick);
+ QCOMPARE(static_cast<MpCollectionContainerArtists*>(mTest)->mList->clampingStyle(), HbListView::BounceBackClamping);
+ QCOMPARE(static_cast<MpCollectionContainerArtists*>(mTest)->mList->longPressEnabled(), true);
+ QCOMPARE(static_cast<MpCollectionContainerArtists*>(mTest)->mList->verticalScrollBarPolicy(), HbScrollArea::ScrollBarAsNeeded);
+ QCOMPARE(static_cast<MpCollectionContainerArtists*>(mTest)->mList->listItemPrototype()->graphicsSize(), HbListViewItem::Thumbnail);
+ QVERIFY(static_cast<MpCollectionContainerArtists*>(mTest)->mIndexFeedback->itemView() == static_cast<MpCollectionContainerArtists*>(mTest)->mList);
+ QCOMPARE(mView->mContainerFactory->mCurrentContext, ECollectionContextArtists);
+
+ mTest = 0;
mTest = mView->mContainerFactory->createContainer(ECollectionContextAlbums);
mCollectionData->mContext = ECollectionContextAlbums;
mTest->setDataModel(mCollectionDataModel);
@@ -195,6 +266,7 @@
QCOMPARE(static_cast<MpCollectionContainerAlbums*>(mTest)->mList->longPressEnabled(), true);
QCOMPARE(static_cast<MpCollectionContainerAlbums*>(mTest)->mList->verticalScrollBarPolicy(), HbScrollArea::ScrollBarAsNeeded);
QCOMPARE(static_cast<MpCollectionContainerAlbums*>(mTest)->mList->listItemPrototype()->graphicsSize(), HbListViewItem::Thumbnail);
+ QVERIFY(static_cast<MpCollectionContainerAlbums*>(mTest)->mIndexFeedback->itemView() == static_cast<MpCollectionContainerAlbums*>(mTest)->mList);
QCOMPARE(mView->mContainerFactory->mCurrentContext, ECollectionContextAlbums);
mCollectionData->mContext = ECollectionContextAlbumSongs;
@@ -208,6 +280,7 @@
QCOMPARE(static_cast<MpCollectionContainerAlbums*>(mTest)->mList->longPressEnabled(), true);
QCOMPARE(static_cast<MpCollectionContainerAlbums*>(mTest)->mList->verticalScrollBarPolicy(), HbScrollArea::ScrollBarAsNeeded);
QCOMPARE(static_cast<MpCollectionContainerAlbums*>(mTest)->mList->listItemPrototype()->graphicsSize(), HbListViewItem::Thumbnail);
+ QVERIFY(static_cast<MpCollectionContainerAlbums*>(mTest)->mIndexFeedback->itemView() == static_cast<MpCollectionContainerAlbums*>(mTest)->mList);
QCOMPARE(mView->mContainerFactory->mCurrentContext, ECollectionContextAlbums);
mTest = 0;
@@ -223,6 +296,7 @@
QCOMPARE(static_cast<MpCollectionContainerPlaylists*>(mTest)->mList->longPressEnabled(), true);
QCOMPARE(static_cast<MpCollectionContainerPlaylists*>(mTest)->mList->verticalScrollBarPolicy(), HbScrollArea::ScrollBarAsNeeded);
QCOMPARE(static_cast<MpCollectionContainerPlaylists*>(mTest)->mList->listItemPrototype()->graphicsSize(), HbListViewItem::Thumbnail);
+ QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mIndexFeedback->itemView() == 0 );
QCOMPARE(mView->mContainerFactory->mCurrentContext, ECollectionContextPlaylists);
mCollectionData->mContext = ECollectionContextPlaylistSongs;
@@ -236,8 +310,28 @@
QCOMPARE(static_cast<MpCollectionContainerPlaylists*>(mTest)->mList->longPressEnabled(), true);
QCOMPARE(static_cast<MpCollectionContainerPlaylists*>(mTest)->mList->verticalScrollBarPolicy(), HbScrollArea::ScrollBarAsNeeded);
QCOMPARE(static_cast<MpCollectionContainerPlaylists*>(mTest)->mList->listItemPrototype()->graphicsSize(), HbListViewItem::Thumbnail);
+ QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mIndexFeedback->itemView() == 0);
QCOMPARE(mView->mContainerFactory->mCurrentContext, ECollectionContextPlaylists);
+ //Test the case when all the songs are removed from a playlist, previous case is precondition...
+ mCollectionData->mCount = 0;
+ mTest->setDataModel(mCollectionDataModel);
+ QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mList != 0);
+ QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mInfoBar == 0);
+ QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mNoMusic != 0);
+ QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mIndexFeedback->itemView() == 0 );
+ QCOMPARE(mView->mContainerFactory->mCurrentContext, ECollectionContextPlaylists);
+
+ //Test the case when songs get added to empty playlist, previous case is precondition...
+ mCollectionData->mCount = 1;
+ mTest->setDataModel(mCollectionDataModel);
+ QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mList != 0);
+ QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mInfoBar != 0);
+ QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mNoMusic == 0);
+ QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mIndexFeedback->itemView() == 0 );
+ QCOMPARE(mView->mContainerFactory->mCurrentContext, ECollectionContextPlaylists);
+
+
//No data
mTest = 0;
mCollectionData->mCount = 0;
@@ -247,6 +341,7 @@
QVERIFY(static_cast<MpCollectionContainerAllSongs*>(mTest)->mList == 0);
QVERIFY(static_cast<MpCollectionContainerAllSongs*>(mTest)->mInfoBar == 0);
QVERIFY(static_cast<MpCollectionContainerAllSongs*>(mTest)->mNoMusic != 0);
+ QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mIndexFeedback->itemView() == 0 );
QCOMPARE(mView->mContainerFactory->mCurrentContext, ECollectionContextAllSongs);
mTest = 0;
@@ -257,6 +352,7 @@
QVERIFY(static_cast<MpCollectionContainerAlbums*>(mTest)->mList == 0);
QVERIFY(static_cast<MpCollectionContainerAlbums*>(mTest)->mInfoBar == 0);
QVERIFY(static_cast<MpCollectionContainerAlbums*>(mTest)->mNoMusic != 0);
+ QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mIndexFeedback->itemView() == 0 );
QCOMPARE(mView->mContainerFactory->mCurrentContext, ECollectionContextAlbums);
mCollectionData->mContext = ECollectionContextAlbumSongs;
@@ -265,6 +361,7 @@
QVERIFY(static_cast<MpCollectionContainerAlbums*>(mTest)->mList == 0);
QVERIFY(static_cast<MpCollectionContainerAlbums*>(mTest)->mInfoBar == 0);
QVERIFY(static_cast<MpCollectionContainerAlbums*>(mTest)->mNoMusic != 0);
+ QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mIndexFeedback->itemView() == 0 );
QCOMPARE(mView->mContainerFactory->mCurrentContext, ECollectionContextAlbums);
mTest = 0;
@@ -275,15 +372,18 @@
QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mList == 0);
QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mInfoBar == 0);
QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mNoMusic != 0);
+ QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mIndexFeedback->itemView() == 0 );
QCOMPARE(mView->mContainerFactory->mCurrentContext, ECollectionContextPlaylists);
mCollectionData->mContext = ECollectionContextPlaylistSongs;
mTest->setDataModel(mCollectionDataModel);
-
+ mCollectionData->mCount = 0;
QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mList == 0);
QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mInfoBar == 0);
QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mNoMusic != 0);
- QCOMPARE(mView->mContainerFactory->mCurrentContext, ECollectionContextPlaylists);
+ QVERIFY(static_cast<MpCollectionContainerPlaylists*>(mTest)->mIndexFeedback->itemView() == 0 );
+ QCOMPARE(mView->mContainerFactory->mCurrentContext, ECollectionContextPlaylists);
+
}
/*!
@@ -299,18 +399,25 @@
QCOMPARE(qvariant_cast<int>(spy.at(0).at(0)), -1);
mTest = 0;
- mTest = mView->mContainerFactory->createContainer(ECollectionContextAlbums);
+ mTest = mView->mContainerFactory->createContainer(ECollectionContextArtists);
QSignalSpy spy2(mTest, SIGNAL(itemActivated( int )));
- static_cast<MpCollectionContainerAlbums*>(mTest)->itemActivated(QModelIndex());
+ static_cast<MpCollectionContainerArtists*>(mTest)->itemActivated(QModelIndex());
QCOMPARE(spy2.count(), 1);
QCOMPARE(qvariant_cast<int>(spy2.at(0).at(0)), -1);
mTest = 0;
- mTest = mView->mContainerFactory->createContainer(ECollectionContextPlaylists);
+ mTest = mView->mContainerFactory->createContainer(ECollectionContextAlbums);
QSignalSpy spy3(mTest, SIGNAL(itemActivated( int )));
- static_cast<MpCollectionContainerPlaylists*>(mTest)->itemActivated(QModelIndex());
+ static_cast<MpCollectionContainerAlbums*>(mTest)->itemActivated(QModelIndex());
QCOMPARE(spy3.count(), 1);
QCOMPARE(qvariant_cast<int>(spy3.at(0).at(0)), -1);
+
+ mTest = 0;
+ mTest = mView->mContainerFactory->createContainer(ECollectionContextPlaylists);
+ QSignalSpy spy4(mTest, SIGNAL(itemActivated( int )));
+ static_cast<MpCollectionContainerPlaylists*>(mTest)->itemActivated(QModelIndex());
+ QCOMPARE(spy4.count(), 1);
+ QCOMPARE(qvariant_cast<int>(spy4.at(0).at(0)), -1);
}
/*!
@@ -327,18 +434,25 @@
QCOMPARE(qvariant_cast<int>(spy.at(0).at(0)), -1);
mTest = 0;
- mTest = mView->mContainerFactory->createContainer(ECollectionContextAlbums);
+ mTest = mView->mContainerFactory->createContainer(ECollectionContextArtists);
QSignalSpy spy2(mTest, SIGNAL(itemLongPressed( int, QPointF )));
- static_cast<MpCollectionContainerAlbums*>(mTest)->onLongPressed(viewItem->listItemPrototype(), QPointF());
+ static_cast<MpCollectionContainerArtists*>(mTest)->onLongPressed(viewItem->listItemPrototype(), QPointF());
QCOMPARE(spy2.count(), 1);
QCOMPARE(qvariant_cast<int>(spy2.at(0).at(0)), -1);
mTest = 0;
- mTest = mView->mContainerFactory->createContainer(ECollectionContextPlaylists);
+ mTest = mView->mContainerFactory->createContainer(ECollectionContextAlbums);
QSignalSpy spy3(mTest, SIGNAL(itemLongPressed( int, QPointF )));
- static_cast<MpCollectionContainerPlaylists*>(mTest)->onLongPressed(viewItem->listItemPrototype(), QPointF());
+ static_cast<MpCollectionContainerAlbums*>(mTest)->onLongPressed(viewItem->listItemPrototype(), QPointF());
QCOMPARE(spy3.count(), 1);
QCOMPARE(qvariant_cast<int>(spy3.at(0).at(0)), -1);
+
+ mTest = 0;
+ mTest = mView->mContainerFactory->createContainer(ECollectionContextPlaylists);
+ QSignalSpy spy4(mTest, SIGNAL(itemLongPressed( int, QPointF )));
+ static_cast<MpCollectionContainerPlaylists*>(mTest)->onLongPressed(viewItem->listItemPrototype(), QPointF());
+ QCOMPARE(spy4.count(), 1);
+ QCOMPARE(qvariant_cast<int>(spy4.at(0).at(0)), -1);
}
// End of file
--- a/mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/stub/inc/mpcollectionview.h Mon May 03 12:29:20 2010 +0300
+++ b/mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/stub/inc/mpcollectionview.h Fri May 14 15:49:53 2010 +0300
@@ -76,8 +76,8 @@
bool mEffectOnGoing;
HbMainWindow *mWindow; // Not own
- HbAction *mSoftKeyQuit; // Not own
- HbAction *mSoftKeyBack; // Not own
+ HbAction *mNavigationQuit; // Not own
+ HbAction *mNavigationBack; // Not own
MpCollectionDocumentLoader *mDocumentLoader; // Own
HbWidget *mMainContainer; // Own
--- a/mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/unittest_mpcollectioncontainers.pro Mon May 03 12:29:20 2010 +0300
+++ b/mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/unittest_mpcollectioncontainers.pro Fri May 14 15:49:53 2010 +0300
@@ -35,6 +35,7 @@
../../inc/mpcollectioncontainer.h \
../../inc/mpcollectionlistcontainer.h \
../../inc/mpcollectioncontainerallsongs.h \
+ ../../inc/mpcollectioncontainerartists.h \
../../inc/mpcollectioncontaineralbums.h \
../../inc/mpcollectioncontainerplaylists.h \
../../inc/mpcollectioncontainergenres.h \
@@ -48,6 +49,7 @@
../../src/mpcollectioncontainer.cpp \
../../src/mpcollectionlistcontainer.cpp \
../../src/mpcollectioncontainerallsongs.cpp \
+ ../../src/mpcollectioncontainerartists.cpp \
../../src/mpcollectioncontaineralbums.cpp \
../../src/mpcollectioncontainerplaylists.cpp \
../../src/mpcollectioncontainergenres.cpp \
--- a/mpviewplugins/mpdetailsviewplugin/inc/mpdetailsview.h Mon May 03 12:29:20 2010 +0300
+++ b/mpviewplugins/mpdetailsviewplugin/inc/mpdetailsview.h Fri May 14 15:49:53 2010 +0300
@@ -109,7 +109,7 @@
bool mActivated;
HbMainWindow *mWindow;
- HbAction *mSoftKeyBack;
+ HbAction *mNavigationBack;
HbWidget *mContainer;
HbLabel *mSongText; //owned
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mpviewplugins/mpdetailsviewplugin/resources/detailsview.docml Fri May 14 15:49:53 2010 +0300
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="0.9">
+ <widget name="content" type="HbWidget">
+ <widget name="container_2" type="HbWidget">
+ <widget name="songDetailsGroupBox" type="HbGroupBox">
+ <string name="heading" value="Song Details 1"/>
+ <real name="z" value="5"/>
+ <sizehint type="PREFERRED" width="53un"/>
+ <bool name="collapsable" value="TRUE"/>
+ </widget>
+ <widget name="inspireMeGroupBox" type="HbGroupBox">
+ <string name="heading" value="Inspire me"/>
+ <real name="z" value="6"/>
+ <sizehint type="PREFERRED" width="53un"/>
+ <bool name="collapsable" value="TRUE"/>
+ </widget>
+ <real name="z" value="0"/>
+ <sizehint height="40un" type="PREFERRED" width="53un"/>
+ <layout orientation="Vertical" spacing="0px" type="linear">
+ <linearitem itemname="songDetailsGroupBox"/>
+ <linearitem itemname="inspireMeGroupBox"/>
+ </layout>
+ </widget>
+ <widget name="albumArt" type="HbLabel">
+ <enums name="alignment" value="AlignAbsolute|AlignLeft|AlignBottom|AlignRight|AlignVCenter|AlignJustify|AlignHCenter|AlignLeading|AlignTrailing"/>
+ <real name="z" value="1"/>
+ <sizehint height="22un" type="PREFERRED" width="22un"/>
+ <string name="plainText" value=""/>
+ </widget>
+ <widget name="shareButton" type="HbPushButton">
+ <real name="z" value="3"/>
+ <string name="text" value="Share"/>
+ <sizehint type="PREFERRED" width="17.61194un"/>
+ </widget>
+ <widget name="container_1" type="HbWidget">
+ <widget name="songText" type="HbLabel">
+ <real name="z" value="4"/>
+ <sizehint height="3.9un" type="PREFERRED"/>
+ <string name="plainText" value="Label"/>
+ <string name="html" value=""/>
+ </widget>
+ <widget name="artistText" type="HbLabel">
+ <real name="z" value="6"/>
+ <sizehint height="3.9un" type="PREFERRED"/>
+ <string name="plainText" value="Label"/>
+ <string name="html" value=""/>
+ </widget>
+ <widget name="albumText" type="HbLabel">
+ <real name="z" value="5"/>
+ <sizehint height="3.9un" type="PREFERRED"/>
+ <string name="plainText" value="Label"/>
+ <string name="html" value=""/>
+ </widget>
+ <real name="z" value="0"/>
+ <sizehint height="20un" type="PREFERRED" width="22.53731un"/>
+ <layout orientation="Vertical" type="linear">
+ <linearitem itemname="songText"/>
+ <linearitem itemname="artistText"/>
+ <linearitem itemname="albumText"/>
+ </layout>
+ </widget>
+ <string name="windowTitle" value="ass"/>
+ <layout type="anchor">
+ <anchoritem dst="container_2" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="container_2" dstEdge="TOP" spacing="28.0597un" src="" srcEdge="TOP"/>
+ <anchoritem dst="albumArt" dstEdge="LEFT" spacing="1.49254un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="albumArt" dstEdge="TOP" spacing="4.77612un" src="" srcEdge="TOP"/>
+ <anchoritem dst="shareButton" dstEdge="TOP" spacing="17.61194un" src="" srcEdge="TOP"/>
+ <anchoritem dst="shareButton" dstEdge="RIGHT" spacing="-32.43284un" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="container_1" dstEdge="TOP" spacing="4.62687un" src="" srcEdge="TOP"/>
+ <anchoritem dst="container_1" dstEdge="RIGHT" spacing="-4.92537un" src="" srcEdge="RIGHT"/>
+ </layout>
+ </widget>
+ <metadata activeUIState="Common ui state" display="QHD portrait" unit="un">
+ <uistate name="Common ui state" sections="#common"/>
+ </metadata>
+</hbdocument>
--- a/mpviewplugins/mpdetailsviewplugin/src/mpdetailsview.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpviewplugins/mpdetailsviewplugin/src/mpdetailsview.cpp Fri May 14 15:49:53 2010 +0300
@@ -63,7 +63,7 @@
mFrameworkWrapper( 0 ),
mActivated( false ),
mWindow( 0 ),
- mSoftKeyBack( 0 ),
+ mNavigationBack( 0 ),
mSongText( NULL ),
mAlbumText( NULL ),
mArtistText( NULL ),
@@ -127,8 +127,8 @@
if ( mFrameworkWrapper ) {
delete mFrameworkWrapper;
}
- if ( mSoftKeyBack ) {
- delete mSoftKeyBack;
+ if ( mNavigationBack ) {
+ delete mNavigationBack;
}
if ( mDocumentLoader ) {
delete mDocumentLoader;
@@ -174,7 +174,7 @@
}
mWindow = mainWindow();
- mSoftKeyBack = new HbAction( Hb::BackAction, this );
+ mNavigationBack = new HbAction( Hb::BackNaviAction, this );
mFrameworkWrapper = new MpMpxDetailsFrameworkWrapper( );
mSongData = mFrameworkWrapper->songData();
@@ -213,7 +213,7 @@
// TODO: might need later
setupMenu();
- connect( mSoftKeyBack, SIGNAL( triggered() ), this, SLOT( back() ) );
+ connect( mNavigationBack, SIGNAL( triggered() ), this, SLOT( back() ) );
connect( mShareButton, SIGNAL( clicked() ), this, SLOT( share() ) );
connect( mSongData, SIGNAL( albumArtReady() ), this, SLOT( albumArtChanged() ) );
connect( mSongData, SIGNAL( playbackInfoChanged() ), this, SLOT( playbackInfoChanged() ) );
@@ -229,7 +229,7 @@
void MpDetailsView::activateView()
{
TX_ENTRY
- setNavigationAction( mSoftKeyBack );
+ setNavigationAction( mNavigationBack );
mFrameworkWrapper->retrieveSong();
mActivated = true;
--- a/mpviewplugins/mpdetailsviewplugin/src/mpsongdata.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpviewplugins/mpdetailsviewplugin/src/mpsongdata.cpp Fri May 14 15:49:53 2010 +0300
@@ -61,13 +61,6 @@
*/
MpSongData::MpSongData( QObject *parent )
: QObject( parent ),
- mTitle( NULL ),
- mAlbum( NULL ),
- mArtist( NULL ),
- mComposer( NULL),
- mGenre( NULL ),
- mYear( NULL ),
- mAlbumTrack( NULL ),
mAlbumArt(),
mReqId( KUndefined )
{
--- a/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/src/unittest_mpdetailsview.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailsview/src/unittest_mpdetailsview.cpp Fri May 14 15:49:53 2010 +0300
@@ -138,7 +138,7 @@
}
void TestMpDetailsView::testbackSlot() {
- connect(this, SIGNAL(back()), mTest->mSoftKeyBack, SIGNAL(triggered()));
+ connect(this, SIGNAL(back()), mTest->mNavigationBack, SIGNAL(triggered()));
QSignalSpy spy(mTest, SIGNAL(command(int)));
QVERIFY(spy.isValid());
QCOMPARE(spy.count(),0);
--- a/mpviewplugins/mpplaybackviewplugin/inc/mpplaybackview.h Mon May 03 12:29:20 2010 +0300
+++ b/mpviewplugins/mpplaybackviewplugin/inc/mpplaybackview.h Fri May 14 15:49:53 2010 +0300
@@ -78,7 +78,7 @@
MpEqualizerWidget *mEqualizerWidget; // Own
HbMainWindow *mWindow; // Not own
- HbAction *mSoftKeyBack; // Own
+ HbAction *mNavigationBack; // Own
bool mActivated;
HbIcon *mPlayIcon; // Own
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mpviewplugins/mpplaybackviewplugin/resources/playbackwidget.docml Fri May 14 15:49:53 2010 +0300
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+
+<hbdocument version="0.9">
+
+ <widget name="playbackWidgetContainer" type="HbWidget">
+
+ <widget name="albumText" type="HbLabel">
+ <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <fontspec name="fontSpec" role="Secondary"/>
+ </widget>
+
+ <widget name="artistText" type="HbLabel">
+ <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <fontspec name="fontSpec" role="Secondary"/>
+ </widget>
+
+ <widget name="songText" type="HbLabel">
+ <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <fontspec name="fontSpec" role="Primary"/>
+ </widget>
+
+ <widget name="albumArt" type="HbLabel">
+ <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ </widget>
+
+ <widget name="progressBar" type="HbProgressSlider">
+ <fontspec name="fontSpec" role="PrimarySmall"/>
+ </widget>
+
+ <widget name="textContainer" type="HbWidget"/>
+
+ <bool name="visible" value="TRUE"/>
+
+ </widget>
+
+ <widget name="albumArt">
+ <sizehint height="var(hb-param-screen-width)" type="MAXIMUM" width="var(hb-param-screen-width)"/>
+ <sizehint height="var(hb-param-screen-width)" type="PREFERRED" width="var(hb-param-screen-width)"/>
+ <sizehint height="var(hb-param-screen-width)" type="FIXED" width="var(hb-param-screen-width)"/>
+ <sizehint height="var(hb-param-screen-width)" type="MINIMUM" width="var(hb-param-screen-width)"/>
+ <sizepolicy horizontalPolicy="Fixed" horizontalStretch="0" verticalPolicy="Fixed" verticalStretch="0"/>
+ </widget>
+
+ <layout type="linear" orientation="Vertical" spacing="var(hb-param-margin-gene-middle-vertical)" widget="textContainer">
+ <contentsmargins bottom="var(hb-param-margin-gene-screen)" left="var(hb-param-margin-gene-screen)" right="var(hb-param-margin-gene-screen)" top="0.0un"/>
+ <linearitem itemname="artistText"/>
+ <linearitem itemname="songText"/>
+ <linearitem itemname="albumText"/>
+ <linearitem itemname="progressBar"/>
+ </layout>
+
+ <layout orientation="Vertical" spacing="var(hb-param-margin-gene-middle-vertical)" type="linear" widget="playbackWidgetContainer">
+ <contentsmargins bottom="0.0un" left="var(hb-param-margin-view-left)" right="var(hb-param-margin-view-right)" top="0.0un"/>
+ <linearitem itemname="albumArt"/>
+ <linearitem itemname="textContainer"/>
+ </layout>
+
+</hbdocument>
\ No newline at end of file
--- a/mpviewplugins/mpplaybackviewplugin/src/mpequalizerwidget.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpviewplugins/mpplaybackviewplugin/src/mpequalizerwidget.cpp Fri May 14 15:49:53 2010 +0300
@@ -86,18 +86,19 @@
{
TX_ENTRY
+ HbAction *action;
setTimeout(NoTimeout);
+ setModal( true );
setDismissPolicy(HbDialog::NoDismiss);
setFrameType(HbPopup::Strong);
- setHeadingWidget(new HbLabel(hbTrId("txt_mus_title_select_preset")));
- setPrimaryAction(new HbAction(hbTrId("txt_common_button_ok")));
- setSecondaryAction(new HbAction(hbTrId("txt_common_button_cancel")));
-
+ setHeadingWidget(new HbLabel(hbTrId("txt_mus_title_select_preset")));
+
+
if ( mEqualizerReady ) {
mOriginalPreset = mEqualizerWrapper->activePreset();
QStringList listItems = mEqualizerWrapper->presetNames();
listItems.prepend(hbTrId("txt_mus_list_off"));
-
+
int presetSelected;
if (mOriginalPreset == KEqualizerPresetNone) {
presetSelected = 0; //First list item corresponds to "OFF"
@@ -105,25 +106,23 @@
else {
presetSelected = mOriginalPreset;
}
-
+
mPresetsList = new HbRadioButtonList(listItems, presetSelected, HbRadioButtonList::NoPreview, this);
setContentWidget( mPresetsList ); //mPresetsList now owned by HbDialog
-
+
connect( mPresetsList,
SIGNAL(itemSelected(int)),
this,
SLOT(presetSelected(int)));
}
- connect( secondaryAction(),
- SIGNAL( triggered(bool) ),
- this,
- SLOT( cancelSelected(bool) ) );
-
- connect( primaryAction(),
- SIGNAL( triggered(bool) ),
- this,
- SLOT( okSelected(bool) ) );
+ clearActions();
+ action = new HbAction( hbTrId( "txt_common_button_ok" ) );
+ connect( action, SIGNAL( triggered( bool ) ), this, SLOT( okSelected( bool ) ) );
+ addAction( action );
+ action = new HbAction( hbTrId( "txt_common_button_cancel" ) );
+ connect( action, SIGNAL( triggered( bool ) ), this, SLOT( cancelSelected( bool ) ) );
+ addAction( action );
TX_EXIT
}
--- a/mpviewplugins/mpplaybackviewplugin/src/mpplaybackview.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpviewplugins/mpplaybackviewplugin/src/mpplaybackview.cpp Fri May 14 15:49:53 2010 +0300
@@ -61,7 +61,7 @@
mPlaybackData( 0 ),
mPlaybackWidget( 0 ),
mEqualizerWidget( new MpEqualizerWidget() ),
- mSoftKeyBack( 0 ),
+ mNavigationBack( 0 ),
mActivated( false ),
mPlayIcon( 0 ),
mPauseIcon( 0 ),
@@ -79,7 +79,7 @@
MpPlaybackView::~MpPlaybackView()
{
TX_ENTRY
- delete mSoftKeyBack;
+ delete mNavigationBack;
delete mPlayIcon;
delete mPauseIcon;
delete mShuffleOnIcon;
@@ -119,8 +119,8 @@
mWindow = mainWindow();
- mSoftKeyBack = new HbAction( Hb::BackAction, this );
- connect( mSoftKeyBack, SIGNAL( triggered() ), this, SLOT( back() ) );
+ mNavigationBack = new HbAction( Hb::BackNaviAction, this );
+ connect( mNavigationBack, SIGNAL( triggered() ), this, SLOT( back() ) );
mMpEngine = MpEngine::instance();
mPlaybackData = mMpEngine->playbackData();
@@ -152,7 +152,7 @@
{
TX_ENTRY
mActivated = true;
- setNavigationAction( mSoftKeyBack );
+ setNavigationAction( mNavigationBack );
TX_EXIT
}
@@ -420,7 +420,7 @@
if( mEqualizerWidget )
{
- mEqualizerWidget->exec();
+ mEqualizerWidget->show();
}
TX_EXIT
--- a/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpequalizerwidget/src/unittest_mpequalizerwidget.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpequalizerwidget/src/unittest_mpequalizerwidget.cpp Fri May 14 15:49:53 2010 +0300
@@ -116,8 +116,7 @@
QVERIFY(mTest->dismissPolicy() == HbDialog::NoDismiss);
QVERIFY(mTest->frameType() == HbPopup::Strong);
QVERIFY(mTest->headingWidget() != 0);
- QVERIFY(mTest->primaryAction() != 0);
- QVERIFY(mTest->secondaryAction() != 0);
+ QVERIFY(mTest->actions().count() != 0);
QVERIFY(mTest->contentWidget() == 0);
--- a/mpviewplugins/mpsettingsviewplugin/inc/mpsettingsview.h Mon May 03 12:29:20 2010 +0300
+++ b/mpviewplugins/mpsettingsviewplugin/inc/mpsettingsview.h Fri May 14 15:49:53 2010 +0300
@@ -46,7 +46,7 @@
private:
HbMainWindow *mWindow; // not own
- HbAction *mSoftKeyBack; // own
+ HbAction *mNavigationBack; // own
MpSettingsAudioEffectsWidget *mAudioEffectsWidget; // not own
Q_DISABLE_COPY(MpSettingsView)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mpviewplugins/mpsettingsviewplugin/resources/settingsview.docml Fri May 14 15:49:53 2010 +0300
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="0.8">
+
+ <widget name="effectsContainer" type="HbWidget">
+
+ <widget name="balanceContainer" type="HbWidget">
+
+ <widget name="balanceTitle" type="HbLabel">
+ <fontspec name="fontSpec" role="Primary"/>
+ </widget>
+
+ <widget name="balanceSlider" type="HbSlider">
+ <integer name="majorTickInterval" value="100"/>
+ <integer name="minorTickInterval" value="25"/>
+ <integer name="sliderPosition" value="0"/>
+ <integer name="singleStep" value="25"/>
+ <integer name="minimum" value="-100"/>
+ <integer name="maximum" value="100"/>
+ <string name="orientation" value="Horizontal"/>
+ <bool name="toolTipVisible" value="FALSE"/>
+ </widget>
+
+ <widget name="balanceLeftLabel" type="HbLabel">
+ <fontspec name="fontSpec" role="Secondary"/>
+ <enums name="alignment" value="AlignLeft"/>
+ </widget>
+
+ <widget name="balanceRightLabel" type="HbLabel">
+ <fontspec name="fontSpec" role="Secondary"/>
+ <enums name="alignment" value="AlignRight"/>
+ </widget>
+
+ <layout type="grid" spacing="0.0">
+ <contentsmargins bottom="0.0" left="0.0" right="0.0" top="0.0"/>
+ <griditem column="0" column_span="2" itemname="balanceTitle" row="0"/>
+ <griditem column="0" column_span="2" itemname="balanceSlider" row="1"/>
+ <griditem column="0" itemname="balanceLeftLabel" row="2"/>
+ <griditem column="1" itemname="balanceRightLabel" row="2"/>
+ </layout>
+ </widget>
+
+ <layout type="linear" orientation="Vertical" spacing="0.0">
+ <linearitem itemname="balanceContainer"/>
+ <stretchitem stretchfactor="1"/>
+ </layout>
+
+ </widget>
+
+</hbdocument>
--- a/mpviewplugins/mpsettingsviewplugin/src/mpsettingsaudioeffectswidget.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpviewplugins/mpsettingsviewplugin/src/mpsettingsaudioeffectswidget.cpp Fri May 14 15:49:53 2010 +0300
@@ -83,6 +83,7 @@
slider->setContentWidgetData( QString( "toolTipVisible" ), false );
slider->setContentWidgetData( QString( "tickPosition" ), Hb::SliderTicksRight );
slider->setContentWidgetData( QString( "sliderPosition" ),mFrameworkWrapper->balance() );
+ slider->setContentWidgetData( QString( "trackFilled" ), false );
if ( mFrameworkWrapper->loudness() == true ) {
loudnessItem->setContentWidgetData( QString( "text" ), hbTrId( "txt_mus_setlabel_loudness_val_on" ) );
loudnessItem->setContentWidgetData( QString( "additionalText" ), hbTrId( "txt_mus_setlabel_loudness_val_off" ) );
--- a/mpviewplugins/mpsettingsviewplugin/src/mpsettingsview.cpp Mon May 03 12:29:20 2010 +0300
+++ b/mpviewplugins/mpsettingsviewplugin/src/mpsettingsview.cpp Fri May 14 15:49:53 2010 +0300
@@ -46,7 +46,7 @@
*/
MpSettingsView::MpSettingsView()
: mWindow(0),
- mSoftKeyBack(0),
+ mNavigationBack(0),
mAudioEffectsWidget(0)
{
TX_LOG
@@ -58,7 +58,7 @@
MpSettingsView::~MpSettingsView()
{
TX_ENTRY
- delete mSoftKeyBack;
+ delete mNavigationBack;
TX_EXIT
}
@@ -83,17 +83,17 @@
}
mWindow = mainWindow();
- mSoftKeyBack = new HbAction(Hb::BackAction, this);
+ mNavigationBack = new HbAction(Hb::BackNaviAction, this);
mAudioEffectsWidget = new MpSettingsAudioEffectsWidget(this);
mAudioEffectsWidget->initialize();
setWidget( mAudioEffectsWidget );
- connect( mSoftKeyBack,
+ connect( mNavigationBack,
SIGNAL(triggered()),
this,
SLOT(back()) );
- connect( mSoftKeyBack,
+ connect( mNavigationBack,
SIGNAL(triggered()),
mAudioEffectsWidget,
SLOT(persistBalance()) );
@@ -106,7 +106,7 @@
void MpSettingsView::activateView()
{
TX_ENTRY
- setNavigationAction( mSoftKeyBack );
+ setNavigationAction( mNavigationBack );
TX_EXIT
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/mpnowplayingbanner/resources/nowplaying.docml Fri May 14 15:49:53 2010 +0300
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<hbdocument version="0.9">
+
+ <widget name="nowPlayingContainer" type="HbWidget">
+
+ <widget name="playPause" type="HbLabel">
+ <sizehint height="var(hb-param-graphic-size-function)" type="MAXIMUM"/>
+ <sizehint height="var(hb-param-graphic-size-function)" type="MINIMUM"/>
+ <sizehint width="var(hb-param-graphic-size-function)" type="MAXIMUM"/>
+ <sizehint width="var(hb-param-graphic-size-function)" type="MINIMUM"/>
+ </widget>
+
+ <widget name="primaryText" type="HbLabel">
+ <fontspec name="fontSpec" role="Primary"/>
+ </widget>
+
+ <widget name="secondaryText" type="HbLabel">
+ <fontspec name="fontSpec" role="Secondary"/>
+ </widget>
+
+ <layout type="anchor">
+ <anchoritem dst="playPause" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-screen)" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="playPause" dstEdge="TOP" spacing="expr(((2*var(hb-param-margin-gene-middle-vertical) + var(hb-param-text-height-primary) + var(hb-param-text-height-secondary))/2) - (var(hb-param-graphic-size-function)/2))" src="" srcEdge="TOP"/>
+
+ <anchoritem dst="primaryText" dstEdge="LEFT" spacing="var(hb-param-margin-gene-screen)" src="" srcEdge="LEFT"/>
+ <anchoritem dst="primaryText" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-screen)" src="playPause" srcEdge="LEFT"/>
+ <anchoritem dst="primaryText" dstEdge="TOP" spacing="var(hb-param-margin-gene-middle-vertical)" src="" srcEdge="TOP"/>
+
+ <anchoritem dst="secondaryText" dstEdge="LEFT" spacing="var(hb-param-margin-gene-screen)" src="" srcEdge="LEFT"/>
+ <anchoritem dst="secondaryText" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-screen)" src="playPause" srcEdge="LEFT"/>
+ <anchoritem dst="secondaryText" dstEdge="BOTTOM" spacing="-var(hb-param-margin-gene-middle-vertical)" src="" srcEdge="BOTTOM"/>
+ </layout>
+
+ </widget>
+
+</hbdocument>