messagingapp/msgui/appengine/src/conversationsmodel.cpp
changeset 41 25fe1fe642e3
parent 38 4e4b6adb1024
child 46 b1f0785c289d
equal deleted inserted replaced
40:224522e33db9 41:25fe1fe642e3
   661     {
   661     {
   662         return;
   662         return;
   663     }
   663     }
   664 
   664 
   665     // fetch relevent info to show in CV
   665     // fetch relevent info to show in CV
   666     // msg size
       
   667     QString estimatedMsgSizeStr = QString("%1").arg(0);
       
   668     estimatedMsgSizeStr.append(" Kb");
       
   669     TRAP_IGNORE(estimatedMsgSizeStr =
       
   670             mMsgStoreHandler->NotificationMsgSizeL());
       
   671 
       
   672     // msg class type
       
   673     QString classInfoStr = mMsgStoreHandler->NotificationClass();
       
   674 
       
   675     // notification expiry date
       
   676     //TODO: Need to do localization of digits used to show expiry time
       
   677     TTime expiryTime;
       
   678     QString expiryTimeStr;
       
   679     mMsgStoreHandler->NotificationExpiryDate(expiryTime, expiryTimeStr);
       
   680 
       
   681     // notification state e.g. waiting, retrieving etc
   666     // notification state e.g. waiting, retrieving etc
   682     QString statusStr;
   667     QString statusStr;
   683     int status;
   668     int status;
   684     mMsgStoreHandler->NotificationStatus(status, statusStr);
   669     mMsgStoreHandler->NotificationStatus(status, statusStr);
   685 
   670 
   686     // create data for bodytext role
   671     // create data for bodytext role
   687     QString dataText;
   672     QString dataText;
   688     dataText.append("Size: "); // TODO: use logical str name
   673     dataText.append(mMsgStoreHandler->NotificationMsgSize());
   689     dataText.append(estimatedMsgSizeStr);
       
   690     dataText.append(QChar::LineSeparator);
   674     dataText.append(QChar::LineSeparator);
   691     dataText.append("Class: "); // TODO: use logical str name
   675     dataText.append(mMsgStoreHandler->NotificationClass());
   692     dataText.append(classInfoStr);
       
   693     dataText.append(QChar::LineSeparator);
   676     dataText.append(QChar::LineSeparator);
   694     dataText.append("Expiry date: "); //TODO: use logical str name
   677     dataText.append(mMsgStoreHandler->NotificationExpiryDate());
   695     dataText.append(expiryTimeStr);
       
   696     if(!statusStr.isEmpty())
   678     if(!statusStr.isEmpty())
   697     {
   679     {
   698         dataText.append(QChar::LineSeparator);
   680         dataText.append(QChar::LineSeparator);
   699         dataText.append(statusStr);
   681         dataText.append(statusStr);
   700         dataText.append(QChar::LineSeparator); //Temp fix to be removed
       
   701     }
   682     }
   702 
   683 
   703     // set fetched data to roles
   684     // set fetched data to roles
   704     item.setData(status, NotificationStatus);
   685     item.setData(status, NotificationStatus);
   705     item.setData(dataText, BodyText);
   686     item.setData(dataText, BodyText);
   717 // @see header
   698 // @see header
   718 //---------------------------------------------------------------
   699 //---------------------------------------------------------------
   719 void ConversationsModel::handleBlueToothMessages(QStandardItem& item,
   700 void ConversationsModel::handleBlueToothMessages(QStandardItem& item,
   720     const CCsConversationEntry& entry)
   701     const CCsConversationEntry& entry)
   721 {
   702 {
   722     //TODO, needs to be revisited again, once BT team provides the solution for
   703      int msgSubType = ConversationsEngineUtility::messageSubType(entry.GetType());
   723     //BT received as Biomsg issue.
   704       if (msgSubType == ConvergedMessage::VCard) 
   724     QString description = XQConversions::s60DescToQString(*(entry.Description()));
   705 			{
   725 
   706            iBioMsgPlugin->setMessageId(entry.EntryId());          
   726     if (description.contains(".vcf") || description.contains(".ics")) // "vCard"
   707 
   727     {
   708            if (iBioMsgPlugin->attachmentCount() > 0) 
   728         //message sub-type
   709 		   			{
   729         item.setData(ConvergedMessage::VCard, MessageSubType);
   710                UniMessageInfoList attList = iBioMsgPlugin->attachmentList();
   730 
   711                QString attachmentPath = attList[0]->path();
   731         //parse vcf file to get the details
   712 
   732         QString displayName = MsgContactHandler::getVCardDisplayName(
   713                //get display-name and set as bodytext
   733                 description);
   714                QString displayName = MsgContactHandler::getVCardDisplayName(attachmentPath);
   734         item.setData(displayName, BodyText);
   715                item.setData(displayName, BodyText);
   735     }
   716 			   	 // clear attachement list : its allocated at data model
   736     else
   717             	while (!attList.isEmpty()) 
   737     {
   718 							{
   738         if (description.contains(".vcs")) // "vCalendar"
   719                 delete attList.takeFirst();
   739         {
   720             	}
   740             //message sub-type
   721 
   741             item.setData(ConvergedMessage::VCal, MessageSubType);
   722            }
   742         }
   723        }
   743         else
   724 
   744         {
   725        else 
   745             //message sub-type
   726 	   	 {
   746             item.setData(ConvergedMessage::None, MessageSubType);
   727            QString description = XQConversions::s60DescToQString(*(entry.Description()));
   747         }
   728 
   748         //for BT messages we show filenames for all other (except vcard) messages
   729            if (msgSubType == ConvergedMessage::VCal) // "vCalendar"
   749         //get filename and set as body
   730            {
   750         QFileInfo fileinfo(description);
   731                //message sub-type
   751         QString filename = fileinfo.fileName();
   732                item.setData(ConvergedMessage::VCal, MessageSubType);
   752         item.setData(filename, BodyText);
   733            }
   753     }
   734            else 
       
   735 		       {
       
   736                //message sub-type
       
   737                item.setData(ConvergedMessage::None, MessageSubType);
       
   738            }
       
   739            //for BT messages we show filenames for all other (except vcard) messages
       
   740            //get filename and set as body
       
   741            QFileInfo fileinfo(description);
       
   742            QString filename = fileinfo.fileName();
       
   743            item.setData(filename, BodyText);
       
   744        }
       
   745     
   754 }
   746 }
   755 
   747 
   756 //---------------------------------------------------------------
   748 //---------------------------------------------------------------
   757 // ConversationsModel::handleBioMessages
   749 // ConversationsModel::handleBioMessages
   758 // @see header
   750 // @see header