From 1ab8df1e204ec6fb17d20c71adda65289b9e1353 Mon Sep 17 00:00:00 2001 From: Andrey Klimenko Date: Mon, 21 Nov 2016 15:33:15 +0200 Subject: [PATCH] TizenRefApp-7698 fixed codestyle in Common/* Change-Id: Id58141b895bac24e4a96e0f98ad6d2e791cf56b6 Signed-off-by: Andrey Klimenko --- src/Common/AppControl/src/AppControlCompose.cpp | 24 +++---- src/Common/AppControl/src/AppControlDefault.cpp | 17 +++-- src/Common/AppControl/src/AppControlParser.cpp | 4 +- src/Common/AppControl/src/AppControlUtils.cpp | 20 +++--- src/Common/AppControl/src/ContactEditor.cpp | 28 ++++---- src/Common/AppControl/src/ContactViewer.cpp | 7 +- src/Common/AppControl/src/FileViewer.cpp | 10 +-- src/Common/AppControl/src/Share.cpp | 17 +++-- src/Common/AppControl/src/VoiceCall.cpp | 2 +- src/Common/ContactManager/inc/Contact.h | 6 +- src/Common/ContactManager/inc/ContactList.h | 2 +- src/Common/ContactManager/src/ContactManager.cpp | 72 ++++++++++---------- src/Common/ContactManager/src/ContactRecord.cpp | 2 +- .../ContactManager/src/ContactVCardGenerator.cpp | 10 +-- .../ContactManager/src/ContactVCardParser.cpp | 5 +- src/Common/Controller/src/App.cpp | 22 +++--- src/Common/Controller/src/BaseController.cpp | 2 - src/Common/Controller/src/FrameController.cpp | 12 ++-- src/Common/Controller/src/MbeRecipients.cpp | 32 ++++----- src/Common/Controller/src/NaviFrameController.cpp | 36 +++++----- src/Common/Controller/src/SaveAttachments.cpp | 40 +++++------ .../Controller/src/SaveAttachmentsListItem.cpp | 2 +- src/Common/Controller/src/ViewItemController.cpp | 2 - src/Common/MsgEngine/inc/MsgAttachment.h | 3 +- src/Common/MsgEngine/inc/MsgEngine.h | 1 - src/Common/MsgEngine/src/Message.cpp | 1 - src/Common/MsgEngine/src/MessageMms.cpp | 1 - src/Common/MsgEngine/src/MessageSMS.cpp | 2 - src/Common/MsgEngine/src/MsgConversationItem.cpp | 1 - src/Common/MsgEngine/src/MsgEngine.cpp | 26 ++++---- src/Common/MsgEngine/src/MsgSettings.cpp | 6 +- src/Common/MsgEngine/src/MsgStorage.cpp | 14 ++-- src/Common/MsgEngine/src/MsgThreadItem.cpp | 1 - src/Common/MsgEngine/src/MsgTransport.cpp | 2 - src/Common/MsgEngine/src/MsgUtils.cpp | 42 ++++++------ .../MsgEngine/src/private/MessageMmsPrivate.cpp | 24 +++---- .../MsgEngine/src/private/MessagePrivate.cpp | 7 +- .../MsgEngine/src/private/MessageSMSPrivate.cpp | 1 - .../MsgEngine/src/private/MsgAddressPrivate.cpp | 2 - .../MsgEngine/src/private/MsgAttachmentPrivate.cpp | 3 +- .../MsgEngine/src/private/MsgComposerPrivate.cpp | 6 +- .../MsgEngine/src/private/MsgConvMediaPrivate.cpp | 2 - .../MsgEngine/src/private/MsgConvMediaPrivate.h | 1 - .../src/private/MsgConversationItemPrivate.cpp | 2 - .../MsgEngine/src/private/MsgListHandlePrivate.h | 2 +- .../MsgEngine/src/private/MsgMediaPrivate.cpp | 3 +- .../MsgEngine/src/private/MsgPagePrivate.cpp | 1 - .../MsgEngine/src/private/MsgReportPrivate.cpp | 2 - .../MsgEngine/src/private/MsgReportPrivate.h | 1 - .../MsgEngine/src/private/MsgSettingsPrivate.cpp | 23 +++---- .../MsgEngine/src/private/MsgStoragePrivate.cpp | 78 ++++++++++------------ .../MsgEngine/src/private/MsgStructListPrivate.h | 2 +- .../MsgEngine/src/private/MsgStructPrivate.h | 2 +- .../MsgEngine/src/private/MsgThreadItemPrivate.cpp | 2 - .../MsgEngine/src/private/MsgTransportPrivate.cpp | 16 ++--- .../MsgEngine/src/private/MsgUtilsPrivate.cpp | 42 ++++++------ .../src/SystemSettingsManager.cpp | 18 ++--- src/Common/Utils/inc/LangUtils.h | 4 +- src/Common/Utils/inc/Logger.h | 2 +- src/Common/Utils/inc/LoggerImpl.h | 2 +- src/Common/Utils/inc/PhoneNumberUtils.h | 1 - src/Common/Utils/src/FileUtils.cpp | 66 +++++++++--------- src/Common/Utils/src/HwButtonListener.cpp | 6 +- src/Common/Utils/src/LoggerImpl.cpp | 4 +- src/Common/Utils/src/MediaUtils.cpp | 56 ++++++++-------- src/Common/Utils/src/PathUtils.cpp | 20 +++--- src/Common/Utils/src/PhoneNumberUtils.cpp | 2 +- src/Common/Utils/src/TextDecorator.cpp | 11 ++- src/Common/Utils/src/ThumbnailMaker.cpp | 36 +++++----- src/Common/Utils/src/TimeUtils.cpp | 26 +++----- src/Common/Utils/src/VCalendarParser.cpp | 23 +++---- src/Common/View/inc/ListView.h | 10 +-- src/Common/View/inc/MbeRecipientViewItem.h | 2 +- src/Common/View/inc/PopupList.h | 2 +- src/Common/View/inc/PopupManager.h | 2 +- src/Common/View/src/Box.cpp | 1 - src/Common/View/src/ContextPopup.cpp | 9 +-- src/Common/View/src/DefaultLayout.cpp | 7 +- src/Common/View/src/ListItem.cpp | 21 +++--- src/Common/View/src/ListView.cpp | 27 ++++---- src/Common/View/src/MbeRecipientsView.cpp | 13 ++-- src/Common/View/src/NaviFrameItem.cpp | 52 ++++++--------- src/Common/View/src/NaviFrameView.cpp | 41 +++++------- src/Common/View/src/NoContentLayout.cpp | 1 - src/Common/View/src/Popup.cpp | 25 +++---- src/Common/View/src/PopupListItem.cpp | 4 +- src/Common/View/src/PopupManager.cpp | 6 +- src/Common/View/src/SelectAllListItem.cpp | 2 +- src/Common/View/src/View.cpp | 30 ++++----- 89 files changed, 547 insertions(+), 681 deletions(-) diff --git a/src/Common/AppControl/src/AppControlCompose.cpp b/src/Common/AppControl/src/AppControlCompose.cpp index eb85b31..7f68dee 100644 --- a/src/Common/AppControl/src/AppControlCompose.cpp +++ b/src/Common/AppControl/src/AppControlCompose.cpp @@ -52,9 +52,9 @@ AppControlCompose::AppControlCompose(const std::string &opMsg, app_control_h han { MSG_LOG("ComposeType: ", m_ComposeType); - if(handle) + if (handle) { - switch(m_ComposeType) + switch (m_ComposeType) { case OpCompose: createComposeOp(handle); @@ -95,10 +95,10 @@ void AppControlCompose::createShareOp(app_control_h handle) { parseUriShare(handle); - if(mimeContact == AppControlUtils::getMimeType(handle)) + if (mimeContact == AppControlUtils::getMimeType(handle)) { std::string idStr = AppControlUtils::getExtraData(handle, APP_CONTROL_DATA_ID); - if(!idStr.empty()) + if (!idStr.empty()) { std::string dataType = AppControlUtils::getExtraData(handle, APP_CONTROL_DATA_TYPE); m_VcfInfo.isMyProfile = (dataType == myProfileDataType); @@ -106,21 +106,21 @@ void AppControlCompose::createShareOp(app_control_h handle) } } - if(m_FileList.empty()) + if (m_FileList.empty()) { std::string path = AppControlUtils::getExtraData(handle, APP_CONTROL_DATA_PATH); - if(!path.empty()) + if (!path.empty()) m_FileList.push_back(std::move(path)); } } void AppControlCompose::createMultiShareOp(app_control_h handle) { - if(mimeContact == AppControlUtils::getMimeType(handle)) + if (mimeContact == AppControlUtils::getMimeType(handle)) { std::list contactsList; AppControlUtils::getExtraDataArray(handle, APP_CONTROL_DATA_ID, contactsList); - for(auto it : contactsList) + for (auto it : contactsList) m_VcfInfo.contactsIdList.push_back(atoi(it.c_str())); } @@ -223,17 +223,15 @@ bool AppControlCompose::parseUriShare(app_control_h handle) if (cur == "sms" || cur == "mmsto" || cur == "file") { m_isMms = (cur == "mmsto" || cur == "file"); - if(cur == "file" && m_FileList.empty()) + if (cur == "file" && m_FileList.empty()) { std::string prefix("file://"); m_FileList.push_back(uriToParse.erase(0, prefix.length())); } res = true; - } - else - { + } else { auto it = std::find(m_FileList.begin(), m_FileList.end(), uriToParse); - if(it == m_FileList.end()) + if (it == m_FileList.end()) m_FileList.push_back(uriToParse); // no prefix, uri is a path to file itself } } diff --git a/src/Common/AppControl/src/AppControlDefault.cpp b/src/Common/AppControl/src/AppControlDefault.cpp index 3e17959..429cb7c 100644 --- a/src/Common/AppControl/src/AppControlDefault.cpp +++ b/src/Common/AppControl/src/AppControlDefault.cpp @@ -38,7 +38,6 @@ AppControlDefault::AppControlDefault(const std::string &opMsg, app_control_h han AppControlDefault::~AppControlDefault() { - } MsgId AppControlDefault::getMessageId() const @@ -60,7 +59,7 @@ void AppControlDefault::parse(app_control_h handle) { char *key = nullptr; app_control_get_extra_data(handle, keyType, &key); - if(!key) + if (!key) { m_DefaultType = MainType; return; @@ -68,16 +67,16 @@ void AppControlDefault::parse(app_control_h handle) std::string type = key; free(key); - if(type == valueNewMsg) + if (type == valueNewMsg) viewMessage(handle); - else if(type == valueSendFailed) + else if (type == valueSendFailed) m_DefaultType = SendFailedType; else MSG_LOG("Unknown type!"); char *msgIdStr = nullptr; app_control_get_extra_data(handle, keyMsgId, &msgIdStr); - if(!msgIdStr) + if (!msgIdStr) return; m_MsgId = atoi(msgIdStr); @@ -88,19 +87,19 @@ bool AppControlDefault::isNotificationPanel(app_control_h handle) const { char *keyVal = nullptr; app_control_get_extra_data(handle, notificationPanel, &keyVal); - if(keyVal) + if (keyVal) { free(keyVal); return true; } - else - return false; + + return false; } void AppControlDefault::viewMessage(app_control_h handle) { makeReplyText(handle); - if(isNotificationPanel(handle)) + if (isNotificationPanel(handle)) m_DefaultType = NotificationType; else m_DefaultType = m_ReplyText.empty() ? ViewType : ReplyType; diff --git a/src/Common/AppControl/src/AppControlParser.cpp b/src/Common/AppControl/src/AppControlParser.cpp index 117e133..0c4604b 100644 --- a/src/Common/AppControl/src/AppControlParser.cpp +++ b/src/Common/AppControl/src/AppControlParser.cpp @@ -55,7 +55,7 @@ AppControlCommandRef AppControlParser::parse(app_control_h handle) app_control_get_operation(handle, &opStr); - if(!opStr) + if (!opStr) { MSG_LOG_WARN("app_control operation is null"); return cmd; @@ -63,7 +63,7 @@ AppControlCommandRef AppControlParser::parse(app_control_h handle) AppControlCommand::OperationType opType = getOperation(opStr); - switch(opType) + switch (opType) { case AppControlCommand::OpDefault: cmd = std::make_shared(opStr, handle); diff --git a/src/Common/AppControl/src/AppControlUtils.cpp b/src/Common/AppControl/src/AppControlUtils.cpp index e9b781d..54a0ca2 100644 --- a/src/Common/AppControl/src/AppControlUtils.cpp +++ b/src/Common/AppControl/src/AppControlUtils.cpp @@ -22,9 +22,9 @@ std::string AppControlUtils::getExtraData(app_control_h handle, const std::strin { std::string res; char *val = nullptr; - if(APP_CONTROL_ERROR_NONE == app_control_get_extra_data(handle, key.c_str(), &val)) + if (APP_CONTROL_ERROR_NONE == app_control_get_extra_data(handle, key.c_str(), &val)) { - if(val) + if (val) { res = val; free(val); @@ -37,9 +37,9 @@ void AppControlUtils::getExtraDataArray(app_control_h handle, const std::string { int arrayLength = 0; char **pArrayVal = nullptr; - if(APP_CONTROL_ERROR_NONE == app_control_get_extra_data_array(handle, key.c_str(), &pArrayVal, &arrayLength)) + if (APP_CONTROL_ERROR_NONE == app_control_get_extra_data_array(handle, key.c_str(), &pArrayVal, &arrayLength)) { - for(int i = 0; i < arrayLength; ++i) + for (int i = 0; i < arrayLength; ++i) { outArray.push_back(pArrayVal[i]); free(pArrayVal[i]); @@ -52,7 +52,7 @@ int AppControlUtils::getExtraDataInt(app_control_h handle, const std::string &ke { char *val = nullptr; int parsed = 0; - if(APP_CONTROL_ERROR_NONE == app_control_get_extra_data(handle, key.c_str(), &val) && val) + if (APP_CONTROL_ERROR_NONE == app_control_get_extra_data(handle, key.c_str(), &val) && val) { parsed = atoi(val); free(val); @@ -64,18 +64,18 @@ void AppControlUtils::getExtraDataIntArray(app_control_h handle, const std::stri { int arrayLength = 0; char **pArrayVal = nullptr; - if(APP_CONTROL_ERROR_NONE == app_control_get_extra_data_array(handle, key.c_str(), &pArrayVal, &arrayLength) + if (APP_CONTROL_ERROR_NONE == app_control_get_extra_data_array(handle, key.c_str(), &pArrayVal, &arrayLength) && pArrayVal) { std::string::size_type sz; - for(int i = 0; i < arrayLength; ++i) + for (int i = 0; i < arrayLength; ++i) { - if(pArrayVal[i]) + if (pArrayVal[i]) { std::string s(pArrayVal[i] ? pArrayVal[i] : ""); free(pArrayVal[i]); int parsed = std::stoi(s, &sz); - if(sz == s.length()) + if (sz == s.length()) { outArray.push_back(parsed); } @@ -90,7 +90,7 @@ std::string AppControlUtils::getMimeType(app_control_h handle) char *mime = nullptr; std::string result; app_control_get_mime(handle, &mime); - if(mime) + if (mime) { result = mime; free(mime); diff --git a/src/Common/AppControl/src/ContactEditor.cpp b/src/Common/AppControl/src/ContactEditor.cpp index d75744f..9317832 100644 --- a/src/Common/AppControl/src/ContactEditor.cpp +++ b/src/Common/AppControl/src/ContactEditor.cpp @@ -45,19 +45,19 @@ void ContactEditor::setListener(IContactEditorListener *l) bool ContactEditor::launch(const std::string &address, Operation operation) { bool res = false; - if(!address.empty()) + if (!address.empty()) { const char *op = nullptr; - if(operation == EditOp) + if (operation == EditOp) op = APP_CONTROL_OPERATION_EDIT; - else if(operation == CreateOp) + else if (operation == CreateOp) op = APP_CONTROL_OPERATION_ADD; - if(op) + if (op) { - if(MsgUtils::isValidNumber(address)) + if (MsgUtils::isValidNumber(address)) res = launch(address, op, APP_CONTROL_DATA_PHONE); - else if(MsgUtils::isValidEmail(address)) + else if (MsgUtils::isValidEmail(address)) res = launch(address, op, APP_CONTROL_DATA_EMAIL); } } @@ -68,7 +68,7 @@ bool ContactEditor::launch(const std::string &address, const char *operation, co { bool res = false; terminate(); - if(APP_CONTROL_ERROR_NONE == app_control_create(&m_Handle)) + if (APP_CONTROL_ERROR_NONE == app_control_create(&m_Handle)) { app_control_set_operation(m_Handle, operation); app_control_set_mime(m_Handle, mimeContact); @@ -77,7 +77,7 @@ bool ContactEditor::launch(const std::string &address, const char *operation, co int ret = app_control_send_launch_request(m_Handle, APP_CONTROL_RES_CALLBACK(ContactEditor, onResultCb), this); MSG_LOG("Result code: ", ret); res = ret == APP_CONTROL_ERROR_NONE; - if(!res) + if (!res) terminate(); } @@ -86,7 +86,7 @@ bool ContactEditor::launch(const std::string &address, const char *operation, co void ContactEditor::terminate() { - if(m_Handle) + if (m_Handle) { app_control_send_terminate_request(m_Handle); app_control_destroy(m_Handle); @@ -96,19 +96,19 @@ void ContactEditor::terminate() void ContactEditor::onResultCb(app_control_h request, app_control_h reply, app_control_result_e result) { - if(m_Handle) + if (m_Handle) { - if(result == APP_CONTROL_RESULT_SUCCEEDED && m_pListener) + if (result == APP_CONTROL_RESULT_SUCCEEDED && m_pListener) { char *op = nullptr; app_control_get_operation(m_Handle, &op); - if(op) + if (op) { terminate(); - if(strcmp(op, APP_CONTROL_OPERATION_EDIT) == 0) + if (strcmp(op, APP_CONTROL_OPERATION_EDIT) == 0) m_pListener->onContactChanged(*this); - else if(strcmp(op, APP_CONTROL_OPERATION_ADD) == 0) + else if (strcmp(op, APP_CONTROL_OPERATION_ADD) == 0) m_pListener->onContactCreated(*this); free(op); } diff --git a/src/Common/AppControl/src/ContactViewer.cpp b/src/Common/AppControl/src/ContactViewer.cpp index 37a2e56..9be1f16 100644 --- a/src/Common/AppControl/src/ContactViewer.cpp +++ b/src/Common/AppControl/src/ContactViewer.cpp @@ -32,7 +32,6 @@ namespace ContactViewer::ContactViewer() : m_Handle() { - } ContactViewer::~ContactViewer() @@ -48,7 +47,7 @@ ContactViewer &ContactViewer::getInst() void ContactViewer::reset() { - if(m_Handle) + if (m_Handle) { app_control_send_terminate_request(m_Handle); app_control_destroy(m_Handle); @@ -61,7 +60,7 @@ bool ContactViewer::launch(int id, ContactAddress::OwnerType ownerType) bool res = false; reset(); - if(APP_CONTROL_ERROR_NONE == app_control_create(&m_Handle)) + if (APP_CONTROL_ERROR_NONE == app_control_create(&m_Handle)) { app_control_set_operation(m_Handle, APP_CONTROL_OPERATION_VIEW); app_control_set_mime(m_Handle, mimeContact); @@ -83,7 +82,7 @@ bool ContactViewer::launch(const ContactAddress &address) const char *ContactViewer::toStr(ContactAddress::OwnerType type) { - switch(type) + switch (type) { case ContactAddress::PersonType: return personContactTypeStr; diff --git a/src/Common/AppControl/src/FileViewer.cpp b/src/Common/AppControl/src/FileViewer.cpp index 64401e8..0309fac 100644 --- a/src/Common/AppControl/src/FileViewer.cpp +++ b/src/Common/AppControl/src/FileViewer.cpp @@ -29,7 +29,7 @@ FileViewer::FileViewer() FileViewer::~FileViewer() { - if(!m_FilePath.empty()) + if (!m_FilePath.empty()) FileUtils::remove(m_FilePath); } @@ -48,10 +48,10 @@ bool FileViewer::launch(const std::string &file) MSG_LOG("File path: ", file); MSG_LOG("MIME type: ", mime); - if(mime.empty() || file.empty()) + if (mime.empty() || file.empty()) return false; - 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_VIEW); app_control_set_mime(svc_handle, mime.c_str()); @@ -71,11 +71,11 @@ bool FileViewer::launchWithCopy(const std::string &file) { bool res = false; // Remove previous file (correct only for APP_CONTROL_LAUNCH_MODE_GROUP) - if(!m_FilePath.empty()) + if (!m_FilePath.empty()) FileUtils::remove(m_FilePath); m_FilePath = FileUtils::addFileToDataDir(file); - if(!m_FilePath.empty()) + if (!m_FilePath.empty()) res = launch(m_FilePath); return res; diff --git a/src/Common/AppControl/src/Share.cpp b/src/Common/AppControl/src/Share.cpp index cf0df1d..fda98aa 100644 --- a/src/Common/AppControl/src/Share.cpp +++ b/src/Common/AppControl/src/Share.cpp @@ -26,7 +26,6 @@ using namespace Msg; Share::Share() { - } Share::~Share() @@ -42,7 +41,7 @@ Share &Share::getInst() void Share::removeFiles() { - for(auto &&file : m_FileList) + for (auto &&file : m_FileList) { FileUtils::remove(file); } @@ -52,7 +51,7 @@ void Share::removeFiles() void Share::addFiles(const std::list &files) { removeFiles(); - for(auto &&file : files) + for (auto &&file : files) { m_FileList.push_back(FileUtils::addFileToDataDir(file)); } @@ -60,22 +59,22 @@ void Share::addFiles(const std::list &files) bool Share::launch(const std::list &files) { - if(files.empty()) + if (files.empty()) return false; bool res = false; app_control_h svc_handle = nullptr; - if(APP_CONTROL_ERROR_NONE == app_control_create(&svc_handle)) + if (APP_CONTROL_ERROR_NONE == app_control_create(&svc_handle)) { addFiles(files); app_control_set_operation(svc_handle, APP_CONTROL_OPERATION_MULTI_SHARE); app_control_set_launch_mode(svc_handle, APP_CONTROL_LAUNCH_MODE_GROUP); std::vector nativePaths; - for(const std::string &file : m_FileList) + for (const std::string &file : m_FileList) { - if(!file.empty()) + if (!file.empty()) nativePaths.push_back(file.c_str()); } @@ -91,13 +90,13 @@ bool Share::launch(const std::list &files) bool Share::launch(const std::string &text) { - if(text.empty()) + if (text.empty()) return false; bool res = false; app_control_h svc_handle = nullptr; - 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_SHARE_TEXT); app_control_add_extra_data(svc_handle, APP_CONTROL_DATA_TEXT, text.c_str()); diff --git a/src/Common/AppControl/src/VoiceCall.cpp b/src/Common/AppControl/src/VoiceCall.cpp index 629f4e1..9ef2813 100644 --- a/src/Common/AppControl/src/VoiceCall.cpp +++ b/src/Common/AppControl/src/VoiceCall.cpp @@ -34,7 +34,7 @@ bool VoiceCall::launch(const std::string &number) bool res = false; app_control_h svcHandle = nullptr; - if(APP_CONTROL_ERROR_NONE == app_control_create(&svcHandle)) + if (APP_CONTROL_ERROR_NONE == app_control_create(&svcHandle)) { app_control_set_operation(svcHandle, APP_CONTROL_OPERATION_CALL); std::string phoneNumber = tel + number; diff --git a/src/Common/ContactManager/inc/Contact.h b/src/Common/ContactManager/inc/Contact.h index c41ce0c..7fe7c9a 100644 --- a/src/Common/ContactManager/inc/Contact.h +++ b/src/Common/ContactManager/inc/Contact.h @@ -55,7 +55,7 @@ namespace Msg { std::string res; int count = getChildCount(_contacts_contact.number); - if(count > 0) + if (count > 0) res = getStr(getChildP(_contacts_contact.number, 0), _contacts_number.number); return res; } @@ -64,7 +64,7 @@ namespace Msg { std::string res; int count = getChildCount(_contacts_contact.email); - if(count > 0) + if (count > 0) res = getStr(getChildP(_contacts_contact.number, 0), _contacts_email.email); return res; } @@ -77,7 +77,7 @@ namespace Msg inline std::string Contact::getAddress() const { std::string address = getPhoneNumber(); - if(address.empty()) + if (address.empty()) address = getEmail(); return address; } diff --git a/src/Common/ContactManager/inc/ContactList.h b/src/Common/ContactManager/inc/ContactList.h index 1be18a5..e06fbd6 100644 --- a/src/Common/ContactManager/inc/ContactList.h +++ b/src/Common/ContactManager/inc/ContactList.h @@ -37,7 +37,7 @@ namespace Msg ~ContactList() { - if(m_List) + if (m_List) contacts_list_destroy(m_List, true); } diff --git a/src/Common/ContactManager/src/ContactManager.cpp b/src/Common/ContactManager/src/ContactManager.cpp index 5a8a199..5c0befd 100644 --- a/src/Common/ContactManager/src/ContactManager.cpp +++ b/src/Common/ContactManager/src/ContactManager.cpp @@ -31,7 +31,7 @@ MSG_LOG(""); m_AddressMap.reserve(mapReservSize); int error = contacts_connect(); - if(error != 0) + if (error != 0) { MSG_LOG_ERROR(whatError(error)); } @@ -45,17 +45,17 @@ { MSG_LOG(""); int error = contacts_db_remove_changed_cb(_contacts_contact._uri, contactChangedCb, this); - if(error != 0) + if (error != 0) MSG_LOG_ERROR(whatError(error)); error = contacts_disconnect(); - if(error != 0) + if (error != 0) MSG_LOG_ERROR(whatError(error)); } std::string ContactManager::whatError(int error) { - switch(error) + switch (error) { case CONTACTS_ERROR_NONE: return "CONTACTS_ERROR_NONE"; @@ -173,7 +173,7 @@ ContactMyProfileNumberRef ContactManager::getContactMyProfileNumber(const std::string &number) { auto myProfile = getOwnerProfile(); - if(!myProfile) + if (!myProfile) return nullptr; contacts_record_h rec = myProfile->getRecord(); @@ -182,22 +182,22 @@ contacts_record_get_child_record_count(rec, _contacts_my_profile.number, &count); std::string normalizedNumber = PhoneNumberUtils::getInst().getNormalizedNumber(number); - for(int i =0; i < count; ++i) + for (int i =0; i < count; ++i) { contacts_record_h child = nullptr; contacts_record_get_child_record_at_p(rec, _contacts_my_profile.number, i, &child); - if(child) + if (child) { char *num = nullptr; contacts_record_get_str_p(child, _contacts_number.number, &num); - if(num) + if (num) { std::string curNum = PhoneNumberUtils::getInst().getNormalizedNumber(num); - if(normalizedNumber == curNum) + if (normalizedNumber == curNum) { contacts_record_h clonedRec = nullptr; contacts_record_clone(child, &clonedRec); - if(clonedRec) + if (clonedRec) return std::make_shared(true, *myProfile, clonedRec); } } @@ -209,7 +209,7 @@ ContactMyProfileEmailRef ContactManager::getContactMyProfileEmail(const std::string &email) { auto myProfile = getOwnerProfile(); - if(!myProfile) + if (!myProfile) return nullptr; contacts_record_h rec = myProfile->getRecord(); @@ -217,21 +217,21 @@ int count = 0; contacts_record_get_child_record_count(rec, _contacts_my_profile.email, &count); - for(int i =0; i < count; ++i) + for (int i =0; i < count; ++i) { contacts_record_h child = nullptr; contacts_record_get_child_record_at_p(rec, _contacts_my_profile.email, i, &child); - if(child) + if (child) { char *curEmail = nullptr; contacts_record_get_str_p(child, _contacts_email.email, &curEmail); - if(curEmail) + if (curEmail) { - if(strcasecmp(email.c_str(), curEmail) == 0) + if (strcasecmp(email.c_str(), curEmail) == 0) { contacts_record_h clonedRec = nullptr; contacts_record_clone(child, &clonedRec); - if(clonedRec) + if (clonedRec) return std::make_shared(true, *myProfile, clonedRec); } } @@ -247,17 +247,17 @@ ContactMyProfileRef ContactManager::getOwnerProfile() { - if(!m_OwnerProfile) + if (!m_OwnerProfile) { contacts_list_h list = nullptr; contacts_record_h myProfile = nullptr; contacts_db_get_all_records(_contacts_my_profile._uri, 0, 1, &list); - if(list) + if (list) { contacts_list_get_current_record_p(list, &myProfile); contacts_list_destroy(list, false); } - if(myProfile) + if (myProfile) m_OwnerProfile.reset(new ContactMyProfile(true, myProfile)); } return m_OwnerProfile; @@ -267,7 +267,7 @@ { ContactManager *self = static_cast(user_data); self->invalidateCache(); - for(auto listener : self->m_Listeners) + for (auto listener : self->m_Listeners) { listener->onContactChanged(); } @@ -277,7 +277,7 @@ { ContactManager *self = static_cast(user_data); self->invalidateCache(); - for(auto listener : self->m_Listeners) + for (auto listener : self->m_Listeners) { listener->onContactChanged(); } @@ -286,7 +286,7 @@ void ContactManager::addListener(IContactManagerListener &listener) { auto found = std::find(m_Listeners.begin(), m_Listeners.end(), &listener); - if(found == m_Listeners.end()) + if (found == m_Listeners.end()) { m_Listeners.push_back(&listener); } @@ -295,7 +295,7 @@ void ContactManager::removeListener(IContactManagerListener &listener) { auto found = std::find(m_Listeners.begin(), m_Listeners.end(), &listener); - if(found != m_Listeners.end()) + if (found != m_Listeners.end()) { m_Listeners.erase(found); } @@ -320,21 +320,21 @@ }; int ctRrr = contacts_query_set_projection(query, numberProjection, sizeof(numberProjection) / sizeof(unsigned int)); - if(ctRrr == CONTACTS_ERROR_NONE) + if (ctRrr == CONTACTS_ERROR_NONE) ctRrr = contacts_db_get_records_with_query(query, 0, 0, &list); contacts_filter_destroy(filter); contacts_query_destroy(query); - while(ctRrr == CONTACTS_ERROR_NONE) + while (ctRrr == CONTACTS_ERROR_NONE) { int contactId = 0; contacts_list_get_current_record_p(list, &crValue); - if(crValue) + if (crValue) { contacts_record_get_int(crValue, _contacts_person_number.person_id, &contactId); - if(contactId > 0) + if (contactId > 0) cResValue = crValue; else contacts_record_destroy(crValue, true); @@ -365,21 +365,21 @@ }; int ctRrr = contacts_query_set_projection(query, numberProjection, sizeof(numberProjection) / sizeof(unsigned int)); - if(ctRrr == CONTACTS_ERROR_NONE) + if (ctRrr == CONTACTS_ERROR_NONE) ctRrr = contacts_db_get_records_with_query(query, 0, 0, &list); contacts_filter_destroy(filter); contacts_query_destroy(query); - while(ctRrr == CONTACTS_ERROR_NONE) + while (ctRrr == CONTACTS_ERROR_NONE) { int contactId = 0; contacts_list_get_current_record_p(list, &crValue); - if(crValue) + if (crValue) { contacts_record_get_int(crValue, _contacts_person_email.person_id, &contactId); - if(contactId > 0) + if (contactId > 0) cResValue = crValue; else contacts_record_destroy(crValue, true); @@ -394,22 +394,22 @@ ContactAddressRef ContactManager::getAddress(const std::string &address) { auto it = m_AddressMap.find(address); - if(m_AddressMap.end() == it) + if (m_AddressMap.end() == it) { bool isNumber = MsgUtils::isValidNumber(address); // ContactPerson: ContactAddressRef contactAddress; - if(isNumber) + if (isNumber) contactAddress = getContactPersonNumber(address); else contactAddress = getContactPersonEmail(address); // MyProfile: - #if(0) - if(!contactAddress) + #if (0) + if (!contactAddress) { - if(isNumber) + if (isNumber) contactAddress = getContactMyProfileNumber(address); else contactAddress = getContactMyProfileEmail(address); diff --git a/src/Common/ContactManager/src/ContactRecord.cpp b/src/Common/ContactManager/src/ContactRecord.cpp index 004dcd6..8645af7 100644 --- a/src/Common/ContactManager/src/ContactRecord.cpp +++ b/src/Common/ContactManager/src/ContactRecord.cpp @@ -26,7 +26,7 @@ ContactRecord::ContactRecord(bool release, contacts_record_h record) ContactRecord::~ContactRecord() { - if(m_Record && m_Release) + if (m_Record && m_Release) { contacts_record_destroy(m_Record, true); m_Record = nullptr; diff --git a/src/Common/ContactManager/src/ContactVCardGenerator.cpp b/src/Common/ContactManager/src/ContactVCardGenerator.cpp index 6a12bc7..aa0630b 100644 --- a/src/Common/ContactManager/src/ContactVCardGenerator.cpp +++ b/src/Common/ContactManager/src/ContactVCardGenerator.cpp @@ -33,7 +33,7 @@ std::string ContactManager::makeVcard(const int personId, bool myProfile) contacts_record_h record = nullptr; std::string vcardContent; - if(contacts_db_get_record((myProfile ? _contacts_my_profile._uri : _contacts_person._uri), personId, &record) != CONTACTS_ERROR_NONE) + if (contacts_db_get_record((myProfile ? _contacts_my_profile._uri : _contacts_person._uri), personId, &record) != CONTACTS_ERROR_NONE) { MSG_LOG_ERROR("contacts_db_get_record() failed"); record = nullptr; @@ -41,7 +41,7 @@ std::string ContactManager::makeVcard(const int personId, bool myProfile) } vcardContent = createContactContent(record, myProfile); - if(record) + if (record) contacts_record_destroy(record, true); return vcardContent; @@ -51,7 +51,7 @@ std::string ContactManager::makeVcard(const std::list &idList) { std::string vcardContent; vcardContent.reserve(idList.size() * avgLengthOfContent); - for(auto it : idList) + for (auto it : idList) vcardContent += createContentForContactList(it); return vcardContent; @@ -63,7 +63,7 @@ std::string ContactManager::createContactContent(contacts_record_h record, bool myProfile ? contacts_vcard_make_from_my_profile(record, &vcardBuff) : contacts_vcard_make_from_person(record, &vcardBuff); - if(!vcardBuff) + if (!vcardBuff) { MSG_LOG_ERROR("vcardBuff is NULL"); return std::string(); @@ -77,7 +77,7 @@ std::string ContactManager::createContactContent(contacts_record_h record, bool std::string ContactManager::createContentForContactList(int personId) { contacts_record_h record = nullptr; - if(contacts_db_get_record(_contacts_person._uri, personId, &record) != CONTACTS_ERROR_NONE) + if (contacts_db_get_record(_contacts_person._uri, personId, &record) != CONTACTS_ERROR_NONE) { MSG_LOG_ERROR("contacts_db_get_record() failed!"); record = nullptr; diff --git a/src/Common/ContactManager/src/ContactVCardParser.cpp b/src/Common/ContactManager/src/ContactVCardParser.cpp index 92cea22..370d053 100644 --- a/src/Common/ContactManager/src/ContactVCardParser.cpp +++ b/src/Common/ContactManager/src/ContactVCardParser.cpp @@ -29,7 +29,7 @@ std::list ContactManager::parseVcard(const std::string &filePath) { std::list res; - if(filePath.empty()) + if (filePath.empty()) return res; int parseRes = contacts_vcard_parse_to_contact_foreach @@ -44,8 +44,7 @@ std::list ContactManager::parseVcard(const std::string &filePath) list->emplace_back(recRef); return true; }, - &res - ); + &res); MSG_LOG("Parse result: ", parseRes); return res; diff --git a/src/Common/Controller/src/App.cpp b/src/Common/Controller/src/App.cpp index be2f17d..eec80b9 100644 --- a/src/Common/Controller/src/App.cpp +++ b/src/Common/Controller/src/App.cpp @@ -34,7 +34,7 @@ App::App() , m_IsPause(true) { int serviceResult = m_Engine.openService(); - if(serviceResult != MESSAGES_ERROR_NONE) + if (serviceResult != MESSAGES_ERROR_NONE) { MSG_ENGINE_WHAT_ERROR(serviceResult); MSG_LOG_ERROR("Service handle open error = ", serviceResult); @@ -86,7 +86,7 @@ const MsgEngine &App::getMsgEngine() const ContactManager &App::getContactManager() { - if(!m_pContactManager) + if (!m_pContactManager) m_pContactManager = new ContactManager; return *m_pContactManager; } @@ -98,7 +98,7 @@ const ContactManager &App::getContactManager() const PopupManager &App::getPopupManager() { - if(!m_pPopupManager) + if (!m_pPopupManager) m_pPopupManager = new PopupManager(getWindow()); return *m_pPopupManager; } @@ -110,7 +110,7 @@ const PopupManager &App::getPopupManager() const ThumbnailMaker &App::getThumbnailMaker() { - if(!m_pThumbnailMaker) + if (!m_pThumbnailMaker) m_pThumbnailMaker = new ThumbnailMaker(*this); return *m_pThumbnailMaker; } @@ -122,7 +122,7 @@ const ThumbnailMaker &App::getThumbnailMaker() const SystemSettingsManager &App::getSysSettingsManager() { - if(!m_pSysSettingsManager) + if (!m_pSysSettingsManager) m_pSysSettingsManager = new SystemSettingsManager; return *m_pSysSettingsManager; } @@ -140,14 +140,14 @@ void App::exit() void App::addListener(IAppListener &l) { auto found = std::find(m_Listeners.begin(), m_Listeners.end(), &l); - if(found == m_Listeners.end()) + if (found == m_Listeners.end()) m_Listeners.push_back(&l); } void App::removeListener(IAppListener &l) { auto found = std::find(m_Listeners.begin(), m_Listeners.end(), &l); - if(found != m_Listeners.end()) + if (found != m_Listeners.end()) m_Listeners.erase(found); } @@ -158,10 +158,10 @@ bool App::isPause() const void App::pause() { - if(!m_IsPause) + if (!m_IsPause) { m_IsPause = true; - for(IAppListener *l : m_Listeners) + for (IAppListener *l : m_Listeners) l->onAppPause(); updateActiveNotifPolicy(); getPopupManager().onPause(); @@ -170,11 +170,11 @@ void App::pause() void App::resume() { - if(m_IsPause) + if (m_IsPause) { m_IsPause = false; updateActiveNotifPolicy(); - for(IAppListener *l : m_Listeners) + for (IAppListener *l : m_Listeners) l->onAppResume(); } } diff --git a/src/Common/Controller/src/BaseController.cpp b/src/Common/Controller/src/BaseController.cpp index f8c1913..e91fd2a 100644 --- a/src/Common/Controller/src/BaseController.cpp +++ b/src/Common/Controller/src/BaseController.cpp @@ -46,12 +46,10 @@ BaseController &BaseController::getParent() void BaseController::onPause() { - } void BaseController::onResume() { - } MsgEngine &BaseController::getMsgEngine() diff --git a/src/Common/Controller/src/FrameController.cpp b/src/Common/Controller/src/FrameController.cpp index 4edc186..09fe621 100644 --- a/src/Common/Controller/src/FrameController.cpp +++ b/src/Common/Controller/src/FrameController.cpp @@ -52,18 +52,18 @@ void FrameController::pop() void FrameController::setNaviBarTitle(const MsgAddressList &addressList) { std::string title; - if(!addressList.isEmpty()) + if (!addressList.isEmpty()) { std::string firstAddress = addressList[0].getAddress(); ContactAddressRef contactPersonAddress = getApp().getContactManager().getContactAddress(firstAddress); - if(contactPersonAddress) + if (contactPersonAddress) title = contactPersonAddress->getDispName(); - if(title.empty()) + if (title.empty()) title = firstAddress; int hidenAddresses = addressList.getLength() - 1; - if(hidenAddresses > 0) + if (hidenAddresses > 0) { title += " + " + std::to_string(hidenAddresses); getNaviBar().showButton(NaviExpandButtonId, true); @@ -75,7 +75,7 @@ void FrameController::setNaviBarTitle(const MsgAddressList &addressList) void FrameController::pause() { - if(!m_IsPause) + if (!m_IsPause) { m_IsPause = true; onPause(); @@ -84,7 +84,7 @@ void FrameController::pause() void FrameController::resume() { - if(m_IsPause && !getApp().isPause()) + if (m_IsPause && !getApp().isPause()) { m_IsPause = false; onResume(); diff --git a/src/Common/Controller/src/MbeRecipients.cpp b/src/Common/Controller/src/MbeRecipients.cpp index 5dbab6b..40bd0e8 100644 --- a/src/Common/Controller/src/MbeRecipients.cpp +++ b/src/Common/Controller/src/MbeRecipients.cpp @@ -37,9 +37,9 @@ std::string MbeRecipients::getDispName(const std::string &address) const { std::string dispName; ContactAddressRef contactAddress = m_App.getContactManager().getContactAddress(address); - if(contactAddress) + if (contactAddress) dispName = contactAddress->getDispName(); - if(dispName.empty()) + if (dispName.empty()) dispName = address; return dispName; } @@ -47,7 +47,7 @@ std::string MbeRecipients::getDispName(const std::string &address) const void MbeRecipients::updateItemsDispName() { auto items = getItems(); - for(MbeRecipientItem *item: items) + for (MbeRecipientItem *item: items) { item->setDispName(getDispName(item->getAddress())); } @@ -57,7 +57,7 @@ void MbeRecipients::update(const MsgAddressList &addressList) { clear(); int addrListLen = addressList.getLength(); - for(int i = 0; i < addrListLen; i++) + for (int i = 0; i < addrListLen; i++) { const MsgAddress &addr = addressList.at(i); appendItem(addr.getAddress(), addr.getAddressType()); @@ -67,10 +67,10 @@ void MbeRecipients::update(const MsgAddressList &addressList) void MbeRecipients::update(ThreadId threadId) { clear(); - if(threadId.isValid()) + if (threadId.isValid()) { MsgAddressListRef addrList = m_App.getMsgEngine().getStorage().getAddressList(threadId); - if(addrList) + if (addrList) update(*addrList); } } @@ -82,29 +82,25 @@ MbeRecipients::AppendItemStatus MbeRecipients::appendItem(const std::string &add MbeRecipients::AppendItemStatus MbeRecipients::appendItem(const std::string &address, const std::string &dispName, MsgAddress::AddressType addressType) { - if(getItemsCount() >= m_App.getMsgEngine().getSettings().getMaxRecipientCount()) + if (getItemsCount() >= m_App.getMsgEngine().getSettings().getMaxRecipientCount()) return TooManyRecipStatus; AppendItemStatus result = SuccessStatus; - if(!isRecipientExists(address)) + if (!isRecipientExists(address)) { - if(addressType == MsgAddress::UnknownAddressType) + if (addressType == MsgAddress::UnknownAddressType) addressType = MsgUtils::getAddressType(address); - if(addressType == MsgAddress::Phone || addressType == MsgAddress::Email) + if (addressType == MsgAddress::Phone || addressType == MsgAddress::Email) { result = SuccessStatus; MbeRecipientItem *item = new MbeRecipientItem(address, dispName, addressType); MbeRecipientsView::appendItem(*item); - } - else - { + } else { result = InvalidRecipStatus; MSG_LOG("invalid recipient: ", address); } - } - else - { + } else { result = DuplicatedStatus; } return result; @@ -113,10 +109,10 @@ MbeRecipients::AppendItemStatus MbeRecipients::appendItem(const std::string &add bool MbeRecipients::isRecipientExists(const std::string& address) const { auto recipientList = getItems(); - for(auto pViewItem : recipientList) + for (auto pViewItem : recipientList) { MbeRecipientItem *pItem = dynamic_cast(pViewItem); - if(pItem && pItem->getAddress() == address) + if (pItem && pItem->getAddress() == address) return true; } diff --git a/src/Common/Controller/src/NaviFrameController.cpp b/src/Common/Controller/src/NaviFrameController.cpp index 8bce706..565ca2b 100644 --- a/src/Common/Controller/src/NaviFrameController.cpp +++ b/src/Common/Controller/src/NaviFrameController.cpp @@ -42,7 +42,7 @@ NaviFrameController::~NaviFrameController() void NaviFrameController::pop(FrameController &frame) { - if(isLastFrame()) + if (isLastFrame()) getApp().exit(); else { @@ -60,7 +60,7 @@ bool NaviFrameController::prepare(const AppControlCommand &cmd) { MSG_LOG("Execute app. control command: ", cmd.getOperationMsg()); std::string errorMsg; - if(!getMsgEngine().isReady(errorMsg)) + if (!getMsgEngine().isReady(errorMsg)) { notification_status_message_post(errorMsg.c_str()); return false; @@ -70,26 +70,24 @@ bool NaviFrameController::prepare(const AppControlCommand &cmd) void NaviFrameController::execCmd(const AppControlDefaultRef &cmd) { - if(prepare(*cmd)) + if (prepare(*cmd)) { AppControlDefault::DefaultType type = cmd->getDefaultType(); MsgThread *thread = getTopFrame(); // Check if thread is open - if(!thread) + if (!thread) insertToBottom(*new MsgThread(*this)); // Push thread list to the bottom Conversation *conv = getTopFrame(); // Check if conversation is open MessageRef msg = getMsgEngine().getStorage().getMessage(cmd->getMessageId()); //To avoid opening conversation if MsgId is invalid - if(type != AppControlDefault::MainType && msg != nullptr) + if (type != AppControlDefault::MainType && msg != nullptr) { - if(conv) + if (conv) { promote(*conv); conv->execCmd(cmd); - } - else if(!conv) - { - if(type == AppControlDefault::ViewType || type == AppControlDefault::ReplyType || isUnreadNotificationSingle(type)) + } else if (!conv) { + if (type == AppControlDefault::ViewType || type == AppControlDefault::ReplyType || isUnreadNotificationSingle(type)) { Conversation *conversation = new Conversation(*this); push(*conversation); @@ -102,15 +100,13 @@ void NaviFrameController::execCmd(const AppControlDefaultRef &cmd) void NaviFrameController::execCmd(const AppControlComposeRef &cmd) { - if(prepare(*cmd)) + if (prepare(*cmd)) { Conversation *conv = getTopFrame(); - if(conv) + if (conv) { promote(*conv); - } - else - { + } else { conv = new Conversation(*this); push(*conv); } @@ -122,10 +118,10 @@ template T *NaviFrameController::getTopFrame() const { auto items = getItems(); - for(auto item = items.rbegin(); item != items.rend(); ++item) + for (auto item = items.rbegin(); item != items.rend(); ++item) { T *frame = dynamic_cast(*item); - if(frame) + if (frame) return frame; } return nullptr; @@ -144,7 +140,7 @@ bool NaviFrameController::isUnreadNotificationSingle(AppControlDefault::DefaultT void NaviFrameController::onHwBackButtonClicked() { auto *top = getTopFrame(); - if(top) + if (top) pop(*top); } @@ -165,14 +161,14 @@ void NaviFrameController::onResume(NaviFrameItem &item) void NaviFrameController::onAppPause() { auto *top = getTopFrame(); - if(top) + if (top) top->pause(); } void NaviFrameController::onAppResume() { auto *top = getTopFrame(); - if(top) + if (top) top->resume(); } diff --git a/src/Common/Controller/src/SaveAttachments.cpp b/src/Common/Controller/src/SaveAttachments.cpp index 988f60d..b4f0f36 100644 --- a/src/Common/Controller/src/SaveAttachments.cpp +++ b/src/Common/Controller/src/SaveAttachments.cpp @@ -69,7 +69,7 @@ void SaveAttachments::createList() m_pList->show(); fillList(); - if(m_pList->getItemsCount() > 1) + if (m_pList->getItemsCount() > 1) showSelectAllItem(); m_pList->checkAllItems(false); @@ -79,13 +79,13 @@ void SaveAttachments::fillList() { MessageMmsRef mms = std::dynamic_pointer_cast(getMsgEngine().getStorage().getMessage(m_Id)); const MsgPageList &pageList = mms->getPageList(); - for(int i = 0; i < pageList.getLength(); ++i) + for (int i = 0; i < pageList.getLength(); ++i) { const MsgMediaList &mediaList = pageList.at(i).getMediaList(); - for(int j = 0; j < mediaList.getLength(); ++j) + for (int j = 0; j < mediaList.getLength(); ++j) { MsgMedia::Type type = mediaList.at(j).getType(); - if(type != MsgMedia::TextType && type != MsgMedia::UnknownType) + if (type != MsgMedia::TextType && type != MsgMedia::UnknownType) { appendItem(mediaList.at(j).getFileName(), mediaList.at(j).getFilePath(), nullptr, this); } @@ -93,7 +93,7 @@ void SaveAttachments::fillList() } const MsgAttachmentList &attachmentList = mms->getAttachmentList(); - for(int i = 0; i < attachmentList.getLength(); ++i) + for (int i = 0; i < attachmentList.getLength(); ++i) { appendItem(attachmentList.at(i).getFileName(), attachmentList.at(i).getFilePath(), nullptr, this); } @@ -107,7 +107,7 @@ void SaveAttachments::appendItem(const std::string &text, const std::string &pat void SaveAttachments::updateSelectItemsTitle() { int checked = getAttachmentsCheckedCount(); - if(checked > 0) + if (checked > 0) getNaviBar().setTitle(msgArgs("IDS_MSG_HEADER_PD_SELECTED_ABB3", checked)); else getNaviBar().setTitle(msgt("IDS_MSG_HEADER_SELECT_ITEMS_ABB3")); @@ -117,9 +117,9 @@ int SaveAttachments::getAttachmentsCheckedCount() const { auto items = m_pList->getItems(); int count = 0; - for(SaveAttachmentsListItem *item : items) + for (SaveAttachmentsListItem *item : items) { - if(item->isCheckable() && item->getCheckedState()) + if (item->isCheckable() && item->getCheckedState()) ++count; } return count; @@ -128,7 +128,7 @@ int SaveAttachments::getAttachmentsCheckedCount() const void SaveAttachments::showSelectAllItem() { SelectAllListItem *item = dynamic_cast(m_pList->getFirstItem()); - if(!item) + if (!item) { item = new SelectAllListItem; m_pList->prependItem(*item); @@ -137,7 +137,7 @@ void SaveAttachments::showSelectAllItem() void SaveAttachments::onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId) { - switch(buttonId) + switch (buttonId) { case NaviCancelButtonId: onHwBackButtonClicked(); @@ -159,7 +159,7 @@ void SaveAttachments::onNaviOkButtonClicked() bool result = saveCheckedItems(); - if(result) + if (result) notification_status_message_post(msg("IDS_MSG_TPOP_ATTACHMENTS_SAVED_IN_MY_FILES_DOWNLOADS").cStr()); else showSavingFailedPopup(); @@ -175,7 +175,7 @@ void SaveAttachments::onHwBackButtonClicked() void SaveAttachments::onListItemChecked(ListItem &listItem) { MSG_LOG(""); - if(SelectAllListItem *it = dynamic_cast(&listItem)) + if (SelectAllListItem *it = dynamic_cast(&listItem)) checkSelectAllItem(*it); else checkItem(listItem); @@ -198,12 +198,12 @@ void SaveAttachments::checkItem(ListItem &item) void SaveAttachments::updateSelectAllItem() { - if(m_pList->getItems().size() > 1) + if (m_pList->getItems().size() > 1) { bool allChecked = areAllItemsChecked(); SelectAllListItem *selectAllItem = dynamic_cast(m_pList->getFirstItem()); - if(selectAllItem) + if (selectAllItem) selectAllItem->setCheckedState(allChecked, true); } } @@ -213,9 +213,9 @@ bool SaveAttachments::areAllItemsChecked() const ListItemCollection items = m_pList->getItems(); auto item = items.empty() ? items.begin() : ++items.begin(); - for(; item != items.end(); ++item) + for (; item != items.end(); ++item) { - if((*item)->isCheckable() && !(*item)->getCheckedState()) + if ((*item)->isCheckable() && !(*item)->getCheckedState()) return false; } return true; @@ -224,9 +224,9 @@ bool SaveAttachments::areAllItemsChecked() const bool SaveAttachments::shouldEnableSaveBtn() const { ListItemCollection items = m_pList->getItems(); - for(auto *item : items) + for (auto *item : items) { - if(item->isCheckable() && item->getCheckedState()) + if (item->isCheckable() && item->getCheckedState()) return true; } return false; @@ -240,9 +240,9 @@ bool SaveAttachments::saveCheckedItems() auto items = m_pList->getItems(); std::list files; - for(auto *item : items) + for (auto *item : items) { - if(item->isCheckable() && item->getCheckedState()) + if (item->isCheckable() && item->getCheckedState()) files.push_back(item->getFilePath()); } diff --git a/src/Common/Controller/src/SaveAttachmentsListItem.cpp b/src/Common/Controller/src/SaveAttachmentsListItem.cpp index cdeeac3..d5809c0 100644 --- a/src/Common/Controller/src/SaveAttachmentsListItem.cpp +++ b/src/Common/Controller/src/SaveAttachmentsListItem.cpp @@ -45,7 +45,7 @@ SaveAttachmentsListItem::~SaveAttachmentsListItem() std::string SaveAttachmentsListItem::getText(ListItem &item, const char *part) { - if(!strcmp(part, namePart)) + if (!strcmp(part, namePart)) return m_FileName; return ""; diff --git a/src/Common/Controller/src/ViewItemController.cpp b/src/Common/Controller/src/ViewItemController.cpp index 5a237c8..74415b9 100644 --- a/src/Common/Controller/src/ViewItemController.cpp +++ b/src/Common/Controller/src/ViewItemController.cpp @@ -26,10 +26,8 @@ ViewItemController::ViewItemController(App &app) ViewItemController::ViewItemController(BaseController *parent) : BaseController(parent) { - } ViewItemController::~ViewItemController() { - } diff --git a/src/Common/MsgEngine/inc/MsgAttachment.h b/src/Common/MsgEngine/inc/MsgAttachment.h index 1b2c60c..27978b8 100644 --- a/src/Common/MsgEngine/inc/MsgAttachment.h +++ b/src/Common/MsgEngine/inc/MsgAttachment.h @@ -25,7 +25,7 @@ namespace Msg class MsgAttachment; typedef std::shared_ptr MsgAttachmentRef; typedef MsgList MsgAttachmentList; - typedef std::shared_ptr>MsgAttachmentListRef; + typedef std::shared_ptr> MsgAttachmentListRef; class MsgAttachment { @@ -35,7 +35,6 @@ namespace Msg virtual std::string getFileName() const = 0; virtual int getFileSize() const = 0; virtual std::string getMime() const = 0; - virtual void setFilePath(const std::string &path) = 0; }; } diff --git a/src/Common/MsgEngine/inc/MsgEngine.h b/src/Common/MsgEngine/inc/MsgEngine.h index dac9d80..cc3d0a4 100644 --- a/src/Common/MsgEngine/inc/MsgEngine.h +++ b/src/Common/MsgEngine/inc/MsgEngine.h @@ -99,7 +99,6 @@ namespace Msg #else messages_service_h m_MsgHandle; #endif - }; } diff --git a/src/Common/MsgEngine/src/Message.cpp b/src/Common/MsgEngine/src/Message.cpp index cfbce2c..e082e6f 100644 --- a/src/Common/MsgEngine/src/Message.cpp +++ b/src/Common/MsgEngine/src/Message.cpp @@ -21,6 +21,5 @@ using namespace Msg; Message::~Message() { - } diff --git a/src/Common/MsgEngine/src/MessageMms.cpp b/src/Common/MsgEngine/src/MessageMms.cpp index dbe7d30..4d8c6e5 100644 --- a/src/Common/MsgEngine/src/MessageMms.cpp +++ b/src/Common/MsgEngine/src/MessageMms.cpp @@ -20,5 +20,4 @@ using namespace Msg; MessageMms::~MessageMms() { - } diff --git a/src/Common/MsgEngine/src/MessageSMS.cpp b/src/Common/MsgEngine/src/MessageSMS.cpp index 82f5480..8f43a0c 100644 --- a/src/Common/MsgEngine/src/MessageSMS.cpp +++ b/src/Common/MsgEngine/src/MessageSMS.cpp @@ -20,11 +20,9 @@ using namespace Msg; MessageSMS::MessageSMS() { - } MessageSMS::~MessageSMS() { - } diff --git a/src/Common/MsgEngine/src/MsgConversationItem.cpp b/src/Common/MsgEngine/src/MsgConversationItem.cpp index 32370f3..240b27b 100644 --- a/src/Common/MsgEngine/src/MsgConversationItem.cpp +++ b/src/Common/MsgEngine/src/MsgConversationItem.cpp @@ -20,5 +20,4 @@ using namespace Msg; MsgConversationItem::~MsgConversationItem() { - } diff --git a/src/Common/MsgEngine/src/MsgEngine.cpp b/src/Common/MsgEngine/src/MsgEngine.cpp index da8e7da..5a0bd11 100644 --- a/src/Common/MsgEngine/src/MsgEngine.cpp +++ b/src/Common/MsgEngine/src/MsgEngine.cpp @@ -45,7 +45,7 @@ MsgEngine::~MsgEngine() int MsgEngine::openService() { TRACE; - if(m_MsgHandle) + if (m_MsgHandle) { MSG_LOG_ERROR("Handle already has been opened"); } @@ -64,7 +64,7 @@ int MsgEngine::openService() result = messages_open_service(&m_MsgHandle); - /* if(result == MESSAGES_ERROR_NONE) + /* if (result == MESSAGES_ERROR_NONE) { m_Storage.reset(new MsgStorage(m_ServiceHandle)); }*/ @@ -76,7 +76,7 @@ int MsgEngine::openService() int MsgEngine::closeService() { int result = 0; - if(m_MsgHandle) + if (m_MsgHandle) { #ifdef TIZEN_PRIVATE_API result = msg_close_msg_handle(&m_MsgHandle); @@ -92,7 +92,7 @@ int MsgEngine::closeService() bool MsgEngine::isReady(std::string &errorMsg) const { #ifdef TIZEN_PRIVATE_API - if(!m_MsgHandle) + if (!m_MsgHandle) { errorMsg = handleIsNullStr; return false; @@ -130,7 +130,7 @@ const MsgTransport &MsgEngine::getTransport() const MsgSettings &MsgEngine::getSettings() { - if(!m_Settings.get()) + if (!m_Settings.get()) m_Settings.reset(new MsgSettingsPrivate(m_MsgHandle)); return *m_Settings; } @@ -155,7 +155,7 @@ const MsgComposer &MsgEngine::getComposer() const std::string MsgEngine::whatError(int error) { #ifdef TIZEN_PRIVATE_API - switch(error) + switch (error) { case MSG_SUCCESS: return "MSG_SUCCESS"; @@ -358,7 +358,7 @@ std::string MsgEngine::whatError(int error) } #else - switch(error) + switch (error) { case MESSAGES_ERROR_NONE: return "MESSAGES_ERROR_NONE"; @@ -418,16 +418,16 @@ void MsgEngine::calculateTextMetric(const std::string &text, MsgTextMetric &text int bytesInChar = 1; textMetric.reset(); - if(!text.empty()) + if (!text.empty()) { - if(msg_util_calculate_text_length(text.c_str(), MSG_ENCODE_AUTO, &textLen, &segmentLen, &encode) != 0) + if (msg_util_calculate_text_length(text.c_str(), MSG_ENCODE_AUTO, &textLen, &segmentLen, &encode) != 0) { MSG_LOG_ERROR("msg_util_calculate_text_length returns error"); } textMetric.bytes = textLen; - switch(encode) + switch (encode) { case MSG_ENCODE_UCS2: bytesInChar = 2; @@ -447,15 +447,15 @@ void MsgEngine::calculateTextMetric(const std::string &text, MsgTextMetric &text segmentLen /= bytesInChar; } - if(segmentLen == 0) + if (segmentLen == 0) segmentLen = encode == MSG_ENCODE_UCS2 ? maxUnicodeLen : maxGsm7Len; - if(textLen == 0) + if (textLen == 0) textLen = text.length() / bytesInChar; textMetric.segmentsCount = (textLen / (segmentLen + 1)) + 1; - if(textLen > 0) + if (textLen > 0) textMetric.charsLeft = segmentLen - (textLen % (segmentLen + 1)); else textMetric.charsLeft = maxGsm7Len; diff --git a/src/Common/MsgEngine/src/MsgSettings.cpp b/src/Common/MsgEngine/src/MsgSettings.cpp index 3f1a601..47ea37d 100644 --- a/src/Common/MsgEngine/src/MsgSettings.cpp +++ b/src/Common/MsgEngine/src/MsgSettings.cpp @@ -26,12 +26,10 @@ const int defaultMaxAttachmentsCount = 10; MsgSettings::MsgSettings() { - } MsgSettings::~MsgSettings() { - } int MsgSettings::getMessageTextMaxChar() const @@ -52,7 +50,7 @@ int MsgSettings::getAttachmentsMaxCount() const void MsgSettings::addListener(IMsgSettingsListener &listener) { auto itr = std::find(m_Listeners.begin(), m_Listeners.end(), &listener); - if(itr == m_Listeners.end()) + if (itr == m_Listeners.end()) { m_Listeners.push_back(&listener); } @@ -61,7 +59,7 @@ void MsgSettings::addListener(IMsgSettingsListener &listener) void MsgSettings::removeListener(IMsgSettingsListener &listener) { auto itr = std::find(m_Listeners.begin(), m_Listeners.end(), &listener); - if(itr != m_Listeners.end()) + if (itr != m_Listeners.end()) { m_Listeners.erase(itr); } diff --git a/src/Common/MsgEngine/src/MsgStorage.cpp b/src/Common/MsgEngine/src/MsgStorage.cpp index 1dd33a0..192173b 100644 --- a/src/Common/MsgEngine/src/MsgStorage.cpp +++ b/src/Common/MsgEngine/src/MsgStorage.cpp @@ -33,7 +33,7 @@ MsgStorage::~MsgStorage() void MsgStorage::addListener(IMsgStorageListener &listener) { auto itr = std::find(m_Listeners.begin(), m_Listeners.end(), &listener); - if(itr == m_Listeners.end()) + if (itr == m_Listeners.end()) { m_Listeners.push_back(&listener); } @@ -42,7 +42,7 @@ void MsgStorage::addListener(IMsgStorageListener &listener) void MsgStorage::removeListener(IMsgStorageListener &listener) { auto itr = std::find(m_Listeners.begin(), m_Listeners.end(), &listener); - if(itr != m_Listeners.end()) + if (itr != m_Listeners.end()) { m_Listeners.erase(itr); } @@ -50,18 +50,18 @@ void MsgStorage::removeListener(IMsgStorageListener &listener) bool MsgStorage::hasEmail(ThreadId id) { - if(!id.isValid()) + if (!id.isValid()) return false; const MsgAddressListRef addressList = getAddressList(id); - if(addressList) + if (addressList) { - for(int i = 0; i < addressList->getLength(); ++i) + for (int i = 0; i < addressList->getLength(); ++i) { const MsgAddress &msgAddr = addressList->at(i); - if(msgAddr.getAddressType() == MsgAddress::Email) + if (msgAddr.getAddressType() == MsgAddress::Email) return true; - else if(MsgUtils::isValidEmail(msgAddr.getAddress())) + else if (MsgUtils::isValidEmail(msgAddr.getAddress())) return true; } } diff --git a/src/Common/MsgEngine/src/MsgThreadItem.cpp b/src/Common/MsgEngine/src/MsgThreadItem.cpp index b4f53e7..0654ba1 100644 --- a/src/Common/MsgEngine/src/MsgThreadItem.cpp +++ b/src/Common/MsgEngine/src/MsgThreadItem.cpp @@ -20,6 +20,5 @@ using namespace Msg; MsgThreadItem::~MsgThreadItem() { - } diff --git a/src/Common/MsgEngine/src/MsgTransport.cpp b/src/Common/MsgEngine/src/MsgTransport.cpp index 47a70a6..c922d89 100644 --- a/src/Common/MsgEngine/src/MsgTransport.cpp +++ b/src/Common/MsgEngine/src/MsgTransport.cpp @@ -20,12 +20,10 @@ using Msg::MsgTransport; MsgTransport::MsgTransport() { - } MsgTransport::~MsgTransport() { - } MsgTransport::SendResult MsgTransport::sendMessage(MessageRef &msg, ThreadId *threadId) diff --git a/src/Common/MsgEngine/src/MsgUtils.cpp b/src/Common/MsgEngine/src/MsgUtils.cpp index 7c04b7c..71fcb38 100644 --- a/src/Common/MsgEngine/src/MsgUtils.cpp +++ b/src/Common/MsgEngine/src/MsgUtils.cpp @@ -40,21 +40,19 @@ TokenizedRecipients MsgUtils::tokenizeRecipients(const std::string &inputText) std::string token; MsgAddress::AddressType addressType = MsgAddress::UnknownAddressType; - while(begin != end) + while (begin != end) { - if(begin != std::string::npos) + if (begin != std::string::npos) { token = inputText.substr(begin, end != std::string::npos ? end-begin : std::string::npos); begin = inputText.find_first_not_of(delimiters, end); result.invalidResult.append(token); addressType = getAddressType(result.invalidResult); - if(addressType != MsgAddress::UnknownAddressType) + if (addressType != MsgAddress::UnknownAddressType) { result.validResults.push_back(std::make_pair(result.invalidResult, addressType)); result.invalidResult.clear(); - } - else if(end != std::string::npos) - { + } else if (end != std::string::npos) { result.invalidResult.append(inputText.substr(end, begin != std::string::npos ? begin-end : std::string::npos)); } end = inputText.find_first_of(delimiters, begin); @@ -66,20 +64,20 @@ TokenizedRecipients MsgUtils::tokenizeRecipients(const std::string &inputText) bool MsgUtils::isValidNumber(const std::string &address) { - if(address.empty()) + if (address.empty()) return false; std::regex numTemplate(numberRegex); - return std::regex_match(address,numTemplate); + return std::regex_match(address, numTemplate); } bool MsgUtils::isValidEmail(const std::string &address) { - if(address.empty() || address.length() > emailAddrLenMax) + if (address.empty() || address.length() > emailAddrLenMax) return false; std::regex emailTemplate(emailRegex); - return std::regex_match(address,emailTemplate); + return std::regex_match(address, emailTemplate); } bool MsgUtils::isValidAddress(const std::string &address) @@ -89,12 +87,12 @@ bool MsgUtils::isValidAddress(const std::string &address) MsgAddress::AddressType MsgUtils::getAddressType(const std::string &address) { - if(isValidNumber(address)) + if (isValidNumber(address)) { return MsgAddress::Phone; } - if(isValidEmail(address)) + if (isValidEmail(address)) { return MsgAddress::Email; } @@ -105,9 +103,9 @@ MsgAddress::AddressType MsgUtils::getAddressType(const std::string &address) std::string MsgUtils::makeNormalizedNumber(const std::string &number) { std::string normalizedNumber; - for(auto symbol : number) + for (auto symbol : number) { - if(isdigit(symbol) || symbol == '*' || symbol == '#' || symbol == '+') + if (isdigit(symbol) || symbol == '*' || symbol == '#' || symbol == '+') { normalizedNumber += symbol; } @@ -118,9 +116,9 @@ std::string MsgUtils::makeNormalizedNumber(const std::string &number) std::string MsgUtils::makeCleanedNumber(const std::string &number) { std::string cleanedNumber; - for(auto symbol : number) + for (auto symbol : number) { - if(isdigit(symbol)) + if (isdigit(symbol)) cleanedNumber += symbol; } return cleanedNumber; @@ -128,7 +126,7 @@ std::string MsgUtils::makeCleanedNumber(const std::string &number) bool MsgUtils::isMms(Message::Type type) { - switch(type) + switch (type) { case Message::MT_MMS: case Message::MT_MMS_Noti: @@ -147,17 +145,15 @@ std::string MsgUtils::makeKbStr(long long bytes) { const long long kb = 1024; // Bytes in kb long long sizeKb = 0; - if(bytes <= kb) + if (bytes <= kb) { sizeKb = 1; - } - else - { + } else { sizeKb = bytes / kb; long long sizeB = bytes % kb; - if(sizeB >= (kb / 2)) + if (sizeB >= (kb / 2)) ++sizeKb; } - return std::to_string(sizeKb) + " " + (std::string)msg("IDS_MSGF_BODY_MSGSIZE_KB"); + return std::to_string(sizeKb) + " " + (std::string)msg("IDS_MSGF_BODY_MSGSIZE_KB"); } diff --git a/src/Common/MsgEngine/src/private/MessageMmsPrivate.cpp b/src/Common/MsgEngine/src/private/MessageMmsPrivate.cpp index d08866e..5a16722 100644 --- a/src/Common/MsgEngine/src/private/MessageMmsPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MessageMmsPrivate.cpp @@ -31,10 +31,10 @@ MessageMmsPrivate::MessageMmsPrivate(bool release, msg_struct_t msgStruct, msg_s , m_Page(false) , m_Attachment(false) { - if(!m_MmsStruct) + if (!m_MmsStruct) { m_MmsStruct = msg_create_struct(MSG_STRUCT_MMS); - if(msgStruct) + if (msgStruct) { msg_get_mms_struct(m_MsgStruct, m_MmsStruct); } @@ -59,7 +59,7 @@ msg_struct_t MessageMmsPrivate::getMmsStruct() const MessageMmsPrivate::~MessageMmsPrivate() { - if(m_MmsStruct) + if (m_MmsStruct) { msg_release_struct(&m_MmsStruct); } @@ -83,19 +83,19 @@ std::string MessageMmsPrivate::getText() const std::string result; int size = pageList.getLength(); - for(int i = 0; i < size; ++i) + for (int i = 0; i < size; ++i) { const MsgMediaList &mediaList = pageList.at(i).getMediaList(); int sizeList = mediaList.getLength(); - for(int j = 0; j < sizeList; ++j) + for (int j = 0; j < sizeList; ++j) { - if(mediaList[j].getType() == MsgMedia::TextType) + if (mediaList[j].getType() == MsgMedia::TextType) { std::string str = FileUtils::readTextFile(mediaList[j].getFilePath()); - if(!str.empty()) + if (!str.empty()) { - if(i > 0 && !result.empty()) + if (i > 0 && !result.empty()) result.append("\n"); result += std::move(str); @@ -112,14 +112,14 @@ int MessageMmsPrivate::getMediaCount() const int result = 0; int size = pageList.getLength(); - for(int i = 0; i < size; ++i) + for (int i = 0; i < size; ++i) { const MsgMediaList &mediaList = pageList.at(i).getMediaList(); int sizeList = mediaList.getLength(); - for(int j = 0; j < sizeList; ++j) + for (int j = 0; j < sizeList; ++j) { - if(mediaList[j].getType() != MsgMedia::TextType && mediaList[j].getType() != MsgMedia::UnknownType) + if (mediaList[j].getType() != MsgMedia::TextType && mediaList[j].getType() != MsgMedia::UnknownType) ++result; } } @@ -169,7 +169,7 @@ int MessageMmsPrivate::getSize() const { int msgSize = 0; int res = msg_get_int_value(m_MmsStruct, MSG_MMS_HEADER_SIZE_INT, &msgSize); // Size in bytes - if(res != MSG_SUCCESS || msgSize <= 0) + if (res != MSG_SUCCESS || msgSize <= 0) msgSize = MessagePrivate::getSize(); return msgSize; } diff --git a/src/Common/MsgEngine/src/private/MessagePrivate.cpp b/src/Common/MsgEngine/src/private/MessagePrivate.cpp index ddd8c09..075dc1d 100644 --- a/src/Common/MsgEngine/src/private/MessagePrivate.cpp +++ b/src/Common/MsgEngine/src/private/MessagePrivate.cpp @@ -61,7 +61,7 @@ MsgAddressPrivate &MessagePrivate::addAddress() void MessagePrivate::addAddresses(const MsgAddressList &list) { int len = list.getLength(); - for(int i = 0; i < len; ++i) + for (int i = 0; i < len; ++i) { MsgAddressPrivate &newAddr = MessagePrivate::addAddress(); newAddr.setFields(list[i]); @@ -102,7 +102,7 @@ void MessagePrivate::setText(const std::string &text) std::string MessagePrivate::getText() const { - if(isMms()) + if (isMms()) return MsgUtilsPrivate::getStr(m_MsgStruct, MSG_MESSAGE_MMS_TEXT_STR, MAX_MSG_TEXT_LEN); else return MsgUtilsPrivate::getStr(m_MsgStruct, MSG_MESSAGE_SMS_DATA_STR, MAX_MSG_DATA_LEN); @@ -146,7 +146,7 @@ void MessagePrivate::setSubject(const std::string &text) void MessagePrivate::setMessageStorageType(Message::MessageStorageType msgStorage) { - switch(msgStorage) + switch (msgStorage) { case Message::MS_Phone: msg_set_int_value(m_MsgStruct, MSG_MESSAGE_STORAGE_ID_INT, MSG_STORAGE_PHONE); @@ -170,7 +170,6 @@ Message::MessageStorageType MessagePrivate::getMessageStorageType() const void MessagePrivate::commit() { - } bool MessagePrivate::isMms() const diff --git a/src/Common/MsgEngine/src/private/MessageSMSPrivate.cpp b/src/Common/MsgEngine/src/private/MessageSMSPrivate.cpp index ef4419e..8aabfad 100644 --- a/src/Common/MsgEngine/src/private/MessageSMSPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MessageSMSPrivate.cpp @@ -31,7 +31,6 @@ MessageSMSPrivate::MessageSMSPrivate(bool release, msg_struct_t msgStruct) : MessagePrivate(release, msgStruct) , MessageSMS() { - } MessageSMSPrivate::~MessageSMSPrivate() diff --git a/src/Common/MsgEngine/src/private/MsgAddressPrivate.cpp b/src/Common/MsgEngine/src/private/MsgAddressPrivate.cpp index 3d5ef68..88a2a14 100644 --- a/src/Common/MsgEngine/src/private/MsgAddressPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgAddressPrivate.cpp @@ -25,12 +25,10 @@ MsgAddressPrivate::MsgAddressPrivate(bool release, msg_struct_t msgStruct) : MsgStructPrivate(release, msgStruct) , MsgAddress() { - } MsgAddressPrivate::~MsgAddressPrivate() { - } std::string MsgAddressPrivate::getAddress() const diff --git a/src/Common/MsgEngine/src/private/MsgAttachmentPrivate.cpp b/src/Common/MsgEngine/src/private/MsgAttachmentPrivate.cpp index 5004780..10d1b91 100644 --- a/src/Common/MsgEngine/src/private/MsgAttachmentPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgAttachmentPrivate.cpp @@ -29,7 +29,6 @@ MsgAttachmentPrivate::MsgAttachmentPrivate(bool release, msg_struct_t msgStruct) MsgAttachmentPrivate::~MsgAttachmentPrivate() { - } std::string MsgAttachmentPrivate::getFilePath() const @@ -47,7 +46,7 @@ int MsgAttachmentPrivate::getFileSize() const int size = 0; msg_get_int_value(m_MsgStruct, MSG_MMS_ATTACH_FILESIZE_INT, &size); - if(size == 0) + if (size == 0) { MSG_LOG_WARN("File ", getFilePath(), " size = 0, trying to get real file size"); size = (int)FileUtils::getFileSize(getFilePath()); diff --git a/src/Common/MsgEngine/src/private/MsgComposerPrivate.cpp b/src/Common/MsgEngine/src/private/MsgComposerPrivate.cpp index 05f9262..70c8571 100644 --- a/src/Common/MsgEngine/src/private/MsgComposerPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgComposerPrivate.cpp @@ -27,19 +27,17 @@ using namespace Msg; MsgComposerPrivate::MsgComposerPrivate() { - } MsgComposerPrivate::~MsgComposerPrivate() { - } MessageSMSRef MsgComposerPrivate::createSms() { MessageSMSRef smsRef; msg_struct_t msgInfo = msg_create_struct(MSG_STRUCT_MESSAGE_INFO); - if(msgInfo) + if (msgInfo) { msg_set_int_value(msgInfo, MSG_MESSAGE_TYPE_INT, MSG_TYPE_SMS); @@ -53,7 +51,7 @@ MessageMmsRef MsgComposerPrivate::createMms() { MessageMmsRef mmsRef; msg_struct_t msgInfo = msg_create_struct(MSG_STRUCT_MESSAGE_INFO); - if(msgInfo) + if (msgInfo) { msg_set_int_value(msgInfo, MSG_MESSAGE_TYPE_INT, MSG_TYPE_MMS); msg_struct_t mmsStruct = msg_create_struct(MSG_STRUCT_MMS); diff --git a/src/Common/MsgEngine/src/private/MsgConvMediaPrivate.cpp b/src/Common/MsgEngine/src/private/MsgConvMediaPrivate.cpp index efe9f32..8b34264 100644 --- a/src/Common/MsgEngine/src/private/MsgConvMediaPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgConvMediaPrivate.cpp @@ -23,12 +23,10 @@ MsgConvMediaPrivate::MsgConvMediaPrivate(bool release, msg_struct_t msgStruct) : MsgStructPrivate(release, msgStruct) , MsgConvMedia() { - } MsgConvMediaPrivate::~MsgConvMediaPrivate() { - } std::string MsgConvMediaPrivate::getMime() const diff --git a/src/Common/MsgEngine/src/private/MsgConvMediaPrivate.h b/src/Common/MsgEngine/src/private/MsgConvMediaPrivate.h index ffd8ab1..6351835 100644 --- a/src/Common/MsgEngine/src/private/MsgConvMediaPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgConvMediaPrivate.h @@ -37,7 +37,6 @@ namespace Msg virtual std::string getThumbPath() const; virtual std::string getContentId() const; virtual std::string getContentLocation() const; - }; typedef class MsgListHandlePrivate MsgConvMediaListHandlePrivate; diff --git a/src/Common/MsgEngine/src/private/MsgConversationItemPrivate.cpp b/src/Common/MsgEngine/src/private/MsgConversationItemPrivate.cpp index d7415f9..2981a96 100644 --- a/src/Common/MsgEngine/src/private/MsgConversationItemPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgConversationItemPrivate.cpp @@ -27,12 +27,10 @@ MsgConversationItemPrivate::MsgConversationItemPrivate(bool release, msg_struct_ : MsgStructPrivate(release, msgStruct) , m_MultipartList(false) { - } MsgConversationItemPrivate::~MsgConversationItemPrivate() { - } MsgId MsgConversationItemPrivate::getMsgId() const diff --git a/src/Common/MsgEngine/src/private/MsgListHandlePrivate.h b/src/Common/MsgEngine/src/private/MsgListHandlePrivate.h index 92d7145..28e3869 100644 --- a/src/Common/MsgEngine/src/private/MsgListHandlePrivate.h +++ b/src/Common/MsgEngine/src/private/MsgListHandlePrivate.h @@ -38,7 +38,7 @@ namespace Msg virtual ~MsgListHandlePrivate() { - if(m_Release && m_List) + if (m_Release && m_List) { msg_list_free(m_List); } diff --git a/src/Common/MsgEngine/src/private/MsgMediaPrivate.cpp b/src/Common/MsgEngine/src/private/MsgMediaPrivate.cpp index 0d189b4..da043e9 100644 --- a/src/Common/MsgEngine/src/private/MsgMediaPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgMediaPrivate.cpp @@ -32,7 +32,6 @@ MsgMediaPrivate::MsgMediaPrivate(bool release, msg_struct_t msgStruct) MsgMediaPrivate::~MsgMediaPrivate() { - } MsgMediaPrivate::Type MsgMediaPrivate::getType() const @@ -61,7 +60,7 @@ void MsgMediaPrivate::setType(Type type) { msg_set_int_value(m_MsgStruct, MSG_MMS_MEDIA_TYPE_INT, MsgUtilsPrivate::smilTypeToNative(type)); - switch(type) + switch (type) { case ImageType: case VideoType: diff --git a/src/Common/MsgEngine/src/private/MsgPagePrivate.cpp b/src/Common/MsgEngine/src/private/MsgPagePrivate.cpp index 038eb24..b7ae9a8 100644 --- a/src/Common/MsgEngine/src/private/MsgPagePrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgPagePrivate.cpp @@ -23,7 +23,6 @@ MsgPagePrivate::MsgPagePrivate(bool release, msg_struct_t msgStruct) , m_MediaList(false) , m_Media(false) { - } MsgPagePrivate::~MsgPagePrivate() diff --git a/src/Common/MsgEngine/src/private/MsgReportPrivate.cpp b/src/Common/MsgEngine/src/private/MsgReportPrivate.cpp index 92d8a46..4c0a20c 100644 --- a/src/Common/MsgEngine/src/private/MsgReportPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgReportPrivate.cpp @@ -25,12 +25,10 @@ MsgReportPrivate::MsgReportPrivate(bool release, msg_struct_t msgStruct) : MsgStructPrivate(release, msgStruct) , MsgReport() { - } MsgReportPrivate::~MsgReportPrivate() { - } std::string MsgReportPrivate::getAddress() const diff --git a/src/Common/MsgEngine/src/private/MsgReportPrivate.h b/src/Common/MsgEngine/src/private/MsgReportPrivate.h index d4ffae8..6885c6c 100644 --- a/src/Common/MsgEngine/src/private/MsgReportPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgReportPrivate.h @@ -37,7 +37,6 @@ namespace Msg virtual ReadStatus getReadStatus() const; virtual Type getType() const; virtual time_t getTime() const; - }; typedef class MsgListHandlePrivate MsgReportListHandlePrivate; diff --git a/src/Common/MsgEngine/src/private/MsgSettingsPrivate.cpp b/src/Common/MsgEngine/src/private/MsgSettingsPrivate.cpp index bc2737a..9f649a1 100644 --- a/src/Common/MsgEngine/src/private/MsgSettingsPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgSettingsPrivate.cpp @@ -62,10 +62,10 @@ void MsgSettingsPrivate::init() void MsgSettingsPrivate::finit() { - if(m_pActiveNotifJob) + if (m_pActiveNotifJob) { ecore_job_del(m_pActiveNotifJob); - m_pActiveNotifJob= nullptr; + m_pActiveNotifJob = nullptr; vconf_set_int(VCONFKEY_MESSAGE_ACTIVATED_CONVERSATION_ID, m_ActiveNotifValue); MSG_LOG("ActiveNotifValue = ", m_ActiveNotifValue); } @@ -109,20 +109,18 @@ int MsgSettingsPrivate::getMaxMmsSize() const { int res = 0; msg_struct_t setting = msg_create_struct(MSG_STRUCT_SETTING_MSGSIZE_OPT); - if(msg_get_msgsize_opt(m_ServiceHandle, setting) == 0) + if (msg_get_msgsize_opt(m_ServiceHandle, setting) == 0) msg_get_int_value(setting, MSG_MESSAGE_SIZE_INT, &res); msg_release_struct(&setting); // Standard MMS has size 307200 bytes const int kb = 1024; - if(res > 0) + if (res > 0) { res *= kb; res -= 5 * kb; // header size - } - else - { + } else { res = MAX_MSG_DATA_LEN * kb; } @@ -151,7 +149,7 @@ void MsgSettingsPrivate::setRingtoneType(RingtoneType type) { msg_set_int_value(m_GeneralOpt, MSG_GENERAL_RINGTONE_TYPE_INT, MsgUtilsPrivate::ringtoneTypeToNative(type)); msg_set_general_opt(m_ServiceHandle, m_GeneralOpt); - for(auto listener: m_Listeners) + for (auto listener: m_Listeners) { listener->onRingtoneChanged(*this); } @@ -168,7 +166,7 @@ void MsgSettingsPrivate::setRingtone(const std::string &soundPath) { MsgUtilsPrivate::setStr(m_GeneralOpt, MSG_GENERAL_RINGTONE_PATH_STR, soundPath); msg_set_general_opt(m_ServiceHandle, m_GeneralOpt); - for(auto listener: m_Listeners) + for (auto listener: m_Listeners) { listener->onRingtoneChanged(*this); } @@ -233,7 +231,7 @@ bool MsgSettingsPrivate::getMmsReadReport() const void MsgSettingsPrivate::setMmsAutoRetr(bool value) { - int retrType= value ? MSG_HOME_AUTO_DOWNLOAD : MSG_HOME_MANUAL; + int retrType = value ? MSG_HOME_AUTO_DOWNLOAD : MSG_HOME_MANUAL; msg_set_int_value(m_MmsRecvOpt, MSG_MMS_RECVOPT_HOME_RETRIEVE_TYPE_INT, retrType); msg_set_mms_recv_opt(m_ServiceHandle, m_MmsRecvOpt); } @@ -277,7 +275,7 @@ void MsgSettingsPrivate::setActiveNotifPolicy(ThreadId id) void MsgSettingsPrivate::addJobSetActiveNotifPolicy(int value) { m_ActiveNotifValue = value; - if(!m_pActiveNotifJob) + if (!m_pActiveNotifJob) { m_pActiveNotifJob = ecore_job_add ( @@ -288,7 +286,6 @@ void MsgSettingsPrivate::addJobSetActiveNotifPolicy(int value) vconf_set_int(VCONFKEY_MESSAGE_ACTIVATED_CONVERSATION_ID, self->m_ActiveNotifValue); MSG_LOG("ActiveNotifValue = ", self->m_ActiveNotifValue); }, - this - ); + this); } } diff --git a/src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp b/src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp index a9a09af..6c2bea1 100644 --- a/src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp @@ -43,7 +43,7 @@ MsgStoragePrivate::MsgStoragePrivate(msg_handle_t serviceHandle) template void MsgStoragePrivate::notifyListeners(const T& delta, ListenerMethod method) { - for(auto listener: m_Listeners) + for (auto listener: m_Listeners) { (listener->*method)(delta); } @@ -58,12 +58,12 @@ void MsgStoragePrivate::msg_storage_change_cb(msg_handle_t handle, msg_storage_c int count = pMsgIdList->nCount; msgIdList.reserve(count); - for(int i = 0; i < count; ++i) + for (int i = 0; i < count; ++i) { msgIdList.push_back(pMsgIdList->msgIdList[i]); } - switch(storageChangeType) + switch (storageChangeType) { case MSG_STORAGE_CHANGE_UPDATE: self->notifyListeners(msgIdList, &IMsgStorageListener::onMsgStorageUpdate); @@ -86,7 +86,7 @@ void MsgStoragePrivate::msg_thread_change_cb(msg_handle_t handle, msg_storage_ch MsgStoragePrivate *self = static_cast(user_param); ThreadId tId = static_cast(threadId); - switch(storageChangeType) + switch (storageChangeType) { case MSG_STORAGE_CHANGE_UPDATE: self->notifyListeners(tId, &IMsgStorageListener::onMsgStorageThreadUpdate); @@ -118,7 +118,7 @@ MsgThreadListRef MsgStoragePrivate::getThreadList() int error = msg_get_thread_view_list(m_ServiceHandle, sortRule, &msgList); msg_release_struct(&sortRule); - if(error == 0) + if (error == 0) { res.reset(new MsgThreadStructListPrivate(true, msgList)); } @@ -138,7 +138,7 @@ MessageSMSListRef MsgStoragePrivate::getSimMsgList() msg_set_int_value(listCond, MSG_LIST_CONDITION_SIM_INDEX_INT, 1); msg_set_int_value(listCond, MSG_LIST_CONDITION_STORAGE_ID_INT, MSG_STORAGE_SIM); - if(msg_get_message_list2(m_ServiceHandle, listCond, &msgList) == 0) + if (msg_get_message_list2(m_ServiceHandle, listCond, &msgList) == 0) { res.reset(new SmsStructListPrivate(true, msgList)); } @@ -150,18 +150,14 @@ ThreadId MsgStoragePrivate::getThreadId(const MsgAddressList &addressList) { msg_thread_id_t id = ThreadId::invalidId; - if(const MsgAddressListHandlePrivate *privateList = dynamic_cast(&addressList)) + if (const MsgAddressListHandlePrivate *privateList = dynamic_cast(&addressList)) { msg_list_handle_t handleList = *privateList; msg_get_thread_id_by_address2(m_ServiceHandle, handleList, &id); - } - else if(const MsgAddressStructListPrivate *privateList = dynamic_cast(&addressList)) - { + } else if (const MsgAddressStructListPrivate *privateList = dynamic_cast(&addressList)) { msg_struct_list_s msgStructList = *privateList; msg_get_thread_id_by_address(m_ServiceHandle, &msgStructList, &id); - } - else - { + } else { assert(false); } @@ -173,9 +169,9 @@ ThreadId MsgStoragePrivate::getThreadId(const std::list &addressLis msg_thread_id_t tid = ThreadId::invalidId; msg_struct_t msgInfo = msg_create_struct(MSG_STRUCT_MESSAGE_INFO); - if(msgInfo) + if (msgInfo) { - for(auto &addr : addressList) + for (auto &addr : addressList) { MsgAddress::AddressType type = MsgUtils::getAddressType(addr); msg_struct_t tmpAddr = nullptr; @@ -190,7 +186,7 @@ ThreadId MsgStoragePrivate::getThreadId(const std::list &addressLis msg_list_handle_t addrList = nullptr; msg_get_list_handle(msgInfo, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addrList); - if(addrList) + if (addrList) msg_get_thread_id_by_address2(m_ServiceHandle, addrList, &tid); msg_release_struct(&msgInfo); @@ -212,12 +208,12 @@ MsgThreadListRef MsgStoragePrivate::searchThread(const std::string &word) msg_struct_list_s searchList = {}; msg_error_t error = msg_search_message_for_thread_view(m_ServiceHandle, word.c_str(), &searchList); - if(error != 0) + if (error != 0) { MSG_LOG_ERROR("msg_search_message_for_thread_view error ", error); } - if(error == 0) + if (error == 0) res.reset(new MsgThreadStructListPrivate(true, searchList)); return res; @@ -236,12 +232,12 @@ int MsgStoragePrivate::getUnreadThreadCount() const msg_get_thread_view_list(m_ServiceHandle, sortRule, &peerList); msg_release_struct(&sortRule); - for(int i = 0; i < peerList.nCount; i++) + for (int i = 0; i < peerList.nCount; i++) { int unreadCnt = 0; msg_get_int_value(peerList.msg_struct_info[i], MSG_THREAD_UNREAD_COUNT_INT, &unreadCnt); - if(unreadCnt > 0) + if (unreadCnt > 0) unreadThreadCount++; } @@ -252,7 +248,7 @@ MsgThreadItemRef MsgStoragePrivate::getThread(ThreadId id) { MsgThreadItemRef res; msg_struct_t thread = msg_create_struct(MSG_STRUCT_THREAD_INFO); - if(msg_get_thread(m_ServiceHandle, id, thread) == 0) + if (msg_get_thread(m_ServiceHandle, id, thread) == 0) { res.reset(new MsgThreadItemPrivate(true, thread)); } @@ -270,7 +266,7 @@ MsgConversationListRef MsgStoragePrivate::getConversationList(ThreadId id) msg_struct_list_s convList = {}; int error = msg_get_conversation_view_list(m_ServiceHandle, id, &convList); - if(error == 0) + if (error == 0) { res.reset(new MsgConversationStructListPrivate(true, convList)); } @@ -281,12 +277,10 @@ MsgConversationItemRef MsgStoragePrivate::getConversationItem(MsgId id) { MsgConversationItemRef res; msg_struct_t convItem = msg_create_struct(MSG_STRUCT_CONV_INFO); - if(msg_get_conversation(m_ServiceHandle, id, convItem) == 0) + if (msg_get_conversation(m_ServiceHandle, id, convItem) == 0) { res.reset(new MsgConversationItemPrivate(true, convItem)); - } - else - { + } else { msg_release_struct(&convItem); } @@ -299,7 +293,7 @@ MessageRef MsgStoragePrivate::getMessage(MsgId id) msg_struct_t msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO); msg_struct_t sendOpt = msg_create_struct(MSG_STRUCT_SENDOPT); - if(msg_get_message(m_ServiceHandle, id, msg, sendOpt) == 0) + if (msg_get_message(m_ServiceHandle, id, msg, sendOpt) == 0) { int nativeType = MSG_TYPE_INVALID; msg_get_int_value(msg, MSG_MESSAGE_TYPE_INT, &nativeType); @@ -309,9 +303,7 @@ MessageRef MsgStoragePrivate::getMessage(MsgId id) msgRef = std::make_shared(true, msg); else msgRef = std::make_shared(true, msg); - } - else - { + } else { msg_release_struct(&msg); } msg_release_struct(&sendOpt); @@ -320,7 +312,7 @@ MessageRef MsgStoragePrivate::getMessage(MsgId id) MsgId MsgStoragePrivate::saveMessage(Message &msg, bool updateExisting, StorageResult *result) { - if(result) + if (result) *result = StorageFail; MsgId newMsgId; @@ -330,23 +322,21 @@ MsgId MsgStoragePrivate::saveMessage(Message &msg, bool updateExisting, StorageR msg_set_bool_value(sendOpt, MSG_SEND_OPT_SETTING_BOOL, false); msgPriv.commit(); - if(msgPriv.getId().isValid() && updateExisting) + if (msgPriv.getId().isValid() && updateExisting) { int err = msg_update_message(m_ServiceHandle, msgPriv, sendOpt); - if(result) + if (result) *result = MsgUtilsPrivate::nativeToStorageResult(err); - if(err == MSG_SUCCESS) + if (err == MSG_SUCCESS) newMsgId = msg.getId(); - } - else - { + } else { newMsgId = msg_add_message(m_ServiceHandle, msgPriv, sendOpt); - if(newMsgId > 0) + if (newMsgId > 0) { int err = msg_move_msg_to_storage(m_ServiceHandle, newMsgId, msg.getMessageStorageType()); - if(result) + if (result) *result = MsgUtilsPrivate::nativeToStorageResult(err); - if(err != MSG_SUCCESS) + if (err != MSG_SUCCESS) { MSG_LOG_WARN("Can't move msg to storage, error = ", MsgEngine::whatError(err)); deleteMessage(newMsgId); @@ -368,7 +358,7 @@ bool MsgStoragePrivate::deleteMessages(const MsgIdList &idList) msg_id_list_s internalIdList; internalIdList.nCount = idList.size(); - if(internalIdList.nCount <= 0) + if (internalIdList.nCount <= 0) return false; msg_message_id_t ids[internalIdList.nCount]; @@ -391,7 +381,7 @@ MessageListRef MsgStoragePrivate::searchMessage(const std::string &word) msg_error_t error = msg_get_message_list2(m_ServiceHandle, listCond, &searchList); msg_release_struct(&listCond); - if(error == 0) + if (error == 0) res.reset(new MessageStructListPrivate(true, searchList)); return res; @@ -423,7 +413,7 @@ bool MsgStoragePrivate::isReadReportChecked(MsgId msgId) msg_get_message(m_ServiceHandle, msgId, msgInfo, sendOpt); msg_get_struct_handle(sendOpt, MSG_SEND_OPT_MMS_OPT_HND, &mmsSendOpt); - if(mmsSendOpt) + if (mmsSendOpt) msg_get_bool_value(mmsSendOpt, MSG_MMS_SENDOPTION_READ_REQUEST_BOOL, &readFlag); msg_release_struct(&msgInfo); @@ -451,7 +441,7 @@ ThreadId MsgStoragePrivate::getThreadId(MsgId id) msg_struct_t msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO); msg_struct_t sendOpt = msg_create_struct(MSG_STRUCT_SENDOPT); - if(msg_get_message(m_ServiceHandle, id, msg, sendOpt) == 0) + if (msg_get_message(m_ServiceHandle, id, msg, sendOpt) == 0) msg_get_int_value(msg, MSG_MESSAGE_THREAD_ID_INT, &threadId); msg_release_struct(&msg); diff --git a/src/Common/MsgEngine/src/private/MsgStructListPrivate.h b/src/Common/MsgEngine/src/private/MsgStructListPrivate.h index 773e31e..8044209 100644 --- a/src/Common/MsgEngine/src/private/MsgStructListPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgStructListPrivate.h @@ -40,7 +40,7 @@ namespace Msg virtual ~MsgStructListPrivate() { - if(m_Release && m_List.nCount) + if (m_Release && m_List.nCount) { msg_release_list_struct(&m_List); } diff --git a/src/Common/MsgEngine/src/private/MsgStructPrivate.h b/src/Common/MsgEngine/src/private/MsgStructPrivate.h index ff4f3f1..c106b99 100644 --- a/src/Common/MsgEngine/src/private/MsgStructPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgStructPrivate.h @@ -48,7 +48,7 @@ namespace Msg inline MsgStructPrivate::~MsgStructPrivate() { - if(m_Release && m_MsgStruct) + if (m_Release && m_MsgStruct) { msg_release_struct(&m_MsgStruct); } diff --git a/src/Common/MsgEngine/src/private/MsgThreadItemPrivate.cpp b/src/Common/MsgEngine/src/private/MsgThreadItemPrivate.cpp index 6025f84..b906f03 100644 --- a/src/Common/MsgEngine/src/private/MsgThreadItemPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgThreadItemPrivate.cpp @@ -28,12 +28,10 @@ MsgThreadItemPrivate::MsgThreadItemPrivate(bool release, msg_struct_t msgStruct) : MsgStructPrivate(release, msgStruct) , MsgThreadItem() { - } MsgThreadItemPrivate::~MsgThreadItemPrivate() { - } ThreadId MsgThreadItemPrivate::getId() const diff --git a/src/Common/MsgEngine/src/private/MsgTransportPrivate.cpp b/src/Common/MsgEngine/src/private/MsgTransportPrivate.cpp index d5fe3b9..a6baac7 100644 --- a/src/Common/MsgEngine/src/private/MsgTransportPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgTransportPrivate.cpp @@ -26,12 +26,10 @@ MsgTransportPrivate::MsgTransportPrivate(msg_handle_t serviceHandle) : MsgTransport() , m_ServiceHandle(serviceHandle) { - } MsgTransportPrivate::~MsgTransportPrivate() { - } MsgTransport::SendResult MsgTransportPrivate::sendMessage(Message &msg, ThreadId *threadId) @@ -48,22 +46,20 @@ MsgTransport::SendResult MsgTransportPrivate::sendMessage(Message &msg, ThreadId msg_set_struct_handle(req, MSG_REQUEST_MESSAGE_HND, privMsg); - if(privMsg.isMms()) + if (privMsg.isMms()) { MSG_LOG("Sending MMS"); err = msg_mms_send_message(m_ServiceHandle, req); - } - else - { + } else { MSG_LOG("Sending SMS"); err = msg_sms_send_message(m_ServiceHandle, req); } - if(threadId) + if (threadId) msg_get_thread_id_by_address2(m_ServiceHandle, privMsg.getAddressList(), (msg_thread_id_t*)threadId); msg_release_struct(&req); - MsgTransport::SendResult sendRes= MsgUtilsPrivate::nativeToSendResult(err); + MsgTransport::SendResult sendRes = MsgUtilsPrivate::nativeToSendResult(err); MSG_LOG("Send result: ", sendRes); return sendRes; } @@ -85,7 +81,7 @@ MsgTransport::SendResult MsgTransportPrivate::retrieveMessage(MsgId msgId) msg_release_struct(&sendOpt); msg_release_struct(&req); - MsgTransport::SendResult sendRes= MsgUtilsPrivate::nativeToSendResult(err); + MsgTransport::SendResult sendRes = MsgUtilsPrivate::nativeToSendResult(err); MSG_LOG("Send result: ", sendRes); return sendRes; } @@ -93,7 +89,7 @@ MsgTransport::SendResult MsgTransportPrivate::retrieveMessage(MsgId msgId) MsgTransport::SendResult MsgTransportPrivate::sendReadReport(MsgId msgId, MsgReport::ReadStatus status) { msg_error_t err = msg_mms_send_read_report(m_ServiceHandle, msgId, MsgUtilsPrivate::reportReadReportStatusToNative(status)); - MsgTransport::SendResult sendRes= MsgUtilsPrivate::nativeToSendResult(err); + MsgTransport::SendResult sendRes = MsgUtilsPrivate::nativeToSendResult(err); MSG_LOG("Send result: ", sendRes); return sendRes; } diff --git a/src/Common/MsgEngine/src/private/MsgUtilsPrivate.cpp b/src/Common/MsgEngine/src/private/MsgUtilsPrivate.cpp index 5921975..fe86a24 100644 --- a/src/Common/MsgEngine/src/private/MsgUtilsPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgUtilsPrivate.cpp @@ -21,7 +21,7 @@ using namespace Msg; int MsgUtilsPrivate::directionToNative(Message::Direction direction) { - switch(direction) + switch (direction) { case Message::MD_Sent: return MSG_DIRECTION_TYPE_MO; @@ -35,7 +35,7 @@ int MsgUtilsPrivate::directionToNative(Message::Direction direction) Message::Direction MsgUtilsPrivate::nativeToDirection(int direction) { - switch(direction) + switch (direction) { case MSG_DIRECTION_TYPE_MO: return Message::MD_Sent; @@ -49,7 +49,7 @@ Message::Direction MsgUtilsPrivate::nativeToDirection(int direction) Message::MessageStorageType MsgUtilsPrivate::nativeToMessageStorage(int id) { - switch(id) + switch (id) { case MSG_STORAGE_PHONE: return Message::MS_Phone; @@ -63,7 +63,7 @@ Message::MessageStorageType MsgUtilsPrivate::nativeToMessageStorage(int id) int MsgUtilsPrivate::addressTypeToNative(MsgAddress::AddressType type) { - switch(type) + switch (type) { case MsgAddress::Phone: return MSG_ADDRESS_TYPE_PLMN; @@ -79,7 +79,7 @@ int MsgUtilsPrivate::addressTypeToNative(MsgAddress::AddressType type) MsgAddress::AddressType MsgUtilsPrivate::nativeToAddressType(int type) { - switch(type) + switch (type) { case MSG_ADDRESS_TYPE_PLMN: return MsgAddress::Phone; @@ -96,7 +96,7 @@ MsgAddress::AddressType MsgUtilsPrivate::nativeToAddressType(int type) MsgReport::DeliveryStatus MsgUtilsPrivate::nativeToReportDeliveryStatus(int status) { - switch(status) + switch (status) { case MSG_DELIVERY_REPORT_SUCCESS: return MsgReport::StatusSuccess; @@ -115,7 +115,7 @@ MsgReport::DeliveryStatus MsgUtilsPrivate::nativeToReportDeliveryStatus(int stat MsgReport::ReadStatus MsgUtilsPrivate::nativeToReportReadStatus(int status) { - switch(status) + switch (status) { case MSG_READ_REPORT_IS_READ: return MsgReport::ReadStatusIsRead; @@ -134,7 +134,7 @@ MsgReport::ReadStatus MsgUtilsPrivate::nativeToReportReadStatus(int status) int MsgUtilsPrivate::reportReadReportStatusToNative(MsgReport::ReadStatus status) { - switch(status) + switch (status) { case MsgReport::ReadStatusIsRead: return MSG_READ_REPORT_IS_READ; @@ -153,7 +153,7 @@ int MsgUtilsPrivate::reportReadReportStatusToNative(MsgReport::ReadStatus status MsgReport::Type MsgUtilsPrivate::nativeToReportType(int type) { - switch(type) + switch (type) { case MSG_REPORT_TYPE_READ: return MsgReport::TypeRead; @@ -169,7 +169,7 @@ MsgReport::Type MsgUtilsPrivate::nativeToReportType(int type) int MsgUtilsPrivate::recipientTypeToNative(MsgAddress::RecipientType type) { - switch(type) + switch (type) { case MsgAddress::To: return MSG_RECIPIENTS_TYPE_TO; @@ -188,7 +188,7 @@ int MsgUtilsPrivate::recipientTypeToNative(MsgAddress::RecipientType type) MsgAddress::RecipientType MsgUtilsPrivate::nativeToRecipientType(int type) { - switch(type) + switch (type) { case MSG_RECIPIENTS_TYPE_TO: return MsgAddress::To; @@ -207,7 +207,7 @@ MsgAddress::RecipientType MsgUtilsPrivate::nativeToRecipientType(int type) Message::Type MsgUtilsPrivate::nativeToMessageType(int type) { - switch(type) + switch (type) { case MSG_TYPE_SMS: case MSG_TYPE_SMS_CB: @@ -241,7 +241,7 @@ Message::Type MsgUtilsPrivate::nativeToMessageType(int type) MsgMedia::Type MsgUtilsPrivate::nativeToSmilType(int type) { - switch(type) + switch (type) { case MMS_SMIL_MEDIA_IMG: return MsgMedia::ImageType; @@ -257,7 +257,7 @@ MsgMedia::Type MsgUtilsPrivate::nativeToSmilType(int type) int MsgUtilsPrivate::smilTypeToNative(MsgMedia::Type type) { - switch(type) + switch (type) { case MsgMedia::ImageType: return MMS_SMIL_MEDIA_IMG; @@ -277,7 +277,7 @@ std::string MsgUtilsPrivate::getStr(msg_struct_t msgStruct, int field, int maxSt { std::string res; char buf[maxStrLen + 1]; - if(msg_get_str_value(msgStruct, field, buf, maxStrLen) == 0) + if (msg_get_str_value(msgStruct, field, buf, maxStrLen) == 0) { res.assign(buf); } @@ -291,7 +291,7 @@ int MsgUtilsPrivate::setStr(msg_struct_t msgStruct, int field, const std::string Message::NetworkStatus MsgUtilsPrivate::nativeToNetworkStatus(int status) { - switch(status) + switch (status) { case MSG_NETWORK_NOT_SEND: return Message::NS_Not_Send; @@ -334,7 +334,7 @@ Message::NetworkStatus MsgUtilsPrivate::nativeToNetworkStatus(int status) int MsgUtilsPrivate::activeNotifPolicyToNative(MsgSettings::ActiveNotifPolicy policy) { - switch(policy) + switch (policy) { case MsgSettings::AppBackgroundPolicy: return -1; @@ -348,7 +348,7 @@ int MsgUtilsPrivate::activeNotifPolicyToNative(MsgSettings::ActiveNotifPolicy po MsgTransport::SendResult MsgUtilsPrivate::nativeToSendResult(int sendRes) { - switch(sendRes) + switch (sendRes) { case MSG_SUCCESS: return MsgTransport::SendSuccess; @@ -367,7 +367,7 @@ MsgTransport::SendResult MsgUtilsPrivate::nativeToSendResult(int sendRes) MsgSettings::RingtoneType MsgUtilsPrivate::nativeToRingtoneType(int type) { - switch(type) + switch (type) { case MSG_RINGTONE_TYPE_SILENT: return MsgSettings::SilentRingtone; @@ -381,7 +381,7 @@ MsgSettings::RingtoneType MsgUtilsPrivate::nativeToRingtoneType(int type) int MsgUtilsPrivate::ringtoneTypeToNative(MsgSettings::RingtoneType type) { - switch(type) + switch (type) { case MsgSettings::SilentRingtone: return MSG_RINGTONE_TYPE_SILENT; @@ -396,7 +396,7 @@ int MsgUtilsPrivate::ringtoneTypeToNative(MsgSettings::RingtoneType type) MsgStorage::StorageResult MsgUtilsPrivate::nativeToStorageResult(int resultCode) { MsgStorage::StorageResult res = MsgStorage::StorageFail; - switch(resultCode) + switch (resultCode) { case MSG_SUCCESS: res = MsgStorage::StorageSuccess; diff --git a/src/Common/SystemSettingsManager/src/SystemSettingsManager.cpp b/src/Common/SystemSettingsManager/src/SystemSettingsManager.cpp index fc266ab..57a33fc 100644 --- a/src/Common/SystemSettingsManager/src/SystemSettingsManager.cpp +++ b/src/Common/SystemSettingsManager/src/SystemSettingsManager.cpp @@ -39,7 +39,7 @@ SystemSettingsManager::SystemSettingsManager() SystemSettingsManager::~SystemSettingsManager() { - if(m_TelHandleList.handle != nullptr) + if (m_TelHandleList.handle != nullptr) telephony_deinit(&m_TelHandleList); deinitDpmHandle(); @@ -47,7 +47,7 @@ SystemSettingsManager::~SystemSettingsManager() void SystemSettingsManager::prepareTel() { - if(m_TelHandleList.handle != nullptr) + if (m_TelHandleList.handle != nullptr) return; int err = telephony_init(&m_TelHandleList); MSG_LOG("telephony_init = ", err); @@ -56,14 +56,14 @@ void SystemSettingsManager::prepareTel() void SystemSettingsManager::addListener(ISystemSettingsManager &l) { auto it = std::find(m_Listeners.begin(), m_Listeners.end(), &l); - if(it == m_Listeners.end()) + if (it == m_Listeners.end()) m_Listeners.push_back(&l); } void SystemSettingsManager::removeListener(ISystemSettingsManager&l) { auto it = std::find(m_Listeners.begin(), m_Listeners.end(), &l); - if(it != m_Listeners.end()) + if (it != m_Listeners.end()) m_Listeners.erase(it); } @@ -72,7 +72,7 @@ bool SystemSettingsManager::isSimInserted() const bool res = false; const_cast(this)->prepareTel(); - if(m_TelHandleList.count > 0) + if (m_TelHandleList.count > 0) { telephony_h handle = m_TelHandleList.handle[0]; telephony_sim_state_e simState = TELEPHONY_SIM_STATE_UNAVAILABLE; @@ -89,11 +89,11 @@ bool SystemSettingsManager::isSimActive() const bool res = false; const_cast(this)->prepareTel(); - if(m_TelHandleList.count > 0) + if (m_TelHandleList.count > 0) { telephony_h telHandle = m_TelHandleList.handle[0]; telephony_network_service_state_e servState; - if(telephony_network_get_service_state(telHandle, &servState) == TELEPHONY_ERROR_NONE) + if (telephony_network_get_service_state(telHandle, &servState) == TELEPHONY_ERROR_NONE) { res = (servState == TELEPHONY_NETWORK_SERVICE_STATE_IN_SERVICE); MSG_LOG("servState = ", servState); @@ -112,7 +112,7 @@ bool SystemSettingsManager::isMobileDataEnabled() const void SystemSettingsManager::onTimeFormatChanged() { - for(ISystemSettingsManager *it : m_Listeners) + for (ISystemSettingsManager *it : m_Listeners) { it->onTimeFormatChanged(); } @@ -120,7 +120,7 @@ void SystemSettingsManager::onTimeFormatChanged() void SystemSettingsManager::onLanguageChanged() { - for(ISystemSettingsManager *it : m_Listeners) + for (ISystemSettingsManager *it : m_Listeners) { it->onLanguageChanged(); } diff --git a/src/Common/Utils/inc/LangUtils.h b/src/Common/Utils/inc/LangUtils.h index c5e11b0..6d38a0b 100644 --- a/src/Common/Utils/inc/LangUtils.h +++ b/src/Common/Utils/inc/LangUtils.h @@ -71,9 +71,9 @@ namespace Msg : m_pMsg(m_Buf) { va_list args; - va_start (args, domainName); + va_start(args, domainName); vsnprintf(m_Buf, maxBufSize, dgettext(domainName, stringId), args); - va_end (args); + va_end(args); } const char *get() const diff --git a/src/Common/Utils/inc/Logger.h b/src/Common/Utils/inc/Logger.h index 6413d1a..a0ab67a 100644 --- a/src/Common/Utils/inc/Logger.h +++ b/src/Common/Utils/inc/Logger.h @@ -41,7 +41,7 @@ loggerImpl(LogPriority::WARN, LOGGER_TAG, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__); #define MSG_ASSERT(expr, ...)\ - if(!(expr)) { MSG_LOG_ERROR(__VA_ARGS__); } \ + if (!(expr)) { MSG_LOG_ERROR(__VA_ARGS__); } \ assert(expr) #endif /* LOGGER_H_ */ diff --git a/src/Common/Utils/inc/LoggerImpl.h b/src/Common/Utils/inc/LoggerImpl.h index 516d6c0..20f7440 100644 --- a/src/Common/Utils/inc/LoggerImpl.h +++ b/src/Common/Utils/inc/LoggerImpl.h @@ -42,7 +42,7 @@ void loggerImpl(LogPriority prior { std::ostringstream messageStr; std::initializer_list { (messageStr << msg, true)... }; - dlog_print( static_cast(prior) + dlog_print(static_cast(prior) , tag, "%s: %s(%d) -> %s", file, function, line , messageStr.str().c_str()); } diff --git a/src/Common/Utils/inc/PhoneNumberUtils.h b/src/Common/Utils/inc/PhoneNumberUtils.h index 40f4278..83a9a0b 100644 --- a/src/Common/Utils/inc/PhoneNumberUtils.h +++ b/src/Common/Utils/inc/PhoneNumberUtils.h @@ -32,7 +32,6 @@ namespace Msg ~PhoneNumberUtils(); PhoneNumberUtils& operator=(PhoneNumberUtils&) = delete; PhoneNumberUtils(PhoneNumberUtils&) = delete; - }; } diff --git a/src/Common/Utils/src/FileUtils.cpp b/src/Common/Utils/src/FileUtils.cpp index 90b1cc9..923e595 100755 --- a/src/Common/Utils/src/FileUtils.cpp +++ b/src/Common/Utils/src/FileUtils.cpp @@ -38,7 +38,7 @@ long long FileUtils::getFileSize(const std::string &file) long long size = 0; struct stat st = {}; - if(stat(file.c_str(), &st) == 0) + if (stat(file.c_str(), &st) == 0) { size = st.st_size; } @@ -67,19 +67,19 @@ bool FileUtils::copy(const std::string &src, const std::string &dst) bool ret = true; f1 = fopen(src.c_str(), "rb"); - if(!f1) + if (!f1) return false; f2 = fopen(dst.c_str(), "wb"); - if(!f2) + if (!f2) { fclose(f1); return false; } - while((num = fread(buf, 1, sizeof(buf), f1)) > 0) + while ((num = fread(buf, 1, sizeof(buf), f1)) > 0) { - if(fwrite(buf, 1, num, f2) != num) + if (fwrite(buf, 1, num, f2) != num) { ret = false; } @@ -104,18 +104,16 @@ bool FileUtils::makeDir(const std::string &dir) std::string FileUtils::addFileToDataDir(const std::string &path) { std::string newPath; - if(isExists(path)) + if (isExists(path)) { std::string dataPath = PathUtils::getDataPath(""); - if(path.find(dataPath) != std::string::npos) + if (path.find(dataPath) != std::string::npos) { newPath = path; MSG_LOG("File is already exists: ", newPath); - } - else - { + } else { newPath = FileUtils::genUniqueFilePath(dataPath, path); - if(!copy(path, newPath)) + if (!copy(path, newPath)) newPath.clear(); } } @@ -147,21 +145,19 @@ void FileUtils::splitPath(const std::string &path, std::string &basePath, { auto pos = path.find_last_of('/'); - if(pos != std::string::npos) + if (pos != std::string::npos) basePath = path.substr(0, pos + 1); std::string name; name = path.substr(pos + 1); pos = name.find_last_of('.'); - if(pos != std::string::npos) + if (pos != std::string::npos) { extension = name.substr(pos + 1); - if(pos != 0) + if (pos != 0) fileName = name.substr(0, pos); - } - else - { + } else { fileName = name; } } @@ -179,17 +175,17 @@ bool FileUtils::remove(const std::string &path, bool removeCurrentDir) struct dirent *dirData = nullptr; DIR *dp = opendir(path.c_str()); - if(dp) + if (dp) { - while(true) + while (true) { dirData = nullptr; readdir_r(dp, &ep, &dirData); - if(dirData == nullptr) + if (dirData == nullptr) break; - if(strcmp(dirData->d_name, ".") != 0 && strcmp(dirData->d_name, "..") != 0) + if (strcmp(dirData->d_name, ".") != 0 && strcmp(dirData->d_name, "..") != 0) { std::string child = path + "/" + dirData->d_name; res &= remove(child, true); @@ -197,13 +193,11 @@ bool FileUtils::remove(const std::string &path, bool removeCurrentDir) } closedir(dp); - if(removeCurrentDir) + if (removeCurrentDir) { res &= rmdir(path.c_str()) == 0; } - } - else - { + } else { res &= unlink(path.c_str()) == 0; } @@ -219,7 +213,7 @@ std::string FileUtils::readTextFile(const std::string &path) bool FileUtils::writeTextFile(const std::string &path, const std::string &text) { std::ofstream file(path, std::ofstream::trunc | std::ofstream::binary | std::ofstream::out); - if(file.is_open()) + if (file.is_open()) file << text; return file.is_open() && file.good(); } @@ -236,16 +230,16 @@ std::string FileUtils::genUniqueFilePath(const std::string &storagePath, const s do { res = storagePath; - if(res.back() != '/') + if (res.back() != '/') res += '/'; res += name; - if(i > 0) + if (i > 0) res += "-" + std::to_string(i); - if(!ext.empty()) + if (!ext.empty()) res += '.' + ext; ++i; - } while(isExists(res)); + } while (isExists(res)); return res; } @@ -256,11 +250,11 @@ std::string FileUtils::getMimeType(const std::string &filePath) std::string name; std::string ext; splitPath(filePath, base, name, ext); - if(!ext.empty()) + if (!ext.empty()) { char *mime = nullptr; mime_type_get_mime_type(ext.c_str(), &mime); - if(mime) + if (mime) { res = mime; std::transform(res.begin(), res.end(), res.begin(), ::tolower); @@ -277,7 +271,7 @@ static bool saveFileToStoragePrivate(const std::string &file) std::string dowloadPath = PathUtils::getDownloadPath(); std::string filePathDst = FileUtils::genUniqueFilePath(dowloadPath, file); - if(FileUtils::copy(file, filePathDst)) + if (FileUtils::copy(file, filePathDst)) res = media_content_scan_file(filePathDst.c_str()) == MEDIA_CONTENT_ERROR_NONE; return res; @@ -286,10 +280,10 @@ static bool saveFileToStoragePrivate(const std::string &file) bool FileUtils::saveFilesToStorage(const std::list &files) { bool res = true; - if(media_content_connect() != 0) + if (media_content_connect() != 0) return false; - for(const std::string &file : files) + for (const std::string &file : files) { res &= saveFileToStoragePrivate(file); } @@ -299,7 +293,7 @@ bool FileUtils::saveFilesToStorage(const std::list &files) bool FileUtils::saveFileToStorage(const std::string &file) { - if(media_content_connect() != 0) + if (media_content_connect() != 0) return false; bool res = saveFileToStoragePrivate(file); diff --git a/src/Common/Utils/src/HwButtonListener.cpp b/src/Common/Utils/src/HwButtonListener.cpp index 1d6b2a9..360a455 100644 --- a/src/Common/Utils/src/HwButtonListener.cpp +++ b/src/Common/Utils/src/HwButtonListener.cpp @@ -33,14 +33,12 @@ static void more_event_cb(void *data, Evas_Object *obj, void *event_info) void IHwButtonListener::setHwButtonListener(Evas_Object * obj, IHwButtonListener *listener) { - if(listener) + if (listener) { setHwButtonListener(obj, nullptr); eext_object_event_callback_add(obj, EEXT_CALLBACK_MORE, more_event_cb, listener); eext_object_event_callback_add(obj, EEXT_CALLBACK_BACK, back_event_cb, listener); - } - else - { + } else { eext_object_event_callback_del(obj, EEXT_CALLBACK_MORE, more_event_cb); eext_object_event_callback_del(obj, EEXT_CALLBACK_BACK, back_event_cb); } diff --git a/src/Common/Utils/src/LoggerImpl.cpp b/src/Common/Utils/src/LoggerImpl.cpp index c779242..d1f89bc 100644 --- a/src/Common/Utils/src/LoggerImpl.cpp +++ b/src/Common/Utils/src/LoggerImpl.cpp @@ -28,7 +28,7 @@ LoggerImpl::LoggerImpl(const char *tag, const char *file, const char *function, , m_File(file) , m_Function(function) { - dlog_print( defaultPriority + dlog_print(defaultPriority , m_Tag.c_str() , enterFraseFormat.c_str() , m_File.c_str() @@ -38,7 +38,7 @@ LoggerImpl::LoggerImpl(const char *tag, const char *file, const char *function, LoggerImpl::~LoggerImpl() { - dlog_print( defaultPriority + dlog_print(defaultPriority , m_Tag.c_str() , leaveFraseFormat.c_str() , m_File.c_str() diff --git a/src/Common/Utils/src/MediaUtils.cpp b/src/Common/Utils/src/MediaUtils.cpp index 23249cb..8ffa83b 100644 --- a/src/Common/Utils/src/MediaUtils.cpp +++ b/src/Common/Utils/src/MediaUtils.cpp @@ -38,10 +38,10 @@ namespace MetadataExtractor(const std::string &path) : m_Metadata() { - if(FileUtils::isExists(path)) + if (FileUtils::isExists(path)) { metadata_extractor_create(&m_Metadata); - if(metadata_extractor_set_path(m_Metadata, path.c_str()) != 0) + if (metadata_extractor_set_path(m_Metadata, path.c_str()) != 0) { metadata_extractor_destroy(m_Metadata); m_Metadata = nullptr; @@ -51,7 +51,7 @@ namespace ~MetadataExtractor() { - if(m_Metadata) + if (m_Metadata) metadata_extractor_destroy(m_Metadata); } @@ -71,7 +71,7 @@ namespace std::string res; char *cStr = nullptr; metadata_extractor_get_metadata(m_Metadata, attr, &cStr); - if(cStr) + if (cStr) { res = cStr; free(cStr); @@ -94,7 +94,7 @@ std::string MediaUtils::getTitle(const std::string &path) std::string fileName = FileUtils::getFileName(path); MetadataExtractor extractor(path); - if(!extractor.isValid()) + if (!extractor.isValid()) return fileName; std::string title = extractor.getStr(METADATA_TITLE); @@ -105,7 +105,7 @@ int MediaUtils::getDuration(const std::string &uri) { MetadataExtractor extractor(uri); int duration = 0; - if(extractor.isValid()) + if (extractor.isValid()) { duration = extractor.getInt(METADATA_DURATION); MSG_LOG("Duration msec: ", duration); @@ -120,7 +120,7 @@ int MediaUtils::getDurationSec(const std::string &uri) MSG_LOG("File: ", uri); MSG_LOG("Duration sec: ", sec); - if(sec < 0) + if (sec < 0) return 0; return sec; @@ -129,7 +129,7 @@ int MediaUtils::getDurationSec(const std::string &uri) bool MediaUtils::getVideoFrame(const std::string &videoFilePath, const std::string &imageFilePath) { MetadataExtractor extractor(videoFilePath); - if(!extractor.isValid()) + if (!extractor.isValid()) return false; int videoW = extractor.getInt(METADATA_VIDEO_WIDTH); @@ -142,13 +142,13 @@ bool MediaUtils::getVideoFrame(const std::string &videoFilePath, const std::stri MSG_LOG("File: ", videoFilePath); MSG_LOG("Frame: width = ", videoW, " height = ", videoH, " size = ", thumbSize); - if(thumbnail) + 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; - if(!isOk) + if (!isOk) { free(thumbnail); return false; @@ -159,7 +159,7 @@ bool MediaUtils::getVideoFrame(const std::string &videoFilePath, const std::stri isOk &= image_util_encode_set_quality(encode_h, quality) == IMAGE_UTIL_ERROR_NONE; isOk &= image_util_encode_set_input_buffer(encode_h, (unsigned char *)thumbnail) == IMAGE_UTIL_ERROR_NONE; isOk &= image_util_encode_set_output_path(encode_h, imageFilePath.c_str()) == IMAGE_UTIL_ERROR_NONE; - if(!isOk) + if (!isOk) { image_util_encode_destroy(encode_h); free(thumbnail); @@ -177,13 +177,13 @@ bool MediaUtils::getVideoFrame(const std::string &videoFilePath, const std::stri bool MediaUtils::getFrameSize(const std::string &videoFilePath, int &width, int &height) { MetadataExtractor extractor(videoFilePath); - if(!extractor.isValid()) + if (!extractor.isValid()) return false; width = extractor.getInt(METADATA_VIDEO_WIDTH); height = extractor.getInt(METADATA_VIDEO_HEIGHT); int orient = extractor.getInt(METADATA_ROTATE); - if(orient == 90 || orient == 270) + if (orient == 90 || orient == 270) std::swap(width, height); MSG_LOG("File: ", videoFilePath); @@ -208,26 +208,26 @@ long long MediaUtils::downgradeImageQuality(const std::string &imagePath) std::ofstream outputFile; exifData = exif_data_new_from_file(imagePath.c_str()); - if(exifData) + if (exifData) { exif_data_save_data(exifData, &exifBuff, &exifBuffLen); } res = image_util_decode_create(&decode_h); - if(res != IMAGE_UTIL_ERROR_NONE) + if (res != IMAGE_UTIL_ERROR_NONE) { return FileUtils::getFileSize(imagePath); } res = image_util_decode_set_input_path(decode_h, imagePath.c_str()); - if(res != IMAGE_UTIL_ERROR_NONE) + if (res != IMAGE_UTIL_ERROR_NONE) { image_util_decode_destroy(decode_h); return FileUtils::getFileSize(imagePath); } res = image_util_decode_set_output_buffer(decode_h, &buffer); - if(res != IMAGE_UTIL_ERROR_NONE) + if (res != IMAGE_UTIL_ERROR_NONE) { image_util_decode_destroy(decode_h); return FileUtils::getFileSize(imagePath); @@ -235,47 +235,47 @@ long long MediaUtils::downgradeImageQuality(const std::string &imagePath) res = image_util_decode_run(decode_h, &width, &height, nullptr); image_util_decode_destroy(decode_h); - if(res != IMAGE_UTIL_ERROR_NONE) + if (res != IMAGE_UTIL_ERROR_NONE) { return FileUtils::getFileSize(imagePath); } res = image_util_encode_create(IMAGE_UTIL_JPEG, &encode_h); - if(res != IMAGE_UTIL_ERROR_NONE) + if (res != IMAGE_UTIL_ERROR_NONE) { return FileUtils::getFileSize(imagePath); } res = image_util_encode_set_resolution(encode_h, width, height); - if(res != IMAGE_UTIL_ERROR_NONE) + if (res != IMAGE_UTIL_ERROR_NONE) { image_util_encode_destroy(encode_h); return FileUtils::getFileSize(imagePath); } res = image_util_encode_set_quality(encode_h, QUALITY); - if(res != IMAGE_UTIL_ERROR_NONE) + if (res != IMAGE_UTIL_ERROR_NONE) { image_util_encode_destroy(encode_h); return FileUtils::getFileSize(imagePath); } res = image_util_encode_set_input_buffer(encode_h, buffer); - if(res != IMAGE_UTIL_ERROR_NONE) + if (res != IMAGE_UTIL_ERROR_NONE) { image_util_encode_destroy(encode_h); return FileUtils::getFileSize(imagePath); } res = image_util_encode_set_output_buffer(encode_h, &jpegBuff); - if(res != IMAGE_UTIL_ERROR_NONE) + if (res != IMAGE_UTIL_ERROR_NONE) { image_util_encode_destroy(encode_h); return FileUtils::getFileSize(imagePath); } res = image_util_encode_run(encode_h, &jpegBuffLen); image_util_encode_destroy(encode_h); - if(res != IMAGE_UTIL_ERROR_NONE) + if (res != IMAGE_UTIL_ERROR_NONE) { free(buffer); free(jpegBuff); @@ -283,14 +283,14 @@ long long MediaUtils::downgradeImageQuality(const std::string &imagePath) } outputFile.open(imagePath.c_str()); - if(!outputFile.is_open()) + if (!outputFile.is_open()) { MSG_LOG_ERROR("Can't open file for write"); free(buffer); free(jpegBuff); return FileUtils::getFileSize(imagePath); } - if(exifData) + if (exifData) { // Write EXIF header outputFile.write((char *)EXIF_HEADER, EXIF_HEADER_LEN); @@ -303,9 +303,7 @@ long long MediaUtils::downgradeImageQuality(const std::string &imagePath) outputFile.write((char *)jpegBuff + JPEG_HEADER_OFFSET, jpegBuffLen - JPEG_HEADER_OFFSET); free(exifBuff); exif_data_unref(exifData); - } - else - { + } else { // Write JPEG image data outputFile.write((char *)jpegBuff, jpegBuffLen); } diff --git a/src/Common/Utils/src/PathUtils.cpp b/src/Common/Utils/src/PathUtils.cpp index 2ae764e..569acdf 100644 --- a/src/Common/Utils/src/PathUtils.cpp +++ b/src/Common/Utils/src/PathUtils.cpp @@ -27,10 +27,10 @@ std::string PathUtils::getResourcePath(const std::string &filePath) { std::string res; static std::string basePath; - if(basePath.empty()) + if (basePath.empty()) { char *path = app_get_resource_path(); - if(path) + if (path) { basePath = path; free(path); @@ -47,10 +47,10 @@ std::string PathUtils::getDataPath(const std::string &filePath) { std::string res; static std::string basePath; - if(basePath.empty()) + if (basePath.empty()) { char *path = app_get_data_path(); - if(path) + if (path) { basePath = path; free(path); @@ -67,7 +67,7 @@ std::string PathUtils::getResourcePath() { std::string res; char* resPath = app_get_resource_path(); - if(resPath) + if (resPath) { res = resPath; free(resPath); @@ -79,7 +79,7 @@ std::string PathUtils::getResourcePath() std::string PathUtils::getLocalePath() { std::string resPath(getResourcePath()); - if(!resPath.empty()) + if (!resPath.empty()) { resPath.append("locale"); } @@ -89,7 +89,7 @@ std::string PathUtils::getLocalePath() static bool storageCb(int storageId, storage_type_e type, storage_state_e state, const char *path, void *userData) { - if(type == STORAGE_TYPE_INTERNAL) + if (type == STORAGE_TYPE_INTERNAL) { int *internalStorage = (int *)userData; *internalStorage = storageId; @@ -102,17 +102,17 @@ const std::string &PathUtils::getDownloadPath() { static std::string downloadPath; - if(!downloadPath.empty()) + if (!downloadPath.empty()) return downloadPath; char *dirPath = nullptr; int storageId = -1; int error = storage_foreach_device_supported(storageCb, &storageId); - if(error == STORAGE_ERROR_NONE) + if (error == STORAGE_ERROR_NONE) storage_get_directory(storageId, STORAGE_DIRECTORY_DOWNLOADS, &dirPath); - if(dirPath) + if (dirPath) { downloadPath = dirPath; free(dirPath); diff --git a/src/Common/Utils/src/PhoneNumberUtils.cpp b/src/Common/Utils/src/PhoneNumberUtils.cpp index 18b8727..b9c6bb0 100644 --- a/src/Common/Utils/src/PhoneNumberUtils.cpp +++ b/src/Common/Utils/src/PhoneNumberUtils.cpp @@ -33,7 +33,7 @@ using namespace Msg; std::string res; char *normalizedNum = nullptr; phone_number_get_normalized_number(number.c_str(), &normalizedNum); - if(normalizedNum) + if (normalizedNum) { res = normalizedNum; free(normalizedNum); diff --git a/src/Common/Utils/src/TextDecorator.cpp b/src/Common/Utils/src/TextDecorator.cpp index d4e90be..491adcf 100644 --- a/src/Common/Utils/src/TextDecorator.cpp +++ b/src/Common/Utils/src/TextDecorator.cpp @@ -34,7 +34,7 @@ namespace { const char *alignAsString(TextAlign align) { - switch(align) + switch (align) { case TextAlign::Center: return "center"; @@ -64,7 +64,6 @@ TextStyle::TextStyle(int size, const std::string &color, TextAlign align) , m_Align(align) , m_Size(size) { - } TextStyle::~TextStyle() @@ -142,17 +141,17 @@ std::string TextDecorator::makePlainText(const std::string &text) std::string TextDecorator::highlightKeyword(std::string str, const std::string &searchWord, bool *foundRes) { - if(foundRes) + if (foundRes) *foundRes = false; - if(str.empty() || searchWord.empty()) + if (str.empty() || searchWord.empty()) return std::move(str); char *found = strcasestr((char*)str.c_str(), (char*)searchWord.c_str()); - if(!found) + if (!found) return str; - if(foundRes) + if (foundRes) *foundRes = true; std::string res; diff --git a/src/Common/Utils/src/ThumbnailMaker.cpp b/src/Common/Utils/src/ThumbnailMaker.cpp index aefcb14..5f3c382 100644 --- a/src/Common/Utils/src/ThumbnailMaker.cpp +++ b/src/Common/Utils/src/ThumbnailMaker.cpp @@ -41,7 +41,7 @@ ThumbnailMaker::ThumbnailMaker(App &app) m_ContactsMap.reserve(defaultCache); m_OriginsMap.reserve(defaultCache); - for(int i = 0; i <= maxStaticThumbId; i++) + for (int i = 0; i <= maxStaticThumbId; i++) { getThumbId((DefaultThumbs)i); } @@ -65,14 +65,12 @@ ThumbId ThumbnailMaker::getThumbId(const std::string &address) ThumbId ThumbnailMaker::getThumbIdFromFile(const std::string &path) { - if(path.empty()) + if (path.empty()) { return getThumbId(SingleThumb); - } - else - { + } else { auto it = m_ContactsMap.find(path); - if(it != m_ContactsMap.end()) + if (it != m_ContactsMap.end()) return it->second; Evas_Object *origin = makeOriginThumb(m_App.getWindow(), path); @@ -85,19 +83,15 @@ ThumbId ThumbnailMaker::getThumbIdFromFile(const std::string &path) ThumbId ThumbnailMaker::getThumbId(DefaultThumbs thumb) { auto it = m_ContactsMap.find(defaultThumbsToStr(thumb)); - if(it != m_ContactsMap.end()) + if (it != m_ContactsMap.end()) { return it->second; - } - else - { + } else { Evas_Object *origin = nullptr; - if(thumb != OwnerThumb) + if (thumb != OwnerThumb) { origin = makeDefaultOriginThumb(m_App.getWindow(), defaultThumbsToPath(thumb)); - } - else - { + } else { ContactMyProfileRef ownerProfile = m_App.getContactManager().getOwnerProfile(); origin = ownerProfile ? makeOriginThumb(m_App.getWindow(), ownerProfile->getThumbnailPath()) : makeDefaultOriginThumb(m_App.getWindow(), defaultThumbsToPath(SingleThumb)); @@ -111,7 +105,7 @@ ThumbId ThumbnailMaker::getThumbId(DefaultThumbs thumb) Evas_Object *ThumbnailMaker::getThumb(Evas_Object *parent, ThumbId id, int thumbSize) { auto it = m_OriginsMap.find(id); - if(it == m_OriginsMap.end()) + if (it == m_OriginsMap.end()) { MSG_LOG_ERROR("Invalid thumbnail id"); return nullptr; @@ -185,23 +179,23 @@ void ThumbnailMaker::invalidate() // m_OriginsMap: auto originsIt = m_OriginsMap.begin(); - for(; originsIt != m_OriginsMap.end();) + for (; originsIt != m_OriginsMap.end();) { - if(originsIt->first > maxStaticThumbId) + if (originsIt->first > maxStaticThumbId) { MSG_LOG(originsIt->first); evas_object_del(originsIt->second); originsIt = m_OriginsMap.erase(originsIt); - } - else + } else { ++originsIt; + } } // m_ContactsMap: auto contactsIt = m_ContactsMap.begin(); - for(; contactsIt != m_ContactsMap.end();) + for (; contactsIt != m_ContactsMap.end();) { - if(contactsIt->second > maxStaticThumbId) + if (contactsIt->second > maxStaticThumbId) contactsIt = m_ContactsMap.erase(contactsIt); else ++contactsIt; diff --git a/src/Common/Utils/src/TimeUtils.cpp b/src/Common/Utils/src/TimeUtils.cpp index 41529e4..3c0b855 100644 --- a/src/Common/Utils/src/TimeUtils.cpp +++ b/src/Common/Utils/src/TimeUtils.cpp @@ -63,13 +63,11 @@ std::string TimeUtils::makeThreadTimeString(time_t msgTime) bool isToday = (curDay - msgDay == 0); - if(isToday) + if (isToday) { const std::string &timeFormat = getTimeFormat() == TimeFormat24H ? time24H : time12H; return getFormattedDate(locale, getDateBestPattern(locale, timeFormat), msgTime); - } - else - { + } else { bool notThisYear = (msgTimeTm.tm_year - curTimeTm.tm_year != 0); const std::string &date = notThisYear ? dateListYear : dateListDefault; return getFormattedDate(locale, getDateBestPattern(locale, date), msgTime); @@ -142,7 +140,7 @@ std::string TimeUtils::makeCalEventString(int year, int month, int mday, int hou int TimeUtils::getTimeFormat() { bool timeFormat = false; - if(system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, &timeFormat) < 0) + if (system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, &timeFormat) < 0) return TimeFormatUnknown; return timeFormat ? TimeFormat24H : TimeFormat12H; } @@ -154,18 +152,16 @@ const std::string &TimeUtils::getDefaultLocale() char *str = nullptr; system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &str); - if(str) + if (str) { i18n_ulocale_set_default(str); res = str; size_t i = res.find("."); - if(i != std::string::npos) + if (i != std::string::npos) res = res.substr(i); free(str); - } - else - { + } else { res.clear(); } return res; @@ -180,16 +176,14 @@ std::string TimeUtils::getTimezone() if (len != -1) { buf[len] = '\0'; - } - else - { + } else { MSG_LOG_ERROR("Getting default timezone failed, use system settings value"); std::string res; char *time_zone = nullptr; system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, &time_zone); - if(time_zone) + if (time_zone) { res = time_zone; free(time_zone); @@ -258,13 +252,13 @@ std::string TimeUtils::getFormattedDate(const std::string &locale, const std::st MSG_LOG_ERROR("default timezone set error"); /* convert time_t to UDate, if it is */ - if(time) + if (time) date = (i18n_udate)time * 1000; else i18n_ucalendar_get_now(&date); dateFormat = getDateFormat(locale, uBestPattern, &status); - if(status == I18N_ERROR_NONE) + if (status == I18N_ERROR_NONE) { /* get formatted string */ i18n_udate_format_date(dateFormat, date, formatted, formattedCapacity, nullptr, &formattedLength); diff --git a/src/Common/Utils/src/VCalendarParser.cpp b/src/Common/Utils/src/VCalendarParser.cpp index 6ad232c..ccc0d9a 100644 --- a/src/Common/Utils/src/VCalendarParser.cpp +++ b/src/Common/Utils/src/VCalendarParser.cpp @@ -27,18 +27,16 @@ CalendarEvent::CalendarEvent(calendar_record_h record) { char *summary = nullptr; calendar_record_get_str_p(record, _calendar_event.summary, &summary); - if(summary) + if (summary) m_Summary = summary; calendar_time_s start = {}; - if(calendar_record_get_caltime(record, _calendar_event.start_time, &start) == 0) + if (calendar_record_get_caltime(record, _calendar_event.start_time, &start) == 0) { - if(start.type == CALENDAR_TIME_UTIME) // Unix time + if (start.type == CALENDAR_TIME_UTIME) // Unix time { m_StartDate = TimeUtils::makeCalEventString(start.time.utime); - } - else // Local time - { + } else { // Local time m_StartDate = TimeUtils::makeCalEventString ( start.time.date.year, @@ -46,8 +44,7 @@ CalendarEvent::CalendarEvent(calendar_record_h record) start.time.date.mday, start.time.date.hour, start.time.date.minute, - nullptr - ); + nullptr); } } } @@ -80,7 +77,7 @@ VCalendarParser &VCalendarParser::getInst() std::list VCalendarParser::parse(const std::string &filePath) { - if(filePath.empty()) + if (filePath.empty()) return {}; std::list list; @@ -94,20 +91,20 @@ std::list VCalendarParser::parse(const std::string &filePath) calendar_list_get_count(records, &count); calendar_list_first(records); - for(int i = 0; i < count; ++i) + for (int i = 0; i < count; ++i) { calendar_record_h record = nullptr; calendar_list_get_current_record_p(records, &record); - if(record) + if (record) { char *viewUri = nullptr; calendar_record_get_uri_p(record, &viewUri); - if(viewUri && !strcmp(viewUri, _calendar_event._uri)) + if (viewUri && !strcmp(viewUri, _calendar_event._uri)) list.emplace_back(record); } } - if(records) + if (records) calendar_list_destroy(records, true); return list; diff --git a/src/Common/View/inc/ListView.h b/src/Common/View/inc/ListView.h index 9ef94ef..fe3596c 100644 --- a/src/Common/View/inc/ListView.h +++ b/src/Common/View/inc/ListView.h @@ -292,13 +292,13 @@ namespace Msg std::vector list; list.reserve(elm_genlist_items_count(getEo())); Elm_Object_Item *elmItem = elm_genlist_first_item_get(getEo()); - while(elmItem) + while (elmItem) { void *data = elm_object_item_data_get(elmItem); - if(data) + if (data) { T *listItem = dynamic_cast(static_cast(data)); - if(listItem) + if (listItem) list.push_back(listItem); } elmItem = elm_genlist_item_next_get(elmItem); @@ -316,7 +316,7 @@ namespace Msg { next = getNextItem(*next); res = dynamic_cast(next); - } while(next && !res); + } while (next && !res); return res; } @@ -330,7 +330,7 @@ namespace Msg { prev = getPrevItem(*prev); res = dynamic_cast(prev); - } while(prev && !res); + } while (prev && !res); return res; } diff --git a/src/Common/View/inc/MbeRecipientViewItem.h b/src/Common/View/inc/MbeRecipientViewItem.h index 6765fb8..3d54c21 100644 --- a/src/Common/View/inc/MbeRecipientViewItem.h +++ b/src/Common/View/inc/MbeRecipientViewItem.h @@ -112,7 +112,7 @@ namespace Msg inline void MbeRecipientItem::setDispName(const std::string &dispName) { m_DispName = dispName; - if(getElmObjItem()) + if (getElmObjItem()) setText(dispName); } } diff --git a/src/Common/View/inc/PopupList.h b/src/Common/View/inc/PopupList.h index f6f84a6..a0d4a03 100644 --- a/src/Common/View/inc/PopupList.h +++ b/src/Common/View/inc/PopupList.h @@ -38,7 +38,7 @@ namespace Msg }; public: PopupList(Evas_Object *parent, PopupListType type = ListPopup); - PopupList(PopupManager &parent, PopupListType type= ListPopup); + PopupList(PopupManager &parent, PopupListType type = ListPopup); virtual ~PopupList(); /** diff --git a/src/Common/View/inc/PopupManager.h b/src/Common/View/inc/PopupManager.h index 4ed0f47..9e1f807 100644 --- a/src/Common/View/inc/PopupManager.h +++ b/src/Common/View/inc/PopupManager.h @@ -86,7 +86,7 @@ namespace Msg * @param[in] new popup owner * @return popup created. */ - Popup &getPopup(void *newOwner = nullptr ); + Popup &getPopup(void *newOwner = nullptr); /** * @brief Creates specific popup. diff --git a/src/Common/View/src/Box.cpp b/src/Common/View/src/Box.cpp index c51187b..d4a429c 100644 --- a/src/Common/View/src/Box.cpp +++ b/src/Common/View/src/Box.cpp @@ -29,5 +29,4 @@ Box::Box(Evas_Object *parent) Box::~Box() { - } diff --git a/src/Common/View/src/ContextPopup.cpp b/src/Common/View/src/ContextPopup.cpp index 43e4479..d9369b0 100644 --- a/src/Common/View/src/ContextPopup.cpp +++ b/src/Common/View/src/ContextPopup.cpp @@ -27,7 +27,6 @@ ContextPopupItem::ContextPopupItem(ContextPopup &parent, int id, ContextPopupIte , m_pUserCb(userCb) , m_pUserData(userData) { - } ContextPopupItem::~ContextPopupItem() @@ -56,12 +55,10 @@ ContextPopupItem *ContextPopup::appendItem(const std::string &text, Evas_Object ContextPopupItem *newItem = new ContextPopupItem(*this, id, cb, userData); Elm_Object_Item *elmItem = elm_ctxpopup_item_append(getEo(), text.c_str(), icon, on_item_pressed_cb, newItem); - if(elmItem) + if (elmItem) { newItem->setElmObjItem(elmItem); - } - else - { + } else { delete newItem; newItem = nullptr; } @@ -109,7 +106,7 @@ void ContextPopup::on_dismissed_cb(void *data, Evas_Object *obj, void *event_inf void ContextPopup::on_item_pressed_cb(void *data, Evas_Object *obj, void *event_info) { ContextPopupItem *item = static_cast(data); - if(item && item->m_pUserCb) + if (item && item->m_pUserCb) item->m_pUserCb(*item, item->m_pUserData); } diff --git a/src/Common/View/src/DefaultLayout.cpp b/src/Common/View/src/DefaultLayout.cpp index f790ed1..723b0bd 100644 --- a/src/Common/View/src/DefaultLayout.cpp +++ b/src/Common/View/src/DefaultLayout.cpp @@ -32,7 +32,6 @@ DefaultLayout::DefaultLayout(Evas_Object *parent) DefaultLayout::~DefaultLayout() { - } void DefaultLayout::setContent(Evas_Object *obj) @@ -53,13 +52,11 @@ void DefaultLayout::setFloatingButton(Evas_Object *obj) void DefaultLayout::showFloatingButton(bool show) { - if(show) + if (show) { View::setContent(m_pFloatingBtn, floatingPart, true); evas_object_show(m_pFloatingBtn); - } - else - { + } else { View::unsetContent(floatingPart); evas_object_hide(m_pFloatingBtn); } diff --git a/src/Common/View/src/ListItem.cpp b/src/Common/View/src/ListItem.cpp index b6d335d..6b7ea69 100644 --- a/src/Common/View/src/ListItem.cpp +++ b/src/Common/View/src/ListItem.cpp @@ -37,7 +37,7 @@ ListItemStyle::ListItemStyle(const char *itemStyle, const char *decorateItemStyl ListItemStyle::~ListItemStyle() { unregisterCallback(); - if(m_pGenlistItemClass) + if (m_pGenlistItemClass) elm_genlist_item_class_free(m_pGenlistItemClass); } @@ -50,7 +50,7 @@ ListItemStyleRef ListItemStyle::create(const char *itemStyle, void ListItemStyle::setStyle(const char * itemStyle, const char * decorateItemStyle, const char * decorateAllItemStyle) { - if(!m_pGenlistItemClass) + if (!m_pGenlistItemClass) return; m_pGenlistItemClass->decorate_all_item_style = decorateAllItemStyle; @@ -60,7 +60,7 @@ void ListItemStyle::setStyle(const char * itemStyle, const char * decorateItemSt void ListItemStyle::registerCallback() { - if(!m_pGenlistItemClass) + if (!m_pGenlistItemClass) return; m_pGenlistItemClass->func.text_get = &ListItem::elm_gen_item_text_get_cb; @@ -72,7 +72,7 @@ void ListItemStyle::registerCallback() void ListItemStyle::unregisterCallback() { - if(!m_pGenlistItemClass) + if (!m_pGenlistItemClass) return; m_pGenlistItemClass->func.text_get = nullptr; @@ -95,7 +95,6 @@ ListItem::ListItem(const ListItemStyleRef &itemStyle, Elm_Genlist_Item_Type type ListItem::ListItem(Elm_Genlist_Item_Type type) : ListItem(ListItemStyleRef(), type) { - } ListItem::~ListItem() @@ -126,7 +125,7 @@ char *ListItem::elm_gen_item_text_get_cb(void *data, Evas_Object *obj, const cha { ListItem *self = static_cast(data); - if(self) + if (self) { std::string text = self->getText(*self, part); return text.empty() ? nullptr : strdup(text.c_str()); @@ -139,13 +138,13 @@ Evas_Object *ListItem::elm_gen_item_content_get_cb(void * data, Evas_Object * ob { ListItem *self = static_cast(data); - if(!self) + if (!self) return nullptr; - if(self->getOwner()->getCheckMode()) + if (self->getOwner()->getCheckMode()) { const char *checkPart = self->getCheckPart(*self); - if(checkPart && strcmp(checkPart, part) == 0) + if (checkPart && strcmp(checkPart, part) == 0) { return self->addCheck(); } @@ -235,7 +234,7 @@ void ListItem::setExpanded(bool expand) void ListItem::update() { - if(m_ItemStyle->m_pGenlistItemClass != elm_genlist_item_item_class_get(getElmObjItem())) + if (m_ItemStyle->m_pGenlistItemClass != elm_genlist_item_item_class_get(getElmObjItem())) elm_genlist_item_item_class_update(getElmObjItem(), m_ItemStyle->m_pGenlistItemClass); elm_genlist_item_update(getElmObjItem()); } @@ -283,7 +282,7 @@ void ListItem::elm_gen_item_del_cb(void *data, Evas_Object *obj) { ListItem *self = static_cast(data); - if(self) + if (self) self->onDelete(*self); } diff --git a/src/Common/View/src/ListView.cpp b/src/Common/View/src/ListView.cpp index cab9346..007d158 100644 --- a/src/Common/View/src/ListView.cpp +++ b/src/Common/View/src/ListView.cpp @@ -109,14 +109,13 @@ bool ListView::sortedInsertItem(ListItem &listItem, ListItem *parent) int res = 0; ListItem *item1 = (ListItem*)elm_object_item_data_get((Elm_Object_Item*)data1); ListItem *item2 = (ListItem*)elm_object_item_data_get((Elm_Object_Item*)data2); - if(item1->m_pOwner->m_CmpFunc) + if (item1->m_pOwner->m_CmpFunc) res = item1->m_pOwner->m_CmpFunc(*item1, *item2); return res; }, on_item_selected_cb, - this - ); + this); listItem.setElmObjItem(elmItem); return elmItem != nullptr; @@ -136,11 +135,11 @@ ListItemCollection ListView::getItems() const { ListItemCollection list; Elm_Object_Item *elmItem = elm_genlist_first_item_get(getEo()); - while(elmItem) + while (elmItem) { void *data = elm_object_item_data_get(elmItem); MSG_ASSERT(data, "Genlist item data is NULL"); - if(data) + if (data) { ListItem *listItem = static_cast(data); list.push_back(listItem); @@ -155,7 +154,7 @@ ListItemCollection ListView::getRealizedItems() const { ListItemCollection collection; Eina_List *list = elm_genlist_realized_items_get(getEo()); - if(list) + if (list) { void *obj = nullptr; Eina_List *l = nullptr; @@ -247,12 +246,12 @@ void ListView::notifyListener(void *data, Evas_Object *obj, void *event_info, Li ListItem *item = ListItem::staticCast(event_info); MSG_ASSERT(item, "Item is null"); - if(item) + if (item) { ListView *owner = item->getOwner(); MSG_ASSERT(owner, "ListItem::owner is null"); - if(owner && owner->m_pListener) + if (owner && owner->m_pListener) (owner->m_pListener->*method)(*item); } } @@ -269,7 +268,7 @@ bool ListView::getCheckMode() const void ListView::checkAllItems(bool check, bool updateFullItem) { - for(ListItem *item: getItems()) + for (ListItem *item: getItems()) { item->setCheckedState(check, false); } @@ -277,7 +276,7 @@ void ListView::checkAllItems(bool check, bool updateFullItem) if (updateFullItem) updateRealizedItems(); else - for(ListItem *item: getRealizedItems()) + for (ListItem *item: getRealizedItems()) { item->updateFields(item->getCheckPart(*item), ELM_GENLIST_ITEM_FIELD_ALL); } @@ -303,13 +302,11 @@ void ListView::on_item_selected_cb(void *data, Evas_Object *obj, void *event_inf ListItem *item = ListItem::staticCast(event_info); item->setSelected(false); - if(item->getOwner()->getCheckMode() && item->isCheckable()) + if (item->getOwner()->getCheckMode() && item->isCheckable()) { item->changeCheckedState(true); notifyListener(data, obj, event_info, &IListViewListener::onListItemChecked); - } - else - { + } else { notifyListener(data, obj, event_info, &IListViewListener::onListItemSelected); } } @@ -330,6 +327,6 @@ void ListView::on_longpressed_cb(void *data, Evas_Object *obj, void *event_info) { ListItem *item = ListItem::staticCast(event_info); item->setSelected(false); - if(!item->getOwner()->getCheckMode()) + if (!item->getOwner()->getCheckMode()) notifyListener(data, obj, event_info, &IListViewListener::onListItemLongPressed); } diff --git a/src/Common/View/src/MbeRecipientsView.cpp b/src/Common/View/src/MbeRecipientsView.cpp index 2589998..5260edc 100644 --- a/src/Common/View/src/MbeRecipientsView.cpp +++ b/src/Common/View/src/MbeRecipientsView.cpp @@ -36,7 +36,7 @@ MbeRecipientsView::MbeRecipientsView(Evas_Object *parent) MbeRecipientsView::~MbeRecipientsView() { - if(m_pChangedJob) + if (m_pChangedJob) { ecore_job_del(m_pChangedJob); m_pChangedJob = nullptr; @@ -53,7 +53,7 @@ int MbeRecipientsView::getItemsCount() const { unsigned int res = 0; const Eina_List* items = elm_multibuttonentry_items_get(getEo()); - if(items) + if (items) res = eina_list_count(items); return res; } @@ -63,7 +63,7 @@ std::vector MbeRecipientsView::getItems() const std::vector res; Elm_Object_Item *elmItem = elm_multibuttonentry_first_item_get(getEo()); - while(elmItem) + while (elmItem) { MbeRecipientItem *item = static_cast(elm_object_item_data_get(elmItem)); res.push_back(item); @@ -103,16 +103,15 @@ void MbeRecipientsView::onMbeItemClicked(Evas_Object *obj, void *eventInfo) void MbeRecipientsView::onMbeChanged(Evas_Object *obj, void *eventInfo) { - if(!m_pChangedJob) + if (!m_pChangedJob) m_pChangedJob = ecore_job_add ( [](void *data) { MbeRecipientsView *self = static_cast(data); self->m_pChangedJob = nullptr; - if(self->m_pListener) + if (self->m_pListener) self->m_pListener->onMbeChanged(); }, - this - ); + this); } diff --git a/src/Common/View/src/NaviFrameItem.cpp b/src/Common/View/src/NaviFrameItem.cpp index 2a98e44..a49bc76 100644 --- a/src/Common/View/src/NaviFrameItem.cpp +++ b/src/Common/View/src/NaviFrameItem.cpp @@ -90,9 +90,7 @@ void NaviFrameItem::setTitleVisibility(bool visible) { setContent(*m_pNaviBar, naviTitlePart); evas_object_show(*m_pNaviBar); - } - else - { + } else { evas_object_hide(elm_object_item_part_content_unset(getElmObjItem(), naviTitlePart)); } } @@ -147,7 +145,7 @@ std::string NaviFrameItem::NaviBar::getTitle() const void NaviFrameItem::NaviBar::getButton(NaviButtonId id) { - if(!m_ButtonList[id].button) + if (!m_ButtonList[id].button) { Evas_Object *btn = elm_button_add(getEo()); m_ButtonList[id].button = btn; @@ -160,25 +158,23 @@ void NaviFrameItem::NaviBar::getButton(NaviButtonId id) void NaviFrameItem::NaviBar::showButton(NaviButtonId id, bool value) { - if(value) + if (value) { getButton(id); - if(getContent(m_ButtonList[id].part) != m_ButtonList[id].button) + if (getContent(m_ButtonList[id].part) != m_ButtonList[id].button) setContent(m_ButtonList[id].button, m_ButtonList[id].part); setButtonColor(id, m_CurrentColor); evas_object_show(m_ButtonList[id].button); - } - else - { - if(getContent(m_ButtonList[id].part) == m_ButtonList[id].button) + } else { + if (getContent(m_ButtonList[id].part) == m_ButtonList[id].button) { evas_object_del(m_ButtonList[id].button); m_ButtonList[id].button = nullptr; } } - switch(id) + switch (id) { case NaviCancelButtonId: showCancelButtonPart(value); @@ -209,7 +205,7 @@ void NaviFrameItem::NaviBar::disabledButton(NaviButtonId id, bool value) { elm_object_disabled_set(m_ButtonList[id].button, value); - if(m_CurrentColor == NaviBlueColorId) + if (m_CurrentColor == NaviBlueColorId) return; TextStyle style; @@ -223,21 +219,19 @@ void NaviFrameItem::NaviBar::disabledButton(NaviButtonId id, bool value) void NaviFrameItem::NaviBar::showCancelButtonPart(bool value) { - if(value) + if (value) { emitSignal("cancel,show,btn", "*"); - } - else if(getContent(cancelButtonPart) == nullptr) - { + } else if (getContent(cancelButtonPart) == nullptr) { emitSignal("left,clear", "*"); } } void NaviFrameItem::NaviBar::showOkButtonPart(bool value) { - if(value) + if (value) emitSignal("done,show,btn", "*"); - else if(getContent(okButtonPart) == nullptr) + else if (getContent(okButtonPart) == nullptr) emitSignal("right,clear", "*"); } @@ -249,20 +243,20 @@ void NaviFrameItem::NaviBar::showCenterButtonPart(bool value) void NaviFrameItem::NaviBar::showPrevButtonPart(bool value) { - if(value) + if (value) emitSignal("back,show,btn", "*"); - else if(getContent(prevButtonPart) == nullptr) + else if (getContent(prevButtonPart) == nullptr) emitSignal("left,clear", "*"); - if(getContent(downButtonPart) == nullptr) + if (getContent(downButtonPart) == nullptr) emitSignal("empty,right,show", "*"); } void NaviFrameItem::NaviBar::showDownButtonPart(bool value) { - if(value) + if (value) emitSignal("down,show,btn", "*"); - else if(getContent(downButtonPart) == nullptr) + else if (getContent(downButtonPart) == nullptr) emitSignal("right,clear", "*"); } @@ -286,7 +280,7 @@ void NaviFrameItem::onAttached(ViewItem &item) void NaviFrameItem::NaviBar::setColor(NaviColorId id) { - switch(id) + switch (id) { case NaviBlueColorId: emitSignal("title,color,blue", "*"); @@ -308,7 +302,7 @@ void NaviFrameItem::NaviBar::setButtonText(NaviButtonId id, const std::string &t // Note that, button's color is opposite to title's color TextStyle style; - switch(m_CurrentColor) + switch (m_CurrentColor) { case NaviBlueColorId: style.setColor(textColorWhiteTitleButtons); @@ -335,7 +329,7 @@ void NaviFrameItem::NaviBar::setButtonColor(NaviButtonId id, NaviColorId titleCo // Note that, button's color is opposite to title's color if (id == NaviPrevButtonId || id == NaviExpandButtonId) { - switch(titleColor) + switch (titleColor) { case NaviBlueColorId: emitSignal(m_ButtonList[id].button, "button,color,white", "*"); @@ -348,12 +342,10 @@ void NaviFrameItem::NaviBar::setButtonColor(NaviButtonId id, NaviColorId titleCo default: break; } - } - else - { + } else { TextStyle style; - switch(titleColor) + switch (titleColor) { case NaviBlueColorId: style.setColor(textColorWhiteTitleButtons); diff --git a/src/Common/View/src/NaviFrameView.cpp b/src/Common/View/src/NaviFrameView.cpp index 5444a99..bae61a8 100644 --- a/src/Common/View/src/NaviFrameView.cpp +++ b/src/Common/View/src/NaviFrameView.cpp @@ -39,7 +39,6 @@ NaviFrameView::NaviFrameView(View &parent) NaviFrameView::~NaviFrameView() { - } void NaviFrameView::create(Evas_Object *parent) @@ -52,14 +51,14 @@ void NaviFrameView::create(Evas_Object *parent) void NaviFrameView::pause() { NaviFrameItem *top = getTopFrame(); - if(top) + if (top) onPause(*top); } void NaviFrameView::resume() { NaviFrameItem *top = getTopFrame(); - if(top) + if (top) onResume(*top); } @@ -76,8 +75,8 @@ NaviFrameItem *NaviFrameView::getTopFrame() const int NaviFrameView::getItemsCount() const { int res = 0; - Eina_List *list= elm_naviframe_items_get(getEo()); - if(list) + Eina_List *list = elm_naviframe_items_get(getEo()); + if (list) { res = eina_list_count(list); eina_list_free(list); @@ -88,9 +87,9 @@ int NaviFrameView::getItemsCount() const NaviFrameItemList NaviFrameView::getItems() const { NaviFrameItemList result; - Eina_List *list= elm_naviframe_items_get(getEo()); + Eina_List *list = elm_naviframe_items_get(getEo()); - if(list) + if (list) { Eina_List *l = nullptr; void *obj = nullptr; @@ -130,7 +129,7 @@ void NaviFrameView::push(NaviFrameItem &item, View &content) void NaviFrameView::pop() { auto *topFrame = getTopFrame(); - if(topFrame) + if (topFrame) pop(*topFrame); } @@ -138,21 +137,17 @@ void NaviFrameView::pop(NaviFrameItem &item) { // Workaround solution to avoid rejected JIRA issue: http://suprem.sec.samsung.net/jira/browse/TSAM-6776 item.m_IsPopping = true; - if(getTransitionStatus()) + if (getTransitionStatus()) { m_ItemsToDelete.push_back(&item); - } - else - { - if(getTopFrame() == &item) + } else { + if (getTopFrame() == &item) { m_TransitionStatus = getItemsCount() > 1; pause(); elm_naviframe_item_pop(getEo()); resume(); - } - else - { + } else { pause(); item.destroy(); resume(); @@ -165,13 +160,11 @@ void NaviFrameView::insertToBottom(NaviFrameItem &item) Elm_Object_Item *before = elm_naviframe_bottom_item_get(getEo()); Elm_Object_Item *insert = nullptr; - if(before) + if (before) { insert = elm_naviframe_item_insert_before(getEo(), before, nullptr, nullptr, nullptr, nullptr, naviTitleStyleEmpty); item.setElmObjItem(insert); - } - else - { + } else { m_TransitionStatus = !isEmpty(); pause(); insert = elm_naviframe_item_push(getEo(), nullptr, nullptr, nullptr, nullptr, naviTitleStyleEmpty); @@ -183,7 +176,7 @@ void NaviFrameView::insertToBottom(NaviFrameItem &item) void NaviFrameView::promote(NaviFrameItem &item) { bool isTop = &item == getTopFrame(); - if(!isTop) + if (!isTop) { m_TransitionStatus = true; pause(); @@ -199,15 +192,15 @@ void NaviFrameView::onTransitionFinished(Evas_Object *obj, void *eventInfo) auto *transFinishedItem = ViewItem::staticCast(eventInfo); - for(NaviFrameItem *item: m_ItemsToDelete) + for (NaviFrameItem *item: m_ItemsToDelete) { - if(item == transFinishedItem) + if (item == transFinishedItem) transFinishedItem = nullptr; item->destroy(); } m_ItemsToDelete.clear(); - if(transFinishedItem) + if (transFinishedItem) transFinishedItem->onTransitionFinished(*transFinishedItem); } diff --git a/src/Common/View/src/NoContentLayout.cpp b/src/Common/View/src/NoContentLayout.cpp index 79446f4..e7fa83e 100644 --- a/src/Common/View/src/NoContentLayout.cpp +++ b/src/Common/View/src/NoContentLayout.cpp @@ -26,7 +26,6 @@ NoContentLayout::NoContentLayout(Evas_Object *parent) NoContentLayout::~NoContentLayout() { - } void NoContentLayout::setText(const TText &text) diff --git a/src/Common/View/src/Popup.cpp b/src/Common/View/src/Popup.cpp index b00fd20..55fa604 100644 --- a/src/Common/View/src/Popup.cpp +++ b/src/Common/View/src/Popup.cpp @@ -55,7 +55,7 @@ Popup::Popup(PopupManager &parent) Popup::~Popup() { MSG_LOG("Destructor"); - if(m_pShowIdler) + if (m_pShowIdler) { ecore_idler_del(m_pShowIdler); m_pShowIdler = nullptr; @@ -80,7 +80,7 @@ void Popup::create(Evas_Object *parent) void Popup::destroy() { - if(m_pManager) + if (m_pManager) m_pManager->reset(); else View::destroy(); @@ -151,7 +151,7 @@ Evas_Object *Popup::addButton(const TText &text, int buttonId, PopupButtonCb but elm_object_style_set(btn, buttonStyle); View::setContent(btn, ss.str().c_str()); - if(elm_object_part_content_get(getEo(), ss.str().c_str())) + if (elm_object_part_content_get(getEo(), ss.str().c_str())) { ++m_CurrentButtonIndex; evas_object_show(btn); @@ -160,9 +160,7 @@ Evas_Object *Popup::addButton(const TText &text, int buttonId, PopupButtonCb but evas_object_data_set(btn, buttonCbDataKey, userData); evas_object_smart_callback_add(btn, "clicked", on_button_clicked, this); setText(btn, text); - } - else - { + } else { MSG_LOG_ERROR("Can't set content to part: ", ss.str()); evas_object_del(btn); btn = nullptr; @@ -193,13 +191,11 @@ void Popup::setTitle(const TText &title) void Popup::show(bool deferred) { - if(!deferred) + if (!deferred) { View::show(); - } - else - { - if(!m_pShowIdler) + } else { + if (!m_pShowIdler) { m_pShowIdler = ecore_idler_add ( @@ -210,8 +206,7 @@ void Popup::show(bool deferred) self->View::show(); return false; // Delete idler }, - this - ); + this); } } } @@ -219,7 +214,7 @@ void Popup::show(bool deferred) void Popup::on_button_clicked(void *data, Evas_Object *obj, void *event_info) { PopupButtonCb cb = (PopupButtonCb)evas_object_data_get(obj, buttonCbKey); - if(cb) + if (cb) { void *userData = evas_object_data_get(obj, buttonCbDataKey); auto *popup = static_cast(data); @@ -231,7 +226,7 @@ void Popup::on_button_clicked(void *data, Evas_Object *obj, void *event_info) void Popup::on_popup_block_clicked_cb(void *data, Evas_Object *obj, void *event_info) { auto *popup = static_cast(data); - if(popup->m_OutsideTapDismiss) + if (popup->m_OutsideTapDismiss) popup->destroy(); } diff --git a/src/Common/View/src/PopupListItem.cpp b/src/Common/View/src/PopupListItem.cpp index 556a355..9e9d0b5 100644 --- a/src/Common/View/src/PopupListItem.cpp +++ b/src/Common/View/src/PopupListItem.cpp @@ -51,7 +51,7 @@ PopupTextListItem::~PopupTextListItem() std::string PopupTextListItem::getText(ListItem &item, const char *part) { - if(strcmp(part, "elm.text") == 0) + if (strcmp(part, "elm.text") == 0) return m_Text; return std::string(); } @@ -73,7 +73,7 @@ const char *PopupCheckListItem::getCheckPart(ListItem &item) std::string PopupCheckListItem::getText(ListItem &item, const char *part) { - if(strcmp(part, "elm.text") == 0) + if (strcmp(part, "elm.text") == 0) return m_Text; return std::string(); } diff --git a/src/Common/View/src/PopupManager.cpp b/src/Common/View/src/PopupManager.cpp index c57b496..0036b51 100644 --- a/src/Common/View/src/PopupManager.cpp +++ b/src/Common/View/src/PopupManager.cpp @@ -40,9 +40,9 @@ PopupManager::~PopupManager() void PopupManager::reset(void *popupOwner) { - if(!popupOwner || (popupOwner == m_pPopupOwner)) + if (!popupOwner || (popupOwner == m_pPopupOwner)) { - if(m_pPopup) + if (m_pPopup) { m_pPopup->View::destroy(); m_pPopup = nullptr; @@ -54,7 +54,7 @@ void PopupManager::reset(void *popupOwner) void PopupManager::reset(Popup &popup, void *newOwner) { m_pPopupOwner = newOwner; - if(&popup != m_pPopup) + if (&popup != m_pPopup) { reset(); eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, SMART_CALLBACK(PopupManager, onHwBackButtonPopupClicked), this); diff --git a/src/Common/View/src/SelectAllListItem.cpp b/src/Common/View/src/SelectAllListItem.cpp index a1332ad..448e8fa 100644 --- a/src/Common/View/src/SelectAllListItem.cpp +++ b/src/Common/View/src/SelectAllListItem.cpp @@ -44,7 +44,7 @@ const char *SelectAllListItem::getCheckPart(ListItem &item) std::string SelectAllListItem::getText(ListItem &item, const char *part) { - if(strcmp(part, textPart) == 0) + if (strcmp(part, textPart) == 0) { return msg("IDS_MSG_MBODY_SELECT_ALL"); } diff --git a/src/Common/View/src/View.cpp b/src/Common/View/src/View.cpp index 0dfa475..7ccdfd8 100644 --- a/src/Common/View/src/View.cpp +++ b/src/Common/View/src/View.cpp @@ -53,12 +53,10 @@ Evas_Object_Event_Cb View::getCb(Evas_Callback_Type type) void View::setEventCb(Evas_Callback_Type type) { Evas_Object_Event_Cb cb = getCb(type); - if(cb) + if (cb) { evas_object_event_callback_add(m_pEo, type, cb, this); - } - else - { + } else { MSG_LOG_ERROR("Not implemented"); assert(false); } @@ -66,14 +64,14 @@ void View::setEventCb(Evas_Callback_Type type) void View::setEo(Evas_Object *eo) { - if(m_pEo) + if (m_pEo) { MSG_LOG_ERROR("m_pEo not null"); assert(false); } m_pEo = eo; - if(eo) + if (eo) { setData(this); setEventCb(EVAS_CALLBACK_FREE); @@ -84,12 +82,10 @@ void View::setEo(Evas_Object *eo) void View::unsetEventCb(Evas_Callback_Type type) { Evas_Object_Event_Cb cb = getCb(type); - if(cb) + if (cb) { evas_object_event_callback_del(m_pEo, type, cb); - } - else - { + } else { MSG_LOG_ERROR("Not implemented"); assert(false); } @@ -105,14 +101,14 @@ Evas_Object *View::setContent(Evas_Object *content, const char *part, bool saveO void View::on_free_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) { View *view = static_cast(data); - if(view) + if (view) view->onViewDestroyed(); } void View::on_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) { View *view = static_cast(data); - if(view) + if (view) view->onBeforeDelete(*view); } @@ -136,7 +132,7 @@ void View::processSignal(Evas_Object *obj) void View::emitSignal(Evas_Object *obj, const char *emission, const char *source, bool async) { elm_object_signal_emit(obj, emission, source); - if(!async) + if (!async) processSignal(obj); } @@ -160,12 +156,12 @@ void *View::getData(Evas_Object *obj) std::string Msg::markupToUtf8(const char *str) { - if(!str) + if (!str) return std::string(); std::string res; char *markup = elm_entry_markup_to_utf8(str); - if(markup) + if (markup) { res = markup; free(markup); @@ -176,12 +172,12 @@ std::string Msg::markupToUtf8(const char *str) std::string Msg::utf8ToMarkup(const char *str) { - if(!str) + if (!str) return std::string(); std::string res; char *markup = elm_entry_utf8_to_markup(str); - if(markup) + if (markup) { res = markup; free(markup); -- 2.7.4