messagingapp/msgui/appengine/src/conversationmsgstorehandler.cpp
changeset 37 518b245aa84c
parent 25 84d9eb65b26f
child 41 25fe1fe642e3
equal deleted inserted replaced
25:84d9eb65b26f 37:518b245aa84c
    24 #include <QDateTime>
    24 #include <QDateTime>
    25 
    25 
    26 #include "conversationmsgstorehandler.h"
    26 #include "conversationmsgstorehandler.h"
    27 #include "draftsmodel.h"
    27 #include "draftsmodel.h"
    28 #include "MuiuOperationWait.h"
    28 #include "MuiuOperationWait.h"
    29 #include "MsgBioUids.h"
    29 #include "msgbiouids.h"
    30 #include "UniEditorGenUtils.h"
    30 #include "UniEditorGenUtils.h"
    31 
    31 
    32 // SYSTEM INCLUDES
    32 // SYSTEM INCLUDES
    33 #include <StringLoader.h>
    33 #include <StringLoader.h>
    34 #include <ccsdefs.h> 
    34 #include <ccsdefs.h> 
   405 void ConversationMsgStoreHandler::FetchDraftMessages(DraftsModel* draftsModel)
   405 void ConversationMsgStoreHandler::FetchDraftMessages(DraftsModel* draftsModel)
   406     {
   406     {
   407     mDraftsModel = draftsModel;
   407     mDraftsModel = draftsModel;
   408     iState = EReadDrafts;
   408     iState = EReadDrafts;
   409     TCallBack callback = TCallBack(ProcessDraftMessages, (TAny*) this);
   409     TCallBack callback = TCallBack(ProcessDraftMessages, (TAny*) this);
   410     iIdle = CIdle::NewL(CActive::EPriorityStandard);
   410     TRAPD(err, iIdle = CIdle::NewL(CActive::EPriorityStandard));
   411     iIdle->Start(callback);
   411     if(err == KErrNone)
       
   412         {
       
   413         iIdle->Start(callback);    
       
   414         }
   412     }
   415     }
   413 
   416 
   414 // -----------------------------------------------------------------------------
   417 // -----------------------------------------------------------------------------
   415 // ConversationMsgStoreHandler::ProcessDraftMessages
   418 // ConversationMsgStoreHandler::ProcessDraftMessages
   416 // CIdle callback 
   419 // CIdle callback 
   646         }
   649         }
   647     return false;
   650     return false;
   648 }
   651 }
   649 
   652 
   650 //---------------------------------------------------------------
   653 //---------------------------------------------------------------
   651 // ConversationMsgStoreHandler::setNotificationMessageId
   654 // ConversationMsgStoreHandler::setNotificationMessageIdL
   652 // @see header
   655 // @see header
   653 //---------------------------------------------------------------
   656 //---------------------------------------------------------------
   654 void ConversationMsgStoreHandler::setNotificationMessageId(int messageId)
   657 void ConversationMsgStoreHandler::setNotificationMessageIdL(int messageId)
   655 {
   658 {
   656     // get MMS Notification client mtm & set the content to current entry
   659     // get MMS Notification client mtm & set the content to current entry
   657     if(iNotificationClient)
   660     if(iNotificationClient)
   658     {
   661     {
   659         delete iNotificationClient;
   662         delete iNotificationClient;
   666     iNotificationClient->SwitchCurrentEntryL(messageId);
   669     iNotificationClient->SwitchCurrentEntryL(messageId);
   667     iNotificationClient->LoadMessageL();
   670     iNotificationClient->LoadMessageL();
   668 }
   671 }
   669 
   672 
   670 //---------------------------------------------------------------
   673 //---------------------------------------------------------------
   671 // ConversationMsgStoreHandler::NotificationMsgSize
   674 // ConversationMsgStoreHandler::NotificationMsgSizeL
   672 // @see header
   675 // @see header
   673 //---------------------------------------------------------------
   676 //---------------------------------------------------------------
   674 QString ConversationMsgStoreHandler::NotificationMsgSize()
   677 QString ConversationMsgStoreHandler::NotificationMsgSizeL()
   675 {
   678 {
   676     // Size of message.
   679     // Size of message.
   677     TInt size = iNotificationClient->MessageTransferSize( );
   680     TInt size = iNotificationClient->MessageTransferSize( );
   678     
   681     
   679     // read max receive size limit from settings
   682     // read max receive size limit from settings
   839         (iMtmReg->NewMtmL(KUidMsgMMSNotification));
   842         (iMtmReg->NewMtmL(KUidMsgMMSNotification));
   840     }
   843     }
   841     iNotificationClient->SwitchCurrentEntryL(aId);    */ 
   844     iNotificationClient->SwitchCurrentEntryL(aId);    */ 
   842     
   845     
   843     // set context to current entry
   846     // set context to current entry
   844     setNotificationMessageId(aId);
   847     setNotificationMessageIdL(aId);
   845 
   848 
   846     TTime currentTime;
   849     TTime currentTime;
   847     currentTime.HomeTime( );
   850     currentTime.HomeTime( );
   848     TTime expiryTime = iNotificationClient->ExpiryDate( );
   851     TTime expiryTime = iNotificationClient->ExpiryDate( );
   849     TLocale locale;
   852     TLocale locale;
   923         TMsvEntry entry = cEntry->Entry();
   926         TMsvEntry entry = cEntry->Entry();
   924         if ( entry.Unread() ) 
   927         if ( entry.Unread() ) 
   925             {
   928             {
   926             // Mark the entry as read
   929             // Mark the entry as read
   927             entry.SetUnread( EFalse );
   930             entry.SetUnread( EFalse );
   928             cEntry->ChangeL( entry );
   931             TRAP_IGNORE(cEntry->ChangeL( entry ));
   929             }
   932             }
   930         // extract message type
   933         // extract message type
   931         extractMsgType(entry,msgType,msgSubType);
   934         extractMsgType(entry,msgType,msgSubType);
   932         }
   935         }
   933     
   936     
   947 
   950 
   948     switch(entry.iMtm.iUid)   
   951     switch(entry.iMtm.iUid)   
   949         {
   952         {
   950         case KSenduiMtmSmsUidValue:            
   953         case KSenduiMtmSmsUidValue:            
   951             msgType = ConvergedMessage::Sms;
   954             msgType = ConvergedMessage::Sms;
       
   955             if (entry.iBioType == KMsgBioNokiaServiceSentMessage.iUid) {
       
   956                 msgSubType = ConvergedMessage::NokiaService;
       
   957             }
   952             break;
   958             break;
   953         case KSenduiMtmBtUidValue:
   959         case KSenduiMtmBtUidValue:
   954             msgType = ConvergedMessage::BT;
   960             msgType = ConvergedMessage::BT;
   955             break;
   961             break;
   956         case KSenduiMtmMmsUidValue:        
   962         case KSenduiMtmMmsUidValue:        
   977                 msgSubType = ConvergedMessage::VCard;
   983                 msgSubType = ConvergedMessage::VCard;
   978                 }
   984                 }
   979             else if (entry.iBioType == KMsgBioUidVCalendar.iUid)
   985             else if (entry.iBioType == KMsgBioUidVCalendar.iUid)
   980                 {
   986                 {
   981                 msgSubType = ConvergedMessage::VCal;
   987                 msgSubType = ConvergedMessage::VCal;
   982                 }        
   988                 }
   983             }
   989             else if (entry.iBioType == KMsgBioNokiaServiceSentMessage.iUid) {
   984             break;
   990                 msgSubType = ConvergedMessage::NokiaService;
   985         default:
   991                 }
   986             msgType = ConvergedMessage::None;       
   992             }
   987             break;
   993         break;
   988         }
   994     default:
   989     }
   995         msgType = ConvergedMessage::None;
       
   996         break;
       
   997     }
       
   998 }
       
   999 
       
  1000 int ConversationMsgStoreHandler::getMsgSubType(int msgId)
       
  1001 {
       
  1002     int msgType = ConvergedMessage::None;
       
  1003     int msgSubType = ConvergedMessage::None;
       
  1004     CMsvEntry* cEntry = NULL;
       
  1005     TRAPD(err, cEntry = iMsvSession->GetEntryL(msgId));
       
  1006     if (err == KErrNone) {
       
  1007         TMsvEntry entry = cEntry->Entry();
       
  1008         extractMsgType(entry, msgType, msgSubType);
       
  1009     }
       
  1010     return msgSubType;
       
  1011 }
       
  1012 
   990 // End of file
  1013 // End of file