videocollection/videocollectionwrapper/src/videocollectionclient.cpp
changeset 52 e3cecb93e76a
parent 17 69946d1824c4
equal deleted inserted replaced
47:45e72b57a2fd 52:e3cecb93e76a
    13 *
    13 *
    14 * Description:   VideoCollectionClient class implementation
    14 * Description:   VideoCollectionClient class implementation
    15 * 
    15 * 
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 39 %
    18 // Version : %version: 41 %
    19 
    19 
    20 // INCLUDE FILES
    20 // INCLUDE FILES
    21 #include <qobject.h>
    21 #include <qobject.h>
    22 #include <centralrepository.h>
    22 #include <centralrepository.h>
    23 #include <mpxcollectionutility.h>
    23 #include <mpxcollectionutility.h>
   206 
   206 
   207 // -----------------------------------------------------------------------------
   207 // -----------------------------------------------------------------------------
   208 // openItem
   208 // openItem
   209 // -----------------------------------------------------------------------------
   209 // -----------------------------------------------------------------------------
   210 //
   210 //
   211 int VideoCollectionClient::openItem(TMPXItemId &mediaId)
   211 int VideoCollectionClient::openItem(const TMPXItemId &mediaId)
   212 {
   212 {
   213 	FUNC_LOG;
   213 	FUNC_LOG;
   214     if(!mCollectionUtility)
   214     if(!mCollectionUtility)
   215     {
   215     {
   216         return -1;
   216         return -1;
   245 
   245 
   246 // -----------------------------------------------------------------------------
   246 // -----------------------------------------------------------------------------
   247 // fetchMpxMediaByMpxId
   247 // fetchMpxMediaByMpxId
   248 // -----------------------------------------------------------------------------
   248 // -----------------------------------------------------------------------------
   249 //
   249 //
   250 int VideoCollectionClient::fetchMpxMediaByMpxId(TMPXItemId &mpxId)
   250 int VideoCollectionClient::fetchMpxMediaByMpxId(const TMPXItemId &mpxId)
   251 {
   251 {
   252 	FUNC_LOG;
   252 	FUNC_LOG;
   253     if(!mCollectionUtility)
   253     if(!mCollectionUtility)
   254     {
   254     {
   255         return -1;
   255         return -1;
   261 
   261 
   262 // -----------------------------------------------------------------------------
   262 // -----------------------------------------------------------------------------
   263 // getVideoDetails
   263 // getVideoDetails
   264 // -----------------------------------------------------------------------------
   264 // -----------------------------------------------------------------------------
   265 //
   265 //
   266 int VideoCollectionClient::getVideoDetails(TMPXItemId &mediaId)
   266 int VideoCollectionClient::getVideoDetails(const TMPXItemId &mediaId)
   267 {
   267 {
   268 	FUNC_LOG;
   268 	FUNC_LOG;
   269     if(!mCollectionUtility)
   269     if(!mCollectionUtility)
   270     {
   270     {
   271         return -1;
   271         return -1;
   317 
   317 
   318 // -----------------------------------------------------------------------------
   318 // -----------------------------------------------------------------------------
   319 // addItemsInAlbum
   319 // addItemsInAlbum
   320 // -----------------------------------------------------------------------------
   320 // -----------------------------------------------------------------------------
   321 //
   321 //
   322 int VideoCollectionClient::addItemsInAlbum(TMPXItemId &albumId,
   322 int VideoCollectionClient::addItemsInAlbum(const TMPXItemId &albumId,
   323         const QList<TMPXItemId> &mediaIds)
   323         const QList<TMPXItemId> &mediaIds)
   324 {
   324 {
   325 	FUNC_LOG;
   325 	FUNC_LOG;
   326     int err(-1);
   326     int err(-1);
   327     
   327     
   336 
   336 
   337 // -----------------------------------------------------------------------------
   337 // -----------------------------------------------------------------------------
   338 // removeItemsFromAlbum
   338 // removeItemsFromAlbum
   339 // -----------------------------------------------------------------------------
   339 // -----------------------------------------------------------------------------
   340 //
   340 //
   341 int VideoCollectionClient::removeItemsFromAlbum(TMPXItemId &albumId, 
   341 int VideoCollectionClient::removeItemsFromAlbum(const TMPXItemId &albumId, 
   342         const QList<TMPXItemId> &mediaIds)
   342         const QList<TMPXItemId> &mediaIds)
   343 {
   343 {
   344 	FUNC_LOG;
   344 	FUNC_LOG;
   345     int err(-1);
   345     int err(-1);
   346         
   346         
   352     
   352     
   353     return err;
   353     return err;
   354 }
   354 }
   355 
   355 
   356 // -----------------------------------------------------------------------------
   356 // -----------------------------------------------------------------------------
   357 // renameAlbum
   357 // renameItem
   358 // -----------------------------------------------------------------------------
   358 // -----------------------------------------------------------------------------
   359 //
   359 //
   360 int VideoCollectionClient::renameAlbum(const TMPXItemId &albumId, 
   360 int VideoCollectionClient::renameItem(const TMPXItemId &itemId, 
   361         const QString &newTitle) 
   361         const QString &newTitle) 
   362 {
   362 {
   363 	FUNC_LOG;
   363 	FUNC_LOG;
   364     int err(-1);
   364     int err(-1);
   365 
   365 
   366     if(mCollectionUtility && albumId.iId2 == KVcxMvcMediaTypeAlbum && 
   366     if(mCollectionUtility && !newTitle.isEmpty() &&
   367        !newTitle.isEmpty())
   367        (itemId.iId2 == KVcxMvcMediaTypeAlbum ||
   368     {
   368         itemId.iId2 == KVcxMvcMediaTypeVideo ) )
   369         TRAP(err, renameAlbumL(albumId, newTitle));
   369     {
       
   370         TRAP(err, renameL(itemId, newTitle));
   370     }
   371     }
   371 
   372 
   372     return err;
   373     return err;
   373 }
   374 }
   374 
   375 
   451 
   452 
   452 // -----------------------------------------------------------------------------
   453 // -----------------------------------------------------------------------------
   453 // openVideoL
   454 // openVideoL
   454 // -----------------------------------------------------------------------------
   455 // -----------------------------------------------------------------------------
   455 //
   456 //
   456 void VideoCollectionClient::openVideoL(TMPXItemId &videoId)
   457 void VideoCollectionClient::openVideoL(const TMPXItemId &videoId)
   457 {
   458 {
   458 	FUNC_LOG;
   459 	FUNC_LOG;
   459     if(!mCollectionUtility)
   460     if(!mCollectionUtility)
   460     {
   461     {
   461         User::Leave(KErrGeneral);
   462         User::Leave(KErrGeneral);
   473 
   474 
   474 // -----------------------------------------------------------------------------
   475 // -----------------------------------------------------------------------------
   475 // openCategoryL
   476 // openCategoryL
   476 // -----------------------------------------------------------------------------
   477 // -----------------------------------------------------------------------------
   477 //
   478 //
   478 void VideoCollectionClient::openCategoryL(TMPXItemId &id)
   479 void VideoCollectionClient::openCategoryL(const TMPXItemId &id)
   479 {    
   480 {    
   480 	FUNC_LOG;
   481 	FUNC_LOG;
   481     if(!mCollectionUtility)
   482     if(!mCollectionUtility)
   482     {
   483     {
   483         User::Leave(KErrGeneral);
   484         User::Leave(KErrGeneral);
   520 
   521 
   521 // -----------------------------------------------------------------------------
   522 // -----------------------------------------------------------------------------
   522 // getVideoDetailsL
   523 // getVideoDetailsL
   523 // -----------------------------------------------------------------------------
   524 // -----------------------------------------------------------------------------
   524 //
   525 //
   525 void VideoCollectionClient::getVideoDetailsL(TMPXItemId &videoId)
   526 void VideoCollectionClient::getVideoDetailsL(const TMPXItemId &videoId)
   526 {
   527 {
   527 	FUNC_LOG;
   528 	FUNC_LOG;
   528     if(!mCollectionUtility)
   529     if(!mCollectionUtility)
   529     {
   530     {
   530         User::Leave(KErrGeneral);
   531         User::Leave(KErrGeneral);
   626 
   627 
   627 // -----------------------------------------------------------------------------
   628 // -----------------------------------------------------------------------------
   628 // addItemsInAlbumL
   629 // addItemsInAlbumL
   629 // -----------------------------------------------------------------------------
   630 // -----------------------------------------------------------------------------
   630 //
   631 //
   631 void VideoCollectionClient::addItemsInAlbumL(TMPXItemId &albumId,
   632 void VideoCollectionClient::addItemsInAlbumL(const TMPXItemId &albumId,
   632     const QList<TMPXItemId> &mediaIds)
   633     const QList<TMPXItemId> &mediaIds)
   633 {
   634 {
   634 	FUNC_LOG;
   635 	FUNC_LOG;
   635     CMPXCommand* cmd = CMPXCommand::NewL();
   636     CMPXCommand* cmd = CMPXCommand::NewL();
   636     CleanupStack::PushL(cmd);
   637     CleanupStack::PushL(cmd);
   672 
   673 
   673 // -----------------------------------------------------------------------------
   674 // -----------------------------------------------------------------------------
   674 // removeItemsFromAlbumL
   675 // removeItemsFromAlbumL
   675 // -----------------------------------------------------------------------------
   676 // -----------------------------------------------------------------------------
   676 //
   677 //
   677 void VideoCollectionClient::removeItemsFromAlbumL(TMPXItemId &albumId, 
   678 void VideoCollectionClient::removeItemsFromAlbumL(const TMPXItemId &albumId, 
   678                                                 const QList<TMPXItemId> &mediaIds)
   679                                                 const QList<TMPXItemId> &mediaIds)
   679 {
   680 {
   680 	FUNC_LOG;
   681 	FUNC_LOG;
   681     CMPXCommand* cmd = CMPXCommand::NewL();
   682     CMPXCommand* cmd = CMPXCommand::NewL();
   682     CleanupStack::PushL(cmd);
   683     CleanupStack::PushL(cmd);
   714     CleanupStack::PopAndDestroy(array);
   715     CleanupStack::PopAndDestroy(array);
   715     CleanupStack::PopAndDestroy(cmd);
   716     CleanupStack::PopAndDestroy(cmd);
   716 }
   717 }
   717 
   718 
   718 // -----------------------------------------------------------------------------
   719 // -----------------------------------------------------------------------------
   719 // renameAlbumL
   720 // renameL
   720 // -----------------------------------------------------------------------------
   721 // -----------------------------------------------------------------------------
   721 //
   722 //
   722 void VideoCollectionClient::renameAlbumL(const TMPXItemId &albumId, const QString newTitle)
   723 void VideoCollectionClient::renameL(const TMPXItemId &itemId, const QString newTitle)
   723 {
   724 {
   724 	FUNC_LOG;
   725 	FUNC_LOG;
   725     CMPXMedia *media = CMPXMedia::NewL();
   726     CMPXMedia *media = CMPXMedia::NewL();
   726     CleanupStack::PushL(media);
   727     CleanupStack::PushL(media);
   727     TPtrC titlePtrC(newTitle.utf16());
   728     TPtrC titlePtrC(newTitle.utf16());
   728     media->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, albumId);
   729     media->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, itemId);
   729     media->SetTextValueL(KMPXMediaGeneralTitle, titlePtrC);
   730     media->SetTextValueL(KMPXMediaGeneralTitle, titlePtrC);
   730 
   731 
   731     CMPXCommand* cmd = CMPXMedia::NewL();
   732     CMPXCommand* cmd = CMPXMedia::NewL();
   732     CleanupStack::PushL( cmd );
   733     CleanupStack::PushL( cmd );
   733     
   734     
   745 
   746 
   746 // -----------------------------------------------------------------------------
   747 // -----------------------------------------------------------------------------
   747 // fetchMpxMediaByMpxIdL
   748 // fetchMpxMediaByMpxIdL
   748 // -----------------------------------------------------------------------------
   749 // -----------------------------------------------------------------------------
   749 //
   750 //
   750 void VideoCollectionClient::fetchMpxMediaByMpxIdL(TMPXItemId &aMpxId)
   751 void VideoCollectionClient::fetchMpxMediaByMpxIdL(const TMPXItemId &aMpxId)
   751 {
   752 {
   752 	FUNC_LOG;
   753 	FUNC_LOG;
   753     if(!mCollectionUtility)
   754     if(!mCollectionUtility)
   754     {
   755     {
   755         User::Leave(KErrGeneral);
   756         User::Leave(KErrGeneral);