From: Denis Dolzhenko Date: Mon, 21 Nov 2016 15:02:38 +0000 (+0200) Subject: TizenRefApp-7697 Conversation/* codestyle X-Git-Tag: submit/tizen_3.0/20161122.132720~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9efbe6914fd274ebc7aa53d8315f9609449f54e9;p=profile%2Fmobile%2Fapps%2Fnative%2Fmessage.git TizenRefApp-7697 Conversation/* codestyle Change-Id: I854e32d403a5d4f9899b5df27f4638a61e445eb0 Signed-off-by: Denis Dolzhenko --- diff --git a/src/Conversation/AppControl/src/AttachPanel.cpp b/src/Conversation/AppControl/src/AttachPanel.cpp index a7f3867..070ca6e 100644 --- a/src/Conversation/AppControl/src/AttachPanel.cpp +++ b/src/Conversation/AppControl/src/AttachPanel.cpp @@ -34,7 +34,6 @@ AttachPanel::AttachPanel(App &app) , m_Handle() , m_pListener(nullptr) { - } AttachPanel::~AttachPanel() @@ -49,11 +48,11 @@ void AttachPanel::setListener(IAttachPanelListener *l) 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); @@ -61,7 +60,7 @@ void AttachPanel::show(bool value) void AttachPanel::reset() { - if(m_Handle) + if (m_Handle) { attach_panel_hide(m_Handle); attach_panel_destroy(m_Handle); @@ -72,7 +71,7 @@ void AttachPanel::reset() bool AttachPanel::isVisible() const { bool res = false; - if(m_Handle) + if (m_Handle) attach_panel_get_visibility(m_Handle, &res); return res; } @@ -80,31 +79,31 @@ bool AttachPanel::isVisible() const 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); @@ -125,13 +124,12 @@ void AttachPanel::result_cb(attach_panel_h attachPanel, attach_panel_content_cat 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); - } diff --git a/src/Conversation/AppControl/src/ContactPicker.cpp b/src/Conversation/AppControl/src/ContactPicker.cpp index ab255b8..b2cf628 100644 --- a/src/Conversation/AppControl/src/ContactPicker.cpp +++ b/src/Conversation/AppControl/src/ContactPicker.cpp @@ -43,17 +43,15 @@ bool ContactPicker::launch(size_t howManyToPick) 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); } @@ -72,7 +70,7 @@ bool ContactPicker::launch(size_t howManyToPick) 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 addressIds; std::list types; @@ -84,19 +82,18 @@ void ContactPicker::onAppControlRes(app_control_h request, app_control_h reply, 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); } } diff --git a/src/Conversation/Body/Controller/src/Body.cpp b/src/Conversation/Body/Controller/src/Body.cpp index 5f8a848..8ce8db0 100644 --- a/src/Conversation/Body/Controller/src/Body.cpp +++ b/src/Conversation/Body/Controller/src/Body.cpp @@ -59,7 +59,7 @@ Body::Body(Evas_Object *parent, App &app, WorkingDirRef workingDir, ConvList &co Body::~Body() { - if(m_pOnChangedJob) + if (m_pOnChangedJob) { ecore_job_del(m_pOnChangedJob); m_pOnChangedJob = nullptr; @@ -92,7 +92,7 @@ void Body::setListener(IBodyListener *listener) ComposeListItem &Body::getComposeItem() { ComposeListItem &item = m_ConvList.getComposeItem(); - if(item.getListener() != this) + if (item.getListener() != this) item.setListener(this); return item; } @@ -109,7 +109,7 @@ void Body::enableAutoFocusForAttachments(bool focus) void Body::addAttachments(const std::list &fileList) { - for(auto& file : fileList) + for (auto& file : fileList) m_SelectedFiles.push(file); runFileProcessing(); } @@ -120,19 +120,19 @@ void Body::addAttachment(const std::string &filePath) 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); @@ -143,10 +143,10 @@ void Body::addFileToPage(MessageMms &msg,const std::string &filePath) 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()); } @@ -154,7 +154,7 @@ void Body::runFileProcessing() bool Body::isMms() { - if(m_MmsRecipFlag || !getComposeItem().isEmpty()) + if (m_MmsRecipFlag || !getComposeItem().isEmpty()) return true; updateTextMetricIfNeeded(); @@ -168,7 +168,7 @@ void Body::setMmsRecipFlag(bool value) void Body::updateTextMetricIfNeeded() { - if(m_TextMetricNeedUpdate) + if (m_TextMetricNeedUpdate) { std::string text = getPlainUtf8Text(); m_Utf8TextSize = text.length(); @@ -189,7 +189,7 @@ long long Body::getMsgSize() // Attachments: auto attachments = getComposeItem().getAttachments(); - for(auto *attachment : attachments) + for (auto *attachment : attachments) { totalSize += attachment->getFileSize(); } @@ -204,18 +204,18 @@ long long Body::getMsgSize() void Body::read(Message &msg) { MSG_LOG(""); - if(MessageSMS *sms = dynamic_cast(&msg)) + if (MessageSMS *sms = dynamic_cast(&msg)) read(*sms); - else if(MessageMms *mms = dynamic_cast(&msg)) + else if (MessageMms *mms = dynamic_cast(&msg)) read(*mms); } void Body::write(const Message &msg) { clear(); - if(const MessageSMS *sms = dynamic_cast(&msg)) + if (const MessageSMS *sms = dynamic_cast(&msg)) write(*sms); - else if(const MessageMms *mms = dynamic_cast(&msg)) + else if (const MessageMms *mms = dynamic_cast(&msg)) write(*mms); } @@ -240,21 +240,21 @@ void Body::writeAttachments(const MessageMms &msg) // 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); @@ -266,14 +266,14 @@ void Body::writeAttachments(const MessageMms &msg) // 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); @@ -284,7 +284,7 @@ void Body::writeAttachments(const MessageMms &msg) void Body::writeTextToFile() { - if(m_MmsTextFilePath.empty()) + if (m_MmsTextFilePath.empty()) m_MmsTextFilePath = m_WorkingDir->addTextFile(getPlainUtf8Text()); else FileUtils::writeTextFile(m_MmsTextFilePath, getPlainUtf8Text()); @@ -304,13 +304,13 @@ void Body::read(MessageMms &msg) 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: @@ -331,7 +331,7 @@ void Body::readAttachments(MessageMms &msg) void Body::readText(MessageMms &msg) { - if(!BodyView::isEmpty()) + if (!BodyView::isEmpty()) { writeTextToFile(); addFileToPage(msg, m_MmsTextFilePath); @@ -343,7 +343,7 @@ void Body::execCmd(const AppControlComposeRef &cmd) clear(); setText(cmd->getMessageText()); std::list path = cmd->getFileList(); - if(!cmd->getVcfInfo().contactsIdList.empty()) + if (!cmd->getVcfInfo().contactsIdList.empty()) path.push_back(createVcfFile(cmd)); addAttachments(path); @@ -351,7 +351,7 @@ void Body::execCmd(const AppControlComposeRef &cmd) void Body::execCmd(const AppControlDefaultRef &cmd) { - if(cmd->getDefaultType() == AppControlDefault::ReplyType) + if (cmd->getDefaultType() == AppControlDefault::ReplyType) { clear(); setText(cmd->getReplyText()); @@ -367,11 +367,11 @@ void Body::onMaxLengthReached() 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(utfText.size()) > maxSize) + if (getMsgSize() + static_cast(utfText.size()) > maxSize) { free(*text); *text = nullptr; @@ -389,14 +389,14 @@ PopupList &Body::createPopupList(const std::string &title) void Body::showTooLargePopup(const std::list &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("
"); content.append(FileUtils::getFileName(file)); @@ -409,7 +409,7 @@ void Body::showTooLargePopup(const std::list &tooBigFiles) 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); @@ -424,7 +424,7 @@ void Body::showTooMuchAttachedPopup(int willBeAttached) 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); @@ -439,7 +439,7 @@ void Body::showTooMuchAttachedPopup() 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); @@ -489,13 +489,11 @@ std::string Body::createVcfFile(const AppControlComposeRef &cmd) 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; } @@ -507,19 +505,17 @@ std::string Body::createVcfFile(const AppControlComposeRef &cmd) 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); } } @@ -536,7 +532,7 @@ void Body::onAttachmentAdded(const std::list &files) void Body::onAttachmentDeleted(const std::list &files) { - for(const std::string &file : files) + for (const std::string &file : files) { m_WorkingDir->removeFile(file); } @@ -547,7 +543,7 @@ void Body::onFileReady(const std::string &filePath) { int numAttached = getComposeItem().getAttachments().size(); int numAttachMax = m_App.getMsgEngine().getSettings().getAttachmentsMaxCount(); - if(numAttached == numAttachMax) + if (numAttached == numAttachMax) { std::queue empty; std::swap(m_SelectedFiles, empty); @@ -559,19 +555,17 @@ void Body::onFileReady(const std::string &filePath) 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(); } } @@ -579,7 +573,7 @@ void Body::onFileReady(const std::string &filePath) void Body::onFileFails() { std::list overflowList; - while(!m_SelectedFiles.empty()) + while (!m_SelectedFiles.empty()) { overflowList.push_back(m_SelectedFiles.front()); m_SelectedFiles.pop(); diff --git a/src/Conversation/Body/View/src/BodyView.cpp b/src/Conversation/Body/View/src/BodyView.cpp index 28c37ef..2cb25be 100644 --- a/src/Conversation/Body/View/src/BodyView.cpp +++ b/src/Conversation/Body/View/src/BodyView.cpp @@ -62,17 +62,15 @@ void BodyView::clear() 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(); } } @@ -80,7 +78,7 @@ void BodyView::setText(const std::string &text) void BodyView::setFocus(bool focus) { elm_object_focus_set(m_pEntry, focus); - if(focus) + if (focus) elm_entry_cursor_end_set(m_pEntry); } @@ -94,10 +92,10 @@ std::string BodyView::getPlainUtf8Text() const 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); @@ -123,13 +121,13 @@ Evas_Object *BodyView::createEntry(Evas_Object *parent, int maxCharCount) 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) @@ -155,7 +153,7 @@ void BodyView::onContentBoxGeometryChanged(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); diff --git a/src/Conversation/ContactList/Controller/src/ConvContactList.cpp b/src/Conversation/ContactList/Controller/src/ConvContactList.cpp index 268dec1..a10d764 100644 --- a/src/Conversation/ContactList/Controller/src/ConvContactList.cpp +++ b/src/Conversation/ContactList/Controller/src/ConvContactList.cpp @@ -34,7 +34,7 @@ ConvContactList::ConvContactList(Evas_Object *parent, App &app) ConvContactList::~ConvContactList() { - if(m_pPredictSearchIdler) + if (m_pPredictSearchIdler) { ecore_idler_del(m_pPredictSearchIdler); m_pPredictSearchIdler = nullptr; @@ -50,7 +50,7 @@ void ConvContactList::clear() { getList().clear(); - if(m_pListener) + if (m_pListener) m_pListener->onContactListChanged(); } @@ -66,20 +66,20 @@ void ConvContactList::setSearchWorld(const std::string &searchWord) 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(); search(); search(); } - if(m_pListener) + if (m_pListener) m_pListener->onContactListChanged(); } @@ -87,21 +87,19 @@ template void ConvContactList::search() { auto list = m_App.getContactManager().search(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()); } } @@ -116,6 +114,6 @@ void ConvContactList::onListItemSelected(ListItem &listItem) { ContactListItem &contactItem = static_cast(listItem); MSG_LOG("Selected recipient: ", contactItem.getRecipient()); - if(m_pListener) + if (m_pListener) m_pListener->onContactSelected(contactItem); } diff --git a/src/Conversation/ContactList/View/src/ContactListViewItem.cpp b/src/Conversation/ContactList/View/src/ContactListViewItem.cpp index b030b83..97e76da 100644 --- a/src/Conversation/ContactList/View/src/ContactListViewItem.cpp +++ b/src/Conversation/ContactList/View/src/ContactListViewItem.cpp @@ -33,25 +33,22 @@ ContactListViewItem::~ContactListViewItem() 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(); } @@ -62,7 +59,7 @@ std::string ContactListViewItem::getText(ListItem &item, const char *part) 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(); } diff --git a/src/Conversation/ContactList/View/src/ConvContactListView.cpp b/src/Conversation/ContactList/View/src/ConvContactListView.cpp index a58be2a..d609790 100644 --- a/src/Conversation/ContactList/View/src/ConvContactListView.cpp +++ b/src/Conversation/ContactList/View/src/ConvContactListView.cpp @@ -45,7 +45,6 @@ ConvContactListView::ConvContactListView(Evas_Object *parent) ConvContactListView::~ConvContactListView() { - } ListView &ConvContactListView::getList() @@ -67,7 +66,7 @@ void ConvContactListView::recalcGeometry() 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); diff --git a/src/Conversation/ConvList/Controller/inc/BubbleEntityFactory.h b/src/Conversation/ConvList/Controller/inc/BubbleEntityFactory.h index 5c8c91c..e8d52b0 100644 --- a/src/Conversation/ConvList/Controller/inc/BubbleEntityFactory.h +++ b/src/Conversation/ConvList/Controller/inc/BubbleEntityFactory.h @@ -37,7 +37,6 @@ namespace Msg { class BubbleEntityFactory { - public: BubbleEntityFactory(App &app, WorkingDirRef workingDir); ~BubbleEntityFactory(); diff --git a/src/Conversation/ConvList/Controller/inc/BubbleTextEntity.h b/src/Conversation/ConvList/Controller/inc/BubbleTextEntity.h index 9833e46..8ca3f08 100644 --- a/src/Conversation/ConvList/Controller/inc/BubbleTextEntity.h +++ b/src/Conversation/ConvList/Controller/inc/BubbleTextEntity.h @@ -47,7 +47,7 @@ namespace Msg 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; } } diff --git a/src/Conversation/ConvList/Controller/src/BubbleCalEventEntity.cpp b/src/Conversation/ConvList/Controller/src/BubbleCalEventEntity.cpp index b211b93..1b3b12d 100644 --- a/src/Conversation/ConvList/Controller/src/BubbleCalEventEntity.cpp +++ b/src/Conversation/ConvList/Controller/src/BubbleCalEventEntity.cpp @@ -24,14 +24,12 @@ BubbleCalEventEntity::BubbleCalEventEntity(const std::string &filePath, const st : 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; } } @@ -46,7 +44,7 @@ BubbleCalEventViewItem *BubbleCalEventEntity::createView(Evas_Object *parent) 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; } diff --git a/src/Conversation/ConvList/Controller/src/BubbleContactEntity.cpp b/src/Conversation/ConvList/Controller/src/BubbleContactEntity.cpp index dfea0fa..9b5d435 100644 --- a/src/Conversation/ConvList/Controller/src/BubbleContactEntity.cpp +++ b/src/Conversation/ConvList/Controller/src/BubbleContactEntity.cpp @@ -27,12 +27,12 @@ BubbleContactEntity::BubbleContactEntity(App &app, const std::string &filePath, , 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(); @@ -40,7 +40,7 @@ BubbleContactEntity::BubbleContactEntity(App &app, const std::string &filePath, } } } - if(!m_Contact) + if (!m_Contact) m_Name = fileName; } @@ -57,9 +57,9 @@ BubbleContactViewItem *BubbleContactEntity::createView(Evas_Object *parent) 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; } diff --git a/src/Conversation/ConvList/Controller/src/BubbleEntityFactory.cpp b/src/Conversation/ConvList/Controller/src/BubbleEntityFactory.cpp index 16c9380..f4f399f 100644 --- a/src/Conversation/ConvList/Controller/src/BubbleEntityFactory.cpp +++ b/src/Conversation/ConvList/Controller/src/BubbleEntityFactory.cpp @@ -37,7 +37,6 @@ BubbleEntityFactory::BubbleEntityFactory(App &app, WorkingDirRef workingDir) : m_App(app) , m_WorkingDir(workingDir) { - } BubbleEntityFactory::~BubbleEntityFactory() @@ -50,10 +49,10 @@ BubbleEntity *BubbleEntityFactory::createEntity(const MsgConvMedia &msgMedia, Bu 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); @@ -77,10 +76,10 @@ BubbleDownloadButtonEntity *BubbleEntityFactory::createDownloadButtonEntity() 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); @@ -89,13 +88,13 @@ BubbleEntity *BubbleEntityFactory::createEntity(const std::string &filePath, con 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); } } diff --git a/src/Conversation/ConvList/Controller/src/BubbleUnknownFileEntity.cpp b/src/Conversation/ConvList/Controller/src/BubbleUnknownFileEntity.cpp index 365b2d2..6fb7eff 100644 --- a/src/Conversation/ConvList/Controller/src/BubbleUnknownFileEntity.cpp +++ b/src/Conversation/ConvList/Controller/src/BubbleUnknownFileEntity.cpp @@ -25,7 +25,6 @@ BubbleUnknownFileEntity::BubbleUnknownFileEntity(const std::string &filePath, co : BubbleBgEntity(UnknownFileItem, bgType, direction, filePath) , m_FileName(fileName) { - } BubbleUnknownFileEntity::~BubbleUnknownFileEntity() diff --git a/src/Conversation/ConvList/Controller/src/BubbleVideoEntity.cpp b/src/Conversation/ConvList/Controller/src/BubbleVideoEntity.cpp index eab61ec..c939975 100644 --- a/src/Conversation/ConvList/Controller/src/BubbleVideoEntity.cpp +++ b/src/Conversation/ConvList/Controller/src/BubbleVideoEntity.cpp @@ -27,7 +27,7 @@ BubbleVideoEntity::BubbleVideoEntity(WorkingDirRef workingDir, const std::string { 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); } diff --git a/src/Conversation/ConvList/Controller/src/ComposeListItem.cpp b/src/Conversation/ConvList/Controller/src/ComposeListItem.cpp index d41da7d..3f67643 100644 --- a/src/Conversation/ConvList/Controller/src/ComposeListItem.cpp +++ b/src/Conversation/ConvList/Controller/src/ComposeListItem.cpp @@ -37,7 +37,6 @@ ComposeListItem::ComposeListItem(BubbleEntityFactory &entityFactory) : m_pListener(nullptr) , m_BubbleEntityFactory(entityFactory) { - } ComposeListItem::~ComposeListItem() @@ -49,13 +48,13 @@ 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}); } } @@ -83,31 +82,31 @@ bool ComposeListItem::isEmpty() const void ComposeListItem::clear(bool updateUi) { std::list 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); @@ -122,15 +121,15 @@ Evas_Object *ComposeListItem::getBubbleContent() 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}); } } diff --git a/src/Conversation/ConvList/Controller/src/ConvList.cpp b/src/Conversation/ConvList/Controller/src/ConvList.cpp index 5649b11..a6a88bb 100644 --- a/src/Conversation/ConvList/Controller/src/ConvList.cpp +++ b/src/Conversation/ConvList/Controller/src/ConvList.cpp @@ -67,13 +67,11 @@ void ConvList::setMode(ConvList::Mode mode) 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(); @@ -122,7 +120,7 @@ Evas_Object *ConvList::createList(Evas_Object *parent) void ConvList::fill() { clear(); - if(!m_ThreadId.isValid()) + if (!m_ThreadId.isValid()) return; MsgConversationListRef convList = m_MsgEngine.getStorage().getConversationList(m_ThreadId); @@ -131,7 +129,7 @@ void ConvList::fill() 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); @@ -142,20 +140,20 @@ void ConvList::setThreadId(ThreadId id, const char *searchWord) { 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(); } @@ -167,21 +165,19 @@ ThreadId ConvList::getThreadId() const 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; } } @@ -189,19 +185,19 @@ void ConvList::updateRecipThumbId() 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(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); } } @@ -214,7 +210,7 @@ ConvListItem *ConvList::getItem(MsgId msgId) const 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)); @@ -225,7 +221,7 @@ void ConvList::insertItem(ConvListItem *item) 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); @@ -243,17 +239,17 @@ void ConvList::deleteItem(ConvListItem *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; @@ -264,7 +260,7 @@ void ConvList::demoteItem(ConvListItem *item) dateLineDelIfNec(item); dateLineAddIfNec(item); m_pList->demoteItem(*item); - if(m_pComposeItem) + if (m_pComposeItem) m_pList->demoteItem(*m_pComposeItem); } @@ -272,12 +268,10 @@ void ConvList::dateLineDelIfNec(ConvListItem *item) { bool needDelDateLine = false; DateLineItem *prev = dynamic_cast(m_pList->getPrevItem(*item)); - if(prev) - { + if (prev) { ListItem *nextItem = m_pList->getNextItem(*item); needDelDateLine = nextItem ? dynamic_cast(nextItem) == nullptr : true; - if(needDelDateLine) - { + if (needDelDateLine) { m_DateLineItemSet.erase(prev->getDateLine()); m_pList->deleteItem(*prev); } @@ -288,11 +282,10 @@ void ConvList::dateLineAddIfNec(ConvListItem *item) { 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); @@ -302,9 +295,9 @@ void ConvList::dateLineAddIfNec(ConvListItem *item) 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(); @@ -315,9 +308,9 @@ void ConvList::deleteSelectedItems() { 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); @@ -333,9 +326,9 @@ int ConvList::getMessageCheckedCount() const { auto items = getConvItems(); int count = 0; - for(ConvListItem *item : items) + for (ConvListItem *item : items) { - if(item->getCheckedState()) + if (item->getCheckedState()) count++; } return count; @@ -344,19 +337,19 @@ int ConvList::getMessageCheckedCount() const 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; @@ -368,7 +361,7 @@ void ConvList::updateSelectAllItem() ComposeListItem &ConvList::getComposeItem() { - if(!m_pComposeItem) + if (!m_pComposeItem) { m_pComposeItem = new ComposeListItem(m_BubbleEntityFactory); m_pList->appendItem(*m_pComposeItem); @@ -390,7 +383,7 @@ void ConvList::setBodyFocusCb(std::function bodyFocusFunc) void ConvList::onListItemLongPressed(ListItem &listItem) { ConvListItem *item = dynamic_cast(&listItem); - if(item) + if (item) item->showPopup(); } @@ -402,20 +395,20 @@ void ConvList::onSelectAllChanged(Evas_Object *obj, void *eventInfo) 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); } } @@ -424,23 +417,23 @@ void ConvList::onMsgStorageUpdate(const MsgIdList &msgIdList) 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(); } @@ -451,31 +444,31 @@ void ConvList::onMsgStorageDelete(const MsgIdList &msgIdList) 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()); @@ -493,7 +486,7 @@ void ConvList::onTimeFormatChanged() { MSG_LOG(""); auto items = getConvItems(); - for(ConvListItem *item : items) + for (ConvListItem *item : items) { item->updateTime(); } @@ -506,7 +499,7 @@ void ConvList::onLanguageChanged() // Update ConvListItem: auto convListItems = getConvItems(); - for(ConvListItem *item : convListItems) + for (ConvListItem *item : convListItems) { item->updateTime(); } @@ -514,7 +507,7 @@ void ConvList::onLanguageChanged() // Update DateLineItem: m_DateLineItemSet.clear(); auto DateLineItems = m_pList->getItems(); - for(DateLineItem *item : DateLineItems) + for (DateLineItem *item : DateLineItems) { item->update(); m_DateLineItemSet.insert(item->getDateLine()); @@ -526,7 +519,7 @@ void ConvList::onLanguageChanged() void ConvList::onListResized(Evas_Object *obj, void *eventInfo) { MSG_LOG(""); - if(m_BodyFocusFunc && m_BodyFocusFunc()) + if (m_BodyFocusFunc && m_BodyFocusFunc()) navigateToBottom(); } diff --git a/src/Conversation/ConvList/Controller/src/ConvListItem.cpp b/src/Conversation/ConvList/Controller/src/ConvListItem.cpp index 7e1c29e..2ab0ba3 100644 --- a/src/Conversation/ConvList/Controller/src/ConvListItem.cpp +++ b/src/Conversation/ConvList/Controller/src/ConvListItem.cpp @@ -72,7 +72,7 @@ ConvListItem::ConvListItem(const MsgConversationItem &item, ConvListItem::~ConvListItem() { m_App.getPopupManager().reset(this); - for(auto *entity : m_BubbleEntityList) + for (auto *entity : m_BubbleEntityList) { delete entity; } @@ -82,7 +82,7 @@ ConvListItem::~ConvListItem() void ConvListItem::updateStatus() { MessageRef msg = m_App.getMsgEngine().getStorage().getMessage(m_MsgId); - if(!msg) + if (!msg) return; updateTime(); @@ -90,29 +90,21 @@ void ConvListItem::updateStatus() 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(); } @@ -132,15 +124,13 @@ bool ConvListItem::isNeededReadReport() const 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; @@ -149,15 +139,13 @@ ConvListViewItem::ConvItemType ConvListItem::getConvItemType(const MsgConversati 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; @@ -168,7 +156,7 @@ BubbleTextEntity *ConvListItem::createTextEntity(BubbleBgViewItem::BgType bgType 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; } @@ -180,7 +168,7 @@ BubbleTextEntity *ConvListItem::createTextEntity(BubbleBgViewItem::BgType bgType 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); @@ -188,9 +176,9 @@ BubbleTextEntity *ConvListItem::createTextEntity(BubbleBgViewItem::BgType bgType 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(entity); } return nullptr; @@ -199,22 +187,22 @@ BubbleDownloadButtonEntity *ConvListItem::findDownloadButton() const 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(entity); - if(bgEntity) + if (bgEntity) bgEntity->setBgType(bgType); } } @@ -222,32 +210,26 @@ void ConvListItem::updateEntityBgType(BubbleBgViewItem::BgType 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)); } } @@ -255,17 +237,15 @@ void ConvListItem::prepareBubble(const MsgConversationItem &item, const std::str void ConvListItem::shareContent() { - if(MsgUtils::isSms(m_Type)) + if (MsgUtils::isSms(m_Type)) { Share::getInst().launch(getAllMsgText()); - } - else - { + } else { std::list 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); @@ -276,25 +256,25 @@ void ConvListItem::copyMsgToSimCard() { 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); @@ -320,7 +300,7 @@ Evas_Object *ConvListItem::getProgress() std::string ConvListItem::getTime() { - if(m_TimeStr.empty()) + if (m_TimeStr.empty()) m_TimeStr = TimeUtils::makeBubbleTimeString(m_Time); return m_TimeStr; } @@ -357,36 +337,36 @@ void ConvListItem::showMainListPopup() 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(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); @@ -395,18 +375,18 @@ void ConvListItem::showMainListPopup() 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() @@ -450,7 +430,7 @@ void ConvListItem::onAction(BubbleViewItem &item) { MSG_LOG(""); - switch(item.getEntity().getType()) + switch (item.getEntity().getType()) { case BubbleEntity::DownloadButtonItem: { @@ -464,7 +444,7 @@ void ConvListItem::onAction(BubbleViewItem &item) default: { const std::string &filePath = item.getEntity().getFilePath(); - if(!filePath.empty()) + if (!filePath.empty()) FileViewer::getInst().launchWithCopy(filePath); break; } @@ -475,7 +455,7 @@ void ConvListItem::onCopyTextItemPressed(PopupListItem &item) { 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()); } @@ -490,7 +470,7 @@ void ConvListItem::onForwardItemPressed(PopupListItem &item) { MSG_LOG(""); item.getParent().destroy(); - if(m_pListener) + if (m_pListener) m_pListener->onForwardMsg(*this); } @@ -511,7 +491,7 @@ void ConvListItem::onSlideShowItemPressed(PopupListItem &item) { MSG_LOG(""); item.getParent().destroy(); - if(m_pListener) + if (m_pListener) m_pListener->onSlideShow(*this); } @@ -519,7 +499,7 @@ void ConvListItem::onEditItemPressed(PopupListItem &item) { MSG_LOG(""); item.getParent().destroy(); - if(m_pListener) + if (m_pListener) m_pListener->onEditDraftMsg(*this); } @@ -527,7 +507,7 @@ void ConvListItem::onSaveAttachmentsItemPressed(PopupListItem &item) { MSG_LOG(""); item.getParent().destroy(); - if(m_pListener) + if (m_pListener) m_pListener->onSaveAttachments(*this); } @@ -547,7 +527,7 @@ void ConvListItem::onViewDetailsItemPressed(PopupListItem &item) void ConvListItem::onEditButtonClicked(Evas_Object *obj, void *event_info) { MSG_LOG(""); - if(m_pListener) + if (m_pListener) m_pListener->onEditDraftMsg(*this); } @@ -567,7 +547,7 @@ void ConvListItem::onFailedResendButtonClicked(Popup &popup, int buttonId) { MSG_LOG(""); popup.destroy(); - if(m_pListener) + if (m_pListener) m_pListener->onResendMsg(*this); } diff --git a/src/Conversation/ConvList/Controller/src/DateLineItem.cpp b/src/Conversation/ConvList/Controller/src/DateLineItem.cpp index 7c17df9..7e5192a 100644 --- a/src/Conversation/ConvList/Controller/src/DateLineItem.cpp +++ b/src/Conversation/ConvList/Controller/src/DateLineItem.cpp @@ -23,19 +23,16 @@ DateLineItem::DateLineItem(time_t dateTime) : 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() diff --git a/src/Conversation/ConvList/Controller/src/MsgDetailsPopup.cpp b/src/Conversation/ConvList/Controller/src/MsgDetailsPopup.cpp index 1ce7782..be79a87 100644 --- a/src/Conversation/ConvList/Controller/src/MsgDetailsPopup.cpp +++ b/src/Conversation/ConvList/Controller/src/MsgDetailsPopup.cpp @@ -56,26 +56,22 @@ void MsgDetailsPopup::updateContent() 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); diff --git a/src/Conversation/ConvList/View/src/BubbleBgViewItem.cpp b/src/Conversation/ConvList/View/src/BubbleBgViewItem.cpp index 2e53d60..e0e1396 100644 --- a/src/Conversation/ConvList/View/src/BubbleBgViewItem.cpp +++ b/src/Conversation/ConvList/View/src/BubbleBgViewItem.cpp @@ -30,7 +30,7 @@ BubbleBgViewItem::BubbleBgViewItem(BubbleEntity &entity, Evas_Object *parent, Bg , m_BgType(bgType) { const char *group = nullptr; - switch(bgType) + switch (bgType) { case SentStyle: group = "conv/list/bubble_sent_bg"; @@ -52,12 +52,10 @@ BubbleBgViewItem::BubbleBgViewItem(BubbleEntity &entity, Evas_Object *parent, 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 @@ -88,7 +86,7 @@ std::string BubbleBgViewItem::applyColor(const std::string &text, BgType bgType) 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); diff --git a/src/Conversation/ConvList/View/src/BubbleDownloadButtonViewItem.cpp b/src/Conversation/ConvList/View/src/BubbleDownloadButtonViewItem.cpp index eda23ef..a116172 100644 --- a/src/Conversation/ConvList/View/src/BubbleDownloadButtonViewItem.cpp +++ b/src/Conversation/ConvList/View/src/BubbleDownloadButtonViewItem.cpp @@ -32,7 +32,6 @@ BubbleDownloadButtonViewItem::BubbleDownloadButtonViewItem(BubbleEntity &entity, BubbleDownloadButtonViewItem::~BubbleDownloadButtonViewItem() { - } void BubbleDownloadButtonViewItem::disabled(bool status) diff --git a/src/Conversation/ConvList/View/src/BubbleIconTextLayoutItem.cpp b/src/Conversation/ConvList/View/src/BubbleIconTextLayoutItem.cpp index 0a99271..e6596cb 100644 --- a/src/Conversation/ConvList/View/src/BubbleIconTextLayoutItem.cpp +++ b/src/Conversation/ConvList/View/src/BubbleIconTextLayoutItem.cpp @@ -29,7 +29,7 @@ BubbleIconTextLayoutItem::BubbleIconTextLayoutItem(BubbleEntity &entity, Evas_Ob , m_pIconTextLayout(nullptr) { const char *group = nullptr; - switch(layoutType) + switch (layoutType) { case Layout1Icon1Text: group = "conv/list/1icon_1text"; diff --git a/src/Conversation/ConvList/View/src/BubbleImageViewItem.cpp b/src/Conversation/ConvList/View/src/BubbleImageViewItem.cpp index d15c4bb..4caed2c 100644 --- a/src/Conversation/ConvList/View/src/BubbleImageViewItem.cpp +++ b/src/Conversation/ConvList/View/src/BubbleImageViewItem.cpp @@ -43,7 +43,7 @@ Evas_Object *BubbleImageViewItem::createImage(Evas_Object *parent, const std::st 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; diff --git a/src/Conversation/ConvList/View/src/BubbleItemContainer.cpp b/src/Conversation/ConvList/View/src/BubbleItemContainer.cpp index 22c7894..2e071f5 100644 --- a/src/Conversation/ConvList/View/src/BubbleItemContainer.cpp +++ b/src/Conversation/ConvList/View/src/BubbleItemContainer.cpp @@ -44,7 +44,7 @@ BubbleItemContainer::~BubbleItemContainer() 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); diff --git a/src/Conversation/ConvList/View/src/BubbleTextViewItem.cpp b/src/Conversation/ConvList/View/src/BubbleTextViewItem.cpp index bc478f5..2c3f7d2 100644 --- a/src/Conversation/ConvList/View/src/BubbleTextViewItem.cpp +++ b/src/Conversation/ConvList/View/src/BubbleTextViewItem.cpp @@ -32,7 +32,7 @@ BubbleTextViewItem::~BubbleTextViewItem() 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); diff --git a/src/Conversation/ConvList/View/src/BubbleVideoViewItem.cpp b/src/Conversation/ConvList/View/src/BubbleVideoViewItem.cpp index 852858d..5db82a0 100644 --- a/src/Conversation/ConvList/View/src/BubbleVideoViewItem.cpp +++ b/src/Conversation/ConvList/View/src/BubbleVideoViewItem.cpp @@ -42,7 +42,7 @@ Evas_Object *BubbleVideoViewItem::createIamge(Evas_Object *parent, const std::st 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; diff --git a/src/Conversation/ConvList/View/src/BubbleViewItem.cpp b/src/Conversation/ConvList/View/src/BubbleViewItem.cpp index b5f5e8c..9f25909 100644 --- a/src/Conversation/ConvList/View/src/BubbleViewItem.cpp +++ b/src/Conversation/ConvList/View/src/BubbleViewItem.cpp @@ -29,7 +29,6 @@ BubbleViewItem::BubbleViewItem(BubbleEntity &entity) BubbleViewItem::~BubbleViewItem() { - } void BubbleViewItem::setListener(IBubbleViewItemListener *l) @@ -51,52 +50,46 @@ void BubbleViewItem::attachGestureTapLayer(Evas_Object *parent, Evas_Object *obj 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(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"; @@ -104,7 +97,7 @@ void BubbleViewItem::showDelButton(bool show) 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); @@ -123,12 +116,12 @@ void BubbleViewItem::calculate() 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); } diff --git a/src/Conversation/ConvList/View/src/ComposeListViewItem.cpp b/src/Conversation/ConvList/View/src/ComposeListViewItem.cpp index 4005f80..4e11c8b 100644 --- a/src/Conversation/ConvList/View/src/ComposeListViewItem.cpp +++ b/src/Conversation/ConvList/View/src/ComposeListViewItem.cpp @@ -35,12 +35,11 @@ ComposeListViewItem::ComposeListViewItem() ComposeListViewItem::~ComposeListViewItem() { - } Evas_Object *ComposeListViewItem::getContent(ListItem &item, const char *part) { - if(!strcmp(part, bubbleContentPart)) + if (!strcmp(part, bubbleContentPart)) return getBubbleContent(); return nullptr; diff --git a/src/Conversation/ConvList/View/src/ConvListLayout.cpp b/src/Conversation/ConvList/View/src/ConvListLayout.cpp index bc7d57d..a79634f 100644 --- a/src/Conversation/ConvList/View/src/ConvListLayout.cpp +++ b/src/Conversation/ConvList/View/src/ConvListLayout.cpp @@ -30,7 +30,6 @@ ConvListLayout::ConvListLayout(Evas_Object *parent) ConvListLayout::~ConvListLayout() { - } void ConvListLayout::showSelectAllMode(bool value) diff --git a/src/Conversation/ConvList/View/src/ConvListViewItem.cpp b/src/Conversation/ConvList/View/src/ConvListViewItem.cpp index 9c14405..c732c1f 100644 --- a/src/Conversation/ConvList/View/src/ConvListViewItem.cpp +++ b/src/Conversation/ConvList/View/src/ConvListViewItem.cpp @@ -48,14 +48,13 @@ ConvListViewItem::ConvListViewItem(ConvItemType type) 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 ""; @@ -63,24 +62,16 @@ std::string ConvListViewItem::getText(ListItem &item, const char *part) 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; @@ -94,39 +85,34 @@ const char *ConvListViewItem::getCheckPart(ListItem &item) 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); } @@ -150,20 +136,20 @@ Evas_Object *ConvListViewItem::createProgress() 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", "*"); } @@ -179,7 +165,7 @@ void ConvListViewItem::updateProgress() void ConvListViewItem::updateItemType(ConvItemType type) { - if(type == m_Type || type == InitType) + if (type == m_Type || type == InitType) return; m_Type = type; @@ -204,7 +190,7 @@ void ConvListViewItem::updateItemType(ConvItemType type) void ConvListViewItem::resetCheckMode(ListView &listView) { - for(ListItem *item: listView.getRealizedItems()) + for (ListItem *item: listView.getRealizedItems()) { item->emitSignal("elm,state,default", "elm"); } diff --git a/src/Conversation/ConvList/View/src/ConvSelectAll.cpp b/src/Conversation/ConvList/View/src/ConvSelectAll.cpp index 4ae98ff..de64ad4 100644 --- a/src/Conversation/ConvList/View/src/ConvSelectAll.cpp +++ b/src/Conversation/ConvList/View/src/ConvSelectAll.cpp @@ -40,7 +40,6 @@ ConvSelectAll::ConvSelectAll(Evas_Object *parent) ConvSelectAll::~ConvSelectAll() { - } void ConvSelectAll::setText(const std::string &text) diff --git a/src/Conversation/ConvList/View/src/DateLineViewItem.cpp b/src/Conversation/ConvList/View/src/DateLineViewItem.cpp index 61a4e9a..a79ff1d 100644 --- a/src/Conversation/ConvList/View/src/DateLineViewItem.cpp +++ b/src/Conversation/ConvList/View/src/DateLineViewItem.cpp @@ -48,7 +48,7 @@ void DateLineViewItem::setDateLine(const std::string &dateLine) std::string DateLineViewItem::getText(ListItem &item, const char *part) { - if(!strcmp(part, datePart)) + if (!strcmp(part, datePart)) return m_DateLine; else return ""; diff --git a/src/Conversation/Main/Controller/src/Conversation.cpp b/src/Conversation/Main/Controller/src/Conversation.cpp index 9a523f4..e3b7ec5 100644 --- a/src/Conversation/Main/Controller/src/Conversation.cpp +++ b/src/Conversation/Main/Controller/src/Conversation.cpp @@ -39,7 +39,7 @@ namespace { 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 += " ("; @@ -74,19 +74,19 @@ Conversation::~Conversation() 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; @@ -98,31 +98,29 @@ void Conversation::execCmd(const AppControlComposeRef &cmd) { 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); } @@ -130,26 +128,24 @@ void Conversation::execCmd(const AppControlDefaultRef &cmd) { 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; @@ -157,11 +153,11 @@ void Conversation::execCmd(const AppControlDefaultRef &cmd) 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); @@ -181,7 +177,7 @@ void Conversation::create() 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); } @@ -191,23 +187,19 @@ void Conversation::recipientClickHandler(const std::string &address) 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); } } @@ -227,17 +219,15 @@ void Conversation::showUnsavedRecipientPopup(const std::string &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)); @@ -270,7 +260,7 @@ void Conversation::navigateToBottom() 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); @@ -280,7 +270,7 @@ void Conversation::setThreadId(ThreadId id, const char *searchWord, bool updateC { MSG_LOG("Thread id = ", id); m_ThreadId = id; - if(id.isValid()) + if (id.isValid()) m_AddressList = getMsgEngine().getStorage().getAddressList(id); else m_AddressList.reset(); @@ -288,13 +278,13 @@ void Conversation::setThreadId(ThreadId id, const char *searchWord, bool updateC 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(); @@ -307,7 +297,7 @@ void Conversation::resetMsgThread(bool updateConvList, bool updateRecipPanel) { m_IsMms = false; m_DispIsMms = false; - if(m_NnotifyConvertMsgTypeIdler) + if (m_NnotifyConvertMsgTypeIdler) { ecore_idler_del(m_NnotifyConvertMsgTypeIdler); m_NnotifyConvertMsgTypeIdler = nullptr; @@ -317,7 +307,7 @@ void Conversation::resetMsgThread(bool updateConvList, bool updateRecipPanel) 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); @@ -333,10 +323,10 @@ void Conversation::setListener(IConversationListener *listener) 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); } @@ -349,10 +339,10 @@ MsgAddressListRef Conversation::getAddressList() void Conversation::setMode(Mode mode) { - if(m_Mode == mode) + if (m_Mode == mode) return; - switch(mode) + switch (mode) { case NewMessageMode: setNewMessageMode(); @@ -393,14 +383,12 @@ void Conversation::setConversationMode() 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); @@ -408,21 +396,19 @@ void Conversation::setConversationMode() 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); } } @@ -437,9 +423,9 @@ void Conversation::createMainLayout() 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)); @@ -447,10 +433,8 @@ void Conversation::showConvList(bool show) m_pConvList->show(); m_pLayout->setConvList(*m_pConvList); } - } - else - { - if(m_pConvList) + } else { + if (m_pConvList) { m_pConvList->setListener(nullptr); m_pConvList->destroy(); @@ -461,9 +445,9 @@ void Conversation::showConvList(bool show) 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); @@ -471,10 +455,8 @@ void Conversation::showRecipPanel(bool show) 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; @@ -484,18 +466,16 @@ void Conversation::showRecipPanel(bool show) 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; @@ -506,13 +486,13 @@ void Conversation::showContactList(bool show) 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); @@ -523,13 +503,13 @@ void Conversation::createMsgInputPanel() 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(); @@ -540,28 +520,28 @@ void Conversation::destroyMsgInputPanel() 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; } @@ -571,18 +551,16 @@ bool Conversation::read(Message &msg) 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(); @@ -593,11 +571,11 @@ bool Conversation::readMsgAddress(Message &msg) 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"; @@ -618,13 +596,13 @@ void Conversation::handleSendResult(const Message &msg, MsgTransport::SendResult 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; @@ -636,12 +614,12 @@ bool Conversation::checkBeforeSend(const Message &msg) std::vector Conversation::getMsgIdListForReadReport() const { std::vector 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()); } } @@ -651,11 +629,11 @@ std::vector Conversation::getMsgIdListForReadReport() const 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; @@ -668,7 +646,7 @@ bool Conversation::sendReadReportIfNeeded() void Conversation::sendReadReport(MsgReport::ReadStatus status) { auto ids = getMsgIdListForReadReport(); - for(MsgId id : ids) + for (MsgId id : ids) { getMsgEngine().getTransport().sendReadReport(id, status); } @@ -677,7 +655,7 @@ void Conversation::sendReadReport(MsgReport::ReadStatus 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); @@ -686,17 +664,17 @@ void Conversation::sendMessage(MsgId msgId) 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); @@ -705,29 +683,27 @@ void Conversation::sendMessage() 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); @@ -740,19 +716,19 @@ MsgId Conversation::saveDraftMsg() 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}); @@ -765,21 +741,20 @@ void Conversation::createNewMsgThread() { 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 ? @@ -789,8 +764,7 @@ void Conversation::notifyConvertMsgType() } return false; // Delete idler }, - this - ); + this); } } @@ -807,10 +781,10 @@ void Conversation::checkAndSetMsgType(bool force) 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(); @@ -847,17 +821,15 @@ void Conversation::navigateToSlideShow(MsgId id) 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); } } @@ -865,24 +837,22 @@ void Conversation::setBodyFocus() 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); } } @@ -899,28 +869,26 @@ void Conversation::showSendDpmNotif(const MsgAddressList &addressList) 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 += "
"; } } - 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(); @@ -968,18 +936,16 @@ void Conversation::showMainPopup() { 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, @@ -988,22 +954,20 @@ void Conversation::showMainPopup() 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(); @@ -1015,33 +979,33 @@ void Conversation::onKeyDown(ConvRecipientsPanel &panel, Evas_Event_Key_Down &ev 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 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); @@ -1064,16 +1028,14 @@ void Conversation::onChanged(Body &body) 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(); @@ -1091,14 +1053,12 @@ void Conversation::updateNavibar() 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); @@ -1106,14 +1066,12 @@ void Conversation::updateNavibar() 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); @@ -1124,10 +1082,10 @@ void Conversation::updateNavibar() 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")); @@ -1138,7 +1096,7 @@ void Conversation::onButtonClicked(MessageInputPanel &obj, MessageInputPanel::Bu { MSG_LOG("MessageInputPanel: button clicked: id = ", id); - switch(id) + switch (id) { case MessageInputPanel::AddButtonId: m_AttachPanel.show(true); @@ -1161,7 +1119,7 @@ void Conversation::onContactSelected(ContactListItem &item) void Conversation::onContactListChanged() { - if(m_pContactsList) + if (m_pContactsList) m_pLayout->showContactList(!m_pContactsList->isEmpty()); } @@ -1176,7 +1134,7 @@ void Conversation::onAttached(ViewItem &item) void Conversation::onTransitionFinished(NaviFrameItem &item) { MSG_LOG(""); - if(m_TransFinishedFunc) + if (m_TransFinishedFunc) { m_TransFinishedFunc(); m_TransFinishedFunc = nullptr; @@ -1198,26 +1156,26 @@ void Conversation::onResume() 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(); @@ -1228,14 +1186,14 @@ void Conversation::onHwBackButtonClicked() 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); @@ -1245,14 +1203,12 @@ void Conversation::onNaviOkButtonClicked() 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()); } } @@ -1260,7 +1216,7 @@ void Conversation::onNaviCenterButtonClicked() void Conversation::onNaviExpandButtonClicked() { MSG_LOG(""); - if(m_pRecipPanel) + if (m_pRecipPanel) { bool isMbeInvisible = !m_pRecipPanel->isMbeVisible(); m_pRecipPanel->showMbe(isMbeInvisible); @@ -1270,7 +1226,7 @@ void Conversation::onNaviExpandButtonClicked() void Conversation::onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId) { - switch(buttonId) + switch (buttonId) { case NaviPrevButtonId: onHwBackButtonClicked(); @@ -1313,7 +1269,7 @@ void Conversation::onSendReadReportPopupDel(Evas_Object *popup, void *eventInfo) void Conversation::onSendReadReportPopupButtonClicked(Popup &popup, int buttonId) { MSG_LOG(""); - if(buttonId == Popup::OkButtonId) + if (buttonId == Popup::OkButtonId) sendReadReport(MsgReport::ReadStatusIsRead); popup.destroy(); } @@ -1321,7 +1277,7 @@ void Conversation::onSendReadReportPopupButtonClicked(Popup &popup, int buttonId void Conversation::onRecipPopupDel(Evas_Object *popup, void *eventInfo) { MSG_LOG(""); - if(m_pRecipPanel) + if (m_pRecipPanel) m_pRecipPanel->unselectMbeItem(); } @@ -1340,44 +1296,40 @@ void Conversation::onMsgSettingsButtonClicked(Popup &popup, int buttonId) 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(); } @@ -1395,7 +1347,7 @@ void Conversation::onAddRecipientsItemPressed(PopupListItem &item) if (m_AttachPanel.isFullExpanded()) m_AttachPanel.show(false); createNewMsgThread(); - if(m_pRecipPanel) + if (m_pRecipPanel) m_pRecipPanel->setEntryFocus(true); } @@ -1450,20 +1402,18 @@ void Conversation::onViewContactDetailsItemPressed(PopupListItem &item) 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); } } diff --git a/src/Conversation/Main/View/src/MessageInputPanel.cpp b/src/Conversation/Main/View/src/MessageInputPanel.cpp index 81f22d9..775e1fd 100644 --- a/src/Conversation/Main/View/src/MessageInputPanel.cpp +++ b/src/Conversation/Main/View/src/MessageInputPanel.cpp @@ -44,7 +44,6 @@ MessageInputPanel::MessageInputPanel(Evas_Object *parent) MessageInputPanel::~MessageInputPanel() { - } void MessageInputPanel::create(Evas_Object *parent) @@ -90,7 +89,7 @@ void MessageInputPanel::setDisabledColor(Evas_Object *button) Evas_Object *MessageInputPanel::getButton(ButtonId id) { - switch(id) + switch (id) { case AddButtonId: return m_pAddButton; @@ -111,7 +110,7 @@ Evas_Object *MessageInputPanel::getButton(ButtonId id) 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); @@ -122,7 +121,7 @@ Evas_Object *MessageInputPanel::createButton(Evas_Object *parent, ButtonId butto 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); @@ -138,7 +137,7 @@ void MessageInputPanel::disabledButton(ButtonId id, bool val) Evas_Object *btn = getButton(id); elm_object_disabled_set(btn, val); - if(val) + if (val) setDisabledColor(btn); else setNormalColor(btn); @@ -156,7 +155,7 @@ void MessageInputPanel::setListener(IMessageInputPanelListener *l) 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); diff --git a/src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp b/src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp index eecd47b..ac62108 100644 --- a/src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp +++ b/src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp @@ -47,7 +47,7 @@ ConvRecipientsPanel::~ConvRecipientsPanel() void ConvRecipientsPanel::read(Message &msg) { auto list = m_pMbe->getItems(); - for(auto it : list) + for (auto it : list) { MbeRecipientItem *recipItem = static_cast(it); MsgAddress &msgAddr = msg.addAddress(); @@ -56,7 +56,7 @@ void ConvRecipientsPanel::read(Message &msg) msgAddr.setAddressType(recipItem->getAddressType()); } - if(list.empty()) + if (list.empty()) { showInvalidIcon(true); showAddRecipNotif(); @@ -72,10 +72,10 @@ void ConvRecipientsPanel::write(const Message &msg) bool ConvRecipientsPanel::isMms() const { auto items = m_pMbe->getItems(); - for(MbeRecipientItem *it : items) + for (MbeRecipientItem *it : items) { MbeRecipientItem *item = static_cast(it); - if(item->getAddressType() == MsgAddress::Email) + if (item->getAddressType() == MsgAddress::Email) return true; } return false; @@ -93,22 +93,22 @@ bool ConvRecipientsPanel::addRecipientsFromEntry(bool showPopup) 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; @@ -130,7 +130,7 @@ void ConvRecipientsPanel::update(const MsgAddressList &addressList) { 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()); @@ -159,7 +159,7 @@ MbeRecipients::AppendItemStatus ConvRecipientsPanel::appendItem(const std::strin void ConvRecipientsPanel::execCmd(const AppControlComposeRef &cmd) { m_pMbe->clear(); - for(auto recipStr: cmd->getRecipientList()) + for (auto recipStr: cmd->getRecipientList()) { appendStatusHandler(appendItem(recipStr)); } @@ -172,11 +172,11 @@ int ConvRecipientsPanel::getMaxRecipientCount() const 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: @@ -200,17 +200,15 @@ void ConvRecipientsPanel::appendStatusHandler(MbeRecipients::AppendItemStatus st 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); } } @@ -221,38 +219,36 @@ void ConvRecipientsPanel::onEntryFocusChanged() 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); } @@ -260,7 +256,7 @@ void ConvRecipientsPanel::onContactButtonClicked() { MSG_LOG(""); int currentRecipientsCount = getItemsCount(); - if(currentRecipientsCount < getMaxRecipientCount()) + if (currentRecipientsCount < getMaxRecipientCount()) m_Picker.launch(getMaxRecipientCount() - currentRecipientsCount); else showTooManyRecipientsNotif(); @@ -277,26 +273,26 @@ void ConvRecipientsPanel::onContactsPicked(const std::list &addressI 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); @@ -344,21 +340,21 @@ void ConvRecipientsPanel::showAddRecipNotif() 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(); } diff --git a/src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp b/src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp index 610daee..10b6aac 100644 --- a/src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp +++ b/src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp @@ -62,10 +62,10 @@ void ConvRecipientsPanelView::setMbe(MbeRecipientsView *pMbe) 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; @@ -123,7 +123,7 @@ void ConvRecipientsPanelView::showMbe(bool show, bool animation) { 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"; @@ -133,7 +133,7 @@ void ConvRecipientsPanelView::showMbe(bool show, bool animation) void ConvRecipientsPanelView::showEntry(bool show) { - if(show) + if (show) getEntry(); const char *sig = show ? "show_entry" : "hide_entry"; emitSignal(m_pLayout, sig, "*"); @@ -158,7 +158,7 @@ std::string ConvRecipientsPanelView::getEntryText() const 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); @@ -187,7 +187,7 @@ void ConvRecipientsPanelView::create(Evas_Object *parent) Evas_Object *ConvRecipientsPanelView::getEntry() { - if(m_pEntryLayout) + if (m_pEntryLayout) return m_pEntryLayout; m_pEntryLayout = elm_layout_add(m_pLayout); @@ -249,7 +249,7 @@ Evas_Object *ConvRecipientsPanelView::createClearButton(Evas_Object *parent) Evas_Object *ConvRecipientsPanelView::getContactBtn() { - if(m_pContactBtn) + if (m_pContactBtn) { evas_object_show(m_pContactBtn); return m_pContactBtn; @@ -280,7 +280,7 @@ Evas_Object *ConvRecipientsPanelView::getContactBtn() Evas_Object *ConvRecipientsPanelView::getPlusBtn() { - if(m_pPlusBtn) + if (m_pPlusBtn) { evas_object_show(m_pPlusBtn); return m_pPlusBtn; @@ -338,10 +338,10 @@ void ConvRecipientsPanelView::setContactBtnColor(Evas_Object *btn, int r, int g, 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(); @@ -352,13 +352,11 @@ void ConvRecipientsPanelView::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); } } @@ -371,7 +369,7 @@ bool ConvRecipientsPanelView::isEntryEmpty() const 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); } @@ -379,7 +377,7 @@ unsigned int ConvRecipientsPanelView::getItemsCount() const { 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; } @@ -395,12 +393,10 @@ void ConvRecipientsPanelView::collapseRecipients() void ConvRecipientsPanelView::expandRecipients() { showMbe(!isMbeEmpty()); - if(!m_IsEditItemClicked) + if (!m_IsEditItemClicked) { setEntryText(m_SavedRecipText); - } - else - { + } else { setEditMode(false); setEntryText(""); } @@ -410,10 +406,10 @@ void ConvRecipientsPanelView::updateShortenedRecipients() { 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); } @@ -422,13 +418,13 @@ void ConvRecipientsPanelView::updateShortenedRecipients() 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); } @@ -437,10 +433,10 @@ void ConvRecipientsPanelView::editSelectedItem() void ConvRecipientsPanelView::removeSelectedItem() { MbeRecipientItem* pItem = getSelectedItem(); - if(pItem) + if (pItem) { pItem->destroy(); - if(isMbeEmpty()) + if (isMbeEmpty()) showMbe(false, false); } } @@ -483,13 +479,12 @@ void ConvRecipientsPanelView::onEntryClicked(Evas_Object *obj, void *event_info) 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); } diff --git a/src/Conversation/Utils/src/AttachmentHandler.cpp b/src/Conversation/Utils/src/AttachmentHandler.cpp index b072b50..ea646fd 100644 --- a/src/Conversation/Utils/src/AttachmentHandler.cpp +++ b/src/Conversation/Utils/src/AttachmentHandler.cpp @@ -35,13 +35,13 @@ AttachmentHandler::~AttachmentHandler() { 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 _lock(m_Mutex); @@ -58,7 +58,7 @@ void AttachmentHandler::setListener(IAttachmentHandlerListener *listener) void *AttachmentHandler::safeCallOnFreeSpaceRequest(void *data) { auto *self = static_cast(data); - if(self->m_pListener) + if (self->m_pListener) self->m_CurrentFreeSpace = self->m_pListener->onFreeSpaceRequest(); return nullptr; } @@ -66,7 +66,7 @@ void *AttachmentHandler::safeCallOnFreeSpaceRequest(void *data) void *AttachmentHandler::safeCallOnFileReady(void *data) { auto *self = static_cast(data); - if(self->m_pListener) + if (self->m_pListener) self->m_pListener->onFileReady(self->m_CurrentFile); return nullptr; } @@ -74,26 +74,26 @@ void *AttachmentHandler::safeCallOnFileReady(void *data) void *AttachmentHandler::safeCallOnFileFails(void *data) { auto *self = static_cast(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 _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); @@ -101,7 +101,7 @@ void AttachmentHandler::onRoutine() } 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); @@ -109,10 +109,10 @@ void AttachmentHandler::onRoutine() } 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); diff --git a/src/Conversation/Utils/src/MessageDetailContent.cpp b/src/Conversation/Utils/src/MessageDetailContent.cpp index e5d795e..9a5392c 100644 --- a/src/Conversation/Utils/src/MessageDetailContent.cpp +++ b/src/Conversation/Utils/src/MessageDetailContent.cpp @@ -52,7 +52,7 @@ std::string getMessageType(Message::Type msgType) std::string msgDetails = makeMainText(msg("IDS_MSG_POP_TYPE")); msgDetails.append("
"); - switch(msgType) + switch (msgType) { case Message::MT_SMS: msgDetails.append(makeSecondText(msg("IDS_MSGF_OPT_TEXT_MESSAGE"))); @@ -75,24 +75,24 @@ std::string getContactsInfo(App &app, Message::Direction msgDirection, ThreadId 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("
"); } - if(msgDirection == Message::MD_Received) + if (msgDirection == Message::MD_Received) { contactsInfo.append(makeMainText(msg("IDS_MSG_BODY_FROM_ABB_M_PERIOD"))); contactsInfo.append("
"); } 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("

"); @@ -103,9 +103,9 @@ std::string getContactsInfo(App &app, Message::Direction msgDirection, ThreadId 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("
"); @@ -119,16 +119,16 @@ std::string makeDeliveryReportResult(App &app, Message::NetworkStatus msgStatus, 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("
"); @@ -136,7 +136,7 @@ std::string makeDeliveryReportResult(App &app, Message::NetworkStatus msgStatus, deliverText.append(makeSecondText(": ")); MsgReport::DeliveryStatus deliveryStatus = report.getDeliveryStatus(); - switch(deliveryStatus) + switch (deliveryStatus) { case MsgReport::StatusSuccess: { @@ -161,14 +161,12 @@ std::string makeDeliveryReportResult(App &app, Message::NetworkStatus msgStatus, } } } - if(!isDelivReportExists) + if (!isDelivReportExists) { deliverText.append("
"); deliverText.append(makeSecondText(msg("IDS_MSGF_BODY_UNKNOWN"))); } - } - else - { + } else { deliverText.append("
"); deliverText.append(makeSecondText(msg("IDS_MSGC_BODY_NOT_REQUESTED"))); } @@ -182,7 +180,7 @@ std::string getSmsStatus(Message::NetworkStatus msgStatus) std::string status = makeMainText(msg("IDS_MSG_BODY_STATUS_C")); status.append("
"); - switch(msgStatus) + switch (msgStatus) { case Message::NS_Sending: status.append(makeSecondText(msg("IDS_MSG_BODY_SENDING_ING_M_STATUS_ABB"))); @@ -210,11 +208,11 @@ std::string getMmsSubject(const Message &message, int style) { std::string msgDetails; std::string subject = message.getSubject(); - switch(style) + switch (style) { case ViewDetailsTextStyle: msgDetails.append(makeMainText(msg("IDS_MSG_HEADER_SUBJECT"))).append("
"); - if(subject.empty()) + if (subject.empty()) msgDetails.append(makeSecondText(msg("IDS_MSGF_BODY_NO_SUBJECT"))); else msgDetails.append(makeSecondText(subject)); @@ -224,7 +222,7 @@ std::string getMmsSubject(const Message &message, int style) 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); @@ -243,7 +241,7 @@ std::string getMmsMessageSize(const Message &message, int style) { int msgSize = message.getSize(); std::string msgDetails; - switch(style) + switch (style) { case ViewDetailsTextStyle: msgDetails.append(makeMainText(msg("IDS_MSGF_BODY_MESSAGE_SIZE"))); @@ -268,13 +266,13 @@ std::string getMmsMessageExpired(const Message &message, int style) { const MessageMms *mms = dynamic_cast(&message); std::string msgDetails; - switch(style) + switch (style) { case ViewDetailsTextStyle: msgDetails.append("

"); msgDetails.append(makeMainText(msg("IDS_MSG_BODY_EXPIRES_ON_C"))); msgDetails.append("
"); - if(mms) + if (mms) { time_t msgExpired = mms->getExpired(); msgDetails.append(makeSecondText(TimeUtils::makeDateString(msgExpired))); @@ -283,7 +281,7 @@ std::string getMmsMessageExpired(const Message &message, int style) 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)); @@ -301,17 +299,17 @@ std::string makeReadReportResult(App &app, MsgId msgId, ThreadId msgThreadId, Me { 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("
"); @@ -319,7 +317,7 @@ std::string makeReadReportResult(App &app, MsgId msgId, ThreadId msgThreadId, Me readReport.append(makeSecondText(": ")); MsgReport::ReadStatus readStatus = report.getReadStatus(); - switch(readStatus) + switch (readStatus) { case MsgReport::ReadStatusIsRead: { @@ -344,14 +342,12 @@ std::string makeReadReportResult(App &app, MsgId msgId, ThreadId msgThreadId, Me } } - if(!isReadReportExists) + if (!isReadReportExists) { readReport.append("
"); readReport.append(makeSecondText(msg("IDS_MSGF_BODY_UNKNOWN"))); } - } - else - { + } else { readReport.append("
"); readReport.append(makeSecondText(msg("IDS_MSGC_BODY_NOT_REQUESTED"))); } @@ -365,19 +361,19 @@ std::string makeDispAddress(App &app, const std::string &address) 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; diff --git a/src/Conversation/Utils/src/WorkingDir.cpp b/src/Conversation/Utils/src/WorkingDir.cpp index 018f551..dc46f2a 100644 --- a/src/Conversation/Utils/src/WorkingDir.cpp +++ b/src/Conversation/Utils/src/WorkingDir.cpp @@ -46,20 +46,20 @@ void WorkingDir::createWorkingDir() // 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; } @@ -68,7 +68,7 @@ void WorkingDir::createWorkingDir() 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); @@ -96,22 +96,18 @@ std::string WorkingDir::addFile(const std::string &path) std::lock_guard _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(); } @@ -129,13 +125,11 @@ std::string WorkingDir::addTextFile(const std::string &text, const std::string & 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(); } @@ -145,7 +139,7 @@ std::string WorkingDir::addTextFile(const std::string &text, const std::string & void WorkingDir::removeFile(const std::string &path) { std::lock_guard _lock(m_Mutex); - if(!path.empty()) + if (!path.empty()) FileUtils::remove(path); } @@ -164,6 +158,6 @@ std::string WorkingDir::getUniqueDirName(const std::string &path) res = path + "-" + std::to_string(i); ++i; } - while(FileUtils::isExists(res)); + while (FileUtils::isExists(res)); return res; }