equal
deleted
inserted
replaced
47 //selecet preview-icon query |
47 //selecet preview-icon query |
48 _LIT(KSelectPreviewIconStmt,"SELECT message_id, preview_icon FROM conversation_messages WHERE message_id = :message_id "); |
48 _LIT(KSelectPreviewIconStmt,"SELECT message_id, preview_icon FROM conversation_messages WHERE message_id = :message_id "); |
49 |
49 |
50 // preview-cache max cost (items) |
50 // preview-cache max cost (items) |
51 const int CACHE_COST = 50; |
51 const int CACHE_COST = 50; |
|
52 //Preview thumbnail size |
|
53 const int KWidth = 9.5 * 6.7; |
|
54 const int KHeight = 9.5 * 6.7; |
52 //--------------------------------------------------------------- |
55 //--------------------------------------------------------------- |
53 // ConversationsModel::ConversationsModel |
56 // ConversationsModel::ConversationsModel |
54 // Constructor |
57 // Constructor |
55 //--------------------------------------------------------------- |
58 //--------------------------------------------------------------- |
56 ConversationsModel::ConversationsModel(ConversationMsgStoreHandler* msgStoreHandler, |
59 ConversationsModel::ConversationsModel(ConversationMsgStoreHandler* msgStoreHandler, |
510 |
513 |
511 //fallback option incase of db operation failure or enry not found in DB |
514 //fallback option incase of db operation failure or enry not found in DB |
512 //populate from data plugins |
515 //populate from data plugins |
513 if (!isEntryInDb || err != KErrNone) |
516 if (!isEntryInDb || err != KErrNone) |
514 { |
517 { |
515 iMmsDataPlugin->setMessageId(entry.EntryId()); |
518 int error = iMmsDataPlugin->setMessageId(entry.EntryId()); |
|
519 if(error != KErrNone) |
|
520 { |
|
521 // skip all |
|
522 return; |
|
523 } |
516 int msgProperty = 0; |
524 int msgProperty = 0; |
517 |
525 |
518 if (iMmsDataPlugin->attachmentCount() > 0) |
526 if (iMmsDataPlugin->attachmentCount() > 0) |
519 { |
527 { |
520 msgProperty |= EPreviewAttachment; |
528 msgProperty |= EPreviewAttachment; |
550 textContent = file.readAll(); |
558 textContent = file.readAll(); |
551 item.setData(textContent, BodyText); |
559 item.setData(textContent, BodyText); |
552 isBodyTextSet = true; |
560 isBodyTextSet = true; |
553 file.close(); |
561 file.close(); |
554 } |
562 } |
555 if (!isImageSet && objectList[index]->mimetype().contains( |
563 if (!isVideoSet && !isImageSet && objectList[index]->mimetype().contains( |
556 "image")) |
564 "image")) |
557 { |
565 { |
558 isImageSet = true; |
566 isImageSet = true; |
559 msgProperty |= EPreviewImage; |
567 msgProperty |= EPreviewImage; |
560 if (objectList[index]->isProtected()) |
568 if (objectList[index]->isProtected()) |
565 { |
573 { |
566 msgProperty |= EPreviewCorruptedImage; |
574 msgProperty |= EPreviewCorruptedImage; |
567 } |
575 } |
568 imagePath = objectList[index]->path(); |
576 imagePath = objectList[index]->path(); |
569 } |
577 } |
570 if (!isAudioSet && objectList[index]->mimetype().contains( |
578 if (!isVideoSet && !isAudioSet && objectList[index]->mimetype().contains( |
571 "audio")) |
579 "audio")) |
572 { |
580 { |
573 msgProperty |= EPreviewAudio; |
581 msgProperty |= EPreviewAudio; |
574 if (objectList[index]->isProtected()) |
582 if (objectList[index]->isProtected()) |
575 { |
583 { |
579 { |
587 { |
580 msgProperty |= EPreviewCorruptedAudio; |
588 msgProperty |= EPreviewCorruptedAudio; |
581 } |
589 } |
582 isAudioSet = true; |
590 isAudioSet = true; |
583 } |
591 } |
584 if (!isVideoSet && objectList[index]->mimetype().contains( |
592 if (!( isImageSet || isAudioSet) && !isVideoSet && objectList[index]->mimetype().contains( |
585 "video")) |
593 "video")) |
586 { |
594 { |
587 isVideoSet = true; |
595 isVideoSet = true; |
588 msgProperty |= EPreviewVideo; |
596 msgProperty |= EPreviewVideo; |
589 if (objectList[index]->isProtected()) |
597 if (objectList[index]->isProtected()) |
602 delete slide; |
610 delete slide; |
603 } |
611 } |
604 } |
612 } |
605 QPixmap pixmap; |
613 QPixmap pixmap; |
606 //populate item with the attachment list |
614 //populate item with the attachment list |
|
615 //TODO: This code is not required bcoz video icon is show and not preview |
607 if (isVideoSet) |
616 if (isVideoSet) |
608 { |
617 { |
609 item.setData(videoPath, Attachments); |
618 item.setData(videoPath, Attachments); |
610 // Store thumbnail only for non protected, non corrupted content. |
619 // Store thumbnail only for non protected, non corrupted content. |
611 if (!(EPreviewProtectedVideo & msgProperty) && |
620 if (!(EPreviewProtectedVideo & msgProperty) && |
823 |
832 |
824 // if not found in db, set from file path |
833 // if not found in db, set from file path |
825 if (!inDb) |
834 if (!inDb) |
826 { |
835 { |
827 QPixmap pixmap(filePath); |
836 QPixmap pixmap(filePath); |
828 QPixmap scaledPixmap = pixmap.scaled(63.65, 63.65, Qt::IgnoreAspectRatio); |
837 QPixmap scaledPixmap = pixmap.scaled(KWidth, KHeight, Qt::IgnoreAspectRatio); |
829 HbIcon *previewIcon = new HbIcon(scaledPixmap); |
838 HbIcon *previewIcon = new HbIcon(scaledPixmap); |
830 |
839 |
831 previewIconCache.insert(msgId, previewIcon); |
840 previewIconCache.insert(msgId, previewIcon); |
832 |
841 |
833 } |
842 } |
961 { |
970 { |
962 clear(); |
971 clear(); |
963 previewIconCache.clear(); |
972 previewIconCache.clear(); |
964 } |
973 } |
965 |
974 |
|
975 void ConversationsModel:: emitConversationViewEmpty() |
|
976 { |
|
977 emit conversationViewEmpty(); |
|
978 } |
966 //EOF |
979 //EOF |