101 if(!mUiLoader) |
100 if(!mUiLoader) |
102 { |
101 { |
103 cleanup(); |
102 cleanup(); |
104 return -1; |
103 return -1; |
105 } |
104 } |
106 |
105 int videoListPhase = VideoCollectionUiLoaderParam::LoadPhasePrimary; |
107 if (XQServiceUtil::isService() && !mVideoServices) |
106 int collectionListPhase = VideoCollectionUiLoaderParam::LoadPhaseSecondary; |
108 { |
107 int collectionContentListPhase = VideoCollectionUiLoaderParam::LoadPhaseSecondary; |
109 INFO("VideoListView::initializeView() service flag set to true."); |
108 VideoCollectionCommon::TCollectionLevels level = VideoCollectionCommon::ELevelVideos; |
110 mIsService = true; |
109 if (XQServiceUtil::isService()) |
111 |
110 { |
112 mVideoServices = VideoServices::instance(); |
111 INFO("VideoListView::initializeView() initializing service."); |
113 |
|
114 if (!mVideoServices) |
112 if (!mVideoServices) |
115 { |
113 { |
116 ERROR(-1, "VideoListView::initializeView() getting services instance failed."); |
114 mVideoServices = VideoServices::instance(); |
117 cleanup(); |
115 connect(mVideoServices, SIGNAL(titleReady(const QString&)), |
118 return -1; |
116 this, SLOT(titleReadySlot(const QString&))); |
119 } |
117 } |
120 else |
118 |
121 { |
|
122 connect(mVideoServices, SIGNAL(titleReady(const QString&)), this, SLOT(titleReadySlot(const QString&))); |
|
123 } |
|
124 } |
119 } |
|
120 else |
|
121 { |
|
122 if(mVideoServices) |
|
123 { |
|
124 disconnect(mVideoServices, SIGNAL(titleReady(const QString&)), |
|
125 this, SLOT(titleReadySlot(const QString&))); |
|
126 mVideoServices->decreaseReferenceCount(); |
|
127 mVideoServices = 0; |
|
128 } |
|
129 VideoCollectionViewUtils::getActivityWidgetLevel(level); |
|
130 if(level == VideoCollectionCommon::ELevelCategory) |
|
131 { |
|
132 videoListPhase = VideoCollectionUiLoaderParam::LoadPhaseSecondary; |
|
133 collectionListPhase = VideoCollectionUiLoaderParam::LoadPhasePrimary; |
|
134 collectionContentListPhase = VideoCollectionUiLoaderParam::LoadPhaseSecondary; |
|
135 } |
|
136 else if(level == VideoCollectionCommon::ELevelDefaultColl || |
|
137 level == VideoCollectionCommon::ELevelAlbum) |
|
138 { |
|
139 videoListPhase = VideoCollectionUiLoaderParam::LoadPhaseSecondary; |
|
140 collectionListPhase = VideoCollectionUiLoaderParam::LoadPhasePrimary; |
|
141 collectionContentListPhase = VideoCollectionUiLoaderParam::LoadPhasePrimary; |
|
142 } |
|
143 } |
|
144 // start loading objects and widgets |
125 QList<VideoCollectionUiLoaderParam> params; |
145 QList<VideoCollectionUiLoaderParam> params; |
126 int videoListPhase = VideoCollectionUiLoaderParam::LoadPhasePrimary; |
146 |
127 int collectionListPhase = VideoCollectionUiLoaderParam::LoadPhaseSecondary; |
147 params.append(VideoCollectionUiLoaderParam( |
128 |
148 DOCML_NAME_VC_VIDEOLISTWIDGET, |
129 if(VideoCollectionViewUtils::loadWidgetLevel() == VideoCollectionCommon::ELevelCategory) |
149 DOCML_VIDEOCOLLECTIONVIEW_FILE, |
130 { |
150 true, |
131 videoListPhase = VideoCollectionUiLoaderParam::LoadPhaseSecondary; |
151 videoListPhase)); |
132 collectionListPhase = VideoCollectionUiLoaderParam::LoadPhasePrimary; |
152 |
133 |
153 params.append(VideoCollectionUiLoaderParam( |
134 |
154 DOCML_NAME_VC_COLLECTIONWIDGET, |
135 } |
155 DOCML_VIDEOCOLLECTIONVIEW_FILE, |
136 // start loading objects and widgets |
156 DOCML_VIDEOCOLLECTIONVIEW_SECTION_LIST, |
137 params.append(VideoCollectionUiLoaderParam( |
157 true, |
138 DOCML_NAME_VC_VIDEOLISTWIDGET, |
158 collectionListPhase)); |
139 DOCML_VIDEOCOLLECTIONVIEW_FILE, |
159 |
140 true, |
160 params.append(VideoCollectionUiLoaderParam( |
141 videoListPhase)); |
161 DOCML_NAME_VC_COLLECTIONCONTENTWIDGET, |
142 params.append(VideoCollectionUiLoaderParam( |
162 DOCML_VIDEOCOLLECTIONVIEW_FILE, |
143 DOCML_NAME_VC_COLLECTIONWIDGET, |
163 DOCML_VIDEOCOLLECTIONVIEW_SECTION_LIST, |
144 DOCML_VIDEOCOLLECTIONVIEW_FILE, |
164 true, |
145 DOCML_VIDEOCOLLECTIONVIEW_SECTION_LIST, |
165 collectionContentListPhase)); |
146 true, |
166 |
147 collectionListPhase)); |
|
148 |
|
149 params.append(VideoCollectionUiLoaderParam( |
167 params.append(VideoCollectionUiLoaderParam( |
150 DOCML_NAME_OPTIONS_MENU, |
168 DOCML_NAME_OPTIONS_MENU, |
151 DOCML_VIDEOCOLLECTIONVIEW_FILE, |
169 DOCML_VIDEOCOLLECTIONVIEW_FILE, |
152 true, |
170 true, |
153 VideoCollectionUiLoaderParam::LoadPhasePrimary)); |
171 VideoCollectionUiLoaderParam::LoadPhasePrimary)); |
193 VideoCollectionUiLoaderParam::LoadPhaseSecondary)); |
211 VideoCollectionUiLoaderParam::LoadPhaseSecondary)); |
194 params.append(VideoCollectionUiLoaderParam( |
212 params.append(VideoCollectionUiLoaderParam( |
195 DOCML_NAME_SORT_BY_SIZE, |
213 DOCML_NAME_SORT_BY_SIZE, |
196 DOCML_VIDEOCOLLECTIONVIEW_FILE, |
214 DOCML_VIDEOCOLLECTIONVIEW_FILE, |
197 false, |
215 false, |
198 VideoCollectionUiLoaderParam::LoadPhaseSecondary)); |
216 VideoCollectionUiLoaderParam::LoadPhaseSecondary)); |
199 params.append(VideoCollectionUiLoaderParam( |
|
200 DOCML_NAME_VC_COLLECTIONCONTENTWIDGET, |
|
201 DOCML_VIDEOCOLLECTIONVIEW_FILE, |
|
202 DOCML_VIDEOCOLLECTIONVIEW_SECTION_LIST, |
|
203 true, |
|
204 VideoCollectionUiLoaderParam::LoadPhaseSecondary)); // widget |
|
205 params.append(VideoCollectionUiLoaderParam( |
217 params.append(VideoCollectionUiLoaderParam( |
206 DOCML_NAME_DIALOG, |
218 DOCML_NAME_DIALOG, |
207 DOCML_VIDEOSELECTIONDIALOG_FILE, |
219 DOCML_VIDEOSELECTIONDIALOG_FILE, |
208 true, |
220 true, |
209 VideoCollectionUiLoaderParam::LoadPhaseSecondary)); |
221 VideoCollectionUiLoaderParam::LoadPhaseSecondary)); |
257 |
274 |
258 // --------------------------------------------------------------------------- |
275 // --------------------------------------------------------------------------- |
259 // activateView() |
276 // activateView() |
260 // --------------------------------------------------------------------------- |
277 // --------------------------------------------------------------------------- |
261 // |
278 // |
262 int VideoListView::activateView(const TMPXItemId &itemId) |
279 int VideoListView::activateView( TMPXItemId &itemId) |
263 { |
280 { |
264 FUNC_LOG; |
281 FUNC_LOG; |
265 |
282 |
266 int err = 0; |
283 int err = -1; |
267 |
284 |
268 // activate collection to correct view |
285 // activate collection to correct view |
269 if (itemId == TMPXItemId::InvalidId()) |
286 if (itemId == TMPXItemId::InvalidId()) |
270 { |
287 { |
271 err = activateVideosView(); |
288 |
272 } |
289 VideoCollectionCommon::TCollectionLevels level = VideoCollectionCommon::ELevelVideos; |
273 else |
290 if(!mVideoServices) |
|
291 { |
|
292 VideoCollectionViewUtils::getActivityWidgetLevel(level); |
|
293 } |
|
294 if(level == VideoCollectionCommon::ELevelCategory || |
|
295 level == VideoCollectionCommon::ELevelVideos) |
|
296 { |
|
297 err = activateMainView(); |
|
298 } |
|
299 else if(level == VideoCollectionCommon::ELevelDefaultColl || |
|
300 level == VideoCollectionCommon::ELevelAlbum) |
|
301 { |
|
302 // level is default or user defined collection |
|
303 // see if we have item id |
|
304 VideoCollectionViewUtils::getCollectionActivityData(itemId, mCollectionName); |
|
305 } |
|
306 } |
|
307 if(itemId != TMPXItemId::InvalidId()) |
274 { |
308 { |
275 err = activateCollectionContentView(itemId); |
309 err = activateCollectionContentView(itemId); |
276 } |
310 } |
277 |
311 |
|
312 if(!err) |
|
313 { |
|
314 |
|
315 err = createToolbar(); |
|
316 } |
|
317 |
278 // connect signals if everything went ok |
318 // connect signals if everything went ok |
279 if (err == 0) |
319 if (!err) |
280 { |
320 { |
281 HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0); |
321 HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0); |
282 mainWnd->setOrientation(Qt::Vertical, false); |
322 mainWnd->setOrientation(Qt::Vertical, false); |
283 if (!connect( |
323 if (!connect( |
284 mainWnd, SIGNAL(aboutToChangeOrientation()), |
324 mainWnd, SIGNAL(aboutToChangeOrientation()), |
491 |
534 |
492 // Collection view actions are not checkable |
535 // Collection view actions are not checkable |
493 mToolbarActions[ETBActionAllVideos]->setCheckable(true); |
536 mToolbarActions[ETBActionAllVideos]->setCheckable(true); |
494 mToolbarActions[ETBActionCollections]->setCheckable(true); |
537 mToolbarActions[ETBActionCollections]->setCheckable(true); |
495 |
538 |
496 if (!mIsService) |
539 if (!mVideoServices) |
497 { |
540 { |
498 mToolbarActions[ETBActionServices]->setCheckable(false); |
541 mToolbarActions[ETBActionServices]->setCheckable(false); |
499 } |
542 } |
500 |
543 VideoCollectionCommon::TCollectionLevels level = VideoCollectionCommon::ELevelVideos; |
501 if(mCurrentList->getLevel() == VideoCollectionCommon::ELevelCategory) |
544 if(mCurrentList) |
|
545 { |
|
546 level = mCurrentList->getLevel(); |
|
547 } |
|
548 if(level == VideoCollectionCommon::ELevelCategory) |
502 { |
549 { |
503 mToolbarActions[ETBActionCollections]->setChecked(true); |
550 mToolbarActions[ETBActionCollections]->setChecked(true); |
504 } |
551 bar->addActions(mToolbarViewsActionGroup->actions()); |
505 else |
552 } |
|
553 else if(level == VideoCollectionCommon::ELevelVideos ) |
506 { |
554 { |
507 mToolbarActions[ETBActionAllVideos]->setChecked(true); |
555 mToolbarActions[ETBActionAllVideos]->setChecked(true); |
508 } |
556 bar->addActions(mToolbarViewsActionGroup->actions()); |
509 |
557 } |
510 bar->addActions(mToolbarViewsActionGroup->actions()); |
558 else if(level == VideoCollectionCommon::ELevelAlbum) |
|
559 { |
|
560 bar->addActions(mToolbarCollectionActionGroup->actions()); |
|
561 } |
|
562 |
511 } |
563 } |
512 |
564 |
513 return 0; |
565 return 0; |
514 } |
566 } |
515 |
567 |
690 action->setVisible(show); |
742 action->setVisible(show); |
691 } |
743 } |
692 } |
744 } |
693 |
745 |
694 // --------------------------------------------------------------------------- |
746 // --------------------------------------------------------------------------- |
695 // activateVideosView() |
747 // activateMainView() |
696 // --------------------------------------------------------------------------- |
748 // --------------------------------------------------------------------------- |
697 // |
749 // |
698 int VideoListView::activateVideosView() |
750 int VideoListView::activateMainView() |
699 { |
751 { |
700 FUNC_LOG; |
752 FUNC_LOG; |
701 |
753 |
702 if(!mCurrentList) |
754 if(!mCurrentList) |
703 { |
755 { |
704 return -1; |
756 return -1; |
705 } |
757 } |
706 VideoCollectionCommon::TCollectionLevels level = mCurrentList->getLevel(); |
758 |
707 |
759 int result = mCurrentList->activate(); |
708 int result = mCurrentList->activate(level); |
|
709 if(result < 0) |
760 if(result < 0) |
710 { |
761 { |
711 ERROR(result, "VideoListView::activateVideosView() failed to activate."); |
762 ERROR(result, "VideoListView::activateVideosView() failed to activate."); |
712 // activate failed, deactivate view so we get rid of dangling connections. |
|
713 deactivateView(); |
|
714 return -1; |
763 return -1; |
715 } |
764 } |
716 |
765 |
717 if (createToolbar() != 0) |
766 return 0; |
718 { |
767 } |
719 ERROR(result, "VideoListView::activateVideosView() failed to create toolbar."); |
768 |
720 deactivateView(); |
769 // --------------------------------------------------------------------------- |
|
770 // activateCollectionContentView() |
|
771 // --------------------------------------------------------------------------- |
|
772 // |
|
773 int VideoListView::activateCollectionContentView(const TMPXItemId &itemId) |
|
774 { |
|
775 FUNC_LOG; |
|
776 |
|
777 // resolve collection name if possible |
|
778 if(itemId.iId2 == KVcxMvcMediaTypeCategory && mCollectionName.isEmpty()) |
|
779 { |
|
780 if (itemId.iId1 == KVcxMvcCategoryIdDownloads) |
|
781 { |
|
782 mCollectionName = hbTrId("txt_videos_dblist_downloaded"); |
|
783 } |
|
784 else if(itemId.iId1 == KVcxMvcCategoryIdCaptured) |
|
785 { |
|
786 mCollectionName = hbTrId("txt_videos_dblist_captured"); |
|
787 } |
|
788 else |
|
789 { |
|
790 // only downloads and captured are supported in default collections |
|
791 ERROR(-1, "VideoListView::activateVideosView() invalid defauld collection."); |
|
792 return -1; |
|
793 } |
|
794 } |
|
795 // at this point activation will fail if there's no collection name available |
|
796 if(mCollectionName.isEmpty()) |
|
797 { |
|
798 ERROR(-1, "VideoListView::activateVideosView() no collection name, cannot proceed."); |
721 return -1; |
799 return -1; |
722 } |
800 } |
723 |
801 |
|
802 // if current list at this point is already collection content, |
|
803 // no need to init again, just activate |
|
804 if(mCurrentList && |
|
805 (mCurrentList->getLevel() == VideoCollectionCommon::ELevelDefaultColl || |
|
806 mCurrentList->getLevel() == VideoCollectionCommon::ELevelAlbum)) |
|
807 { |
|
808 |
|
809 return mCurrentList->activate(); |
|
810 } |
|
811 // no currentlist, or currentlist differs, create and initialize all over |
|
812 collectionOpenedSlot(true, mCollectionName, itemId); |
|
813 |
|
814 if((!mCurrentList || !mCurrentList->getModel()) || |
|
815 (mCurrentList->getLevel() != VideoCollectionCommon::ELevelDefaultColl && |
|
816 mCurrentList->getLevel() != VideoCollectionCommon::ELevelAlbum )) |
|
817 { |
|
818 ERROR(-1, "VideoListView::activateVideosView() failed to init and activate collection."); |
|
819 return -1; |
|
820 } |
|
821 |
|
822 // if we're servicing, need to fetch sorting role from client |
|
823 // in normal use, sorting has set already at uiloader |
|
824 |
|
825 if (mVideoServices) |
|
826 { |
|
827 // TODO: service sorting roles needs to be defined somewhere |
|
828 int sortRole = mVideoServices->sortRole(); |
|
829 if(sortRole == 2) |
|
830 { |
|
831 sortRole = VideoCollectionCommon::KeyTitle; |
|
832 } |
|
833 else if(sortRole == 3) |
|
834 { |
|
835 sortRole = VideoCollectionCommon::KeySizeValue; |
|
836 } |
|
837 else |
|
838 { |
|
839 // default |
|
840 sortRole = VideoCollectionCommon::KeyDateTime; |
|
841 } |
|
842 mCurrentList->getModel()->doSorting(sortRole, Qt::AscendingOrder); |
|
843 } |
|
844 |
724 return 0; |
845 return 0; |
725 } |
|
726 |
|
727 // --------------------------------------------------------------------------- |
|
728 // activateCollectionContentView() |
|
729 // --------------------------------------------------------------------------- |
|
730 // |
|
731 int VideoListView::activateCollectionContentView(const TMPXItemId &itemId) |
|
732 { |
|
733 FUNC_LOG; |
|
734 int err = 0; |
|
735 |
|
736 if (itemId.iId2 == KVcxMvcMediaTypeCategory || |
|
737 itemId.iId2 == KVcxMvcMediaTypeAlbum) |
|
738 { |
|
739 // currently only captured and downloaded categories are supported |
|
740 switch (itemId.iId1) |
|
741 { |
|
742 case KVcxMvcCategoryIdDownloads: |
|
743 case KVcxMvcCategoryIdCaptured: |
|
744 { |
|
745 VideoListWidget *collectionContentWidget = |
|
746 mUiLoader->findWidget<VideoListWidget>( |
|
747 DOCML_NAME_VC_COLLECTIONCONTENTWIDGET); |
|
748 if (collectionContentWidget && collectionContentWidget->getModel()) |
|
749 { |
|
750 // no need to deactivate since there cannot be previous widget |
|
751 mCurrentList = collectionContentWidget; |
|
752 |
|
753 // resolve collection name |
|
754 if (itemId.iId1 == KVcxMvcCategoryIdDownloads) |
|
755 { |
|
756 mCollectionName = hbTrId("txt_videos_dblist_downloaded"); |
|
757 } |
|
758 else if (itemId.iId1 == KVcxMvcCategoryIdCaptured) |
|
759 { |
|
760 mCollectionName = hbTrId("txt_videos_dblist_captured"); |
|
761 } |
|
762 |
|
763 // activate collection content widget |
|
764 mCurrentList->activate(VideoCollectionCommon::ELevelDefaultColl); |
|
765 |
|
766 // open the model |
|
767 VideoSortFilterProxyModel *model = mCurrentList->getModel(); |
|
768 model->openItem(itemId); |
|
769 |
|
770 // sort model |
|
771 int sortRole = VideoCollectionCommon::KeyDateTime; |
|
772 if (mIsService && |
|
773 mVideoServices) |
|
774 { |
|
775 // TODO: sorting roles needs to be defined somewhere |
|
776 sortRole = mVideoServices->sortRole(); |
|
777 switch (sortRole) |
|
778 { |
|
779 // sort by name |
|
780 case 2: |
|
781 { |
|
782 sortRole = VideoCollectionCommon::KeyTitle; |
|
783 break; |
|
784 } |
|
785 // sort by size |
|
786 case 3: |
|
787 { |
|
788 sortRole = VideoCollectionCommon::KeySizeValue; |
|
789 break; |
|
790 } |
|
791 // date & time |
|
792 case 1: |
|
793 // fall through |
|
794 default: |
|
795 { |
|
796 sortRole = VideoCollectionCommon::KeyDateTime; |
|
797 break; |
|
798 } |
|
799 } |
|
800 } |
|
801 model->doSorting(sortRole, Qt::AscendingOrder); |
|
802 |
|
803 // set hint level to collections |
|
804 setHintLevel(VideoHintWidget::Collection); |
|
805 } |
|
806 else |
|
807 { |
|
808 ERROR(-1, "VideoListView::activateVideosView() failed to get collection content widget."); |
|
809 err = -1; |
|
810 } |
|
811 break; |
|
812 } |
|
813 default: |
|
814 { |
|
815 // by default open videos view |
|
816 err = activateVideosView(); |
|
817 break; |
|
818 } |
|
819 } |
|
820 |
|
821 } |
|
822 else |
|
823 { |
|
824 // open videos view |
|
825 err = activateVideosView(); |
|
826 } |
|
827 |
|
828 return err; |
|
829 } |
846 } |
830 |
847 |
831 // --------------------------------------------------------------------------- |
848 // --------------------------------------------------------------------------- |
832 // openAllVideosViewSlot() |
849 // openAllVideosViewSlot() |
833 // --------------------------------------------------------------------------- |
850 // --------------------------------------------------------------------------- |
941 { |
958 { |
942 order = Qt::DescendingOrder; |
959 order = Qt::DescendingOrder; |
943 } |
960 } |
944 model->doSorting(role, order); |
961 model->doSorting(role, order); |
945 |
962 |
946 if (mCurrentList == mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET)) |
963 // for video related sorting, all videos list and collection content |
|
964 // list, sorting orders are same all the time |
|
965 VideoListWidget *anotherVideosList = 0; |
|
966 VideoCollectionCommon::TCollectionLevels level = mCurrentList->getLevel(); |
|
967 if (level == VideoCollectionCommon::ELevelDefaultColl || |
|
968 level == VideoCollectionCommon::ELevelAlbum) |
947 { |
969 { |
948 VideoListWidget *allVideosList = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_VIDEOLISTWIDGET); |
970 anotherVideosList = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_VIDEOLISTWIDGET); |
949 if(allVideosList && allVideosList->getModel()) |
|
950 { |
|
951 allVideosList->getModel()->doSorting(role, order); |
|
952 } |
|
953 } |
971 } |
|
972 else if(level == VideoCollectionCommon::ELevelVideos) |
|
973 { |
|
974 anotherVideosList = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET); |
|
975 } |
|
976 if(anotherVideosList && anotherVideosList->getModel()) |
|
977 { |
|
978 anotherVideosList->getModel()->doSorting(role, order); |
|
979 } |
954 |
980 |
955 // save sorting values only if the application is not started as a service |
981 // save sorting values only if the application is not started as a service |
956 if (!mIsService) |
982 if (!mVideoServices) |
957 { |
983 { |
958 // save sorting values |
984 // save sorting values |
959 mUiUtils.saveSortingValues(role, order, mCurrentList->getLevel()); |
985 mUiUtils.saveSortingValues(role, order, mCurrentList->getLevel()); |
960 } |
986 } |
961 } |
987 } |
1270 |
1295 |
1271 // ------------------------------------------------------------------------------------------------- |
1296 // ------------------------------------------------------------------------------------------------- |
1272 // collectionOpenedSlot |
1297 // collectionOpenedSlot |
1273 // ------------------------------------------------------------------------------------------------- |
1298 // ------------------------------------------------------------------------------------------------- |
1274 // |
1299 // |
1275 void VideoListView::collectionOpenedSlot(bool collectionOpened, |
1300 void VideoListView::collectionOpenedSlot(bool openingCollection, |
1276 const QString& collection, |
1301 const QString& collection, |
1277 const QModelIndex &index) |
1302 const TMPXItemId &collectionId) |
1278 { |
1303 { |
1279 FUNC_LOG; |
1304 FUNC_LOG; |
1280 |
1305 |
1281 if(!mCurrentList || !mCurrentList->getModel()) |
|
1282 { |
|
1283 return; |
|
1284 } |
|
1285 // clear toolbar actions. |
1306 // clear toolbar actions. |
1286 toolBar()->clearActions(); |
1307 toolBar()->clearActions(); |
1287 |
1308 |
1288 VideoListWidget *collectionContentWidget = |
1309 VideoListWidget *collectionContentWidget = |
1289 mUiLoader->findWidget<VideoListWidget>( |
1310 mUiLoader->findWidget<VideoListWidget>( |
1298 |
1319 |
1299 // disable collection content animations during widget change |
1320 // disable collection content animations during widget change |
1300 HbAbstractItemView::ItemAnimations animationState = collectionContentWidget->enabledAnimations(); |
1321 HbAbstractItemView::ItemAnimations animationState = collectionContentWidget->enabledAnimations(); |
1301 collectionContentWidget->setEnabledAnimations(HbAbstractItemView::None); |
1322 collectionContentWidget->setEnabledAnimations(HbAbstractItemView::None); |
1302 |
1323 |
1303 if(collectionOpened) |
1324 if(openingCollection) |
1304 { |
1325 { |
1305 // open album view |
1326 // open album view |
1306 if (!index.isValid() || !mCurrentList || mCurrentList == collectionContentWidget) |
1327 if (collectionId == TMPXItemId::InvalidId() || mCurrentList == collectionContentWidget) |
1307 { |
1328 { |
1308 // no currentlist or currentlist is already collection content -list |
1329 // no currentlist or currentlist is already collection content -list |
1309 collectionContentWidget->setEnabledAnimations(animationState); |
1330 collectionContentWidget->setEnabledAnimations(animationState); |
1310 return; |
1331 return; |
1311 } |
1332 } |
1312 |
1333 |
1313 // get item id before deactivating |
|
1314 TMPXItemId itemId = mCurrentList->getModel()->getMediaIdAtIndex(index); |
|
1315 |
|
1316 // get level from the item to be opened only default |
1334 // get level from the item to be opened only default |
1317 // or user defined collections can be activated here |
1335 // or user defined collections can be activated here |
1318 VideoCollectionCommon::TCollectionLevels level = VideoCollectionCommon::ELevelInvalid; |
1336 VideoCollectionCommon::TCollectionLevels level = VideoCollectionCommon::ELevelInvalid; |
1319 if(itemId.iId2 == KVcxMvcMediaTypeCategory) |
1337 if(collectionId.iId2 == KVcxMvcMediaTypeCategory) |
1320 { |
1338 { |
1321 level = VideoCollectionCommon::ELevelDefaultColl; |
1339 level = VideoCollectionCommon::ELevelDefaultColl; |
1322 } |
1340 } |
1323 else if(itemId.iId2 == KVcxMvcMediaTypeAlbum) |
1341 else if(collectionId.iId2 == KVcxMvcMediaTypeAlbum) |
1324 { |
1342 { |
1325 level = VideoCollectionCommon::ELevelAlbum; |
1343 level = VideoCollectionCommon::ELevelAlbum; |
1326 } |
1344 } |
1327 else |
1345 else |
1328 { |
1346 { |
1409 } |
1436 } |
1410 else if (name.compare(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET) == 0) |
1437 else if (name.compare(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET) == 0) |
1411 { |
1438 { |
1412 connect(object, SIGNAL(command(int)), this, SIGNAL(command(int))); |
1439 connect(object, SIGNAL(command(int)), this, SIGNAL(command(int))); |
1413 connect( |
1440 connect( |
1414 object, SIGNAL(collectionOpened(bool, const QString&, const QModelIndex&)), |
1441 object, SIGNAL(collectionOpened(bool, const QString&, const TMPXItemId&)), |
1415 this, SLOT(collectionOpenedSlot(bool, const QString&, const QModelIndex&))); |
1442 this, SLOT(collectionOpenedSlot(bool, const QString&, const TMPXItemId&))); |
1416 if(mCurrentList != object) |
1443 if(mCurrentList != object) |
1417 { |
1444 { |
1418 // this widget not yet activated so it's has been created on the second phase |
1445 // this widget not yet activated so it's has been created on the second phase |
1419 // safe to call doDelayed right away |
1446 // safe to call doDelayed right away |
1420 qobject_cast<VideoListWidget*>(object)->doDelayedsSlot(); |
1447 qobject_cast<VideoListWidget*>(object)->doDelayedsSlot(); |