Nabi_SEN_SE-48289 fixed.
authorByounghui <byounghui.lim@samsung.com>
Tue, 6 Aug 2013 05:08:16 +0000 (14:08 +0900)
committerByounghui <byounghui.lim@samsung.com>
Tue, 6 Aug 2013 05:14:00 +0000 (14:14 +0900)
Change-Id: I1c5be92b3e49d21fa00f261de03707d7856f4b6c
Signed-off-by: Byounghui <byounghui.lim@samsung.com>
inc/FMsgEmailManager.h
src/FMsg_EmailManagerImpl.cpp
src/FMsg_MsgUtil.cpp
src/FMsg_MsgUtil.h

index 53938f1..5de3f04 100755 (executable)
@@ -166,7 +166,6 @@ namespace Tizen { namespace Messaging
                * @exception    E_MAX_EXCEEDED                   The number of recipients has crossed the maximum limit (Maximum 20).
                * @exception    E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
                * @exception    E_USER_NOT_CONSENTED    The user blocks an application from calling this method. @b Since: @b 2.1
-               * @remarks              The value of the flag, @c saveToSentbox, is fixed to @c false in the emulator.
                * @see                  IEmailListener::OnEmailMessageSent()
                */
                result Send(const EmailMessage& message, const RecipientList& recipientList, bool saveToSentbox);
index c7c72ab..fd4dad5 100644 (file)
@@ -212,7 +212,7 @@ _EmailManagerImpl::Send(const EmailMessage& message, const RecipientList& recipi
        SysAssertf(__isConstructed == true, "The _EmailManagerImpl instance is not constructed yet.");
        SysLog(NID_MSG, "sending an email message.");
 
-       r = _MsgUtil::SendEmail(message, recipientList, msgId, requestId);
+       r = _MsgUtil::SendEmail(message, recipientList, msgId, requestId, saveToSentBox);
        SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "[%s] Failed to send the email message.", GetErrorMessage(r));        
 
        pTemp = new (std::nothrow) _EmailAsyncData();
index d33ff9c..e84d934 100644 (file)
@@ -1610,13 +1610,14 @@ CATCH:
        return NULL;
 }
 result
-_MsgUtil::SendEmail(const EmailMessage& message, const RecipientList& recipientList, int &mailId,  int &requestId)
+_MsgUtil::SendEmail(const EmailMessage& message, const RecipientList& recipientList, int &mailId,  int &requestId, bool saveToSentBox)
 {
 
        email_account_t* pAccount = NULL;
        email_mail_data_t *pMail = null;        
        email_mailbox_t *pMailbox = null;
        email_attachment_data_t **pAttach=null;         
+       int tmpSaveToSentBox = -1;
        int accountId = 0;
        int err = EMAIL_ERROR_NONE;
        result r = E_SUCCESS;
@@ -1630,12 +1631,18 @@ _MsgUtil::SendEmail(const EmailMessage& message, const RecipientList& recipientL
        pMailbox =  (email_mailbox_t *)calloc(1,sizeof(email_mailbox_t));
        SysTryCatch(NID_MSG, pMailbox != null, r = E_OUT_OF_MEMORY, r, "Insufficient memory");
 
-               
        err = email_load_default_account_id(&accountId);
        SysTryCatch(NID_MSG, err == EMAIL_ERROR_NONE, r = E_INVALID_ACCOUNT, r, "Account Load is Failed.");
        
        err = email_get_account(accountId, GET_FULL_DATA, &pAccount);
        SysTryCatch(NID_MSG, err == EMAIL_ERROR_NONE, r = E_INVALID_ACCOUNT, r, "Account is Failed.");
+       SysLog(NID_MSG, "keep %d, save %d" , pAccount->options.keep_local_copy, saveToSentBox);
+
+       tmpSaveToSentBox = pAccount->options.keep_local_copy;
+       pAccount->options.keep_local_copy = saveToSentBox;
+
+       email_update_account(accountId, pAccount);
+       SysTryCatch(NID_MSG, err == EMAIL_ERROR_NONE, r = E_INVALID_ACCOUNT, r, "Account update is Failed.");
 
        fromAddr.Append(L'\"'); 
        fromAddr.Append(pAccount->incoming_server_user_name);   
@@ -1691,6 +1698,13 @@ _MsgUtil::SendEmail(const EmailMessage& message, const RecipientList& recipientL
 
        r = AddEmailCallBackToDbus();
                
+       if (-1 != tmpSaveToSentBox)
+       {
+               pAccount->options.keep_local_copy = (bool)tmpSaveToSentBox;
+               email_update_account(accountId, pAccount);
+       }
+
+               
        if (pAttach)
        {
                if (*pAttach)
@@ -1722,6 +1736,14 @@ _MsgUtil::SendEmail(const EmailMessage& message, const RecipientList& recipientL
        return r;
 
 CATCH:
+       
+       if (-1 != tmpSaveToSentBox)
+       {
+               pAccount->options.keep_local_copy = (bool)tmpSaveToSentBox;
+               email_update_account(accountId, pAccount);
+       }
+
+       
        if (pAttach)
        {
                if (*pAttach)
index 404a934..0a201f3 100644 (file)
@@ -66,7 +66,7 @@ public:
        static SmsMessage* ConvertSmsMessageN(const SmsMessageBoxType& type, msg_struct_t& msg);
        static int AddMessageAddress(const RecipientList& recipientList, RecipientType type, msg_struct_t& messageMsg, _MSG_RECIPIENT_TYPE_E recipientType);
        static result AddEmailMessageAddress(const RecipientList& recipientList, RecipientType type, email_mail_data_t *pMail);
-       static result SendEmail(const EmailMessage& message, const RecipientList& recipientList, int &mailboxId,        int &requestId);
+       static result SendEmail(const EmailMessage& message, const RecipientList& recipientList, int &mailboxId, int &requestId, bool saveToSentBox);
        static result AddEmailMessageBody(email_mail_data_t *pMail, char * pBody);
        static result AddEmailMessageAttachment(const EmailMessage& message, email_attachment_data_t ***pAttach, email_mail_data_t *pMail);
        static result AddEmailCallBackToDbus(void);