TizenRefApp-6564 Load conversation-history after adding recipient 38/78938/3
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Thu, 7 Jul 2016 11:05:14 +0000 (14:05 +0300)
committerDenis Dolzhenko <d.dolzhenko@samsung.com>
Thu, 7 Jul 2016 11:11:28 +0000 (14:11 +0300)
Change-Id: I497f6f1d81b177c406027278020a6904153667f9
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
src/Conversation/Main/Controller/src/Conversation.cpp
src/Conversation/Recipients/Controller/inc/ConvRecipientsPanel.h
src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp

index 49e5c8f..c702ce8 100644 (file)
@@ -149,6 +149,7 @@ void Conversation::create()
     createMainLayout(getParent());
     createMsgInputPanel(*m_pLayout);
     createBody(*m_pMsgInputPanel);
+    createConvList(*m_pLayout);
     updateMsgInputPanel();
 
     getApp().getContactManager().addListener(*this);
@@ -312,7 +313,6 @@ void Conversation::setNewMessageMode()
 
     createRecipPanel(*m_pLayout);
     createContactList(*m_pLayout);
-    destroyConvList();
     updateNavibar();
 
     m_pRecipPanel->update(m_ThreadId);
@@ -326,8 +326,6 @@ void Conversation::setConversationMode()
     MSG_LOG("");
 
     m_Mode = ConversationMode;
-    createConvList(*m_pLayout);
-
     updateNavibar();
 
     MsgAddressListRef addressList = getAddressList();
@@ -712,6 +710,21 @@ void Conversation::onMbeChanged(ConvRecipientsPanel &panel)
     MSG_LOG("");
     m_pBody->setMmsRecipFlag(m_pRecipPanel->isMms());
     checkAndSetMsgType();
+    if(m_pConvList)
+    {
+        std::list<std::string> recips;
+        auto items = panel.getMbeRecipients().getItems();
+        for(MbeRecipientItem *item : items)
+        {
+            recips.push_back(item->getAddress());
+        }
+        ThreadId id;
+        if(!recips.empty())
+            id = getMsgEngine().getStorage().getThreadId(recips);
+
+        m_pConvList->setThreadId(id);
+        m_pConvList->navigateToLastMsg();
+    }
 }
 
 void Conversation::onItemClicked(ConvRecipientsPanel &panel, MbeRecipientItem &item)
index 9da8ee4..7c93384 100644 (file)
@@ -51,6 +51,7 @@ namespace Msg
             void removeSelectedItem();
             void editSelectedItem();
             bool addRecipientsFromEntry(bool showPopup = true);
+            MbeRecipients &getMbeRecipients();
 
         private:
             // RecipientsPanelView:
index 609c983..f0eaab5 100644 (file)
@@ -116,6 +116,11 @@ bool ConvRecipientsPanel::addRecipientsFromEntry(bool showPopup)
     return true;
 }
 
+MbeRecipients &ConvRecipientsPanel::getMbeRecipients()
+{
+    return *m_pMbe;
+}
+
 void ConvRecipientsPanel::update(const MsgAddressList &addressList)
 {
     clearMbe();