void setListener(IBodyListener *listener);
void enableAutoFocusForAttachments(bool focus);
- void addMedia(const std::list<std::string> &fileList);
- void addMedia(const std::string &filePath);
+ void addAttachments(const std::list<std::string> &fileList);
+ void addAttachment(const std::string &filePath);
void clear();
bool isEmpty() const;
bool isMms();
void writeAttachments(const MessageMms &msg);
void writeTextToFile();
void runFileProcessing();
+ void addFileToPage(MessageMms &msg, const std::string &filePath);
PopupList &createPopupList(const std::string &title);
m_AutoFocusForAttachments = focus;
}
-void Body::addMedia(const std::list<std::string> &fileList)
+void Body::addAttachments(const std::list<std::string> &fileList)
{
for(auto& file : fileList)
m_SelectedFiles.push(file);
runFileProcessing();
}
-void Body::addMedia(const std::string &filePath)
+void Body::addAttachment(const std::string &filePath)
{
m_SelectedFiles.push(filePath);
runFileProcessing();
}
+void Body::addFileToPage(MessageMms &msg,const std::string &filePath)
+{
+ static const int defaultPageDuration = 5; // sec
+ if(!filePath.empty())
+ {
+ MsgPage &msgPage = msg.addPage();
+ msgPage.setPageDuration(defaultPageDuration);
+ MsgMedia &media = msgPage.addMedia();
+ media.setFilePath(filePath);
+ }
+}
+
void Body::runFileProcessing()
{
if(!m_SelectedFiles.empty())
void Body::read(MessageMms &msg)
{
- readAttachments(msg);
readText(msg);
+ readAttachments(msg);
}
void Body::readAttachments(MessageMms &msg)
{
- const int defaultPageDuration = 5; // sec
const auto &attachments = getComposeItem().getAttachments();
- for(auto *attachment : attachments)
+ for(auto *attach : attachments)
{
- const std::string &filePath = attachment->getFilePath();
+ const std::string &filePath = attach->getFilePath();
if(filePath.empty())
continue;
case MsgMedia::AudioType:
case MsgMedia::VideoType:
{
- MsgPage &msgPage = msg.addPage();
- msgPage.setPageDuration(defaultPageDuration);
- MsgMedia &media = msgPage.addMedia();
- media.setFilePath(filePath);
+ addFileToPage(msg, filePath);
break;
}
default:
if(!isEmpty())
{
writeTextToFile();
- MsgPage &msgPage = msg.addPage();
- MsgMedia &media = msgPage.addMedia();
- media.setFilePath(m_MmsTextFilePath);
+ addFileToPage(msg, m_MmsTextFilePath);
}
}
if(!cmd->getVcfInfo().contactsIdList.empty())
path.push_back(createVcfFile(cmd));
- addMedia(path);
+ addAttachments(path);
}
void Body::onMaxLengthReached()