TizenRefApp-9196 Fix sonar issues 59/145759/3
authorEvgen Servetnik <e.servetnik@samsung.com>
Wed, 23 Aug 2017 13:29:42 +0000 (16:29 +0300)
committerEvgen Servetnik <e.servetnik@samsung.com>
Fri, 25 Aug 2017 12:37:16 +0000 (15:37 +0300)
Change-Id: Ifad94f9fdabe136cc1f0d003818f7c799836c4d6
Signed-off-by: Evgen Servetnik <e.servetnik@samsung.com>
18 files changed:
src/Common/Controller/src/SaveAttachments.cpp
src/Common/MsgEngine/src/MsgEngine.cpp
src/Common/MsgEngine/src/private/MsgSettingsPrivate.cpp
src/Common/Utils/src/FileUtils.cpp
src/Common/Utils/src/MediaUtils.cpp
src/Conversation/Body/Controller/src/Body.cpp
src/Conversation/ConvList/Controller/src/ConvList.cpp
src/Conversation/ConvList/View/inc/ConvListViewItem.h
src/Conversation/ConvList/View/src/ConvListViewItem.cpp
src/Conversation/Recipients/Controller/inc/ConvRecipientsPanel.h
src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp
src/Conversation/Recipients/View/inc/ConvRecipientsPanelView.h
src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp
src/MsgThread/Controller/inc/MsgThread.h
src/MsgThread/Controller/inc/ThreadList.h
src/MsgThread/Controller/src/MsgThread.cpp
src/MsgThread/Controller/src/ThreadList.cpp
src/MsgThread/View/inc/MsgThreadSearchPanel.h

