virtual MsgThreadListRef searchThread(const std::string &word) = 0;
virtual void setReadStatus(ThreadId id) = 0;
virtual int getUnreadThreadCount() const = 0;
+ bool hasEmail(ThreadId id);
// Message:
virtual MessageSMSListRef getSimMsgList() = 0;
unsigned charsLeft; // Only for SMS
unsigned segmentsCount; // Only for SMS
- unsigned bytes; // SMS or MMS
- bool isMms; // SMS or MMS
+ unsigned bytes; // Only for SMS
+ bool isMms;
};
inline MsgTextMetric::MsgTextMetric()
#include "MsgStorage.h"
#include "Logger.h"
+#include "MsgUtils.h"
#include <algorithm>
using namespace Msg;
m_Listeners.erase(itr);
}
}
+
+bool MsgStorage::hasEmail(ThreadId id)
+{
+ if(!id.isValid())
+ return false;
+
+ const MsgAddressListRef addressList = getAddressList(id);
+ if(addressList)
+ {
+ for(int i = 0; i < addressList->getLength(); ++i)
+ {
+ const MsgAddress &msgAddr = addressList->at(i);
+ if(msgAddr.getAddressType() == MsgAddress::Email)
+ return true;
+ else if(MsgUtils::isValidEmail(msgAddr.getAddress()))
+ return true;
+ }
+ }
+ return false;
+}
bool addMedia(const std::string &filePath);
bool isMms();
+ void setMmsRecipFlag(bool value);
const MsgTextMetric &getTextMetric();
long long getMsgSize();
int getAttachmentsCountTotal() const;
Ecore_Idler *m_pOnChangedIdler;
bool m_TooLargePopupShow;
bool m_TooMuchAttachedPopupShow;
+ bool m_MmsRecipFlag;
};
class IBodyListener
Body &m_Body;
MsgTextMetric m_MsgMetric;
WorkingDirRef m_WorkingDir;
+ int m_Utf8TextSize;
};
}
, m_pOnChangedIdler(nullptr)
, m_TooLargePopupShow(false)
, m_TooMuchAttachedPopupShow(false)
+ , m_MmsRecipFlag(false)
{
}
bool Body::isMms()
{
+ if(m_MmsRecipFlag)
+ return true;
+
auto pages = getPages();
if(pages.size() > 1)
return false;
}
+void Body::setMmsRecipFlag(bool value)
+{
+ m_MmsRecipFlag = value;
+}
+
const MsgTextMetric &Body::getTextMetric()
{
return static_cast<Page&>(getDefaultPage()).getTextMetric();
, m_Body(parent)
, m_MsgMetric()
, m_WorkingDir(workingDir)
+ , m_Utf8TextSize(0)
{
}
if(item->hasChanged())
{
std::string text = item->getPlainUtf8Text();
+ m_Utf8TextSize = text.length();
MsgEngine::calculateTextMetric(text, m_MsgMetric);
item->resetChangedFlag();
}
}
}
updateMsgMetricIfNeeded();
- totalSize += m_MsgMetric.bytes;
-
+ totalSize += m_Body.isMms() ? m_Utf8TextSize : m_MsgMetric.bytes;
return totalSize;
}
{
m_ThreadId = id;
setMode(m_ThreadId.isValid() ? ConversationMode : NewMessageMode);
+
m_pBody->clear();
+ m_pBody->setMmsRecipFlag( getMsgEngine().getStorage().hasEmail(m_ThreadId));
+
if(m_pRecipPanel)
{
m_pRecipPanel->clear();
}
if(m_pConvList)
m_pConvList->setThreadId(m_ThreadId, searchWord);
+
markAsRead();
+ checkAndSetMsgType();
}
void Conversation::setListener(IConversationListener *listener)
if(!isBodyEmpty())
{
MessageRef msg = getMsgEngine().getComposer().createMessage(m_IsMms ? Message::MT_MMS : Message::MT_SMS);
-
if(msg)
{
read(*msg);
void Conversation::convertMsgTypeHandler()
{
MSG_LOG("Is MMS: ", m_IsMms);
+ updateMsgInputPanel();
notifyConvertMsgType();
}
void Conversation::onMbeChanged(ConvRecipientsPanel &panel)
{
MSG_LOG("");
+ m_pBody->setMmsRecipFlag(m_pRecipPanel->isMms());
checkAndSetMsgType();
}