From: Evgen Servetnik Date: Wed, 23 Aug 2017 13:29:42 +0000 (+0300) Subject: TizenRefApp-9196 Fix sonar issues X-Git-Tag: submit/tizen/20170831.131829~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7dc3ff18792fdb005a8f67351d16bbb7b743b6e6;p=profile%2Fmobile%2Fapps%2Fnative%2Fmessage.git TizenRefApp-9196 Fix sonar issues Change-Id: Ifad94f9fdabe136cc1f0d003818f7c799836c4d6 Signed-off-by: Evgen Servetnik --- diff --git a/src/Common/Controller/src/SaveAttachments.cpp b/src/Common/Controller/src/SaveAttachments.cpp index e0a662b6..034aa322 100644 --- a/src/Common/Controller/src/SaveAttachments.cpp +++ b/src/Common/Controller/src/SaveAttachments.cpp @@ -221,9 +221,6 @@ bool SaveAttachments::shouldEnableSaveBtn() const bool SaveAttachments::saveCheckedItems() { - std::string filePathDst; - std::string dowloadPath = PathUtils::getDownloadPath(); - auto items = m_pList->getItems(); std::list files; diff --git a/src/Common/MsgEngine/src/MsgEngine.cpp b/src/Common/MsgEngine/src/MsgEngine.cpp index f8a85f00..5e206d34 100644 --- a/src/Common/MsgEngine/src/MsgEngine.cpp +++ b/src/Common/MsgEngine/src/MsgEngine.cpp @@ -406,7 +406,6 @@ void MsgEngine::calculateTextMetric(const std::string &text, MsgTextMetric &text #ifdef TIZEN_PRIVATE_API const int maxSegments = 3; const int maxGsm7Len = 160; - const int maxUnicodeLen = 70; msg_encode_type_t encode = MSG_ENCODE_GSM7BIT; unsigned textLen = 0; @@ -440,9 +439,10 @@ void MsgEngine::calculateTextMetric(const std::string &text, MsgTextMetric &text segmentLen /= bytesInChar; } - if (segmentLen == 0) + if (segmentLen == 0) { + const int maxUnicodeLen = 70; segmentLen = encode == MSG_ENCODE_UCS2 ? maxUnicodeLen : maxGsm7Len; - + } if (textLen == 0) textLen = text.length() / bytesInChar; diff --git a/src/Common/MsgEngine/src/private/MsgSettingsPrivate.cpp b/src/Common/MsgEngine/src/private/MsgSettingsPrivate.cpp index 8ecaf1a4..244dbe94 100644 --- a/src/Common/MsgEngine/src/private/MsgSettingsPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgSettingsPrivate.cpp @@ -232,10 +232,9 @@ void MsgSettingsPrivate::setMmsAutoRetr(bool value) bool MsgSettingsPrivate::getMmsAutoRetr() const { - bool res = false; int retrType = 0; msg_get_int_value(m_MmsRecvOpt, MSG_MMS_RECVOPT_HOME_RETRIEVE_TYPE_INT, &retrType); - res = retrType == MSG_HOME_AUTO_DOWNLOAD; + bool res = retrType == MSG_HOME_AUTO_DOWNLOAD; return res; } @@ -248,10 +247,9 @@ void MsgSettingsPrivate::setMmsAutoRetrRoaming(bool value) bool MsgSettingsPrivate::getMmsAutoRetrRoaming() const { - bool res = false; int retrType = 0; msg_get_int_value(m_MmsRecvOpt, MSG_MMS_RECVOPT_ABROAD_RETRIEVE_TYPE_INT, &retrType); - res = retrType == MSG_ABROAD_AUTO_DOWNLOAD; + bool res = retrType == MSG_ABROAD_AUTO_DOWNLOAD; return res; } @@ -274,7 +272,7 @@ void MsgSettingsPrivate::addJobSetActiveNotifPolicy(int value) ( [](void *data) { - auto *self =(MsgSettingsPrivate*)data; + auto *self = static_cast(data); self->m_pActiveNotifJob = nullptr; vconf_set_int(VCONFKEY_MESSAGE_ACTIVATED_CONVERSATION_ID, self->m_ActiveNotifValue); MSG_LOG("ActiveNotifValue = ", self->m_ActiveNotifValue); diff --git a/src/Common/Utils/src/FileUtils.cpp b/src/Common/Utils/src/FileUtils.cpp index 0c7b92fa..60b530f2 100755 --- a/src/Common/Utils/src/FileUtils.cpp +++ b/src/Common/Utils/src/FileUtils.cpp @@ -47,10 +47,8 @@ long long FileUtils::getFileSize(const std::string &file) bool FileUtils::isExists(const std::string &file) { - bool res = false; struct stat st = {}; - res = stat(file.c_str(), &st) == 0 || file == "/"; - return res; + return stat(file.c_str(), &st) == 0 || file == "/"; } bool FileUtils::copy(const std::string &src, const std::string &dst) @@ -88,12 +86,8 @@ bool FileUtils::copy(const std::string &src, const std::string &dst) bool FileUtils::makeDir(const std::string &dir) { - bool res = false; - mode_t mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; - res = mkdir(dir.c_str(), mode) == 0; - - return res; + return mkdir(dir.c_str(), mode) == 0; } std::string FileUtils::addFileToDataDir(const std::string &path) diff --git a/src/Common/Utils/src/MediaUtils.cpp b/src/Common/Utils/src/MediaUtils.cpp index 8eb0f9c0..8a58e231 100644 --- a/src/Common/Utils/src/MediaUtils.cpp +++ b/src/Common/Utils/src/MediaUtils.cpp @@ -145,8 +145,7 @@ bool MediaUtils::getVideoFrame(const std::string &videoFilePath, const std::stri if (thumbnail) { const int quality = 90; // JPEG image quality(1 ~ 100) image_util_encode_h encode_h = {}; - bool isOk = false; - isOk = image_util_encode_create(IMAGE_UTIL_JPEG, &encode_h) == IMAGE_UTIL_ERROR_NONE; + bool isOk = image_util_encode_create(IMAGE_UTIL_JPEG, &encode_h) == IMAGE_UTIL_ERROR_NONE; if (!isOk) { free(thumbnail); return false; diff --git a/src/Conversation/Body/Controller/src/Body.cpp b/src/Conversation/Body/Controller/src/Body.cpp index 1a7744c7..14e36955 100644 --- a/src/Conversation/Body/Controller/src/Body.cpp +++ b/src/Conversation/Body/Controller/src/Body.cpp @@ -119,7 +119,6 @@ void Body::addAttachment(const std::string &filePath) void Body::addFileToPage(MessageMms &msg, const std::string &filePath) { - static const int defaultPageDuration = 5000; // msec if (!filePath.empty()) { MsgPage &msgPage = msg.addPage(); MediaTypeData mediaData = getMsgMediaTypeByFileExt(filePath); @@ -128,9 +127,10 @@ void Body::addFileToPage(MessageMms &msg, const std::string &filePath) if (mediaData.type == MsgMedia::VideoType || mediaData.type == MsgMedia::AudioType) pageDuration = MediaUtils::getDuration(filePath); - if (pageDuration <= 0) + if (pageDuration <= 0) { + const int defaultPageDuration = 5000; // msec pageDuration = defaultPageDuration; - + } msgPage.setPageDuration(pageDuration); MsgMedia &media = msgPage.addMedia(); media.setFilePath(filePath); diff --git a/src/Conversation/ConvList/Controller/src/ConvList.cpp b/src/Conversation/ConvList/Controller/src/ConvList.cpp index 2bb38e12..ce75b208 100644 --- a/src/Conversation/ConvList/Controller/src/ConvList.cpp +++ b/src/Conversation/ConvList/Controller/src/ConvList.cpp @@ -257,11 +257,10 @@ void ConvList::demoteItem(ConvListItem *item) void ConvList::dateLineDelIfNec(ConvListItem *item) { - bool needDelDateLine = false; DateLineItem *prev = dynamic_cast(m_pList->getPrevItem(*item)); if (prev) { ListItem *nextItem = m_pList->getNextItem(*item); - needDelDateLine = nextItem ? dynamic_cast(nextItem) == nullptr : true; + bool needDelDateLine = nextItem ? dynamic_cast(nextItem) == nullptr : true; if (needDelDateLine) { m_DateLineItemSet.erase(prev->getDateLine()); m_pList->deleteItem(*prev); diff --git a/src/Conversation/ConvList/View/inc/ConvListViewItem.h b/src/Conversation/ConvList/View/inc/ConvListViewItem.h index 0aaa7f4b..0b3bc06f 100644 --- a/src/Conversation/ConvList/View/inc/ConvListViewItem.h +++ b/src/Conversation/ConvList/View/inc/ConvListViewItem.h @@ -49,7 +49,6 @@ namespace Msg { protected: Evas_Object *createProgress(); - void updateProgress(); void updateContent(); void updateItemType(ConvItemType type); virtual void onRealized(ListItem &item); diff --git a/src/Conversation/ConvList/View/src/ConvListViewItem.cpp b/src/Conversation/ConvList/View/src/ConvListViewItem.cpp index 98cfc8d6..e09e4f49 100644 --- a/src/Conversation/ConvList/View/src/ConvListViewItem.cpp +++ b/src/Conversation/ConvList/View/src/ConvListViewItem.cpp @@ -155,11 +155,6 @@ void ConvListViewItem::updateContent() updateFields(bubbleContentPart, ELM_GENLIST_ITEM_FIELD_CONTENT); } -void ConvListViewItem::updateProgress() -{ - updateFields(infoStatus, ELM_GENLIST_ITEM_FIELD_CONTENT); -} - void ConvListViewItem::updateItemType(ConvItemType type) { if (type == m_Type || type == InitType) diff --git a/src/Conversation/Recipients/Controller/inc/ConvRecipientsPanel.h b/src/Conversation/Recipients/Controller/inc/ConvRecipientsPanel.h index 126a6f93..ddd519b0 100644 --- a/src/Conversation/Recipients/Controller/inc/ConvRecipientsPanel.h +++ b/src/Conversation/Recipients/Controller/inc/ConvRecipientsPanel.h @@ -63,8 +63,6 @@ namespace Msg { virtual void onMbeChanged(); void onAppControlRes(app_control_h request, app_control_h reply, app_control_result_e result); - void onPopupBtnClicked(Popup &popup, int buttonId); - void onPopupDel(Evas_Object *popup, void *eventInfo); void appendStatusHandler(MbeRecipients::AppendItemStatus status); int getMaxRecipientCount() const; diff --git a/src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp b/src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp index 20c383c5..8ad0e0d3 100644 --- a/src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp +++ b/src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp @@ -289,16 +289,6 @@ void ConvRecipientsPanel::onContactsPicked(const std::list &addressI setEntryFocus(true); } -void ConvRecipientsPanel::onPopupBtnClicked(Popup &popup, int buttonId) -{ - popup.destroy(); -} - -void ConvRecipientsPanel::onPopupDel(Evas_Object *popup, void *eventInfo) -{ - setEntryFocus(true); -} - void ConvRecipientsPanel::showInvalidRecipientPopup() { notification_status_message_post(msg("IDS_MSG_TPOP_CANT_ADD_RECIPIENT_NUMBER_NOT_VALID").cStr()); diff --git a/src/Conversation/Recipients/View/inc/ConvRecipientsPanelView.h b/src/Conversation/Recipients/View/inc/ConvRecipientsPanelView.h index 4a4cefe5..db6cfacb 100644 --- a/src/Conversation/Recipients/View/inc/ConvRecipientsPanelView.h +++ b/src/Conversation/Recipients/View/inc/ConvRecipientsPanelView.h @@ -69,8 +69,6 @@ namespace Msg { void setEditMode(bool isEdit); void showInvalidIcon(bool show); void showClearButton(bool show); - void setButtonEnabled(ButtonType buttonType, bool enabled); - private: // Out signals: diff --git a/src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp b/src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp index 542ce92a..0063465a 100644 --- a/src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp +++ b/src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp @@ -79,27 +79,6 @@ void ConvRecipientsPanelView::showButton(ButtonType buttonType) } } -void ConvRecipientsPanelView::setButtonEnabled(ButtonType buttonType, bool enabled) -{ - Evas_Object *pBtn = nullptr; - switch (buttonType) { - case NoneButton: - break; - case ContactButton: - pBtn = getContactBtn(); - break; - case PlusButton: - pBtn = getPlusBtn(); - break; - default: - assert(false); - break; - } - - if (pBtn) - elm_object_disabled_set(pBtn, !enabled); -} - void ConvRecipientsPanelView::addGeometryChangedCb(Evas_Object *obj) { evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, EVAS_EVENT_CALLBACK(ConvRecipientsPanelView, onGeometryChanged), this); diff --git a/src/MsgThread/Controller/inc/MsgThread.h b/src/MsgThread/Controller/inc/MsgThread.h index 34dc9772..2b695eb4 100644 --- a/src/MsgThread/Controller/inc/MsgThread.h +++ b/src/MsgThread/Controller/inc/MsgThread.h @@ -66,7 +66,6 @@ namespace Msg { void onSearchItemPressed(PopupListItem &item); // IMsgThreadSearchPanelListener: - virtual void onSearchButtonClicked(MsgThreadSearchPanel &obj); virtual void onEntryChanged(MsgThreadSearchPanel &obj); // IFloatingButtonListener diff --git a/src/MsgThread/Controller/inc/ThreadList.h b/src/MsgThread/Controller/inc/ThreadList.h index f405216a..cce577fb 100644 --- a/src/MsgThread/Controller/inc/ThreadList.h +++ b/src/MsgThread/Controller/inc/ThreadList.h @@ -42,7 +42,6 @@ namespace Msg { void setListener(IThreadListListener *l); void setDeleteMode(bool value); - bool isDeleteModeEnabled() const; void deleteSelectedItems(); int getThreadsCheckedCount() const; diff --git a/src/MsgThread/Controller/src/MsgThread.cpp b/src/MsgThread/Controller/src/MsgThread.cpp index 000812bc..7f9ba827 100644 --- a/src/MsgThread/Controller/src/MsgThread.cpp +++ b/src/MsgThread/Controller/src/MsgThread.cpp @@ -357,11 +357,6 @@ void MsgThread::onFloatingButtonPressed() composeNewMessage(); } -void MsgThread::onSearchButtonClicked(MsgThreadSearchPanel &obj) -{ - MSG_LOG(""); -} - void MsgThread::onEntryChanged(MsgThreadSearchPanel &obj) { MSG_LOG(""); diff --git a/src/MsgThread/Controller/src/ThreadList.cpp b/src/MsgThread/Controller/src/ThreadList.cpp index f42aac22..82201a80 100644 --- a/src/MsgThread/Controller/src/ThreadList.cpp +++ b/src/MsgThread/Controller/src/ThreadList.cpp @@ -75,11 +75,6 @@ void ThreadList::setDeleteMode(bool value) showSelectAllItem(value); } -bool ThreadList::isDeleteModeEnabled() const -{ - return m_DeleteMode; -} - void ThreadList::deleteSelectedItems() { auto items = getItems(); diff --git a/src/MsgThread/View/inc/MsgThreadSearchPanel.h b/src/MsgThread/View/inc/MsgThreadSearchPanel.h index 034c52ea..0239c1d5 100644 --- a/src/MsgThread/View/inc/MsgThreadSearchPanel.h +++ b/src/MsgThread/View/inc/MsgThreadSearchPanel.h @@ -61,7 +61,6 @@ namespace Msg { virtual ~IMsgThreadSearchPanelListener() {}; virtual void onBackButtonClicked(MsgThreadSearchPanel &obj) {}; - virtual void onSearchButtonClicked(MsgThreadSearchPanel &obj) {}; virtual void onEntryChanged(MsgThreadSearchPanel &obj) {}; }; }