index e0a662b6bb50bff890a9c0967eac50d3fc114a33..034aa32231ddc8d628c08f61a617ccf4a7e2e393 100644 (file)
@@ -221,9 +221,6 @@ bool SaveAttachments::shouldEnableSaveBtn() const
 
 bool SaveAttachments::saveCheckedItems()
 {
-       std::string filePathDst;
-       std::string dowloadPath = PathUtils::getDownloadPath();
-
        auto items = m_pList->getItems<SaveAttachmentsListItem>();
        std::list<std::string> files;
 
index f8a85f00ba7915360888c2a3e209ac4c86354176..5e206d349a2e975d9ab2c98a07dc257814c61d13 100644 (file)
@@ -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;
 
index 8ecaf1a4860bc4366159fc00364c3ebdfc0ee905..244dbe941314a1a5de513813dd61a15312b78372 100644 (file)
@@ -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<MsgSettingsPrivate*>(data);
                                self->m_pActiveNotifJob = nullptr;
                                vconf_set_int(VCONFKEY_MESSAGE_ACTIVATED_CONVERSATION_ID, self->m_ActiveNotifValue);
                                MSG_LOG("ActiveNotifValue = ", self->m_ActiveNotifValue);
index 0c7b92fa85547a890303fce82e19912ce8fe28c7..60b530f22313d023900d276eccd962d4499b8715 100755 (executable)
@@ -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)
index 8eb0f9c0636ade78fbe9c57c3f7c62876a9a5b26..8a58e231a13691f44fa149c792cdbef0e18ab037 100644 (file)
@@ -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;
index 1a7744c75935d6f40512bafee232fccfe8c66876..14e36955e0395b52c883e1b8e8d296045670df46 100644 (file)
@@ -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);
index 2bb38e125ba4e85a47d393d9f1d902a25323b677..ce75b2080c25be4e42474af40ebe1b4ad93e0786 100644 (file)
@@ -257,11 +257,10 @@ void ConvList::demoteItem(ConvListItem *item)
 
 void ConvList::dateLineDelIfNec(ConvListItem *item)
 {
-       bool needDelDateLine = false;
        DateLineItem *prev = dynamic_cast<DateLineItem*>(m_pList->getPrevItem(*item));
        if (prev) {
                ListItem *nextItem = m_pList->getNextItem(*item);
-               needDelDateLine = nextItem ? dynamic_cast<ConvListItem*>(nextItem) == nullptr : true;
+               bool needDelDateLine = nextItem ? dynamic_cast<ConvListItem*>(nextItem) == nullptr : true;
                if (needDelDateLine) {
                        m_DateLineItemSet.erase(prev->getDateLine());
                        m_pList->deleteItem(*prev);
index 0aaa7f4bffe1805e1d382e8fdf4d57c1088651b0..0b3bc06f54b8e308705608d8b80e335dd4a4c3a2 100644 (file)
@@ -49,7 +49,6 @@ namespace Msg {
 
                protected:
                        Evas_Object *createProgress();
-                       void updateProgress();
                        void updateContent();
                        void updateItemType(ConvItemType type);
                        virtual void onRealized(ListItem &item);
index 98cfc8d60fd15cd00cee17c4c4e05262fc51fb30..e09e4f495d250761ab16e15f61fbf7dfd40a71b2 100644 (file)
@@ -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)
index 126a6f937240456a4165eb24936a744d111b913e..ddd519b05106c50ff8ae84954502d6fcc15ad186 100644 (file)
@@ -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;
index 20c383c5cf98fc39a33c13a568b0832fbdebd815..8ad0e0d3c45b3329f56ee9c5268b099514bf3f1c 100644 (file)
@@ -289,16 +289,6 @@ void ConvRecipientsPanel::onContactsPicked(const std::list<ResultData> &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());
index 4a4cefe52eb2a4e573f8fb45ce5e11a418c74068..db6cfacb6d5ac8632f55353ac4d8c1471a4def82 100644 (file)
@@ -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:
index 542ce92aced893cdc3f37b82c7a7fa5e24eb6cbb..0063465a5a80dace4227db23b7d18e2402d4f702 100644 (file)
@@ -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);
index 34dc97729f9b9c28a50e376842273e2be05f5767..2b695eb40682b483f6f9d35f3f2f747d46c3368f 100644 (file)
@@ -66,7 +66,6 @@ namespace Msg {
                        void onSearchItemPressed(PopupListItem &item);
 
                        // IMsgThreadSearchPanelListener:
-                       virtual void onSearchButtonClicked(MsgThreadSearchPanel &obj);
                        virtual void onEntryChanged(MsgThreadSearchPanel &obj);
 
                        // IFloatingButtonListener
index f405216ab7fc001cf3e8405a62b7356007f7ed0d..cce577fbd8d19ffdb6f4744e0938835e04d787f6 100644 (file)
@@ -42,7 +42,6 @@ namespace Msg {
 
                        void setListener(IThreadListListener *l);
                        void setDeleteMode(bool value);
-                       bool isDeleteModeEnabled() const;
                        void deleteSelectedItems();
                        int getThreadsCheckedCount() const;
 
index 000812bca160963fbb4b84889da99ee6b752ab65..7f9ba82738bd3342976994adb535a154a9e205b3 100644 (file)
@@ -357,11 +357,6 @@ void MsgThread::onFloatingButtonPressed()
        composeNewMessage();
 }
 
-void MsgThread::onSearchButtonClicked(MsgThreadSearchPanel &obj)
-{
-       MSG_LOG("");
-}
-
 void MsgThread::onEntryChanged(MsgThreadSearchPanel &obj)
 {
        MSG_LOG("");
index f42aac22d5c46ec76cb307ff38bd775a1ad8ad6b..82201a802ef28e5eff84b07a44dbe6d0a3b03d07 100644 (file)
@@ -75,11 +75,6 @@ void ThreadList::setDeleteMode(bool value)
        showSelectAllItem(value);
 }
 
-bool ThreadList::isDeleteModeEnabled() const
-{
-       return m_DeleteMode;
-}
-
 void ThreadList::deleteSelectedItems()
 {
        auto items = getItems<ThreadListItem>();
index 034c52eaed890c459f50aac015019f01057359f9..0239c1d5dcf447b77d95672773dac89b1a4553e6 100644 (file)
@@ -61,7 +61,6 @@ namespace Msg {
                        virtual ~IMsgThreadSearchPanelListener() {};
 
                        virtual void onBackButtonClicked(MsgThreadSearchPanel &obj) {};
-                       virtual void onSearchButtonClicked(MsgThreadSearchPanel &obj) {};
                        virtual void onEntryChanged(MsgThreadSearchPanel &obj) {};
        };
 }