44 const TUid KSmsMtmUid ={KSenduiMtmSmsUidValue}; |
45 const TUid KSmsMtmUid ={KSenduiMtmSmsUidValue}; |
45 const TUid KMmsMtmUid ={KSenduiMtmMmsUidValue}; |
46 const TUid KMmsMtmUid ={KSenduiMtmMmsUidValue}; |
46 _LIT(KUnixEpoch, "19700000:000000.000000"); |
47 _LIT(KUnixEpoch, "19700000:000000.000000"); |
47 #define BYTES_TO_KBYTES_FACTOR 1024 |
48 #define BYTES_TO_KBYTES_FACTOR 1024 |
48 |
49 |
49 // TODO: read global setting of formats on the phone |
50 // LOCALIZATION |
50 const QString DATE_FORMAT("dd/MM"); |
51 #define LOC_MESSAGE_SIZE hbTrId("txt_messaging_list_size") |
51 const QString TIME_FORMAT("hh:mm"); |
52 #define LOC_CLASS_ADVERTISEMENT hbTrId("txt_messaging_list_advertisement") |
|
53 #define LOC_CLASS_INFORMATIONAL hbTrId("txt_messaging_list_informational") |
|
54 #define LOC_CLASS_PERSONAL hbTrId("txt_messaging_list_personal") |
|
55 #define LOC_MMS_RETRIEVAL_FAILED hbTrId("txt_messaging_dialog_mms_retrieval_failed") |
|
56 #define LOC_MMS_NOTIF_EXPIRED hbTrId("Message Expired !") //TODO: localization |
|
57 #define LOC_MMS_WAITING hbTrId("txt_wireframe_list_multimedia_message_waiting") |
|
58 #define LOC_MMS_RETRIEVING hbTrId("Retrieving message...") //TODO: localization |
|
59 #define LOC_MMS_EXPIRY_DATE hbTrId("txt_messaging_list_expiry_date") |
52 |
60 |
53 // ================= MEMBER FUNCTIONS ======================= |
61 // ================= MEMBER FUNCTIONS ======================= |
54 |
62 |
55 // --------------------------------------------------------- |
63 // --------------------------------------------------------- |
56 // Default constructor. |
64 // Default constructor. |
672 |
680 |
673 //--------------------------------------------------------------- |
681 //--------------------------------------------------------------- |
674 // ConversationMsgStoreHandler::NotificationMsgSizeL |
682 // ConversationMsgStoreHandler::NotificationMsgSizeL |
675 // @see header |
683 // @see header |
676 //--------------------------------------------------------------- |
684 //--------------------------------------------------------------- |
677 QString ConversationMsgStoreHandler::NotificationMsgSizeL() |
685 QString ConversationMsgStoreHandler::NotificationMsgSize() |
678 { |
686 { |
679 // Size of message. |
687 // Size of message. |
680 TInt size = iNotificationClient->MessageTransferSize( ); |
688 TInt size = iNotificationClient->MessageTransferSize( ); |
681 |
689 |
682 // read max receive size limit from settings |
690 // read max receive size limit from settings |
683 CMmsSettings* settings = CMmsSettings::NewL(); |
691 TInt maxSize = 0; |
684 CleanupStack::PushL( settings ); |
692 TRAP_IGNORE(maxSize = MaxReceiveSizeLimitL()); |
685 iNotificationClient->RestoreSettingsL(); |
|
686 settings->CopyL( iNotificationClient->MmsSettings() ); |
|
687 TInt maxSize = static_cast<TInt>(settings->MaximumReceiveSize() ); |
|
688 CleanupStack::PopAndDestroy( settings ); |
|
689 |
693 |
690 // apply max size limit rule |
694 // apply max size limit rule |
691 if( maxSize > 0 ) |
695 if( maxSize > 0 ) |
692 { |
696 { |
693 if( size > maxSize ) |
697 if( size > maxSize ) |
694 { |
698 { |
695 size = maxSize; |
699 size = maxSize; |
696 } |
700 } |
697 } |
701 } |
698 |
702 |
699 // Finally make the UI string |
703 TInt fileSize = size / BYTES_TO_KBYTES_FACTOR; |
700 int fileSize = size / BYTES_TO_KBYTES_FACTOR; |
|
701 if ( size % BYTES_TO_KBYTES_FACTOR ) |
704 if ( size % BYTES_TO_KBYTES_FACTOR ) |
702 { |
705 { |
703 fileSize++; |
706 fileSize++; |
704 } |
707 } |
705 // TODO: use localized string constants here |
708 |
706 QString sizeString = QString("%1").arg(fileSize); |
709 return LOC_MESSAGE_SIZE.arg(fileSize); |
707 sizeString.append(" Kb"); |
|
708 return sizeString; |
|
709 } |
710 } |
710 |
711 |
711 //--------------------------------------------------------------- |
712 //--------------------------------------------------------------- |
712 // ConversationMsgStoreHandler::NotificationClass |
713 // ConversationMsgStoreHandler::NotificationClass |
713 // @see header |
714 // @see header |
714 //--------------------------------------------------------------- |
715 //--------------------------------------------------------------- |
715 QString ConversationMsgStoreHandler::NotificationClass() |
716 QString ConversationMsgStoreHandler::NotificationClass() |
716 { |
717 { |
717 //TODO: use localized string |
|
718 QString notificationClass; |
718 QString notificationClass; |
719 TInt msgClass = iNotificationClient->MessageClass( ); |
719 TInt msgClass = iNotificationClient->MessageClass( ); |
720 switch( msgClass ) |
720 switch( msgClass ) |
721 { |
721 { |
722 case EMmsClassPersonal: |
722 case EMmsClassPersonal: |
723 { |
723 { |
724 notificationClass = "Personal"; |
724 notificationClass = LOC_CLASS_PERSONAL; |
725 break; |
725 break; |
726 } |
726 } |
727 case EMmsClassAdvertisement: |
727 case EMmsClassAdvertisement: |
728 { |
728 { |
729 notificationClass = "Advertisement"; |
729 notificationClass = LOC_CLASS_ADVERTISEMENT; |
730 break; |
730 break; |
731 } |
731 } |
732 case EMmsClassInformational: |
732 case EMmsClassInformational: |
733 { |
733 { |
734 notificationClass = "Informative"; |
734 notificationClass = LOC_CLASS_INFORMATIONAL; |
735 break; |
735 break; |
736 } |
736 } |
737 default: |
737 default: |
738 { // In case no class is returned (0), don't add the field |
738 { // In case no class is returned (0), don't add the field |
739 break; |
739 break; |
748 //--------------------------------------------------------------- |
748 //--------------------------------------------------------------- |
749 void ConversationMsgStoreHandler::NotificationStatus( |
749 void ConversationMsgStoreHandler::NotificationStatus( |
750 int& status, |
750 int& status, |
751 QString& statusStr) |
751 QString& statusStr) |
752 { |
752 { |
753 // TODO : use standard strings provided by Arul |
|
754 // fetch mms notification status from store handler |
753 // fetch mms notification status from store handler |
755 // and map as per our UI requirements |
754 // and map as per our UI requirements |
756 TMsvEntry entry = iNotificationClient->Entry().Entry(); |
755 TMsvEntry entry = iNotificationClient->Entry().Entry(); |
757 status = MmsNotificationStatus(entry.Id()); |
756 status = MmsNotificationStatus(entry.Id()); |
758 switch(status) |
757 switch(status) |
759 { |
758 { |
760 case ConvergedMessage::NotifFailed: |
759 case ConvergedMessage::NotifFailed: |
761 { |
760 { |
762 statusStr = "Message retrieval failed !"; |
761 statusStr = LOC_MMS_RETRIEVAL_FAILED; |
763 break; |
762 break; |
764 } |
763 } |
765 case ConvergedMessage::NotifExpired: |
764 case ConvergedMessage::NotifExpired: |
766 { |
765 { |
767 statusStr = "Message Expired !"; |
766 statusStr = LOC_MMS_NOTIF_EXPIRED; |
768 break; |
767 break; |
769 } |
768 } |
770 case ConvergedMessage::NotifReadyForFetching: |
769 case ConvergedMessage::NotifReadyForFetching: |
771 { |
770 { |
772 statusStr = "Multimedia Message waiting..."; |
771 statusStr = LOC_MMS_WAITING; |
773 break; |
772 break; |
774 } |
773 } |
775 case ConvergedMessage::NotifWaiting: |
774 case ConvergedMessage::NotifWaiting: |
776 case ConvergedMessage::NotifRetrieving: |
775 case ConvergedMessage::NotifRetrieving: |
777 { |
776 { |
778 statusStr = "Retrieving message..."; |
777 statusStr = LOC_MMS_RETRIEVING; |
779 break; |
778 break; |
780 } |
779 } |
781 default: |
780 default: |
782 { |
781 { |
783 // not handled, do nothing |
782 // not handled, do nothing |
788 |
787 |
789 //--------------------------------------------------------------- |
788 //--------------------------------------------------------------- |
790 // ConversationMsgStoreHandler::NotificationExpiryDate |
789 // ConversationMsgStoreHandler::NotificationExpiryDate |
791 // @see header |
790 // @see header |
792 //--------------------------------------------------------------- |
791 //--------------------------------------------------------------- |
793 void ConversationMsgStoreHandler::NotificationExpiryDate( |
792 QString ConversationMsgStoreHandler::NotificationExpiryDate() |
794 TTime& expiryTime, |
793 { |
795 QString& expiryTimeStr) |
794 TTime expiryTime = 0; |
796 { |
795 QString expiryTimeStr; |
|
796 |
797 // get expiry time from entry |
797 // get expiry time from entry |
798 expiryTime = iNotificationClient->ExpiryDate( ); |
798 expiryTime = iNotificationClient->ExpiryDate( ); |
799 TLocale locale; |
799 TLocale locale; |
800 expiryTime += locale.UniversalTimeOffset(); |
800 expiryTime += locale.UniversalTimeOffset(); |
801 if (locale.QueryHomeHasDaylightSavingOn()) |
801 if (locale.QueryHomeHasDaylightSavingOn()) |
806 |
806 |
807 // create formatted string for the expiry time |
807 // create formatted string for the expiry time |
808 TTime unixEpoch(KUnixEpoch); |
808 TTime unixEpoch(KUnixEpoch); |
809 TTimeIntervalSeconds seconds; |
809 TTimeIntervalSeconds seconds; |
810 expiryTime.SecondsFrom(unixEpoch, seconds); |
810 expiryTime.SecondsFrom(unixEpoch, seconds); |
811 QDateTime dateTime; |
811 return LOC_MMS_EXPIRY_DATE.arg(seconds.Int()); |
812 dateTime.setTime_t(seconds.Int()); |
|
813 if (dateTime.date() == QDateTime::currentDateTime().date()) { |
|
814 expiryTimeStr = dateTime.toString(TIME_FORMAT); |
|
815 } |
|
816 else { |
|
817 expiryTimeStr = dateTime.toString(DATE_FORMAT); |
|
818 } |
|
819 } |
812 } |
820 |
813 |
821 //----------------------------------------------------------------------------- |
814 //----------------------------------------------------------------------------- |
822 // ConversationMsgStoreHandler::DownloadMessageL |
815 // ConversationMsgStoreHandler::DownloadMessageL |
823 // |
816 // |
965 case KSenduiMMSNotificationUidValue: |
958 case KSenduiMMSNotificationUidValue: |
966 msgType = ConvergedMessage::MmsNotification; |
959 msgType = ConvergedMessage::MmsNotification; |
967 break; |
960 break; |
968 case KSenduiMtmBioUidValue: |
961 case KSenduiMtmBioUidValue: |
969 { |
962 { |
|
963 if (entry.iMtmData1 == KSenduiMtmBtUidValue) |
|
964 { |
|
965 msgType = ConvergedMessage::BT; |
|
966 |
|
967 if (entry.iBioType == KMsgBioUidVCard.iUid) |
|
968 { |
|
969 msgSubType = ConvergedMessage::VCard; |
|
970 } |
|
971 else if (entry.iBioType == KMsgBioUidVCalendar.iUid) |
|
972 { |
|
973 |
|
974 msgSubType = ConvergedMessage::VCal; |
|
975 } |
|
976 |
|
977 break; |
|
978 } |
970 msgType = ConvergedMessage::BioMsg; |
979 msgType = ConvergedMessage::BioMsg; |
971 |
980 |
972 // based on the biotype uid set message type |
981 // based on the biotype uid set message type |
973 if(entry.iBioType == KMsgBioUidRingingTone.iUid) |
982 if(entry.iBioType == KMsgBioUidRingingTone.iUid) |
974 { |
983 { |
995 msgType = ConvergedMessage::None; |
1004 msgType = ConvergedMessage::None; |
996 break; |
1005 break; |
997 } |
1006 } |
998 } |
1007 } |
999 |
1008 |
|
1009 //---------------------------------------------------------------------------- |
|
1010 // ConversationMsgStoreHandler::getMsgSubType |
|
1011 // @see header |
|
1012 //---------------------------------------------------------------------------- |
1000 int ConversationMsgStoreHandler::getMsgSubType(int msgId) |
1013 int ConversationMsgStoreHandler::getMsgSubType(int msgId) |
1001 { |
1014 { |
1002 int msgType = ConvergedMessage::None; |
1015 int msgType = ConvergedMessage::None; |
1003 int msgSubType = ConvergedMessage::None; |
1016 int msgSubType = ConvergedMessage::None; |
1004 CMsvEntry* cEntry = NULL; |
1017 CMsvEntry* cEntry = NULL; |
1008 extractMsgType(entry, msgType, msgSubType); |
1021 extractMsgType(entry, msgType, msgSubType); |
1009 } |
1022 } |
1010 return msgSubType; |
1023 return msgSubType; |
1011 } |
1024 } |
1012 |
1025 |
|
1026 //---------------------------------------------------------------------------- |
|
1027 // ConversationMsgStoreHandler::MaxReceiveSizeLimitL |
|
1028 // @see header |
|
1029 //---------------------------------------------------------------------------- |
|
1030 TInt ConversationMsgStoreHandler::MaxReceiveSizeLimitL() |
|
1031 { |
|
1032 CMmsSettings* settings = CMmsSettings::NewL(); |
|
1033 CleanupStack::PushL( settings ); |
|
1034 iNotificationClient->RestoreSettingsL(); |
|
1035 settings->CopyL( iNotificationClient->MmsSettings() ); |
|
1036 TInt maxSize = static_cast<TInt>(settings->MaximumReceiveSize() ); |
|
1037 CleanupStack::PopAndDestroy( settings ); |
|
1038 return maxSize; |
|
1039 } |
|
1040 |
1013 // End of file |
1041 // End of file |