messagingapp/msgservices/msgserviceapp/src/msgstorehandler.cpp
changeset 73 ecf6a73a9186
parent 67 fc91263aee62
equal deleted inserted replaced
68:e8a69c93c830 73:ecf6a73a9186
    22 #include <mtclreg.h>    // for CClientMtmRegistry
    22 #include <mtclreg.h>    // for CClientMtmRegistry
    23 #include <mmsnotificationclient.h>
    23 #include <mmsnotificationclient.h>
    24 #include <mmssettings.h>
    24 #include <mmssettings.h>
    25 #include <xqconversions.h> // from xqutils
    25 #include <xqconversions.h> // from xqutils
    26 #include <mmsconst.h>
    26 #include <mmsconst.h>
       
    27 #include <HbExtendedLocale>
    27 #include <QDateTime>
    28 #include <QDateTime>
    28 #include <hbglobal.h>
    29 #include <hbglobal.h>
    29 
    30 
    30 #include "msgstorehandler.h"
    31 #include "msgstorehandler.h"
    31 #include "msgbiouids.h"
    32 #include "msgbiouids.h"
    32 #include "convergedmessage.h"
    33 #include "convergedmessage.h"
       
    34 #include "msgcontacthandler.h"
    33 
    35 
    34 // CONSTANTS
    36 // CONSTANTS
    35 _LIT(KUnixEpoch, "19700000:000000.000000");
    37 _LIT(KUnixEpoch, "19700000:000000.000000");
    36 #define BYTES_TO_KBYTES_FACTOR 1024
    38 #define BYTES_TO_KBYTES_FACTOR 1024
    37 
    39 
       
    40 // @see hbi18ndef.h
       
    41 static const char DATE_FORMAT[] = r_qtn_date_short_with_zero;
       
    42 static const char TIME_FORMAT[] = r_qtn_time_usual_with_zero;
       
    43 
    38 // LOCALIZATION
    44 // LOCALIZATION
    39 // TODO : use dialog localizations
    45 #define LOC_MESSAGE_SIZE hbTrId("txt_messages_dialog_size")
    40 #define LOC_MESSAGE_SIZE hbTrId("txt_messaging_list_size")
    46 #define LOC_CLASS_ADVERTISEMENT hbTrId("txt_messages_dialog_class_advertisement")
    41 #define LOC_CLASS_ADVERTISEMENT hbTrId("txt_messaging_list_advertisement")
    47 #define LOC_CLASS_INFORMATIONAL hbTrId("txt_messages_dialog_class_informational")
    42 #define LOC_CLASS_INFORMATIONAL hbTrId("txt_messaging_list_informational")
    48 #define LOC_CLASS_PERSONAL hbTrId("txt_messages_dialog_class_personal")
    43 #define LOC_CLASS_PERSONAL hbTrId("txt_messaging_list_personal")
       
    44 #define LOC_MMS_RETRIEVAL_FAILED hbTrId("txt_messaging_dialog_mms_retrieval_failed")
    49 #define LOC_MMS_RETRIEVAL_FAILED hbTrId("txt_messaging_dialog_mms_retrieval_failed")
    45 #define LOC_MMS_NOTIF_EXPIRED hbTrId("txt_messaging_list_message_expired")  
    50 #define LOC_MMS_NOTIF_EXPIRED hbTrId("txt_messaging_list_message_expired")  
    46 #define LOC_MMS_WAITING hbTrId("txt_wireframe_list_multimedia_message_waiting")
    51 #define LOC_MMS_WAITING hbTrId("txt_messages_dialog_multimedia_message_waiting")
    47 #define LOC_MMS_RETRIEVING hbTrId("txt_messaging_list_retrieving_message")   
    52 #define LOC_MMS_RETRIEVING hbTrId("txt_messaging_list_retrieving_message")   
    48 #define LOC_MMS_EXPIRY_DATE hbTrId("txt_messaging_list_expiry_date")
    53 #define LOC_MMS_EXPIRY_DATE hbTrId("txt_messages_dialog_expiry_date")
    49 
    54 
    50 //----------------------------------------------------------------------------
    55 //----------------------------------------------------------------------------
    51 // MsgStoreHandler::MsgStoreHandler
    56 // MsgStoreHandler::MsgStoreHandler
    52 // @see header
    57 // @see header
    53 //----------------------------------------------------------------------------
    58 //----------------------------------------------------------------------------
   447     {
   452     {
   448     return (    aEntry.iMtmData2 & KMmsOperationFinished
   453     return (    aEntry.iMtmData2 & KMmsOperationFinished
   449             &&  !( aEntry.iMtmData2 & KMmsOperationOngoing ) );
   454             &&  !( aEntry.iMtmData2 & KMmsOperationOngoing ) );
   450     }
   455     }
   451 
   456 
       
   457 // ---------------------------------------------------------
       
   458 // MsgStoreHandler::notificationSender
       
   459 // @see header
       
   460 // ---------------------------------------------------------
       
   461 QString MsgStoreHandler::notificationSender()
       
   462 {
       
   463     QString retVal;
       
   464     QString sender;
       
   465     if(iNotificationClient)
       
   466     {
       
   467         TPtrC sndr = iNotificationClient->Sender();
       
   468         sender = XQConversions::s60DescToQString(sndr);
       
   469     }
       
   470     
       
   471     QString displayName;
       
   472     int count;
       
   473     if(-1 != MsgContactHandler::resolveContactDisplayName(
       
   474             sender, displayName, count))
       
   475     {
       
   476         retVal = QString("%1(%2)").arg(displayName).arg(sender);
       
   477     }
       
   478     else
       
   479     {
       
   480         retVal = sender;
       
   481     }
       
   482 
       
   483     return retVal;
       
   484 }
       
   485 
       
   486 //---------------------------------------------------------------
       
   487 // MsgStoreHandler::notificationTimeStamp
       
   488 // @see header
       
   489 //---------------------------------------------------------------
       
   490 QString MsgStoreHandler::notificationTimeStamp()
       
   491 {
       
   492     // Null Check
       
   493     if(!iNotificationClient)
       
   494     {
       
   495         return QString();
       
   496     }
       
   497 
       
   498     TMsvEntry entry = iNotificationClient->Entry().Entry();
       
   499     TTime unixEpoch(KUnixEpoch);
       
   500     TTimeIntervalSeconds seconds;
       
   501     TTime timeStamp(entry.iDate.Int64());
       
   502     timeStamp.SecondsFrom(unixEpoch, seconds);
       
   503     
       
   504     QDateTime dateTime;
       
   505     dateTime.setTime_t(seconds.Int());
       
   506     HbExtendedLocale locale = HbExtendedLocale::system();
       
   507 
       
   508     QString timeStampStr;
       
   509     if (dateTime.date() == QDateTime::currentDateTime().date()) {
       
   510         timeStampStr = locale.format(dateTime.time(), TIME_FORMAT);
       
   511     }
       
   512     else {
       
   513         timeStampStr = locale.format(dateTime.date(), DATE_FORMAT);
       
   514     }
       
   515     return timeStampStr;
       
   516 }
       
   517 
   452 //---------------------------------------------------------------
   518 //---------------------------------------------------------------
   453 // MsgStoreHandler::notificationSubject
   519 // MsgStoreHandler::notificationSubject
   454 // @see header
   520 // @see header
   455 //---------------------------------------------------------------
   521 //---------------------------------------------------------------
   456 QString MsgStoreHandler::notificationSubject()
   522 QString MsgStoreHandler::notificationSubject()