, m_Handle()
, m_pListener(nullptr)
{
-
}
AttachPanel::~AttachPanel()
void AttachPanel::show(bool value)
{
- if(!value && !m_Handle)
+ if (!value && !m_Handle)
return;
getAttachPanel();
- if(value)
+ if (value)
attach_panel_show(m_Handle);
else
attach_panel_hide(m_Handle);
void AttachPanel::reset()
{
- if(m_Handle)
+ if (m_Handle)
{
attach_panel_hide(m_Handle);
attach_panel_destroy(m_Handle);
bool AttachPanel::isVisible() const
{
bool res = false;
- if(m_Handle)
+ if (m_Handle)
attach_panel_get_visibility(m_Handle, &res);
return res;
}
bool AttachPanel::isFullExpanded() const
{
attach_panel_state_e res = ATTACH_PANEL_STATE_HIDDEN;
- if(m_Handle)
+ if (m_Handle)
attach_panel_get_state(m_Handle, &res);
return res == ATTACH_PANEL_STATE_FULL;
}
attach_panel_h AttachPanel::getAttachPanel()
{
- if(m_Handle)
+ if (m_Handle)
return m_Handle;
attach_panel_create(m_App.getWindow().getConformEvasObject(), &m_Handle);
- if(m_Handle)
+ if (m_Handle)
{
bundle *extraData = bundle_create();
int maxMmsSize = m_App.getMsgEngine().getSettings().getMaxMmsSize();
MSG_LOG("Mss mms size = ", maxMmsSize);
- if(maxMmsSize > 0)
+ if (maxMmsSize > 0)
bundle_add_str(extraData, appControlTotalSize, std::to_string(maxMmsSize).c_str());
std::string maxAttachment = std::to_string(m_App.getMsgEngine().getSettings().getAttachmentsMaxCount());
bundle_add_str(extraData, appControlTotalCount, maxAttachment.c_str());
- if(extraData)
+ if (extraData)
{
attach_panel_add_content_category(m_Handle, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE, extraData);
attach_panel_add_content_category(m_Handle, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA, extraData);
app_control_h result, app_control_result_e resultCode, void *userData)
{
AttachPanel *self = (AttachPanel*)userData;
- if(!self->m_pListener || resultCode != APP_CONTROL_RESULT_SUCCEEDED)
+ if (!self->m_pListener || resultCode != APP_CONTROL_RESULT_SUCCEEDED)
return;
FileList fileList;
AppControlUtils::getExtraDataArray(result, APP_CONTROL_DATA_SELECTED, fileList);
- if(!fileList.empty())
+ if (!fileList.empty())
self->m_pListener->onFileSelected(*self, fileList);
-
}
bool res = false;
app_control_h svc_handle = NULL;
- if(APP_CONTROL_ERROR_NONE == app_control_create(&svc_handle))
+ if (APP_CONTROL_ERROR_NONE == app_control_create(&svc_handle))
{
app_control_set_operation(svc_handle, APP_CONTROL_OPERATION_PICK);
app_control_set_mime(svc_handle, mimeContact);
- if(howManyToPick > 1)
+ if (howManyToPick > 1)
{
app_control_add_extra_data(svc_handle, APP_CONTROL_DATA_SELECTION_MODE, multiple);
app_control_add_extra_data(svc_handle, APP_CONTROL_DATA_TOTAL_COUNT, std::to_string(howManyToPick).c_str());
- }
- else
- {
+ } else {
app_control_add_extra_data(svc_handle, APP_CONTROL_DATA_SELECTION_MODE, single);
}
void ContactPicker::onAppControlRes(app_control_h request, app_control_h reply, app_control_result_e result)
{
- if(result == APP_CONTROL_RESULT_SUCCEEDED)
+ if (result == APP_CONTROL_RESULT_SUCCEEDED)
{
std::list<int> addressIds;
std::list<std::string> types;
int minLen = std::min(addressIds.size(), types.size());
auto itId = addressIds.begin();
auto itType = types.begin();
- for(int i = 0; i < minLen; ++i, ++itId, ++itType)
+ for (int i = 0; i < minLen; ++i, ++itId, ++itType)
{
- if(*itType == typePhone)
+ if (*itType == typePhone) {
result.push_back({IContactPickerListener::PhoneType, *itId});
- else if(*itType == typeEmail)
+ } else if (*itType == typeEmail) {
result.push_back({IContactPickerListener::EmailType, *itId});
- else
- {
+ } else {
MSG_LOG_WARN("Unknown type: ", *itType);
}
}
- if(m_pListener)
+ if (m_pListener)
m_pListener->onContactsPicked(result);
}
}
Body::~Body()
{
- if(m_pOnChangedJob)
+ if (m_pOnChangedJob)
{
ecore_job_del(m_pOnChangedJob);
m_pOnChangedJob = nullptr;
ComposeListItem &Body::getComposeItem()
{
ComposeListItem &item = m_ConvList.getComposeItem();
- if(item.getListener() != this)
+ if (item.getListener() != this)
item.setListener(this);
return item;
}
void Body::addAttachments(const std::list<std::string> &fileList)
{
- for(auto& file : fileList)
+ for (auto& file : fileList)
m_SelectedFiles.push(file);
runFileProcessing();
}
runFileProcessing();
}
-void Body::addFileToPage(MessageMms &msg,const std::string &filePath)
+void Body::addFileToPage(MessageMms &msg, const std::string &filePath)
{
static const int defaultPageDuration = 5000; // msec
- if(!filePath.empty())
+ if (!filePath.empty())
{
MsgPage &msgPage = msg.addPage();
MediaTypeData mediaData = getMsgMediaTypeByFileExt(filePath);
int pageDuration = 0;
- if(mediaData.type == MsgMedia::VideoType || mediaData.type == MsgMedia::AudioType)
+ if (mediaData.type == MsgMedia::VideoType || mediaData.type == MsgMedia::AudioType)
pageDuration = MediaUtils::getDuration(filePath);
- if(pageDuration <= 0)
+ if (pageDuration <= 0)
pageDuration = defaultPageDuration;
msgPage.setPageDuration(pageDuration);
void Body::runFileProcessing()
{
- if(!m_SelectedFiles.empty())
+ if (!m_SelectedFiles.empty())
{
long long freeSpace = m_App.getMsgEngine().getSettings().getMaxMmsSize() - getMsgSize();
- if(freeSpace < FileUtils::getFileSize(m_SelectedFiles.front()))
+ if (freeSpace < FileUtils::getFileSize(m_SelectedFiles.front()))
showResizingPopup();
m_AttachmentHandler.processFile(m_SelectedFiles.front());
}
bool Body::isMms()
{
- if(m_MmsRecipFlag || !getComposeItem().isEmpty())
+ if (m_MmsRecipFlag || !getComposeItem().isEmpty())
return true;
updateTextMetricIfNeeded();
void Body::updateTextMetricIfNeeded()
{
- if(m_TextMetricNeedUpdate)
+ if (m_TextMetricNeedUpdate)
{
std::string text = getPlainUtf8Text();
m_Utf8TextSize = text.length();
// Attachments:
auto attachments = getComposeItem().getAttachments();
- for(auto *attachment : attachments)
+ for (auto *attachment : attachments)
{
totalSize += attachment->getFileSize();
}
void Body::read(Message &msg)
{
MSG_LOG("");
- if(MessageSMS *sms = dynamic_cast<MessageSMS*>(&msg))
+ if (MessageSMS *sms = dynamic_cast<MessageSMS*>(&msg))
read(*sms);
- else if(MessageMms *mms = dynamic_cast<MessageMms*>(&msg))
+ else if (MessageMms *mms = dynamic_cast<MessageMms*>(&msg))
read(*mms);
}
void Body::write(const Message &msg)
{
clear();
- if(const MessageSMS *sms = dynamic_cast<const MessageSMS*>(&msg))
+ if (const MessageSMS *sms = dynamic_cast<const MessageSMS*>(&msg))
write(*sms);
- else if(const MessageMms *mms = dynamic_cast<const MessageMms*>(&msg))
+ else if (const MessageMms *mms = dynamic_cast<const MessageMms*>(&msg))
write(*mms);
}
// Pages:
const MsgPageList &pages = msg.getPageList();
int pageCount = pages.getLength();
- for(int pageIndex = 0; pageIndex < pageCount; ++pageIndex)
+ for (int pageIndex = 0; pageIndex < pageCount; ++pageIndex)
{
const MsgPage &page = pages[pageIndex];
// Media:
const MsgMediaList &mediaList = page.getMediaList();
int mediaCount = mediaList.getLength();
- for(int mediaIndex = 0; mediaIndex < mediaCount; ++mediaIndex)
+ for (int mediaIndex = 0; mediaIndex < mediaCount; ++mediaIndex)
{
const MsgMedia &media = mediaList[mediaIndex];
std::string filePath = media.getFilePath();
- if(!filePath.empty())
+ if (!filePath.empty())
{
std::string mime = FileUtils::getMimeType(filePath);
- if(mime != "text/plain") // Skip text on page
+ if (mime != "text/plain") // Skip text on page
{
std::string newFilePath = m_WorkingDir->addFile(filePath);
getComposeItem().addAttachment(newFilePath);
// Attachments:
const MsgAttachmentList &attachments = msg.getAttachmentList();
int attachmentCount = attachments.getLength();
- for(int i = 0; i < attachmentCount; ++i)
+ for (int i = 0; i < attachmentCount; ++i)
{
const MsgAttachment &attachment = attachments[i];
std::string filePath = attachment.getFilePath();
- if(!filePath.empty())
+ if (!filePath.empty())
{
std::string mime = FileUtils::getMimeType(filePath);
- if(mime != "application/smil") // Skip SMIL layout
+ if (mime != "application/smil") // Skip SMIL layout
{
std::string newFilePath = m_WorkingDir->addFile(filePath);
getComposeItem().addAttachment(newFilePath);
void Body::writeTextToFile()
{
- if(m_MmsTextFilePath.empty())
+ if (m_MmsTextFilePath.empty())
m_MmsTextFilePath = m_WorkingDir->addTextFile(getPlainUtf8Text());
else
FileUtils::writeTextFile(m_MmsTextFilePath, getPlainUtf8Text());
void Body::readAttachments(MessageMms &msg)
{
const auto &attachments = getComposeItem().getAttachments();
- for(auto *attach : attachments)
+ for (auto *attach : attachments)
{
const std::string &filePath = attach->getFilePath();
- if(filePath.empty())
+ if (filePath.empty())
continue;
- switch(getMsgMediaTypeByFileExt(filePath).type)
+ switch (getMsgMediaTypeByFileExt(filePath).type)
{
case MsgMedia::ImageType:
case MsgMedia::AudioType:
void Body::readText(MessageMms &msg)
{
- if(!BodyView::isEmpty())
+ if (!BodyView::isEmpty())
{
writeTextToFile();
addFileToPage(msg, m_MmsTextFilePath);
clear();
setText(cmd->getMessageText());
std::list<std::string> path = cmd->getFileList();
- if(!cmd->getVcfInfo().contactsIdList.empty())
+ if (!cmd->getVcfInfo().contactsIdList.empty())
path.push_back(createVcfFile(cmd));
addAttachments(path);
void Body::execCmd(const AppControlDefaultRef &cmd)
{
- if(cmd->getDefaultType() == AppControlDefault::ReplyType)
+ if (cmd->getDefaultType() == AppControlDefault::ReplyType)
{
clear();
setText(cmd->getReplyText());
void Body::onCheckBoundaryText(char **text)
{
MSG_LOG("");
- if(isMms())
+ if (isMms())
{
long long maxSize = m_App.getMsgEngine().getSettings().getMaxMmsSize();
std::string utfText = markupToUtf8(*text);
- if(getMsgSize() + static_cast<long long>(utfText.size()) > maxSize)
+ if (getMsgSize() + static_cast<long long>(utfText.size()) > maxSize)
{
free(*text);
*text = nullptr;
void Body::showTooLargePopup(const std::list <std::string> &tooBigFiles)
{
- if(!m_TooLargePopupShow)
+ if (!m_TooLargePopupShow)
{
Popup &popup = m_App.getPopupManager().getPopup();
popup.addEventCb(EVAS_CALLBACK_DEL, EVAS_EVENT_CALLBACK(Body, onTooLargePopupDel), this);
popup.addButton(msgt("IDS_MSG_BUTTON_OK_ABB"), Popup::OkButtonId);
popup.setTitle(msgt("IDS_MSG_HEADER_FILE_SIZE_TOO_LARGE_ABB"));
std::string content(msg("IDS_MSG_POP_UNABLE_TO_ATTACH_FILE_FILE_SIZE_TOO_LARGE_TRY_SENDING_VIA_EMAIL_BLUETOOTH_WI_FI_ETC"));
- for(auto& file: tooBigFiles)
+ for (auto& file: tooBigFiles)
{
content.append("<br/>");
content.append(FileUtils::getFileName(file));
void Body::showTooMuchAttachedPopup(int willBeAttached)
{
- if(!m_TooMuchAttachedPopupShow)
+ if (!m_TooMuchAttachedPopupShow)
{
Popup &popup = m_App.getPopupManager().getPopup();
popup.addEventCb(EVAS_CALLBACK_DEL, EVAS_EVENT_CALLBACK(Body, onTooMuchAttachedPopupDel), this);
void Body::showTooMuchAttachedPopup()
{
- if(!m_TooMuchAttachedPopupShow)
+ if (!m_TooMuchAttachedPopupShow)
{
Popup &popup = m_App.getPopupManager().getPopup();
popup.addEventCb(EVAS_CALLBACK_DEL, EVAS_EVENT_CALLBACK(Body, onTooMuchAttachedPopupDel), this);
void Body::showResizingPopup()
{
- if(!m_ResizingPopupShow)
+ if (!m_ResizingPopupShow)
{
Popup &popup = m_App.getPopupManager().getPopup();
popup.addEventCb(EVAS_CALLBACK_DEL, EVAS_EVENT_CALLBACK(Body, onResizingPopupDel), this);
std::string content;
std::string path;
- if(cmd->getComposeType() == AppControlCompose::OpShare)
+ if (cmd->getComposeType() == AppControlCompose::OpShare)
{
content = m_App.getContactManager().makeVcard(*idList.begin(), cmd->getVcfInfo().isMyProfile);
path = contactFileName;
- }
- else if(cmd->getComposeType() == AppControlCompose::OpMultiShare)
- {
+ } else if (cmd->getComposeType() == AppControlCompose::OpMultiShare) {
content = m_App.getContactManager().makeVcard(idList);
path = contactsFileName;
}
void Body::notifyContentChanged()
{
- if(!m_pOnChangedJob)
+ if (!m_pOnChangedJob)
{
- m_pOnChangedJob = ecore_job_add
- (
+ m_pOnChangedJob = ecore_job_add(
[](void *data)
{
Body *self =(Body*)data;
self->m_pOnChangedJob = nullptr;
- if(self->m_pListener)
+ if (self->m_pListener)
self->m_pListener->onChanged(*self);
},
- this
- );
+ this);
}
}
void Body::onAttachmentDeleted(const std::list<std::string> &files)
{
- for(const std::string &file : files)
+ for (const std::string &file : files)
{
m_WorkingDir->removeFile(file);
}
{
int numAttached = getComposeItem().getAttachments().size();
int numAttachMax = m_App.getMsgEngine().getSettings().getAttachmentsMaxCount();
- if(numAttached == numAttachMax)
+ if (numAttached == numAttachMax)
{
std::queue <std::string> empty;
std::swap(m_SelectedFiles, empty);
getComposeItem().addAttachment(filePath);
- if(m_AutoFocusForAttachments)
+ if (m_AutoFocusForAttachments)
BodyView::setFocus(true);
m_SelectedFiles.pop();
- if(!m_SelectedFiles.empty())
+ if (!m_SelectedFiles.empty())
{
long long freeSpace = m_App.getMsgEngine().getSettings().getMaxMmsSize() - getMsgSize();
- if(freeSpace < FileUtils::getFileSize(m_SelectedFiles.front()))
+ if (freeSpace < FileUtils::getFileSize(m_SelectedFiles.front()))
showResizingPopup();
m_AttachmentHandler.processFile(m_SelectedFiles.front());
- }
- else
- {
+ } else {
hideResizingPopup();
}
}
void Body::onFileFails()
{
std::list <std::string> overflowList;
- while(!m_SelectedFiles.empty())
+ while (!m_SelectedFiles.empty())
{
overflowList.push_back(m_SelectedFiles.front());
m_SelectedFiles.pop();
void BodyView::setText(const std::string &text)
{
- if(!text.empty())
+ if (!text.empty())
{
char *markupText = elm_entry_utf8_to_markup(text.c_str());
- if(markupText)
+ if (markupText)
{
elm_object_text_set(m_pEntry, markupText);
free(markupText);
}
- }
- else
- {
+ } else {
clear();
}
}
void BodyView::setFocus(bool focus)
{
elm_object_focus_set(m_pEntry, focus);
- if(focus)
+ if (focus)
elm_entry_cursor_end_set(m_pEntry);
}
std::string res;
const char *plainText = elm_entry_entry_get(m_pEntry);
- if(plainText)
+ if (plainText)
{
char *text = elm_entry_markup_to_utf8(plainText);
- if(text)
+ if (text)
{
res.assign(text);
free(text);
Elm_Entry_Filter_Limit_Size limitFilter = {};
limitFilter.max_char_count = maxCharCount;
elm_entry_markup_filter_append(m_pEntry, elm_entry_filter_limit_size, &limitFilter);
- elm_entry_markup_filter_append
- (
+ elm_entry_markup_filter_append(
m_pEntry,
[](void *data, Evas_Object *entry, char **text)
{
((BodyView*)data)->onCheckBoundaryText(text);
- }, this );
+ },
+ this);
evas_object_show(m_pEntry);
evas_object_smart_callback_add(m_pEntry, "changed", [](void *data, Evas_Object *obj, void *event_info)
evas_object_geometry_get(m_pEntry, nullptr, nullptr, &w, &h);
- if(h > maxBodyHeight)
+ if (h > maxBodyHeight)
h = maxBodyHeight;
evas_object_size_hint_min_set(m_pGrid, 0, h);
ConvContactList::~ConvContactList()
{
- if(m_pPredictSearchIdler)
+ if (m_pPredictSearchIdler)
{
ecore_idler_del(m_pPredictSearchIdler);
m_pPredictSearchIdler = nullptr;
{
getList().clear();
- if(m_pListener)
+ if (m_pListener)
m_pListener->onContactListChanged();
}
void ConvContactList::requestSearch()
{
- if(!m_pPredictSearchIdler)
+ if (!m_pPredictSearchIdler)
m_pPredictSearchIdler = ecore_idler_add(ECORE_TACK_CALLBACK(ConvContactList, onPredictSearchUpdateRequest), this);
}
void ConvContactList::search()
{
getList().clear();
- if(!m_SearchWord.empty())
+ if (!m_SearchWord.empty())
{
search<ContactPersonNumber>();
search<ContactPersonEmail>();
search<ContactPersonPhoneLog>();
}
- if(m_pListener)
+ if (m_pListener)
m_pListener->onContactListChanged();
}
void ConvContactList::search()
{
auto list = m_App.getContactManager().search<ContactRecord>(m_SearchWord);
- if(list)
+ if (list)
{
do
{
auto &rec = list->get();
- if(MsgUtils::isValidAddress(rec.getAddress()))
+ if (MsgUtils::isValidAddress(rec.getAddress()))
{
ContactListItem *item = new ContactListItem(rec, m_App, m_SearchWord);
getList().appendItem(*item);
- }
- else
- {
+ } else {
MSG_LOG("Skip invalid contact: ", rec.getAddress());
}
- } while(list->next());
+ } while (list->next());
}
}
{
ContactListItem &contactItem = static_cast<ContactListItem&>(listItem);
MSG_LOG("Selected recipient: ", contactItem.getRecipient());
- if(m_pListener)
+ if (m_pListener)
m_pListener->onContactSelected(contactItem);
}
std::string ContactListViewItem::getText(ListItem &item, const char *part)
{
- if(getStyle() == nameOrEmailStyle)
+ if (getStyle() == nameOrEmailStyle)
{
const char *mainTextPart = "elm.text";
const char *subTextPart = "elm.text.sub";
- if(strcmp(part, mainTextPart) == 0)
+ if (strcmp(part, mainTextPart) == 0)
{
return getMainText();
- }
- else if(strcmp(part, subTextPart) == 0)
- {
+ } else if (strcmp(part, subTextPart) == 0) {
return getSubText();
}
}
- if(getStyle() == logStyle)
+ if (getStyle() == logStyle)
{
const char *mainTextPart = "elm.text";
-
- if(strcmp(part, mainTextPart) == 0)
+ if (strcmp(part, mainTextPart) == 0)
{
return getMainText();
}
Evas_Object *ContactListViewItem::getContent(ListItem &item, const char *part)
{
- if(strcmp(part, "elm.swallow.icon") == 0)
+ if (strcmp(part, "elm.swallow.icon") == 0)
{
return getThumbnail();
}
ConvContactListView::~ConvContactListView()
{
-
}
ListView &ConvContactListView::getList()
int h = 0;
evas_object_size_hint_min_get(*m_pList, nullptr, &h);
- if(h > maxHeight)
+ if (h > maxHeight)
h = maxHeight;
evas_object_size_hint_min_set(m_pGrid, width, h);
{
class BubbleEntityFactory
{
-
public:
BubbleEntityFactory(App &app, WorkingDirRef workingDir);
~BubbleEntityFactory();
inline BubbleTextViewItem *BubbleTextEntity::createView(Evas_Object *parent)
{
- auto *item = new BubbleTextViewItem(*this ,parent, m_BgType, m_Text);
+ auto *item = new BubbleTextViewItem(*this, parent, m_BgType, m_Text);
return item;
}
}
: BubbleBgEntity(CalendarEventItem, bgType, direction, filePath)
{
auto list = VCalendarParser::getInst().parse(filePath);
- if(list.size() == 1)
+ if (list.size() == 1)
{
const CalendarEvent &event = list.front();
m_Name = event.getSummary();
m_DateTime = event.getStartDate();
- }
- else
- {
+ } else {
m_Name = fileName;
}
}
BubbleCalEventViewItem::Layout1Icon2Text;
auto *item = new BubbleCalEventViewItem(*this, parent, m_BgType, type);
item->setMainText(m_Name);
- if(!m_DateTime.empty())
+ if (!m_DateTime.empty())
item->setSubText(m_DateTime);
return item;
}
, m_ThumbMaker(app.getThumbnailMaker())
{
auto list = app.getContactManager().parseVcard(getFilePath());
- if(!list.empty())
+ if (!list.empty())
{
- if(list.size() == 1)
+ if (list.size() == 1)
{
m_Contact = list.front();
- if(m_Contact)
+ if (m_Contact)
{
m_Name = m_Contact->getDispName();
m_Address = m_Contact->getAddress();
}
}
}
- if(!m_Contact)
+ if (!m_Contact)
m_Name = fileName;
}
Evas_Object *thumb = m_ThumbPath.empty() ? item->createIcon(ATTACH_CONTACT_ICON)
: m_ThumbMaker.getThumb(*item, m_ThumbPath, BubbleContactViewItem::iconSize);
- if(thumb)
+ if (thumb)
item->setIcon(thumb);
- if(!m_Address.empty())
+ if (!m_Address.empty())
item->setSubText(m_Address);
return item;
}
: m_App(app)
, m_WorkingDir(workingDir)
{
-
}
BubbleEntityFactory::~BubbleEntityFactory()
std::string fileName = msgMedia.getName();
std::string filePath = msgMedia.getPath();
- if(mime.empty())
+ if (mime.empty())
mime = FileUtils::getMimeType(filePath);
- if(fileName.empty())
+ if (fileName.empty())
fileName = FileUtils::getFileName(filePath);
return createEntity(filePath, fileName, mime, bgType, direction);
BubbleEntity *BubbleEntityFactory::createEntity(const std::string &filePath, const std::string &fileName, std::string mime, BubbleBgViewItem::BgType bgType, Message::Direction direction)
{
std::transform(mime.begin(), mime.end(), mime.begin(), ::tolower);
- if(FileUtils::isExists(filePath))
+ if (FileUtils::isExists(filePath))
{
MsgMedia::Type msgMediaType = getMsgMediaTypeByMime(mime);
- switch(msgMediaType)
+ switch (msgMediaType)
{
case MsgMedia::ImageType:
return new BubbleImageEntity(filePath, direction);
case MsgMedia::VideoType:
return new BubbleVideoEntity(m_WorkingDir, filePath, direction);
default:
- if(mime == "text/x-vcalendar" || mime == "text/calendar")
+ if (mime == "text/x-vcalendar" || mime == "text/calendar")
return new BubbleCalEventEntity(filePath, fileName, bgType, direction);
- else if(mime == "text/x-vcard" ||
+ else if (mime == "text/x-vcard" ||
mime == "text/vcard" ||
mime == "text/x-vcalendar")
return new BubbleContactEntity(m_App, filePath, fileName , bgType, direction);
- else if(mime != "application/smil")
+ else if (mime != "application/smil")
return new BubbleUnknownFileEntity(filePath, fileName, bgType, direction);
}
}
: BubbleBgEntity(UnknownFileItem, bgType, direction, filePath)
, m_FileName(fileName)
{
-
}
BubbleUnknownFileEntity::~BubbleUnknownFileEntity()
{
static const std::string thumbFileName = "thumbnail.jpeg";
m_ImgPath = m_WorkingDir->genUniqueFilePath(thumbFileName);
- if(!m_ImgPath.empty())
+ if (!m_ImgPath.empty())
MediaUtils::getVideoFrame(getFilePath(), m_ImgPath);
}
: m_pListener(nullptr)
, m_BubbleEntityFactory(entityFactory)
{
-
}
ComposeListItem::~ComposeListItem()
void ComposeListItem::addAttachment(const std::string &filePath)
{
auto *entity = m_BubbleEntityFactory.createEntity(filePath, BubbleBgViewItem::DraftStyle, Message::MD_Sent);
- if(entity)
+ if (entity)
{
m_BubbleEntityList.push_back(entity);
updateBubblePart();
show(true);
navigate();
- if(m_pListener)
+ if (m_pListener)
m_pListener->onAttachmentAdded({filePath});
}
}
void ComposeListItem::clear(bool updateUi)
{
std::list<std::string> fileList;
- for(BubbleEntity *entity : m_BubbleEntityList)
+ for (BubbleEntity *entity : m_BubbleEntityList)
{
fileList.push_back(entity->getFilePath());
delete entity;
}
m_BubbleEntityList.clear();
- if(updateUi)
+ if (updateUi)
{
show(false);
ComposeListItem::updateBubblePart();
}
- if(m_pListener)
+ if (m_pListener)
m_pListener->onAttachmentDeleted(fileList);
}
Evas_Object *ComposeListItem::getBubbleContent()
{
- if(m_BubbleEntityList.empty())
+ if (m_BubbleEntityList.empty())
return nullptr;
auto *bubble = new BubbleItemContainer(*getOwner());
- for(BubbleEntity *entity : m_BubbleEntityList)
+ for (BubbleEntity *entity : m_BubbleEntityList)
{
BubbleViewItem *item = entity->createView(*bubble);
- if(item)
+ if (item)
{
item->showDelButton(true);
item->setListener(this);
void ComposeListItem::deleteEntity(BubbleEntity &entity)
{
auto it = std::find(m_BubbleEntityList.begin(), m_BubbleEntityList.end(), &entity);
- if(it != m_BubbleEntityList.end())
+ if (it != m_BubbleEntityList.end())
{
std::string filePath = entity.getFilePath();
delete *it;
m_BubbleEntityList.erase(it);
- if(isEmpty())
+ if (isEmpty())
show(false);
updateBubblePart();
- if(m_pListener)
+ if (m_pListener)
m_pListener->onAttachmentDeleted({filePath});
}
}
showSelectAllMode(isCheckMode);
m_pList->setCheckMode(isCheckMode);
- if(isCheckMode)
+ if (isCheckMode)
{
selectListItems(false);
m_pSelectAll->setCheckState(false);
- }
- else
- {
+ } else {
ConvListViewItem::resetCheckMode(*m_pList);
}
m_pList->updateRealizedItems();
void ConvList::fill()
{
clear();
- if(!m_ThreadId.isValid())
+ if (!m_ThreadId.isValid())
return;
MsgConversationListRef convList = m_MsgEngine.getStorage().getConversationList(m_ThreadId);
m_ConvListItemMap.reserve(reserveSize);
m_DateLineItemSet.reserve(reserveSize);
- for(int i = 0; i < convListLen; ++i)
+ for (int i = 0; i < convListLen; ++i)
{
MsgConversationItem &item = convList->at(i);
insertItem(item);
{
bool fillList = false;
- if(m_ThreadId != id)
+ if (m_ThreadId != id)
{
fillList = true;
m_ThreadId = id;
updateRecipThumbId();
}
- if(searchWord && strcmp(searchWord, m_SearchWord.c_str()))
+ if (searchWord && strcmp(searchWord, m_SearchWord.c_str()))
{
fillList = true;
m_SearchWord = searchWord;
}
- if(fillList)
+ if (fillList)
fill();
}
void ConvList::updateRecipThumbId()
{
const MsgAddressListRef addressList = m_App.getMsgEngine().getStorage().getAddressList(m_ThreadId);
- if(addressList)
+ if (addressList)
{
int countContact = addressList->getLength();
- if(countContact > 1)
+ if (countContact > 1)
+ {
m_RecipThumbId = m_App.getThumbnailMaker().getThumbId(ThumbnailMaker::GroupThumb);
- else if(countContact == 1)
+ } else if (countContact == 1) {
m_RecipThumbId = m_App.getThumbnailMaker().getThumbId(addressList->at(0));
- else
- {
+ } else {
m_RecipThumbId = m_App.getThumbnailMaker().getThumbId(ThumbnailMaker::SingleThumb);
MSG_LOG_WARN("Msg address list is empty");
}
- }
- else
- {
+ } else {
m_RecipThumbId = invalidThumbId;
}
}
void ConvList::navigateTo(MsgId msgId)
{
ConvListItem *item = getItem(msgId);
- if(item)
+ if (item)
m_pList->showItem(*item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
}
void ConvList::navigateToBottom()
{
ListItem *item = m_pList->getLastItem();
- if(item)
+ if (item)
{
ComposeListViewItem *composeItem = dynamic_cast<ComposeListViewItem*>(item);
- if(!(composeItem && composeItem->isVisible()))
+ if (!(composeItem && composeItem->isVisible()))
item = m_pList->getPrevItem(*item);
- if(item)
+ if (item)
m_pList->showItem(*item, ELM_GENLIST_ITEM_SCROLLTO_BOTTOM);
}
}
void ConvList::insertItem(const MsgConversationItem &item)
{
- if(item.getDirection() == Message::MD_Received)
+ if (item.getDirection() == Message::MD_Received)
insertItem(new ConvListItem(item, m_App, m_BubbleEntityFactory, m_SearchWord, m_RecipThumbId));
else
insertItem(new ConvListItem(item, m_App, m_BubbleEntityFactory, m_SearchWord));
dateLineAddIfNec(item);
m_ConvListItemMap[item->getMsgId()] = item;
item->setListener(this);
- if(m_pComposeItem)
+ if (m_pComposeItem)
m_pList->insertBeforeItem(*item, *m_pComposeItem);
else
m_pList->appendItem(*item);
bool ConvList::deleteItems(const MsgIdList &idList)
{
bool res = false;
- for(const MsgId &id: idList)
+ for (const MsgId &id: idList)
{
ConvListItem *deleted = getItem(id);
- if(deleted)
+ if (deleted)
{
res = true;
deleteItem(deleted);
}
}
- if(m_pListener && m_ConvListItemMap.empty())
+ if (m_pListener && m_ConvListItemMap.empty())
m_pListener->onAllConvItemsDeleted(*this);
return res;
dateLineDelIfNec(item);
dateLineAddIfNec(item);
m_pList->demoteItem(*item);
- if(m_pComposeItem)
+ if (m_pComposeItem)
m_pList->demoteItem(*m_pComposeItem);
}
{
bool needDelDateLine = false;
DateLineItem *prev = dynamic_cast<DateLineItem*>(m_pList->getPrevItem(*item));
- if(prev)
- {
+ if (prev) {
ListItem *nextItem = m_pList->getNextItem(*item);
needDelDateLine = nextItem ? dynamic_cast<ConvListItem*>(nextItem) == nullptr : true;
- if(needDelDateLine)
- {
+ if (needDelDateLine) {
m_DateLineItemSet.erase(prev->getDateLine());
m_pList->deleteItem(*prev);
}
{
std::string dateStr = TimeUtils::makeBubbleDateLineString(item->getRawTime());
auto it = m_DateLineItemSet.find(dateStr);
- if (it == m_DateLineItemSet.end())
- {
+ if (it == m_DateLineItemSet.end()) {
DateLineItem *dateLine = new DateLineItem(item->getRawTime(), dateStr);
m_DateLineItemSet.insert(dateStr);
- if(m_pComposeItem)
+ if (m_pComposeItem)
m_pList->insertBeforeItem(*dateLine, *m_pComposeItem);
else
m_pList->appendItem(*dateLine);
void ConvList::clear()
{
auto items = m_pList->getItems();
- for(ListItem *item : items)
+ for (ListItem *item : items)
{
- if(item != m_pComposeItem)
+ if (item != m_pComposeItem)
item->destroy();
}
m_ConvListItemMap.clear();
{
auto items = getConvItems();
MsgIdList messages;
- for(ConvListItem *item : items)
+ for (ConvListItem *item : items)
{
- if(item->getCheckedState())
+ if (item->getCheckedState())
messages.push_back(item->getMsgId());
}
m_MsgEngine.getStorage().deleteMessages(messages);
{
auto items = getConvItems();
int count = 0;
- for(ConvListItem *item : items)
+ for (ConvListItem *item : items)
{
- if(item->getCheckedState())
+ if (item->getCheckedState())
count++;
}
return count;
void ConvList::selectListItems(bool state)
{
m_pList->checkAllItems(state);
- if(m_pListener)
+ if (m_pListener)
m_pListener->onConvListItemChecked();
}
void ConvList::updateSelectAllItem()
{
- if(m_Mode == SelectMode && m_pSelectAll)
+ if (m_Mode == SelectMode && m_pSelectAll)
{
bool check = true;
auto items = getConvItems();
- for(ConvListItem *item : items)
+ for (ConvListItem *item : items)
{
- if(!item->getCheckedState())
+ if (!item->getCheckedState())
{
check = false;
break;
ComposeListItem &ConvList::getComposeItem()
{
- if(!m_pComposeItem)
+ if (!m_pComposeItem)
{
m_pComposeItem = new ComposeListItem(m_BubbleEntityFactory);
m_pList->appendItem(*m_pComposeItem);
void ConvList::onListItemLongPressed(ListItem &listItem)
{
ConvListItem *item = dynamic_cast<ConvListItem*>(&listItem);
- if(item)
+ if (item)
item->showPopup();
}
void ConvList::onListItemChecked(ListItem &listItem)
{
updateSelectAllItem();
- if(m_pListener)
+ if (m_pListener)
m_pListener->onConvListItemChecked();
}
void ConvList::onMsgStorageUpdate(const MsgIdList &msgIdList)
{
- for(auto &itemId: msgIdList)
+ for (auto &itemId: msgIdList)
{
ConvListItem *updated = getItem(itemId);
- if(updated)
+ if (updated)
{
time_t beforeTime = updated->getRawTime();
updated->updateStatus();
- if(beforeTime != updated->getRawTime())
+ if (beforeTime != updated->getRawTime())
demoteItem(updated);
}
}
void ConvList::onMsgStorageInsert(const MsgIdList &msgIdList)
{
bool inserted = false;
- for(MsgId msgId: msgIdList)
+ for (MsgId msgId: msgIdList)
{
- if(getItem(msgId))
+ if (getItem(msgId))
continue;
MessageRef msg = m_MsgEngine.getStorage().getMessage(msgId);
- if(msg && msg->getThreadId() == m_ThreadId && msg->getMessageStorageType() != Message::MS_Sim)
+ if (msg && msg->getThreadId() == m_ThreadId && msg->getMessageStorageType() != Message::MS_Sim)
{
MsgConversationItemRef item = m_MsgEngine.getStorage().getConversationItem(msgId);
- if(item)
+ if (item)
{
insertItem(*item);
inserted = true;
}
}
}
- if(inserted)
+ if (inserted)
navigateToBottom();
}
void ConvList::onForwardMsg(ConvListItem &item)
{
- if(m_pListener)
+ if (m_pListener)
m_pListener->onForwardMsg(item.getMsgId());
}
void ConvList::onSlideShow(ConvListItem &item)
{
- if(m_pListener)
+ if (m_pListener)
m_pListener->onSlideShow(item.getMsgId());
}
void ConvList::onResendMsg(ConvListItem &item)
{
- if(m_pListener)
+ if (m_pListener)
m_pListener->onResendMsg(item.getMsgId());
}
void ConvList::onSaveAttachments(ConvListItem &item)
{
- if(m_pListener)
+ if (m_pListener)
m_pListener->onSaveAttachments(item.getMsgId());
}
void ConvList::onEditDraftMsg(ConvListItem &item)
{
- if(m_pListener)
+ if (m_pListener)
{
item.disabled(true);
m_pListener->onEditDraftMsg(item.getMsgId());
{
MSG_LOG("");
auto items = getConvItems();
- for(ConvListItem *item : items)
+ for (ConvListItem *item : items)
{
item->updateTime();
}
// Update ConvListItem:
auto convListItems = getConvItems();
- for(ConvListItem *item : convListItems)
+ for (ConvListItem *item : convListItems)
{
item->updateTime();
}
// Update DateLineItem:
m_DateLineItemSet.clear();
auto DateLineItems = m_pList->getItems<DateLineItem>();
- for(DateLineItem *item : DateLineItems)
+ for (DateLineItem *item : DateLineItems)
{
item->update();
m_DateLineItemSet.insert(item->getDateLine());
void ConvList::onListResized(Evas_Object *obj, void *eventInfo)
{
MSG_LOG("");
- if(m_BodyFocusFunc && m_BodyFocusFunc())
+ if (m_BodyFocusFunc && m_BodyFocusFunc())
navigateToBottom();
}
ConvListItem::~ConvListItem()
{
m_App.getPopupManager().reset(this);
- for(auto *entity : m_BubbleEntityList)
+ for (auto *entity : m_BubbleEntityList)
{
delete entity;
}
void ConvListItem::updateStatus()
{
MessageRef msg = m_App.getMsgEngine().getStorage().getMessage(m_MsgId);
- if(!msg)
+ if (!msg)
return;
updateTime();
m_NetworkStatus = msg->getNetworkStatus();
m_IsRestrictedByDpm = msg->isRestrictedByDpm();
- if(m_NetworkStatus == Message::NS_Send_Fail)
+ if (m_NetworkStatus == Message::NS_Send_Fail)
{
updateItemType(ConvItemType::Failed);
updateEntityBgType(BubbleBgViewItem::FailedStyle);
- }
- else if(m_NetworkStatus == Message::NS_Send_Success || m_NetworkStatus == Message::NS_Sending)
- {
+ } else if (m_NetworkStatus == Message::NS_Send_Success || m_NetworkStatus == Message::NS_Sending) {
updateItemType(ConvItemType::Sent);
updateEntityBgType(BubbleBgViewItem::SentStyle);
- }
- else if(m_NetworkStatus == Message::NS_Not_Send)
- {
+ } else if (m_NetworkStatus == Message::NS_Not_Send) {
updateItemType(ConvItemType::Draft);
updateEntityBgType(BubbleBgViewItem::DraftStyle);
- }
- else if(m_NetworkStatus == Message::NS_Received)
- {
+ } else if (m_NetworkStatus == Message::NS_Received) {
updateItemType(ConvItemType::Received);
BubbleBgViewItem::BgType bgType = m_IsRestrictedByDpm ? BubbleBgViewItem::RestrictedStyle : BubbleBgViewItem::ReceivedStyle;
updateEntityBgType(bgType);
- }
- else if(m_NetworkStatus == Message::NS_Retrieving)
- {
+ } else if (m_NetworkStatus == Message::NS_Retrieving) {
updateDownloadButton();
}
ConvListViewItem::ConvItemType ConvListItem::getConvItemType(const MsgConversationItem &item)
{
ConvItemType type = ConvItemType::Sent;
- if(item.getDirection() == Message::Direction::MD_Sent)
+ if (item.getDirection() == Message::Direction::MD_Sent)
{
- if(item.isDraft())
+ if (item.isDraft())
type = ConvItemType::Draft;
- else if(item.getNetworkStatus() == Message::NS_Send_Fail)
+ else if (item.getNetworkStatus() == Message::NS_Send_Fail)
type = ConvItemType::Failed;
- }
- else
- {
+ } else {
type = ConvItemType::Received;
}
return type;
BubbleBgViewItem::BgType ConvListItem::getBubbleBgType(const MsgConversationItem &item)
{
BubbleBgViewItem::BgType type = BubbleBgViewItem::SentStyle;
- if(item.getDirection() == Message::Direction::MD_Sent)
+ if (item.getDirection() == Message::Direction::MD_Sent)
{
- if(item.isDraft())
+ if (item.isDraft())
type = BubbleBgViewItem::DraftStyle;
- else if(item.getNetworkStatus() == Message::NS_Send_Fail)
+ else if (item.getNetworkStatus() == Message::NS_Send_Fail)
type = BubbleBgViewItem::FailedStyle;
- }
- else
- {
+ } else {
type = BubbleBgViewItem::ReceivedStyle;
}
return type;
std::string filePath = media.getPath();
std::string text = FileUtils::readTextFile(filePath);
BubbleTextEntity *entity = createTextEntity(bgType, std::move(text), true, std::move(searchWord));
- if(entity)
+ if (entity)
entity->setFilePath(std::move(filePath));
return entity;
}
std::string markupSearchWord = markup ? utf8ToMarkup(searchWord) : std::move(searchWord);
std::string resText = TextDecorator::highlightKeyword(std::move(markupText), markupSearchWord, &found);
- if(found)
+ if (found)
showSearch();
return m_BubbleEntityFactory.createTextEntity(std::move(resText), bgType, m_Direction);
BubbleDownloadButtonEntity *ConvListItem::findDownloadButton() const
{
- for(BubbleEntity *entity : m_BubbleEntityList)
+ for (BubbleEntity *entity : m_BubbleEntityList)
{
- if(entity->getType() == BubbleEntity::DownloadButtonItem)
+ if (entity->getType() == BubbleEntity::DownloadButtonItem)
return static_cast<BubbleDownloadButtonEntity*>(entity);
}
return nullptr;
void ConvListItem::updateDownloadButton()
{
auto *downloadButton = findDownloadButton();
- if(downloadButton)
+ if (downloadButton)
downloadButton->disabled(m_NetworkStatus == Message::NS_Retrieving);
}
void ConvListItem::addEntity(BubbleEntity *entity)
{
- if(entity)
+ if (entity)
m_BubbleEntityList.push_back(entity);
}
void ConvListItem::updateEntityBgType(BubbleBgViewItem::BgType bgType)
{
- for(BubbleEntity *entity : m_BubbleEntityList)
+ for (BubbleEntity *entity : m_BubbleEntityList)
{
auto *bgEntity = dynamic_cast<BubbleBgEntity*>(entity);
- if(bgEntity)
+ if (bgEntity)
bgEntity->setBgType(bgType);
}
}
void ConvListItem::prepareBubble(const MsgConversationItem &item, const std::string &searchWord)
{
BubbleBgViewItem::BgType bgType = getBubbleBgType(item);
- if(m_IsRestrictedByDpm)
+ if (m_IsRestrictedByDpm)
{
addEntity(createTextEntity(BubbleBgViewItem::RestrictedStyle, msg("IDS_MSG_BODY_COULDNT_RECEIVE_THIS_MESSAGE_THE_SECURITY_POLICY_PREVENTS_RECEIVING_MESSAGES"), false, ""));
- }
- else if(!MsgUtils::isMms(m_Type))
- {
+ } else if (!MsgUtils::isMms(m_Type)) {
addEntity(createTextEntity(bgType, item.getText(), true, searchWord));
- }
- else if(m_Type == Message::MT_MMS_Noti)
- {
+ } else if (m_Type == Message::MT_MMS_Noti) {
std::string text = MessageDetailContent::getMmsNotiConvListItemContent(m_App, m_MsgId);
addEntity(createTextEntity(bgType, std::move(text), false, searchWord));
addEntity(m_BubbleEntityFactory.createDownloadButtonEntity());
updateDownloadButton();
- }
- else
- {
+ } else {
const MsgConvMediaList &list = item.getMediaList();
- for(int i = 0; i < list.getLength(); ++i)
+ for (int i = 0; i < list.getLength(); ++i)
{
const MsgConvMedia &media = list.at(i);
std::string mime = media.getMime();
std::transform(mime.begin(), mime.end(), mime.begin(), ::tolower);
- if(mime == "text/plain")
+ if (mime == "text/plain")
addEntity(createTextEntity(bgType, media, searchWord));
- else if(mime != "application/smil")
+ else if (mime != "application/smil")
addEntity(m_BubbleEntityFactory.createEntity(media, bgType, m_Direction));
}
}
void ConvListItem::shareContent()
{
- if(MsgUtils::isSms(m_Type))
+ if (MsgUtils::isSms(m_Type))
{
Share::getInst().launch(getAllMsgText());
- }
- else
- {
+ } else {
std::list<std::string> fileList;
- for(BubbleEntity *entity : m_BubbleEntityList)
+ for (BubbleEntity *entity : m_BubbleEntityList)
{
const std::string &filePath = entity->getFilePath();
- if(!filePath.empty())
+ if (!filePath.empty())
fileList.push_back(filePath);
}
Share::getInst().launch(fileList);
{
MsgStorage::StorageResult result = MsgStorage::StorageFail;
MessageRef msg = m_App.getMsgEngine().getStorage().getMessage(m_MsgId);
- if(msg)
+ if (msg)
{
msg->setMessageStorageType(Message::MS_Sim);
m_App.getMsgEngine().getStorage().saveMessage(*msg, false, &result);
- if(result == MsgStorage::StorageSimFull)
+ if (result == MsgStorage::StorageSimFull)
notification_status_message_post(msg("IDS_MSGF_BODY_SIM_MEMORY_FULL_DELETE_SOME_ITEMS").cStr());
}
- if(result == MsgStorage::StorageSuccess)
+ if (result == MsgStorage::StorageSuccess)
notification_status_message_post(msg("IDS_MSGC_POP_COPIED_TO_SIM_CARD").cStr());
}
Evas_Object *ConvListItem::getBubbleContent()
{
auto *bubble = new BubbleItemContainer(*getOwner());
- for(BubbleEntity *entity : m_BubbleEntityList)
+ for (BubbleEntity *entity : m_BubbleEntityList)
{
BubbleViewItem *item = entity->createView(*bubble);
- if(item)
+ if (item)
{
bubble->append(*item, entity->getDirection());
item->setListener(this);
std::string ConvListItem::getTime()
{
- if(m_TimeStr.empty())
+ if (m_TimeStr.empty())
m_TimeStr = TimeUtils::makeBubbleTimeString(m_Time);
return m_TimeStr;
}
std::string msgText = getAllMsgText();
- if(m_NetworkStatus == Message::NS_Send_Fail)
+ if (m_NetworkStatus == Message::NS_Send_Fail)
listPopup.appendItem(msg("IDS_MSG_OPT_RESEND"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onResendItemPressed), this);
listPopup.appendItem(msg("IDS_MSG_OPT_DELETE"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onDeleteItemPressed), this);
- if(m_Type == Message::MT_MMS)
+ if (m_Type == Message::MT_MMS)
listPopup.appendItem(msg("IDS_MSG_OPT_VIEW_AS_SLIDESHOW_ABB"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onSlideShowItemPressed), this);
- if(m_Type == Message::MT_MMS_Noti && m_NetworkStatus != Message::NS_Retrieving)
+ if (m_Type == Message::MT_MMS_Noti && m_NetworkStatus != Message::NS_Retrieving)
listPopup.appendItem(msg("IDS_MSG_BUTTON_DOWNLOAD_ABB3"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onDownloadItemPressed), this);
- if(!msgText.empty())
+ if (!msgText.empty())
listPopup.appendItem(msg("IDS_MSG_OPT_COPY_TEXT"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onCopyTextItemPressed), this);
- if(!m_IsRestrictedByDpm)
+ if (!m_IsRestrictedByDpm)
{
listPopup.appendItem(msg("IDS_MSGF_OPT_FORWARD"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onForwardItemPressed), this);
listPopup.appendItem(msg("IDS_COM_BUTTON_SHARE"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onShareItemPressed), this);
}
- if(m_NetworkStatus == Message::NS_Send_Fail)
+ if (m_NetworkStatus == Message::NS_Send_Fail)
listPopup.appendItem(msg("IDS_MSG_OPT_EDIT"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onEditItemPressed), this);
- if(m_Type == Message::MT_MMS)
+ if (m_Type == Message::MT_MMS)
{
MessageMmsRef mms = std::dynamic_pointer_cast<MessageMms>(m_App.getMsgEngine().getStorage().getMessage(m_MsgId));
- if(mms && (!mms->getAttachmentList().isEmpty() || mms->getMediaCount() > 0))
+ if (mms && (!mms->getAttachmentList().isEmpty() || mms->getMediaCount() > 0))
listPopup.appendItem(msg("IDS_MSG_OPT_SAVE_ATTACHMENTS_ABB"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onSaveAttachmentsItemPressed), this);
}
- if(m_NetworkStatus != Message::NS_Sending && !msgText.empty() && m_Type == Message::MT_SMS)
+ if (m_NetworkStatus != Message::NS_Sending && !msgText.empty() && m_Type == Message::MT_SMS)
listPopup.appendItem(msg("IDS_MSG_OPT_COPY_TO_SIM_CARD_ABB"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onCopyToSimCardItemPressed), this);
listPopup.appendItem(msg("IDS_MSG_OPT_VIEW_DETAILS_ABB"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onViewDetailsItemPressed), this);
void ConvListItem::tryToDownloadMms(bool showToast)
{
- if(!m_App.getSysSettingsManager().isMessagingRestrictedByDpm())
+ if (!m_App.getSysSettingsManager().isMessagingRestrictedByDpm())
{
m_App.getMsgEngine().getTransport().retrieveMessage(m_MsgId);
auto *button = findDownloadButton();
- if(button)
+ if (button)
{
button->disabled(true);
updateContent();
}
- }
- else if(showToast)
+ } else if (showToast) {
notification_status_message_post(msg("IDS_MSG_TPOP_SECURITY_POLICY_RESTRICTS_DOWNLOADING_MULTIMEDIA_MESSAGES").cStr());
+ }
}
void ConvListItem::showDraftListPopup()
{
MSG_LOG("");
- switch(item.getEntity().getType())
+ switch (item.getEntity().getType())
{
case BubbleEntity::DownloadButtonItem:
{
default:
{
const std::string &filePath = item.getEntity().getFilePath();
- if(!filePath.empty())
+ if (!filePath.empty())
FileViewer::getInst().launchWithCopy(filePath);
break;
}
{
item.getParent().destroy();
std::string text = getAllMsgText();
- if(!text.empty())
+ if (!text.empty())
elm_cnp_selection_set(*getOwner(), ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT, text.c_str(), text.length());
}
{
MSG_LOG("");
item.getParent().destroy();
- if(m_pListener)
+ if (m_pListener)
m_pListener->onForwardMsg(*this);
}
{
MSG_LOG("");
item.getParent().destroy();
- if(m_pListener)
+ if (m_pListener)
m_pListener->onSlideShow(*this);
}
{
MSG_LOG("");
item.getParent().destroy();
- if(m_pListener)
+ if (m_pListener)
m_pListener->onEditDraftMsg(*this);
}
{
MSG_LOG("");
item.getParent().destroy();
- if(m_pListener)
+ if (m_pListener)
m_pListener->onSaveAttachments(*this);
}
void ConvListItem::onEditButtonClicked(Evas_Object *obj, void *event_info)
{
MSG_LOG("");
- if(m_pListener)
+ if (m_pListener)
m_pListener->onEditDraftMsg(*this);
}
{
MSG_LOG("");
popup.destroy();
- if(m_pListener)
+ if (m_pListener)
m_pListener->onResendMsg(*this);
}
: DateLineViewItem(TimeUtils::makeBubbleDateLineString(dateTime))
, m_Time(dateTime)
{
-
}
DateLineItem::DateLineItem(time_t dateTime, const std::string &dateTimeStr)
: DateLineViewItem(dateTimeStr)
, m_Time(dateTime)
{
-
}
DateLineItem::~DateLineItem()
{
-
}
void DateLineItem::update()
content += getContactsInfo(m_App, msgDirection, msgThreadId);
content += getSentReceivedTime(*message, msgDirection);
- if(msgDirection == Message::MD_Sent && msgType == Message::MT_SMS)
+ if (msgDirection == Message::MD_Sent && msgType == Message::MT_SMS)
{
content += brTag;
content += makeDeliveryReportResult(m_App, msgStatus, msgType, msgThreadId, m_MsgId);
content += getSmsStatus(msgStatus);
- }
- else if(msgType == Message::MT_MMS_Noti)
- {
+ } else if (msgType == Message::MT_MMS_Noti) {
content += brTag;
content += getMmsSubject(*message, ViewDetailsTextStyle);
content += getMmsMessageSize(*message, ViewDetailsTextStyle);
content += getMmsMessageExpired(*message, ViewDetailsTextStyle);
- }
- else if(msgType == Message::MT_MMS)
- {
+ } else if (msgType == Message::MT_MMS) {
content += brTag;
content += getMmsSubject(*message, ViewDetailsTextStyle);
content += getMmsMessageSize(*message, ViewDetailsTextStyle);
- if(msgDirection == Message::MD_Sent)
+ if (msgDirection == Message::MD_Sent)
{
content += brTag;
content += makeDeliveryReportResult(m_App, msgStatus, msgType, msgThreadId, m_MsgId);
, m_BgType(bgType)
{
const char *group = nullptr;
- switch(bgType)
+ switch (bgType)
{
case SentStyle:
group = "conv/list/bubble_sent_bg";
setEo(addLayout(parent, CONV_LIST_BUBBLE_EDJ_PATH, group));
View::setContent(createGestureRect(getEo()), "swl.gesture");
evas_object_size_hint_align_set(getEo(), 1.0, EVAS_HINT_FILL);
-
}
BubbleBgViewItem::~BubbleBgViewItem()
{
-
}
BubbleBgViewItem::BgType BubbleBgViewItem::getBgType() const
void BubbleBgViewItem::applyColor(Evas_Object *obj, BgType bgType)
{
- if(bgType == SentStyle || bgType == ReceivedStyle)
+ if (bgType == SentStyle || bgType == ReceivedStyle)
evas_object_color_set(obj, WHITE_OBJ_COLOR);
else
evas_object_color_set(obj, DARK_OBJ_COLOR);
BubbleDownloadButtonViewItem::~BubbleDownloadButtonViewItem()
{
-
}
void BubbleDownloadButtonViewItem::disabled(bool status)
, m_pIconTextLayout(nullptr)
{
const char *group = nullptr;
- switch(layoutType)
+ switch (layoutType)
{
case Layout1Icon1Text:
group = "conv/list/1icon_1text";
elm_image_aspect_fixed_set(image, true);
elm_image_file_set(image, path.c_str(), nullptr);
elm_image_object_size_get(image, &imageWidth, &imageHeight);
- if(imageWidth > maxWidth)
+ if (imageWidth > maxWidth)
{
double scale = maxWidth/(double)imageWidth;
imageWidth *= scale;
void BubbleItemContainer::append(BubbleViewItem &item, Message::Direction direction)
{
const char *itemType = evas_object_type_get(item);
- if(strcmp(itemType, "elm_button") == 0)
+ if (strcmp(itemType, "elm_button") == 0)
expand(item);
else if (direction == Message::MD_Sent)
evas_object_size_hint_align_set(item, 1.0, EVAS_HINT_FILL);
Evas_Object *BubbleTextViewItem::createText(Evas_Object *parent, const std::string &text)
{
- if(text.empty())
+ if (text.empty())
return nullptr;
static const int maxTextWidth = maxWidth - (bgPadLeft + bgPadRight);
int imageWidth = 0;
int imageHeight = 0;
elm_image_object_size_get(image, &imageWidth, &imageHeight);
- if(imageWidth > maxWidth)
+ if (imageWidth > maxWidth)
{
double scale = maxWidth/(double)imageWidth;
imageWidth *= scale;
BubbleViewItem::~BubbleViewItem()
{
-
}
void BubbleViewItem::setListener(IBubbleViewItemListener *l)
elm_gesture_layer_attach(layer, obj);
elm_gesture_layer_tap_finger_size_set(layer, ELM_SCALE_SIZE(tapFingerSize));
- elm_gesture_layer_cb_add
- (
+ elm_gesture_layer_cb_add(
layer,
ELM_GESTURE_N_TAPS,
ELM_GESTURE_STATE_END,
[](void *data, void *event_info)->Evas_Event_Flags
{
auto *self = static_cast<BubbleViewItem*>(data);
- if(self)
+ if (self)
self->emitActionEvent();
return EVAS_EVENT_FLAG_NONE;
},
- this
- );
+ this);
}
void BubbleViewItem::showDelButton(bool show)
{
- if(show && !m_pDelButton)
+ if (show && !m_pDelButton)
{
m_pDelButton = elm_button_add(getEo());
elm_object_style_set(m_pDelButton, "transparent");
evas_object_smart_callback_add(m_pDelButton, "clicked", SMART_CALLBACK(BubbleViewItem, onDelButtonClicked), this);
elm_object_focus_allow_set(m_pDelButton, false);
- evas_object_event_callback_add
- (
+ evas_object_event_callback_add(
m_pDelButton,
EVAS_CALLBACK_MOUSE_DOWN,
[](void *data, Evas *e, Evas_Object *obj, void *event_info)
{
- if(!elm_object_disabled_get(obj))
+ if (!elm_object_disabled_get(obj))
emitSignal(elm_object_content_get(obj), "pressed", "*");
},
- this
- );
- evas_object_event_callback_add
- (
+ this);
+ evas_object_event_callback_add(
m_pDelButton,
EVAS_CALLBACK_MOUSE_UP,
[](void *data, Evas *e, Evas_Object *obj, void *event_info)
{
- if(!elm_object_disabled_get(obj))
+ if (!elm_object_disabled_get(obj))
emitSignal(elm_object_content_get(obj), "unpressed", "*");
},
- this
- );
+ this);
const char *delButtonPart = "del_button";
elm_object_content_set(m_pDelButton, icon);
setContent(m_pDelButton, delButtonPart);
- if(!getContent(delButtonPart))
+ if (!getContent(delButtonPart))
{
MSG_LOG_ERROR("Layout has not 'del_button' part");
evas_object_del(m_pDelButton);
void BubbleViewItem::emitActionEvent()
{
- if(m_pListener)
+ if (m_pListener)
m_pListener->onAction(*this);
}
void BubbleViewItem::onDelButtonClicked(Evas_Object *obj, void *eventInfo)
{
- if(m_pListener)
+ if (m_pListener)
m_pListener->onDelClicked(*this);
}
ComposeListViewItem::~ComposeListViewItem()
{
-
}
Evas_Object *ComposeListViewItem::getContent(ListItem &item, const char *part)
{
- if(!strcmp(part, bubbleContentPart))
+ if (!strcmp(part, bubbleContentPart))
return getBubbleContent();
return nullptr;
ConvListLayout::~ConvListLayout()
{
-
}
void ConvListLayout::showSelectAllMode(bool value)
ConvListViewItem::~ConvListViewItem()
{
-
}
std::string ConvListViewItem::getText(ListItem &item, const char *part)
{
- if(!strcmp(part, timeTextPart))
+ if (!strcmp(part, timeTextPart))
return getTime();
- else if(!strcmp(part, msgType))
+ else if (!strcmp(part, msgType))
return getMsgType();
else
return "";
Evas_Object *ConvListViewItem::getContent(ListItem &item, const char *part)
{
- if(!strcmp(part, bubbleContentPart))
+ if (!strcmp(part, bubbleContentPart))
{
return getBubbleContent();
- }
- else if(!strcmp(part, thumbContentPart))
- {
+ } else if (!strcmp(part, thumbContentPart)) {
return getThumbnail();
- }
- else if(!strcmp(part, draftButtonPart))
- {
+ } else if (!strcmp(part, draftButtonPart)) {
return createButton(!getOwner()->getCheckMode(), Draft);
- }
- else if(!strcmp(part, failedButtonPart))
- {
+ } else if (!strcmp(part, failedButtonPart)) {
return createButton(!getOwner()->getCheckMode(), Failed);
- }
- else if(!strcmp(part, infoStatus))
- {
+ } else if (!strcmp(part, infoStatus)){
return getProgress();
}
return nullptr;
Evas_Object *ConvListViewItem::createButton(bool isEnabled, ConvItemType type)
{
Evas_Object *button = elm_button_add(*getOwner());
- evas_object_event_callback_add
- (
+ evas_object_event_callback_add(
button,
EVAS_CALLBACK_MOUSE_DOWN,
[](void *data, Evas *e, Evas_Object *obj, void *event_info)
{
- if(!elm_object_disabled_get(obj))
+ if (!elm_object_disabled_get(obj))
View::emitSignal(elm_object_content_get(obj), "pressed", "*");
},
- this
- );
- evas_object_event_callback_add
- (
+ this);
+
+ evas_object_event_callback_add(
button,
EVAS_CALLBACK_MOUSE_UP,
[](void *data, Evas *e, Evas_Object *obj, void *event_info)
{
- if(!elm_object_disabled_get(obj))
+ if (!elm_object_disabled_get(obj))
View::emitSignal(elm_object_content_get(obj), "unpressed", "*");
},
- this
- );
+ this);
elm_object_style_set(button, "transparent");
Evas_Object *icon = nullptr;
- if(type == Draft)
+ if (type == Draft)
{
icon = View::addLayout(button, ICONS_EDJ_PATH, "draft_icon");
evas_object_smart_callback_add(button, "clicked", SMART_CALLBACK(ConvListViewItem, onEditButtonClicked), this);
- }
- else if(type == Failed)
- {
+ } else if (type == Failed) {
icon = View::addLayout(button, ICONS_EDJ_PATH, "failed_icon");
evas_object_smart_callback_add(button, "clicked", SMART_CALLBACK(ConvListViewItem, onFailedButtonClicked), this);
}
void ConvListViewItem::showSearch()
{
m_SearchMode = true;
- if(getElmObjItem())
+ if (getElmObjItem())
emitSignal("show_search", "*");
}
void ConvListViewItem::onRealized(ListItem &item)
{
- if(m_SearchMode)
+ if (m_SearchMode)
emitSignal("show_search", "*");
}
void ConvListViewItem::onUnrealized(ListItem &item)
{
// Use because genlist does not save state for other items
- if(m_SearchMode)
+ if (m_SearchMode)
emitSignal("hide_search", "*");
}
void ConvListViewItem::updateItemType(ConvItemType type)
{
- if(type == m_Type || type == InitType)
+ if (type == m_Type || type == InitType)
return;
m_Type = type;
void ConvListViewItem::resetCheckMode(ListView &listView)
{
- for(ListItem *item: listView.getRealizedItems())
+ for (ListItem *item: listView.getRealizedItems())
{
item->emitSignal("elm,state,default", "elm");
}
ConvSelectAll::~ConvSelectAll()
{
-
}
void ConvSelectAll::setText(const std::string &text)
std::string DateLineViewItem::getText(ListItem &item, const char *part)
{
- if(!strcmp(part, datePart))
+ if (!strcmp(part, datePart))
return m_DateLine;
else
return "";
{
std::string makeDispAddress(std::string address, std::string dispName)
{
- if(dispName.empty())
+ if (dispName.empty())
return std::move(address);
std::string res = std::move(dispName);
res += " (";
MSG_LOG("");
getApp().getContactManager().removeListener(*this);
getApp().getSysSettingsManager().removeListener(*this);
- if(m_pBody)
+ if (m_pBody)
m_pBody->setListener(nullptr);
- if(m_pRecipPanel)
+ if (m_pRecipPanel)
m_pRecipPanel->setListener(nullptr);
- if(m_pContactsList)
+ if (m_pContactsList)
m_pContactsList->setListener(nullptr);
- if(m_pConvList)
+ if (m_pConvList)
{
m_pConvList->setListener(nullptr);
m_pConvList->setBodyFocusCb(nullptr);
}
m_AttachPanel.setListener(nullptr);
- if(m_NnotifyConvertMsgTypeIdler)
+ if (m_NnotifyConvertMsgTypeIdler)
{
ecore_idler_del(m_NnotifyConvertMsgTypeIdler);
m_NnotifyConvertMsgTypeIdler = nullptr;
{
getApp().getPopupManager().reset();
setDeleteMode(false);
- if(!isRecipExists() && !isBodyEmpty() && m_Mode == NewMessageMode) // Check if we can save draft to avoid losing data
+ if (!isRecipExists() && !isBodyEmpty() && m_Mode == NewMessageMode) // Check if we can save draft to avoid losing data
{
m_DefferedCmd.composeCmd = cmd;
showNoRecipPopup();
return;
- }
- else
- {
+ } else {
saveDraftMsg();
}
setThreadId(ThreadId());
- if(m_pRecipPanel)
+ if (m_pRecipPanel)
m_pRecipPanel->execCmd(cmd);
- if(m_pBody)
+ if (m_pBody)
{
m_pBody->enableAutoFocusForAttachments(isRecipExists());
m_pBody->execCmd(cmd);
}
- if(isRecipExists() && m_pBody)
+ if (isRecipExists() && m_pBody)
m_pBody->setFocus(true);
- else if(m_pRecipPanel)
+ else if (m_pRecipPanel)
m_pRecipPanel->setEntryFocus(true);
}
{
getApp().getPopupManager().reset();
setDeleteMode(false);
- if(!isRecipExists() && !isBodyEmpty() && m_Mode == NewMessageMode) // Check if we can save draft to avoid losing data
+ if (!isRecipExists() && !isBodyEmpty() && m_Mode == NewMessageMode) // Check if we can save draft to avoid losing data
{
m_DefferedCmd.defaultCmd = cmd;
showNoRecipPopup();
return;
- }
- else
- {
+ } else {
saveDraftMsg();
- if(m_pBody)
+ if (m_pBody)
m_pBody->clear();
}
- if(cmd->getDefaultType() == AppControlDefault::SendFailedType)
+ if (cmd->getDefaultType() == AppControlDefault::SendFailedType)
{
pop();
return;
}
- if(cmd->getDefaultType() == AppControlDefault::NotificationType && getMsgEngine().getStorage().getUnreadThreadCount() > 1)
+ if (cmd->getDefaultType() == AppControlDefault::NotificationType && getMsgEngine().getStorage().getUnreadThreadCount() > 1)
{
pop();
return;
MsgId msgId = cmd->getMessageId();
setThreadId(getMsgEngine().getStorage().getMessage(msgId)->getThreadId());
- if(msgId.isValid())
+ if (msgId.isValid())
navigateTo(msgId);
else
navigateToBottom();
- if(cmd->getDefaultType() == AppControlDefault::ReplyType)
+ if (cmd->getDefaultType() == AppControlDefault::ReplyType)
{
m_pBody->execCmd(cmd);
m_pBody->setFocus(true);
void Conversation::markAsRead()
{
// Warning thread and messages marks as read only for ConversationMode.
- if(m_ThreadId.isValid() && m_Mode == ConversationMode)
+ if (m_ThreadId.isValid() && m_Mode == ConversationMode)
getMsgEngine().getStorage().setReadStatus(m_ThreadId);
}
MSG_ASSERT(m_Mode != InitMode, "m_Mode is in initial state");
ContactAddressRef contactAddress = getApp().getContactManager().getContactAddress(address);
- if(contactAddress)
+ if (contactAddress)
{
- if(m_Mode == NewMessageMode)
+ if (m_Mode == NewMessageMode)
{
MbeRecipientItem *pItem = m_pRecipPanel->getSelectedItem();
- if(pItem)
+ if (pItem)
showSavedRecipientPopup(pItem->getDispName(), contactAddress->getOwnerId(), contactAddress->getOwnerType());
- }
- else if(m_Mode == ConversationMode)
- {
- if(m_pRecipPanel)
+ } else if (m_Mode == ConversationMode) {
+ if (m_pRecipPanel)
m_pRecipPanel->unselectMbeItem();
ContactViewer::getInst().launch(*contactAddress);
}
- }
- else
- {
+ } else {
showUnsavedRecipientPopup(address);
}
}
{
PopupList &popup = createPopupList(address);
popup.addEventCb(EVAS_CALLBACK_DEL, EVAS_EVENT_CALLBACK(Conversation, onRecipPopupDel), this);
- if(m_Mode == NewMessageMode)
+ if (m_Mode == NewMessageMode)
{
popup.appendItem(*new PopupAddressListItem(popup, msg("IDS_MSGF_OPT_REMOVE"), address,
POPUPLIST_ITEM_PRESSED_CB(Conversation, onRecipRemoveItemPressed), this));
popup.appendItem(*new PopupAddressListItem(popup, msg("IDS_MSG_OPT_EDIT"), address,
POPUPLIST_ITEM_PRESSED_CB(Conversation, onEditItemPressed), this));
- }
- else if(m_Mode == ConversationMode)
- {
- if(MsgUtils::isValidNumber(address))
+ } else if (m_Mode == ConversationMode) {
+ if (MsgUtils::isValidNumber(address))
{
popup.appendItem(*new PopupAddressListItem(popup, msg("IDS_MSG_OPT_MAKE_VOICE_CALL"), address,
POPUPLIST_ITEM_PRESSED_CB(Conversation, onMakeVoiceItemPressed), this));
void Conversation::updateActiveNotifPolicy()
{
ThreadId threadId = m_pConvList ? m_pConvList->getThreadId() : ThreadId();
- if(isPause() || !threadId.isValid())
+ if (isPause() || !threadId.isValid())
getApp().updateActiveNotifPolicy();
else
getMsgEngine().getSettings().setActiveNotifPolicy(threadId);
{
MSG_LOG("Thread id = ", id);
m_ThreadId = id;
- if(id.isValid())
+ if (id.isValid())
m_AddressList = getMsgEngine().getStorage().getAddressList(id);
else
m_AddressList.reset();
setMode(m_ThreadId.isValid() ? ConversationMode : NewMessageMode);
isHiddenAddress() ? destroyMsgInputPanel() : showMsgInputPanelIfNeeded(true);
- if(m_pBody)
+ if (m_pBody)
m_pBody->setMmsRecipFlag(getMsgEngine().getStorage().hasEmail(m_ThreadId));
- if(m_pRecipPanel && updateRecipPanel)
+ if (m_pRecipPanel && updateRecipPanel)
m_pRecipPanel->update(m_ThreadId);
- if(m_pConvList && updateConvList)
+ if (m_pConvList && updateConvList)
m_pConvList->setThreadId(m_ThreadId, searchWord);
markAsRead();
{
m_IsMms = false;
m_DispIsMms = false;
- if(m_NnotifyConvertMsgTypeIdler)
+ if (m_NnotifyConvertMsgTypeIdler)
{
ecore_idler_del(m_NnotifyConvertMsgTypeIdler);
m_NnotifyConvertMsgTypeIdler = nullptr;
bool Conversation::isHiddenAddress() const
{
- if(m_AddressList && !m_AddressList->isEmpty())
+ if (m_AddressList && !m_AddressList->isEmpty())
{
std::string addr = m_AddressList->at(0).getAddress();
return !MsgUtils::isValidAddress(addr);
void Conversation::forwardMsg(MsgId id)
{
MessageRef msg = getMsgEngine().getStorage().getMessage(id);
- if(msg)
+ if (msg)
{
resetMsgThread();
- if(m_pBody)
+ if (m_pBody)
m_pBody->write(*msg);
m_pRecipPanel->setEntryFocus(true);
}
void Conversation::setMode(Mode mode)
{
- if(m_Mode == mode)
+ if (m_Mode == mode)
return;
- switch(mode)
+ switch (mode)
{
case NewMessageMode:
setNewMessageMode();
m_Mode = ConversationMode;
m_pLayout->showRecipEditMode(false);
MsgAddressListRef addressList = getAddressList();
- if(addressList && addressList->getLength() > 1)
+ if (addressList && addressList->getLength() > 1)
{
showRecipPanel(true);
m_pRecipPanel->showEntry(false);
m_pRecipPanel->update(addressList);
- }
- else
- {
+ } else {
showRecipPanel(false);
}
showContactList(false);
void Conversation::setDeleteMode(bool value)
{
- if(m_DeleteMode == value)
+ if (m_DeleteMode == value)
return;
m_DeleteMode = value;
updateNavibar();
showMsgInputPanelIfNeeded(!value);
- if(value)
+ if (value)
{
if (m_AttachPanel.isFullExpanded())
m_AttachPanel.show(false);
m_pConvList->setMode(ConvList::SelectMode);
- }
- else
- {
+ } else {
m_pConvList->setMode(ConvList::NormalMode);
}
}
void Conversation::showConvList(bool show)
{
- if(show)
+ if (show)
{
- if(!m_pConvList)
+ if (!m_pConvList)
{
m_pConvList = new ConvList(*m_pLayout, getApp(), m_WorkingDir);
m_pConvList->setBodyFocusCb(std::bind(&Conversation::getSipVisibility, this));
m_pConvList->show();
m_pLayout->setConvList(*m_pConvList);
}
- }
- else
- {
- if(m_pConvList)
+ } else {
+ if (m_pConvList)
{
m_pConvList->setListener(nullptr);
m_pConvList->destroy();
void Conversation::showRecipPanel(bool show)
{
- if(show)
+ if (show)
{
- if(!m_pRecipPanel)
+ if (!m_pRecipPanel)
{
m_pRecipPanel = new ConvRecipientsPanel(*m_pLayout, getApp());
m_pRecipPanel->setListener(this);
m_pLayout->setRecipientPanel(*m_pRecipPanel);
m_pLayout->setRecipientRect(m_pRecipPanel->getAreaRect());
}
- }
- else
- {
- if(m_pRecipPanel)
+ } else {
+ if (m_pRecipPanel)
{
m_pRecipPanel->destroy();
m_pRecipPanel = nullptr;
void Conversation::showContactList(bool show)
{
- if(show)
+ if (show)
{
- if(!m_pContactsList)
+ if (!m_pContactsList)
{
m_pContactsList = new ConvContactList(*m_pLayout, getApp());
m_pContactsList->setListener(this);
m_pLayout->setContactList(*m_pContactsList);
}
- }
- else
- {
- if(m_pContactsList)
+ } else {
+ if (m_pContactsList)
{
m_pContactsList->destroy();
m_pContactsList = nullptr;
void Conversation::createMsgInputPanel()
{
- if(!m_pMsgInputPanel)
+ if (!m_pMsgInputPanel)
{
m_pMsgInputPanel = new MessageInputPanel(*m_pConvList);
m_pMsgInputPanel->setListener(this);
m_pLayout->setMsgInputPanel(*m_pMsgInputPanel);
}
- if(!m_pBody && m_pConvList)
+ if (!m_pBody && m_pConvList)
{
m_pBody = new Body(*m_pMsgInputPanel, getApp(), m_WorkingDir, *m_pConvList);
m_pBody->setListener(this);
void Conversation::destroyMsgInputPanel()
{
- if(m_pBody)
+ if (m_pBody)
{
m_pBody->setListener(this);
m_pBody->destroy();
m_pBody = nullptr;
}
- if(m_pMsgInputPanel)
+ if (m_pMsgInputPanel)
{
m_pMsgInputPanel->setListener(this);
m_pMsgInputPanel->destroy();
void Conversation::showMsgInputPanelIfNeeded(bool show)
{
- if(show && !isHiddenAddress())
+ if (show && !isHiddenAddress())
createMsgInputPanel();
- if(m_pBody)
+ if (m_pBody)
m_pBody->show(show);
- if(m_pMsgInputPanel)
+ if (m_pMsgInputPanel)
m_pMsgInputPanel->show(show);
m_pLayout->showMsgInputPanel(show);
}
void Conversation::write(const Message &msg)
{
- if(m_pBody)
+ if (m_pBody)
m_pBody->write(msg);
- if(m_pRecipPanel)
+ if (m_pRecipPanel)
m_pRecipPanel->write(msg);
}
bool Conversation::read(Message &msg)
{
- if(readMsgAddress(msg))
+ if (readMsgAddress(msg))
{
- if(m_pBody)
+ if (m_pBody)
m_pBody->read(msg);
return true;
}
bool Conversation::readMsgAddress(Message &msg)
{
bool res = false;
- if(m_ThreadId.isValid())
+ if (m_ThreadId.isValid())
{
MsgAddressListRef addressList = getAddressList();
- if(addressList)
+ if (addressList)
{
res = !addressList->isEmpty();
msg.addAddresses(*addressList);
}
- }
- else
- {
- if(m_pRecipPanel)
+ } else {
+ if (m_pRecipPanel)
{
m_pRecipPanel->read(msg);
res = !m_pRecipPanel->isMbeEmpty();
void Conversation::handleSendResult(const Message &msg, MsgTransport::SendResult result)
{
- if(result == MsgTransport::SendSuccess)
+ if (result == MsgTransport::SendSuccess)
return;
const char *strId = nullptr;
- switch(result)
+ switch (result)
{
case MsgTransport::SendNoSIM:
strId = "IDS_MSG_BODY_UNABLE_TO_SEND_THIS_MESSAGE_INSERT_YOUR_SIM_CARD_AND_TRY_AGAIN";
bool Conversation::checkBeforeSend(const Message &msg)
{
- if(!getApp().getSysSettingsManager().isSimInserted())
+ if (!getApp().getSysSettingsManager().isSimInserted())
{
handleSendResult(msg, MsgTransport::SendNoSIM); // Show no SIM card
return false;
}
- if(msg.isMms() && !getApp().getSysSettingsManager().isMobileDataEnabled())
+ if (msg.isMms() && !getApp().getSysSettingsManager().isMobileDataEnabled())
{
showMobileDataPopup();
return false;
std::vector<MsgId> Conversation::getMsgIdListForReadReport() const
{
std::vector<MsgId> msgIds;
- if(m_pConvList)
+ if (m_pConvList)
{
auto items = m_pConvList->getConvItems();
- for(ConvListItem *item : items)
+ for (ConvListItem *item : items)
{
- if(item->isNeededReadReport())
+ if (item->isNeededReadReport())
msgIds.push_back(item->getMsgId());
}
}
bool Conversation::sendReadReportIfNeeded()
{
- if(getMsgEngine().getSettings().getMmsReadReport() &&
+ if (getMsgEngine().getSettings().getMmsReadReport() &&
!getApp().getSysSettingsManager().isMessagingRestrictedByDpm())
{
auto msgIds = getMsgIdListForReadReport();
- if(!msgIds.empty())
+ if (!msgIds.empty())
{
showSendReadReportPopup();
return true;
void Conversation::sendReadReport(MsgReport::ReadStatus status)
{
auto ids = getMsgIdListForReadReport();
- for(MsgId id : ids)
+ for (MsgId id : ids)
{
getMsgEngine().getTransport().sendReadReport(id, status);
}
void Conversation::sendMessage(MsgId msgId)
{
MessageRef msg = getMsgEngine().getStorage().getMessage(msgId);
- if(msg && checkBeforeSend(*msg))
+ if (msg && checkBeforeSend(*msg))
{
auto sentRes = getMsgEngine().getTransport().sendMessage(msg);
handleSendResult(*msg, sentRes);
void Conversation::sendMessage()
{
- if(!m_pMsgInputPanel || !m_pBody)
+ if (!m_pMsgInputPanel || !m_pBody)
return;
- if(m_pRecipPanel &&
+ if (m_pRecipPanel &&
m_pRecipPanel->getEntryFocus() &&
!m_pRecipPanel->getEntryText().empty() &&
!m_pRecipPanel->addRecipientsFromEntry())
return;
auto msg = getMsgEngine().getComposer().createMessage(m_IsMms ? Message::MT_MMS : Message::MT_SMS);
- if(!msg || !read(*msg) || !checkBeforeSend(*msg))
+ if (!msg || !read(*msg) || !checkBeforeSend(*msg))
return;
MSG_LOG("Old threadId = ", m_ThreadId);
MSG_LOG("Send result = ", sendRes);
MSG_LOG("New threadId = ", m_ThreadId);
- if(sendRes == MsgTransport::SendSuccess && m_ThreadId.isValid())
+ if (sendRes == MsgTransport::SendSuccess && m_ThreadId.isValid())
{
m_DispIsMms = false; // Skip "Convert to SMS" after sent message with MMS body.
setThreadId(m_ThreadId);
m_pMsgInputPanel->disabledButton(MessageInputPanel::SendButtonId, true);
m_pBody->clear();
- }
- else
- {
+ } else {
handleSendResult(*msg, sendRes);
}
- if(m_pListener)
+ if (m_pListener)
m_pListener->onConversationSentMessage();
}
MsgId Conversation::saveDraftMsg()
{
MsgId msgId;
- if(!isBodyEmpty())
+ if (!isBodyEmpty())
{
MessageRef msg = getMsgEngine().getComposer().createMessage(m_IsMms ? Message::MT_MMS : Message::MT_SMS);
- if(msg)
+ if (msg)
{
read(*msg);
msg->setMessageStorageType(Message::MS_Phone);
void Conversation::editDraftMsg(MsgId id)
{
- if(!m_pBody)
+ if (!m_pBody)
return;
MessageRef msg = getMsgEngine().getStorage().getMessage(id);
- if(msg)
+ if (msg)
{
MsgId draftMsgId = saveDraftMsg();
m_pBody->clear();
- if(m_pConvList->getMessageCount() <= 1 && !draftMsgId.isValid())
+ if (m_pConvList->getMessageCount() <= 1 && !draftMsgId.isValid())
setThreadId(ThreadId());
write(*msg);
- if(getMsgEngine().getStorage().deleteMessage(id))
+ if (getMsgEngine().getStorage().deleteMessage(id))
{
// Fast remove item in order to avoid blink:
m_pConvList->deleteItems({id});
{
MsgAddressListRef addressList = getAddressList();
resetMsgThread(false, true);
- if(m_pRecipPanel)
+ if (m_pRecipPanel)
m_pRecipPanel->update(addressList);
}
void Conversation::notifyConvertMsgType()
{
- if(!m_NnotifyConvertMsgTypeIdler)
+ if (!m_NnotifyConvertMsgTypeIdler)
{
- m_NnotifyConvertMsgTypeIdler = ecore_idler_add
- (
+ m_NnotifyConvertMsgTypeIdler = ecore_idler_add(
[](void *data)->Eina_Bool
{
auto *self =(Conversation*)data;
self->m_NnotifyConvertMsgTypeIdler = nullptr;
- if(self->m_DispIsMms != self->m_IsMms)
+ if (self->m_DispIsMms != self->m_IsMms)
{
self->m_DispIsMms = self->m_IsMms;
std::string notifText = self->m_IsMms ?
}
return false; // Delete idler
},
- this
- );
+ this);
}
}
bool isMms = m_pBody ? m_pBody->isMms() : false;
// Recipients:
- if(!isMms && m_pRecipPanel && !m_pRecipPanel->isMbeEmpty())
+ if (!isMms && m_pRecipPanel && !m_pRecipPanel->isMbeEmpty())
isMms = m_pRecipPanel->isMms();
- if(force || isMms != m_IsMms)
+ if (force || isMms != m_IsMms)
{
m_IsMms = isMms;
convertMsgTypeHandler();
void Conversation::setBodyFocus()
{
- if(getOwner().getTransitionStatus())
+ if (getOwner().getTransitionStatus())
{
m_TransFinishedFunc = [this]()
{
- if(m_pBody)
+ if (m_pBody)
m_pBody->setFocus(true);
};
- }
- else
- {
- if(m_pBody)
+ } else {
+ if (m_pBody)
m_pBody->setFocus(true);
}
}
bool Conversation::getSipVisibility() const
{
bool res = m_pBody ? m_pBody->getFocus() : false;
- if(!res)
+ if (!res)
res = m_AttachPanel.isVisible();
return res;
}
void Conversation::setRecipEntryFocus()
{
- if(getOwner().getTransitionStatus())
+ if (getOwner().getTransitionStatus())
{
m_TransFinishedFunc = [this]()
{
- if(m_pRecipPanel)
+ if (m_pRecipPanel)
m_pRecipPanel->setEntryFocus(true);
};
- }
- else
- {
- if(m_pRecipPanel)
+ } else {
+ if (m_pRecipPanel)
m_pRecipPanel->setEntryFocus(true);
}
}
int len = addressList.getLength();
std::string addresses;
- for(int i = 0; i < len; ++i)
+ for (int i = 0; i < len; ++i)
{
std::string address = addressList[i].getAddress();
std::string dispName;
- if(!address.empty())
+ if (!address.empty())
{
ContactAddressRef rec = getApp().getContactManager().getContactAddress(address);
- if(rec)
+ if (rec)
dispName = rec->getDispName();
addresses += makeDispAddress(address, dispName);
- if(i < len - 1)
+ if (i < len - 1)
addresses += "<br/>";
}
}
- if(len <= 1)
+ if (len <= 1)
{
std::string text = msgArgs("IDS_MSG_POP_THE_SECURITY_POLICY_PREVENTS_SENDING_MESSAGES_TO_PS", addresses.c_str());
notification_status_message_post(text.c_str());
- }
- else
- {
+ } else {
std::string text = msgArgs("IDS_MSG_POP_THE_SECURITY_POLICY_PREVENTS_SENDING_MESSAGES_TO_THE_FOLLOWING_RECIPIENTS_C_NPS", addresses.c_str());
auto &popupMngr = getApp().getPopupManager();
Popup &popup = popupMngr.getPopup();
{
PopupList &popup = getApp().getPopupManager().getMorePopup();
popup.appendItem(msg("IDS_MSG_OPT_DELETE"), POPUPLIST_ITEM_PRESSED_CB(Conversation, onDeleteItemPressed), this);
- if(m_AddressList && m_AddressList->getLength() == 1)
+ if (m_AddressList && m_AddressList->getLength() == 1)
{
const std::string adress = m_AddressList->at(0).getAddress();
ContactAddressRef contactAddress = getApp().getContactManager().getContactAddress(adress);
- if(contactAddress)
+ if (contactAddress)
{
popup.appendItem(*new PopupPersonIdListItem(popup, msg("IDS_MSG_OPT_VIEW_CONTACT_DETAILS_ABB"), contactAddress->getOwnerId(),
contactAddress->getOwnerType(), POPUPLIST_ITEM_PRESSED_CB(Conversation, onViewContactDetailsItemPressed), this));
- }
- else
- {
+ } else {
popup.appendItem(*new PopupAddressListItem(popup, msg("IDS_MSG_OPT_MAKE_VOICE_CALL"), adress,
POPUPLIST_ITEM_PRESSED_CB(Conversation, onMakeVoiceItemPressed), this));
popup.appendItem(*new PopupAddressListItem(popup, msg("IDS_MSG_OPT_CREATE_CONTACT_ABB"), adress,
POPUPLIST_ITEM_PRESSED_CB(Conversation, onUpdateContactItemPressed), this));
}
}
- if(!isHiddenAddress())
+ if (!isHiddenAddress())
popup.appendItem(msg("IDS_MSG_TMBODY_ADD_OR_REMOVE_RECIPIENTS"), POPUPLIST_ITEM_PRESSED_CB(Conversation, onAddRecipientsItemPressed), this);
popup.show();
}
void Conversation::onKeyDown(ConvRecipientsPanel &panel, Evas_Event_Key_Down &ev)
{
- if(ev.keyname)
+ if (ev.keyname)
{
- if((strcmp(ev.keyname, "Return") == 0))
+ if ((strcmp(ev.keyname, "Return") == 0))
{
m_pBody->setFocus(true);
- }
- else
- {
- if(m_pContactsList)
+ } else {
+ if (m_pContactsList)
{
m_pContactsList->setSearchWorld(m_pRecipPanel->getEntryText());
m_pContactsList->requestSearch();
void Conversation::onEntryFocusChanged(ConvRecipientsPanel &panel)
{
MSG_LOG("");
- if(!m_pRecipPanel->getEntryFocus() && m_pContactsList)
+ if (!m_pRecipPanel->getEntryFocus() && m_pContactsList)
m_pContactsList->clear();
}
void Conversation::onEntryChanged(ConvRecipientsPanel &panel)
{
MSG_LOG("");
- if(m_pRecipPanel->isEntryEmpty() && m_pContactsList)
+ if (m_pRecipPanel->isEntryEmpty() && m_pContactsList)
m_pContactsList->clear();
}
void Conversation::onMbeChanged(ConvRecipientsPanel &panel)
{
MSG_LOG("");
- if(m_pBody)
+ if (m_pBody)
m_pBody->setMmsRecipFlag(m_pRecipPanel->isMms());
checkAndSetMsgType();
- if(m_pConvList)
+ if (m_pConvList)
{
std::list<std::string> recips;
auto items = panel.getMbeRecipients().getItems();
- for(MbeRecipientItem *item : items)
+ for (MbeRecipientItem *item : items)
{
recips.push_back(item->getAddress());
}
ThreadId id;
- if(!recips.empty())
+ if (!recips.empty())
id = getMsgEngine().getStorage().getThreadId(recips);
m_pConvList->setThreadId(id);
void Conversation::updateMsgInputPanel()
{
- if(!m_pBody || !m_pMsgInputPanel)
+ if (!m_pBody || !m_pMsgInputPanel)
return;
- if(m_pBody->isMms())
+ if (m_pBody->isMms())
{
// Mms:
m_pMsgInputPanel->setCounter(MsgUtils::makeKbStr(m_pBody->getMsgSize()));
- }
- else
- {
+ } else {
// Sms:
std::ostringstream ss;
const MsgTextMetric &size = m_pBody->getTextMetric();
naviBar.clear();
naviBar.setColor(NaviBar::NaviWhiteColorId);
- if(m_Mode == NewMessageMode)
+ if (m_Mode == NewMessageMode)
{
naviBar.setTitle(msgt("IDS_MSG_HEADER_COMPOSE_MESSAGE_ABB"));
naviBar.showButton(NaviPrevButtonId, true);
- }
- else if(m_Mode == ConversationMode)
- {
- if(m_DeleteMode)
+ } else if (m_Mode == ConversationMode) {
+ if (m_DeleteMode)
{
updateSelectMsgTitle();
naviBar.showButton(NaviCancelButtonId, true);
naviBar.setButtonText(NaviOkButtonId, msgt("IDS_MSG_ACBUTTON_DELETE_ABB"));
naviBar.disabledButton(NaviOkButtonId, true);
naviBar.setDownButtonState(false);
- if(m_pRecipPanel)
+ if (m_pRecipPanel)
m_pRecipPanel->showMbe(false, false);
- }
- else
- {
+ } else {
naviBar.showButton(NaviPrevButtonId, true);
MsgAddressListRef addressList = getAddressList();
- if(addressList)
+ if (addressList)
{
naviBar.showButton(NaviCenterButtonId, true);
FrameController::setNaviBarTitle(*addressList);
void Conversation::updateSelectMsgTitle()
{
- if(m_pConvList && m_DeleteMode)
+ if (m_pConvList && m_DeleteMode)
{
int checked = m_pConvList->getMessageCheckedCount();
- if(checked > 0)
+ if (checked > 0)
getNaviBar().setTitle(msgArgs("IDS_MSG_HEADER_PD_SELECTED_ABB3", checked));
else
getNaviBar().setTitle(msgt("IDS_MSGF_HEADER_SELECT_MESSAGES"));
{
MSG_LOG("MessageInputPanel: button clicked: id = ", id);
- switch(id)
+ switch (id)
{
case MessageInputPanel::AddButtonId:
m_AttachPanel.show(true);
void Conversation::onContactListChanged()
{
- if(m_pContactsList)
+ if (m_pContactsList)
m_pLayout->showContactList(!m_pContactsList->isEmpty());
}
void Conversation::onTransitionFinished(NaviFrameItem &item)
{
MSG_LOG("");
- if(m_TransFinishedFunc)
+ if (m_TransFinishedFunc)
{
m_TransFinishedFunc();
m_TransFinishedFunc = nullptr;
void Conversation::onHwBackButtonClicked()
{
MSG_LOG("");
- if(m_DeleteMode)
+ if (m_DeleteMode)
{
setDeleteMode(false);
return;
}
- if(m_pRecipPanel)
+ if (m_pRecipPanel)
{
- if(m_pRecipPanel->isMbeVisible() || m_pRecipPanel->getItemsCount() == 0)
+ if (m_pRecipPanel->isMbeVisible() || m_pRecipPanel->getItemsCount() == 0)
m_pRecipPanel->addRecipientsFromEntry(false);
m_pRecipPanel->clearEntry();
}
- if(!isRecipExists() && !isBodyEmpty() && m_Mode == NewMessageMode)
+ if (!isRecipExists() && !isBodyEmpty() && m_Mode == NewMessageMode)
{
showNoRecipPopup();
return;
}
- if(sendReadReportIfNeeded())
+ if (sendReadReportIfNeeded())
return;
m_AttachPanel.reset();
void Conversation::onHwMoreButtonClicked()
{
MSG_LOG("");
- if(m_Mode == ConversationMode && !m_DeleteMode)
+ if (m_Mode == ConversationMode && !m_DeleteMode)
showMainPopup();
}
void Conversation::onNaviOkButtonClicked()
{
MSG_LOG("");
- if(m_Mode == ConversationMode && m_DeleteMode)
+ if (m_Mode == ConversationMode && m_DeleteMode)
{
m_pConvList->deleteSelectedItems();
setDeleteMode(false);
void Conversation::onNaviCenterButtonClicked()
{
MSG_LOG("");
- if(m_pRecipPanel)
+ if (m_pRecipPanel)
{
onNaviExpandButtonClicked();
- }
- else
- {
+ } else {
MsgAddressListRef addressList = getAddressList();
- if(addressList && !addressList->isEmpty() && !isHiddenAddress())
+ if (addressList && !addressList->isEmpty() && !isHiddenAddress())
recipientClickHandler(addressList->at(0).getAddress());
}
}
void Conversation::onNaviExpandButtonClicked()
{
MSG_LOG("");
- if(m_pRecipPanel)
+ if (m_pRecipPanel)
{
bool isMbeInvisible = !m_pRecipPanel->isMbeVisible();
m_pRecipPanel->showMbe(isMbeInvisible);
void Conversation::onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId)
{
- switch(buttonId)
+ switch (buttonId)
{
case NaviPrevButtonId:
onHwBackButtonClicked();
void Conversation::onSendReadReportPopupButtonClicked(Popup &popup, int buttonId)
{
MSG_LOG("");
- if(buttonId == Popup::OkButtonId)
+ if (buttonId == Popup::OkButtonId)
sendReadReport(MsgReport::ReadStatusIsRead);
popup.destroy();
}
void Conversation::onRecipPopupDel(Evas_Object *popup, void *eventInfo)
{
MSG_LOG("");
- if(m_pRecipPanel)
+ if (m_pRecipPanel)
m_pRecipPanel->unselectMbeItem();
}
void Conversation::onNoRecipDiscardButtonClicked(Popup &popup, int buttonId)
{
- if(isDefferedCmd())
+ if (isDefferedCmd())
{
- if(m_pBody)
+ if (m_pBody)
m_pBody->clear();
- if(m_DefferedCmd.defaultCmd)
+ if (m_DefferedCmd.defaultCmd)
{ // If we came from notification menu and unread threads will be more than one, we should to go back on thread list view
- if(m_DefferedCmd.defaultCmd->getDefaultType() == AppControlDefault::NotificationType && getMsgEngine().getStorage().getUnreadThreadCount() > 1)
+ if (m_DefferedCmd.defaultCmd->getDefaultType() == AppControlDefault::NotificationType && getMsgEngine().getStorage().getUnreadThreadCount() > 1)
{
pop();
- }
- else
- { // Go to needed conversation
+ } else {
+ // Go to needed conversation
MessageRef msg = getMsgEngine().getStorage().getMessage(m_DefferedCmd.defaultCmd->getMessageId());
- if(msg)
+ if (msg)
setThreadId(msg->getThreadId());
- if(m_DefferedCmd.defaultCmd->getDefaultType() == AppControlDefault::ReplyType && m_pBody)
+ if (m_DefferedCmd.defaultCmd->getDefaultType() == AppControlDefault::ReplyType && m_pBody)
{
m_pBody->execCmd(m_DefferedCmd.defaultCmd);
m_pBody->setFocus(true);
}
}
- }
- else if(m_DefferedCmd.composeCmd)
- { // Go to needed conversation
+ } else if (m_DefferedCmd.composeCmd) {
+ // Go to needed conversation
setThreadId(ThreadId());
- if(m_pRecipPanel)
+ if (m_pRecipPanel)
m_pRecipPanel->execCmd(m_DefferedCmd.composeCmd);
- if(m_pBody)
+ if (m_pBody)
m_pBody->execCmd(m_DefferedCmd.composeCmd);
}
resetDefferedCmd();
- }
- else
- {
+ } else {
pop();
}
- if(!isPopping())
+ if (!isPopping())
popup.destroy();
}
if (m_AttachPanel.isFullExpanded())
m_AttachPanel.show(false);
createNewMsgThread();
- if(m_pRecipPanel)
+ if (m_pRecipPanel)
m_pRecipPanel->setEntryFocus(true);
}
void Conversation::onAllConvItemsDeleted(ConvList &list)
{
MSG_LOG("");
- if(m_Mode != NewMessageMode)
+ if (m_Mode != NewMessageMode)
{
auto convList = getMsgEngine().getStorage().getConversationList(m_ThreadId);
- if((convList && convList->getLength() == 0) || !convList)
+ if ((convList && convList->getLength() == 0) || !convList)
{
- if(isBodyEmpty())
+ if (isBodyEmpty())
{
onHwBackButtonClicked();
- }
- else
- {
+ } else {
// Current MsgThread is dead, so create new MsgThread from existing recipients.
createNewMsgThread();
- if(m_pBody)
+ if (m_pBody)
m_pBody->setFocus(true);
}
}
MessageInputPanel::~MessageInputPanel()
{
-
}
void MessageInputPanel::create(Evas_Object *parent)
Evas_Object *MessageInputPanel::getButton(ButtonId id)
{
- switch(id)
+ switch (id)
{
case AddButtonId:
return m_pAddButton;
Evas_Object *MessageInputPanel::createButton(Evas_Object *parent, ButtonId buttonId, const char *res)
{
Evas_Object *button = elm_button_add(parent);
- if(buttonId == SendButtonId)
+ if (buttonId == SendButtonId)
elm_object_focus_allow_set(button, false);
elm_object_style_set(button, "transparent");
evas_object_data_set(button, buttonIdKey, (void*)buttonId);
evas_object_show(button);
Evas_Object *icon = elm_icon_add(button);
- if(buttonId == SendButtonId)
+ if (buttonId == SendButtonId)
elm_object_focus_allow_set(icon, false);
std::string resPath = PathUtils::getResourcePath(IMAGES_EDJ_PATH);
elm_image_file_set(icon, resPath.c_str(), res);
Evas_Object *btn = getButton(id);
elm_object_disabled_set(btn, val);
- if(val)
+ if (val)
setDisabledColor(btn);
else
setNormalColor(btn);
void MessageInputPanel::onButtonClicked(Evas_Object *obj, void *event_info)
{
- if(m_pListener)
+ if (m_pListener)
{
int id = (int)(intptr_t)evas_object_data_get(obj, buttonIdKey);
m_pListener->onButtonClicked(*this, (ButtonId)id);
void ConvRecipientsPanel::read(Message &msg)
{
auto list = m_pMbe->getItems();
- for(auto it : list)
+ for (auto it : list)
{
MbeRecipientItem *recipItem = static_cast<MbeRecipientItem*>(it);
MsgAddress &msgAddr = msg.addAddress();
msgAddr.setAddressType(recipItem->getAddressType());
}
- if(list.empty())
+ if (list.empty())
{
showInvalidIcon(true);
showAddRecipNotif();
bool ConvRecipientsPanel::isMms() const
{
auto items = m_pMbe->getItems();
- for(MbeRecipientItem *it : items)
+ for (MbeRecipientItem *it : items)
{
MbeRecipientItem *item = static_cast<MbeRecipientItem*>(it);
- if(item->getAddressType() == MsgAddress::Email)
+ if (item->getAddressType() == MsgAddress::Email)
return true;
}
return false;
TokenizedRecipients result = MsgUtils::tokenizeRecipients(text);
bool duplicateFound = false;
- for(auto &it : result.validResults)
+ for (auto &it : result.validResults)
{
- if(it.second == MsgAddress::Phone)
+ if (it.second == MsgAddress::Phone)
it.first = MsgUtils::makeNormalizedNumber(it.first);
duplicateFound |= appendItem(it.first, it.second) == MbeRecipients::DuplicatedStatus;
}
- if(duplicateFound)
+ if (duplicateFound)
{
showDuplicatedRecipientNotif();
return false;
}
setEntryText(result.invalidResult);
- if(!result.invalidResult.empty() && showPopup)
+ if (!result.invalidResult.empty() && showPopup)
{
showInvalidRecipientPopup();
return false;
{
clearMbe();
int addrListLen = addressList.getLength();
- for(int i = 0; i < addrListLen; ++i)
+ for (int i = 0; i < addrListLen; ++i)
{
auto &addr = addressList.at(i);
appendItem(addr.getAddress(), addr.getAddressType());
void ConvRecipientsPanel::execCmd(const AppControlComposeRef &cmd)
{
m_pMbe->clear();
- for(auto recipStr: cmd->getRecipientList())
+ for (auto recipStr: cmd->getRecipientList())
{
appendStatusHandler(appendItem(recipStr));
}
void ConvRecipientsPanel::appendStatusHandler(MbeRecipients::AppendItemStatus status)
{
- switch(status)
+ switch (status)
{
case MbeRecipients::SuccessStatus:
showInvalidIcon(false);
- if(getEntryFocus())
+ if (getEntryFocus())
showMbe(true);
break;
case MbeRecipients::DuplicatedStatus:
void ConvRecipientsPanel::onKeyDown(Evas_Event_Key_Down *ev)
{
- if(ev && ev->keyname)
+ if (ev && ev->keyname)
{
MSG_LOG("Key: ", ev->keyname);
- if((strcmp(ev->keyname, "semicolon") == 0) || (strcmp(ev->keyname, "comma") == 0))
+ if ((strcmp(ev->keyname, "semicolon") == 0) || (strcmp(ev->keyname, "comma") == 0))
{
addRecipientsFromEntry();
- }
- else
- {
- if(m_pListener)
+ } else {
+ if (m_pListener)
m_pListener->onKeyDown(*this, *ev);
}
}
MSG_LOG("");
unselectMbeItem();
- if(!getEntryFocus())
+ if (!getEntryFocus())
showButton(ContactButton);
- if(getEntryFocus())
+ if (getEntryFocus())
{
expandRecipients();
- }
- else
- {
+ } else {
addRecipientsFromEntry();
collapseRecipients();
}
- if(!isMbeEmpty())
+ if (!isMbeEmpty())
showInvalidIcon(false);
- if(m_pListener)
+ if (m_pListener)
m_pListener->onEntryFocusChanged(*this);
}
void ConvRecipientsPanel::onEntryChanged()
{
unselectMbeItem();
- if(!isEntryEmpty() && getEntryFocus())
+ if (!isEntryEmpty() && getEntryFocus())
{
showButton(PlusButton);
showInvalidIcon(false);
- }
- else
+ } else {
showButton(ContactButton);
+ }
- if(m_pListener)
+ if (m_pListener)
m_pListener->onEntryChanged(*this);
}
{
MSG_LOG("");
int currentRecipientsCount = getItemsCount();
- if(currentRecipientsCount < getMaxRecipientCount())
+ if (currentRecipientsCount < getMaxRecipientCount())
m_Picker.launch(getMaxRecipientCount() - currentRecipientsCount);
else
showTooManyRecipientsNotif();
int addressOfInvalids = 0;
int duplicateRecip = 0;
int sizeOfList = addressIdList.size();
- for(auto &addressData : addressIdList)
+ for (auto &addressData : addressIdList)
{
ContactAddressRef address;
- if(addressData.type == IContactPickerListener::PhoneType)
+ if (addressData.type == IContactPickerListener::PhoneType)
address = m_App.getContactManager().getContactPersonNumber(addressData.id);
- else if(addressData.type == IContactPickerListener::EmailType)
+ else if (addressData.type == IContactPickerListener::EmailType)
address = m_App.getContactManager().getContactPersonEmail(addressData.id);
- if(address)
+ if (address)
{
auto apendStatus = appendItem(address->getAddress(), address->getDispName(), MsgAddress::UnknownAddressType);
- if(apendStatus == MbeRecipients::InvalidRecipStatus)
+ if (apendStatus == MbeRecipients::InvalidRecipStatus)
++addressOfInvalids;
- if(apendStatus == MbeRecipients::DuplicatedStatus)
+ if (apendStatus == MbeRecipients::DuplicatedStatus)
++duplicateRecip;
}
}
- if(addressOfInvalids != 0)
+ if (addressOfInvalids != 0)
appendStatusHandler((addressOfInvalids == sizeOfList) ? MbeRecipients::InvalidAllRecipStatus : MbeRecipients::InvalidSomeRecipStatus);
- else if(duplicateRecip != 0)
+ else if (duplicateRecip != 0)
appendStatusHandler(MbeRecipients::DuplicatedStatus);
setEntryFocus(true);
void ConvRecipientsPanel::onMbeChanged()
{
- if(!isMbeVisible())
+ if (!isMbeVisible())
updateShortenedRecipients();
- if(m_pListener)
+ if (m_pListener)
m_pListener->onMbeChanged(*this);
}
void ConvRecipientsPanel::onMbeItemClicked(MbeRecipientItem &item)
{
- if(m_pListener)
+ if (m_pListener)
m_pListener->onItemClicked(*this, item);
}
void ConvRecipientsPanel::onContactChanged()
{
MSG_LOG("");
- if(!getEntryFocus())
+ if (!getEntryFocus())
updateShortenedRecipients();
}
void ConvRecipientsPanelView::showButton(ButtonType buttonType)
{
Evas_Object *button = elm_object_part_content_unset(m_pLayout, buttonPart);
- if(button)
+ if (button)
evas_object_hide(button);
- switch(buttonType)
+ switch (buttonType)
{
case NoneButton:
break;
{
m_IsMbeVisible = show;
const char *sig = nullptr;
- if(animation)
+ if (animation)
sig = show ? "show_to_mbe_anim" : "hide_to_mbe_anim";
else
sig = show ? "show_to_mbe" : "hide_to_mbe";
void ConvRecipientsPanelView::showEntry(bool show)
{
- if(show)
+ if (show)
getEntry();
const char *sig = show ? "show_entry" : "hide_entry";
emitSignal(m_pLayout, sig, "*");
void ConvRecipientsPanelView::setEntryText(const std::string &utf8)
{
char *text = elm_entry_utf8_to_markup(utf8.c_str());
- if(text)
+ if (text)
{
elm_entry_entry_set(m_pEntry, text);
elm_entry_cursor_end_set(m_pEntry);
Evas_Object *ConvRecipientsPanelView::getEntry()
{
- if(m_pEntryLayout)
+ if (m_pEntryLayout)
return m_pEntryLayout;
m_pEntryLayout = elm_layout_add(m_pLayout);
Evas_Object *ConvRecipientsPanelView::getContactBtn()
{
- if(m_pContactBtn)
+ if (m_pContactBtn)
{
evas_object_show(m_pContactBtn);
return m_pContactBtn;
Evas_Object *ConvRecipientsPanelView::getPlusBtn()
{
- if(m_pPlusBtn)
+ if (m_pPlusBtn)
{
evas_object_show(m_pPlusBtn);
return m_pPlusBtn;
void ConvRecipientsPanelView::deleteNextRecipient()
{
- if(!isMbeEmpty())
+ if (!isMbeEmpty())
{
Elm_Object_Item *selectedItem = elm_multibuttonentry_selected_item_get(*m_pMbe);
- if(selectedItem)
+ if (selectedItem)
elm_object_item_del(selectedItem);
selectLastItem();
{
Elm_Object_Item *lastItem = elm_multibuttonentry_last_item_get(*m_pMbe);
- if(lastItem)
+ if (lastItem)
{
elm_object_focus_allow_set(*m_pMbe, true);
elm_multibuttonentry_item_selected_set(lastItem, true);
- }
- else
- {
+ } else {
showMbe(false);
}
}
void ConvRecipientsPanelView::unselectMbeItem()
{
Elm_Object_Item *selectedItem = elm_multibuttonentry_selected_item_get(*m_pMbe);
- if(selectedItem)
+ if (selectedItem)
elm_multibuttonentry_item_selected_set(selectedItem, EINA_FALSE);
}
{
unsigned int res = 0;
const Eina_List* items = elm_multibuttonentry_items_get(*m_pMbe);
- if(items)
+ if (items)
res = eina_list_count(items);
return res;
}
void ConvRecipientsPanelView::expandRecipients()
{
showMbe(!isMbeEmpty());
- if(!m_IsEditItemClicked)
+ if (!m_IsEditItemClicked)
{
setEntryText(m_SavedRecipText);
- }
- else
- {
+ } else {
setEditMode(false);
setEntryText("");
}
{
const auto &items = m_pMbe->getItems();
std::string shortenedRecipients;
- if(!items.empty())
+ if (!items.empty())
{
shortenedRecipients = items[0]->getDispName();
- if(items.size() > 1)
+ if (items.size() > 1)
shortenedRecipients += " + " + std::to_string(items.size() - 1);
setEntryText(shortenedRecipients);
}
void ConvRecipientsPanelView::editSelectedItem()
{
MbeRecipientItem* pItem = getSelectedItem();
- if(pItem)
+ if (pItem)
{
setEditMode(true);
setEntryText(pItem->getAddress());
showEntry(true);
pItem->destroy();
- if(isMbeEmpty())
+ if (isMbeEmpty())
showMbe(false, false);
setEntryFocus(true);
}
void ConvRecipientsPanelView::removeSelectedItem()
{
MbeRecipientItem* pItem = getSelectedItem();
- if(pItem)
+ if (pItem)
{
pItem->destroy();
- if(isMbeEmpty())
+ if (isMbeEmpty())
showMbe(false, false);
}
}
void ConvRecipientsPanelView::onEntryMaxlengthReached(Evas_Object *obj, void *event_info)
{
-
}
void ConvRecipientsPanelView::onKeyDown(Evas_Object *obj, void *event_info)
{
Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *)event_info;
- if((strcmp(ev->keyname, "BackSpace") == 0) && isEntryEmpty())
+ if ((strcmp(ev->keyname, "BackSpace") == 0) && isEntryEmpty())
deleteNextRecipient();
onKeyDown(ev);
}
{
m_NeedTerminate = true;
m_Condition.notify_one();
- if(m_Thread.joinable())
+ if (m_Thread.joinable())
m_Thread.join();
}
void AttachmentHandler::processFile(const std::string &file)
{
- if(!m_Thread.joinable())
+ if (!m_Thread.joinable())
m_Thread = std::thread(&AttachmentHandler::onRoutine, this);
std::unique_lock<std::mutex> _lock(m_Mutex);
void *AttachmentHandler::safeCallOnFreeSpaceRequest(void *data)
{
auto *self = static_cast<AttachmentHandler*>(data);
- if(self->m_pListener)
+ if (self->m_pListener)
self->m_CurrentFreeSpace = self->m_pListener->onFreeSpaceRequest();
return nullptr;
}
void *AttachmentHandler::safeCallOnFileReady(void *data)
{
auto *self = static_cast<AttachmentHandler*>(data);
- if(self->m_pListener)
+ if (self->m_pListener)
self->m_pListener->onFileReady(self->m_CurrentFile);
return nullptr;
}
void *AttachmentHandler::safeCallOnFileFails(void *data)
{
auto *self = static_cast<AttachmentHandler*>(data);
- if(self->m_pListener)
+ if (self->m_pListener)
self->m_pListener->onFileFails();
return nullptr;
}
void AttachmentHandler::onRoutine()
{
- while(!m_NeedTerminate)
+ while (!m_NeedTerminate)
{
std::unique_lock<std::mutex> _lock(m_Mutex);
- if(m_Task.empty() && !m_NeedTerminate)
+ if (m_Task.empty() && !m_NeedTerminate)
m_Condition.wait(_lock);
- if(m_Task.empty() || m_NeedTerminate)
+ if (m_Task.empty() || m_NeedTerminate)
continue;
m_CurrentFile = m_Task.front();
m_Task.pop();
_lock.unlock();
- if(!FileUtils::isExists(m_CurrentFile) || FileUtils::isDir(m_CurrentFile))
+ if (!FileUtils::isExists(m_CurrentFile) || FileUtils::isDir(m_CurrentFile))
{
MSG_LOG_ERROR("File not exists: ", m_CurrentFile);
ecore_main_loop_thread_safe_call_sync(safeCallOnFileFails, this);
}
m_CurrentFile = m_WorkingDir->addFile(m_CurrentFile);
- if(m_CurrentFile.empty())
+ if (m_CurrentFile.empty())
{
MSG_LOG_ERROR("Error while copy file");
ecore_main_loop_thread_safe_call_sync(safeCallOnFileFails, this);
}
ecore_main_loop_thread_safe_call_sync(safeCallOnFreeSpaceRequest, this);
- if(FileUtils::getFileSize(m_CurrentFile) > m_CurrentFreeSpace)
+ if (FileUtils::getFileSize(m_CurrentFile) > m_CurrentFreeSpace)
{
bool isImage = getMsgMediaTypeByFileExt(m_CurrentFile).type == MsgMedia::ImageType;
- if((isImage && MediaUtils::downgradeImageQuality(m_CurrentFile) > m_CurrentFreeSpace) || !isImage)
+ if ((isImage && MediaUtils::downgradeImageQuality(m_CurrentFile) > m_CurrentFreeSpace) || !isImage)
{
m_WorkingDir->removeFile(m_CurrentFile);
ecore_main_loop_thread_safe_call_sync(safeCallOnFileFails, this);
std::string msgDetails = makeMainText(msg("IDS_MSG_POP_TYPE"));
msgDetails.append("<br/>");
- switch(msgType)
+ switch (msgType)
{
case Message::MT_SMS:
msgDetails.append(makeSecondText(msg("IDS_MSGF_OPT_TEXT_MESSAGE")));
MsgAddressListRef addrList = app.getMsgEngine().getStorage().getAddressList(msgThreadId);
std::string contactsInfo;
- if(msgDirection == Message::MD_Sent)
+ if (msgDirection == Message::MD_Sent)
{
contactsInfo.append(msg("IDS_MSG_HEADER_TO_M_RECIPIENT"));
contactsInfo.append("<br/>");
}
- if(msgDirection == Message::MD_Received)
+ if (msgDirection == Message::MD_Received)
{
contactsInfo.append(makeMainText(msg("IDS_MSG_BODY_FROM_ABB_M_PERIOD")));
contactsInfo.append("<br/>");
}
int addressListLength = addrList->getLength();
- for(int i = 0; i < addressListLength; ++i)
+ for (int i = 0; i < addressListLength; ++i)
{
std::string address = addrList->at(i).getAddress();
contactsInfo.append(makeSecondText(makeDispAddress(app, address)));
- if(i != addressListLength - 1)
+ if (i != addressListLength - 1)
contactsInfo.append(makeSecondText(", "));
}
contactsInfo.append("<br/><br/>");
std::string getSentReceivedTime(const Message &message, Message::Direction msgDirection)
{
std::string msgDetails;
- if(msgDirection == Message::MD_Sent)
+ if (msgDirection == Message::MD_Sent)
msgDetails.append(makeMainText(msg("IDS_MSG_HEADER_TIME_SENT")));
- else if(msgDirection == Message::MD_Received)
+ else if (msgDirection == Message::MD_Received)
msgDetails.append(makeMainText(msg("IDS_MSG_HEADER_TIME_RECEIVED")));
msgDetails.append("<br/>");
std::string deliverText = makeMainText(msg("IDS_MSGF_BODY_DELIVERY_REPORT"));
bool deliverFlag = app.getMsgEngine().getStorage().isDeliverReportChecked(msgId);
- if(deliverFlag)
+ if (deliverFlag)
{
MsgReportListRef reportList = app.getMsgEngine().getStorage().getMsgReportList(msgId);
int size = reportList->getLength();
bool isDelivReportExists = false;
- for(int i = 0; i < size; i++)
+ for (int i = 0; i < size; i++)
{
const MsgReport &report = reportList->at(i);
- if(report.getType() == MsgReport::TypeDelivery)
+ if (report.getType() == MsgReport::TypeDelivery)
{
isDelivReportExists = true;
deliverText.append("<br/>");
deliverText.append(makeSecondText(": "));
MsgReport::DeliveryStatus deliveryStatus = report.getDeliveryStatus();
- switch(deliveryStatus)
+ switch (deliveryStatus)
{
case MsgReport::StatusSuccess:
{
}
}
}
- if(!isDelivReportExists)
+ if (!isDelivReportExists)
{
deliverText.append("<br/>");
deliverText.append(makeSecondText(msg("IDS_MSGF_BODY_UNKNOWN")));
}
- }
- else
- {
+ } else {
deliverText.append("<br/>");
deliverText.append(makeSecondText(msg("IDS_MSGC_BODY_NOT_REQUESTED")));
}
std::string status = makeMainText(msg("IDS_MSG_BODY_STATUS_C"));
status.append("<br/>");
- switch(msgStatus)
+ switch (msgStatus)
{
case Message::NS_Sending:
status.append(makeSecondText(msg("IDS_MSG_BODY_SENDING_ING_M_STATUS_ABB")));
{
std::string msgDetails;
std::string subject = message.getSubject();
- switch(style)
+ switch (style)
{
case ViewDetailsTextStyle:
msgDetails.append(makeMainText(msg("IDS_MSG_HEADER_SUBJECT"))).append("<br/>");
- if(subject.empty())
+ if (subject.empty())
msgDetails.append(makeSecondText(msg("IDS_MSGF_BODY_NO_SUBJECT")));
else
msgDetails.append(makeSecondText(subject));
case DownloadTextStyle:
msgDetails.append(msg("IDS_MSGF_OPT_SUBJECT_COLON"));
msgDetails.append(" ");
- if(subject.empty())
+ if (subject.empty())
msgDetails.append(msg("IDS_MSGF_BODY_NO_SUBJECT"));
else
msgDetails.append(subject);
{
int msgSize = message.getSize();
std::string msgDetails;
- switch(style)
+ switch (style)
{
case ViewDetailsTextStyle:
msgDetails.append(makeMainText(msg("IDS_MSGF_BODY_MESSAGE_SIZE")));
{
const MessageMms *mms = dynamic_cast<const MessageMms*>(&message);
std::string msgDetails;
- switch(style)
+ switch (style)
{
case ViewDetailsTextStyle:
msgDetails.append("<br/><br/>");
msgDetails.append(makeMainText(msg("IDS_MSG_BODY_EXPIRES_ON_C")));
msgDetails.append("<br/>");
- if(mms)
+ if (mms)
{
time_t msgExpired = mms->getExpired();
msgDetails.append(makeSecondText(TimeUtils::makeDateString(msgExpired)));
case DownloadTextStyle:
msgDetails.append(msg("IDS_MSG_BODY_EXPIRES_ON_C"));
msgDetails.append(" ");
- if(mms)
+ if (mms)
{
time_t msgExpired = mms->getExpired();
msgDetails.append(TimeUtils::makeDateString(msgExpired));
{
std::string readReport = makeMainText(msg("IDS_MSGF_POP_READ_REPORT"));
bool readFlag = app.getMsgEngine().getStorage().isReadReportChecked(msgId);
- if(readFlag)
+ if (readFlag)
{
MsgReportListRef reportList = app.getMsgEngine().getStorage().getMsgReportList(msgId);
int size = reportList->getLength();
bool isReadReportExists = false;
- for(int i = 0; i < size; i++)
+ for (int i = 0; i < size; i++)
{
const MsgReport &report = reportList->at(i);
- if(report.getType() == MsgReport::TypeRead)
+ if (report.getType() == MsgReport::TypeRead)
{
isReadReportExists = true;
readReport.append("<br/>");
readReport.append(makeSecondText(": "));
MsgReport::ReadStatus readStatus = report.getReadStatus();
- switch(readStatus)
+ switch (readStatus)
{
case MsgReport::ReadStatusIsRead:
{
}
}
- if(!isReadReportExists)
+ if (!isReadReportExists)
{
readReport.append("<br/>");
readReport.append(makeSecondText(msg("IDS_MSGF_BODY_UNKNOWN")));
}
- }
- else
- {
+ } else {
readReport.append("<br/>");
readReport.append(makeSecondText(msg("IDS_MSGC_BODY_NOT_REQUESTED")));
}
ContactAddressRef rec = app.getContactManager().getContactAddress(address);
std::string dispName;
- if(rec)
+ if (rec)
dispName = rec->getDispName();
res = dispName;
- if(!res.empty())
+ if (!res.empty())
res += "(";
res += address;
- if(!dispName.empty())
+ if (!dispName.empty())
res += ')';
- if(res.empty())
+ if (res.empty())
res += msg("IDS_MSGF_BODY_UNKNOWN");
return res;
// Create common dir. if not exists:
std::string commonDir = PathUtils::getDataPath(commonWorkingDirName);
bool isCommonExists = FileUtils::isExists(commonDir);
- if(!isCommonExists)
+ if (!isCommonExists)
{
isCommonExists = FileUtils::makeDir(commonDir);
MSG_ASSERT(isCommonExists, "Can't create common working dir: ", commonDir);
}
// Create current dir:
- if(isCommonExists)
+ if (isCommonExists)
{
std::string uniqueDir = getUniqueDirName(commonDir + "/" + currentWorkingDirPrefix);
FileUtils::makeDir(uniqueDir);
bool isExists = FileUtils::isExists(uniqueDir);
MSG_ASSERT(isExists, "Can't create current working dir: ", uniqueDir);
- if(isExists)
+ if (isExists)
{
m_Path = uniqueDir;
}
void WorkingDir::removeWorkingDir()
{
- if(!m_Path.empty())
+ if (!m_Path.empty())
{
bool res = FileUtils::remove(m_Path, true);
MSG_LOG("Working dir remove with result = ", res);
std::lock_guard<std::recursive_mutex> _lock(m_Mutex);
std::string newPath;
- if(FileUtils::isExists(path))
+ if (FileUtils::isExists(path))
{
- if(path.find(m_Path) != std::string::npos)
+ if (path.find(m_Path) != std::string::npos)
{
newPath = path;
MSG_LOG("File is already exists: ", newPath);
- }
- else
- {
+ } else {
newPath = genUniqueFilePath(path);
- if(FileUtils::copy(path, newPath))
+ if (FileUtils::copy(path, newPath))
{
MSG_LOG("File added: ", newPath);
- }
- else
- {
+ } else {
MSG_LOG_ERROR("Can't copy to working dir: ", path);
newPath.clear();
}
std::string path = genUniqueFilePath(result);
std::ofstream file(path, std::ofstream::trunc | std::ofstream::binary | std::ofstream::out);
- if(file.is_open())
+ if (file.is_open())
{
file << text;
MSG_LOG("Text file added: ", path);
- }
- else
- {
+ } else {
path.clear();
}
void WorkingDir::removeFile(const std::string &path)
{
std::lock_guard<std::recursive_mutex> _lock(m_Mutex);
- if(!path.empty())
+ if (!path.empty())
FileUtils::remove(path);
}
res = path + "-" + std::to_string(i);
++i;
}
- while(FileUtils::isExists(res));
+ while (FileUtils::isExists(res));
return res;
}