30 #include "videocollectioncommon.h" |
30 #include "videocollectioncommon.h" |
31 #include "videocollectionviewutils.h" |
31 #include "videocollectionviewutils.h" |
32 #include "videosortfilterproxymodel.h" |
32 #include "videosortfilterproxymodel.h" |
33 #include "videocollectiontrace.h" |
33 #include "videocollectiontrace.h" |
34 |
34 |
|
35 // Object names. |
|
36 const char* const VIEW_UTILS_OBJECT_NAME_STATUS_MSG = "vc:ViewUtilsStatusMessage"; |
|
37 const char* const VIEW_UTILS_OBJECT_NAME_MESSAGE_BOX_WARNING = "vc:ViewUtilsMessageBoxWarning"; |
|
38 |
|
39 // Cenrep constants. |
35 const int KVideoCollectionViewCenrepUid(0x2002BC63); |
40 const int KVideoCollectionViewCenrepUid(0x2002BC63); |
36 const int KVideoCollectionViewCenrepServiceIconKey(0x2); |
41 const int KVideoCollectionViewCenrepServiceIconKey(0x2); |
37 const int KVideoCollectionViewCenrepServiceIconPressedKey(0x3); |
42 const int KVideoCollectionViewCenrepServiceIconPressedKey(0x3); |
38 const int KVideoCollectionViewCenrepVideoSortingRoleKey(0x5); |
43 const int KVideoCollectionViewCenrepVideoSortingRoleKey(0x5); |
39 const int KVideoCollectionViewCenrepVideoSortingOrderKey(0x6); |
44 const int KVideoCollectionViewCenrepVideoSortingOrderKey(0x6); |
40 const int KVideoCollectionViewCenrepCollectionsSortingRoleKey(0x7); |
45 const int KVideoCollectionViewCenrepCollectionsSortingRoleKey(0x7); |
41 const int KVideoCollectionViewCenrepCollectionsSortingOrderKey(0x8); |
46 const int KVideoCollectionViewCenrepCollectionsSortingOrderKey(0x8); |
42 |
47 |
|
48 const int KAddToCollectionDataCount(2); |
|
49 const int KAddToCollectionCountIndex(0); |
|
50 const int KAddToCollectionNameIndex(1); |
|
51 |
43 // --------------------------------------------------------------------------- |
52 // --------------------------------------------------------------------------- |
44 // instance |
53 // instance |
45 // --------------------------------------------------------------------------- |
54 // --------------------------------------------------------------------------- |
46 // |
55 // |
47 VideoCollectionViewUtils& VideoCollectionViewUtils::instance() |
56 VideoCollectionViewUtils& VideoCollectionViewUtils::instance() |
48 { |
57 { |
49 FUNC_LOG; |
58 FUNC_LOG; |
50 static VideoCollectionViewUtils _popupInstance; |
59 static VideoCollectionViewUtils _popupInstance; |
51 return _popupInstance; |
60 return _popupInstance; |
52 } |
61 } |
53 |
62 |
54 // --------------------------------------------------------------------------- |
63 // --------------------------------------------------------------------------- |
55 // VideoCollectionViewUtils |
64 // VideoCollectionViewUtils |
56 // --------------------------------------------------------------------------- |
65 // --------------------------------------------------------------------------- |
60 mCollectionsSortRole(-1), |
69 mCollectionsSortRole(-1), |
61 mVideosSortOrder(Qt::AscendingOrder), |
70 mVideosSortOrder(Qt::AscendingOrder), |
62 mCollectionsSortOrder(Qt::AscendingOrder) |
71 mCollectionsSortOrder(Qt::AscendingOrder) |
63 { |
72 { |
64 FUNC_LOG; |
73 FUNC_LOG; |
65 |
|
66 } |
74 } |
67 |
75 |
68 // --------------------------------------------------------------------------- |
76 // --------------------------------------------------------------------------- |
69 // ~VideoCollectionViewUtils |
77 // ~VideoCollectionViewUtils |
70 // --------------------------------------------------------------------------- |
78 // --------------------------------------------------------------------------- |
71 // |
79 // |
72 VideoCollectionViewUtils::~VideoCollectionViewUtils() |
80 VideoCollectionViewUtils::~VideoCollectionViewUtils() |
73 { |
81 { |
74 FUNC_LOG; |
82 FUNC_LOG; |
75 |
|
76 } |
83 } |
77 |
84 |
78 // --------------------------------------------------------------------------- |
85 // --------------------------------------------------------------------------- |
79 // saveSortingValues |
86 // saveSortingValues |
80 // --------------------------------------------------------------------------- |
87 // --------------------------------------------------------------------------- |
333 } |
340 } |
334 break; |
341 break; |
335 case VideoCollectionCommon::statusMultiRemoveFail: |
342 case VideoCollectionCommon::statusMultiRemoveFail: |
336 msg = hbTrId("txt_videos_info_unable_to_remove_some_collections"); |
343 msg = hbTrId("txt_videos_info_unable_to_remove_some_collections"); |
337 break; |
344 break; |
338 case VideoCollectionCommon::statusVideosAddedToCollection: |
345 case VideoCollectionCommon::statusVideosAddedToCollection: |
339 format = hbTrId("txt_videos_dpopinfo_videos_added_to_1"); |
346 // videos added to collection - status should containg both count and collection name |
340 if(additional.isValid()) |
347 if(additional.isValid() && additional.toList().count() == KAddToCollectionDataCount) |
341 { |
348 { |
342 msg = format.arg(additional.toString()); |
349 int count = additional.toList().at(KAddToCollectionCountIndex).toInt(); |
|
350 QString name = additional.toList().at(KAddToCollectionNameIndex).toString(); |
|
351 if(count && name.length()) |
|
352 { |
|
353 msg = hbTrId("txt_videos_dpopinfo_ln_videos_added_to_1", count).arg(name); |
|
354 } |
343 } |
355 } |
344 error = false; |
356 error = false; |
345 break; |
357 break; |
346 case VideoCollectionCommon::statusAllVideosAlreadyInCollection: |
358 case VideoCollectionCommon::statusAllVideosAlreadyInCollection: |
347 msg = hbTrId("txt_videos_info_all_videos_already_added_to_this_c"); |
359 msg = hbTrId("txt_videos_info_all_videos_already_added_to_this_c"); |
348 break; |
360 break; |
349 case VideoCollectionCommon::statusDeleteInProgress: |
361 case VideoCollectionCommon::statusDeleteInProgress: |
350 format = hbTrId("txt_videos_dpopinfo_ln_videos_are_being_deleted"); |
|
351 if(additional.isValid()) |
362 if(additional.isValid()) |
352 { |
363 { |
353 msg = format.arg(additional.toString()); |
364 msg = hbTrId("txt_videos_dpopinfo_ln_videos_are_being_deleted", additional.toInt()); |
354 } |
365 } |
355 error = false; |
366 error = false; |
356 break; |
367 break; |
357 default: // no msg to show |
368 default: // no msg to show |
358 return; |
369 return; |
360 |
371 |
361 if(msg.count() > 0) |
372 if(msg.count() > 0) |
362 { |
373 { |
363 if(error) |
374 if(error) |
364 { |
375 { |
365 HbMessageBox::warning(msg); |
376 HbMessageBox *messageBox = new HbMessageBox(msg, HbMessageBox::MessageTypeWarning); |
|
377 messageBox->setAttribute(Qt::WA_DeleteOnClose); |
|
378 messageBox->setObjectName(VIEW_UTILS_OBJECT_NAME_MESSAGE_BOX_WARNING); |
|
379 messageBox->show(); |
366 } |
380 } |
367 else |
381 else |
368 { |
382 { |
369 HbNotificationDialog *infoNote = new HbNotificationDialog(); |
383 HbNotificationDialog *infoNote = new HbNotificationDialog(); |
370 infoNote->setAttribute(Qt::WA_DeleteOnClose); |
384 infoNote->setAttribute(Qt::WA_DeleteOnClose); |
371 // only title can be two rows for HbNotificationDialog |
385 // only title can be two rows for HbNotificationDialog |
372 infoNote->setTitleTextWrapping(Hb::TextWordWrap); |
386 infoNote->setTitleTextWrapping(Hb::TextWordWrap); |
373 infoNote->setTitle(msg); |
387 infoNote->setTitle(msg); |
|
388 infoNote->setObjectName(VIEW_UTILS_OBJECT_NAME_STATUS_MSG); |
374 infoNote->show(); |
389 infoNote->show(); |
375 } |
390 } |
376 } |
391 } |
377 } |
392 } |
378 |
393 |
|
394 // End of file |