28 #include <hbinstance.h> |
28 #include <hbinstance.h> |
29 #include <hbmainwindow.h> |
29 #include <hbmainwindow.h> |
30 #include <hblistviewitem.h> |
30 #include <hblistviewitem.h> |
31 #include <hbmessagebox.h> |
31 #include <hbmessagebox.h> |
32 #include <hbinputdialog.h> |
32 #include <hbinputdialog.h> |
|
33 #include <hbparameterlengthlimiter.h> |
33 #include <vcxmyvideosdefs.h> |
34 #include <vcxmyvideosdefs.h> |
34 |
35 |
35 #include "videocollectionviewutils.h" |
36 #include "videocollectionviewutils.h" |
36 #include "videocollectionuiloader.h" |
37 #include "videocollectionuiloader.h" |
37 #include "videolistselectiondialog.h" |
38 #include "videolistselectiondialog.h" |
198 } |
199 } |
199 |
200 |
200 // Enable thumbnail background fetching. |
201 // Enable thumbnail background fetching. |
201 VideoThumbnailData &thumbnailData = VideoThumbnailData::instance(); |
202 VideoThumbnailData &thumbnailData = VideoThumbnailData::instance(); |
202 thumbnailData.enableBackgroundFetching(true); |
203 thumbnailData.enableBackgroundFetching(true); |
203 thumbnailData.startBackgroundFetching(mModel, 0); |
204 fetchThumbnailsForVisibleItems(); |
204 |
205 |
205 return 0; |
206 return 0; |
206 } |
207 } |
207 |
208 |
208 // --------------------------------------------------------------------------- |
209 // --------------------------------------------------------------------------- |
378 QModelIndex index = currentIndex(); |
379 QModelIndex index = currentIndex(); |
379 variant = mModel->data(index, VideoCollectionCommon::KeyTitle); |
380 variant = mModel->data(index, VideoCollectionCommon::KeyTitle); |
380 |
381 |
381 if (variant.isValid()) |
382 if (variant.isValid()) |
382 { |
383 { |
383 QString text = hbTrId("txt_videos_info_do_you_want_to_delete_1").arg( |
384 QString text = HbParameterLengthLimiter( |
384 variant.toString()); |
385 hbTrId("txt_videos_info_do_you_want_to_delete_1")).arg(variant.toString()); |
385 |
386 |
386 HbMessageBox *messageBox = new HbMessageBox(text, HbMessageBox::MessageTypeQuestion); |
387 HbMessageBox *messageBox = new HbMessageBox(text, HbMessageBox::MessageTypeQuestion); |
|
388 messageBox->setStandardButtons(HbMessageBox::Yes | HbMessageBox::No); |
387 messageBox->setAttribute(Qt::WA_DeleteOnClose); |
389 messageBox->setAttribute(Qt::WA_DeleteOnClose); |
388 messageBox->setObjectName(LIST_WIDGET_OBJECT_NAME_DELETE_VIDEO); |
390 messageBox->setObjectName(LIST_WIDGET_OBJECT_NAME_DELETE_VIDEO); |
389 messageBox->open(this, SLOT(deleteItemDialogFinished(HbAction *))); |
391 messageBox->open(this, SLOT(deleteItemDialogFinished(int))); |
390 } |
392 } |
391 } |
393 } |
392 |
394 |
393 // --------------------------------------------------------------------------- |
395 // --------------------------------------------------------------------------- |
394 // deleteItemDialogFinished |
396 // deleteItemDialogFinished |
395 // --------------------------------------------------------------------------- |
397 // --------------------------------------------------------------------------- |
396 // |
398 // |
397 void VideoListWidget::deleteItemDialogFinished(HbAction *action) |
399 void VideoListWidget::deleteItemDialogFinished(int action) |
398 { |
400 { |
399 HbMessageBox *dlg = static_cast<HbMessageBox*>(sender()); |
401 if(action == HbMessageBox::Yes) |
400 if(action == dlg->actions().at(0)) |
|
401 { |
402 { |
402 QModelIndex index = currentIndex(); |
403 QModelIndex index = currentIndex(); |
403 if(index.isValid()) |
404 if(index.isValid()) |
404 { |
405 { |
405 QModelIndexList list; |
406 QModelIndexList list; |
895 QModelIndex index = currentIndex(); |
896 QModelIndex index = currentIndex(); |
896 variant = mModel->data(index, VideoCollectionCommon::KeyTitle); |
897 variant = mModel->data(index, VideoCollectionCommon::KeyTitle); |
897 |
898 |
898 if (variant.isValid()) |
899 if (variant.isValid()) |
899 { |
900 { |
900 QString text = hbTrId("txt_videos_info_do_you_want_to_remove_collection").arg( |
901 QString text = HbParameterLengthLimiter( |
901 variant.toString()); |
902 hbTrId("txt_videos_info_do_you_want_to_remove_collection")).arg(variant.toString()); |
|
903 |
902 HbMessageBox *messageBox = new HbMessageBox(text, HbMessageBox::MessageTypeQuestion); |
904 HbMessageBox *messageBox = new HbMessageBox(text, HbMessageBox::MessageTypeQuestion); |
|
905 messageBox->setStandardButtons(HbMessageBox::Yes | HbMessageBox::No); |
903 messageBox->setAttribute(Qt::WA_DeleteOnClose); |
906 messageBox->setAttribute(Qt::WA_DeleteOnClose); |
904 messageBox->setObjectName(LIST_WIDGET_OBJECT_NAME_REMOVE_COLLECTION); |
907 messageBox->setObjectName(LIST_WIDGET_OBJECT_NAME_REMOVE_COLLECTION); |
905 messageBox->open(this, SLOT(removeCollectionDialogFinished(HbAction *))); |
908 messageBox->open(this, SLOT(removeCollectionDialogFinished(int))); |
906 } |
909 } |
907 } |
910 } |
908 |
911 |
909 // --------------------------------------------------------------------------- |
912 // --------------------------------------------------------------------------- |
910 // removeCollectionDialogFinished |
913 // removeCollectionDialogFinished |
911 // --------------------------------------------------------------------------- |
914 // --------------------------------------------------------------------------- |
912 // |
915 // |
913 void VideoListWidget::removeCollectionDialogFinished(HbAction *action) |
916 void VideoListWidget::removeCollectionDialogFinished(int action) |
914 { |
917 { |
915 HbMessageBox *dlg = static_cast<HbMessageBox*>(sender()); |
918 if(action == HbMessageBox::Yes) |
916 if(action == dlg->actions().at(0)) |
|
917 { |
919 { |
918 QModelIndex index = currentIndex(); |
920 QModelIndex index = currentIndex(); |
919 if(index.isValid()) |
921 if(index.isValid()) |
920 { |
922 { |
921 QModelIndexList list; |
923 QModelIndexList list; |
1012 if(itemsVisible.count() > 0) |
1014 if(itemsVisible.count() > 0) |
1013 { |
1015 { |
1014 int row = itemsVisible.value(0)->modelIndex().row(); |
1016 int row = itemsVisible.value(0)->modelIndex().row(); |
1015 VideoThumbnailData::instance().startBackgroundFetching(mModel, row); |
1017 VideoThumbnailData::instance().startBackgroundFetching(mModel, row); |
1016 } |
1018 } |
|
1019 else |
|
1020 { |
|
1021 // Nothing visible yet, start from first index. |
|
1022 VideoThumbnailData::instance().startBackgroundFetching(mModel, 0); |
|
1023 } |
|
1024 } |
|
1025 |
|
1026 // --------------------------------------------------------------------------- |
|
1027 // rowsInserted |
|
1028 // --------------------------------------------------------------------------- |
|
1029 // |
|
1030 void VideoListWidget::rowsInserted(const QModelIndex &parent, int start, int end) |
|
1031 { |
|
1032 FUNC_LOG_ADDR(this); |
|
1033 Q_UNUSED(parent); |
|
1034 Q_UNUSED(start); |
|
1035 Q_UNUSED(end); |
|
1036 fetchThumbnailsForVisibleItems(); |
|
1037 HbListView::rowsInserted(parent, start, end); |
|
1038 } |
|
1039 |
|
1040 // --------------------------------------------------------------------------- |
|
1041 // rowsRemoved |
|
1042 // --------------------------------------------------------------------------- |
|
1043 // |
|
1044 void VideoListWidget::rowsRemoved(const QModelIndex &parent, int start, int end) |
|
1045 { |
|
1046 FUNC_LOG_ADDR(this); |
|
1047 Q_UNUSED(parent); |
|
1048 Q_UNUSED(start); |
|
1049 Q_UNUSED(end); |
|
1050 fetchThumbnailsForVisibleItems(); |
|
1051 HbListView::rowsRemoved(parent, start, end); |
1017 } |
1052 } |
1018 |
1053 |
1019 // end of file |
1054 // end of file |