videocollection/videofiledetailsview/src/videofiledetailsviewplugin.cpp
changeset 37 4eb2df7f7cbe
parent 36 8aed59de29f9
child 38 ff53afa8ad05
equal deleted inserted replaced
36:8aed59de29f9 37:4eb2df7f7cbe
    13 *
    13 *
    14 * Description:   VideoCollectionViewPlugin class implementation
    14 * Description:   VideoCollectionViewPlugin class implementation
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 69 %
    18 // Version : %version: 73 %
    19 
    19 
    20 // INCLUDE FILES
    20 // INCLUDE FILES
    21 #include <qcoreapplication.h>
    21 #include <qcoreapplication.h>
    22 #include <xqserviceutil.h>
    22 #include <xqserviceutil.h>
    23 #include <xqplugin.h>
    23 #include <xqplugin.h>
   122 	mModel = mCollectionWrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
   122 	mModel = mCollectionWrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
   123 
   123 
   124 	if (!mModel)
   124 	if (!mModel)
   125 		{
   125 		{
   126 	    ERROR(-1, "VideoFileDetailsViewPlugin::createView() get model failed.");
   126 	    ERROR(-1, "VideoFileDetailsViewPlugin::createView() get model failed.");
   127 		// TODO need to throw exception instead?
       
   128 		return;
   127 		return;
   129 		}
   128 		}
   130 
   129 
   131 	mIsService = XQServiceUtil::isService();
   130 	mIsService = XQServiceUtil::isService();
   132 
   131 
   202 		mThumbnailManager = new ThumbnailManager();
   201 		mThumbnailManager = new ThumbnailManager();
   203 	}
   202 	}
   204 
   203 
   205 	connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap,void*,int,int)),
   204 	connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap,void*,int,int)),
   206 			this, SLOT(thumbnailReadySlot(QPixmap,void*,int,int)));
   205 			this, SLOT(thumbnailReadySlot(QPixmap,void*,int,int)));
       
   206 	
       
   207     HbListWidget* list = findWidget<HbListWidget>(VIDEO_DETAILS_LISTWIDGET);
       
   208     if(!list)
       
   209     {
       
   210         ERROR(-1, "VideoFileDetailsViewPlugin::activateView() failed to load details list widget.");
       
   211         return;
       
   212     }
       
   213     
       
   214     list->setEnabledAnimations(HbAbstractItemView::None);
       
   215 
   207 }
   216 }
   208 
   217 
   209 // ---------------------------------------------------------------------------
   218 // ---------------------------------------------------------------------------
   210 // Destroy view
   219 // Destroy view
   211 // ---------------------------------------------------------------------------
   220 // ---------------------------------------------------------------------------
   532 // ---------------------------------------------------------------------------
   541 // ---------------------------------------------------------------------------
   533 //
   542 //
   534 void VideoFileDetailsViewPlugin::sendVideoSlot()
   543 void VideoFileDetailsViewPlugin::sendVideoSlot()
   535 {
   544 {
   536 	FUNC_LOG;
   545 	FUNC_LOG;
   537 	HbMessageBox::information(tr("Not implemented yet"));
   546 //	HbMessageBox::information(tr("Not implemented yet"));
   538 	
   547 	
   539 /*    if(mVideoId != TMPXItemId::InvalidId())
   548     if(mVideoId != TMPXItemId::InvalidId())
   540     {
   549     {
   541         ShareUi dialog;
   550         ShareUi dialog;
   542         QModelIndex modelIndex = mModel->indexOfId(mVideoId);
   551         QModelIndex modelIndex = mModel->indexOfId(mVideoId);
   543         QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyFilePath);
   552         QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyFilePath);
   544         if(variant.isValid())
   553         if(variant.isValid())
   545         {
   554         {
   546             QStringList fileList;
   555             QStringList fileList;
   547             fileList.append(variant.toString());
   556             fileList.append(variant.toString());
   548             dialog.send(fileList, true);
   557             dialog.send(fileList, true);
   549         }
   558         }
   550     }*/
   559     }
   551 }
   560 }
   552 
   561 
   553 // ---------------------------------------------------------------------------
   562 // ---------------------------------------------------------------------------
   554 // Slot: deleteVideo
   563 // Slot: deleteVideo
   555 // ---------------------------------------------------------------------------
   564 // ---------------------------------------------------------------------------
   565         if (variant.isValid())
   574         if (variant.isValid())
   566         {
   575         {
   567             QString text = hbTrId("txt_videos_info_do_you_want_to_delete_1").arg(
   576             QString text = hbTrId("txt_videos_info_do_you_want_to_delete_1").arg(
   568 			   variant.toString());
   577 			   variant.toString());
   569 
   578 
   570             if (HbMessageBox::question(text))
   579             HbMessageBox *messageBox = new HbMessageBox(text, HbMessageBox::MessageTypeQuestion);
   571             {
   580             messageBox->setAttribute(Qt::WA_DeleteOnClose);
   572                 deleteItem(modelIndex);
   581             messageBox->open(this, SLOT(deleteVideoDialogFinished(HbAction *)));
   573             }
   582             
   574         }
   583         }
       
   584     }
       
   585 }
       
   586 
       
   587 // ---------------------------------------------------------------------------
       
   588 // deleteVideoDialogFinished
       
   589 // ---------------------------------------------------------------------------
       
   590 //
       
   591 void VideoFileDetailsViewPlugin::deleteVideoDialogFinished(HbAction *action)
       
   592 {
       
   593     FUNC_LOG;
       
   594     HbMessageBox *dlg = static_cast<HbMessageBox*>(sender());
       
   595     QModelIndex modelIndex = mModel->indexOfId(mVideoId);
       
   596     if(action == dlg->actions().at(0) && modelIndex.isValid()) 
       
   597     {
       
   598         deleteItem(modelIndex);
   575     }
   599     }
   576 }
   600 }
   577 
   601 
   578 // ---------------------------------------------------------------------------
   602 // ---------------------------------------------------------------------------
   579 // deleteItem
   603 // deleteItem