messagingapp/msgui/appengine/src/conversationsmodel.cpp
changeset 44 36f374c67aa8
parent 43 35b64624a9e7
child 47 5b14749788d7
child 52 12db4185673b
--- a/messagingapp/msgui/appengine/src/conversationsmodel.cpp	Wed Jun 23 18:09:17 2010 +0300
+++ b/messagingapp/msgui/appengine/src/conversationsmodel.cpp	Tue Jul 06 14:12:40 2010 +0300
@@ -49,6 +49,9 @@
 
 // preview-cache max cost (items)
 const int CACHE_COST =  50;
+//Preview thumbnail size
+const int KWidth = 9.5 * 6.7;
+const int KHeight = 9.5 * 6.7;
 //---------------------------------------------------------------
 // ConversationsModel::ConversationsModel
 // Constructor
@@ -512,7 +515,12 @@
     //populate from data plugins
     if (!isEntryInDb || err != KErrNone)
     {
-        iMmsDataPlugin->setMessageId(entry.EntryId());
+        int error = iMmsDataPlugin->setMessageId(entry.EntryId());
+        if(error != KErrNone)
+        {
+            // skip all
+            return;
+        }
         int msgProperty = 0;
 
         if (iMmsDataPlugin->attachmentCount() > 0)
@@ -552,7 +560,7 @@
                     isBodyTextSet = true;
                     file.close();
                 }
-                if (!isImageSet && objectList[index]->mimetype().contains(
+                if (!isVideoSet && !isImageSet && objectList[index]->mimetype().contains(
                     "image"))
                 {
                     isImageSet = true;
@@ -567,7 +575,7 @@
                     }
                     imagePath = objectList[index]->path();
                 }
-                if (!isAudioSet && objectList[index]->mimetype().contains(
+                if (!isVideoSet && !isAudioSet && objectList[index]->mimetype().contains(
                     "audio"))
                 {
                     msgProperty |= EPreviewAudio;
@@ -581,7 +589,7 @@
                     }
                     isAudioSet = true;
                 }
-                if (!isVideoSet && objectList[index]->mimetype().contains(
+                if (!( isImageSet || isAudioSet) && !isVideoSet && objectList[index]->mimetype().contains(
                     "video"))
                 {
                     isVideoSet = true;
@@ -604,6 +612,7 @@
         }
         QPixmap pixmap;
         //populate item  with the attachment list
+        //TODO: This code is not required bcoz video icon is show and not preview  
         if (isVideoSet)
         {
             item.setData(videoPath, Attachments);
@@ -825,7 +834,7 @@
     if (!inDb)
     {
         QPixmap pixmap(filePath);
-        QPixmap scaledPixmap = pixmap.scaled(63.65, 63.65, Qt::IgnoreAspectRatio);
+        QPixmap scaledPixmap = pixmap.scaled(KWidth, KHeight, Qt::IgnoreAspectRatio);
         HbIcon *previewIcon = new HbIcon(scaledPixmap);
 
         previewIconCache.insert(msgId, previewIcon);
@@ -963,4 +972,8 @@
     previewIconCache.clear();
 }
 
+void ConversationsModel:: emitConversationViewEmpty()
+{
+    emit conversationViewEmpty();
+}
 //EOF