From d75847014086033f019e7f8ceb222994b4b5b4ee Mon Sep 17 00:00:00 2001 From: Oleksander Kostenko Date: Thu, 9 Feb 2017 17:39:51 +0200 Subject: [PATCH] TizenRefApp-8014 Fix code style Change-Id: I1198d868c8a66013c4cd0b9315e35b52fbe091bf Signed-off-by: Oleksander Kostenko --- src/Common/AppControl/inc/AppControlCommand.h | 9 +- src/Common/AppControl/inc/AppControlCompose.h | 12 +- src/Common/AppControl/inc/AppControlDefault.h | 9 +- .../AppControl/inc/AppControlLauncher.h | 9 +- src/Common/AppControl/inc/AppControlParser.h | 6 +- src/Common/AppControl/inc/AppControlUtils.h | 6 +- src/Common/AppControl/inc/ContactEditor.h | 9 +- src/Common/AppControl/inc/ContactViewer.h | 6 +- src/Common/AppControl/inc/FileViewer.h | 6 +- src/Common/AppControl/inc/Share.h | 6 +- src/Common/AppControl/inc/VoiceCall.h | 6 +- .../AppControl/src/AppControlCompose.cpp | 48 ++-- .../AppControl/src/AppControlDefault.cpp | 9 +- .../AppControl/src/AppControlLauncher.cpp | 6 +- .../AppControl/src/AppControlParser.cpp | 9 +- src/Common/AppControl/src/AppControlUtils.cpp | 29 +- src/Common/AppControl/src/ContactEditor.cpp | 9 +- src/Common/AppControl/src/ContactViewer.cpp | 6 +- src/Common/AppControl/src/FileViewer.cpp | 9 +- src/Common/AppControl/src/Share.cpp | 8 +- src/Common/AppControl/src/VoiceCall.cpp | 6 +- src/Common/ContactManager/inc/Contact.h | 6 +- .../ContactManager/inc/ContactAddress.h | 12 +- src/Common/ContactManager/inc/ContactList.h | 6 +- .../ContactManager/inc/ContactManager.h | 9 +- .../ContactManager/inc/ContactMyProfile.h | 6 +- .../inc/ContactMyProfileEmail.h | 6 +- .../inc/ContactMyProfileNumber.h | 6 +- .../ContactManager/inc/ContactPersonEmail.h | 6 +- .../ContactManager/inc/ContactPersonNumber.h | 6 +- .../inc/ContactPersonPhoneLog.h | 6 +- src/Common/ContactManager/inc/ContactRecord.h | 6 +- .../ContactManager/src/ContactManager.cpp | 62 ++--- .../ContactManager/src/ContactRecord.cpp | 3 +- .../src/ContactVCardGenerator.cpp | 12 +- src/Common/Controller/inc/App.h | 9 +- src/Common/Controller/inc/BaseController.h | 6 +- src/Common/Controller/inc/FrameController.h | 6 +- src/Common/Controller/inc/MbeRecipients.h | 9 +- .../Controller/inc/NaviFrameController.h | 6 +- src/Common/Controller/inc/SaveAttachments.h | 6 +- .../Controller/inc/SaveAttachmentsListItem.h | 6 +- src/Common/Controller/inc/ViewController.h | 6 +- .../Controller/inc/ViewItemController.h | 6 +- src/Common/Controller/src/App.cpp | 9 +- src/Common/Controller/src/FrameController.cpp | 12 +- src/Common/Controller/src/MbeRecipients.cpp | 17 +- .../Controller/src/NaviFrameController.cpp | 29 +- src/Common/Controller/src/SaveAttachments.cpp | 30 +- .../src/SaveAttachmentsListItem.cpp | 3 +- src/Common/MsgEngine/inc/MediaType.h | 6 +- src/Common/MsgEngine/inc/Message.h | 18 +- src/Common/MsgEngine/inc/MessageMms.h | 6 +- src/Common/MsgEngine/inc/MessageSMS.h | 6 +- src/Common/MsgEngine/inc/MsgAddress.h | 12 +- src/Common/MsgEngine/inc/MsgAttachment.h | 6 +- src/Common/MsgEngine/inc/MsgComposer.h | 6 +- src/Common/MsgEngine/inc/MsgConvMedia.h | 6 +- .../MsgEngine/inc/MsgConversationItem.h | 6 +- src/Common/MsgEngine/inc/MsgEngine.h | 6 +- src/Common/MsgEngine/inc/MsgList.h | 6 +- src/Common/MsgEngine/inc/MsgMedia.h | 9 +- src/Common/MsgEngine/inc/MsgPage.h | 6 +- src/Common/MsgEngine/inc/MsgReport.h | 15 +- src/Common/MsgEngine/inc/MsgSettings.h | 12 +- src/Common/MsgEngine/inc/MsgStorage.h | 9 +- src/Common/MsgEngine/inc/MsgThreadItem.h | 6 +- src/Common/MsgEngine/inc/MsgTransport.h | 9 +- src/Common/MsgEngine/inc/MsgTypes.h | 15 +- src/Common/MsgEngine/inc/MsgUtils.h | 9 +- src/Common/MsgEngine/src/MsgEngine.cpp | 24 +- src/Common/MsgEngine/src/MsgSettings.cpp | 4 - src/Common/MsgEngine/src/MsgStorage.cpp | 10 +- src/Common/MsgEngine/src/MsgUtils.cpp | 30 +- .../src/private/MessageMmsPrivate.cpp | 25 +- .../MsgEngine/src/private/MessageMmsPrivate.h | 6 +- .../MsgEngine/src/private/MessagePrivate.cpp | 6 +- .../MsgEngine/src/private/MessagePrivate.h | 6 +- .../MsgEngine/src/private/MessageSMSPrivate.h | 6 +- .../MsgEngine/src/private/MsgAddressPrivate.h | 6 +- .../src/private/MsgAttachmentPrivate.cpp | 3 +- .../src/private/MsgAttachmentPrivate.h | 6 +- .../src/private/MsgComposerPrivate.cpp | 6 +- .../src/private/MsgComposerPrivate.h | 6 +- .../src/private/MsgConvMediaPrivate.h | 6 +- .../src/private/MsgConversationItemPrivate.h | 6 +- .../MsgEngine/src/private/MsgDefPrivate.h | 3 +- .../src/private/MsgListHandlePrivate.h | 8 +- .../MsgEngine/src/private/MsgMediaPrivate.cpp | 12 +- .../MsgEngine/src/private/MsgMediaPrivate.h | 6 +- .../MsgEngine/src/private/MsgPagePrivate.h | 6 +- .../MsgEngine/src/private/MsgReportPrivate.h | 6 +- .../src/private/MsgSettingsPrivate.cpp | 13 +- .../src/private/MsgSettingsPrivate.h | 6 +- .../src/private/MsgStoragePrivate.cpp | 54 ++-- .../MsgEngine/src/private/MsgStoragePrivate.h | 6 +- .../src/private/MsgStructListPrivate.h | 8 +- .../MsgEngine/src/private/MsgStructPrivate.h | 8 +- .../src/private/MsgThreadItemPrivate.h | 6 +- .../src/private/MsgTransportPrivate.cpp | 3 +- .../src/private/MsgTransportPrivate.h | 6 +- .../MsgEngine/src/private/MsgUtilsPrivate.cpp | 87 ++---- .../MsgEngine/src/private/MsgUtilsPrivate.h | 6 +- .../inc/SystemSettingsManager.h | 9 +- .../src/SystemSettingsManager.cpp | 19 +- src/Common/Utils/inc/BidirectUtils.h | 6 +- src/Common/Utils/inc/FileUtils.h | 6 +- src/Common/Utils/inc/HwButtonListener.h | 6 +- src/Common/Utils/inc/LangUtils.h | 9 +- src/Common/Utils/inc/LoggerImpl.h | 5 +- src/Common/Utils/inc/MediaUtils.h | 6 +- src/Common/Utils/inc/PathUtils.h | 6 +- src/Common/Utils/inc/PhoneNumberUtils.h | 6 +- src/Common/Utils/inc/TextDecorator.h | 12 +- src/Common/Utils/inc/ThumbnailMaker.h | 9 +- src/Common/Utils/inc/TimeUtils.h | 9 +- src/Common/Utils/inc/VCalendarParser.h | 9 +- src/Common/Utils/src/FileUtils.cpp | 45 +-- src/Common/Utils/src/HwButtonListener.cpp | 3 +- src/Common/Utils/src/LoggerImpl.cpp | 3 +- src/Common/Utils/src/MediaUtils.cpp | 62 ++--- src/Common/Utils/src/PathUtils.cpp | 23 +- src/Common/Utils/src/PhoneNumberUtils.cpp | 3 +- src/Common/Utils/src/TextDecorator.cpp | 12 +- src/Common/Utils/src/ThumbnailMaker.cpp | 29 +- src/Common/Utils/src/TimeUtils.cpp | 18 +- src/Common/Utils/src/VCalendarParser.cpp | 12 +- .../View/inc/AtspiAccessibleInterface.h | 6 +- src/Common/View/inc/BaseView.h | 6 +- src/Common/View/inc/Box.h | 6 +- src/Common/View/inc/ContextPopup.h | 9 +- src/Common/View/inc/DefaultLayout.h | 6 +- src/Common/View/inc/ListItem.h | 9 +- src/Common/View/inc/ListView.h | 21 +- src/Common/View/inc/MbeRecipientViewItem.h | 6 +- src/Common/View/inc/MbeRecipientsView.h | 9 +- src/Common/View/inc/NaviFrameItem.h | 18 +- src/Common/View/inc/NaviFrameView.h | 6 +- src/Common/View/inc/NoContentLayout.h | 6 +- src/Common/View/inc/Popup.h | 9 +- src/Common/View/inc/PopupAttachmentListItem.h | 6 +- src/Common/View/inc/PopupList.h | 9 +- src/Common/View/inc/PopupListItem.h | 12 +- src/Common/View/inc/PopupManager.h | 6 +- src/Common/View/inc/Scroller.h | 6 +- src/Common/View/inc/SelectAllListItem.h | 6 +- src/Common/View/inc/StandardWindow.h | 6 +- src/Common/View/inc/View.h | 6 +- src/Common/View/inc/ViewItem.h | 6 +- src/Common/View/inc/Window.h | 6 +- src/Common/View/src/ContextPopup.cpp | 6 +- src/Common/View/src/DefaultLayout.cpp | 6 +- src/Common/View/src/ListItem.cpp | 8 +- src/Common/View/src/ListView.cpp | 25 +- src/Common/View/src/MbeRecipientsView.cpp | 6 +- src/Common/View/src/NaviFrameItem.cpp | 38 +-- src/Common/View/src/NaviFrameView.cpp | 24 +- src/Common/View/src/Popup.cpp | 18 +- src/Common/View/src/PopupList.cpp | 3 +- src/Common/View/src/PopupManager.cpp | 9 +- src/Common/View/src/SelectAllListItem.cpp | 5 +- src/Common/View/src/View.cpp | 21 +- src/Conversation/AppControl/inc/AttachPanel.h | 9 +- .../AppControl/inc/ContactPicker.h | 15 +- .../AppControl/inc/SettingsNetwork.h | 6 +- .../AppControl/src/AttachPanel.cpp | 12 +- .../AppControl/src/ContactPicker.cpp | 15 +- src/Conversation/Body/Controller/inc/Body.h | 9 +- src/Conversation/Body/Controller/src/Body.cpp | 87 ++---- src/Conversation/Body/View/inc/BodyView.h | 3 +- src/Conversation/Body/View/src/BodyView.cpp | 15 +- .../Controller/inc/ContactListItem.h | 6 +- .../Controller/inc/ConvContactList.h | 9 +- .../Controller/src/ConvContactList.cpp | 15 +- .../View/inc/ContactListViewItem.h | 6 +- .../View/inc/ConvContactListView.h | 6 +- .../View/src/ContactListViewItem.cpp | 14 +- .../Controller/inc/BubbleAudioEntity.h | 6 +- .../ConvList/Controller/inc/BubbleBgEntity.h | 6 +- .../Controller/inc/BubbleCalEventEntity.h | 6 +- .../Controller/inc/BubbleContactEntity.h | 6 +- .../inc/BubbleDownloadButtonEntity.h | 6 +- .../ConvList/Controller/inc/BubbleEntity.h | 9 +- .../Controller/inc/BubbleEntityFactory.h | 6 +- .../Controller/inc/BubbleImageEntity.h | 6 +- .../Controller/inc/BubbleTextEntity.h | 6 +- .../Controller/inc/BubbleUnknownFileEntity.h | 6 +- .../Controller/inc/BubbleVideoEntity.h | 6 +- .../ConvList/Controller/inc/ComposeListItem.h | 9 +- .../ConvList/Controller/inc/ConvList.h | 12 +- .../ConvList/Controller/inc/ConvListItem.h | 9 +- .../ConvList/Controller/inc/DateLineItem.h | 6 +- .../ConvList/Controller/inc/MsgDetailsPopup.h | 6 +- .../Controller/src/BubbleCalEventEntity.cpp | 3 +- .../Controller/src/BubbleContactEntity.cpp | 9 +- .../Controller/src/BubbleEntityFactory.cpp | 8 +- .../Controller/src/ComposeListItem.cpp | 18 +- .../ConvList/Controller/src/ConvList.cpp | 74 ++--- .../ConvList/Controller/src/ConvListItem.cpp | 60 ++-- .../Controller/src/MsgDetailsPopup.cpp | 6 +- .../ConvList/View/inc/BubbleAudioViewItem.h | 6 +- .../ConvList/View/inc/BubbleBgViewItem.h | 9 +- .../View/inc/BubbleCalEventViewItem.h | 6 +- .../ConvList/View/inc/BubbleContactViewItem.h | 6 +- .../View/inc/BubbleDownloadButtonViewItem.h | 6 +- .../View/inc/BubbleIconTextLayoutItem.h | 9 +- .../ConvList/View/inc/BubbleImageViewItem.h | 6 +- .../ConvList/View/inc/BubbleItemContainer.h | 6 +- .../ConvList/View/inc/BubbleTextViewItem.h | 6 +- .../View/inc/BubbleUnknownFileViewItem.h | 6 +- .../ConvList/View/inc/BubbleVideoViewItem.h | 6 +- .../ConvList/View/inc/BubbleViewItem.h | 9 +- .../ConvList/View/inc/ComposeListViewItem.h | 6 +- .../ConvList/View/inc/ConvListLayout.h | 6 +- .../ConvList/View/inc/ConvListViewItem.h | 9 +- .../ConvList/View/inc/ConvSelectAll.h | 6 +- .../ConvList/View/inc/DateLineViewItem.h | 6 +- .../ConvList/View/src/BubbleBgViewItem.cpp | 3 +- .../View/src/BubbleIconTextLayoutItem.cpp | 3 +- .../ConvList/View/src/BubbleImageViewItem.cpp | 3 +- .../ConvList/View/src/BubbleItemContainer.cpp | 3 +- .../ConvList/View/src/BubbleVideoViewItem.cpp | 3 +- .../ConvList/View/src/BubbleViewItem.cpp | 6 +- .../ConvList/View/src/ComposeListViewItem.cpp | 3 +- .../ConvList/View/src/ConvListLayout.cpp | 3 +- .../ConvList/View/src/ConvListViewItem.cpp | 22 +- .../ConvList/View/src/ConvSelectAll.cpp | 3 +- .../ConvList/View/src/DateLineViewItem.cpp | 3 +- .../Main/Controller/inc/Conversation.h | 15 +- .../Controller/inc/PopupRecipientListItem.h | 9 +- .../Main/Controller/src/Conversation.cpp | 256 ++++++------------ .../Main/View/inc/ConversationLayout.h | 6 +- .../Main/View/inc/MessageInputPanel.h | 12 +- .../Main/View/src/MessageInputPanel.cpp | 11 +- .../Controller/inc/ConvRecipientsPanel.h | 9 +- .../Controller/src/ConvRecipientsPanel.cpp | 45 +-- .../View/inc/ConvRecipientsPanelView.h | 9 +- .../View/src/ConvRecipientsPanelView.cpp | 46 +--- .../Utils/inc/AttachmentHandler.h | 9 +- .../Utils/inc/MessageDetailContent.h | 9 +- src/Conversation/Utils/inc/WorkingDir.h | 6 +- .../Utils/src/AttachmentHandler.cpp | 24 +- .../Utils/src/MessageDetailContent.cpp | 85 ++---- src/Conversation/Utils/src/WorkingDir.cpp | 29 +- src/MainApp/MainApp.cpp | 14 +- src/MainApp/MainApp.h | 6 +- .../Controller/inc/BaseThreadListItem.h | 6 +- .../Controller/inc/MsgSearchListItem.h | 6 +- src/MsgThread/Controller/inc/MsgThread.h | 9 +- src/MsgThread/Controller/inc/ThreadList.h | 9 +- src/MsgThread/Controller/inc/ThreadListItem.h | 6 +- .../Controller/inc/ThreadSearchList.h | 9 +- .../Controller/inc/ThreadSearchListItem.h | 6 +- .../Controller/src/BaseThreadListItem.cpp | 6 +- src/MsgThread/Controller/src/MsgThread.cpp | 38 +-- src/MsgThread/Controller/src/ThreadList.cpp | 51 ++-- .../Controller/src/ThreadListItem.cpp | 6 +- .../Controller/src/ThreadSearchList.cpp | 27 +- src/MsgThread/View/inc/FloatingButton.h | 9 +- src/MsgThread/View/inc/MsgThreadLayout.h | 6 +- src/MsgThread/View/inc/MsgThreadSearchPanel.h | 9 +- src/MsgThread/View/inc/ThreadListViewItem.h | 9 +- src/MsgThread/View/src/FloatingButton.cpp | 2 - .../View/src/MsgThreadSearchPanel.cpp | 9 +- src/MsgThread/View/src/ThreadListViewItem.cpp | 17 +- src/Settings/Controller/inc/MsgOnSimCard.h | 9 +- src/Settings/Controller/inc/Settings.h | 6 +- .../Controller/inc/SettingsListItem.h | 6 +- src/Settings/Controller/inc/SettingsSound.h | 6 +- src/Settings/Controller/inc/SimListViewItem.h | 6 +- src/Settings/Controller/src/MsgOnSimCard.cpp | 59 ++-- src/Settings/Controller/src/Settings.cpp | 6 +- src/Settings/Controller/src/SettingsSound.cpp | 3 +- .../Controller/src/SimListViewItem.cpp | 5 +- .../View/inc/SettingsGroupListViewItem.h | 6 +- src/Settings/View/inc/SettingsListViewItem.h | 9 +- src/Settings/View/inc/SimMsgLayout.h | 6 +- .../View/src/SettingsGroupListViewItem.cpp | 3 +- .../View/src/SettingsListViewItem.cpp | 12 +- src/Viewer/Controller/inc/SmilPage.h | 6 +- src/Viewer/Controller/inc/SmilPlayer.h | 12 +- src/Viewer/Controller/inc/Viewer.h | 6 +- src/Viewer/Controller/src/SmilPage.cpp | 35 +-- src/Viewer/Controller/src/SmilPlayer.cpp | 61 ++--- src/Viewer/Controller/src/Viewer.cpp | 41 +-- src/Viewer/Utils/inc/MediaPlayer.h | 9 +- src/Viewer/Utils/src/MediaPlayer.cpp | 21 +- src/Viewer/View/inc/PlayerControl.h | 12 +- src/Viewer/View/inc/SmilAttachmentItemView.h | 18 +- src/Viewer/View/inc/SmilAudioItemView.h | 6 +- src/Viewer/View/inc/SmilImageItemView.h | 6 +- src/Viewer/View/inc/SmilPageLayout.h | 6 +- src/Viewer/View/inc/SmilPlayerView.h | 6 +- src/Viewer/View/inc/SmilTextItemView.h | 6 +- src/Viewer/View/inc/SmilVideoItemView.h | 6 +- src/Viewer/View/inc/SubjectLayout.h | 6 +- src/Viewer/View/inc/ViewerLayout.h | 9 +- src/Viewer/View/src/PlayerControl.cpp | 3 +- .../View/src/SmilAttachmentItemView.cpp | 3 +- src/Viewer/View/src/SmilImageItemView.cpp | 3 +- src/Viewer/View/src/SmilPlayerView.cpp | 6 +- src/Viewer/View/src/SmilTextItemView.cpp | 3 +- src/Viewer/View/src/SmilVideoItemView.cpp | 12 +- src/Viewer/View/src/SubjectLayout.cpp | 3 +- src/Viewer/View/src/ViewerLayout.cpp | 3 +- test/TC/ContactUtils.cpp | 18 +- test/TC/ContactUtils.h | 3 +- test/TC/TestAppControlUtils.cpp | 9 +- test/TC/TestContactManager.cpp | 3 +- test/TC/TestMessageSender.cpp | 3 +- test/TC/TestTimeUtils.cpp | 3 +- test/TC/main.cpp | 3 +- 312 files changed, 1207 insertions(+), 2601 deletions(-) diff --git a/src/Common/AppControl/inc/AppControlCommand.h b/src/Common/AppControl/inc/AppControlCommand.h index fcd7efad..dce36c54 100644 --- a/src/Common/AppControl/inc/AppControlCommand.h +++ b/src/Common/AppControl/inc/AppControlCommand.h @@ -21,16 +21,13 @@ #include #include -namespace Msg -{ +namespace Msg { class AppControlCommand; typedef std::shared_ptr AppControlCommandRef; - class AppControlCommand - { + class AppControlCommand { public: - enum OperationType - { + enum OperationType { OpUnknown, OpDefault, OpComposeFamily /** For operations Compose, Share, MultiShare and ShareText */ diff --git a/src/Common/AppControl/inc/AppControlCompose.h b/src/Common/AppControl/inc/AppControlCompose.h index 1bc5e4e4..31d44c60 100644 --- a/src/Common/AppControl/inc/AppControlCompose.h +++ b/src/Common/AppControl/inc/AppControlCompose.h @@ -22,26 +22,22 @@ #include #include -namespace Msg -{ +namespace Msg { class AppControlCompose; typedef std::shared_ptr AppControlComposeRef; - struct VcfInfo - { + struct VcfInfo { std::list contactsIdList; bool isMyProfile; }; class AppControlCompose - : public AppControlCommand - { + : public AppControlCommand { public: typedef std::list RecipientList; typedef std::list FileList; - enum OpComposeType - { + enum OpComposeType { OpUnknown, OpCompose, /** APP_CONTROL_OPERATION_COMPOSE */ OpShare, /** APP_CONTROL_OPERATION_SHARE */ diff --git a/src/Common/AppControl/inc/AppControlDefault.h b/src/Common/AppControl/inc/AppControlDefault.h index b10340d0..e7e9886e 100644 --- a/src/Common/AppControl/inc/AppControlDefault.h +++ b/src/Common/AppControl/inc/AppControlDefault.h @@ -22,17 +22,14 @@ #include "Logger.h" #include -namespace Msg -{ +namespace Msg { class AppControlDefault; typedef std::shared_ptr AppControlDefaultRef; class AppControlDefault - : public AppControlCommand - { + : public AppControlCommand { public: - enum DefaultType - { + enum DefaultType { UnknownType, MainType, //Type from home screen ReplyType, //Type for reply message button clicked from Active Notification diff --git a/src/Common/AppControl/inc/AppControlLauncher.h b/src/Common/AppControl/inc/AppControlLauncher.h index a87f5a7d..a1ae4443 100644 --- a/src/Common/AppControl/inc/AppControlLauncher.h +++ b/src/Common/AppControl/inc/AppControlLauncher.h @@ -21,11 +21,9 @@ #include -namespace Msg -{ +namespace Msg { class AppControlLauncher; - class AppControlHandle - { + class AppControlHandle { friend class AppControlLauncher; public: @@ -52,8 +50,7 @@ namespace Msg app_control_h m_Handle; }; - class AppControlLauncher - { + class AppControlLauncher { friend class AppControlHandle; public: diff --git a/src/Common/AppControl/inc/AppControlParser.h b/src/Common/AppControl/inc/AppControlParser.h index 980e7317..0e5e27f2 100644 --- a/src/Common/AppControl/inc/AppControlParser.h +++ b/src/Common/AppControl/inc/AppControlParser.h @@ -20,10 +20,8 @@ #include "AppControlCommand.h" #include -namespace Msg -{ - class AppControlParser - { +namespace Msg { + class AppControlParser { public: static AppControlCommandRef parse(app_control_h handle); }; diff --git a/src/Common/AppControl/inc/AppControlUtils.h b/src/Common/AppControl/inc/AppControlUtils.h index d2c9f3cc..12ae9d3a 100644 --- a/src/Common/AppControl/inc/AppControlUtils.h +++ b/src/Common/AppControl/inc/AppControlUtils.h @@ -26,10 +26,8 @@ return static_cast(data)->method(request, reply, result);\ } -namespace Msg -{ - struct AppControlUtils - { +namespace Msg { + struct AppControlUtils { /** *@brief Gets a single string from given app-control handle by a key specified */ diff --git a/src/Common/AppControl/inc/ContactEditor.h b/src/Common/AppControl/inc/ContactEditor.h index 51e7612f..c874ca8b 100644 --- a/src/Common/AppControl/inc/ContactEditor.h +++ b/src/Common/AppControl/inc/ContactEditor.h @@ -21,19 +21,16 @@ #include -namespace Msg -{ +namespace Msg { class IContactEditorListener; /** *@brief An utility-class aimed to launch contacts-application with add-operation and edit-operation passed via app-control. */ class ContactEditor - : public AppControlHandle - { + : public AppControlHandle { public: - enum Operation - { + enum Operation { EditOp, CreateOp }; diff --git a/src/Common/AppControl/inc/ContactViewer.h b/src/Common/AppControl/inc/ContactViewer.h index 08947ba9..83d166fc 100644 --- a/src/Common/AppControl/inc/ContactViewer.h +++ b/src/Common/AppControl/inc/ContactViewer.h @@ -20,14 +20,12 @@ #include "AppControlLauncher.h" #include "ContactAddress.h" -namespace Msg -{ +namespace Msg { /** *@brief An utility-class aimed to launch contacts-application with view-operation passed via app-control. */ class ContactViewer - : public AppControlHandle - { + : public AppControlHandle { public: ContactViewer(); virtual ~ContactViewer(); diff --git a/src/Common/AppControl/inc/FileViewer.h b/src/Common/AppControl/inc/FileViewer.h index 868502fc..1b01b253 100644 --- a/src/Common/AppControl/inc/FileViewer.h +++ b/src/Common/AppControl/inc/FileViewer.h @@ -19,11 +19,9 @@ #include "AppControlLauncher.h" -namespace Msg -{ +namespace Msg { class FileViewer - : public AppControlHandle - { + : public AppControlHandle { public: FileViewer(); virtual ~FileViewer(); diff --git a/src/Common/AppControl/inc/Share.h b/src/Common/AppControl/inc/Share.h index 2f086125..ca972b19 100644 --- a/src/Common/AppControl/inc/Share.h +++ b/src/Common/AppControl/inc/Share.h @@ -22,11 +22,9 @@ #include #include -namespace Msg -{ +namespace Msg { class Share - : public AppControlHandle - { + : public AppControlHandle { public: Share(); virtual ~Share(); diff --git a/src/Common/AppControl/inc/VoiceCall.h b/src/Common/AppControl/inc/VoiceCall.h index 7bef3dea..8a6877b0 100644 --- a/src/Common/AppControl/inc/VoiceCall.h +++ b/src/Common/AppControl/inc/VoiceCall.h @@ -20,13 +20,11 @@ #include "AppControlUtils.h" #include -namespace Msg -{ +namespace Msg { /** * @brief An utility-class aimed to make voice call passed via app-control. */ - class VoiceCall - { + class VoiceCall { public: VoiceCall(); diff --git a/src/Common/AppControl/src/AppControlCompose.cpp b/src/Common/AppControl/src/AppControlCompose.cpp index 7f68dee9..54803cce 100644 --- a/src/Common/AppControl/src/AppControlCompose.cpp +++ b/src/Common/AppControl/src/AppControlCompose.cpp @@ -23,8 +23,7 @@ using namespace Msg; -namespace -{ +namespace { const std::string mimeContact = "application/vnd.tizen.contact"; const std::string myProfileDataType = "my_profile"; @@ -52,10 +51,8 @@ AppControlCompose::AppControlCompose(const std::string &opMsg, app_control_h han { MSG_LOG("ComposeType: ", m_ComposeType); - if (handle) - { - switch (m_ComposeType) - { + if (handle) { + switch (m_ComposeType) { case OpCompose: createComposeOp(handle); break; @@ -83,9 +80,8 @@ void AppControlCompose::createComposeOp(app_control_h handle) { parseUriCompose(handle); if (m_RecipientList.empty()) - { AppControlUtils::getExtraDataArray(handle, APP_CONTROL_DATA_TO, m_RecipientList); - } + m_MessageText = AppControlUtils::getExtraData(handle, APP_CONTROL_DATA_TEXT); m_Subject = AppControlUtils::getExtraData(handle, APP_CONTROL_DATA_SUBJECT); AppControlUtils::getExtraDataArray(handle, APP_CONTROL_DATA_PATH, m_FileList); @@ -95,19 +91,16 @@ 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); m_VcfInfo.contactsIdList.push_back(atoi(idStr.c_str())); } } - if (m_FileList.empty()) - { + if (m_FileList.empty()) { std::string path = AppControlUtils::getExtraData(handle, APP_CONTROL_DATA_PATH); if (!path.empty()) m_FileList.push_back(std::move(path)); @@ -116,8 +109,7 @@ void AppControlCompose::createShareOp(app_control_h handle) 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) @@ -174,10 +166,8 @@ bool AppControlCompose::parseUriCompose(app_control_h handle) bool res = false; char *uri = nullptr; - if (APP_CONTROL_ERROR_NONE == app_control_get_uri(handle, &uri)) - { - if (uri) - { + if (APP_CONTROL_ERROR_NONE == app_control_get_uri(handle, &uri)) { + if (uri) { MSG_LOG("uri = ", uri); std::string uriToParse(uri); std::istringstream is(uriToParse); @@ -186,11 +176,9 @@ bool AppControlCompose::parseUriCompose(app_control_h handle) std::getline(is, cur, ':'); MSG_LOG("cur = ", cur.c_str()); - if (cur == "sms" || cur == "mmsto") - { + if (cur == "sms" || cur == "mmsto") { m_isMms = (cur == "mmsto"); - for (; std::getline(is, cur, ',');) - { + for (; std::getline(is, cur, ',');) { m_RecipientList.push_back(cur); } res = true; @@ -208,10 +196,8 @@ bool AppControlCompose::parseUriShare(app_control_h handle) bool res = false; char *uri = nullptr; - if (APP_CONTROL_ERROR_NONE == app_control_get_uri(handle, &uri)) - { - if (uri) - { + if (APP_CONTROL_ERROR_NONE == app_control_get_uri(handle, &uri)) { + if (uri) { MSG_LOG("uri = ", uri); std::string uriToParse(uri); std::istringstream is(uriToParse); @@ -220,11 +206,9 @@ bool AppControlCompose::parseUriShare(app_control_h handle) std::getline(is, cur, ':'); MSG_LOG("cur = ", cur.c_str()); - if (cur == "sms" || cur == "mmsto" || cur == "file") - { + 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())); } diff --git a/src/Common/AppControl/src/AppControlDefault.cpp b/src/Common/AppControl/src/AppControlDefault.cpp index 429cb7ce..8c0519d6 100644 --- a/src/Common/AppControl/src/AppControlDefault.cpp +++ b/src/Common/AppControl/src/AppControlDefault.cpp @@ -19,8 +19,7 @@ using namespace Msg; -namespace -{ +namespace { const char *notificationPanel = "http://tizen.org/appcontrol/data/notification"; const char *keyType = "type"; const char *valueNewMsg = "new_msg"; @@ -59,8 +58,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; } @@ -87,8 +85,7 @@ 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; } diff --git a/src/Common/AppControl/src/AppControlLauncher.cpp b/src/Common/AppControl/src/AppControlLauncher.cpp index 26313d62..0638be6f 100644 --- a/src/Common/AppControl/src/AppControlLauncher.cpp +++ b/src/Common/AppControl/src/AppControlLauncher.cpp @@ -29,8 +29,7 @@ AppControlHandle::AppControlHandle(app_control_launch_mode_e launchMode) AppControlHandle::~AppControlHandle() { - if (m_Handle) - { + if (m_Handle) { terminate(); app_control_destroy(m_Handle); } @@ -103,8 +102,7 @@ void AppControlLauncher::onReply(app_control_h request, app_control_h reply, app if (m_pHandle) m_pHandle->onReply(request, reply, result); - if (m_LaunchInProgress) - { + if (m_LaunchInProgress) { m_pTimer = ecore_timer_add(1.2, // Extra time for application startup. [](void *data)->Eina_Bool { diff --git a/src/Common/AppControl/src/AppControlParser.cpp b/src/Common/AppControl/src/AppControlParser.cpp index 0c4604b8..6dff899b 100644 --- a/src/Common/AppControl/src/AppControlParser.cpp +++ b/src/Common/AppControl/src/AppControlParser.cpp @@ -27,8 +27,7 @@ using namespace Msg; -namespace -{ +namespace { typedef std::unordered_map OperationMap; const OperationMap operationMap = @@ -55,16 +54,14 @@ 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; } AppControlCommand::OperationType opType = getOperation(opStr); - switch (opType) - { + switch (opType) { case AppControlCommand::OpDefault: cmd = std::make_shared(opStr, handle); break; diff --git a/src/Common/AppControl/src/AppControlUtils.cpp b/src/Common/AppControl/src/AppControlUtils.cpp index 54a0ca2c..e047d906 100644 --- a/src/Common/AppControl/src/AppControlUtils.cpp +++ b/src/Common/AppControl/src/AppControlUtils.cpp @@ -22,10 +22,8 @@ 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 (val) - { + if (APP_CONTROL_ERROR_NONE == app_control_get_extra_data(handle, key.c_str(), &val)) { + if (val) { res = val; free(val); } @@ -37,10 +35,8 @@ 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)) - { - for (int i = 0; i < arrayLength; ++i) - { + if (APP_CONTROL_ERROR_NONE == app_control_get_extra_data_array(handle, key.c_str(), &pArrayVal, &arrayLength)) { + for (int i = 0; i < arrayLength; ++i) { outArray.push_back(pArrayVal[i]); free(pArrayVal[i]); } @@ -52,8 +48,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); } @@ -65,20 +60,15 @@ 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) - && pArrayVal) - { + && pArrayVal) { std::string::size_type sz; - for (int i = 0; i < arrayLength; ++i) - { - if (pArrayVal[i]) - { + for (int i = 0; i < arrayLength; ++i) { + if (pArrayVal[i]) { std::string s(pArrayVal[i] ? pArrayVal[i] : ""); free(pArrayVal[i]); int parsed = std::stoi(s, &sz); if (sz == s.length()) - { outArray.push_back(parsed); - } } } free(pArrayVal); @@ -90,8 +80,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 374bb022..acd7fbe5 100644 --- a/src/Common/AppControl/src/ContactEditor.cpp +++ b/src/Common/AppControl/src/ContactEditor.cpp @@ -21,8 +21,7 @@ using namespace Msg; -namespace -{ +namespace { const char* mimeContact = "application/vnd.tizen.contact"; } @@ -39,16 +38,14 @@ ContactEditor::~ContactEditor() 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) op = APP_CONTROL_OPERATION_EDIT; else if (operation == CreateOp) op = APP_CONTROL_OPERATION_ADD; - if (op) - { + if (op) { if (MsgUtils::isValidNumber(address)) res = launch(address, op, APP_CONTROL_DATA_PHONE); else if (MsgUtils::isValidEmail(address)) diff --git a/src/Common/AppControl/src/ContactViewer.cpp b/src/Common/AppControl/src/ContactViewer.cpp index 40d41f29..26cfd57f 100644 --- a/src/Common/AppControl/src/ContactViewer.cpp +++ b/src/Common/AppControl/src/ContactViewer.cpp @@ -22,8 +22,7 @@ using namespace Msg; -namespace -{ +namespace { const char *mimeContact = "application/vnd.tizen.contact"; const char *personContactTypeStr = "person"; const char *myProfileTypeStr = "my_profile"; @@ -53,8 +52,7 @@ bool ContactViewer::launch(const ContactAddress &address) const char *ContactViewer::toStr(ContactAddress::OwnerType type) { - switch (type) - { + switch (type) { case ContactAddress::PersonType: return personContactTypeStr; case ContactAddress::MyProfileType: diff --git a/src/Common/AppControl/src/FileViewer.cpp b/src/Common/AppControl/src/FileViewer.cpp index a24f2a26..582f0d0b 100644 --- a/src/Common/AppControl/src/FileViewer.cpp +++ b/src/Common/AppControl/src/FileViewer.cpp @@ -46,8 +46,7 @@ bool FileViewer::launch(const std::string &file) if (mime.empty() || file.empty()) return false; - if (m_Handle) - { + if (m_Handle) { app_control_set_mime(m_Handle, mime.c_str()); std::string uri = "file://" + file; app_control_set_uri(m_Handle, uri.c_str()); @@ -61,15 +60,13 @@ bool FileViewer::launchWithCopy(const std::string &file) { bool res = false; - if (!AppControlLauncher::getInst().isLaunchInProgress()) - { + if (!AppControlLauncher::getInst().isLaunchInProgress()) { // Remove previous file (correct only for APP_CONTROL_LAUNCH_MODE_GROUP) if (!m_FilePath.empty()) FileUtils::remove(m_FilePath); m_FilePath = FileUtils::addFileToDataDir(file); - if (!m_FilePath.empty()) - { + if (!m_FilePath.empty()) { FileUtils::saveFileToStorage(m_FilePath); res = launch(m_FilePath); } diff --git a/src/Common/AppControl/src/Share.cpp b/src/Common/AppControl/src/Share.cpp index 4385add9..7ee75210 100644 --- a/src/Common/AppControl/src/Share.cpp +++ b/src/Common/AppControl/src/Share.cpp @@ -36,9 +36,8 @@ Share::~Share() void Share::removeFiles() { for (auto &&file : m_FileList) - { FileUtils::remove(file); - } + m_FileList.clear(); } @@ -46,9 +45,7 @@ void Share::addFiles(const std::list &files) { removeFiles(); for (auto &&file : files) - { m_FileList.push_back(FileUtils::addFileToDataDir(file)); - } } bool Share::launch(const std::list &files) @@ -58,8 +55,7 @@ bool Share::launch(const std::list &files) addFiles(files); std::vector nativePaths; - for (const std::string &file : m_FileList) - { + for (const std::string &file : m_FileList) { if (!file.empty()) nativePaths.push_back(file.c_str()); } diff --git a/src/Common/AppControl/src/VoiceCall.cpp b/src/Common/AppControl/src/VoiceCall.cpp index 9ef2813e..86e026a3 100644 --- a/src/Common/AppControl/src/VoiceCall.cpp +++ b/src/Common/AppControl/src/VoiceCall.cpp @@ -20,8 +20,7 @@ using namespace Msg; -namespace -{ +namespace { const std::string tel = "tel:"; } @@ -34,8 +33,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 7fe7c9a7..65f8efd8 100644 --- a/src/Common/ContactManager/inc/Contact.h +++ b/src/Common/ContactManager/inc/Contact.h @@ -23,14 +23,12 @@ #include #include -namespace Msg -{ +namespace Msg { class Contact; typedef std::shared_ptr ContactRef; class Contact - : public ContactRecord - { + : public ContactRecord { public: Contact(bool release, contacts_record_h record = nullptr); diff --git a/src/Common/ContactManager/inc/ContactAddress.h b/src/Common/ContactManager/inc/ContactAddress.h index 14e6827c..f0ff88e7 100644 --- a/src/Common/ContactManager/inc/ContactAddress.h +++ b/src/Common/ContactManager/inc/ContactAddress.h @@ -19,22 +19,18 @@ #include "MsgUtils.h" -namespace Msg -{ +namespace Msg { class ContactAddress; typedef std::shared_ptr ContactAddressRef; - class ContactAddress - { + class ContactAddress { public: - enum AddressType - { + enum AddressType { EmailType, NumberType }; - enum OwnerType - { + enum OwnerType { PersonType, MyProfileType }; diff --git a/src/Common/ContactManager/inc/ContactList.h b/src/Common/ContactManager/inc/ContactList.h index e06fbd6e..5a2dc8b5 100644 --- a/src/Common/ContactManager/inc/ContactList.h +++ b/src/Common/ContactManager/inc/ContactList.h @@ -19,13 +19,11 @@ #include -namespace Msg -{ +namespace Msg { class ContactManager; template - class ContactList - { + class ContactList { friend class ContactManager; public: diff --git a/src/Common/ContactManager/inc/ContactManager.h b/src/Common/ContactManager/inc/ContactManager.h index 614a3238..daf1b338 100644 --- a/src/Common/ContactManager/inc/ContactManager.h +++ b/src/Common/ContactManager/inc/ContactManager.h @@ -33,8 +33,7 @@ #include "ContactMyProfileEmail.h" #include "Contact.h" -namespace Msg -{ +namespace Msg { /* *@brief A listener to be notified after contact-information will be changed in contacts-db */ @@ -43,8 +42,7 @@ namespace Msg *@brief Class that work with contacts database. *@brief Search contacts, add listeners, register callback on changes in database. */ - class ContactManager - { + class ContactManager { public: ContactManager(); ~ContactManager(); @@ -187,8 +185,7 @@ namespace Msg ContactMyProfileRef m_OwnerProfile; }; - class IContactManagerListener - { + class IContactManagerListener { public: virtual ~IContactManagerListener() {} /* diff --git a/src/Common/ContactManager/inc/ContactMyProfile.h b/src/Common/ContactManager/inc/ContactMyProfile.h index e8282255..ce183e87 100644 --- a/src/Common/ContactManager/inc/ContactMyProfile.h +++ b/src/Common/ContactManager/inc/ContactMyProfile.h @@ -19,14 +19,12 @@ #include "ContactRecord.h" -namespace Msg -{ +namespace Msg { class ContactMyProfile; typedef std::shared_ptr ContactMyProfileRef; class ContactMyProfile - : public ContactRecord - { + : public ContactRecord { public: ContactMyProfile(bool release, contacts_record_h record = nullptr); int getId() const; diff --git a/src/Common/ContactManager/inc/ContactMyProfileEmail.h b/src/Common/ContactManager/inc/ContactMyProfileEmail.h index 42782947..7b1063ee 100644 --- a/src/Common/ContactManager/inc/ContactMyProfileEmail.h +++ b/src/Common/ContactManager/inc/ContactMyProfileEmail.h @@ -21,15 +21,13 @@ #include "ContactRecord.h" #include "ContactMyProfile.h" -namespace Msg -{ +namespace Msg { class ContactMyProfileEmail; typedef std::shared_ptr ContactMyProfileEmailRef; class ContactMyProfileEmail : public ContactAddress - , public ContactRecord - { + , public ContactRecord { public: ContactMyProfileEmail(bool release, const ContactMyProfile &myProfile, contacts_record_h record = nullptr); static const char *getUri(); diff --git a/src/Common/ContactManager/inc/ContactMyProfileNumber.h b/src/Common/ContactManager/inc/ContactMyProfileNumber.h index 7d63aea7..31fbc081 100644 --- a/src/Common/ContactManager/inc/ContactMyProfileNumber.h +++ b/src/Common/ContactManager/inc/ContactMyProfileNumber.h @@ -21,15 +21,13 @@ #include "ContactRecord.h" #include "ContactMyProfile.h" -namespace Msg -{ +namespace Msg { class ContactMyProfileNumber; typedef std::shared_ptr ContactMyProfileNumberRef; class ContactMyProfileNumber : public ContactAddress - , public ContactRecord - { + , public ContactRecord { public: ContactMyProfileNumber(bool release, const ContactMyProfile &myProfile, contacts_record_h record = nullptr); static const char *getUri(); diff --git a/src/Common/ContactManager/inc/ContactPersonEmail.h b/src/Common/ContactManager/inc/ContactPersonEmail.h index fd031643..692e3172 100644 --- a/src/Common/ContactManager/inc/ContactPersonEmail.h +++ b/src/Common/ContactManager/inc/ContactPersonEmail.h @@ -20,15 +20,13 @@ #include "ContactAddress.h" #include "ContactRecord.h" -namespace Msg -{ +namespace Msg { class ContactPersonEmail; typedef std::shared_ptr ContactPersonEmailRef; class ContactPersonEmail : public ContactAddress - , public ContactRecord - { + , public ContactRecord { public: ContactPersonEmail(bool release, contacts_record_h record = nullptr); static const char *getUri(); diff --git a/src/Common/ContactManager/inc/ContactPersonNumber.h b/src/Common/ContactManager/inc/ContactPersonNumber.h index fa842047..ec19f2f1 100644 --- a/src/Common/ContactManager/inc/ContactPersonNumber.h +++ b/src/Common/ContactManager/inc/ContactPersonNumber.h @@ -20,15 +20,13 @@ #include "ContactAddress.h" #include "ContactRecord.h" -namespace Msg -{ +namespace Msg { class ContactPersonNumber; typedef std::shared_ptr ContactPersonNumberRef; class ContactPersonNumber : public ContactAddress - , public ContactRecord - { + , public ContactRecord { public: ContactPersonNumber(bool release, contacts_record_h record = nullptr); static const char *getUri(); diff --git a/src/Common/ContactManager/inc/ContactPersonPhoneLog.h b/src/Common/ContactManager/inc/ContactPersonPhoneLog.h index fc31eb8f..4f7d3062 100644 --- a/src/Common/ContactManager/inc/ContactPersonPhoneLog.h +++ b/src/Common/ContactManager/inc/ContactPersonPhoneLog.h @@ -19,14 +19,12 @@ #include "ContactRecord.h" -namespace Msg -{ +namespace Msg { class ContactPersonPhoneLog; typedef std::shared_ptr ContactPersonPhoneLogRef; class ContactPersonPhoneLog - : public ContactRecord - { + : public ContactRecord { public: ContactPersonPhoneLog(bool release, contacts_record_h record = nullptr); static const char *getUri(); diff --git a/src/Common/ContactManager/inc/ContactRecord.h b/src/Common/ContactManager/inc/ContactRecord.h index 3aa68049..c8bcaf04 100644 --- a/src/Common/ContactManager/inc/ContactRecord.h +++ b/src/Common/ContactManager/inc/ContactRecord.h @@ -21,13 +21,11 @@ #include #include -namespace Msg -{ +namespace Msg { class ContactRecord; typedef std::shared_ptr ContactRecordRef; - class ContactRecord - { + class ContactRecord { public: ContactRecord(bool release, contacts_record_h record = nullptr); virtual ~ContactRecord(); diff --git a/src/Common/ContactManager/src/ContactManager.cpp b/src/Common/ContactManager/src/ContactManager.cpp index 5c0befdb..4d89b7cc 100644 --- a/src/Common/ContactManager/src/ContactManager.cpp +++ b/src/Common/ContactManager/src/ContactManager.cpp @@ -22,8 +22,7 @@ #include #include - namespace Msg - { + namespace Msg { const int mapReservSize = 512; ContactManager::ContactManager() @@ -31,8 +30,7 @@ MSG_LOG(""); m_AddressMap.reserve(mapReservSize); int error = contacts_connect(); - if (error != 0) - { + if (error != 0) { MSG_LOG_ERROR(whatError(error)); } @@ -55,8 +53,7 @@ std::string ContactManager::whatError(int error) { - switch (error) - { + switch (error) { case CONTACTS_ERROR_NONE: return "CONTACTS_ERROR_NONE"; case CONTACTS_ERROR_OUT_OF_MEMORY: @@ -103,8 +100,7 @@ contacts_query_set_filter(query, filter); /* set projection */ - unsigned int numberProjection[] = - { + unsigned int numberProjection[] = { _contacts_person_phone_log.person_id, _contacts_person_phone_log.address, _contacts_person_phone_log.display_name @@ -182,19 +178,15 @@ 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) @@ -217,18 +209,14 @@ 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 (strcasecmp(email.c_str(), curEmail) == 0) - { + if (curEmail) { + if (strcasecmp(email.c_str(), curEmail) == 0) { contacts_record_h clonedRec = nullptr; contacts_record_clone(child, &clonedRec); if (clonedRec) @@ -268,9 +256,7 @@ ContactManager *self = static_cast(user_data); self->invalidateCache(); for (auto listener : self->m_Listeners) - { listener->onContactChanged(); - } } void ContactManager::contactDisplayOrderChangedCb(contacts_name_display_order_e name_display_order, void *user_data) @@ -278,27 +264,21 @@ ContactManager *self = static_cast(user_data); self->invalidateCache(); for (auto listener : self->m_Listeners) - { listener->onContactChanged(); - } } void ContactManager::addListener(IContactManagerListener &listener) { auto found = std::find(m_Listeners.begin(), m_Listeners.end(), &listener); if (found == m_Listeners.end()) - { m_Listeners.push_back(&listener); - } } void ContactManager::removeListener(IContactManagerListener &listener) { auto found = std::find(m_Listeners.begin(), m_Listeners.end(), &listener); if (found != m_Listeners.end()) - { m_Listeners.erase(found); - } } ContactPersonNumberRef ContactManager::getContactPersonNumber(contacts_filter_h filter) @@ -326,13 +306,11 @@ 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) cResValue = crValue; @@ -371,13 +349,11 @@ 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) cResValue = crValue; @@ -394,8 +370,7 @@ 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: @@ -407,8 +382,7 @@ // MyProfile: #if (0) - if (!contactAddress) - { + if (!contactAddress) { if (isNumber) contactAddress = getContactMyProfileNumber(address); else diff --git a/src/Common/ContactManager/src/ContactRecord.cpp b/src/Common/ContactManager/src/ContactRecord.cpp index 8645af74..ee35b39f 100644 --- a/src/Common/ContactManager/src/ContactRecord.cpp +++ b/src/Common/ContactManager/src/ContactRecord.cpp @@ -26,8 +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 aa0630bb..d07ed358 100644 --- a/src/Common/ContactManager/src/ContactVCardGenerator.cpp +++ b/src/Common/ContactManager/src/ContactVCardGenerator.cpp @@ -23,8 +23,7 @@ using namespace Msg; -namespace -{ +namespace { const int avgLengthOfContent = 2048; } @@ -33,8 +32,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; return std::string(); @@ -63,8 +61,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,8 +74,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; return std::string(); diff --git a/src/Common/Controller/inc/App.h b/src/Common/Controller/inc/App.h index 1cd0f9b6..3ddae32f 100644 --- a/src/Common/Controller/inc/App.h +++ b/src/Common/Controller/inc/App.h @@ -25,14 +25,12 @@ #include "SystemSettingsManager.h" #include -namespace Msg -{ +namespace Msg { class MsgEngine; class ContactManager; class IAppListener; - class App - { + class App { public: App(); virtual ~App(); @@ -80,8 +78,7 @@ namespace Msg bool m_IsPause; }; - class IAppListener - { + class IAppListener { public: virtual ~IAppListener() {} virtual void onAppPause() {}; diff --git a/src/Common/Controller/inc/BaseController.h b/src/Common/Controller/inc/BaseController.h index 98a063e8..f245a9b8 100644 --- a/src/Common/Controller/inc/BaseController.h +++ b/src/Common/Controller/inc/BaseController.h @@ -19,13 +19,11 @@ #include "BaseView.h" -namespace Msg -{ +namespace Msg { class App; class MsgEngine; - class BaseController - { + class BaseController { public: BaseController(App &app); BaseController(BaseController *parent); diff --git a/src/Common/Controller/inc/FrameController.h b/src/Common/Controller/inc/FrameController.h index d6611fe6..926db51c 100644 --- a/src/Common/Controller/inc/FrameController.h +++ b/src/Common/Controller/inc/FrameController.h @@ -22,14 +22,12 @@ #include "NaviFrameController.h" #include "MsgAddress.h" -namespace Msg -{ +namespace Msg { class NaviFrameController; class FrameController : public ViewItemController - , public NaviFrameItem - { + , public NaviFrameItem { public: FrameController(NaviFrameController &parent); virtual ~FrameController(); diff --git a/src/Common/Controller/inc/MbeRecipients.h b/src/Common/Controller/inc/MbeRecipients.h index 2892a493..8746ff94 100644 --- a/src/Common/Controller/inc/MbeRecipients.h +++ b/src/Common/Controller/inc/MbeRecipients.h @@ -23,15 +23,12 @@ #include "MsgTypes.h" #include "App.h" -namespace Msg -{ +namespace Msg { class MbeRecipients : public MbeRecipientsView - , private IContactManagerListener - { + , private IContactManagerListener { public: - enum AppendItemStatus - { + enum AppendItemStatus { SuccessStatus, DuplicatedStatus, InvalidRecipStatus, diff --git a/src/Common/Controller/inc/NaviFrameController.h b/src/Common/Controller/inc/NaviFrameController.h index aebdadc7..6556c818 100644 --- a/src/Common/Controller/inc/NaviFrameController.h +++ b/src/Common/Controller/inc/NaviFrameController.h @@ -25,16 +25,14 @@ #include "AppControlDefault.h" #include "App.h" -namespace Msg -{ +namespace Msg { class FrameController; class NaviFrameController : public ViewController , public NaviFrameView , private IHwButtonListener - , private IAppListener - { + , private IAppListener { public: NaviFrameController(App &app); virtual ~NaviFrameController(); diff --git a/src/Common/Controller/inc/SaveAttachments.h b/src/Common/Controller/inc/SaveAttachments.h index 8e22e27e..8d98fa91 100644 --- a/src/Common/Controller/inc/SaveAttachments.h +++ b/src/Common/Controller/inc/SaveAttachments.h @@ -23,13 +23,11 @@ #include "SelectAllListItem.h" #include "MsgStorage.h" -namespace Msg -{ +namespace Msg { class SaveAttachments : public FrameController , private IHwButtonListener - , private IListViewListener - { + , private IListViewListener { public: SaveAttachments(NaviFrameController &parent, MsgId id); virtual ~SaveAttachments(); diff --git a/src/Common/Controller/inc/SaveAttachmentsListItem.h b/src/Common/Controller/inc/SaveAttachmentsListItem.h index 9162553b..19d4df7d 100644 --- a/src/Common/Controller/inc/SaveAttachmentsListItem.h +++ b/src/Common/Controller/inc/SaveAttachmentsListItem.h @@ -20,11 +20,9 @@ #include "ListItem.h" #include -namespace Msg -{ +namespace Msg { class SaveAttachmentsListItem - : public ListItem - { + : public ListItem { public: SaveAttachmentsListItem(const std::string &text, const std::string &path); virtual ~SaveAttachmentsListItem(); diff --git a/src/Common/Controller/inc/ViewController.h b/src/Common/Controller/inc/ViewController.h index 331e1334..c1eb5c21 100644 --- a/src/Common/Controller/inc/ViewController.h +++ b/src/Common/Controller/inc/ViewController.h @@ -20,13 +20,11 @@ #include "BaseController.h" #include -namespace Msg -{ +namespace Msg { class App; class ViewController - : public BaseController - { + : public BaseController { public: ViewController(App &app); ViewController(BaseController *parent); diff --git a/src/Common/Controller/inc/ViewItemController.h b/src/Common/Controller/inc/ViewItemController.h index 3a10baa0..05eedcbf 100644 --- a/src/Common/Controller/inc/ViewItemController.h +++ b/src/Common/Controller/inc/ViewItemController.h @@ -20,13 +20,11 @@ #include "BaseController.h" #include "ViewItem.h" -namespace Msg -{ +namespace Msg { class App; class ViewItemController - : public BaseController - { + : public BaseController { public: ViewItemController(App &app); ViewItemController(BaseController *parent); diff --git a/src/Common/Controller/src/App.cpp b/src/Common/Controller/src/App.cpp index eec80b9c..3cde9267 100644 --- a/src/Common/Controller/src/App.cpp +++ b/src/Common/Controller/src/App.cpp @@ -34,8 +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); } @@ -158,8 +157,7 @@ bool App::isPause() const void App::pause() { - if (!m_IsPause) - { + if (!m_IsPause) { m_IsPause = true; for (IAppListener *l : m_Listeners) l->onAppPause(); @@ -170,8 +168,7 @@ void App::pause() void App::resume() { - if (m_IsPause) - { + if (m_IsPause) { m_IsPause = false; updateActiveNotifPolicy(); for (IAppListener *l : m_Listeners) diff --git a/src/Common/Controller/src/FrameController.cpp b/src/Common/Controller/src/FrameController.cpp index 09fe6214..2b564ffe 100644 --- a/src/Common/Controller/src/FrameController.cpp +++ b/src/Common/Controller/src/FrameController.cpp @@ -52,8 +52,7 @@ 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) @@ -63,8 +62,7 @@ void FrameController::setNaviBarTitle(const MsgAddressList &addressList) title = firstAddress; int hidenAddresses = addressList.getLength() - 1; - if (hidenAddresses > 0) - { + if (hidenAddresses > 0) { title += " + " + std::to_string(hidenAddresses); getNaviBar().showButton(NaviExpandButtonId, true); } @@ -75,8 +73,7 @@ void FrameController::setNaviBarTitle(const MsgAddressList &addressList) void FrameController::pause() { - if (!m_IsPause) - { + if (!m_IsPause) { m_IsPause = true; onPause(); } @@ -84,8 +81,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 40bd0e87..71f14ad3 100644 --- a/src/Common/Controller/src/MbeRecipients.cpp +++ b/src/Common/Controller/src/MbeRecipients.cpp @@ -48,17 +48,14 @@ void MbeRecipients::updateItemsDispName() { auto items = getItems(); for (MbeRecipientItem *item: items) - { item->setDispName(getDispName(item->getAddress())); - } } 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,8 +64,7 @@ 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) update(*addrList); @@ -86,13 +82,11 @@ MbeRecipients::AppendItemStatus MbeRecipients::appendItem(const std::string &add return TooManyRecipStatus; AppendItemStatus result = SuccessStatus; - if (!isRecipientExists(address)) - { + if (!isRecipientExists(address)) { 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); @@ -109,8 +103,7 @@ 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) return true; diff --git a/src/Common/Controller/src/NaviFrameController.cpp b/src/Common/Controller/src/NaviFrameController.cpp index 37be247a..2829a385 100644 --- a/src/Common/Controller/src/NaviFrameController.cpp +++ b/src/Common/Controller/src/NaviFrameController.cpp @@ -43,10 +43,9 @@ NaviFrameController::~NaviFrameController() void NaviFrameController::pop(FrameController &frame) { - if (isLastFrame()) + if (isLastFrame()) { getApp().exit(); - else - { + } else { getApp().getPopupManager().reset(); NaviFrameView::pop(frame); } @@ -61,8 +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; } @@ -71,8 +69,7 @@ bool NaviFrameController::prepare(const AppControlCommand &cmd) void NaviFrameController::execCmd(const AppControlDefaultRef &cmd) { - if (prepare(*cmd)) - { + if (prepare(*cmd)) { AppControlLauncher::getInst().terminate(); AppControlDefault::DefaultType type = cmd->getDefaultType(); MsgThread *thread = getTopFrame(); // Check if thread is open @@ -81,15 +78,12 @@ void NaviFrameController::execCmd(const AppControlDefaultRef &cmd) auto *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 (conv) - { + if (type != AppControlDefault::MainType && msg != nullptr) { + if (conv) { promote(*conv); conv->execCmd(cmd); } else if (!conv) { - if (type == AppControlDefault::ViewType || type == AppControlDefault::ReplyType || isUnreadNotificationSingle(type)) - { + if (type == AppControlDefault::ViewType || type == AppControlDefault::ReplyType || isUnreadNotificationSingle(type)) { auto *conversation = new Conversation(*this); push(*conversation); conversation->execCmd(cmd); @@ -101,12 +95,10 @@ void NaviFrameController::execCmd(const AppControlDefaultRef &cmd) void NaviFrameController::execCmd(const AppControlComposeRef &cmd) { - if (prepare(*cmd)) - { + if (prepare(*cmd)) { AppControlLauncher::getInst().terminate(); auto *conv = getTopFrame(); - if (conv) - { + if (conv) { promote(*conv); } else { conv = new Conversation(*this); @@ -120,8 +112,7 @@ 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) return frame; diff --git a/src/Common/Controller/src/SaveAttachments.cpp b/src/Common/Controller/src/SaveAttachments.cpp index b4f0f36f..3a6ff3b5 100644 --- a/src/Common/Controller/src/SaveAttachments.cpp +++ b/src/Common/Controller/src/SaveAttachments.cpp @@ -79,24 +79,18 @@ 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) - { appendItem(mediaList.at(j).getFileName(), mediaList.at(j).getFilePath(), nullptr, this); - } } } const MsgAttachmentList &attachmentList = mms->getAttachmentList(); for (int i = 0; i < attachmentList.getLength(); ++i) - { appendItem(attachmentList.at(i).getFileName(), attachmentList.at(i).getFilePath(), nullptr, this); - } } void SaveAttachments::appendItem(const std::string &text, const std::string &path, PopupListItemPressedCb cb, void *userData) @@ -117,8 +111,7 @@ 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()) ++count; } @@ -129,16 +122,13 @@ void SaveAttachments::showSelectAllItem() { SelectAllListItem *item = dynamic_cast(m_pList->getFirstItem()); if (!item) - { item = new SelectAllListItem; m_pList->prependItem(*item); - } } void SaveAttachments::onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId) { - switch (buttonId) - { + switch (buttonId) { case NaviCancelButtonId: onHwBackButtonClicked(); break; @@ -198,8 +188,7 @@ 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()); @@ -213,8 +202,7 @@ 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()) return false; } @@ -224,8 +212,7 @@ 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()) return true; } @@ -240,8 +227,7 @@ bool SaveAttachments::saveCheckedItems() auto items = m_pList->getItems(); std::list files; - for (auto *item : items) - { + for (auto *item : items) { 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 d5809c06..42b13a5e 100644 --- a/src/Common/Controller/src/SaveAttachmentsListItem.cpp +++ b/src/Common/Controller/src/SaveAttachmentsListItem.cpp @@ -24,8 +24,7 @@ using namespace Msg; -namespace -{ +namespace { ListItemStyleRef ItemStyle = ListItemStyle::create("type1"); Elm_Genlist_Item_Type type = ELM_GENLIST_ITEM_NONE; const char *namePart = "elm.text"; diff --git a/src/Common/MsgEngine/inc/MediaType.h b/src/Common/MsgEngine/inc/MediaType.h index 0c484ef0..573a31ec 100644 --- a/src/Common/MsgEngine/inc/MediaType.h +++ b/src/Common/MsgEngine/inc/MediaType.h @@ -26,10 +26,8 @@ #include #include -namespace Msg -{ - struct MediaTypeData - { +namespace Msg { + struct MediaTypeData { MediaTypeData(const char *aMime, MsgMedia::Type aType) : mime(aMime) , type(aType) diff --git a/src/Common/MsgEngine/inc/Message.h b/src/Common/MsgEngine/inc/Message.h index 27d5897c..754c19b4 100644 --- a/src/Common/MsgEngine/inc/Message.h +++ b/src/Common/MsgEngine/inc/Message.h @@ -24,8 +24,7 @@ #include "MsgAddress.h" #include "MsgList.h" -namespace Msg -{ +namespace Msg { class Message; typedef std::shared_ptr MessageRef; typedef MsgList MessageList; @@ -34,14 +33,12 @@ namespace Msg /** * @brief An abstraction that represents message-entity stored in message-service. */ - class Message - { + class Message { public: /** * @brief Each message can be sent or received, and this enum is used to distinguish the kind of every message. */ - enum Direction - { + enum Direction { MD_Sent = 0, /**< Outgoing message.*/ MD_Received /**< Incoming message.*/ }; @@ -49,8 +46,7 @@ namespace Msg /** * @brief A type of every message. */ - enum Type - { + enum Type { MT_Unknown, /**< Unknown type of message. If you got it something bad has happened.*/ MT_SMS, /**< Text message - sms.*/ MT_MMS, /**< Multimedia message - mms.*/ @@ -60,8 +56,7 @@ namespace Msg /** * @brief Status of every message. */ - enum NetworkStatus - { + enum NetworkStatus { NS_Unknown = -1, /**< Attempt to get message status has failed.*/ NS_Not_Send, /**< Message is a draft for now.*/ NS_Sending, /**< message is in progress of sending.*/ @@ -82,8 +77,7 @@ namespace Msg /** * @brief Defines a storage for messages. */ - enum MessageStorageType - { + enum MessageStorageType { MS_Unknown, /**< Unknown storage.*/ MS_Phone, /**< Phone's internal storage used for regular messages.*/ MS_Sim /**< Sim-card storage used for messages on SIM.*/ diff --git a/src/Common/MsgEngine/inc/MessageMms.h b/src/Common/MsgEngine/inc/MessageMms.h index 878fd330..89ac7791 100644 --- a/src/Common/MsgEngine/inc/MessageMms.h +++ b/src/Common/MsgEngine/inc/MessageMms.h @@ -24,16 +24,14 @@ #include -namespace Msg -{ +namespace Msg { class MessageMms; typedef std::shared_ptr MessageMmsRef; typedef MsgList MessageMmsList; typedef std::shared_ptr> MessageMmsListRef; class MessageMms: - public virtual Message - { + public virtual Message { public: virtual ~MessageMms(); diff --git a/src/Common/MsgEngine/inc/MessageSMS.h b/src/Common/MsgEngine/inc/MessageSMS.h index 4e9b087f..d74321c2 100644 --- a/src/Common/MsgEngine/inc/MessageSMS.h +++ b/src/Common/MsgEngine/inc/MessageSMS.h @@ -22,16 +22,14 @@ #include -namespace Msg -{ +namespace Msg { class MessageSMS; typedef std::shared_ptr MessageSMSRef; typedef MsgList MessageSMSList; typedef std::shared_ptr> MessageSMSListRef; class MessageSMS: - public virtual Message - { + public virtual Message { public: MessageSMS(); virtual ~MessageSMS(); diff --git a/src/Common/MsgEngine/inc/MsgAddress.h b/src/Common/MsgEngine/inc/MsgAddress.h index 52de4324..65b42350 100644 --- a/src/Common/MsgEngine/inc/MsgAddress.h +++ b/src/Common/MsgEngine/inc/MsgAddress.h @@ -22,8 +22,7 @@ #include #include -namespace Msg -{ +namespace Msg { class MsgAddress; typedef MsgList MsgAddressList; typedef std::shared_ptr> MsgAddressListRef; @@ -31,14 +30,12 @@ namespace Msg /** * @brief Basic abstraction that represents a recipient's address message should be delivered to. */ - class MsgAddress - { + class MsgAddress { public: /** * @brief Type of address. */ - enum AddressType - { + enum AddressType { Phone, /**< Phone number*/ Email, /**< Email address*/ UnknownAddressType /**< Unknown address, you get it if phone number format or email-format validations has failed to parce address.*/ @@ -47,8 +44,7 @@ namespace Msg /** * @brief A kind of recipient that defines a way how message should be delivered to this address. */ - enum RecipientType - { + enum RecipientType { To, /**< Primary recipient, messages are sent directly to this address.*/ Cc, /**< "Carbon copy", secondary recipient. This address gets a message as a copy of original message sent to other "TO"-recipient.*/ Bcc, /**< "Blind carbon copy" to tertiary recipients who receive the message. The primary and secondary recipients cannot see the tertiary recipients.*/ diff --git a/src/Common/MsgEngine/inc/MsgAttachment.h b/src/Common/MsgEngine/inc/MsgAttachment.h index 27978b81..6e314bbe 100644 --- a/src/Common/MsgEngine/inc/MsgAttachment.h +++ b/src/Common/MsgEngine/inc/MsgAttachment.h @@ -20,15 +20,13 @@ #include "MsgList.h" #include -namespace Msg -{ +namespace Msg { class MsgAttachment; typedef std::shared_ptr MsgAttachmentRef; typedef MsgList MsgAttachmentList; typedef std::shared_ptr> MsgAttachmentListRef; - class MsgAttachment - { + class MsgAttachment { public: virtual ~MsgAttachment() {}; virtual std::string getFilePath() const = 0; diff --git a/src/Common/MsgEngine/inc/MsgComposer.h b/src/Common/MsgEngine/inc/MsgComposer.h index 2268c621..9f9a3aa2 100644 --- a/src/Common/MsgEngine/inc/MsgComposer.h +++ b/src/Common/MsgEngine/inc/MsgComposer.h @@ -22,10 +22,8 @@ #include "MsgUtils.h" #include "Logger.h" -namespace Msg -{ - class MsgComposer - { +namespace Msg { + class MsgComposer { public: virtual ~MsgComposer() {}; diff --git a/src/Common/MsgEngine/inc/MsgConvMedia.h b/src/Common/MsgEngine/inc/MsgConvMedia.h index 0bed0d12..9f6be5f6 100644 --- a/src/Common/MsgEngine/inc/MsgConvMedia.h +++ b/src/Common/MsgEngine/inc/MsgConvMedia.h @@ -22,14 +22,12 @@ #include #include -namespace Msg -{ +namespace Msg { class MsgConvMedia; typedef MsgList MsgConvMediaList; typedef std::shared_ptr> MsgConvMediaListRef; - class MsgConvMedia - { + class MsgConvMedia { public: virtual ~MsgConvMedia() {}; diff --git a/src/Common/MsgEngine/inc/MsgConversationItem.h b/src/Common/MsgEngine/inc/MsgConversationItem.h index 204c3703..95f55cf1 100644 --- a/src/Common/MsgEngine/inc/MsgConversationItem.h +++ b/src/Common/MsgEngine/inc/MsgConversationItem.h @@ -25,8 +25,7 @@ #include #include -namespace Msg -{ +namespace Msg { class MsgConversationItem; typedef std::shared_ptr MsgConversationItemRef; typedef std::shared_ptr> MsgConversationListRef; @@ -34,8 +33,7 @@ namespace Msg /** * @brief An interface that provides basic information about conversation-list item. */ - class MsgConversationItem - { + class MsgConversationItem { public: virtual ~MsgConversationItem(); diff --git a/src/Common/MsgEngine/inc/MsgEngine.h b/src/Common/MsgEngine/inc/MsgEngine.h index cc3d0a44..44932ffb 100644 --- a/src/Common/MsgEngine/inc/MsgEngine.h +++ b/src/Common/MsgEngine/inc/MsgEngine.h @@ -33,13 +33,11 @@ #include "Logger.h" #include "MsgTypes.h" -namespace Msg -{ +namespace Msg { /** * @brief Core-instance of whole mechanism that interacts with message-service. */ - class MsgEngine - { + class MsgEngine { public: MsgEngine(); ~MsgEngine(); diff --git a/src/Common/MsgEngine/inc/MsgList.h b/src/Common/MsgEngine/inc/MsgList.h index 5746e608..39b00419 100644 --- a/src/Common/MsgEngine/inc/MsgList.h +++ b/src/Common/MsgEngine/inc/MsgList.h @@ -18,14 +18,12 @@ #define MsgList_H_ -namespace Msg -{ +namespace Msg { /** * @brief Generic container for message-objects. */ template - class MsgList - { + class MsgList { public: typedef T Type; diff --git a/src/Common/MsgEngine/inc/MsgMedia.h b/src/Common/MsgEngine/inc/MsgMedia.h index 73092213..7fafa8ce 100644 --- a/src/Common/MsgEngine/inc/MsgMedia.h +++ b/src/Common/MsgEngine/inc/MsgMedia.h @@ -20,8 +20,7 @@ #include "MsgList.h" #include -namespace Msg -{ +namespace Msg { class MsgMedia; typedef std::shared_ptr MsgMediaRef; typedef MsgList MsgMediaList; @@ -30,14 +29,12 @@ namespace Msg /** * @brief represents a file to be attached to message. */ - class MsgMedia - { + class MsgMedia { public: /** * @brief Attacment-type. */ - enum Type - { + enum Type { UnknownType = 0, /**< File type unsupported by smil-player, can't be played by smil-player. Attached as unknown filetype.*/ ImageType, /**< Image file. Can be played with smil-player.*/ AudioType, /**< Audio file. Can be played with smil-player.*/ diff --git a/src/Common/MsgEngine/inc/MsgPage.h b/src/Common/MsgEngine/inc/MsgPage.h index bc3203ff..a3279711 100644 --- a/src/Common/MsgEngine/inc/MsgPage.h +++ b/src/Common/MsgEngine/inc/MsgPage.h @@ -19,8 +19,7 @@ #include "MsgMedia.h" -namespace Msg -{ +namespace Msg { class MsgPage; typedef std::shared_ptr MsgPageRef; typedef MsgList MsgPageList; @@ -30,8 +29,7 @@ namespace Msg * @brief An abstraction that represents a concept of "page". * This is a part of MMS that contains one previewable attachment(video or image) and a number of attachments that have no preview(documents, audio-files etc). */ - class MsgPage - { + class MsgPage { public: virtual ~MsgPage(); diff --git a/src/Common/MsgEngine/inc/MsgReport.h b/src/Common/MsgEngine/inc/MsgReport.h index 06864d20..7a2f0296 100644 --- a/src/Common/MsgEngine/inc/MsgReport.h +++ b/src/Common/MsgEngine/inc/MsgReport.h @@ -22,33 +22,28 @@ #include #include -namespace Msg -{ +namespace Msg { class MsgReport; typedef MsgList MsgReportList; typedef std::shared_ptr> MsgReportListRef; - class MsgReport - { + class MsgReport { public: - enum DeliveryStatus - { + enum DeliveryStatus { StatusNone, StatusExpired, StatusSuccess, StatusRejected }; - enum ReadStatus - { + enum ReadStatus { ReadStatusNone, ReadStatusIsRead, ReadStatusIsDeleted, ReadStatusRejectByUser }; - enum Type - { + enum Type { TypeDelivery, TypeRead, TypeReadReportSent diff --git a/src/Common/MsgEngine/inc/MsgSettings.h b/src/Common/MsgEngine/inc/MsgSettings.h index 8e781d73..8584979a 100644 --- a/src/Common/MsgEngine/inc/MsgSettings.h +++ b/src/Common/MsgEngine/inc/MsgSettings.h @@ -22,21 +22,17 @@ #include #include -namespace Msg -{ +namespace Msg { class IMsgSettingsListener; - class MsgSettings - { + class MsgSettings { public: - enum ActiveNotifPolicy - { + enum ActiveNotifPolicy { AppBackgroundPolicy, // App is not running or on background. AppForegroundPolicy // App is running and on foreground, but not in conversation. }; - enum RingtoneType - { + enum RingtoneType { DefaultRingtone, SilentRingtone, UserRingtone diff --git a/src/Common/MsgEngine/inc/MsgStorage.h b/src/Common/MsgEngine/inc/MsgStorage.h index 4556f905..fb823fc9 100644 --- a/src/Common/MsgEngine/inc/MsgStorage.h +++ b/src/Common/MsgEngine/inc/MsgStorage.h @@ -28,22 +28,19 @@ #include "MsgConversationItem.h" #include "MsgReport.h" -namespace Msg -{ +namespace Msg { class IMsgStorageListener; class MsgDataContainer; /** * @brief Instance responsible for interaction with message-service internal message-storage. */ - class MsgStorage - { + class MsgStorage { public: /** * @brief Possible results message storage could cause to. */ - enum StorageResult - { + enum StorageResult { StorageSuccess = 0, /**< Storage successful.*/ StorageFail = -1, /**< Storage failure.*/ StorageSimFull = -2, /**< SIM storage is full.*/ diff --git a/src/Common/MsgEngine/inc/MsgThreadItem.h b/src/Common/MsgEngine/inc/MsgThreadItem.h index 3a35229d..42a49177 100644 --- a/src/Common/MsgEngine/inc/MsgThreadItem.h +++ b/src/Common/MsgEngine/inc/MsgThreadItem.h @@ -23,8 +23,7 @@ #include #include -namespace Msg -{ +namespace Msg { class MsgThreadItem; typedef std::shared_ptr MsgThreadItemRef; typedef std::shared_ptr> MsgThreadListRef; @@ -32,8 +31,7 @@ namespace Msg /** * @brief An interface that should be implemented by data-structure responsible for accessing basic thread information. */ - class MsgThreadItem - { + class MsgThreadItem { public: virtual ~MsgThreadItem(); diff --git a/src/Common/MsgEngine/inc/MsgTransport.h b/src/Common/MsgEngine/inc/MsgTransport.h index 62aed32d..148bb304 100644 --- a/src/Common/MsgEngine/inc/MsgTransport.h +++ b/src/Common/MsgEngine/inc/MsgTransport.h @@ -22,19 +22,16 @@ #include "MessageSMS.h" #include "MsgReport.h" -namespace Msg -{ +namespace Msg { /** * @brief Manages sending(receiving) messages activity. */ - class MsgTransport - { + class MsgTransport { public: /** * @brief Possible results message sending could cause to. */ - enum SendResult - { + enum SendResult { SendSuccess = 0, /**< Sending successful.*/ SendFail = -1, /**< Sending failure.*/ SendNoSIM = -2, /**< No SIM was found.*/ diff --git a/src/Common/MsgEngine/inc/MsgTypes.h b/src/Common/MsgEngine/inc/MsgTypes.h index 167230ff..8e373bec 100644 --- a/src/Common/MsgEngine/inc/MsgTypes.h +++ b/src/Common/MsgEngine/inc/MsgTypes.h @@ -19,10 +19,8 @@ #include -namespace Msg -{ - class BaseMsgId - { +namespace Msg { + class BaseMsgId { public: typedef unsigned Type; static const Type invalidId = 0; @@ -67,21 +65,18 @@ namespace Msg }; class ThreadId - : public BaseMsgId - { + : public BaseMsgId { using BaseMsgId::BaseMsgId; }; class MsgId - : public BaseMsgId - { + : public BaseMsgId { using BaseMsgId::BaseMsgId; }; typedef std::vector MsgIdList; - struct MsgTextMetric - { + struct MsgTextMetric { MsgTextMetric(); void reset(); diff --git a/src/Common/MsgEngine/inc/MsgUtils.h b/src/Common/MsgEngine/inc/MsgUtils.h index 8e4591ad..fc119ec5 100644 --- a/src/Common/MsgEngine/inc/MsgUtils.h +++ b/src/Common/MsgEngine/inc/MsgUtils.h @@ -25,16 +25,13 @@ #include #include -namespace Msg -{ - struct TokenizedRecipients - { +namespace Msg { + struct TokenizedRecipients { std::list> validResults; std::string invalidResult; }; - class MsgUtils - { + class MsgUtils { public: static TokenizedRecipients tokenizeRecipients(const std::string &inputText); static bool isValidNumber(const std::string &address); diff --git a/src/Common/MsgEngine/src/MsgEngine.cpp b/src/Common/MsgEngine/src/MsgEngine.cpp index 76124563..ee3b41b9 100644 --- a/src/Common/MsgEngine/src/MsgEngine.cpp +++ b/src/Common/MsgEngine/src/MsgEngine.cpp @@ -46,8 +46,7 @@ MsgEngine::~MsgEngine() int MsgEngine::openService() { TRACE; - if (m_MsgHandle) - { + if (m_MsgHandle) { MSG_LOG_ERROR("Handle already has been opened"); } int result = 0; @@ -77,8 +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); #else @@ -93,8 +91,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; } @@ -156,8 +153,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"; break; @@ -359,8 +355,7 @@ std::string MsgEngine::whatError(int error) } #else - switch (error) - { + switch (error) { case MESSAGES_ERROR_NONE: return "MESSAGES_ERROR_NONE"; break; @@ -419,17 +414,14 @@ void MsgEngine::calculateTextMetric(const std::string &text, MsgTextMetric &text int bytesInChar = 1; textMetric.reset(); - if (!text.empty()) - { - if (msg_util_calculate_text_length(text.c_str(), MSG_ENCODE_AUTO, &textLen, &segmentLen, &encode) != 0) - { + if (!text.empty()) { + 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; break; diff --git a/src/Common/MsgEngine/src/MsgSettings.cpp b/src/Common/MsgEngine/src/MsgSettings.cpp index 47ea37d4..f5f9fb73 100644 --- a/src/Common/MsgEngine/src/MsgSettings.cpp +++ b/src/Common/MsgEngine/src/MsgSettings.cpp @@ -51,17 +51,13 @@ void MsgSettings::addListener(IMsgSettingsListener &listener) { auto itr = std::find(m_Listeners.begin(), m_Listeners.end(), &listener); if (itr == m_Listeners.end()) - { m_Listeners.push_back(&listener); - } } void MsgSettings::removeListener(IMsgSettingsListener &listener) { auto itr = std::find(m_Listeners.begin(), m_Listeners.end(), &listener); 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 192173b0..73d41b30 100644 --- a/src/Common/MsgEngine/src/MsgStorage.cpp +++ b/src/Common/MsgEngine/src/MsgStorage.cpp @@ -34,18 +34,14 @@ void MsgStorage::addListener(IMsgStorageListener &listener) { auto itr = std::find(m_Listeners.begin(), m_Listeners.end(), &listener); if (itr == m_Listeners.end()) - { m_Listeners.push_back(&listener); - } } void MsgStorage::removeListener(IMsgStorageListener &listener) { auto itr = std::find(m_Listeners.begin(), m_Listeners.end(), &listener); if (itr != m_Listeners.end()) - { m_Listeners.erase(itr); - } } bool MsgStorage::hasEmail(ThreadId id) @@ -54,10 +50,8 @@ bool MsgStorage::hasEmail(ThreadId id) return false; const MsgAddressListRef addressList = getAddressList(id); - if (addressList) - { - for (int i = 0; i < addressList->getLength(); ++i) - { + if (addressList) { + for (int i = 0; i < addressList->getLength(); ++i) { const MsgAddress &msgAddr = addressList->at(i); if (msgAddr.getAddressType() == MsgAddress::Email) return true; diff --git a/src/Common/MsgEngine/src/MsgUtils.cpp b/src/Common/MsgEngine/src/MsgUtils.cpp index 71fcb38d..72224d02 100644 --- a/src/Common/MsgEngine/src/MsgUtils.cpp +++ b/src/Common/MsgEngine/src/MsgUtils.cpp @@ -24,8 +24,7 @@ using namespace Msg; -namespace -{ +namespace { unsigned emailAddrLenMax = 256; const char *delimiters = ",;"; const char *numberRegex = "\\+?([[:digit:]][ *\\(\\)-]*){2,14}[[:digit:]]$"; @@ -40,16 +39,13 @@ TokenizedRecipients MsgUtils::tokenizeRecipients(const std::string &inputText) std::string token; MsgAddress::AddressType addressType = MsgAddress::UnknownAddressType; - while (begin != end) - { - if (begin != std::string::npos) - { + while (begin != end) { + 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) { @@ -88,14 +84,10 @@ bool MsgUtils::isValidAddress(const std::string &address) MsgAddress::AddressType MsgUtils::getAddressType(const std::string &address) { if (isValidNumber(address)) - { return MsgAddress::Phone; - } if (isValidEmail(address)) - { return MsgAddress::Email; - } return MsgAddress::UnknownAddressType; } @@ -103,12 +95,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 == '+') - { normalizedNumber += symbol; - } } return normalizedNumber; } @@ -116,8 +105,7 @@ 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)) cleanedNumber += symbol; } @@ -126,8 +114,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: return true; @@ -145,8 +132,7 @@ 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 { sizeKb = bytes / kb; diff --git a/src/Common/MsgEngine/src/private/MessageMmsPrivate.cpp b/src/Common/MsgEngine/src/private/MessageMmsPrivate.cpp index 5a167222..d71eaa35 100644 --- a/src/Common/MsgEngine/src/private/MessageMmsPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MessageMmsPrivate.cpp @@ -31,13 +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) - { msg_get_mms_struct(m_MsgStruct, m_MmsStruct); - } } } @@ -60,9 +57,7 @@ msg_struct_t MessageMmsPrivate::getMmsStruct() const MessageMmsPrivate::~MessageMmsPrivate() { if (m_MmsStruct) - { msg_release_struct(&m_MmsStruct); - } } MessageMmsPrivate::Type MessageMmsPrivate::getType() const @@ -83,18 +78,14 @@ 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) - { - if (mediaList[j].getType() == MsgMedia::TextType) - { + for (int j = 0; j < sizeList; ++j) { + 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()) result.append("\n"); @@ -112,13 +103,11 @@ 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) ++result; } diff --git a/src/Common/MsgEngine/src/private/MessageMmsPrivate.h b/src/Common/MsgEngine/src/private/MessageMmsPrivate.h index 6d5c02a8..a7ec5438 100644 --- a/src/Common/MsgEngine/src/private/MessageMmsPrivate.h +++ b/src/Common/MsgEngine/src/private/MessageMmsPrivate.h @@ -22,12 +22,10 @@ #include "MsgPagePrivate.h" #include "MsgAttachmentPrivate.h" -namespace Msg -{ +namespace Msg { class MessageMmsPrivate : public MessagePrivate - , public MessageMms - { + , public MessageMms { public: MessageMmsPrivate(bool release, msg_struct_t msgStruct = nullptr, msg_struct_t mmsStruct = nullptr); virtual ~MessageMmsPrivate(); diff --git a/src/Common/MsgEngine/src/private/MessagePrivate.cpp b/src/Common/MsgEngine/src/private/MessagePrivate.cpp index 075dc1d0..fd59d816 100644 --- a/src/Common/MsgEngine/src/private/MessagePrivate.cpp +++ b/src/Common/MsgEngine/src/private/MessagePrivate.cpp @@ -61,8 +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]); } @@ -146,8 +145,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); break; diff --git a/src/Common/MsgEngine/src/private/MessagePrivate.h b/src/Common/MsgEngine/src/private/MessagePrivate.h index eba4c308..497bb248 100644 --- a/src/Common/MsgEngine/src/private/MessagePrivate.h +++ b/src/Common/MsgEngine/src/private/MessagePrivate.h @@ -23,12 +23,10 @@ #include -namespace Msg -{ +namespace Msg { class MessagePrivate : public virtual Message - , public MsgStructPrivate - { + , public MsgStructPrivate { public: MessagePrivate(bool release, msg_struct_t msgStruct = nullptr); virtual ~MessagePrivate(); diff --git a/src/Common/MsgEngine/src/private/MessageSMSPrivate.h b/src/Common/MsgEngine/src/private/MessageSMSPrivate.h index 813d8da3..7561fb80 100644 --- a/src/Common/MsgEngine/src/private/MessageSMSPrivate.h +++ b/src/Common/MsgEngine/src/private/MessageSMSPrivate.h @@ -22,12 +22,10 @@ #include "MsgListHandlePrivate.h" #include "MsgStructListPrivate.h" -namespace Msg -{ +namespace Msg { class MessageSMSPrivate : public MessagePrivate - , public MessageSMS - { + , public MessageSMS { public: MessageSMSPrivate(bool release, msg_struct_t msgStruct = nullptr); virtual ~MessageSMSPrivate(); diff --git a/src/Common/MsgEngine/src/private/MsgAddressPrivate.h b/src/Common/MsgEngine/src/private/MsgAddressPrivate.h index e7161dae..dc593c64 100644 --- a/src/Common/MsgEngine/src/private/MsgAddressPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgAddressPrivate.h @@ -22,12 +22,10 @@ #include "MsgStructListPrivate.h" #include "MsgStructPrivate.h" -namespace Msg -{ +namespace Msg { class MsgAddressPrivate : public MsgStructPrivate - , public MsgAddress - { + , public MsgAddress { public: MsgAddressPrivate(bool release, msg_struct_t msgStruct = nullptr); virtual ~MsgAddressPrivate(); diff --git a/src/Common/MsgEngine/src/private/MsgAttachmentPrivate.cpp b/src/Common/MsgEngine/src/private/MsgAttachmentPrivate.cpp index 10d1b915..63673b6b 100644 --- a/src/Common/MsgEngine/src/private/MsgAttachmentPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgAttachmentPrivate.cpp @@ -46,8 +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()); MSG_LOG("Real file size = ", size); diff --git a/src/Common/MsgEngine/src/private/MsgAttachmentPrivate.h b/src/Common/MsgEngine/src/private/MsgAttachmentPrivate.h index 360710ef..3ed3814c 100644 --- a/src/Common/MsgEngine/src/private/MsgAttachmentPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgAttachmentPrivate.h @@ -22,12 +22,10 @@ #include "MsgListHandlePrivate.h" #include "MsgStructListPrivate.h" -namespace Msg -{ +namespace Msg { class MsgAttachmentPrivate : public MsgStructPrivate - , public MsgAttachment - { + , public MsgAttachment { public: MsgAttachmentPrivate(bool release, msg_struct_t msgStruct = nullptr); virtual ~MsgAttachmentPrivate(); diff --git a/src/Common/MsgEngine/src/private/MsgComposerPrivate.cpp b/src/Common/MsgEngine/src/private/MsgComposerPrivate.cpp index 70c8571c..82dc2a4f 100644 --- a/src/Common/MsgEngine/src/private/MsgComposerPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgComposerPrivate.cpp @@ -37,8 +37,7 @@ 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); MessageSMSPrivate *sms = new MessageSMSPrivate(true, msgInfo); @@ -51,8 +50,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/MsgComposerPrivate.h b/src/Common/MsgEngine/src/private/MsgComposerPrivate.h index 380ead44..8f6cda48 100644 --- a/src/Common/MsgEngine/src/private/MsgComposerPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgComposerPrivate.h @@ -20,11 +20,9 @@ #include "MsgComposer.h" #include -namespace Msg -{ +namespace Msg { class MsgComposerPrivate - : public MsgComposer - { + : public MsgComposer { public: MsgComposerPrivate(); MsgComposerPrivate(MsgComposerPrivate&) = delete; diff --git a/src/Common/MsgEngine/src/private/MsgConvMediaPrivate.h b/src/Common/MsgEngine/src/private/MsgConvMediaPrivate.h index 6351835c..2f1fc09d 100644 --- a/src/Common/MsgEngine/src/private/MsgConvMediaPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgConvMediaPrivate.h @@ -21,12 +21,10 @@ #include "MsgListHandlePrivate.h" #include "MsgStructPrivate.h" -namespace Msg -{ +namespace Msg { class MsgConvMediaPrivate : public MsgStructPrivate - , public MsgConvMedia - { + , public MsgConvMedia { public: MsgConvMediaPrivate(bool release, msg_struct_t msgStruct = nullptr); virtual ~MsgConvMediaPrivate(); diff --git a/src/Common/MsgEngine/src/private/MsgConversationItemPrivate.h b/src/Common/MsgEngine/src/private/MsgConversationItemPrivate.h index 61d637e5..b1e55d85 100644 --- a/src/Common/MsgEngine/src/private/MsgConversationItemPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgConversationItemPrivate.h @@ -23,15 +23,13 @@ #include "MsgStructListPrivate.h" #include "MsgConvMediaPrivate.h" -namespace Msg -{ +namespace Msg { /** * @brief Implementation of MsgConversationItem with msg-service private API usage. */ class MsgConversationItemPrivate : public MsgStructPrivate - , public MsgConversationItem - { + , public MsgConversationItem { public: MsgConversationItemPrivate(bool release, msg_struct_t msgStruct = nullptr); virtual ~MsgConversationItemPrivate(); diff --git a/src/Common/MsgEngine/src/private/MsgDefPrivate.h b/src/Common/MsgEngine/src/private/MsgDefPrivate.h index 0fe4cedc..38e06709 100644 --- a/src/Common/MsgEngine/src/private/MsgDefPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgDefPrivate.h @@ -19,8 +19,7 @@ #include -namespace Msg -{ +namespace Msg { // SMIL layout: const int smilScreenWidthP = 100; const int smilScreenHeightP = 100; diff --git a/src/Common/MsgEngine/src/private/MsgListHandlePrivate.h b/src/Common/MsgEngine/src/private/MsgListHandlePrivate.h index 28e3869c..5645b97c 100644 --- a/src/Common/MsgEngine/src/private/MsgListHandlePrivate.h +++ b/src/Common/MsgEngine/src/private/MsgListHandlePrivate.h @@ -21,13 +21,11 @@ #include -namespace Msg -{ +namespace Msg { // class T : public BaseT {} template class MsgListHandlePrivate - : public MsgList // implement interface - { + : public MsgList { // implement interface public: MsgListHandlePrivate(bool release, msg_list_handle_t list = nullptr) : m_List(list) @@ -39,9 +37,7 @@ namespace Msg virtual ~MsgListHandlePrivate() { if (m_Release && m_List) - { msg_list_free(m_List); - } } virtual BaseT &at(int i) diff --git a/src/Common/MsgEngine/src/private/MsgMediaPrivate.cpp b/src/Common/MsgEngine/src/private/MsgMediaPrivate.cpp index da043e9b..e5d5ebb1 100644 --- a/src/Common/MsgEngine/src/private/MsgMediaPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgMediaPrivate.cpp @@ -60,26 +60,16 @@ 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: - { MsgUtilsPrivate::setStr(m_MsgStruct, MSG_MMS_MEDIA_REGION_ID_STR, imageRegionId); break; - } - case AudioType: - { break; - } - case TextType: - { MsgUtilsPrivate::setStr(m_MsgStruct, MSG_MMS_MEDIA_REGION_ID_STR, textRegionId); break; - } - default: MSG_ASSERT(false, "Wrong SMIL type:", type); } diff --git a/src/Common/MsgEngine/src/private/MsgMediaPrivate.h b/src/Common/MsgEngine/src/private/MsgMediaPrivate.h index ffc0f6f9..bffa366f 100644 --- a/src/Common/MsgEngine/src/private/MsgMediaPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgMediaPrivate.h @@ -22,12 +22,10 @@ #include "MsgListHandlePrivate.h" #include "MsgStructListPrivate.h" -namespace Msg -{ +namespace Msg { class MsgMediaPrivate : public MsgStructPrivate - , public MsgMedia - { + , public MsgMedia { public: MsgMediaPrivate(bool release, msg_struct_t msgStruct = nullptr); virtual ~MsgMediaPrivate(); diff --git a/src/Common/MsgEngine/src/private/MsgPagePrivate.h b/src/Common/MsgEngine/src/private/MsgPagePrivate.h index 17cfe715..8e676b95 100644 --- a/src/Common/MsgEngine/src/private/MsgPagePrivate.h +++ b/src/Common/MsgEngine/src/private/MsgPagePrivate.h @@ -20,12 +20,10 @@ #include "MsgPage.h" #include "MsgMediaPrivate.h" -namespace Msg -{ +namespace Msg { class MsgPagePrivate : public MsgStructPrivate - , public MsgPage - { + , public MsgPage { public: MsgPagePrivate(bool release, msg_struct_t msgStruct = nullptr); virtual ~MsgPagePrivate(); diff --git a/src/Common/MsgEngine/src/private/MsgReportPrivate.h b/src/Common/MsgEngine/src/private/MsgReportPrivate.h index 6885c6c7..daaff40a 100644 --- a/src/Common/MsgEngine/src/private/MsgReportPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgReportPrivate.h @@ -22,12 +22,10 @@ #include "MsgStructListPrivate.h" #include "MsgStructPrivate.h" -namespace Msg -{ +namespace Msg { class MsgReportPrivate : public MsgStructPrivate - , public MsgReport - { + , public MsgReport { public: MsgReportPrivate(bool release, msg_struct_t msgStruct = nullptr); virtual ~MsgReportPrivate(); diff --git a/src/Common/MsgEngine/src/private/MsgSettingsPrivate.cpp b/src/Common/MsgEngine/src/private/MsgSettingsPrivate.cpp index 9f649a13..8b4a75d1 100644 --- a/src/Common/MsgEngine/src/private/MsgSettingsPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgSettingsPrivate.cpp @@ -62,8 +62,7 @@ void MsgSettingsPrivate::init() void MsgSettingsPrivate::finit() { - if (m_pActiveNotifJob) - { + if (m_pActiveNotifJob) { ecore_job_del(m_pActiveNotifJob); m_pActiveNotifJob = nullptr; vconf_set_int(VCONFKEY_MESSAGE_ACTIVATED_CONVERSATION_ID, m_ActiveNotifValue); @@ -116,8 +115,7 @@ int MsgSettingsPrivate::getMaxMmsSize() const // Standard MMS has size 307200 bytes const int kb = 1024; - if (res > 0) - { + if (res > 0) { res *= kb; res -= 5 * kb; // header size } else { @@ -150,9 +148,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) - { listener->onRingtoneChanged(*this); - } } MsgSettingsPrivate::RingtoneType MsgSettingsPrivate::getRingtoneType() const @@ -167,9 +163,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) - { listener->onRingtoneChanged(*this); - } } std::string MsgSettingsPrivate::getRingtone() const @@ -275,8 +269,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 ( [](void *data) diff --git a/src/Common/MsgEngine/src/private/MsgSettingsPrivate.h b/src/Common/MsgEngine/src/private/MsgSettingsPrivate.h index 84825575..f3ea3f3f 100644 --- a/src/Common/MsgEngine/src/private/MsgSettingsPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgSettingsPrivate.h @@ -22,11 +22,9 @@ #include #include -namespace Msg -{ +namespace Msg { class MsgSettingsPrivate - : public MsgSettings - { + : public MsgSettings { public: MsgSettingsPrivate(msg_handle_t serviceHandle); MsgSettingsPrivate(MsgSettingsPrivate&) = delete; diff --git a/src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp b/src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp index 6c2bea18..bcdd4505 100644 --- a/src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp @@ -44,9 +44,7 @@ template void MsgStoragePrivate::notifyListeners(const T& delta, ListenerMethod method) { for (auto listener: m_Listeners) - { (listener->*method)(delta); - } } void MsgStoragePrivate::msg_storage_change_cb(msg_handle_t handle, msg_storage_change_type_t storageChangeType, msg_id_list_s *pMsgIdList, void *user_param) @@ -59,12 +57,9 @@ void MsgStoragePrivate::msg_storage_change_cb(msg_handle_t handle, msg_storage_c msgIdList.reserve(count); 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); break; @@ -86,8 +81,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); break; @@ -119,9 +113,7 @@ MsgThreadListRef MsgStoragePrivate::getThreadList() msg_release_struct(&sortRule); if (error == 0) - { res.reset(new MsgThreadStructListPrivate(true, msgList)); - } return res; } @@ -139,9 +131,8 @@ MessageSMSListRef MsgStoragePrivate::getSimMsgList() msg_set_int_value(listCond, MSG_LIST_CONDITION_STORAGE_ID_INT, MSG_STORAGE_SIM); if (msg_get_message_list2(m_ServiceHandle, listCond, &msgList) == 0) - { res.reset(new SmsStructListPrivate(true, msgList)); - } + msg_release_struct(&listCond); return res; } @@ -150,8 +141,7 @@ 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)) { @@ -169,15 +159,12 @@ 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) - { - for (auto &addr : addressList) - { + if (msgInfo) { + for (auto &addr : addressList) { MsgAddress::AddressType type = MsgUtils::getAddressType(addr); msg_struct_t tmpAddr = nullptr; - if (msg_list_add_item(msgInfo, MSG_MESSAGE_ADDR_LIST_HND, &tmpAddr) == MSG_SUCCESS) - { + if (msg_list_add_item(msgInfo, MSG_MESSAGE_ADDR_LIST_HND, &tmpAddr) == MSG_SUCCESS) { msg_set_int_value(tmpAddr, MSG_ADDRESS_INFO_ADDRESS_TYPE_INT, MsgUtilsPrivate::addressTypeToNative(type)); msg_set_int_value(tmpAddr, MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, MSG_RECIPIENTS_TYPE_TO); MsgUtilsPrivate::setStr(tmpAddr, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, addr); @@ -208,8 +195,7 @@ 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); } @@ -232,8 +218,7 @@ 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); @@ -249,9 +234,8 @@ 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) - { res.reset(new MsgThreadItemPrivate(true, thread)); - } + return res; } @@ -267,9 +251,8 @@ MsgConversationListRef MsgStoragePrivate::getConversationList(ThreadId id) int error = msg_get_conversation_view_list(m_ServiceHandle, id, &convList); if (error == 0) - { res.reset(new MsgConversationStructListPrivate(true, convList)); - } + return res; } @@ -277,8 +260,7 @@ 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 { msg_release_struct(&convItem); @@ -293,8 +275,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); Message::Type type = MsgUtilsPrivate::nativeToMessageType(nativeType); @@ -322,8 +303,7 @@ 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) *result = MsgUtilsPrivate::nativeToStorageResult(err); @@ -331,13 +311,11 @@ MsgId MsgStoragePrivate::saveMessage(Message &msg, bool updateExisting, StorageR newMsgId = msg.getId(); } 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) *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); newMsgId.reset(); diff --git a/src/Common/MsgEngine/src/private/MsgStoragePrivate.h b/src/Common/MsgEngine/src/private/MsgStoragePrivate.h index e7abfcee..6154bb0b 100644 --- a/src/Common/MsgEngine/src/private/MsgStoragePrivate.h +++ b/src/Common/MsgEngine/src/private/MsgStoragePrivate.h @@ -23,11 +23,9 @@ #include #include -namespace Msg -{ +namespace Msg { class MsgStoragePrivate - : public MsgStorage - { + : public MsgStorage { public: MsgStoragePrivate(msg_handle_t serviceHandle); MsgStoragePrivate(MsgStoragePrivate&) = delete; diff --git a/src/Common/MsgEngine/src/private/MsgStructListPrivate.h b/src/Common/MsgEngine/src/private/MsgStructListPrivate.h index 8044209d..cd24a92c 100644 --- a/src/Common/MsgEngine/src/private/MsgStructListPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgStructListPrivate.h @@ -21,15 +21,13 @@ #include -namespace Msg -{ +namespace Msg { static msg_struct_list_s emptyStructList; // class T : public BaseT {} template class MsgStructListPrivate - : public MsgList // implement interface - { + : public MsgList { // implement interface public: MsgStructListPrivate(bool release, const msg_struct_list_s &list = emptyStructList) : m_List(list) @@ -41,9 +39,7 @@ namespace Msg virtual ~MsgStructListPrivate() { if (m_Release && m_List.nCount) - { msg_release_list_struct(&m_List); - } } virtual BaseT &at(int i) diff --git a/src/Common/MsgEngine/src/private/MsgStructPrivate.h b/src/Common/MsgEngine/src/private/MsgStructPrivate.h index c106b998..99138306 100644 --- a/src/Common/MsgEngine/src/private/MsgStructPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgStructPrivate.h @@ -22,10 +22,8 @@ #include -namespace Msg -{ - class MsgStructPrivate - { +namespace Msg { + class MsgStructPrivate { public: inline MsgStructPrivate(bool release, msg_struct_t msgStruct = nullptr); inline virtual ~MsgStructPrivate(); @@ -49,9 +47,7 @@ namespace Msg inline MsgStructPrivate::~MsgStructPrivate() { if (m_Release && m_MsgStruct) - { msg_release_struct(&m_MsgStruct); - } } inline void MsgStructPrivate::set(msg_struct_t msgStruct) diff --git a/src/Common/MsgEngine/src/private/MsgThreadItemPrivate.h b/src/Common/MsgEngine/src/private/MsgThreadItemPrivate.h index 2d3f1e82..dfe3ede0 100644 --- a/src/Common/MsgEngine/src/private/MsgThreadItemPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgThreadItemPrivate.h @@ -22,12 +22,10 @@ #include "MsgStructListPrivate.h" #include "MsgStructPrivate.h" -namespace Msg -{ +namespace Msg { class MsgThreadItemPrivate : public MsgStructPrivate - , public MsgThreadItem - { + , public MsgThreadItem { public: MsgThreadItemPrivate(bool release, msg_struct_t msgStruct = nullptr); virtual ~MsgThreadItemPrivate(); diff --git a/src/Common/MsgEngine/src/private/MsgTransportPrivate.cpp b/src/Common/MsgEngine/src/private/MsgTransportPrivate.cpp index a6baac71..aec9f477 100644 --- a/src/Common/MsgEngine/src/private/MsgTransportPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgTransportPrivate.cpp @@ -46,8 +46,7 @@ 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 { diff --git a/src/Common/MsgEngine/src/private/MsgTransportPrivate.h b/src/Common/MsgEngine/src/private/MsgTransportPrivate.h index cb7ba305..b58a3e08 100644 --- a/src/Common/MsgEngine/src/private/MsgTransportPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgTransportPrivate.h @@ -23,14 +23,12 @@ #include #include -namespace Msg -{ +namespace Msg { /** * @brief Private msg-service API specific implementation of sending messages routine. */ class MsgTransportPrivate - : public MsgTransport - { + : public MsgTransport { public: MsgTransportPrivate(msg_handle_t serviceHandle); virtual ~MsgTransportPrivate(); diff --git a/src/Common/MsgEngine/src/private/MsgUtilsPrivate.cpp b/src/Common/MsgEngine/src/private/MsgUtilsPrivate.cpp index 6cc6ee6b..bf527fc7 100644 --- a/src/Common/MsgEngine/src/private/MsgUtilsPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgUtilsPrivate.cpp @@ -21,11 +21,9 @@ using namespace Msg; int MsgUtilsPrivate::directionToNative(Message::Direction direction) { - switch (direction) - { + switch (direction) { case Message::MD_Sent: return MSG_DIRECTION_TYPE_MO; - case Message::MD_Received: return MSG_DIRECTION_TYPE_MT; } @@ -35,11 +33,9 @@ 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; - case MSG_DIRECTION_TYPE_MT: return Message::MD_Received; } @@ -49,11 +45,9 @@ Message::Direction MsgUtilsPrivate::nativeToDirection(int direction) Message::MessageStorageType MsgUtilsPrivate::nativeToMessageStorage(int id) { - switch (id) - { + switch (id) { case MSG_STORAGE_PHONE: return Message::MS_Phone; - case MSG_STORAGE_SIM: return Message::MS_Sim; } @@ -63,14 +57,11 @@ Message::MessageStorageType MsgUtilsPrivate::nativeToMessageStorage(int id) int MsgUtilsPrivate::addressTypeToNative(MsgAddress::AddressType type) { - switch (type) - { + switch (type) { case MsgAddress::Phone: return MSG_ADDRESS_TYPE_PLMN; - case MsgAddress::Email: return MSG_ADDRESS_TYPE_EMAIL; - default: case MsgAddress::UnknownAddressType: return MSG_ADDRESS_TYPE_UNKNOWN; @@ -79,14 +70,11 @@ int MsgUtilsPrivate::addressTypeToNative(MsgAddress::AddressType type) MsgAddress::AddressType MsgUtilsPrivate::nativeToAddressType(int type) { - switch (type) - { + switch (type) { case MSG_ADDRESS_TYPE_PLMN: return MsgAddress::Phone; - case MSG_ADDRESS_TYPE_EMAIL: return MsgAddress::Email; - default: case MSG_ADDRESS_TYPE_UNKNOWN: return MsgAddress::UnknownAddressType; @@ -96,17 +84,13 @@ MsgAddress::AddressType MsgUtilsPrivate::nativeToAddressType(int type) MsgReport::DeliveryStatus MsgUtilsPrivate::nativeToReportDeliveryStatus(int status) { - switch (status) - { + switch (status) { case MSG_DELIVERY_REPORT_SUCCESS: return MsgReport::StatusSuccess; - case MSG_DELIVERY_REPORT_EXPIRED: return MsgReport::StatusExpired; - case MSG_DELIVERY_REPORT_REJECTED: return MsgReport::StatusRejected; - default: case MSG_DELIVERY_REPORT_NONE: return MsgReport::StatusNone; @@ -115,17 +99,13 @@ 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; - case MSG_READ_REPORT_IS_DELETED: return MsgReport::ReadStatusIsDeleted; - case MSG_READ_REPORT_REJECT_BY_USER: return MsgReport::ReadStatusRejectByUser; - default: case MSG_READ_REPORT_NONE: return MsgReport::ReadStatusNone; @@ -134,17 +114,13 @@ 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; - case MsgReport::ReadStatusIsDeleted: return MSG_READ_REPORT_IS_DELETED; - case MsgReport::ReadStatusRejectByUser: return MSG_READ_REPORT_REJECT_BY_USER; - default: case MsgReport::ReadStatusNone: return MSG_READ_REPORT_NONE; @@ -153,14 +129,11 @@ int MsgUtilsPrivate::reportReadReportStatusToNative(MsgReport::ReadStatus status MsgReport::Type MsgUtilsPrivate::nativeToReportType(int type) { - switch (type) - { + switch (type) { case MSG_REPORT_TYPE_READ: return MsgReport::TypeRead; - case MSG_REPORT_TYPE_READ_REPORT_SENT: return MsgReport::TypeReadReportSent; - default: case MSG_REPORT_TYPE_DELIVERY: return MsgReport::TypeDelivery; @@ -169,17 +142,13 @@ MsgReport::Type MsgUtilsPrivate::nativeToReportType(int type) int MsgUtilsPrivate::recipientTypeToNative(MsgAddress::RecipientType type) { - switch (type) - { + switch (type) { case MsgAddress::To: return MSG_RECIPIENTS_TYPE_TO; - case MsgAddress::Cc: return MSG_RECIPIENTS_TYPE_CC; - case MsgAddress::Bcc: return MSG_RECIPIENTS_TYPE_BCC; - default: case MsgAddress::UnknownRecipientType: return MSG_RECIPIENTS_TYPE_UNKNOWN; @@ -188,17 +157,13 @@ int MsgUtilsPrivate::recipientTypeToNative(MsgAddress::RecipientType type) MsgAddress::RecipientType MsgUtilsPrivate::nativeToRecipientType(int type) { - switch (type) - { + switch (type) { case MSG_RECIPIENTS_TYPE_TO: return MsgAddress::To; - case MSG_RECIPIENTS_TYPE_CC: return MsgAddress::Cc; - case MSG_RECIPIENTS_TYPE_BCC: return MsgAddress::Bcc; - default: case MSG_RECIPIENTS_TYPE_UNKNOWN: return MsgAddress::UnknownRecipientType; @@ -207,8 +172,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: case MSG_TYPE_SMS_JAVACB: @@ -241,8 +205,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; case MMS_SMIL_MEDIA_AUDIO: @@ -257,8 +220,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; case MsgMedia::AudioType: @@ -278,9 +240,8 @@ 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) - { res.assign(buf); - } + return res; } @@ -291,8 +252,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; case MSG_NETWORK_SENDING: @@ -334,8 +294,7 @@ Message::NetworkStatus MsgUtilsPrivate::nativeToNetworkStatus(int status) int MsgUtilsPrivate::activeNotifPolicyToNative(MsgSettings::ActiveNotifPolicy policy) { - switch (policy) - { + switch (policy) { case MsgSettings::AppBackgroundPolicy: return -1; case MsgSettings::AppForegroundPolicy: @@ -348,8 +307,7 @@ int MsgUtilsPrivate::activeNotifPolicyToNative(MsgSettings::ActiveNotifPolicy po MsgTransport::SendResult MsgUtilsPrivate::nativeToSendResult(int sendRes) { - switch (sendRes) - { + switch (sendRes) { case MSG_SUCCESS: return MsgTransport::SendSuccess; case MSG_ERR_NO_SIM: @@ -367,8 +325,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; case MSG_RINGTONE_TYPE_USER: @@ -381,8 +338,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; case MsgSettings::UserRingtone: @@ -394,8 +350,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; break; diff --git a/src/Common/MsgEngine/src/private/MsgUtilsPrivate.h b/src/Common/MsgEngine/src/private/MsgUtilsPrivate.h index 04eae910..ea77284d 100644 --- a/src/Common/MsgEngine/src/private/MsgUtilsPrivate.h +++ b/src/Common/MsgEngine/src/private/MsgUtilsPrivate.h @@ -31,10 +31,8 @@ #include #include -namespace Msg -{ - class MsgUtilsPrivate - { +namespace Msg { + class MsgUtilsPrivate { public: static int directionToNative(Message::Direction direction); static int addressTypeToNative(MsgAddress::AddressType type); diff --git a/src/Common/SystemSettingsManager/inc/SystemSettingsManager.h b/src/Common/SystemSettingsManager/inc/SystemSettingsManager.h index cf206ca2..e10de89e 100644 --- a/src/Common/SystemSettingsManager/inc/SystemSettingsManager.h +++ b/src/Common/SystemSettingsManager/inc/SystemSettingsManager.h @@ -21,15 +21,13 @@ #include #include -namespace Msg -{ +namespace Msg { class ISystemSettingsManager; /** * @brief Monitors changing of time format and system language. Also reads telephony settings. */ - class SystemSettingsManager - { + class SystemSettingsManager { public: /** * @brief A constructor initializes telephony handle to make system settings manager instance to read telephony settings. @@ -92,8 +90,7 @@ namespace Msg /** * @brief A listener-interface that should be implemented by subscriber in order to be notified about time format or nsystem language change. */ - class ISystemSettingsManager - { + class ISystemSettingsManager { public: virtual ~ISystemSettingsManager() {} diff --git a/src/Common/SystemSettingsManager/src/SystemSettingsManager.cpp b/src/Common/SystemSettingsManager/src/SystemSettingsManager.cpp index 163e0c27..e1cf548b 100644 --- a/src/Common/SystemSettingsManager/src/SystemSettingsManager.cpp +++ b/src/Common/SystemSettingsManager/src/SystemSettingsManager.cpp @@ -23,8 +23,7 @@ using namespace Msg; -namespace -{ +namespace { const char *sim1Id = "sim1"; } @@ -76,8 +75,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; telephony_sim_get_state(handle, &simState); @@ -93,12 +91,10 @@ 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); } @@ -117,17 +113,13 @@ bool SystemSettingsManager::isMobileDataEnabled() const void SystemSettingsManager::onTimeFormatChanged() { for (ISystemSettingsManager *it : m_Listeners) - { it->onTimeFormatChanged(); - } } void SystemSettingsManager::onLanguageChanged() { for (ISystemSettingsManager *it : m_Listeners) - { it->onLanguageChanged(); - } } bool SystemSettingsManager::isMessagingRestrictedByDpm() const @@ -146,8 +138,7 @@ void SystemSettingsManager::initDpmHandle() const void SystemSettingsManager::deinitDpmHandle() { - if (m_DpmHandle) - { + if (m_DpmHandle) { dpm_manager_destroy(m_DpmHandle); m_DpmHandle = nullptr; } diff --git a/src/Common/Utils/inc/BidirectUtils.h b/src/Common/Utils/inc/BidirectUtils.h index 8fe28945..8ee152f0 100644 --- a/src/Common/Utils/inc/BidirectUtils.h +++ b/src/Common/Utils/inc/BidirectUtils.h @@ -19,10 +19,8 @@ #include -namespace Msg -{ - class BidiUtils - { +namespace Msg { + class BidiUtils { public: static constexpr const char *lrmChar = "\u200E"; static constexpr const char *rlmChar = "\u200F"; diff --git a/src/Common/Utils/inc/FileUtils.h b/src/Common/Utils/inc/FileUtils.h index 1d2f6309..71a9091a 100755 --- a/src/Common/Utils/inc/FileUtils.h +++ b/src/Common/Utils/inc/FileUtils.h @@ -20,10 +20,8 @@ #include #include -namespace Msg -{ - class FileUtils - { +namespace Msg { + class FileUtils { public: /** * @brief Get file size. diff --git a/src/Common/Utils/inc/HwButtonListener.h b/src/Common/Utils/inc/HwButtonListener.h index 27ed50d7..279183cb 100644 --- a/src/Common/Utils/inc/HwButtonListener.h +++ b/src/Common/Utils/inc/HwButtonListener.h @@ -20,10 +20,8 @@ #include #include -namespace Msg -{ - class IHwButtonListener - { +namespace Msg { + class IHwButtonListener { public: virtual ~IHwButtonListener() {}; virtual void onHwBackButtonClicked() {}; diff --git a/src/Common/Utils/inc/LangUtils.h b/src/Common/Utils/inc/LangUtils.h index 6d38a0be..d3ad1160 100644 --- a/src/Common/Utils/inc/LangUtils.h +++ b/src/Common/Utils/inc/LangUtils.h @@ -25,11 +25,9 @@ #include #include -namespace Msg -{ +namespace Msg { // Translatable Text - struct TText - { + struct TText { explicit TText(const char *stringId, const char *domainName) : m_pDomain(domainName) , m_pMsg(stringId) @@ -55,8 +53,7 @@ namespace Msg }; // dgettext - struct DText - { + struct DText { explicit DText(const char *stringId, const char *domainName) { m_pMsg = dgettext(domainName, stringId); diff --git a/src/Common/Utils/inc/LoggerImpl.h b/src/Common/Utils/inc/LoggerImpl.h index 20f7440d..03967ae6 100644 --- a/src/Common/Utils/inc/LoggerImpl.h +++ b/src/Common/Utils/inc/LoggerImpl.h @@ -21,8 +21,7 @@ #include #include -enum class LogPriority -{ +enum class LogPriority { DEFAULT = DLOG_DEFAULT, VERBOSE = DLOG_VERBOSE, /**< Verbose */ DEBUG = DLOG_DEBUG, /**< Debug */ @@ -31,7 +30,7 @@ enum class LogPriority ERROR = DLOG_ERROR, /**< Error */ FATAL = DLOG_FATAL, /**< Fatal */ SILEN = DLOG_SILENT, /**< Silent */ - MAX = DLOG_PRIO_MAX/**< Keep this always at the end. */ + MAX = DLOG_PRIO_MAX /**< Keep this always at the end. */ }; template diff --git a/src/Common/Utils/inc/MediaUtils.h b/src/Common/Utils/inc/MediaUtils.h index 53ec0661..f5abdb88 100644 --- a/src/Common/Utils/inc/MediaUtils.h +++ b/src/Common/Utils/inc/MediaUtils.h @@ -19,10 +19,8 @@ #include -namespace Msg -{ - class MediaUtils - { +namespace Msg { + class MediaUtils { public: static std::string getTitle(const std::string &path); static int getDuration(const std::string &uri); // msec; diff --git a/src/Common/Utils/inc/PathUtils.h b/src/Common/Utils/inc/PathUtils.h index eebbd20d..7d842e47 100644 --- a/src/Common/Utils/inc/PathUtils.h +++ b/src/Common/Utils/inc/PathUtils.h @@ -20,10 +20,8 @@ #include #include "Resource.h" -namespace Msg -{ - class PathUtils - { +namespace Msg { + class PathUtils { public: /** * @brief Gets the absolute path to file in the application resource directory. diff --git a/src/Common/Utils/inc/PhoneNumberUtils.h b/src/Common/Utils/inc/PhoneNumberUtils.h index 83a9a0b5..b86fbd5c 100644 --- a/src/Common/Utils/inc/PhoneNumberUtils.h +++ b/src/Common/Utils/inc/PhoneNumberUtils.h @@ -19,10 +19,8 @@ #include -namespace Msg -{ - class PhoneNumberUtils - { +namespace Msg { + class PhoneNumberUtils { public: static PhoneNumberUtils &getInst(); std::string getNormalizedNumber(const std::string &number) const; diff --git a/src/Common/Utils/inc/TextDecorator.h b/src/Common/Utils/inc/TextDecorator.h index 9b2cb419..54a29cac 100644 --- a/src/Common/Utils/inc/TextDecorator.h +++ b/src/Common/Utils/inc/TextDecorator.h @@ -19,18 +19,15 @@ #include -namespace Msg -{ - enum class TextAlign - { +namespace Msg { + enum class TextAlign { None, Left, Center, Right }; - class TextStyle - { + class TextStyle { public: static const char *defaultColor; static const char *whiteColor; @@ -58,8 +55,7 @@ namespace Msg /** * @brief Class with text decorator utils */ - class TextDecorator - { + class TextDecorator { public: static std::string make(const std::string &text, const TextStyle &style); static std::string make(const std::string &text, const std::string &color); diff --git a/src/Common/Utils/inc/ThumbnailMaker.h b/src/Common/Utils/inc/ThumbnailMaker.h index 64fa21d8..6ee4d6d5 100644 --- a/src/Common/Utils/inc/ThumbnailMaker.h +++ b/src/Common/Utils/inc/ThumbnailMaker.h @@ -23,18 +23,15 @@ #include "MsgAddress.h" #include "ContactManager.h" -namespace Msg -{ +namespace Msg { class App; typedef long ThumbId; const ThumbId invalidThumbId = -1; class ThumbnailMaker - : public IContactManagerListener - { + : public IContactManagerListener { public: - enum DefaultThumbs - { + enum DefaultThumbs { SingleThumb = 0, // Static thumb GroupThumb, // Static thumb OwnerThumb, // Mutable thumb diff --git a/src/Common/Utils/inc/TimeUtils.h b/src/Common/Utils/inc/TimeUtils.h index 5ae37389..a4125633 100644 --- a/src/Common/Utils/inc/TimeUtils.h +++ b/src/Common/Utils/inc/TimeUtils.h @@ -20,12 +20,9 @@ #include #include -namespace Msg -{ - class TimeUtils - { - enum TimeFormat - { +namespace Msg { + class TimeUtils { + enum TimeFormat { TimeFormatUnknown, TimeFormat24H, TimeFormat12H diff --git a/src/Common/Utils/inc/VCalendarParser.h b/src/Common/Utils/inc/VCalendarParser.h index 977bc22f..db6fb0fb 100644 --- a/src/Common/Utils/inc/VCalendarParser.h +++ b/src/Common/Utils/inc/VCalendarParser.h @@ -21,10 +21,8 @@ #include #include -namespace Msg -{ - class CalendarEvent - { +namespace Msg { + class CalendarEvent { public: CalendarEvent(calendar_record_h record); @@ -36,8 +34,7 @@ namespace Msg std::string m_StartDate; }; - class VCalendarParser - { + class VCalendarParser { public: static VCalendarParser &getInst(); static std::list parse(const std::string &filePath); diff --git a/src/Common/Utils/src/FileUtils.cpp b/src/Common/Utils/src/FileUtils.cpp index 923e595b..41ee1c47 100755 --- a/src/Common/Utils/src/FileUtils.cpp +++ b/src/Common/Utils/src/FileUtils.cpp @@ -39,9 +39,7 @@ long long FileUtils::getFileSize(const std::string &file) struct stat st = {}; if (stat(file.c_str(), &st) == 0) - { size = st.st_size; - } return size; } @@ -71,16 +69,13 @@ bool FileUtils::copy(const std::string &src, const std::string &dst) 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) - { - if (fwrite(buf, 1, num, f2) != num) - { + while ((num = fread(buf, 1, sizeof(buf), f1)) > 0) { + if (fwrite(buf, 1, num, f2) != num) { ret = false; } } @@ -104,11 +99,9 @@ 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 { @@ -127,9 +120,7 @@ bool FileUtils::isDir(const std::string &file) struct stat st = {}; if (stat(file.c_str(), &st) == 0) - { res = S_ISDIR(st.st_mode); - } return res; } @@ -152,8 +143,7 @@ void FileUtils::splitPath(const std::string &path, std::string &basePath, 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) fileName = name.substr(0, pos); @@ -175,18 +165,15 @@ bool FileUtils::remove(const std::string &path, bool removeCurrentDir) struct dirent *dirData = nullptr; DIR *dp = opendir(path.c_str()); - if (dp) - { - while (true) - { + if (dp) { + while (true) { dirData = nullptr; readdir_r(dp, &ep, &dirData); 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); } @@ -194,9 +181,7 @@ bool FileUtils::remove(const std::string &path, bool removeCurrentDir) closedir(dp); if (removeCurrentDir) - { res &= rmdir(path.c_str()) == 0; - } } else { res &= unlink(path.c_str()) == 0; } @@ -227,8 +212,7 @@ std::string FileUtils::genUniqueFilePath(const std::string &storagePath, const s splitPath(filePath, base, name, ext); unsigned i = 0; - do - { + do { res = storagePath; if (res.back() != '/') res += '/'; @@ -250,12 +234,10 @@ 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); free(mime); @@ -284,9 +266,8 @@ bool FileUtils::saveFilesToStorage(const std::list &files) return false; for (const std::string &file : files) - { res &= saveFileToStoragePrivate(file); - } + media_content_disconnect(); return res; } diff --git a/src/Common/Utils/src/HwButtonListener.cpp b/src/Common/Utils/src/HwButtonListener.cpp index 360a4551..8edf6988 100644 --- a/src/Common/Utils/src/HwButtonListener.cpp +++ b/src/Common/Utils/src/HwButtonListener.cpp @@ -33,8 +33,7 @@ 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); diff --git a/src/Common/Utils/src/LoggerImpl.cpp b/src/Common/Utils/src/LoggerImpl.cpp index d1f89bc0..5cfb1fd1 100644 --- a/src/Common/Utils/src/LoggerImpl.cpp +++ b/src/Common/Utils/src/LoggerImpl.cpp @@ -16,8 +16,7 @@ #include "LoggerImpl.h" -namespace -{ +namespace { const std::string enterFraseFormat = "%s: %s(%d) -> [ENTER]"; const std::string leaveFraseFormat = "%s: %s -> [LEAVE]"; const log_priority defaultPriority = DLOG_DEBUG; diff --git a/src/Common/Utils/src/MediaUtils.cpp b/src/Common/Utils/src/MediaUtils.cpp index 7464d6d0..7bf8f152 100644 --- a/src/Common/Utils/src/MediaUtils.cpp +++ b/src/Common/Utils/src/MediaUtils.cpp @@ -26,23 +26,19 @@ using namespace Msg; -namespace -{ +namespace { const int QUALITY = 50; const unsigned char EXIF_HEADER[] = { 0xff, 0xd8, 0xff, 0xe1 }; const unsigned int EXIF_HEADER_LEN = sizeof(EXIF_HEADER); const unsigned int JPEG_HEADER_OFFSET = 20; - class MetadataExtractor - { + class MetadataExtractor { public: 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; } @@ -77,8 +73,7 @@ namespace std::string res; char *cStr = nullptr; metadata_extractor_get_metadata(m_Metadata, attr, &cStr); - if (cStr) - { + if (cStr) { res = cStr; free(cStr); } @@ -111,8 +106,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); } @@ -148,14 +142,12 @@ 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; } @@ -165,8 +157,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); return false; @@ -233,26 +224,20 @@ long long MediaUtils::downgradeImageQuality(const std::string &imagePath) exifData = exif_data_new_from_file(imagePath.c_str()); if (exifData) - { exif_data_save_data(exifData, &exifBuff, &exifBuffLen); - } res = image_util_decode_create(&decode_h); 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); } @@ -260,62 +245,51 @@ 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) - { return FileUtils::getFileSize(imagePath); - } res = image_util_encode_create(IMAGE_UTIL_JPEG, &encode_h); 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); return FileUtils::getFileSize(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); // Write EXIF block length in big-endian order diff --git a/src/Common/Utils/src/PathUtils.cpp b/src/Common/Utils/src/PathUtils.cpp index 569acdf3..024f6f78 100644 --- a/src/Common/Utils/src/PathUtils.cpp +++ b/src/Common/Utils/src/PathUtils.cpp @@ -27,11 +27,9 @@ 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,11 +45,9 @@ 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,8 +63,7 @@ std::string PathUtils::getResourcePath() { std::string res; char* resPath = app_get_resource_path(); - if (resPath) - { + if (resPath) { res = resPath; free(resPath); } @@ -80,17 +75,14 @@ std::string PathUtils::getLocalePath() { std::string resPath(getResourcePath()); if (!resPath.empty()) - { resPath.append("locale"); - } return resPath; } 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; return false; @@ -112,8 +104,7 @@ const std::string &PathUtils::getDownloadPath() 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 b9c6bb0e..5737ce16 100644 --- a/src/Common/Utils/src/PhoneNumberUtils.cpp +++ b/src/Common/Utils/src/PhoneNumberUtils.cpp @@ -33,8 +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 491adcf2..02bfbe76 100644 --- a/src/Common/Utils/src/TextDecorator.cpp +++ b/src/Common/Utils/src/TextDecorator.cpp @@ -30,12 +30,10 @@ const int TextStyle::defaultFontSize = 28; #define OPEN_TAG(name, val) "<" name "=" << (val) << ">" #define CLOSE_TAG(name) "" -namespace -{ +namespace { const char *alignAsString(TextAlign align) { - switch (align) - { + switch (align) { case TextAlign::Center: return "center"; case TextAlign::Left: @@ -119,14 +117,12 @@ std::string TextDecorator::make(const std::string &text, std::ostringstream ss; ss << OPEN_TAG("font_size", size) << OPEN_TAG("color", color); if (align != TextAlign::None) - { ss << OPEN_TAG("align", alignAsString(align)); - } + ss << text; if (align != TextAlign::None) - { ss << CLOSE_TAG("align"); - } + ss << CLOSE_TAG("color") << CLOSE_TAG("font_size"); return ss.str(); } diff --git a/src/Common/Utils/src/ThumbnailMaker.cpp b/src/Common/Utils/src/ThumbnailMaker.cpp index 5f3c3823..8584f716 100644 --- a/src/Common/Utils/src/ThumbnailMaker.cpp +++ b/src/Common/Utils/src/ThumbnailMaker.cpp @@ -42,9 +42,7 @@ ThumbnailMaker::ThumbnailMaker(App &app) m_OriginsMap.reserve(defaultCache); for (int i = 0; i <= maxStaticThumbId; i++) - { getThumbId((DefaultThumbs)i); - } } ThumbnailMaker::~ThumbnailMaker() @@ -65,8 +63,7 @@ ThumbId ThumbnailMaker::getThumbId(const std::string &address) ThumbId ThumbnailMaker::getThumbIdFromFile(const std::string &path) { - if (path.empty()) - { + if (path.empty()) { return getThumbId(SingleThumb); } else { auto it = m_ContactsMap.find(path); @@ -83,13 +80,11 @@ 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 { Evas_Object *origin = nullptr; - if (thumb != OwnerThumb) - { + if (thumb != OwnerThumb) { origin = makeDefaultOriginThumb(m_App.getWindow(), defaultThumbsToPath(thumb)); } else { ContactMyProfileRef ownerProfile = m_App.getContactManager().getOwnerProfile(); @@ -105,8 +100,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; } @@ -179,10 +173,8 @@ void ThumbnailMaker::invalidate() // m_OriginsMap: auto originsIt = m_OriginsMap.begin(); - for (; originsIt != m_OriginsMap.end();) - { - if (originsIt->first > maxStaticThumbId) - { + for (; originsIt != m_OriginsMap.end();) { + if (originsIt->first > maxStaticThumbId) { MSG_LOG(originsIt->first); evas_object_del(originsIt->second); originsIt = m_OriginsMap.erase(originsIt); @@ -193,8 +185,7 @@ void ThumbnailMaker::invalidate() // m_ContactsMap: auto contactsIt = m_ContactsMap.begin(); - for (; contactsIt != m_ContactsMap.end();) - { + for (; contactsIt != m_ContactsMap.end();) { if (contactsIt->second > maxStaticThumbId) contactsIt = m_ContactsMap.erase(contactsIt); else @@ -208,8 +199,7 @@ const std::string &ThumbnailMaker::defaultThumbsToStr(DefaultThumbs thumb) static const std::string gThumb = "GroupThumb"; static const std::string oThumb = "OwnerThumb"; static const std::string emptyThumb = ""; - switch (thumb) - { + switch (thumb) { case SingleThumb: return sThumb; case GroupThumb: @@ -223,8 +213,7 @@ const std::string &ThumbnailMaker::defaultThumbsToStr(DefaultThumbs thumb) std::string ThumbnailMaker::defaultThumbsToPath(DefaultThumbs thumb) { - switch (thumb) - { + switch (thumb) { case SingleThumb: return PathUtils::getResourcePath(THUMB_CONTACT_IMG_PATH); case GroupThumb: diff --git a/src/Common/Utils/src/TimeUtils.cpp b/src/Common/Utils/src/TimeUtils.cpp index 3c0b855c..7a2bf016 100644 --- a/src/Common/Utils/src/TimeUtils.cpp +++ b/src/Common/Utils/src/TimeUtils.cpp @@ -29,8 +29,7 @@ using namespace Msg; -namespace -{ +namespace { const int maxUcharLen = 64; const int maxCharLen = 128; const int defBufLen = 512; @@ -63,8 +62,7 @@ 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 { @@ -152,8 +150,7 @@ 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("."); @@ -173,8 +170,7 @@ std::string TimeUtils::getTimezone() ssize_t len = readlink("/opt/etc/localtime", buf, sizeof(buf) - 1); int filePathLength = 20; - if (len != -1) - { + if (len != -1) { buf[len] = '\0'; } else { MSG_LOG_ERROR("Getting default timezone failed, use system settings value"); @@ -183,8 +179,7 @@ std::string TimeUtils::getTimezone() 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,8 +253,7 @@ std::string TimeUtils::getFormattedDate(const std::string &locale, const std::st 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); /* convert uchar to char */ diff --git a/src/Common/Utils/src/VCalendarParser.cpp b/src/Common/Utils/src/VCalendarParser.cpp index ccc0d9a8..b40cbaf7 100644 --- a/src/Common/Utils/src/VCalendarParser.cpp +++ b/src/Common/Utils/src/VCalendarParser.cpp @@ -31,10 +31,8 @@ CalendarEvent::CalendarEvent(calendar_record_h record) m_Summary = summary; calendar_time_s start = {}; - if (calendar_record_get_caltime(record, _calendar_event.start_time, &start) == 0) - { - if (start.type == CALENDAR_TIME_UTIME) // Unix time - { + if (calendar_record_get_caltime(record, _calendar_event.start_time, &start) == 0) { + if (start.type == CALENDAR_TIME_UTIME) { // Unix time m_StartDate = TimeUtils::makeCalEventString(start.time.utime); } else { // Local time m_StartDate = TimeUtils::makeCalEventString @@ -91,12 +89,10 @@ 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)) diff --git a/src/Common/View/inc/AtspiAccessibleInterface.h b/src/Common/View/inc/AtspiAccessibleInterface.h index eadd3f7e..73aecf37 100644 --- a/src/Common/View/inc/AtspiAccessibleInterface.h +++ b/src/Common/View/inc/AtspiAccessibleInterface.h @@ -21,13 +21,11 @@ #include "Config.h" #include -namespace Msg -{ +namespace Msg { /** * @brief Wrapper for Elm_Interface_Atspi_Accessible interface (Screen reader) */ - class AtspiAccessibleInterface - { + class AtspiAccessibleInterface { public: AtspiAccessibleInterface(Elm_Interface_Atspi_Accessible *obj); void wrap(Elm_Interface_Atspi_Accessible *obj); diff --git a/src/Common/View/inc/BaseView.h b/src/Common/View/inc/BaseView.h index 840e2b7a..6d2ce11d 100644 --- a/src/Common/View/inc/BaseView.h +++ b/src/Common/View/inc/BaseView.h @@ -20,13 +20,11 @@ #include #include "PathUtils.h" -namespace Msg -{ +namespace Msg { /** * @brief Basic interface for all visual objects used across the whole application. */ - class BaseView - { + class BaseView { public: virtual ~BaseView() {}; virtual void destroy() = 0; diff --git a/src/Common/View/inc/Box.h b/src/Common/View/inc/Box.h index 75f6de8f..33ce3936 100644 --- a/src/Common/View/inc/Box.h +++ b/src/Common/View/inc/Box.h @@ -20,14 +20,12 @@ #include "View.h" #include -namespace Msg -{ +namespace Msg { /** * @brief Wraps all basic Box operations. */ class Box - : public View - { + : public View { public: Box(Evas_Object *parent); virtual ~Box(); diff --git a/src/Common/View/inc/ContextPopup.h b/src/Common/View/inc/ContextPopup.h index 28077d80..010f0cd6 100644 --- a/src/Common/View/inc/ContextPopup.h +++ b/src/Common/View/inc/ContextPopup.h @@ -24,8 +24,7 @@ #include #include -namespace Msg -{ +namespace Msg { class ContextPopup; class ContextPopupItem; class Window; @@ -38,8 +37,7 @@ namespace Msg typedef void (*ContextPopupItemPressedCb)(ContextPopupItem &item, void *userData); class ContextPopupItem - : public ViewItem - { + : public ViewItem { friend class ContextPopup; public: @@ -58,8 +56,7 @@ namespace Msg }; class ContextPopup - : public View - { + : public View { public: ContextPopup(Evas_Object *parent); virtual ~ContextPopup(); diff --git a/src/Common/View/inc/DefaultLayout.h b/src/Common/View/inc/DefaultLayout.h index ec6f6d9e..09bbc7f4 100644 --- a/src/Common/View/inc/DefaultLayout.h +++ b/src/Common/View/inc/DefaultLayout.h @@ -19,11 +19,9 @@ #include "View.h" -namespace Msg -{ +namespace Msg { class DefaultLayout - : public View - { + : public View { public: DefaultLayout(Evas_Object *parent); virtual ~DefaultLayout(); diff --git a/src/Common/View/inc/ListItem.h b/src/Common/View/inc/ListItem.h index 171616d5..20d7529c 100644 --- a/src/Common/View/inc/ListItem.h +++ b/src/Common/View/inc/ListItem.h @@ -24,16 +24,14 @@ #include #include -namespace Msg -{ +namespace Msg { class ListView; class ListItemStyle; class ListItem; typedef std::shared_ptr ListItemStyleRef; typedef std::vector ListItemCollection; - class ListItemStyle - { + class ListItemStyle { public: ListItemStyle(const char *itemStyle, const char *decorateItemStyle = nullptr, @@ -59,8 +57,7 @@ namespace Msg * @brief Wraps all basic genlist item operations. */ class ListItem - : public ViewItem - { + : public ViewItem { friend class ListItemStyle; friend class ListView; diff --git a/src/Common/View/inc/ListView.h b/src/Common/View/inc/ListView.h index fe3596c8..3ec4acdc 100644 --- a/src/Common/View/inc/ListView.h +++ b/src/Common/View/inc/ListView.h @@ -22,16 +22,14 @@ #include -namespace Msg -{ +namespace Msg { class IListViewListener; /** * @brief Wraps all basic genlist operations. */ class ListView - : public View - { + : public View { public: /**@brief Function of comparing two list-items, used for sorted item insertion.*/ typedef int (*CmpFunc)(const ListItem &item1, const ListItem &item2); @@ -262,8 +260,7 @@ namespace Msg /** * @brief A listener-interface aimed to make subscribers to get notified about genlist events. */ - class IListViewListener - { + class IListViewListener { public: virtual ~IListViewListener() {}; @@ -292,11 +289,9 @@ 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) list.push_back(listItem); @@ -312,8 +307,7 @@ namespace Msg { T *res = nullptr; ListItem *next = &item; - do - { + do { next = getNextItem(*next); res = dynamic_cast(next); } while (next && !res); @@ -326,8 +320,7 @@ namespace Msg { T *res = nullptr; ListItem *prev = &item; - do - { + do { prev = getPrevItem(*prev); res = dynamic_cast(prev); } while (prev && !res); diff --git a/src/Common/View/inc/MbeRecipientViewItem.h b/src/Common/View/inc/MbeRecipientViewItem.h index 3d54c21d..7c254246 100644 --- a/src/Common/View/inc/MbeRecipientViewItem.h +++ b/src/Common/View/inc/MbeRecipientViewItem.h @@ -20,16 +20,14 @@ #include "ViewItem.h" #include "MsgAddress.h" -namespace Msg -{ +namespace Msg { class MbeRecipientsView; /** * @brief Wraps all basic multibutton entry item operations. */ class MbeRecipientItem - : public ViewItem - { + : public ViewItem { friend class MbeRecipientsView; public: diff --git a/src/Common/View/inc/MbeRecipientsView.h b/src/Common/View/inc/MbeRecipientsView.h index 4d6ad006..fe7e0a27 100644 --- a/src/Common/View/inc/MbeRecipientsView.h +++ b/src/Common/View/inc/MbeRecipientsView.h @@ -22,16 +22,14 @@ #include -namespace Msg -{ +namespace Msg { class IMbeRecipientsListener; /** * @brief Wraps all basic multibutton entry(mbe) operations. */ class MbeRecipientsView - : public View - { + : public View { public: MbeRecipientsView(Evas_Object *parent); virtual ~MbeRecipientsView(); @@ -86,8 +84,7 @@ namespace Msg /** * @brief A listener class that should be implemented by all mbe event subscribers. */ - class IMbeRecipientsListener - { + class IMbeRecipientsListener { public: virtual ~IMbeRecipientsListener() {}; diff --git a/src/Common/View/inc/NaviFrameItem.h b/src/Common/View/inc/NaviFrameItem.h index c74d4b1c..84de4d50 100644 --- a/src/Common/View/inc/NaviFrameItem.h +++ b/src/Common/View/inc/NaviFrameItem.h @@ -25,8 +25,7 @@ #include #include -namespace Msg -{ +namespace Msg { class NaviFrameView; class NaviFrameItem; typedef std::vector NaviFrameItemList; @@ -35,16 +34,14 @@ namespace Msg * @brief Wraps all basic Naviframe-item operations. */ class NaviFrameItem - : public ViewItem - { + : public ViewItem { friend class NaviFrameView; public: /** * @brief An identifiers of buttons that can be shown on the top naviframe-item. */ - enum NaviButtonId - { + enum NaviButtonId { NaviCancelButtonId = 0,/**< Cancel-button */ NaviOkButtonId, /**< OK-button */ NaviCenterButtonId, /**< Central-button */ @@ -104,16 +101,14 @@ namespace Msg * @brief A bar at the top of NaviFrameItem. */ class NaviFrameItem::NaviBar - : public View - { + : public View { friend class NaviFrameItem; public: /** * @brief An enumeration of colors that could be applied to Navibar's background. */ - enum NaviColorId - { + enum NaviColorId { NaviBlueColorId = 0,/**< Blue */ NaviWhiteColorId, /**< White */ NaviColorMax @@ -236,8 +231,7 @@ namespace Msg static void on_button_clicked(void *data, Evas_Object *obj, void *event_info); private: - struct ButtonStruct - { + struct ButtonStruct { ButtonStruct(Evas_Object *b = nullptr, const char *p = nullptr, const char *s = nullptr, const char *d = nullptr) : button(b) , part(p) diff --git a/src/Common/View/inc/NaviFrameView.h b/src/Common/View/inc/NaviFrameView.h index f140b944..ece8d6ae 100644 --- a/src/Common/View/inc/NaviFrameView.h +++ b/src/Common/View/inc/NaviFrameView.h @@ -21,14 +21,12 @@ #include "NaviFrameItem.h" #include -namespace Msg -{ +namespace Msg { /** * @brief Wraps all basic Naviframe operations. */ class NaviFrameView - : public View - { + : public View { public: NaviFrameView(Evas_Object *parent); NaviFrameView(View &parent); diff --git a/src/Common/View/inc/NoContentLayout.h b/src/Common/View/inc/NoContentLayout.h index 08005b3d..5234be9a 100644 --- a/src/Common/View/inc/NoContentLayout.h +++ b/src/Common/View/inc/NoContentLayout.h @@ -21,14 +21,12 @@ #include "LangUtils.h" #include -namespace Msg -{ +namespace Msg { /** * @brief A Layout that shows a message text when ThreadList is empty */ class NoContentLayout - : public View - { + : public View { public: NoContentLayout(Evas_Object *parent); virtual ~NoContentLayout(); diff --git a/src/Common/View/inc/Popup.h b/src/Common/View/inc/Popup.h index c05c5363..ab38e84f 100644 --- a/src/Common/View/inc/Popup.h +++ b/src/Common/View/inc/Popup.h @@ -23,8 +23,7 @@ #include #include -namespace Msg -{ +namespace Msg { class IPopupListener; class Popup; class PopupManager; @@ -36,13 +35,11 @@ namespace Msg } class Popup - : public View - { + : public View { public: static void defaultButtonCb(Popup &popup, int buttonId, void *userData); - enum ButtonID - { + enum ButtonID { OkButtonId, CancelButtonId }; diff --git a/src/Common/View/inc/PopupAttachmentListItem.h b/src/Common/View/inc/PopupAttachmentListItem.h index 5b3b2fb0..c4405434 100644 --- a/src/Common/View/inc/PopupAttachmentListItem.h +++ b/src/Common/View/inc/PopupAttachmentListItem.h @@ -19,15 +19,13 @@ #include "PopupListItem.h" -namespace Msg -{ +namespace Msg { /** * @brief A class of popup-for attach files */ class PopupAttachmentListItem - : public PopupCheckListItem - { + : public PopupCheckListItem { public: PopupAttachmentListItem(PopupList &parent, const std::string &text, const std::string &path, PopupListItemPressedCb cb, void *userData); diff --git a/src/Common/View/inc/PopupList.h b/src/Common/View/inc/PopupList.h index a0d4a037..f2eb8c2b 100644 --- a/src/Common/View/inc/PopupList.h +++ b/src/Common/View/inc/PopupList.h @@ -21,18 +21,15 @@ #include "ListView.h" #include "PopupListItem.h" -namespace Msg -{ +namespace Msg { /** * @brief A popup with list of available popup items. */ class PopupList : public Popup - , private IListViewListener - { + , private IListViewListener { public: - enum PopupListType - { + enum PopupListType { ListPopup, /**< Popup with title >*/ MoreMenuPopup /**< Popup without title, hides by more button and pause events >*/ }; diff --git a/src/Common/View/inc/PopupListItem.h b/src/Common/View/inc/PopupListItem.h index 395a665f..75bb7c84 100644 --- a/src/Common/View/inc/PopupListItem.h +++ b/src/Common/View/inc/PopupListItem.h @@ -19,8 +19,7 @@ #include "ListItem.h" -namespace Msg -{ +namespace Msg { class PopupList; class PopupListItem; @@ -34,8 +33,7 @@ namespace Msg /** * @brief Generic Popup-list item class */ - class PopupListItem: public ListItem - { + class PopupListItem: public ListItem { public: PopupListItem(PopupList &parent, PopupListItemPressedCb cb, void *userData); PopupList &getParent(); @@ -49,8 +47,7 @@ namespace Msg /** * @brief A class of popup-item with single text displayed. */ - class PopupTextListItem: public PopupListItem - { + class PopupTextListItem: public PopupListItem { public: PopupTextListItem(PopupList &parent, const std::string &text, PopupListItemPressedCb cb, void *userData); virtual ~PopupTextListItem(); @@ -63,8 +60,7 @@ namespace Msg /** * @brief A class of popup-item with text and check field. */ - class PopupCheckListItem: public PopupListItem - { + class PopupCheckListItem: public PopupListItem { public: PopupCheckListItem(PopupList &parent, const std::string &text, PopupListItemPressedCb cb, void *userData); virtual ~PopupCheckListItem(); diff --git a/src/Common/View/inc/PopupManager.h b/src/Common/View/inc/PopupManager.h index 9e1f807f..e803b0e5 100644 --- a/src/Common/View/inc/PopupManager.h +++ b/src/Common/View/inc/PopupManager.h @@ -21,15 +21,13 @@ #include "PopupList.h" #include "ContextPopup.h" -namespace Msg -{ +namespace Msg { class Window; /** * @brief A global instance that manages context popups and regular popups lifecycle in context of one window. */ - class PopupManager - { + class PopupManager { public: /** * @brief Creating PopupManager instance in context of specified window. diff --git a/src/Common/View/inc/Scroller.h b/src/Common/View/inc/Scroller.h index d922ea83..f320ebc9 100644 --- a/src/Common/View/inc/Scroller.h +++ b/src/Common/View/inc/Scroller.h @@ -20,11 +20,9 @@ #include "View.h" #include -namespace Msg -{ +namespace Msg { class Scroller - : public View - { + : public View { public: Scroller(Evas_Object *parent); virtual ~Scroller(); diff --git a/src/Common/View/inc/SelectAllListItem.h b/src/Common/View/inc/SelectAllListItem.h index d8fcc955..736c297a 100644 --- a/src/Common/View/inc/SelectAllListItem.h +++ b/src/Common/View/inc/SelectAllListItem.h @@ -21,11 +21,9 @@ #include -namespace Msg -{ +namespace Msg { class SelectAllListItem - : public ListItem - { + : public ListItem { public: SelectAllListItem(); virtual ~SelectAllListItem(); diff --git a/src/Common/View/inc/StandardWindow.h b/src/Common/View/inc/StandardWindow.h index 0ac53370..257b3139 100644 --- a/src/Common/View/inc/StandardWindow.h +++ b/src/Common/View/inc/StandardWindow.h @@ -19,11 +19,9 @@ #include "Window.h" -namespace Msg -{ +namespace Msg { class StandardWindow - : public Window - { + : public Window { public: StandardWindow(); virtual ~StandardWindow(); diff --git a/src/Common/View/inc/View.h b/src/Common/View/inc/View.h index a704da1b..589f09e7 100644 --- a/src/Common/View/inc/View.h +++ b/src/Common/View/inc/View.h @@ -25,14 +25,12 @@ #include #include -namespace Msg -{ +namespace Msg { /** * @brief Wraps all basic Evas_Object operations and manages automatic self-removal by EVAS_CALLBACK_FREE and EVAS_CALLBACK_DEL events. */ class View - : public BaseView - { + : public BaseView { public: View(); diff --git a/src/Common/View/inc/ViewItem.h b/src/Common/View/inc/ViewItem.h index 567cc178..57f7a5e4 100644 --- a/src/Common/View/inc/ViewItem.h +++ b/src/Common/View/inc/ViewItem.h @@ -23,14 +23,12 @@ #include -namespace Msg -{ +namespace Msg { /** * @brief Wraps all basic Elm_Object_Item operations and manages automatic self-removal by delete-callback. */ class ViewItem - : public BaseView - { + : public BaseView { public: ViewItem(); ViewItem(ViewItem&) = delete; diff --git a/src/Common/View/inc/Window.h b/src/Common/View/inc/Window.h index 4f659789..323df62c 100644 --- a/src/Common/View/inc/Window.h +++ b/src/Common/View/inc/Window.h @@ -20,14 +20,12 @@ #include "View.h" #include -namespace Msg -{ +namespace Msg { /** * @brief An interface that should be implemented by all window-classes across whole application. */ class Window - : public View - { + : public View { public: virtual ~Window() {}; diff --git a/src/Common/View/src/ContextPopup.cpp b/src/Common/View/src/ContextPopup.cpp index d9369b07..a9d508ae 100644 --- a/src/Common/View/src/ContextPopup.cpp +++ b/src/Common/View/src/ContextPopup.cpp @@ -55,8 +55,7 @@ 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 { delete newItem; @@ -118,8 +117,7 @@ void ContextPopup::align(Window &win) int pos = win.getRotation(); win.getScreenSize(nullptr, nullptr, &w, &h); - switch (pos) - { + switch (pos) { case 0: case 180: move(w/2, h); diff --git a/src/Common/View/src/DefaultLayout.cpp b/src/Common/View/src/DefaultLayout.cpp index 723b0bdd..2c71541c 100644 --- a/src/Common/View/src/DefaultLayout.cpp +++ b/src/Common/View/src/DefaultLayout.cpp @@ -18,8 +18,7 @@ using namespace Msg; -namespace -{ +namespace { const char *floatingPart = "elm.swallow.floatingbutton"; } @@ -52,8 +51,7 @@ 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 { diff --git a/src/Common/View/src/ListItem.cpp b/src/Common/View/src/ListItem.cpp index 6b7ea692..c71a5ae5 100644 --- a/src/Common/View/src/ListItem.cpp +++ b/src/Common/View/src/ListItem.cpp @@ -125,8 +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()); } @@ -141,13 +140,10 @@ Evas_Object *ListItem::elm_gen_item_content_get_cb(void * data, Evas_Object * ob if (!self) return nullptr; - if (self->getOwner()->getCheckMode()) - { + if (self->getOwner()->getCheckMode()) { const char *checkPart = self->getCheckPart(*self); if (checkPart && strcmp(checkPart, part) == 0) - { return self->addCheck(); - } } return self->getContent(*self, part); diff --git a/src/Common/View/src/ListView.cpp b/src/Common/View/src/ListView.cpp index 007d1585..bae81cca 100644 --- a/src/Common/View/src/ListView.cpp +++ b/src/Common/View/src/ListView.cpp @@ -23,8 +23,7 @@ using namespace Msg; -namespace -{ +namespace { inline ListItem *getItem(Elm_Object_Item *obj) { return obj ? static_cast(elm_object_item_data_get(obj)) : nullptr; @@ -135,12 +134,10 @@ 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); } @@ -154,13 +151,11 @@ 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; - EINA_LIST_FOREACH(list, l, obj) - { + EINA_LIST_FOREACH(list, l, obj) { collection.push_back(getItem((Elm_Object_Item *)obj)); } @@ -246,8 +241,7 @@ 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"); @@ -269,17 +263,13 @@ bool ListView::getCheckMode() const void ListView::checkAllItems(bool check, bool updateFullItem) { for (ListItem *item: getItems()) - { item->setCheckedState(check, false); - } if (updateFullItem) updateRealizedItems(); else for (ListItem *item: getRealizedItems()) - { item->updateFields(item->getCheckPart(*item), ELM_GENLIST_ITEM_FIELD_ALL); - } } void ListView::updateRealizedItems() @@ -302,8 +292,7 @@ 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 { diff --git a/src/Common/View/src/MbeRecipientsView.cpp b/src/Common/View/src/MbeRecipientsView.cpp index 5260edc1..c6ecbd42 100644 --- a/src/Common/View/src/MbeRecipientsView.cpp +++ b/src/Common/View/src/MbeRecipientsView.cpp @@ -36,8 +36,7 @@ MbeRecipientsView::MbeRecipientsView(Evas_Object *parent) MbeRecipientsView::~MbeRecipientsView() { - if (m_pChangedJob) - { + if (m_pChangedJob) { ecore_job_del(m_pChangedJob); m_pChangedJob = nullptr; } @@ -63,8 +62,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); elmItem = elm_multibuttonentry_item_next_get(elmItem); diff --git a/src/Common/View/src/NaviFrameItem.cpp b/src/Common/View/src/NaviFrameItem.cpp index a49bc766..76eac2ab 100644 --- a/src/Common/View/src/NaviFrameItem.cpp +++ b/src/Common/View/src/NaviFrameItem.cpp @@ -22,8 +22,7 @@ using namespace Msg; -namespace -{ +namespace { const char *titleStyleName = "title"; const char *naviTitlePart = "title"; const char *titleTextPart = "text.center"; @@ -86,8 +85,7 @@ bool NaviFrameItem::isPopping() const void NaviFrameItem::setTitleVisibility(bool visible) { - if (visible) - { + if (visible) { setContent(*m_pNaviBar, naviTitlePart); evas_object_show(*m_pNaviBar); } else { @@ -145,8 +143,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; elm_object_style_set(btn, m_ButtonList[id].style); @@ -158,8 +155,7 @@ 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) @@ -167,15 +163,13 @@ void NaviFrameItem::NaviBar::showButton(NaviButtonId id, bool value) setButtonColor(id, m_CurrentColor); evas_object_show(m_ButtonList[id].button); } else { - if (getContent(m_ButtonList[id].part) == m_ButtonList[id].button) - { + 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); break; @@ -219,8 +213,7 @@ 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) { emitSignal("left,clear", "*"); @@ -280,8 +273,7 @@ void NaviFrameItem::onAttached(ViewItem &item) void NaviFrameItem::NaviBar::setColor(NaviColorId id) { - switch (id) - { + switch (id) { case NaviBlueColorId: emitSignal("title,color,blue", "*"); m_CurrentColor = NaviBlueColorId; @@ -302,8 +294,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); break; @@ -327,8 +318,7 @@ void NaviFrameItem::NaviBar::setButtonText(NaviButtonId id, const TText &text) void NaviFrameItem::NaviBar::setButtonColor(NaviButtonId id, NaviColorId titleColor) { // Note that, button's color is opposite to title's color - if (id == NaviPrevButtonId || id == NaviExpandButtonId) - { + if (id == NaviPrevButtonId || id == NaviExpandButtonId) { switch (titleColor) { case NaviBlueColorId: @@ -345,8 +335,7 @@ void NaviFrameItem::NaviBar::setButtonColor(NaviButtonId id, NaviColorId titleCo } else { TextStyle style; - switch (titleColor) - { + switch (titleColor) { case NaviBlueColorId: style.setColor(textColorWhiteTitleButtons); break; @@ -361,9 +350,7 @@ void NaviFrameItem::NaviBar::setButtonColor(NaviButtonId id, NaviColorId titleCo style.setSize(getTextSize(id)); const char *buttonText = elm_object_text_get(m_ButtonList[id].button); if (buttonText != nullptr) - { elm_object_text_set(m_ButtonList[id].button, TextDecorator::make(buttonText, style).c_str()); - } } } @@ -371,9 +358,8 @@ void NaviFrameItem::NaviBar::clear() { emitSignal("sides,clear", "*"); for (int iter = NaviCancelButtonId; iter < NaviButtonMax; iter++) - { evas_object_hide(elm_object_part_content_unset(getEo(), m_ButtonList[iter].part)); - } + showCenterButtonPart(false); } diff --git a/src/Common/View/src/NaviFrameView.cpp b/src/Common/View/src/NaviFrameView.cpp index bae61a88..60fb53ac 100644 --- a/src/Common/View/src/NaviFrameView.cpp +++ b/src/Common/View/src/NaviFrameView.cpp @@ -76,8 +76,7 @@ int NaviFrameView::getItemsCount() const { int res = 0; Eina_List *list = elm_naviframe_items_get(getEo()); - if (list) - { + if (list) { res = eina_list_count(list); eina_list_free(list); } @@ -89,13 +88,11 @@ NaviFrameItemList NaviFrameView::getItems() const NaviFrameItemList result; Eina_List *list = elm_naviframe_items_get(getEo()); - if (list) - { + if (list) { Eina_List *l = nullptr; void *obj = nullptr; - EINA_LIST_FOREACH(list, l, obj) - { + EINA_LIST_FOREACH(list, l, obj) { NaviFrameItem *item = static_cast(elm_object_item_data_get((Elm_Object_Item*)obj)); result.push_back(item); } @@ -137,12 +134,10 @@ 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) - { + if (getTopFrame() == &item) { m_TransitionStatus = getItemsCount() > 1; pause(); elm_naviframe_item_pop(getEo()); @@ -160,8 +155,7 @@ 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 { @@ -176,8 +170,7 @@ void NaviFrameView::insertToBottom(NaviFrameItem &item) void NaviFrameView::promote(NaviFrameItem &item) { bool isTop = &item == getTopFrame(); - if (!isTop) - { + if (!isTop) { m_TransitionStatus = true; pause(); elm_naviframe_item_promote(item); @@ -192,8 +185,7 @@ 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) transFinishedItem = nullptr; item->destroy(); diff --git a/src/Common/View/src/Popup.cpp b/src/Common/View/src/Popup.cpp index 55fa604d..557bf919 100644 --- a/src/Common/View/src/Popup.cpp +++ b/src/Common/View/src/Popup.cpp @@ -24,8 +24,7 @@ using namespace Msg; -namespace -{ +namespace { const char *buttonIdKey = "id"; const char *buttonCbKey = "cb"; const char *buttonCbDataKey = "cb-data"; @@ -55,8 +54,7 @@ Popup::Popup(PopupManager &parent) Popup::~Popup() { MSG_LOG("Destructor"); - if (m_pShowIdler) - { + if (m_pShowIdler) { ecore_idler_del(m_pShowIdler); m_pShowIdler = nullptr; } @@ -151,8 +149,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); evas_object_data_set(btn, buttonIdKey, (void*)(intptr_t)buttonId); @@ -191,12 +188,10 @@ void Popup::setTitle(const TText &title) void Popup::show(bool deferred) { - if (!deferred) - { + if (!deferred) { View::show(); } else { - if (!m_pShowIdler) - { + if (!m_pShowIdler) { m_pShowIdler = ecore_idler_add ( [](void *data)->Eina_Bool @@ -214,8 +209,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); int buttonId = (int)(intptr_t)evas_object_data_get(obj, buttonIdKey); diff --git a/src/Common/View/src/PopupList.cpp b/src/Common/View/src/PopupList.cpp index b3463725..a6b3fbc5 100644 --- a/src/Common/View/src/PopupList.cpp +++ b/src/Common/View/src/PopupList.cpp @@ -61,8 +61,7 @@ void PopupList::create(PopupListType type) //set popup's behavior setDismissByOutsideTapFlag(true); - if (type == MoreMenuPopup) - { + if (type == MoreMenuPopup) { setDismissByMoreMenuKeyFlag(true); setDismissByPauseAppFlag(true); } diff --git a/src/Common/View/src/PopupManager.cpp b/src/Common/View/src/PopupManager.cpp index 0036b513..ee8bdf5d 100644 --- a/src/Common/View/src/PopupManager.cpp +++ b/src/Common/View/src/PopupManager.cpp @@ -40,10 +40,8 @@ PopupManager::~PopupManager() void PopupManager::reset(void *popupOwner) { - if (!popupOwner || (popupOwner == m_pPopupOwner)) - { - if (m_pPopup) - { + if (!popupOwner || (popupOwner == m_pPopupOwner)) { + if (m_pPopup) { m_pPopup->View::destroy(); m_pPopup = nullptr; } @@ -54,8 +52,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); m_pPopup = &popup; diff --git a/src/Common/View/src/SelectAllListItem.cpp b/src/Common/View/src/SelectAllListItem.cpp index 448e8fa2..33f617ed 100644 --- a/src/Common/View/src/SelectAllListItem.cpp +++ b/src/Common/View/src/SelectAllListItem.cpp @@ -21,8 +21,7 @@ using namespace Msg; -namespace -{ +namespace { ListItemStyleRef style = ListItemStyle::create("type1"); const char *textPart = "elm.text"; const char *checkPart = "elm.swallow.end"; @@ -45,9 +44,7 @@ const char *SelectAllListItem::getCheckPart(ListItem &item) std::string SelectAllListItem::getText(ListItem &item, const char *part) { if (strcmp(part, textPart) == 0) - { return msg("IDS_MSG_MBODY_SELECT_ALL"); - } return ""; } diff --git a/src/Common/View/src/View.cpp b/src/Common/View/src/View.cpp index 7ccdfd8b..31852709 100644 --- a/src/Common/View/src/View.cpp +++ b/src/Common/View/src/View.cpp @@ -24,8 +24,7 @@ using namespace Msg; -namespace -{ +namespace { const char *thisKey = "this"; } @@ -53,8 +52,7 @@ 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 { MSG_LOG_ERROR("Not implemented"); @@ -64,15 +62,13 @@ 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); setEventCb(EVAS_CALLBACK_DEL); @@ -82,8 +78,7 @@ 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 { MSG_LOG_ERROR("Not implemented"); @@ -161,8 +156,7 @@ std::string Msg::markupToUtf8(const char *str) std::string res; char *markup = elm_entry_markup_to_utf8(str); - if (markup) - { + if (markup) { res = markup; free(markup); } @@ -177,8 +171,7 @@ std::string Msg::utf8ToMarkup(const char *str) std::string res; char *markup = elm_entry_utf8_to_markup(str); - if (markup) - { + if (markup) { res = markup; free(markup); } diff --git a/src/Conversation/AppControl/inc/AttachPanel.h b/src/Conversation/AppControl/inc/AttachPanel.h index 4ed5bff4..843a2599 100644 --- a/src/Conversation/AppControl/inc/AttachPanel.h +++ b/src/Conversation/AppControl/inc/AttachPanel.h @@ -23,12 +23,10 @@ #include #include -namespace Msg -{ +namespace Msg { class IAttachPanelListener; - class AttachPanel - { + class AttachPanel { public: typedef std::list FileList; @@ -56,8 +54,7 @@ namespace Msg IAttachPanelListener *m_pListener; }; - class IAttachPanelListener - { + class IAttachPanelListener { public: virtual ~IAttachPanelListener() {} virtual void onFileSelected(AttachPanel &panel, const AttachPanel::FileList &files) {}; diff --git a/src/Conversation/AppControl/inc/ContactPicker.h b/src/Conversation/AppControl/inc/ContactPicker.h index 643db174..033dd405 100644 --- a/src/Conversation/AppControl/inc/ContactPicker.h +++ b/src/Conversation/AppControl/inc/ContactPicker.h @@ -20,16 +20,14 @@ #include "AppControlUtils.h" #include "AppControlLauncher.h" -namespace Msg -{ +namespace Msg { class IContactPickerListener; /** * @brief An utility-class aimed to launch contacts-application with pick-operation passed via app-control. */ class ContactPicker - : public AppControlHandle - { + : public AppControlHandle { public: ContactPicker(); @@ -52,16 +50,13 @@ namespace Msg IContactPickerListener *m_pListener; }; - class IContactPickerListener - { + class IContactPickerListener { public: - enum AddressType - { + enum AddressType { PhoneType, EmailType }; - struct ResultData - { + struct ResultData { AddressType type; int id; }; diff --git a/src/Conversation/AppControl/inc/SettingsNetwork.h b/src/Conversation/AppControl/inc/SettingsNetwork.h index 9ba3f3be..800aa0d5 100644 --- a/src/Conversation/AppControl/inc/SettingsNetwork.h +++ b/src/Conversation/AppControl/inc/SettingsNetwork.h @@ -19,11 +19,9 @@ #include "AppControlLauncher.h" -namespace Msg -{ +namespace Msg { class SettingsNetwork - : public AppControlHandle - { + : public AppControlHandle { public: SettingsNetwork(); void launch(); diff --git a/src/Conversation/AppControl/src/AttachPanel.cpp b/src/Conversation/AppControl/src/AttachPanel.cpp index 070ca6eb..fefd734d 100644 --- a/src/Conversation/AppControl/src/AttachPanel.cpp +++ b/src/Conversation/AppControl/src/AttachPanel.cpp @@ -23,8 +23,7 @@ using namespace Msg; -namespace -{ +namespace { const char *appControlTotalSize = "http://tizen.org/appcontrol/data/total_size"; const char *appControlTotalCount = "http://tizen.org/appcontrol/data/total_count"; } @@ -60,8 +59,7 @@ void AttachPanel::show(bool value) void AttachPanel::reset() { - if (m_Handle) - { + if (m_Handle) { attach_panel_hide(m_Handle); attach_panel_destroy(m_Handle); m_Handle = nullptr; @@ -90,8 +88,7 @@ attach_panel_h AttachPanel::getAttachPanel() return m_Handle; attach_panel_create(m_App.getWindow().getConformEvasObject(), &m_Handle); - if (m_Handle) - { + if (m_Handle) { bundle *extraData = bundle_create(); int maxMmsSize = m_App.getMsgEngine().getSettings().getMaxMmsSize(); @@ -103,8 +100,7 @@ attach_panel_h AttachPanel::getAttachPanel() std::string maxAttachment = std::to_string(m_App.getMsgEngine().getSettings().getAttachmentsMaxCount()); bundle_add_str(extraData, appControlTotalCount, maxAttachment.c_str()); - if (extraData) - { + if (extraData) { attach_panel_add_content_category(m_Handle, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE, extraData); attach_panel_add_content_category(m_Handle, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA, extraData); attach_panel_add_content_category(m_Handle, ATTACH_PANEL_CONTENT_CATEGORY_VOICE, extraData); diff --git a/src/Conversation/AppControl/src/ContactPicker.cpp b/src/Conversation/AppControl/src/ContactPicker.cpp index aee6357f..0d9f1af0 100644 --- a/src/Conversation/AppControl/src/ContactPicker.cpp +++ b/src/Conversation/AppControl/src/ContactPicker.cpp @@ -19,8 +19,7 @@ using namespace Msg; -namespace -{ +namespace { const char* mimeContact = "application/vnd.tizen.contact"; const char* single = "single"; const char* multiple = "multiple"; @@ -43,10 +42,8 @@ void ContactPicker::setListener(IContactPickerListener *pListener) bool ContactPicker::launch(size_t howManyToPick) { bool res = false; - if (m_Handle) - { - if (howManyToPick > 1) - { + if (m_Handle) { + if (howManyToPick > 1) { app_control_add_extra_data(m_Handle, APP_CONTROL_DATA_SELECTION_MODE, multiple); app_control_add_extra_data(m_Handle, APP_CONTROL_DATA_TOTAL_COUNT, std::to_string(howManyToPick).c_str()); } else { @@ -64,8 +61,7 @@ bool ContactPicker::launch(size_t howManyToPick) void ContactPicker::onReply(app_control_h request, app_control_h reply, app_control_result_e result) { - if (result == APP_CONTROL_RESULT_SUCCEEDED) - { + if (result == APP_CONTROL_RESULT_SUCCEEDED) { std::list addressIds; std::list types; std::list result; @@ -76,8 +72,7 @@ void ContactPicker::onReply(app_control_h request, app_control_h reply, app_cont int minLen = std::min(addressIds.size(), types.size()); auto itId = addressIds.begin(); auto itType = types.begin(); - for (int i = 0; i < minLen; ++i, ++itId, ++itType) - { + for (int i = 0; i < minLen; ++i, ++itId, ++itType) { if (*itType == typePhone) { result.push_back({IContactPickerListener::PhoneType, *itId}); } else if (*itType == typeEmail) { diff --git a/src/Conversation/Body/Controller/inc/Body.h b/src/Conversation/Body/Controller/inc/Body.h index c872227a..7d2218a7 100644 --- a/src/Conversation/Body/Controller/inc/Body.h +++ b/src/Conversation/Body/Controller/inc/Body.h @@ -30,8 +30,7 @@ #include #include -namespace Msg -{ +namespace Msg { class IBodyListener; class App; class PopupListItem; @@ -42,8 +41,7 @@ namespace Msg class Body : public BodyView , private IAttachmentHandlerListener - , private IComposeListItemListener - { + , private IComposeListItemListener { public: Body(Evas_Object *parent, App &app, WorkingDirRef workingDir, ConvList &convList); virtual ~Body(); @@ -126,8 +124,7 @@ namespace Msg int m_Utf8TextSize; }; - class IBodyListener - { + class IBodyListener { public: virtual ~IBodyListener() {} diff --git a/src/Conversation/Body/Controller/src/Body.cpp b/src/Conversation/Body/Controller/src/Body.cpp index 82479043..da32c926 100644 --- a/src/Conversation/Body/Controller/src/Body.cpp +++ b/src/Conversation/Body/Controller/src/Body.cpp @@ -31,8 +31,7 @@ using namespace Msg; -namespace -{ +namespace { const std::string contactFileName = "Contact.vcf"; const std::string contactsFileName = "Contacts.vcf"; } @@ -58,8 +57,7 @@ Body::Body(Evas_Object *parent, App &app, WorkingDirRef workingDir, ConvList &co Body::~Body() { - if (m_pOnChangedJob) - { + if (m_pOnChangedJob) { ecore_job_del(m_pOnChangedJob); m_pOnChangedJob = nullptr; } @@ -122,8 +120,7 @@ void Body::addAttachment(const std::string &filePath) void Body::addFileToPage(MessageMms &msg, const std::string &filePath) { static const int defaultPageDuration = 5000; // msec - if (!filePath.empty()) - { + if (!filePath.empty()) { MsgPage &msgPage = msg.addPage(); MediaTypeData mediaData = getMsgMediaTypeByFileExt(filePath); int pageDuration = 0; @@ -142,8 +139,7 @@ void Body::addFileToPage(MessageMms &msg, const std::string &filePath) void Body::runFileProcessing() { - if (!m_SelectedFiles.empty()) - { + if (!m_SelectedFiles.empty()) { long long freeSpace = m_App.getMsgEngine().getSettings().getMaxMmsSize() - getMsgSize(); if (freeSpace < FileUtils::getFileSize(m_SelectedFiles.front())) showResizingPopup(); @@ -167,8 +163,7 @@ void Body::setMmsRecipFlag(bool value) void Body::updateTextMetricIfNeeded() { - if (m_TextMetricNeedUpdate) - { + if (m_TextMetricNeedUpdate) { std::string text = getPlainUtf8Text(); m_Utf8TextSize = text.length(); MsgEngine::calculateTextMetric(text, m_TextMetric); @@ -189,9 +184,7 @@ long long Body::getMsgSize() // Attachments: auto attachments = getComposeItem().getAttachments(); for (auto *attachment : attachments) - { totalSize += attachment->getFileSize(); - } // Text: updateTextMetricIfNeeded(); @@ -239,22 +232,18 @@ void Body::writeAttachments(const MessageMms &msg) // Pages: const MsgPageList &pages = msg.getPageList(); int pageCount = pages.getLength(); - for (int pageIndex = 0; pageIndex < pageCount; ++pageIndex) - { + for (int pageIndex = 0; pageIndex < pageCount; ++pageIndex) { const MsgPage &page = pages[pageIndex]; // Media: const MsgMediaList &mediaList = page.getMediaList(); int mediaCount = mediaList.getLength(); - for (int mediaIndex = 0; mediaIndex < mediaCount; ++mediaIndex) - { + for (int mediaIndex = 0; mediaIndex < mediaCount; ++mediaIndex) { const MsgMedia &media = mediaList[mediaIndex]; std::string filePath = media.getFilePath(); - if (!filePath.empty()) - { + if (!filePath.empty()) { std::string mime = FileUtils::getMimeType(filePath); - if (mime != "text/plain") // Skip text on page - { + if (mime != "text/plain") { // Skip text on page std::string newFilePath = m_WorkingDir->addFile(filePath); getComposeItem().addAttachment(newFilePath); } @@ -265,15 +254,12 @@ void Body::writeAttachments(const MessageMms &msg) // Attachments: const MsgAttachmentList &attachments = msg.getAttachmentList(); int attachmentCount = attachments.getLength(); - for (int i = 0; i < attachmentCount; ++i) - { + for (int i = 0; i < attachmentCount; ++i) { const MsgAttachment &attachment = attachments[i]; std::string filePath = attachment.getFilePath(); - if (!filePath.empty()) - { + if (!filePath.empty()) { std::string mime = FileUtils::getMimeType(filePath); - if (mime != "application/smil") // Skip SMIL layout - { + if (mime != "application/smil") { // Skip SMIL layout std::string newFilePath = m_WorkingDir->addFile(filePath); getComposeItem().addAttachment(newFilePath); } @@ -303,35 +289,28 @@ void Body::read(MessageMms &msg) void Body::readAttachments(MessageMms &msg) { const auto &attachments = getComposeItem().getAttachments(); - for (auto *attach : attachments) - { + for (auto *attach : attachments) { const std::string &filePath = attach->getFilePath(); if (filePath.empty()) continue; - switch (getMsgMediaTypeByFileExt(filePath).type) - { + switch (getMsgMediaTypeByFileExt(filePath).type) { case MsgMedia::ImageType: case MsgMedia::AudioType: case MsgMedia::VideoType: - { addFileToPage(msg, filePath); break; - } default: - { MsgAttachment &msgAttach = msg.addAttachment(); msgAttach.setFilePath(filePath); break; - } } } } void Body::readText(MessageMms &msg) { - if (!BodyView::isEmpty()) - { + if (!BodyView::isEmpty()) { writeTextToFile(); addFileToPage(msg, m_MmsTextFilePath); } @@ -350,8 +329,7 @@ void Body::execCmd(const AppControlComposeRef &cmd) void Body::execCmd(const AppControlDefaultRef &cmd) { - if (cmd->getDefaultType() == AppControlDefault::ReplyType) - { + if (cmd->getDefaultType() == AppControlDefault::ReplyType) { clear(); setText(cmd->getReplyText()); } @@ -366,12 +344,10 @@ void Body::onMaxLengthReached() void Body::onCheckBoundaryText(char **text) { MSG_LOG(""); - if (isMms()) - { + if (isMms()) { long long maxSize = m_App.getMsgEngine().getSettings().getMaxMmsSize(); std::string utfText = markupToUtf8(*text); - if (getMsgSize() + static_cast(utfText.size()) > maxSize) - { + if (getMsgSize() + static_cast(utfText.size()) > maxSize) { free(*text); *text = nullptr; showMaxCharactersPopup(); @@ -388,15 +364,13 @@ PopupList &Body::createPopupList(const std::string &title) void Body::showTooLargePopup(const std::list &tooBigFiles) { - if (!m_TooLargePopupShow) - { + if (!m_TooLargePopupShow) { Popup &popup = m_App.getPopupManager().getPopup(); popup.addEventCb(EVAS_CALLBACK_DEL, EVAS_EVENT_CALLBACK(Body, onTooLargePopupDel), this); popup.addButton(msgt("IDS_MSG_BUTTON_OK_ABB"), Popup::OkButtonId); popup.setTitle(msgt("IDS_MSG_HEADER_FILE_SIZE_TOO_LARGE_ABB")); std::string content(msg("IDS_MSG_POP_UNABLE_TO_ATTACH_FILE_FILE_SIZE_TOO_LARGE_TRY_SENDING_VIA_EMAIL_BLUETOOTH_WI_FI_ETC")); - for (auto& file: tooBigFiles) - { + for (auto& file: tooBigFiles) { content.append("
"); content.append(FileUtils::getFileName(file)); } @@ -415,8 +389,7 @@ void Body::showTooMuchAttachedPopup() void Body::showResizingPopup() { - if (!m_ResizingPopupShow) - { + if (!m_ResizingPopupShow) { Popup &popup = m_App.getPopupManager().getPopup(); popup.addEventCb(EVAS_CALLBACK_DEL, EVAS_EVENT_CALLBACK(Body, onResizingPopupDel), this); int maxSize = m_App.getMsgEngine().getSettings().getMaxMmsSize(); @@ -459,8 +432,7 @@ std::string Body::createVcfFile(const AppControlComposeRef &cmd) std::string content; std::string path; - if (cmd->getComposeType() == AppControlCompose::OpShare) - { + if (cmd->getComposeType() == AppControlCompose::OpShare) { content = m_App.getContactManager().makeVcard(*idList.begin(), cmd->getVcfInfo().isMyProfile); path = contactFileName; } else if (cmd->getComposeType() == AppControlCompose::OpMultiShare) { @@ -475,8 +447,7 @@ std::string Body::createVcfFile(const AppControlComposeRef &cmd) void Body::notifyContentChanged() { - if (!m_pOnChangedJob) - { + if (!m_pOnChangedJob) { m_pOnChangedJob = ecore_job_add( [](void *data) { @@ -503,9 +474,8 @@ void Body::onAttachmentAdded(const std::list &files) void Body::onAttachmentDeleted(const std::list &files) { for (const std::string &file : files) - { m_WorkingDir->removeFile(file); - } + notifyContentChanged(); } @@ -513,8 +483,7 @@ void Body::onFileReady(const std::string &filePath) { int numAttached = getComposeItem().getAttachments().size(); int numAttachMax = m_App.getMsgEngine().getSettings().getAttachmentsMaxCount(); - if (numAttached == numAttachMax) - { + if (numAttached == numAttachMax) { std::queue empty; std::swap(m_SelectedFiles, empty); showTooMuchAttachedPopup(); @@ -529,8 +498,7 @@ void Body::onFileReady(const std::string &filePath) BodyView::setFocus(true); m_SelectedFiles.pop(); - if (!m_SelectedFiles.empty()) - { + if (!m_SelectedFiles.empty()) { long long freeSpace = m_App.getMsgEngine().getSettings().getMaxMmsSize() - getMsgSize(); if (freeSpace < FileUtils::getFileSize(m_SelectedFiles.front())) showResizingPopup(); @@ -543,8 +511,7 @@ void Body::onFileReady(const std::string &filePath) void Body::onFileFails() { std::list overflowList; - while (!m_SelectedFiles.empty()) - { + while (!m_SelectedFiles.empty()) { overflowList.push_back(m_SelectedFiles.front()); m_SelectedFiles.pop(); } diff --git a/src/Conversation/Body/View/inc/BodyView.h b/src/Conversation/Body/View/inc/BodyView.h index 9365ba70..0306e3a9 100644 --- a/src/Conversation/Body/View/inc/BodyView.h +++ b/src/Conversation/Body/View/inc/BodyView.h @@ -24,8 +24,7 @@ namespace Msg { class BodyView - : public View - { + : public View { public: BodyView(Evas_Object *parent, int maxCharCount); virtual ~BodyView(); diff --git a/src/Conversation/Body/View/src/BodyView.cpp b/src/Conversation/Body/View/src/BodyView.cpp index 2cb25bec..26721ab4 100644 --- a/src/Conversation/Body/View/src/BodyView.cpp +++ b/src/Conversation/Body/View/src/BodyView.cpp @@ -24,8 +24,7 @@ using namespace Msg; -namespace -{ +namespace { #define maxBodyHeight ELM_SCALE_SIZE(360) } @@ -62,11 +61,9 @@ void BodyView::clear() void BodyView::setText(const std::string &text) { - if (!text.empty()) - { + if (!text.empty()) { char *markupText = elm_entry_utf8_to_markup(text.c_str()); - if (markupText) - { + if (markupText) { elm_object_text_set(m_pEntry, markupText); free(markupText); } @@ -92,11 +89,9 @@ std::string BodyView::getPlainUtf8Text() const std::string res; const char *plainText = elm_entry_entry_get(m_pEntry); - if (plainText) - { + if (plainText) { char *text = elm_entry_markup_to_utf8(plainText); - if (text) - { + if (text) { res.assign(text); free(text); } diff --git a/src/Conversation/ContactList/Controller/inc/ContactListItem.h b/src/Conversation/ContactList/Controller/inc/ContactListItem.h index c7283287..e232572b 100644 --- a/src/Conversation/ContactList/Controller/inc/ContactListItem.h +++ b/src/Conversation/ContactList/Controller/inc/ContactListItem.h @@ -22,11 +22,9 @@ #include "ContactAddress.h" #include "App.h" -namespace Msg -{ +namespace Msg { class ContactListItem - : public ContactListViewItem - { + : public ContactListViewItem { public: ContactListItem(const ContactPersonPhoneLog &rec, App &app, const std::string &searchWord); ContactListItem(const ContactAddress &rec, App &app, const std::string &searchWord); diff --git a/src/Conversation/ContactList/Controller/inc/ConvContactList.h b/src/Conversation/ContactList/Controller/inc/ConvContactList.h index aad01591..59c91dae 100644 --- a/src/Conversation/ContactList/Controller/inc/ConvContactList.h +++ b/src/Conversation/ContactList/Controller/inc/ConvContactList.h @@ -23,14 +23,12 @@ #include -namespace Msg -{ +namespace Msg { class IConvContactListListener; class ConvContactList : public ConvContactListView - , private IListViewListener - { + , private IListViewListener { public: ConvContactList(Evas_Object *parent, App &app); virtual ~ConvContactList(); @@ -58,8 +56,7 @@ namespace Msg std::string m_SearchWord; }; - class IConvContactListListener - { + class IConvContactListListener { public: virtual ~IConvContactListListener() {} diff --git a/src/Conversation/ContactList/Controller/src/ConvContactList.cpp b/src/Conversation/ContactList/Controller/src/ConvContactList.cpp index a10d7647..c59d5234 100644 --- a/src/Conversation/ContactList/Controller/src/ConvContactList.cpp +++ b/src/Conversation/ContactList/Controller/src/ConvContactList.cpp @@ -34,8 +34,7 @@ ConvContactList::ConvContactList(Evas_Object *parent, App &app) ConvContactList::~ConvContactList() { - if (m_pPredictSearchIdler) - { + if (m_pPredictSearchIdler) { ecore_idler_del(m_pPredictSearchIdler); m_pPredictSearchIdler = nullptr; } @@ -73,8 +72,7 @@ void ConvContactList::requestSearch() void ConvContactList::search() { getList().clear(); - if (!m_SearchWord.empty()) - { + if (!m_SearchWord.empty()) { search(); search(); search(); @@ -87,13 +85,10 @@ template void ConvContactList::search() { auto list = m_App.getContactManager().search(m_SearchWord); - if (list) - { - do - { + if (list) { + do { auto &rec = list->get(); - if (MsgUtils::isValidAddress(rec.getAddress())) - { + if (MsgUtils::isValidAddress(rec.getAddress())) { ContactListItem *item = new ContactListItem(rec, m_App, m_SearchWord); getList().appendItem(*item); } else { diff --git a/src/Conversation/ContactList/View/inc/ContactListViewItem.h b/src/Conversation/ContactList/View/inc/ContactListViewItem.h index 8a91a6d0..be4235b4 100644 --- a/src/Conversation/ContactList/View/inc/ContactListViewItem.h +++ b/src/Conversation/ContactList/View/inc/ContactListViewItem.h @@ -20,11 +20,9 @@ #include "ListItem.h" #include -namespace Msg -{ +namespace Msg { class ContactListViewItem - : public ListItem - { + : public ListItem { public: ContactListViewItem(); virtual ~ContactListViewItem(); diff --git a/src/Conversation/ContactList/View/inc/ConvContactListView.h b/src/Conversation/ContactList/View/inc/ConvContactListView.h index d9d6aaf6..502213da 100644 --- a/src/Conversation/ContactList/View/inc/ConvContactListView.h +++ b/src/Conversation/ContactList/View/inc/ConvContactListView.h @@ -19,11 +19,9 @@ #include "ListView.h" -namespace Msg -{ +namespace Msg { class ConvContactListView - : public View - { + : public View { public: ConvContactListView(Evas_Object *parent); virtual ~ConvContactListView(); diff --git a/src/Conversation/ContactList/View/src/ContactListViewItem.cpp b/src/Conversation/ContactList/View/src/ContactListViewItem.cpp index 97e76daf..7c2e57a8 100644 --- a/src/Conversation/ContactList/View/src/ContactListViewItem.cpp +++ b/src/Conversation/ContactList/View/src/ContactListViewItem.cpp @@ -33,25 +33,20 @@ ContactListViewItem::~ContactListViewItem() std::string ContactListViewItem::getText(ListItem &item, const char *part) { - if (getStyle() == nameOrEmailStyle) - { + if (getStyle() == nameOrEmailStyle) { const char *mainTextPart = "elm.text"; const char *subTextPart = "elm.text.sub"; - if (strcmp(part, mainTextPart) == 0) - { + if (strcmp(part, mainTextPart) == 0) { return getMainText(); } else if (strcmp(part, subTextPart) == 0) { return getSubText(); } } - if (getStyle() == logStyle) - { + if (getStyle() == logStyle) { const char *mainTextPart = "elm.text"; if (strcmp(part, mainTextPart) == 0) - { return getMainText(); - } } return ""; @@ -60,8 +55,7 @@ std::string ContactListViewItem::getText(ListItem &item, const char *part) Evas_Object *ContactListViewItem::getContent(ListItem &item, const char *part) { if (strcmp(part, "elm.swallow.icon") == 0) - { return getThumbnail(); - } + return nullptr; } diff --git a/src/Conversation/ConvList/Controller/inc/BubbleAudioEntity.h b/src/Conversation/ConvList/Controller/inc/BubbleAudioEntity.h index dbe3572f..b2a247bf 100644 --- a/src/Conversation/ConvList/Controller/inc/BubbleAudioEntity.h +++ b/src/Conversation/ConvList/Controller/inc/BubbleAudioEntity.h @@ -20,11 +20,9 @@ #include "BubbleAudioViewItem.h" #include "BubbleBgEntity.h" -namespace Msg -{ +namespace Msg { class BubbleAudioEntity - : public BubbleBgEntity - { + : public BubbleBgEntity { public: BubbleAudioEntity(const std::string &filePath, const std::string &fileName, BubbleBgViewItem::BgType bgType, Message::Direction direction); virtual ~BubbleAudioEntity(); diff --git a/src/Conversation/ConvList/Controller/inc/BubbleBgEntity.h b/src/Conversation/ConvList/Controller/inc/BubbleBgEntity.h index bdcc684a..48e9a187 100644 --- a/src/Conversation/ConvList/Controller/inc/BubbleBgEntity.h +++ b/src/Conversation/ConvList/Controller/inc/BubbleBgEntity.h @@ -20,11 +20,9 @@ #include "BubbleEntity.h" #include "BubbleBgViewItem.h" -namespace Msg -{ +namespace Msg { class BubbleBgEntity - : public BubbleEntity - { + : public BubbleEntity { public: BubbleBgEntity(Type type, BubbleBgViewItem::BgType bgType, Message::Direction direction, const std::string &filePath = ""); virtual ~BubbleBgEntity(); diff --git a/src/Conversation/ConvList/Controller/inc/BubbleCalEventEntity.h b/src/Conversation/ConvList/Controller/inc/BubbleCalEventEntity.h index 3b74142c..50b5d973 100644 --- a/src/Conversation/ConvList/Controller/inc/BubbleCalEventEntity.h +++ b/src/Conversation/ConvList/Controller/inc/BubbleCalEventEntity.h @@ -20,11 +20,9 @@ #include "BubbleCalEventViewItem.h" #include "BubbleBgEntity.h" -namespace Msg -{ +namespace Msg { class BubbleCalEventEntity - : public BubbleBgEntity - { + : public BubbleBgEntity { public: BubbleCalEventEntity(const std::string &filePath, const std::string &fileName, BubbleBgViewItem::BgType bgType, Message::Direction direction); virtual ~BubbleCalEventEntity(); diff --git a/src/Conversation/ConvList/Controller/inc/BubbleContactEntity.h b/src/Conversation/ConvList/Controller/inc/BubbleContactEntity.h index 0fd551d2..b630225e 100644 --- a/src/Conversation/ConvList/Controller/inc/BubbleContactEntity.h +++ b/src/Conversation/ConvList/Controller/inc/BubbleContactEntity.h @@ -22,11 +22,9 @@ #include "App.h" #include "Contact.h" -namespace Msg -{ +namespace Msg { class BubbleContactEntity - : public BubbleBgEntity - { + : public BubbleBgEntity { public: BubbleContactEntity(App &app, const std::string &filePath, const std::string &fileName, BubbleBgViewItem::BgType bgType, Message::Direction direction); virtual ~BubbleContactEntity(); diff --git a/src/Conversation/ConvList/Controller/inc/BubbleDownloadButtonEntity.h b/src/Conversation/ConvList/Controller/inc/BubbleDownloadButtonEntity.h index a8312f24..22b5d4d5 100644 --- a/src/Conversation/ConvList/Controller/inc/BubbleDownloadButtonEntity.h +++ b/src/Conversation/ConvList/Controller/inc/BubbleDownloadButtonEntity.h @@ -20,11 +20,9 @@ #include "BubbleDownloadButtonViewItem.h" #include "BubbleEntity.h" -namespace Msg -{ +namespace Msg { class BubbleDownloadButtonEntity - : public BubbleEntity - { + : public BubbleEntity { public: BubbleDownloadButtonEntity(); virtual ~BubbleDownloadButtonEntity(); diff --git a/src/Conversation/ConvList/Controller/inc/BubbleEntity.h b/src/Conversation/ConvList/Controller/inc/BubbleEntity.h index 32b3c0d4..c96831d5 100644 --- a/src/Conversation/ConvList/Controller/inc/BubbleEntity.h +++ b/src/Conversation/ConvList/Controller/inc/BubbleEntity.h @@ -25,13 +25,10 @@ #include -namespace Msg -{ - class BubbleEntity - { +namespace Msg { + class BubbleEntity { public: - enum Type - { + enum Type { TextItem, ImageItem, AudioItem, diff --git a/src/Conversation/ConvList/Controller/inc/BubbleEntityFactory.h b/src/Conversation/ConvList/Controller/inc/BubbleEntityFactory.h index a306f2a4..77f6ab13 100644 --- a/src/Conversation/ConvList/Controller/inc/BubbleEntityFactory.h +++ b/src/Conversation/ConvList/Controller/inc/BubbleEntityFactory.h @@ -33,10 +33,8 @@ #include -namespace Msg -{ - class BubbleEntityFactory - { +namespace Msg { + class BubbleEntityFactory { public: BubbleEntityFactory(App &app, WorkingDirRef workingDir); ~BubbleEntityFactory(); diff --git a/src/Conversation/ConvList/Controller/inc/BubbleImageEntity.h b/src/Conversation/ConvList/Controller/inc/BubbleImageEntity.h index 9f2d93f3..2bed0752 100644 --- a/src/Conversation/ConvList/Controller/inc/BubbleImageEntity.h +++ b/src/Conversation/ConvList/Controller/inc/BubbleImageEntity.h @@ -20,11 +20,9 @@ #include "BubbleImageViewItem.h" #include "BubbleEntity.h" -namespace Msg -{ +namespace Msg { class BubbleImageEntity - : public BubbleEntity - { + : public BubbleEntity { public: BubbleImageEntity(const std::string &filePath, Message::Direction direction); virtual ~BubbleImageEntity(); diff --git a/src/Conversation/ConvList/Controller/inc/BubbleTextEntity.h b/src/Conversation/ConvList/Controller/inc/BubbleTextEntity.h index 8ca3f086..9ab9ddd3 100644 --- a/src/Conversation/ConvList/Controller/inc/BubbleTextEntity.h +++ b/src/Conversation/ConvList/Controller/inc/BubbleTextEntity.h @@ -20,11 +20,9 @@ #include "BubbleTextViewItem.h" #include "BubbleBgEntity.h" -namespace Msg -{ +namespace Msg { class BubbleTextEntity - : public BubbleBgEntity - { + : public BubbleBgEntity { public: BubbleTextEntity(BubbleBgViewItem::BgType type, Message::Direction direction, std::string text); virtual ~BubbleTextEntity(); diff --git a/src/Conversation/ConvList/Controller/inc/BubbleUnknownFileEntity.h b/src/Conversation/ConvList/Controller/inc/BubbleUnknownFileEntity.h index a413f72e..9d6e928c 100644 --- a/src/Conversation/ConvList/Controller/inc/BubbleUnknownFileEntity.h +++ b/src/Conversation/ConvList/Controller/inc/BubbleUnknownFileEntity.h @@ -20,11 +20,9 @@ #include "BubbleUnknownFileViewItem.h" #include "BubbleBgEntity.h" -namespace Msg -{ +namespace Msg { class BubbleUnknownFileEntity - : public BubbleBgEntity - { + : public BubbleBgEntity { public: BubbleUnknownFileEntity(const std::string &filePath, const std::string &fileName, BubbleBgViewItem::BgType bgType, Message::Direction direction); virtual ~BubbleUnknownFileEntity(); diff --git a/src/Conversation/ConvList/Controller/inc/BubbleVideoEntity.h b/src/Conversation/ConvList/Controller/inc/BubbleVideoEntity.h index b379bfdb..1f8ca3cf 100644 --- a/src/Conversation/ConvList/Controller/inc/BubbleVideoEntity.h +++ b/src/Conversation/ConvList/Controller/inc/BubbleVideoEntity.h @@ -21,11 +21,9 @@ #include "BubbleEntity.h" #include "WorkingDir.h" -namespace Msg -{ +namespace Msg { class BubbleVideoEntity - : public BubbleEntity - { + : public BubbleEntity { public: BubbleVideoEntity(WorkingDirRef workingDir, const std::string &filePath, Message::Direction direction); virtual ~BubbleVideoEntity(); diff --git a/src/Conversation/ConvList/Controller/inc/ComposeListItem.h b/src/Conversation/ConvList/Controller/inc/ComposeListItem.h index ba1e942e..b86e08f2 100644 --- a/src/Conversation/ConvList/Controller/inc/ComposeListItem.h +++ b/src/Conversation/ConvList/Controller/inc/ComposeListItem.h @@ -22,16 +22,14 @@ #include -namespace Msg -{ +namespace Msg { class IComposeListItemListener; class FileViewer; typedef std::list BubbleEntityList; class ComposeListItem : public ComposeListViewItem - , private IBubbleViewItemListener - { + , private IBubbleViewItemListener { public: ComposeListItem(BubbleEntityFactory &entityFactory, FileViewer &fileViewer); virtual ~ComposeListItem(); @@ -60,8 +58,7 @@ namespace Msg FileViewer &m_FileViewer; }; - class IComposeListItemListener - { + class IComposeListItemListener { public: virtual ~IComposeListItemListener() {} virtual void onAttachmentAdded(const std::list &files) {}; diff --git a/src/Conversation/ConvList/Controller/inc/ConvList.h b/src/Conversation/ConvList/Controller/inc/ConvList.h index cbcbce81..cdc53c13 100644 --- a/src/Conversation/ConvList/Controller/inc/ConvList.h +++ b/src/Conversation/ConvList/Controller/inc/ConvList.h @@ -33,8 +33,7 @@ #include #include -namespace Msg -{ +namespace Msg { class IConvListListener; class ConvList @@ -43,11 +42,9 @@ namespace Msg , private IListViewListener , private IConvListItemListener , private IContactManagerListener - , private ISystemSettingsManager - { + , private ISystemSettingsManager { public: - enum Mode - { + enum Mode { NormalMode, SelectMode }; @@ -213,8 +210,7 @@ namespace Msg Share m_Share; }; - class IConvListListener - { + class IConvListListener { public: virtual ~IConvListListener() {}; diff --git a/src/Conversation/ConvList/Controller/inc/ConvListItem.h b/src/Conversation/ConvList/Controller/inc/ConvListItem.h index 3b6ae519..cdc20493 100644 --- a/src/Conversation/ConvList/Controller/inc/ConvListItem.h +++ b/src/Conversation/ConvList/Controller/inc/ConvListItem.h @@ -31,8 +31,7 @@ #include "BubbleBgViewItem.h" #include "BubbleEntityFactory.h" -namespace Msg -{ +namespace Msg { class MsgConversationItem; class IConvListItemListener; class FileViewer; @@ -40,8 +39,7 @@ namespace Msg class ConvListItem : public ConvListViewItem - , public IBubbleViewItemListener - { + , public IBubbleViewItemListener { public: /** * @brief Creates item for Conversation list @@ -149,8 +147,7 @@ namespace Msg bool m_IsNeededReadReport; }; - class IConvListItemListener - { + class IConvListItemListener { public: virtual ~IConvListItemListener() {} virtual void onEditDraftMsg(ConvListItem &item) {}; diff --git a/src/Conversation/ConvList/Controller/inc/DateLineItem.h b/src/Conversation/ConvList/Controller/inc/DateLineItem.h index c3c6fb3e..34af0109 100644 --- a/src/Conversation/ConvList/Controller/inc/DateLineItem.h +++ b/src/Conversation/ConvList/Controller/inc/DateLineItem.h @@ -20,11 +20,9 @@ #include "DateLineViewItem.h" #include -namespace Msg -{ +namespace Msg { class DateLineItem - : public DateLineViewItem - { + : public DateLineViewItem { public: DateLineItem(time_t dateTime); DateLineItem(time_t dateTime, const std::string &dateTimeStr); diff --git a/src/Conversation/ConvList/Controller/inc/MsgDetailsPopup.h b/src/Conversation/ConvList/Controller/inc/MsgDetailsPopup.h index feb5bfdd..5d18a886 100644 --- a/src/Conversation/ConvList/Controller/inc/MsgDetailsPopup.h +++ b/src/Conversation/ConvList/Controller/inc/MsgDetailsPopup.h @@ -23,13 +23,11 @@ #include "ContactManager.h" #include "SystemSettingsManager.h" -namespace Msg -{ +namespace Msg { class MsgDetailsPopup : public Popup , private IContactManagerListener - , private ISystemSettingsManager - { + , private ISystemSettingsManager { public: MsgDetailsPopup(PopupManager &mngr, App &app, MsgId msgId); virtual ~MsgDetailsPopup(); diff --git a/src/Conversation/ConvList/Controller/src/BubbleCalEventEntity.cpp b/src/Conversation/ConvList/Controller/src/BubbleCalEventEntity.cpp index 1b3b12db..29b3bf52 100644 --- a/src/Conversation/ConvList/Controller/src/BubbleCalEventEntity.cpp +++ b/src/Conversation/ConvList/Controller/src/BubbleCalEventEntity.cpp @@ -24,8 +24,7 @@ BubbleCalEventEntity::BubbleCalEventEntity(const std::string &filePath, const st : BubbleBgEntity(CalendarEventItem, bgType, direction, filePath) { auto list = VCalendarParser::getInst().parse(filePath); - if (list.size() == 1) - { + if (list.size() == 1) { const CalendarEvent &event = list.front(); m_Name = event.getSummary(); m_DateTime = event.getStartDate(); diff --git a/src/Conversation/ConvList/Controller/src/BubbleContactEntity.cpp b/src/Conversation/ConvList/Controller/src/BubbleContactEntity.cpp index 9b5d435e..7fdcad8e 100644 --- a/src/Conversation/ConvList/Controller/src/BubbleContactEntity.cpp +++ b/src/Conversation/ConvList/Controller/src/BubbleContactEntity.cpp @@ -27,13 +27,10 @@ BubbleContactEntity::BubbleContactEntity(App &app, const std::string &filePath, , m_ThumbMaker(app.getThumbnailMaker()) { auto list = app.getContactManager().parseVcard(getFilePath()); - if (!list.empty()) - { - if (list.size() == 1) - { + if (!list.empty()) { + if (list.size() == 1) { m_Contact = list.front(); - if (m_Contact) - { + if (m_Contact) { m_Name = m_Contact->getDispName(); m_Address = m_Contact->getAddress(); m_ThumbPath = m_Contact->getThumb(); diff --git a/src/Conversation/ConvList/Controller/src/BubbleEntityFactory.cpp b/src/Conversation/ConvList/Controller/src/BubbleEntityFactory.cpp index b9d4c2e3..6b37e8ea 100644 --- a/src/Conversation/ConvList/Controller/src/BubbleEntityFactory.cpp +++ b/src/Conversation/ConvList/Controller/src/BubbleEntityFactory.cpp @@ -93,12 +93,10 @@ BubbleEntity *BubbleEntityFactory::createVideoEntity(const std::string &filePath BubbleEntity *BubbleEntityFactory::createEntity(const std::string &filePath, const std::string &fileName, std::string mime, BubbleBgViewItem::BgType bgType, Message::Direction direction) { - if (FileUtils::isExists(filePath)) - { + if (FileUtils::isExists(filePath)) { std::transform(mime.begin(), mime.end(), mime.begin(), ::tolower); MsgMedia::Type msgMediaType = getMsgMediaTypeByMime(mime); - switch (msgMediaType) - { + switch (msgMediaType) { case MsgMedia::ImageType: return new BubbleImageEntity(filePath, direction); case MsgMedia::AudioType: @@ -106,7 +104,6 @@ BubbleEntity *BubbleEntityFactory::createEntity(const std::string &filePath, con case MsgMedia::VideoType: return createVideoEntity(filePath, fileName, bgType, direction); default: - { if (mime == "text/x-vcalendar" || mime == "text/calendar") return new BubbleCalEventEntity(filePath, fileName, bgType, direction); else if (mime == "text/x-vcard" || @@ -115,7 +112,6 @@ BubbleEntity *BubbleEntityFactory::createEntity(const std::string &filePath, con return new BubbleContactEntity(m_App, filePath, fileName , bgType, direction); else if (mime != "application/smil") return new BubbleUnknownFileEntity(filePath, fileName, bgType, direction); - } } } diff --git a/src/Conversation/ConvList/Controller/src/ComposeListItem.cpp b/src/Conversation/ConvList/Controller/src/ComposeListItem.cpp index 2875b621..db58a605 100644 --- a/src/Conversation/ConvList/Controller/src/ComposeListItem.cpp +++ b/src/Conversation/ConvList/Controller/src/ComposeListItem.cpp @@ -50,8 +50,7 @@ ComposeListItem::~ComposeListItem() void ComposeListItem::addAttachment(const std::string &filePath) { auto *entity = m_BubbleEntityFactory.createEntity(filePath, BubbleBgViewItem::DraftStyle, Message::MD_Sent); - if (entity) - { + if (entity) { m_BubbleEntityList.push_back(entity); updateBubblePart(); show(true); @@ -84,14 +83,12 @@ bool ComposeListItem::isEmpty() const void ComposeListItem::clear(bool updateUi) { std::list fileList; - for (BubbleEntity *entity : m_BubbleEntityList) - { + for (BubbleEntity *entity : m_BubbleEntityList) { fileList.push_back(entity->getFilePath()); delete entity; } m_BubbleEntityList.clear(); - if (updateUi) - { + if (updateUi) { show(false); ComposeListItem::updateBubblePart(); } @@ -105,11 +102,9 @@ Evas_Object *ComposeListItem::getBubbleContent() return nullptr; auto *bubble = new BubbleItemContainer(*getOwner()); - for (BubbleEntity *entity : m_BubbleEntityList) - { + for (BubbleEntity *entity : m_BubbleEntityList) { BubbleViewItem *item = entity->createView(*bubble); - if (item) - { + if (item) { item->showDelButton(true); item->setListener(this); bubble->append(*item, entity->getDirection()); @@ -123,8 +118,7 @@ Evas_Object *ComposeListItem::getBubbleContent() void ComposeListItem::deleteEntity(BubbleEntity &entity) { auto it = std::find(m_BubbleEntityList.begin(), m_BubbleEntityList.end(), &entity); - if (it != m_BubbleEntityList.end()) - { + if (it != m_BubbleEntityList.end()) { std::string filePath = entity.getFilePath(); delete *it; m_BubbleEntityList.erase(it); diff --git a/src/Conversation/ConvList/Controller/src/ConvList.cpp b/src/Conversation/ConvList/Controller/src/ConvList.cpp index 7b713cd7..17ad46cc 100644 --- a/src/Conversation/ConvList/Controller/src/ConvList.cpp +++ b/src/Conversation/ConvList/Controller/src/ConvList.cpp @@ -22,8 +22,7 @@ using namespace Msg; -namespace -{ +namespace { const int minMessagesBulk = 100; const int additionalMessagesBulk = 50; const std::string solidStyle = "solid/default"; @@ -67,8 +66,7 @@ void ConvList::setMode(ConvList::Mode mode) showSelectAllMode(isCheckMode); m_pList->setCheckMode(isCheckMode); - if (isCheckMode) - { + if (isCheckMode) { selectListItems(false); m_pSelectAll->setCheckState(false); } else { @@ -129,8 +127,7 @@ void ConvList::fill() m_ConvListItemMap.reserve(reserveSize); m_DateLineItemSet.reserve(reserveSize); - for (int i = 0; i < convListLen; ++i) - { + for (int i = 0; i < convListLen; ++i) { MsgConversationItem &item = convList->at(i); insertItem(item); } @@ -140,15 +137,13 @@ void ConvList::setThreadId(ThreadId id, const char *searchWord) { bool fillList = false; - if (m_ThreadId != id) - { + if (m_ThreadId != id) { fillList = true; m_ThreadId = id; updateRecipThumbId(); } - if (searchWord && strcmp(searchWord, m_SearchWord.c_str())) - { + if (searchWord && strcmp(searchWord, m_SearchWord.c_str())) { fillList = true; m_SearchWord = searchWord; } @@ -165,11 +160,9 @@ ThreadId ConvList::getThreadId() const void ConvList::updateRecipThumbId() { const MsgAddressListRef addressList = m_App.getMsgEngine().getStorage().getAddressList(m_ThreadId); - if (addressList) - { + if (addressList) { int countContact = addressList->getLength(); - if (countContact > 1) - { + if (countContact > 1) { m_RecipThumbId = m_App.getThumbnailMaker().getThumbId(ThumbnailMaker::GroupThumb); } else if (countContact == 1) { m_RecipThumbId = m_App.getThumbnailMaker().getThumbId(addressList->at(0)); @@ -192,8 +185,7 @@ void ConvList::navigateTo(MsgId msgId) void ConvList::navigateToBottom() { ListItem *item = m_pList->getLastItem(); - if (item) - { + if (item) { ComposeListViewItem *composeItem = dynamic_cast(item); if (!(composeItem && composeItem->isVisible())) item = m_pList->getPrevItem(*item); @@ -239,8 +231,7 @@ void ConvList::deleteItem(ConvListItem *item) bool ConvList::deleteItems(const MsgIdList &idList) { bool res = false; - for (const MsgId &id: idList) - { + for (const MsgId &id: idList) { ConvListItem *deleted = getItem(id); if (deleted) { @@ -295,8 +286,7 @@ void ConvList::dateLineAddIfNec(ConvListItem *item) void ConvList::clear() { auto items = m_pList->getItems(); - for (ListItem *item : items) - { + for (ListItem *item : items) { if (item != m_pComposeItem) item->destroy(); } @@ -308,8 +298,7 @@ void ConvList::deleteSelectedItems() { auto items = getConvItems(); MsgIdList messages; - for (ConvListItem *item : items) - { + for (ConvListItem *item : items) { if (item->getCheckedState()) messages.push_back(item->getMsgId()); } @@ -326,8 +315,7 @@ int ConvList::getMessageCheckedCount() const { auto items = getConvItems(); int count = 0; - for (ConvListItem *item : items) - { + for (ConvListItem *item : items) { if (item->getCheckedState()) count++; } @@ -343,14 +331,11 @@ void ConvList::selectListItems(bool state) void ConvList::updateSelectAllItem() { - if (m_Mode == SelectMode && m_pSelectAll) - { + if (m_Mode == SelectMode && m_pSelectAll) { bool check = true; auto items = getConvItems(); - for (ConvListItem *item : items) - { - if (!item->getCheckedState()) - { + for (ConvListItem *item : items) { + if (!item->getCheckedState()) { check = false; break; } @@ -361,8 +346,7 @@ void ConvList::updateSelectAllItem() ComposeListItem &ConvList::getComposeItem() { - if (!m_pComposeItem) - { + if (!m_pComposeItem) { m_pComposeItem = new ComposeListItem(m_BubbleEntityFactory, m_FileViewer); m_pList->appendItem(*m_pComposeItem); m_pComposeItem->show(false); @@ -401,11 +385,9 @@ void ConvList::onListItemChecked(ListItem &listItem) void ConvList::onMsgStorageUpdate(const MsgIdList &msgIdList) { - for (auto &itemId: msgIdList) - { + for (auto &itemId: msgIdList) { ConvListItem *updated = getItem(itemId); - if (updated) - { + if (updated) { time_t beforeTime = updated->getRawTime(); updated->updateStatus(); if (beforeTime != updated->getRawTime()) @@ -417,17 +399,14 @@ void ConvList::onMsgStorageUpdate(const MsgIdList &msgIdList) void ConvList::onMsgStorageInsert(const MsgIdList &msgIdList) { bool inserted = false; - for (MsgId msgId: msgIdList) - { + for (MsgId msgId: msgIdList) { if (getItem(msgId)) continue; MessageRef msg = m_MsgEngine.getStorage().getMessage(msgId); - if (msg && msg->getThreadId() == m_ThreadId && msg->getMessageStorageType() != Message::MS_Sim) - { + if (msg && msg->getThreadId() == m_ThreadId && msg->getMessageStorageType() != Message::MS_Sim) { MsgConversationItemRef item = m_MsgEngine.getStorage().getConversationItem(msgId); - if (item) - { + if (item) { insertItem(*item); inserted = true; } @@ -468,8 +447,7 @@ void ConvList::onSaveAttachments(ConvListItem &item) void ConvList::onEditDraftMsg(ConvListItem &item) { - if (m_pListener) - { + if (m_pListener) { item.disabled(true); m_pListener->onEditDraftMsg(item.getMsgId()); } @@ -486,8 +464,7 @@ void ConvList::onTimeFormatChanged() { MSG_LOG(""); auto items = getConvItems(); - for (ConvListItem *item : items) - { + for (ConvListItem *item : items) { item->updateTime(); } m_pList->updateRealizedItems(); @@ -500,15 +477,12 @@ void ConvList::onLanguageChanged() // Update ConvListItem: auto convListItems = getConvItems(); for (ConvListItem *item : convListItems) - { item->updateTime(); - } // Update DateLineItem: m_DateLineItemSet.clear(); auto DateLineItems = m_pList->getItems(); - for (DateLineItem *item : DateLineItems) - { + for (DateLineItem *item : DateLineItems) { item->update(); m_DateLineItemSet.insert(item->getDateLine()); } diff --git a/src/Conversation/ConvList/Controller/src/ConvListItem.cpp b/src/Conversation/ConvList/Controller/src/ConvListItem.cpp index 1cc36105..53d52fcf 100644 --- a/src/Conversation/ConvList/Controller/src/ConvListItem.cpp +++ b/src/Conversation/ConvList/Controller/src/ConvListItem.cpp @@ -77,9 +77,8 @@ ConvListItem::~ConvListItem() { m_App.getPopupManager().reset(this); for (auto *entity : m_BubbleEntityList) - { delete entity; - } + m_BubbleEntityList.clear(); } @@ -94,8 +93,7 @@ void ConvListItem::updateStatus() m_NetworkStatus = msg->getNetworkStatus(); m_IsRestrictedByDpm = msg->isRestrictedByDpm(); - if (m_NetworkStatus == Message::NS_Send_Fail) - { + if (m_NetworkStatus == Message::NS_Send_Fail) { updateItemType(ConvItemType::Failed); updateEntityBgType(BubbleBgViewItem::FailedStyle); } else if (m_NetworkStatus == Message::NS_Send_Success || m_NetworkStatus == Message::NS_Sending) { @@ -128,8 +126,7 @@ bool ConvListItem::isNeededReadReport() const ConvListViewItem::ConvItemType ConvListItem::getConvItemType(const MsgConversationItem &item) { ConvItemType type = ConvItemType::Sent; - if (item.getDirection() == Message::Direction::MD_Sent) - { + if (item.getDirection() == Message::Direction::MD_Sent) { if (item.isDraft()) type = ConvItemType::Draft; else if (item.getNetworkStatus() == Message::NS_Send_Fail) @@ -143,8 +140,7 @@ ConvListViewItem::ConvItemType ConvListItem::getConvItemType(const MsgConversati BubbleBgViewItem::BgType ConvListItem::getBubbleBgType(const MsgConversationItem &item) { BubbleBgViewItem::BgType type = BubbleBgViewItem::SentStyle; - if (item.getDirection() == Message::Direction::MD_Sent) - { + if (item.getDirection() == Message::Direction::MD_Sent) { if (item.isDraft()) type = BubbleBgViewItem::DraftStyle; else if (item.getNetworkStatus() == Message::NS_Send_Fail) @@ -180,8 +176,7 @@ BubbleTextEntity *ConvListItem::createTextEntity(BubbleBgViewItem::BgType bgType BubbleDownloadButtonEntity *ConvListItem::findDownloadButton() const { - for (BubbleEntity *entity : m_BubbleEntityList) - { + for (BubbleEntity *entity : m_BubbleEntityList) { if (entity->getType() == BubbleEntity::DownloadButtonItem) return static_cast(entity); } @@ -203,8 +198,7 @@ void ConvListItem::addEntity(BubbleEntity *entity) void ConvListItem::updateEntityBgType(BubbleBgViewItem::BgType bgType) { - for (BubbleEntity *entity : m_BubbleEntityList) - { + for (BubbleEntity *entity : m_BubbleEntityList) { auto *bgEntity = dynamic_cast(entity); if (bgEntity) bgEntity->setBgType(bgType); @@ -214,8 +208,7 @@ void ConvListItem::updateEntityBgType(BubbleBgViewItem::BgType bgType) void ConvListItem::prepareBubble(const MsgConversationItem &item, const std::string &searchWord) { BubbleBgViewItem::BgType bgType = getBubbleBgType(item); - if (m_IsRestrictedByDpm) - { + if (m_IsRestrictedByDpm) { addEntity(createTextEntity(BubbleBgViewItem::RestrictedStyle, msg("IDS_MSG_BODY_COULDNT_RECEIVE_THIS_MESSAGE_THE_SECURITY_POLICY_PREVENTS_RECEIVING_MESSAGES"), false, "")); } else if (!MsgUtils::isMms(m_Type)) { addEntity(createTextEntity(bgType, item.getText(), true, searchWord)); @@ -226,8 +219,7 @@ void ConvListItem::prepareBubble(const MsgConversationItem &item, const std::str updateDownloadButton(); } else { const MsgConvMediaList &list = item.getMediaList(); - for (int i = 0; i < list.getLength(); ++i) - { + for (int i = 0; i < list.getLength(); ++i) { const MsgConvMedia &media = list.at(i); std::string mime = media.getMime(); std::transform(mime.begin(), mime.end(), mime.begin(), ::tolower); @@ -241,13 +233,11 @@ void ConvListItem::prepareBubble(const MsgConversationItem &item, const std::str void ConvListItem::shareContent() { - if (MsgUtils::isSms(m_Type)) - { + if (MsgUtils::isSms(m_Type)) { m_Share.launch(getAllMsgText()); } else { std::list fileList; - for (BubbleEntity *entity : m_BubbleEntityList) - { + for (BubbleEntity *entity : m_BubbleEntityList) { const std::string &filePath = entity->getFilePath(); if (!filePath.empty()) fileList.push_back(filePath); @@ -260,8 +250,7 @@ void ConvListItem::copyMsgToSimCard() { MsgStorage::StorageResult result = MsgStorage::StorageFail; MessageRef msg = m_App.getMsgEngine().getStorage().getMessage(m_MsgId); - if (msg) - { + if (msg) { msg->setMessageStorageType(Message::MS_Sim); m_App.getMsgEngine().getStorage().saveMessage(*msg, false, &result); @@ -275,11 +264,9 @@ void ConvListItem::copyMsgToSimCard() Evas_Object *ConvListItem::getBubbleContent() { auto *bubble = new BubbleItemContainer(*getOwner()); - for (BubbleEntity *entity : m_BubbleEntityList) - { + for (BubbleEntity *entity : m_BubbleEntityList) { BubbleViewItem *item = entity->createView(*bubble); - if (item) - { + if (item) { bubble->append(*item, entity->getDirection()); item->setListener(this); } @@ -354,8 +341,7 @@ void ConvListItem::showMainListPopup() if (!msgText.empty()) listPopup.appendItem(msg("IDS_MSG_OPT_COPY_TEXT"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onCopyTextItemPressed), this); - if (!m_IsRestrictedByDpm) - { + if (!m_IsRestrictedByDpm) { listPopup.appendItem(msg("IDS_MSGF_OPT_FORWARD"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onForwardItemPressed), this); listPopup.appendItem(msg("IDS_COM_BUTTON_SHARE"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onShareItemPressed), this); } @@ -363,8 +349,7 @@ void ConvListItem::showMainListPopup() if (m_NetworkStatus == Message::NS_Send_Fail) listPopup.appendItem(msg("IDS_MSG_OPT_EDIT"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onEditItemPressed), this); - if (m_Type == Message::MT_MMS) - { + if (m_Type == Message::MT_MMS) { MessageMmsRef mms = std::dynamic_pointer_cast(m_App.getMsgEngine().getStorage().getMessage(m_MsgId)); if (mms && (!mms->getAttachmentList().isEmpty() || mms->getMediaCount() > 0)) listPopup.appendItem(msg("IDS_MSG_OPT_SAVE_ATTACHMENTS_ABB"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onSaveAttachmentsItemPressed), this); @@ -381,12 +366,10 @@ void ConvListItem::showMainListPopup() void ConvListItem::tryToDownloadMms(bool showToast) { - if (!m_App.getSysSettingsManager().isMessagingRestrictedByDpm()) - { + if (!m_App.getSysSettingsManager().isMessagingRestrictedByDpm()) { m_App.getMsgEngine().getTransport().retrieveMessage(m_MsgId); auto *button = findDownloadButton(); - if (button) - { + if (button) { button->disabled(true); updateContent(); } @@ -436,24 +419,17 @@ void ConvListItem::onAction(BubbleViewItem &item) { MSG_LOG(""); - switch (item.getEntity().getType()) - { + switch (item.getEntity().getType()) { case BubbleEntity::DownloadButtonItem: - { tryToDownloadMms(); break; - } case BubbleEntity::TextItem: - { break; - } default: - { const std::string &filePath = item.getEntity().getFilePath(); if (!filePath.empty()) m_FileViewer.launchWithCopy(filePath); break; - } } } diff --git a/src/Conversation/ConvList/Controller/src/MsgDetailsPopup.cpp b/src/Conversation/ConvList/Controller/src/MsgDetailsPopup.cpp index be79a873..43656840 100644 --- a/src/Conversation/ConvList/Controller/src/MsgDetailsPopup.cpp +++ b/src/Conversation/ConvList/Controller/src/MsgDetailsPopup.cpp @@ -56,8 +56,7 @@ void MsgDetailsPopup::updateContent() content += getContactsInfo(m_App, msgDirection, msgThreadId); content += getSentReceivedTime(*message, msgDirection); - if (msgDirection == Message::MD_Sent && msgType == Message::MT_SMS) - { + if (msgDirection == Message::MD_Sent && msgType == Message::MT_SMS) { content += brTag; content += makeDeliveryReportResult(m_App, msgStatus, msgType, msgThreadId, m_MsgId); content += getSmsStatus(msgStatus); @@ -71,8 +70,7 @@ void MsgDetailsPopup::updateContent() content += getMmsSubject(*message, ViewDetailsTextStyle); content += getMmsMessageSize(*message, ViewDetailsTextStyle); - if (msgDirection == Message::MD_Sent) - { + if (msgDirection == Message::MD_Sent) { content += brTag; content += makeDeliveryReportResult(m_App, msgStatus, msgType, msgThreadId, m_MsgId); content += makeReadReportResult(m_App, m_MsgId, msgThreadId, msgStatus); diff --git a/src/Conversation/ConvList/View/inc/BubbleAudioViewItem.h b/src/Conversation/ConvList/View/inc/BubbleAudioViewItem.h index 01acb2c4..bee59ce0 100644 --- a/src/Conversation/ConvList/View/inc/BubbleAudioViewItem.h +++ b/src/Conversation/ConvList/View/inc/BubbleAudioViewItem.h @@ -20,11 +20,9 @@ #include "BubbleIconTextLayoutItem.h" #include "Resource.h" -namespace Msg -{ +namespace Msg { class BubbleAudioViewItem - : public BubbleIconTextLayoutItem - { + : public BubbleIconTextLayoutItem { public: BubbleAudioViewItem(BubbleEntity &entity, Evas_Object *parent, BgType bgType); virtual ~BubbleAudioViewItem(); diff --git a/src/Conversation/ConvList/View/inc/BubbleBgViewItem.h b/src/Conversation/ConvList/View/inc/BubbleBgViewItem.h index 81f24985..1cc14f13 100644 --- a/src/Conversation/ConvList/View/inc/BubbleBgViewItem.h +++ b/src/Conversation/ConvList/View/inc/BubbleBgViewItem.h @@ -19,14 +19,11 @@ #include "BubbleViewItem.h" -namespace Msg -{ +namespace Msg { class BubbleBgViewItem - : public BubbleViewItem - { + : public BubbleViewItem { public: - enum BgType - { + enum BgType { SentStyle, ReceivedStyle, DraftStyle, diff --git a/src/Conversation/ConvList/View/inc/BubbleCalEventViewItem.h b/src/Conversation/ConvList/View/inc/BubbleCalEventViewItem.h index f1567079..6d0281f4 100644 --- a/src/Conversation/ConvList/View/inc/BubbleCalEventViewItem.h +++ b/src/Conversation/ConvList/View/inc/BubbleCalEventViewItem.h @@ -20,11 +20,9 @@ #include "BubbleIconTextLayoutItem.h" #include "Resource.h" -namespace Msg -{ +namespace Msg { class BubbleCalEventViewItem - : public BubbleIconTextLayoutItem - { + : public BubbleIconTextLayoutItem { public: BubbleCalEventViewItem(BubbleEntity &entity, Evas_Object *parent, BgType bgType, LayoutType layoutType); virtual ~BubbleCalEventViewItem(); diff --git a/src/Conversation/ConvList/View/inc/BubbleContactViewItem.h b/src/Conversation/ConvList/View/inc/BubbleContactViewItem.h index 8a0b6803..76d7a8d5 100644 --- a/src/Conversation/ConvList/View/inc/BubbleContactViewItem.h +++ b/src/Conversation/ConvList/View/inc/BubbleContactViewItem.h @@ -20,11 +20,9 @@ #include "BubbleIconTextLayoutItem.h" #include "Resource.h" -namespace Msg -{ +namespace Msg { class BubbleContactViewItem - : public BubbleIconTextLayoutItem - { + : public BubbleIconTextLayoutItem { public: BubbleContactViewItem(BubbleEntity &entity, Evas_Object *parent, BgType bgType, LayoutType type); virtual ~BubbleContactViewItem(); diff --git a/src/Conversation/ConvList/View/inc/BubbleDownloadButtonViewItem.h b/src/Conversation/ConvList/View/inc/BubbleDownloadButtonViewItem.h index ec92478d..d3e9096d 100644 --- a/src/Conversation/ConvList/View/inc/BubbleDownloadButtonViewItem.h +++ b/src/Conversation/ConvList/View/inc/BubbleDownloadButtonViewItem.h @@ -19,11 +19,9 @@ #include "BubbleViewItem.h" -namespace Msg -{ +namespace Msg { class BubbleDownloadButtonViewItem - : public BubbleViewItem - { + : public BubbleViewItem { public: BubbleDownloadButtonViewItem(BubbleEntity &entity, Evas_Object *parent); virtual ~BubbleDownloadButtonViewItem(); diff --git a/src/Conversation/ConvList/View/inc/BubbleIconTextLayoutItem.h b/src/Conversation/ConvList/View/inc/BubbleIconTextLayoutItem.h index fb3d1a22..13a66832 100644 --- a/src/Conversation/ConvList/View/inc/BubbleIconTextLayoutItem.h +++ b/src/Conversation/ConvList/View/inc/BubbleIconTextLayoutItem.h @@ -19,14 +19,11 @@ #include "BubbleBgViewItem.h" -namespace Msg -{ +namespace Msg { class BubbleIconTextLayoutItem - : public BubbleBgViewItem - { + : public BubbleBgViewItem { public: - enum LayoutType - { + enum LayoutType { Layout1Icon1Text, Layout1Icon2Text }; diff --git a/src/Conversation/ConvList/View/inc/BubbleImageViewItem.h b/src/Conversation/ConvList/View/inc/BubbleImageViewItem.h index 49a4306a..73ea4f9e 100644 --- a/src/Conversation/ConvList/View/inc/BubbleImageViewItem.h +++ b/src/Conversation/ConvList/View/inc/BubbleImageViewItem.h @@ -19,11 +19,9 @@ #include "BubbleViewItem.h" -namespace Msg -{ +namespace Msg { class BubbleImageViewItem - : public BubbleViewItem - { + : public BubbleViewItem { public: BubbleImageViewItem(BubbleEntity &entity, Evas_Object *parent, const std::string &imagePath); virtual ~BubbleImageViewItem(); diff --git a/src/Conversation/ConvList/View/inc/BubbleItemContainer.h b/src/Conversation/ConvList/View/inc/BubbleItemContainer.h index 113177b1..825cda57 100644 --- a/src/Conversation/ConvList/View/inc/BubbleItemContainer.h +++ b/src/Conversation/ConvList/View/inc/BubbleItemContainer.h @@ -20,11 +20,9 @@ #include "BubbleViewItem.h" #include "Message.h" -namespace Msg -{ +namespace Msg { class BubbleItemContainer - : public View - { + : public View { public: BubbleItemContainer(Evas_Object *parent); virtual ~BubbleItemContainer(); diff --git a/src/Conversation/ConvList/View/inc/BubbleTextViewItem.h b/src/Conversation/ConvList/View/inc/BubbleTextViewItem.h index 7015930c..f556b01a 100644 --- a/src/Conversation/ConvList/View/inc/BubbleTextViewItem.h +++ b/src/Conversation/ConvList/View/inc/BubbleTextViewItem.h @@ -19,11 +19,9 @@ #include "BubbleBgViewItem.h" -namespace Msg -{ +namespace Msg { class BubbleTextViewItem - : public BubbleBgViewItem - { + : public BubbleBgViewItem { public: BubbleTextViewItem(BubbleEntity &entity, Evas_Object *parent, BgType bgType, const std::string &text); virtual ~BubbleTextViewItem(); diff --git a/src/Conversation/ConvList/View/inc/BubbleUnknownFileViewItem.h b/src/Conversation/ConvList/View/inc/BubbleUnknownFileViewItem.h index 395c411b..77761c97 100644 --- a/src/Conversation/ConvList/View/inc/BubbleUnknownFileViewItem.h +++ b/src/Conversation/ConvList/View/inc/BubbleUnknownFileViewItem.h @@ -20,11 +20,9 @@ #include "BubbleIconTextLayoutItem.h" #include "Resource.h" -namespace Msg -{ +namespace Msg { class BubbleUnknownFileViewItem - : public BubbleIconTextLayoutItem - { + : public BubbleIconTextLayoutItem { public: BubbleUnknownFileViewItem(BubbleEntity &entity, Evas_Object *parent, BgType bgType); virtual ~BubbleUnknownFileViewItem(); diff --git a/src/Conversation/ConvList/View/inc/BubbleVideoViewItem.h b/src/Conversation/ConvList/View/inc/BubbleVideoViewItem.h index 13c3b679..012245fb 100644 --- a/src/Conversation/ConvList/View/inc/BubbleVideoViewItem.h +++ b/src/Conversation/ConvList/View/inc/BubbleVideoViewItem.h @@ -19,11 +19,9 @@ #include "BubbleViewItem.h" -namespace Msg -{ +namespace Msg { class BubbleVideoViewItem - : public BubbleViewItem - { + : public BubbleViewItem { public: BubbleVideoViewItem(BubbleEntity &entity, Evas_Object *parent, const std::string &imagePath); virtual ~BubbleVideoViewItem(); diff --git a/src/Conversation/ConvList/View/inc/BubbleViewItem.h b/src/Conversation/ConvList/View/inc/BubbleViewItem.h index d75b2601..54923b6b 100644 --- a/src/Conversation/ConvList/View/inc/BubbleViewItem.h +++ b/src/Conversation/ConvList/View/inc/BubbleViewItem.h @@ -20,14 +20,12 @@ #include "View.h" #include -namespace Msg -{ +namespace Msg { class IBubbleViewItemListener; class BubbleEntity; class BubbleViewItem - : public View - { + : public View { public: static const int maxWidth = 408; @@ -52,8 +50,7 @@ namespace Msg Evas_Object *m_pDelButton; }; - class IBubbleViewItemListener - { + class IBubbleViewItemListener { public: virtual ~IBubbleViewItemListener() {}; virtual void onAction(BubbleViewItem &item) {}; // Tap or Click diff --git a/src/Conversation/ConvList/View/inc/ComposeListViewItem.h b/src/Conversation/ConvList/View/inc/ComposeListViewItem.h index 7849d882..7ccad59c 100644 --- a/src/Conversation/ConvList/View/inc/ComposeListViewItem.h +++ b/src/Conversation/ConvList/View/inc/ComposeListViewItem.h @@ -19,11 +19,9 @@ #include "ListItem.h" -namespace Msg -{ +namespace Msg { class ComposeListViewItem - : public ListItem - { + : public ListItem { public: ComposeListViewItem(); virtual ~ComposeListViewItem(); diff --git a/src/Conversation/ConvList/View/inc/ConvListLayout.h b/src/Conversation/ConvList/View/inc/ConvListLayout.h index 51f86e0e..5b6047e4 100644 --- a/src/Conversation/ConvList/View/inc/ConvListLayout.h +++ b/src/Conversation/ConvList/View/inc/ConvListLayout.h @@ -19,11 +19,9 @@ #include "View.h" -namespace Msg -{ +namespace Msg { class ConvListLayout - : public View - { + : public View { public: ConvListLayout(Evas_Object *parent); virtual ~ConvListLayout(); diff --git a/src/Conversation/ConvList/View/inc/ConvListViewItem.h b/src/Conversation/ConvList/View/inc/ConvListViewItem.h index b612b226..aee2ea3a 100644 --- a/src/Conversation/ConvList/View/inc/ConvListViewItem.h +++ b/src/Conversation/ConvList/View/inc/ConvListViewItem.h @@ -19,14 +19,11 @@ #include "ListItem.h" -namespace Msg -{ +namespace Msg { class ConvListViewItem - : public ListItem - { + : public ListItem { public: - enum ConvItemType - { + enum ConvItemType { InitType, Sent, Received, diff --git a/src/Conversation/ConvList/View/inc/ConvSelectAll.h b/src/Conversation/ConvList/View/inc/ConvSelectAll.h index 06ba62ec..2cf2fac0 100644 --- a/src/Conversation/ConvList/View/inc/ConvSelectAll.h +++ b/src/Conversation/ConvList/View/inc/ConvSelectAll.h @@ -20,11 +20,9 @@ #include "View.h" #include "LangUtils.h" -namespace Msg -{ +namespace Msg { class ConvSelectAll - : public View - { + : public View { public: ConvSelectAll(Evas_Object *parent); virtual ~ConvSelectAll(); diff --git a/src/Conversation/ConvList/View/inc/DateLineViewItem.h b/src/Conversation/ConvList/View/inc/DateLineViewItem.h index 945f37b9..e68d27c4 100644 --- a/src/Conversation/ConvList/View/inc/DateLineViewItem.h +++ b/src/Conversation/ConvList/View/inc/DateLineViewItem.h @@ -19,11 +19,9 @@ #include "ListItem.h" -namespace Msg -{ +namespace Msg { class DateLineViewItem - : public ListItem - { + : public ListItem { public: DateLineViewItem(const std::string &dateLine); virtual ~DateLineViewItem(); diff --git a/src/Conversation/ConvList/View/src/BubbleBgViewItem.cpp b/src/Conversation/ConvList/View/src/BubbleBgViewItem.cpp index e0e13969..c35ac170 100644 --- a/src/Conversation/ConvList/View/src/BubbleBgViewItem.cpp +++ b/src/Conversation/ConvList/View/src/BubbleBgViewItem.cpp @@ -30,8 +30,7 @@ BubbleBgViewItem::BubbleBgViewItem(BubbleEntity &entity, Evas_Object *parent, Bg , m_BgType(bgType) { const char *group = nullptr; - switch (bgType) - { + switch (bgType) { case SentStyle: group = "conv/list/bubble_sent_bg"; break; diff --git a/src/Conversation/ConvList/View/src/BubbleIconTextLayoutItem.cpp b/src/Conversation/ConvList/View/src/BubbleIconTextLayoutItem.cpp index e6596cb5..ca163107 100644 --- a/src/Conversation/ConvList/View/src/BubbleIconTextLayoutItem.cpp +++ b/src/Conversation/ConvList/View/src/BubbleIconTextLayoutItem.cpp @@ -29,8 +29,7 @@ BubbleIconTextLayoutItem::BubbleIconTextLayoutItem(BubbleEntity &entity, Evas_Ob , m_pIconTextLayout(nullptr) { const char *group = nullptr; - switch (layoutType) - { + switch (layoutType) { case Layout1Icon1Text: group = "conv/list/1icon_1text"; break; diff --git a/src/Conversation/ConvList/View/src/BubbleImageViewItem.cpp b/src/Conversation/ConvList/View/src/BubbleImageViewItem.cpp index 4caed2ce..78f6c38a 100644 --- a/src/Conversation/ConvList/View/src/BubbleImageViewItem.cpp +++ b/src/Conversation/ConvList/View/src/BubbleImageViewItem.cpp @@ -43,8 +43,7 @@ Evas_Object *BubbleImageViewItem::createImage(Evas_Object *parent, const std::st elm_image_aspect_fixed_set(image, true); elm_image_file_set(image, path.c_str(), nullptr); elm_image_object_size_get(image, &imageWidth, &imageHeight); - if (imageWidth > maxWidth) - { + if (imageWidth > maxWidth) { double scale = maxWidth/(double)imageWidth; imageWidth *= scale; imageHeight *= scale; diff --git a/src/Conversation/ConvList/View/src/BubbleItemContainer.cpp b/src/Conversation/ConvList/View/src/BubbleItemContainer.cpp index 2e071f51..0de4c011 100644 --- a/src/Conversation/ConvList/View/src/BubbleItemContainer.cpp +++ b/src/Conversation/ConvList/View/src/BubbleItemContainer.cpp @@ -21,8 +21,7 @@ using namespace Msg; -namespace -{ +namespace { const int verticalBoxPads = 10; const int horizontalBoxPads = 0; } diff --git a/src/Conversation/ConvList/View/src/BubbleVideoViewItem.cpp b/src/Conversation/ConvList/View/src/BubbleVideoViewItem.cpp index 5db82a04..fd3faefb 100644 --- a/src/Conversation/ConvList/View/src/BubbleVideoViewItem.cpp +++ b/src/Conversation/ConvList/View/src/BubbleVideoViewItem.cpp @@ -42,8 +42,7 @@ Evas_Object *BubbleVideoViewItem::createIamge(Evas_Object *parent, const std::st int imageWidth = 0; int imageHeight = 0; elm_image_object_size_get(image, &imageWidth, &imageHeight); - if (imageWidth > maxWidth) - { + if (imageWidth > maxWidth) { double scale = maxWidth/(double)imageWidth; imageWidth *= scale; imageHeight *= scale; diff --git a/src/Conversation/ConvList/View/src/BubbleViewItem.cpp b/src/Conversation/ConvList/View/src/BubbleViewItem.cpp index 9f259094..c68bb479 100644 --- a/src/Conversation/ConvList/View/src/BubbleViewItem.cpp +++ b/src/Conversation/ConvList/View/src/BubbleViewItem.cpp @@ -66,8 +66,7 @@ void BubbleViewItem::attachGestureTapLayer(Evas_Object *parent, Evas_Object *obj void BubbleViewItem::showDelButton(bool show) { - if (show && !m_pDelButton) - { + if (show && !m_pDelButton) { m_pDelButton = elm_button_add(getEo()); elm_object_style_set(m_pDelButton, "transparent"); evas_object_smart_callback_add(m_pDelButton, "clicked", SMART_CALLBACK(BubbleViewItem, onDelButtonClicked), this); @@ -97,8 +96,7 @@ void BubbleViewItem::showDelButton(bool show) elm_object_content_set(m_pDelButton, icon); setContent(m_pDelButton, delButtonPart); - if (!getContent(delButtonPart)) - { + if (!getContent(delButtonPart)) { MSG_LOG_ERROR("Layout has not 'del_button' part"); evas_object_del(m_pDelButton); m_pDelButton = nullptr; diff --git a/src/Conversation/ConvList/View/src/ComposeListViewItem.cpp b/src/Conversation/ConvList/View/src/ComposeListViewItem.cpp index 4e11c8bc..bc383741 100644 --- a/src/Conversation/ConvList/View/src/ComposeListViewItem.cpp +++ b/src/Conversation/ConvList/View/src/ComposeListViewItem.cpp @@ -21,8 +21,7 @@ using namespace Msg; -namespace -{ +namespace { ListItemStyleRef sentStyle = ListItemStyle::create("sentbubble"); const char *bubbleContentPart = "bubble.content"; } diff --git a/src/Conversation/ConvList/View/src/ConvListLayout.cpp b/src/Conversation/ConvList/View/src/ConvListLayout.cpp index a79634f0..3709b966 100644 --- a/src/Conversation/ConvList/View/src/ConvListLayout.cpp +++ b/src/Conversation/ConvList/View/src/ConvListLayout.cpp @@ -18,8 +18,7 @@ using namespace Msg; -namespace -{ +namespace { const char *layoutStyle = "conv_list_base"; } diff --git a/src/Conversation/ConvList/View/src/ConvListViewItem.cpp b/src/Conversation/ConvList/View/src/ConvListViewItem.cpp index c732c1f8..b94a19cd 100644 --- a/src/Conversation/ConvList/View/src/ConvListViewItem.cpp +++ b/src/Conversation/ConvList/View/src/ConvListViewItem.cpp @@ -21,8 +21,7 @@ using namespace Msg; -namespace -{ +namespace { ListItemStyleRef sentStyle = ListItemStyle::create("sentbubble"); ListItemStyleRef receivedStyle = ListItemStyle::create("receivebubble"); ListItemStyleRef draftStyle = ListItemStyle::create("draft"); @@ -63,17 +62,16 @@ std::string ConvListViewItem::getText(ListItem &item, const char *part) Evas_Object *ConvListViewItem::getContent(ListItem &item, const char *part) { if (!strcmp(part, bubbleContentPart)) - { return getBubbleContent(); - } else if (!strcmp(part, thumbContentPart)) { + else if (!strcmp(part, thumbContentPart)) return getThumbnail(); - } else if (!strcmp(part, draftButtonPart)) { + else if (!strcmp(part, draftButtonPart)) return createButton(!getOwner()->getCheckMode(), Draft); - } else if (!strcmp(part, failedButtonPart)) { + else if (!strcmp(part, failedButtonPart)) return createButton(!getOwner()->getCheckMode(), Failed); - } else if (!strcmp(part, infoStatus)){ + else if (!strcmp(part, infoStatus)) return getProgress(); - } + return nullptr; } @@ -108,8 +106,7 @@ Evas_Object *ConvListViewItem::createButton(bool isEnabled, ConvItemType type) elm_object_style_set(button, "transparent"); Evas_Object *icon = nullptr; - if (type == Draft) - { + if (type == Draft) { icon = View::addLayout(button, ICONS_EDJ_PATH, "draft_icon"); evas_object_smart_callback_add(button, "clicked", SMART_CALLBACK(ConvListViewItem, onEditButtonClicked), this); } else if (type == Failed) { @@ -169,8 +166,7 @@ void ConvListViewItem::updateItemType(ConvItemType type) return; m_Type = type; - switch (type) - { + switch (type) { case Sent: setStyle(sentStyle); break; @@ -191,7 +187,5 @@ void ConvListViewItem::updateItemType(ConvItemType type) void ConvListViewItem::resetCheckMode(ListView &listView) { for (ListItem *item: listView.getRealizedItems()) - { item->emitSignal("elm,state,default", "elm"); - } } diff --git a/src/Conversation/ConvList/View/src/ConvSelectAll.cpp b/src/Conversation/ConvList/View/src/ConvSelectAll.cpp index de64ad40..4f4afbee 100644 --- a/src/Conversation/ConvList/View/src/ConvSelectAll.cpp +++ b/src/Conversation/ConvList/View/src/ConvSelectAll.cpp @@ -20,8 +20,7 @@ using namespace Msg; -namespace -{ +namespace { const char *groupName = "elm/layout/select_all_layout"; const char *textPart = "elm.select_all_text"; const char *iconPart = "elm.swallow.select_icon"; diff --git a/src/Conversation/ConvList/View/src/DateLineViewItem.cpp b/src/Conversation/ConvList/View/src/DateLineViewItem.cpp index a79ff1dc..a4058c33 100644 --- a/src/Conversation/ConvList/View/src/DateLineViewItem.cpp +++ b/src/Conversation/ConvList/View/src/DateLineViewItem.cpp @@ -19,8 +19,7 @@ using namespace Msg; -namespace -{ +namespace { ListItemStyleRef dateLineStyle = ListItemStyle::create("dateline"); const char *datePart = "text.date"; } diff --git a/src/Conversation/Main/Controller/inc/Conversation.h b/src/Conversation/Main/Controller/inc/Conversation.h index a911c658..223ecf3b 100644 --- a/src/Conversation/Main/Controller/inc/Conversation.h +++ b/src/Conversation/Main/Controller/inc/Conversation.h @@ -41,8 +41,7 @@ #include -namespace Msg -{ +namespace Msg { class NaviFrameController; class Scroller; class ConversationInputPanel; @@ -58,8 +57,7 @@ namespace Msg , private IConvListListener , private IAttachPanelListener , private IContactManagerListener - , private ISystemSettingsManager - { + , private ISystemSettingsManager { public: Conversation(NaviFrameController &parent); virtual ~Conversation(); @@ -73,15 +71,13 @@ namespace Msg void forwardMsg(MsgId id); private: - enum Mode - { + enum Mode { InitMode, NewMessageMode, ConversationMode }; - struct DefferedCmd - { + struct DefferedCmd { AppControlComposeRef composeCmd; AppControlDefaultRef defaultCmd; }; @@ -235,8 +231,7 @@ namespace Msg std::function m_TransFinishedFunc; }; - class IConversationListener - { + class IConversationListener { public: virtual ~IConversationListener() {}; virtual void onConversationSentMessage() {}; diff --git a/src/Conversation/Main/Controller/inc/PopupRecipientListItem.h b/src/Conversation/Main/Controller/inc/PopupRecipientListItem.h index 88f90798..edc93bf8 100644 --- a/src/Conversation/Main/Controller/inc/PopupRecipientListItem.h +++ b/src/Conversation/Main/Controller/inc/PopupRecipientListItem.h @@ -20,11 +20,9 @@ #include "PopupListItem.h" #include "ContactAddress.h" -namespace Msg -{ +namespace Msg { class PopupAddressListItem - : public PopupTextListItem - { + : public PopupTextListItem { public: PopupAddressListItem(PopupList &parent, const std::string &text, @@ -40,8 +38,7 @@ namespace Msg }; class PopupPersonIdListItem - : public PopupTextListItem - { + : public PopupTextListItem { public: PopupPersonIdListItem(PopupList &parent, const std::string &text, diff --git a/src/Conversation/Main/Controller/src/Conversation.cpp b/src/Conversation/Main/Controller/src/Conversation.cpp index f345dd8c..8d35f012 100644 --- a/src/Conversation/Main/Controller/src/Conversation.cpp +++ b/src/Conversation/Main/Controller/src/Conversation.cpp @@ -34,8 +34,7 @@ using namespace Msg; -namespace -{ +namespace { std::string makeDispAddress(std::string address, std::string dispName) { if (dispName.empty()) @@ -79,14 +78,12 @@ Conversation::~Conversation() m_pRecipPanel->setListener(nullptr); if (m_pContactsList) m_pContactsList->setListener(nullptr); - if (m_pConvList) - { + if (m_pConvList) { m_pConvList->setListener(nullptr); m_pConvList->setBodyFocusCb(nullptr); } m_AttachPanel.setListener(nullptr); - if (m_NnotifyConvertMsgTypeIdler) - { + if (m_NnotifyConvertMsgTypeIdler) { ecore_idler_del(m_NnotifyConvertMsgTypeIdler); m_NnotifyConvertMsgTypeIdler = nullptr; } @@ -97,8 +94,7 @@ void Conversation::execCmd(const AppControlComposeRef &cmd) { getApp().getPopupManager().reset(); setDeleteMode(false); - if (!isRecipExists() && !isBodyEmpty() && m_Mode == NewMessageMode) // Check if we can save draft to avoid losing data - { + if (!isRecipExists() && !isBodyEmpty() && m_Mode == NewMessageMode) { // Check if we can save draft to avoid losing data m_DefferedCmd.composeCmd = cmd; showNoRecipPopup(); return; @@ -111,8 +107,7 @@ void Conversation::execCmd(const AppControlComposeRef &cmd) if (m_pRecipPanel) m_pRecipPanel->execCmd(cmd); - if (m_pBody) - { + if (m_pBody) { m_pBody->enableAutoFocusForAttachments(isRecipExists()); m_pBody->execCmd(cmd); } @@ -127,8 +122,7 @@ void Conversation::execCmd(const AppControlDefaultRef &cmd) { getApp().getPopupManager().reset(); setDeleteMode(false); - if (!isRecipExists() && !isBodyEmpty() && m_Mode == NewMessageMode) // Check if we can save draft to avoid losing data - { + if (!isRecipExists() && !isBodyEmpty() && m_Mode == NewMessageMode) { // Check if we can save draft to avoid losing data m_DefferedCmd.defaultCmd = cmd; showNoRecipPopup(); return; @@ -138,14 +132,12 @@ void Conversation::execCmd(const AppControlDefaultRef &cmd) m_pBody->clear(); } - if (cmd->getDefaultType() == AppControlDefault::SendFailedType) - { + if (cmd->getDefaultType() == AppControlDefault::SendFailedType) { pop(); return; } - if (cmd->getDefaultType() == AppControlDefault::NotificationType && getMsgEngine().getStorage().getUnreadThreadCount() > 1) - { + if (cmd->getDefaultType() == AppControlDefault::NotificationType && getMsgEngine().getStorage().getUnreadThreadCount() > 1) { pop(); return; } @@ -156,8 +148,7 @@ void Conversation::execCmd(const AppControlDefaultRef &cmd) navigateTo(msgId); else navigateToBottom(); - if (cmd->getDefaultType() == AppControlDefault::ReplyType) - { + if (cmd->getDefaultType() == AppControlDefault::ReplyType) { m_pBody->execCmd(cmd); m_pBody->setFocus(true); } @@ -186,10 +177,8 @@ void Conversation::recipientClickHandler(const std::string &address) MSG_ASSERT(m_Mode != InitMode, "m_Mode is in initial state"); ContactAddressRef contactAddress = getApp().getContactManager().getContactAddress(address); - if (contactAddress) - { - if (m_Mode == NewMessageMode) - { + if (contactAddress) { + if (m_Mode == NewMessageMode) { MbeRecipientItem *pItem = m_pRecipPanel->getSelectedItem(); if (pItem) showSavedRecipientPopup(pItem->getDispName(), contactAddress->getOwnerId(), contactAddress->getOwnerType()); @@ -218,16 +207,14 @@ void Conversation::showUnsavedRecipientPopup(const std::string &address) { PopupList &popup = createPopupList(address); popup.addEventCb(EVAS_CALLBACK_DEL, EVAS_EVENT_CALLBACK(Conversation, onRecipPopupDel), this); - if (m_Mode == NewMessageMode) - { + if (m_Mode == NewMessageMode) { popup.appendItem(*new PopupAddressListItem(popup, msg("IDS_MSGF_OPT_REMOVE"), address, POPUPLIST_ITEM_PRESSED_CB(Conversation, onRecipRemoveItemPressed), this)); popup.appendItem(*new PopupAddressListItem(popup, msg("IDS_MSG_OPT_EDIT"), address, POPUPLIST_ITEM_PRESSED_CB(Conversation, onEditItemPressed), this)); } else if (m_Mode == ConversationMode) { - if (MsgUtils::isValidNumber(address)) - { + if (MsgUtils::isValidNumber(address)) { popup.appendItem(*new PopupAddressListItem(popup, msg("IDS_MSG_OPT_MAKE_VOICE_CALL"), address, POPUPLIST_ITEM_PRESSED_CB(Conversation, onMakeVoiceItemPressed), this)); } @@ -296,8 +283,7 @@ void Conversation::resetMsgThread(bool updateConvList, bool updateRecipPanel) { m_IsMms = false; m_DispIsMms = false; - if (m_NnotifyConvertMsgTypeIdler) - { + if (m_NnotifyConvertMsgTypeIdler) { ecore_idler_del(m_NnotifyConvertMsgTypeIdler); m_NnotifyConvertMsgTypeIdler = nullptr; } @@ -306,8 +292,7 @@ void Conversation::resetMsgThread(bool updateConvList, bool updateRecipPanel) bool Conversation::isHiddenAddress() const { - if (m_AddressList && !m_AddressList->isEmpty()) - { + if (m_AddressList && !m_AddressList->isEmpty()) { std::string addr = m_AddressList->at(0).getAddress(); return !MsgUtils::isValidAddress(addr); } @@ -322,8 +307,7 @@ void Conversation::setListener(IConversationListener *listener) void Conversation::forwardMsg(MsgId id) { MessageRef msg = getMsgEngine().getStorage().getMessage(id); - if (msg) - { + if (msg) { resetMsgThread(); if (m_pBody) m_pBody->write(*msg); @@ -341,8 +325,7 @@ void Conversation::setMode(Mode mode) if (m_Mode == mode) return; - switch (mode) - { + switch (mode) { case NewMessageMode: setNewMessageMode(); break; @@ -382,8 +365,7 @@ void Conversation::setConversationMode() m_Mode = ConversationMode; m_pLayout->showRecipEditMode(false); MsgAddressListRef addressList = getAddressList(); - if (addressList && addressList->getLength() > 1) - { + if (addressList && addressList->getLength() > 1) { showRecipPanel(true); m_pRecipPanel->showEntry(false); m_pRecipPanel->update(addressList); @@ -402,8 +384,7 @@ void Conversation::setDeleteMode(bool value) updateNavibar(); showMsgInputPanelIfNeeded(!value); - if (value) - { + if (value) { if (m_AttachPanel.isFullExpanded()) m_AttachPanel.show(false); m_pConvList->setMode(ConvList::SelectMode); @@ -422,10 +403,8 @@ void Conversation::createMainLayout() void Conversation::showConvList(bool show) { - if (show) - { - if (!m_pConvList) - { + if (show) { + if (!m_pConvList) { m_pConvList = new ConvList(*m_pLayout, getApp(), m_WorkingDir); m_pConvList->setBodyFocusCb(std::bind(&Conversation::getSipVisibility, this)); m_pConvList->setListener(this); @@ -444,10 +423,8 @@ void Conversation::showConvList(bool show) void Conversation::showRecipPanel(bool show) { - if (show) - { - if (!m_pRecipPanel) - { + if (show) { + if (!m_pRecipPanel) { m_pRecipPanel = new ConvRecipientsPanel(*m_pLayout, getApp()); m_pRecipPanel->setListener(this); m_pRecipPanel->show(); @@ -465,17 +442,14 @@ void Conversation::showRecipPanel(bool show) void Conversation::showContactList(bool show) { - if (show) - { - if (!m_pContactsList) - { + if (show) { + if (!m_pContactsList) { m_pContactsList = new ConvContactList(*m_pLayout, getApp()); m_pContactsList->setListener(this); m_pLayout->setContactList(*m_pContactsList); } } else { - if (m_pContactsList) - { + if (m_pContactsList) { m_pContactsList->destroy(); m_pContactsList = nullptr; m_pLayout->showContactList(false); @@ -485,14 +459,12 @@ void Conversation::showContactList(bool show) void Conversation::createMsgInputPanel() { - if (!m_pMsgInputPanel) - { + if (!m_pMsgInputPanel) { m_pMsgInputPanel = new MessageInputPanel(*m_pConvList); m_pMsgInputPanel->setListener(this); m_pLayout->setMsgInputPanel(*m_pMsgInputPanel); } - if (!m_pBody && m_pConvList) - { + if (!m_pBody && m_pConvList) { m_pBody = new Body(*m_pMsgInputPanel, getApp(), m_WorkingDir, *m_pConvList); m_pBody->setListener(this); m_pMsgInputPanel->setEntry(*m_pBody); @@ -502,14 +474,12 @@ void Conversation::createMsgInputPanel() void Conversation::destroyMsgInputPanel() { - if (m_pBody) - { + if (m_pBody) { m_pBody->setListener(this); m_pBody->destroy(); m_pBody = nullptr; } - if (m_pMsgInputPanel) - { + if (m_pMsgInputPanel) { m_pMsgInputPanel->setListener(this); m_pMsgInputPanel->destroy(); m_pMsgInputPanel = nullptr; @@ -538,8 +508,7 @@ void Conversation::write(const Message &msg) bool Conversation::read(Message &msg) { - if (readMsgAddress(msg)) - { + if (readMsgAddress(msg)) { if (m_pBody) m_pBody->read(msg); return true; @@ -550,17 +519,14 @@ bool Conversation::read(Message &msg) bool Conversation::readMsgAddress(Message &msg) { bool res = false; - if (m_ThreadId.isValid()) - { + if (m_ThreadId.isValid()) { MsgAddressListRef addressList = getAddressList(); - if (addressList) - { + if (addressList) { res = !addressList->isEmpty(); msg.addAddresses(*addressList); } } else { - if (m_pRecipPanel) - { + if (m_pRecipPanel) { m_pRecipPanel->read(msg); res = !m_pRecipPanel->isMbeEmpty(); } @@ -574,8 +540,7 @@ void Conversation::handleSendResult(const Message &msg, MsgTransport::SendResult return; const char *strId = nullptr; - switch (result) - { + switch (result) { case MsgTransport::SendNoSIM: strId = "IDS_MSG_BODY_UNABLE_TO_SEND_THIS_MESSAGE_INSERT_YOUR_SIM_CARD_AND_TRY_AGAIN"; break; @@ -595,20 +560,17 @@ void Conversation::handleSendResult(const Message &msg, MsgTransport::SendResult bool Conversation::checkBeforeSend(const Message &msg) { - if (!getApp().getSysSettingsManager().isSimInserted()) - { + if (!getApp().getSysSettingsManager().isSimInserted()) { handleSendResult(msg, MsgTransport::SendNoSIM); // Show no SIM card return false; } - if (getApp().getSysSettingsManager().isMessagingRestrictedByDpm()) - { + if (getApp().getSysSettingsManager().isMessagingRestrictedByDpm()) { showSendDpmNotif(msg.getAddressList()); return false; } - if (msg.isMms() && !getApp().getSysSettingsManager().isMobileDataEnabled()) - { + if (msg.isMms() && !getApp().getSysSettingsManager().isMobileDataEnabled()) { showMobileDataPopup(); return false; } @@ -619,11 +581,9 @@ bool Conversation::checkBeforeSend(const Message &msg) std::vector Conversation::getMsgIdListForReadReport() const { std::vector msgIds; - if (m_pConvList) - { + if (m_pConvList) { auto items = m_pConvList->getConvItems(); - for (ConvListItem *item : items) - { + for (ConvListItem *item : items) { if (item->isNeededReadReport()) msgIds.push_back(item->getMsgId()); } @@ -635,11 +595,9 @@ std::vector Conversation::getMsgIdListForReadReport() const bool Conversation::sendReadReportIfNeeded() { if (getMsgEngine().getSettings().getMmsReadReport() && - !getApp().getSysSettingsManager().isMessagingRestrictedByDpm()) - { + !getApp().getSysSettingsManager().isMessagingRestrictedByDpm()) { auto msgIds = getMsgIdListForReadReport(); - if (!msgIds.empty()) - { + if (!msgIds.empty()) { showSendReadReportPopup(); return true; } @@ -652,16 +610,13 @@ void Conversation::sendReadReport(MsgReport::ReadStatus status) { auto ids = getMsgIdListForReadReport(); for (MsgId id : ids) - { getMsgEngine().getTransport().sendReadReport(id, status); - } } void Conversation::sendMessage(MsgId msgId) { MessageRef msg = getMsgEngine().getStorage().getMessage(msgId); - if (msg && checkBeforeSend(*msg)) - { + if (msg && checkBeforeSend(*msg)) { auto sentRes = getMsgEngine().getTransport().sendMessage(msg); handleSendResult(*msg, sentRes); } @@ -688,8 +643,7 @@ void Conversation::sendMessage() MSG_LOG("Send result = ", sendRes); MSG_LOG("New threadId = ", m_ThreadId); - if (sendRes == MsgTransport::SendSuccess && m_ThreadId.isValid()) - { + if (sendRes == MsgTransport::SendSuccess && m_ThreadId.isValid()) { m_DispIsMms = false; // Skip "Convert to SMS" after sent message with MMS body. setThreadId(m_ThreadId); m_pMsgInputPanel->disabledButton(MessageInputPanel::SendButtonId, true); @@ -705,11 +659,9 @@ void Conversation::sendMessage() MsgId Conversation::saveDraftMsg() { MsgId msgId; - if (!isBodyEmpty()) - { + if (!isBodyEmpty()) { MessageRef msg = getMsgEngine().getComposer().createMessage(m_IsMms ? Message::MT_MMS : Message::MT_SMS); - if (msg) - { + if (msg) { read(*msg); msg->setMessageStorageType(Message::MS_Phone); msgId = getMsgEngine().getStorage().saveMessage(*msg, false); @@ -725,16 +677,14 @@ void Conversation::editDraftMsg(MsgId id) return; MessageRef msg = getMsgEngine().getStorage().getMessage(id); - if (msg) - { + if (msg) { MsgId draftMsgId = saveDraftMsg(); m_pBody->clear(); if (m_pConvList->getMessageCount() <= 1 && !draftMsgId.isValid()) setThreadId(ThreadId()); write(*msg); - if (getMsgEngine().getStorage().deleteMessage(id)) - { + if (getMsgEngine().getStorage().deleteMessage(id)) { // Fast remove item in order to avoid blink: m_pConvList->deleteItems({id}); } @@ -752,15 +702,13 @@ void Conversation::createNewMsgThread() void Conversation::notifyConvertMsgType() { - if (!m_NnotifyConvertMsgTypeIdler) - { + if (!m_NnotifyConvertMsgTypeIdler) { m_NnotifyConvertMsgTypeIdler = ecore_idler_add( [](void *data)->Eina_Bool { auto *self =(Conversation*)data; self->m_NnotifyConvertMsgTypeIdler = nullptr; - if (self->m_DispIsMms != self->m_IsMms) - { + if (self->m_DispIsMms != self->m_IsMms) { self->m_DispIsMms = self->m_IsMms; std::string notifText = self->m_IsMms ? msg("IDS_MSGF_POP_CONVERTING_TO_MULTIMEDIA_MESSAGE_ING") : @@ -789,8 +737,7 @@ void Conversation::checkAndSetMsgType(bool force) if (!isMms && m_pRecipPanel && !m_pRecipPanel->isMbeEmpty()) isMms = m_pRecipPanel->isMms(); - if (force || isMms != m_IsMms) - { + if (force || isMms != m_IsMms) { m_IsMms = isMms; convertMsgTypeHandler(); } @@ -826,8 +773,7 @@ void Conversation::navigateToSlideShow(MsgId id) void Conversation::setBodyFocus() { - if (getOwner().getTransitionStatus()) - { + if (getOwner().getTransitionStatus()) { m_TransFinishedFunc = [this]() { if (m_pBody) @@ -849,8 +795,7 @@ bool Conversation::getSipVisibility() const void Conversation::setRecipEntryFocus() { - if (getOwner().getTransitionStatus()) - { + if (getOwner().getTransitionStatus()) { m_TransFinishedFunc = [this]() { if (m_pRecipPanel) @@ -874,12 +819,10 @@ void Conversation::showSendDpmNotif(const MsgAddressList &addressList) int len = addressList.getLength(); std::string addresses; - for (int i = 0; i < len; ++i) - { + for (int i = 0; i < len; ++i) { std::string address = addressList[i].getAddress(); std::string dispName; - if (!address.empty()) - { + if (!address.empty()) { ContactAddressRef rec = getApp().getContactManager().getContactAddress(address); if (rec) dispName = rec->getDispName(); @@ -889,8 +832,7 @@ void Conversation::showSendDpmNotif(const MsgAddressList &addressList) } } - if (len <= 1) - { + if (len <= 1) { std::string text = msgArgs("IDS_MSG_POP_THE_SECURITY_POLICY_PREVENTS_SENDING_MESSAGES_TO_PS", addresses.c_str()); notification_status_message_post(text.c_str()); } else { @@ -941,13 +883,11 @@ void Conversation::showMainPopup() { PopupList &popup = getApp().getPopupManager().getMorePopup(); popup.appendItem(msg("IDS_MSG_OPT_DELETE"), POPUPLIST_ITEM_PRESSED_CB(Conversation, onDeleteItemPressed), this); - if (m_AddressList && m_AddressList->getLength() == 1) - { + if (m_AddressList && m_AddressList->getLength() == 1) { const std::string adress = m_AddressList->at(0).getAddress(); ContactAddressRef contactAddress = getApp().getContactManager().getContactAddress(adress); - if (contactAddress) - { + if (contactAddress) { popup.appendItem(*new PopupPersonIdListItem(popup, msg("IDS_MSG_OPT_VIEW_CONTACT_DETAILS_ABB"), contactAddress->getOwnerId(), contactAddress->getOwnerType(), POPUPLIST_ITEM_PRESSED_CB(Conversation, onViewContactDetailsItemPressed), this)); } else if (!isHiddenAddress()) { @@ -966,14 +906,11 @@ void Conversation::showMainPopup() void Conversation::onKeyDown(ConvRecipientsPanel &panel, Evas_Event_Key_Down &ev) { - if (ev.keyname) - { - if ((strcmp(ev.keyname, "Return") == 0)) - { + if (ev.keyname) { + if ((strcmp(ev.keyname, "Return") == 0)) { m_pBody->setFocus(true); } else { - if (m_pContactsList) - { + if (m_pContactsList) { m_pContactsList->setSearchWorld(m_pRecipPanel->getEntryText()); m_pContactsList->requestSearch(); } @@ -1001,12 +938,10 @@ void Conversation::onMbeChanged(ConvRecipientsPanel &panel) if (m_pBody) m_pBody->setMmsRecipFlag(m_pRecipPanel->isMms()); checkAndSetMsgType(); - if (m_pConvList) - { + if (m_pConvList) { std::list recips; auto items = panel.getMbeRecipients().getItems(); - for (MbeRecipientItem *item : items) - { + for (MbeRecipientItem *item : items) { recips.push_back(item->getAddress()); } ThreadId id; @@ -1036,8 +971,7 @@ void Conversation::updateMsgInputPanel() if (!m_pBody || !m_pMsgInputPanel) return; - if (m_pBody->isMms()) - { + if (m_pBody->isMms()) { // Mms: m_pMsgInputPanel->setCounter(MsgUtils::makeKbStr(m_pBody->getMsgSize())); } else { @@ -1058,13 +992,11 @@ void Conversation::updateNavibar() naviBar.clear(); naviBar.setColor(NaviBar::NaviWhiteColorId); - if (m_Mode == NewMessageMode) - { + if (m_Mode == NewMessageMode) { naviBar.setTitle(msgt("IDS_MSG_HEADER_COMPOSE_MESSAGE_ABB")); naviBar.showButton(NaviPrevButtonId, true); } else if (m_Mode == ConversationMode) { - if (m_DeleteMode) - { + if (m_DeleteMode) { updateSelectMsgTitle(); naviBar.showButton(NaviCancelButtonId, true); naviBar.showButton(NaviOkButtonId, true); @@ -1076,8 +1008,7 @@ void Conversation::updateNavibar() } else { naviBar.showButton(NaviPrevButtonId, true); MsgAddressListRef addressList = getAddressList(); - if (addressList) - { + if (addressList) { naviBar.showButton(NaviCenterButtonId, true); FrameController::setNaviBarTitle(*addressList); } @@ -1087,8 +1018,7 @@ void Conversation::updateNavibar() void Conversation::updateSelectMsgTitle() { - if (m_pConvList && m_DeleteMode) - { + if (m_pConvList && m_DeleteMode) { int checked = m_pConvList->getMessageCheckedCount(); if (checked > 0) getNaviBar().setTitle(msgArgs("IDS_MSG_HEADER_PD_SELECTED_ABB3", checked)); @@ -1101,8 +1031,7 @@ void Conversation::onButtonClicked(MessageInputPanel &obj, MessageInputPanel::Bu { MSG_LOG("MessageInputPanel: button clicked: id = ", id); - switch (id) - { + switch (id) { case MessageInputPanel::AddButtonId: m_AttachPanel.show(true); break; @@ -1139,8 +1068,7 @@ void Conversation::onAttached(ViewItem &item) void Conversation::onTransitionFinished(NaviFrameItem &item) { MSG_LOG(""); - if (m_TransFinishedFunc) - { + if (m_TransFinishedFunc) { m_TransFinishedFunc(); m_TransFinishedFunc = nullptr; } @@ -1161,21 +1089,18 @@ void Conversation::onResume() void Conversation::onHwBackButtonClicked() { MSG_LOG(""); - if (m_DeleteMode) - { + if (m_DeleteMode) { setDeleteMode(false); return; } - if (m_pRecipPanel) - { + if (m_pRecipPanel) { if (m_pRecipPanel->isMbeVisible() || m_pRecipPanel->getItemsCount() == 0) m_pRecipPanel->addRecipientsFromEntry(false); m_pRecipPanel->clearEntry(); } - if (!isRecipExists() && !isBodyEmpty() && m_Mode == NewMessageMode) - { + if (!isRecipExists() && !isBodyEmpty() && m_Mode == NewMessageMode) { showNoRecipPopup(); return; } @@ -1198,8 +1123,7 @@ void Conversation::onHwMoreButtonClicked() void Conversation::onNaviOkButtonClicked() { MSG_LOG(""); - if (m_Mode == ConversationMode && m_DeleteMode) - { + if (m_Mode == ConversationMode && m_DeleteMode) { m_pConvList->deleteSelectedItems(); setDeleteMode(false); } @@ -1208,8 +1132,7 @@ void Conversation::onNaviOkButtonClicked() void Conversation::onNaviCenterButtonClicked() { MSG_LOG(""); - if (m_pRecipPanel) - { + if (m_pRecipPanel) { onNaviExpandButtonClicked(); } else { MsgAddressListRef addressList = getAddressList(); @@ -1221,8 +1144,7 @@ void Conversation::onNaviCenterButtonClicked() void Conversation::onNaviExpandButtonClicked() { MSG_LOG(""); - if (m_pRecipPanel) - { + if (m_pRecipPanel) { bool isMbeInvisible = !m_pRecipPanel->isMbeVisible(); m_pRecipPanel->showMbe(isMbeInvisible); getNaviBar().setDownButtonState(isMbeInvisible); @@ -1231,28 +1153,22 @@ void Conversation::onNaviExpandButtonClicked() void Conversation::onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId) { - switch (buttonId) - { + switch (buttonId) { case NaviPrevButtonId: onHwBackButtonClicked(); break; - case NaviExpandButtonId: onNaviExpandButtonClicked(); break; - case NaviCenterButtonId: onNaviCenterButtonClicked(); break; - case NaviCancelButtonId: onHwBackButtonClicked(); break; - case NaviOkButtonId: onNaviOkButtonClicked(); break; - default: MSG_LOG_ERROR("Invalid buttonId: ", buttonId); break; @@ -1301,14 +1217,11 @@ void Conversation::onMsgSettingsButtonClicked(Popup &popup, int buttonId) void Conversation::onNoRecipDiscardButtonClicked(Popup &popup, int buttonId) { - if (isDefferedCmd()) - { + if (isDefferedCmd()) { if (m_pBody) m_pBody->clear(); - if (m_DefferedCmd.defaultCmd) - { // If we came from notification menu and unread threads will be more than one, we should to go back on thread list view - if (m_DefferedCmd.defaultCmd->getDefaultType() == AppControlDefault::NotificationType && getMsgEngine().getStorage().getUnreadThreadCount() > 1) - { + if (m_DefferedCmd.defaultCmd) { // If we came from notification menu and unread threads will be more than one, we should to go back on thread list view + if (m_DefferedCmd.defaultCmd->getDefaultType() == AppControlDefault::NotificationType && getMsgEngine().getStorage().getUnreadThreadCount() > 1) { pop(); } else { // Go to needed conversation @@ -1407,13 +1320,10 @@ void Conversation::onViewContactDetailsItemPressed(PopupListItem &item) void Conversation::onAllConvItemsDeleted(ConvList &list) { MSG_LOG(""); - if (m_Mode != NewMessageMode) - { + if (m_Mode != NewMessageMode) { auto convList = getMsgEngine().getStorage().getConversationList(m_ThreadId); - if ((convList && convList->getLength() == 0) || !convList) - { - if (isBodyEmpty()) - { + if ((convList && convList->getLength() == 0) || !convList) { + if (isBodyEmpty()) { onHwBackButtonClicked(); } else { // Current MsgThread is dead, so create new MsgThread from existing recipients. diff --git a/src/Conversation/Main/View/inc/ConversationLayout.h b/src/Conversation/Main/View/inc/ConversationLayout.h index 0a3dc4c9..044e0ffd 100644 --- a/src/Conversation/Main/View/inc/ConversationLayout.h +++ b/src/Conversation/Main/View/inc/ConversationLayout.h @@ -21,11 +21,9 @@ #include -namespace Msg -{ +namespace Msg { class ConversationLayout - : public View - { + : public View { public: ConversationLayout(Evas_Object *parent); virtual ~ConversationLayout(); diff --git a/src/Conversation/Main/View/inc/MessageInputPanel.h b/src/Conversation/Main/View/inc/MessageInputPanel.h index 47efb25f..603207f6 100644 --- a/src/Conversation/Main/View/inc/MessageInputPanel.h +++ b/src/Conversation/Main/View/inc/MessageInputPanel.h @@ -21,16 +21,13 @@ #include -namespace Msg -{ +namespace Msg { class IMessageInputPanelListener; class MessageInputPanel - : public View - { + : public View { public: - enum ButtonId - { + enum ButtonId { AddButtonId, SendButtonId }; @@ -65,8 +62,7 @@ namespace Msg Evas_Object *m_pAddButton; }; - class IMessageInputPanelListener - { + class IMessageInputPanelListener { public: virtual ~IMessageInputPanelListener() {} virtual void onButtonClicked(MessageInputPanel &obj, MessageInputPanel::ButtonId id) {}; diff --git a/src/Conversation/Main/View/src/MessageInputPanel.cpp b/src/Conversation/Main/View/src/MessageInputPanel.cpp index 107a765a..d0fe6e3c 100644 --- a/src/Conversation/Main/View/src/MessageInputPanel.cpp +++ b/src/Conversation/Main/View/src/MessageInputPanel.cpp @@ -30,8 +30,7 @@ using namespace Msg; #define BUTTON_PRESSED_COLOR 60, 75, 140, 255 #define BUTTON_DISABLED_COLOR 179, 197, 218, 255 -namespace -{ +namespace { const char *buttonIdKey = "id"; } @@ -91,16 +90,13 @@ void MessageInputPanel::setDisabledColor(Evas_Object *button) Evas_Object *MessageInputPanel::getButton(ButtonId id) { - switch (id) - { + switch (id) { case AddButtonId: return m_pAddButton; break; - case SendButtonId: return m_pSendButton; break; - default: MSG_ASSERT(false, "Unknown button id"); break; @@ -158,8 +154,7 @@ void MessageInputPanel::setListener(IMessageInputPanelListener *l) void MessageInputPanel::onButtonClicked(Evas_Object *obj, void *event_info) { feedback_play(FEEDBACK_PATTERN_TAP); - if (m_pListener) - { + if (m_pListener) { int id = (int)(intptr_t)evas_object_data_get(obj, buttonIdKey); m_pListener->onButtonClicked(*this, (ButtonId)id); } diff --git a/src/Conversation/Recipients/Controller/inc/ConvRecipientsPanel.h b/src/Conversation/Recipients/Controller/inc/ConvRecipientsPanel.h index 24b33ed4..e1392bef 100644 --- a/src/Conversation/Recipients/Controller/inc/ConvRecipientsPanel.h +++ b/src/Conversation/Recipients/Controller/inc/ConvRecipientsPanel.h @@ -25,16 +25,14 @@ #include "ContactPicker.h" #include "ContactManager.h" -namespace Msg -{ +namespace Msg { class IConvRecipientsPanelListener; class ConvRecipientsPanel : public ConvRecipientsPanelView , private IContactPickerListener , private IMbeRecipientsListener - , private IContactManagerListener - { + , private IContactManagerListener { public: ConvRecipientsPanel(Evas_Object *parent, App &app); virtual ~ConvRecipientsPanel(); @@ -91,8 +89,7 @@ namespace Msg MbeRecipients *m_pMbe; }; - class IConvRecipientsPanelListener - { + class IConvRecipientsPanelListener { public: virtual ~IConvRecipientsPanelListener() {} diff --git a/src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp b/src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp index ac62108e..ab74cd29 100644 --- a/src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp +++ b/src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp @@ -47,8 +47,7 @@ ConvRecipientsPanel::~ConvRecipientsPanel() void ConvRecipientsPanel::read(Message &msg) { auto list = m_pMbe->getItems(); - for (auto it : list) - { + for (auto it : list) { MbeRecipientItem *recipItem = static_cast(it); MsgAddress &msgAddr = msg.addAddress(); msgAddr.setAddress(recipItem->getAddress()); @@ -56,8 +55,7 @@ void ConvRecipientsPanel::read(Message &msg) msgAddr.setAddressType(recipItem->getAddressType()); } - if (list.empty()) - { + if (list.empty()) { showInvalidIcon(true); showAddRecipNotif(); setEntryFocus(true); @@ -72,8 +70,7 @@ void ConvRecipientsPanel::write(const Message &msg) bool ConvRecipientsPanel::isMms() const { auto items = m_pMbe->getItems(); - for (MbeRecipientItem *it : items) - { + for (MbeRecipientItem *it : items) { MbeRecipientItem *item = static_cast(it); if (item->getAddressType() == MsgAddress::Email) return true; @@ -93,23 +90,20 @@ bool ConvRecipientsPanel::addRecipientsFromEntry(bool showPopup) TokenizedRecipients result = MsgUtils::tokenizeRecipients(text); bool duplicateFound = false; - for (auto &it : result.validResults) - { + for (auto &it : result.validResults) { if (it.second == MsgAddress::Phone) it.first = MsgUtils::makeNormalizedNumber(it.first); duplicateFound |= appendItem(it.first, it.second) == MbeRecipients::DuplicatedStatus; } - if (duplicateFound) - { + if (duplicateFound) { showDuplicatedRecipientNotif(); return false; } setEntryText(result.invalidResult); - if (!result.invalidResult.empty() && showPopup) - { + if (!result.invalidResult.empty() && showPopup) { showInvalidRecipientPopup(); return false; } @@ -130,8 +124,7 @@ void ConvRecipientsPanel::update(const MsgAddressList &addressList) { clearMbe(); int addrListLen = addressList.getLength(); - for (int i = 0; i < addrListLen; ++i) - { + for (int i = 0; i < addrListLen; ++i) { auto &addr = addressList.at(i); appendItem(addr.getAddress(), addr.getAddressType()); } @@ -159,8 +152,7 @@ MbeRecipients::AppendItemStatus ConvRecipientsPanel::appendItem(const std::strin void ConvRecipientsPanel::execCmd(const AppControlComposeRef &cmd) { m_pMbe->clear(); - for (auto recipStr: cmd->getRecipientList()) - { + for (auto recipStr: cmd->getRecipientList()) { appendStatusHandler(appendItem(recipStr)); } } @@ -172,8 +164,7 @@ int ConvRecipientsPanel::getMaxRecipientCount() const void ConvRecipientsPanel::appendStatusHandler(MbeRecipients::AppendItemStatus status) { - switch (status) - { + switch (status) { case MbeRecipients::SuccessStatus: showInvalidIcon(false); if (getEntryFocus()) @@ -200,12 +191,10 @@ void ConvRecipientsPanel::appendStatusHandler(MbeRecipients::AppendItemStatus st void ConvRecipientsPanel::onKeyDown(Evas_Event_Key_Down *ev) { - if (ev && ev->keyname) - { + if (ev && ev->keyname) { MSG_LOG("Key: ", ev->keyname); - if ((strcmp(ev->keyname, "semicolon") == 0) || (strcmp(ev->keyname, "comma") == 0)) - { + if ((strcmp(ev->keyname, "semicolon") == 0) || (strcmp(ev->keyname, "comma") == 0)) { addRecipientsFromEntry(); } else { if (m_pListener) @@ -222,8 +211,7 @@ void ConvRecipientsPanel::onEntryFocusChanged() if (!getEntryFocus()) showButton(ContactButton); - if (getEntryFocus()) - { + if (getEntryFocus()) { expandRecipients(); } else { addRecipientsFromEntry(); @@ -240,8 +228,7 @@ void ConvRecipientsPanel::onEntryFocusChanged() void ConvRecipientsPanel::onEntryChanged() { unselectMbeItem(); - if (!isEntryEmpty() && getEntryFocus()) - { + if (!isEntryEmpty() && getEntryFocus()) { showButton(PlusButton); showInvalidIcon(false); } else { @@ -273,16 +260,14 @@ void ConvRecipientsPanel::onContactsPicked(const std::list &addressI int addressOfInvalids = 0; int duplicateRecip = 0; int sizeOfList = addressIdList.size(); - for (auto &addressData : addressIdList) - { + for (auto &addressData : addressIdList) { ContactAddressRef address; if (addressData.type == IContactPickerListener::PhoneType) address = m_App.getContactManager().getContactPersonNumber(addressData.id); else if (addressData.type == IContactPickerListener::EmailType) address = m_App.getContactManager().getContactPersonEmail(addressData.id); - if (address) - { + if (address) { auto apendStatus = appendItem(address->getAddress(), address->getDispName(), MsgAddress::UnknownAddressType); if (apendStatus == MbeRecipients::InvalidRecipStatus) ++addressOfInvalids; diff --git a/src/Conversation/Recipients/View/inc/ConvRecipientsPanelView.h b/src/Conversation/Recipients/View/inc/ConvRecipientsPanelView.h index e9af3982..39df3886 100644 --- a/src/Conversation/Recipients/View/inc/ConvRecipientsPanelView.h +++ b/src/Conversation/Recipients/View/inc/ConvRecipientsPanelView.h @@ -23,11 +23,9 @@ #include #include -namespace Msg -{ +namespace Msg { class ConvRecipientsPanelView - : public View - { + : public View { public: ConvRecipientsPanelView(Evas_Object *parent, int entryMaxCharCount); virtual ~ConvRecipientsPanelView(); @@ -59,8 +57,7 @@ namespace Msg void updateShortenedRecipients(); protected: - enum ButtonType - { + enum ButtonType { NoneButton, ContactButton, PlusButton diff --git a/src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp b/src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp index 0b368a68..0b9d41cc 100644 --- a/src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp +++ b/src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp @@ -27,8 +27,7 @@ using namespace Msg; #define BUTTON_COLOR 61, 185, 204, 255 #define BUTTON_PRESSED_COLOR 50, 160, 170, 255 -namespace -{ +namespace { const char *buttonPart = "swl.contact_btn"; } @@ -65,19 +64,15 @@ void ConvRecipientsPanelView::showButton(ButtonType buttonType) if (button) evas_object_hide(button); - switch (buttonType) - { + switch (buttonType) { case NoneButton: break; - case ContactButton: elm_object_part_content_set(m_pLayout, buttonPart, getContactBtn()); break; - case PlusButton: elm_object_part_content_set(m_pLayout, buttonPart, getPlusBtn()); break; - default: assert(false); break; @@ -87,28 +82,22 @@ void ConvRecipientsPanelView::showButton(ButtonType buttonType) void ConvRecipientsPanelView::setButtonEnabled(ButtonType buttonType, bool enabled) { Evas_Object *pBtn = nullptr; - switch (buttonType) - { + switch (buttonType) { case NoneButton: break; - case ContactButton: pBtn = getContactBtn(); break; - case PlusButton: pBtn = getPlusBtn(); break; - default: assert(false); break; } - if(pBtn) - { + if (pBtn) elm_object_disabled_set(pBtn, !enabled); - } } void ConvRecipientsPanelView::addGeometryChangedCb(Evas_Object *obj) @@ -185,8 +174,7 @@ std::string ConvRecipientsPanelView::getEntryText() const void ConvRecipientsPanelView::setEntryText(const std::string &utf8) { char *text = elm_entry_utf8_to_markup(utf8.c_str()); - if (text) - { + if (text) { elm_entry_entry_set(m_pEntry, text); elm_entry_cursor_end_set(m_pEntry); free(text); @@ -276,8 +264,7 @@ Evas_Object *ConvRecipientsPanelView::createClearButton(Evas_Object *parent) Evas_Object *ConvRecipientsPanelView::getContactBtn() { - if (m_pContactBtn) - { + if (m_pContactBtn) { evas_object_show(m_pContactBtn); return m_pContactBtn; } @@ -307,8 +294,7 @@ Evas_Object *ConvRecipientsPanelView::getContactBtn() Evas_Object *ConvRecipientsPanelView::getPlusBtn() { - if (m_pPlusBtn) - { + if (m_pPlusBtn) { evas_object_show(m_pPlusBtn); return m_pPlusBtn; } @@ -365,8 +351,7 @@ void ConvRecipientsPanelView::setContactBtnColor(Evas_Object *btn, int r, int g, void ConvRecipientsPanelView::deleteNextRecipient() { - if (!isMbeEmpty()) - { + if (!isMbeEmpty()) { Elm_Object_Item *selectedItem = elm_multibuttonentry_selected_item_get(*m_pMbe); if (selectedItem) elm_object_item_del(selectedItem); @@ -379,8 +364,7 @@ void ConvRecipientsPanelView::selectLastItem() { Elm_Object_Item *lastItem = elm_multibuttonentry_last_item_get(*m_pMbe); - if (lastItem) - { + if (lastItem) { elm_object_focus_allow_set(*m_pMbe, true); elm_multibuttonentry_item_selected_set(lastItem, true); } else { @@ -420,8 +404,7 @@ void ConvRecipientsPanelView::collapseRecipients() void ConvRecipientsPanelView::expandRecipients() { showMbe(!isMbeEmpty()); - if (!m_IsEditItemClicked) - { + if (!m_IsEditItemClicked) { setEntryText(m_SavedRecipText); } else { setEditMode(false); @@ -433,8 +416,7 @@ void ConvRecipientsPanelView::updateShortenedRecipients() { const auto &items = m_pMbe->getItems(); std::string shortenedRecipients; - if (!items.empty()) - { + if (!items.empty()) { shortenedRecipients = items[0]->getDispName(); if (items.size() > 1) shortenedRecipients += " + " + std::to_string(items.size() - 1); @@ -445,8 +427,7 @@ void ConvRecipientsPanelView::updateShortenedRecipients() void ConvRecipientsPanelView::editSelectedItem() { MbeRecipientItem* pItem = getSelectedItem(); - if (pItem) - { + if (pItem) { setEditMode(true); setEntryText(pItem->getAddress()); showEntry(true); @@ -460,8 +441,7 @@ void ConvRecipientsPanelView::editSelectedItem() void ConvRecipientsPanelView::removeSelectedItem() { MbeRecipientItem* pItem = getSelectedItem(); - if (pItem) - { + if (pItem) { pItem->destroy(); if (isMbeEmpty()) showMbe(false, false); diff --git a/src/Conversation/Utils/inc/AttachmentHandler.h b/src/Conversation/Utils/inc/AttachmentHandler.h index 27d66820..66040111 100644 --- a/src/Conversation/Utils/inc/AttachmentHandler.h +++ b/src/Conversation/Utils/inc/AttachmentHandler.h @@ -26,12 +26,10 @@ #include #include "WorkingDir.h" -namespace Msg -{ +namespace Msg { class IAttachmentHandlerListener; - class AttachmentHandler - { + class AttachmentHandler { public: AttachmentHandler(WorkingDirRef workingDir); ~AttachmentHandler(); @@ -65,8 +63,7 @@ namespace Msg std::queue m_Task; }; - class IAttachmentHandlerListener - { + class IAttachmentHandlerListener { public: virtual ~IAttachmentHandlerListener() {}; virtual long long onFreeSpaceRequest() = 0; diff --git a/src/Conversation/Utils/inc/MessageDetailContent.h b/src/Conversation/Utils/inc/MessageDetailContent.h index 2edaa384..aec910eb 100644 --- a/src/Conversation/Utils/inc/MessageDetailContent.h +++ b/src/Conversation/Utils/inc/MessageDetailContent.h @@ -22,12 +22,9 @@ #include "App.h" #include -namespace Msg -{ - namespace MessageDetailContent - { - enum TextStyle - { +namespace Msg { + namespace MessageDetailContent { + enum TextStyle { ViewDetailsTextStyle, DownloadTextStyle }; diff --git a/src/Conversation/Utils/inc/WorkingDir.h b/src/Conversation/Utils/inc/WorkingDir.h index 7d6d01d2..e44fb6b7 100644 --- a/src/Conversation/Utils/inc/WorkingDir.h +++ b/src/Conversation/Utils/inc/WorkingDir.h @@ -21,10 +21,8 @@ #include #include -namespace Msg -{ - class WorkingDir - { +namespace Msg { + class WorkingDir { public: WorkingDir(); ~WorkingDir(); diff --git a/src/Conversation/Utils/src/AttachmentHandler.cpp b/src/Conversation/Utils/src/AttachmentHandler.cpp index 67006145..132c3cb9 100644 --- a/src/Conversation/Utils/src/AttachmentHandler.cpp +++ b/src/Conversation/Utils/src/AttachmentHandler.cpp @@ -31,7 +31,6 @@ AttachmentHandler::AttachmentHandler(WorkingDirRef workingDir) , m_ThreadCreated(false) , m_NeedTerminate(false) { - } AttachmentHandler::~AttachmentHandler() @@ -46,13 +45,11 @@ AttachmentHandler::~AttachmentHandler() void AttachmentHandler::processFile(const std::string &file) { - if (!m_ThreadCreated) - { - if (eina_thread_create(&m_Thread, EINA_THREAD_NORMAL, 0, on_routine_cb, this)) - { + if (!m_ThreadCreated) { + if (eina_thread_create(&m_Thread, EINA_THREAD_NORMAL, 0, on_routine_cb, this)) { m_ThreadCreated = true; } else { - if(m_pListener) + if (m_pListener) m_pListener->onFileFails(); } } @@ -104,8 +101,7 @@ void *AttachmentHandler::on_routine_cb(void *data, Eina_Thread t) void AttachmentHandler::onRoutine() { - while (!m_NeedTerminate) - { + while (!m_NeedTerminate) { std::unique_lock _lock(m_Mutex); if (m_Task.empty() && !m_NeedTerminate) m_Condition.wait(_lock); @@ -116,27 +112,23 @@ void AttachmentHandler::onRoutine() m_Task.pop(); _lock.unlock(); - if (!FileUtils::isExists(m_CurrentFile) || FileUtils::isDir(m_CurrentFile)) - { + if (!FileUtils::isExists(m_CurrentFile) || FileUtils::isDir(m_CurrentFile)) { MSG_LOG_ERROR("File not exists: ", m_CurrentFile); ecore_main_loop_thread_safe_call_sync(safeCallOnFileFails, this); continue; } m_CurrentFile = m_WorkingDir->addFile(m_CurrentFile); - if (m_CurrentFile.empty()) - { + if (m_CurrentFile.empty()) { MSG_LOG_ERROR("Error while copy file"); ecore_main_loop_thread_safe_call_sync(safeCallOnFileFails, this); continue; } ecore_main_loop_thread_safe_call_sync(safeCallOnFreeSpaceRequest, this); - if (FileUtils::getFileSize(m_CurrentFile) > m_CurrentFreeSpace) - { + if (FileUtils::getFileSize(m_CurrentFile) > m_CurrentFreeSpace) { bool isImage = getMsgMediaTypeByFileExt(m_CurrentFile).type == MsgMedia::ImageType; - if ((isImage && MediaUtils::downgradeImageQuality(m_CurrentFile) > m_CurrentFreeSpace) || !isImage) - { + if ((isImage && MediaUtils::downgradeImageQuality(m_CurrentFile) > m_CurrentFreeSpace) || !isImage) { m_WorkingDir->removeFile(m_CurrentFile); ecore_main_loop_thread_safe_call_sync(safeCallOnFileFails, this); continue; diff --git a/src/Conversation/Utils/src/MessageDetailContent.cpp b/src/Conversation/Utils/src/MessageDetailContent.cpp index 9a5392cb..7836e9ad 100644 --- a/src/Conversation/Utils/src/MessageDetailContent.cpp +++ b/src/Conversation/Utils/src/MessageDetailContent.cpp @@ -25,13 +25,10 @@ #include #include -namespace Msg -{ -namespace MessageDetailContent -{ +namespace Msg { +namespace MessageDetailContent { -namespace -{ +namespace { const std::string secondTextColor = "#737373"; const unsigned int mainTextSize = 40; const unsigned int secondTextSize = 32; @@ -52,8 +49,7 @@ std::string getMessageType(Message::Type msgType) std::string msgDetails = makeMainText(msg("IDS_MSG_POP_TYPE")); msgDetails.append("
"); - switch (msgType) - { + switch (msgType) { case Message::MT_SMS: msgDetails.append(makeSecondText(msg("IDS_MSGF_OPT_TEXT_MESSAGE"))); break; @@ -75,21 +71,18 @@ std::string getContactsInfo(App &app, Message::Direction msgDirection, ThreadId MsgAddressListRef addrList = app.getMsgEngine().getStorage().getAddressList(msgThreadId); std::string contactsInfo; - if (msgDirection == Message::MD_Sent) - { + if (msgDirection == Message::MD_Sent) { contactsInfo.append(msg("IDS_MSG_HEADER_TO_M_RECIPIENT")); contactsInfo.append("
"); } - if (msgDirection == Message::MD_Received) - { + if (msgDirection == Message::MD_Received) { contactsInfo.append(makeMainText(msg("IDS_MSG_BODY_FROM_ABB_M_PERIOD"))); contactsInfo.append("
"); } int addressListLength = addrList->getLength(); - for (int i = 0; i < addressListLength; ++i) - { + for (int i = 0; i < addressListLength; ++i) { std::string address = addrList->at(i).getAddress(); contactsInfo.append(makeSecondText(makeDispAddress(app, address))); if (i != addressListLength - 1) @@ -119,50 +112,37 @@ std::string makeDeliveryReportResult(App &app, Message::NetworkStatus msgStatus, std::string deliverText = makeMainText(msg("IDS_MSGF_BODY_DELIVERY_REPORT")); bool deliverFlag = app.getMsgEngine().getStorage().isDeliverReportChecked(msgId); - if (deliverFlag) - { + if (deliverFlag) { MsgReportListRef reportList = app.getMsgEngine().getStorage().getMsgReportList(msgId); int size = reportList->getLength(); bool isDelivReportExists = false; - for (int i = 0; i < size; i++) - { + for (int i = 0; i < size; i++) { const MsgReport &report = reportList->at(i); - if (report.getType() == MsgReport::TypeDelivery) - { + if (report.getType() == MsgReport::TypeDelivery) { isDelivReportExists = true; deliverText.append("
"); deliverText.append(makeSecondText(makeDispAddress(app, report.getAddress()))); deliverText.append(makeSecondText(": ")); MsgReport::DeliveryStatus deliveryStatus = report.getDeliveryStatus(); - switch (deliveryStatus) - { + switch (deliveryStatus) { case MsgReport::StatusSuccess: - { deliverText.append(makeSecondText(msg("IDS_MSG_BODY_DELIVERED_M_STATUS"))); break; - } case MsgReport::StatusExpired: - { deliverText.append(makeSecondText(msg("IDS_MSGF_BODY_EXPIRED"))); break; - } case MsgReport::StatusRejected: - { deliverText.append(makeSecondText(msg("IDS_MSGF_POP_REJECTED"))); break; - } case MsgReport::StatusNone: - { deliverText.append(makeSecondText(msg("IDS_MSG_BODY_REQUESTED_M_MESSAGE_STATUS"))); break; - } } } } - if (!isDelivReportExists) - { + if (!isDelivReportExists) { deliverText.append("
"); deliverText.append(makeSecondText(msg("IDS_MSGF_BODY_UNKNOWN"))); } @@ -180,8 +160,7 @@ std::string getSmsStatus(Message::NetworkStatus msgStatus) std::string status = makeMainText(msg("IDS_MSG_BODY_STATUS_C")); status.append("
"); - switch (msgStatus) - { + switch (msgStatus) { case Message::NS_Sending: status.append(makeSecondText(msg("IDS_MSG_BODY_SENDING_ING_M_STATUS_ABB"))); break; @@ -208,8 +187,7 @@ std::string getMmsSubject(const Message &message, int style) { std::string msgDetails; std::string subject = message.getSubject(); - switch (style) - { + switch (style) { case ViewDetailsTextStyle: msgDetails.append(makeMainText(msg("IDS_MSG_HEADER_SUBJECT"))).append("
"); if (subject.empty()) @@ -241,8 +219,7 @@ std::string getMmsMessageSize(const Message &message, int style) { int msgSize = message.getSize(); std::string msgDetails; - switch (style) - { + switch (style) { case ViewDetailsTextStyle: msgDetails.append(makeMainText(msg("IDS_MSGF_BODY_MESSAGE_SIZE"))); msgDetails.append("
"); @@ -266,14 +243,12 @@ std::string getMmsMessageExpired(const Message &message, int style) { const MessageMms *mms = dynamic_cast(&message); std::string msgDetails; - switch (style) - { + switch (style) { case ViewDetailsTextStyle: msgDetails.append("

"); msgDetails.append(makeMainText(msg("IDS_MSG_BODY_EXPIRES_ON_C"))); msgDetails.append("
"); - if (mms) - { + if (mms) { time_t msgExpired = mms->getExpired(); msgDetails.append(makeSecondText(TimeUtils::makeDateString(msgExpired))); } @@ -281,8 +256,7 @@ std::string getMmsMessageExpired(const Message &message, int style) case DownloadTextStyle: msgDetails.append(msg("IDS_MSG_BODY_EXPIRES_ON_C")); msgDetails.append(" "); - if (mms) - { + if (mms) { time_t msgExpired = mms->getExpired(); msgDetails.append(TimeUtils::makeDateString(msgExpired)); } @@ -299,51 +273,38 @@ std::string makeReadReportResult(App &app, MsgId msgId, ThreadId msgThreadId, Me { std::string readReport = makeMainText(msg("IDS_MSGF_POP_READ_REPORT")); bool readFlag = app.getMsgEngine().getStorage().isReadReportChecked(msgId); - if (readFlag) - { + if (readFlag) { MsgReportListRef reportList = app.getMsgEngine().getStorage().getMsgReportList(msgId); int size = reportList->getLength(); bool isReadReportExists = false; - for (int i = 0; i < size; i++) - { + for (int i = 0; i < size; i++) { const MsgReport &report = reportList->at(i); - if (report.getType() == MsgReport::TypeRead) - { + if (report.getType() == MsgReport::TypeRead) { isReadReportExists = true; readReport.append("
"); readReport.append(makeSecondText(makeDispAddress(app, report.getAddress()))); readReport.append(makeSecondText(": ")); MsgReport::ReadStatus readStatus = report.getReadStatus(); - switch (readStatus) - { + switch (readStatus) { case MsgReport::ReadStatusIsRead: - { readReport.append(makeSecondText(msg("IDS_MSGF_BODY_MMSREADREPLYMSGREAD"))); break; - } case MsgReport::ReadStatusIsDeleted: - { readReport.append(makeSecondText(msg("IDS_MSG_POP_DELETED"))); break; - } case MsgReport::ReadStatusNone: - { readReport.append(makeSecondText(msg("IDS_MSG_BODY_REQUESTED_M_MESSAGE_STATUS"))); break; - } default: - { readReport.append(makeSecondText(msg("IDS_MSGF_BODY_UNKNOWN"))); - } } } } - if (!isReadReportExists) - { + if (!isReadReportExists) { readReport.append("
"); readReport.append(makeSecondText(msg("IDS_MSGF_BODY_UNKNOWN"))); } diff --git a/src/Conversation/Utils/src/WorkingDir.cpp b/src/Conversation/Utils/src/WorkingDir.cpp index dc46f2a3..e0c07562 100644 --- a/src/Conversation/Utils/src/WorkingDir.cpp +++ b/src/Conversation/Utils/src/WorkingDir.cpp @@ -46,30 +46,25 @@ void WorkingDir::createWorkingDir() // Create common dir. if not exists: std::string commonDir = PathUtils::getDataPath(commonWorkingDirName); bool isCommonExists = FileUtils::isExists(commonDir); - if (!isCommonExists) - { + if (!isCommonExists) { isCommonExists = FileUtils::makeDir(commonDir); MSG_ASSERT(isCommonExists, "Can't create common working dir: ", commonDir); } // Create current dir: - if (isCommonExists) - { + if (isCommonExists) { std::string uniqueDir = getUniqueDirName(commonDir + "/" + currentWorkingDirPrefix); FileUtils::makeDir(uniqueDir); bool isExists = FileUtils::isExists(uniqueDir); MSG_ASSERT(isExists, "Can't create current working dir: ", uniqueDir); if (isExists) - { m_Path = uniqueDir; - } } } void WorkingDir::removeWorkingDir() { - if (!m_Path.empty()) - { + if (!m_Path.empty()) { bool res = FileUtils::remove(m_Path, true); MSG_LOG("Working dir remove with result = ", res); } @@ -96,16 +91,13 @@ std::string WorkingDir::addFile(const std::string &path) std::lock_guard _lock(m_Mutex); std::string newPath; - if (FileUtils::isExists(path)) - { - if (path.find(m_Path) != std::string::npos) - { + if (FileUtils::isExists(path)) { + if (path.find(m_Path) != std::string::npos) { newPath = path; MSG_LOG("File is already exists: ", newPath); } else { newPath = genUniqueFilePath(path); - if (FileUtils::copy(path, newPath)) - { + if (FileUtils::copy(path, newPath)) { MSG_LOG("File added: ", newPath); } else { MSG_LOG_ERROR("Can't copy to working dir: ", path); @@ -125,8 +117,7 @@ std::string WorkingDir::addTextFile(const std::string &text, const std::string & std::string path = genUniqueFilePath(result); std::ofstream file(path, std::ofstream::trunc | std::ofstream::binary | std::ofstream::out); - if (file.is_open()) - { + if (file.is_open()) { file << text; MSG_LOG("Text file added: ", path); } else { @@ -153,11 +144,9 @@ std::string WorkingDir::getUniqueDirName(const std::string &path) { std::string res; unsigned i = 0; - do - { + do { res = path + "-" + std::to_string(i); ++i; - } - while (FileUtils::isExists(res)); + } while (FileUtils::isExists(res)); return res; } diff --git a/src/MainApp/MainApp.cpp b/src/MainApp/MainApp.cpp index 1f7ebf04..4988f615 100644 --- a/src/MainApp/MainApp.cpp +++ b/src/MainApp/MainApp.cpp @@ -96,8 +96,7 @@ const Window &MainApp::getWindow() const void MainApp::terminate() { - if (m_NeedToCloseApp) - { + if (m_NeedToCloseApp) { // Close app completely ui_app_exit(); } else if (m_pWindow) { @@ -162,8 +161,7 @@ void MainApp::onAppControl(app_control_h app_control) app_control_get_launch_mode(app_control, &mode); m_NeedToCloseApp = (mode == APP_CONTROL_LAUNCH_MODE_GROUP); - switch (cmd->getOperationType()) - { + switch (cmd->getOperationType()) { case AppControlCommand::OpDefault: if (m_pRootController) m_pRootController->execCmd(std::static_pointer_cast(cmd)); @@ -189,21 +187,17 @@ void MainApp::updateCharacterOrientation() { char *lang = nullptr; system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &lang); - if (lang) - { + if (lang) { MSG_LOG("Language: ", lang); elm_language_set(lang); i18n_ulocale_layout_type_e layout = I18N_ULOCALE_LAYOUT_UNKNOWN; - if (i18n_ulocale_get_character_orientation(lang, &layout) == I18N_ERROR_NONE) - { + if (i18n_ulocale_get_character_orientation(lang, &layout) == I18N_ERROR_NONE) { if (layout == I18N_ULOCALE_LAYOUT_LTR) elm_config_mirrored_set(false); else if (layout == I18N_ULOCALE_LAYOUT_RTL) elm_config_mirrored_set(true); else - { MSG_LOG_ERROR("Unsupported character orientation type: ", layout); - } } free(lang); } diff --git a/src/MainApp/MainApp.h b/src/MainApp/MainApp.h index c8bf4fdf..c5c24ebf 100644 --- a/src/MainApp/MainApp.h +++ b/src/MainApp/MainApp.h @@ -23,14 +23,12 @@ #include #include -namespace Msg -{ +namespace Msg { class StandardWindow; class NaviFrameController; class MainApp: - public App - { + public App { public: MainApp(); virtual ~MainApp(); diff --git a/src/MsgThread/Controller/inc/BaseThreadListItem.h b/src/MsgThread/Controller/inc/BaseThreadListItem.h index 3deb778a..464bae0b 100644 --- a/src/MsgThread/Controller/inc/BaseThreadListItem.h +++ b/src/MsgThread/Controller/inc/BaseThreadListItem.h @@ -26,11 +26,9 @@ #include -namespace Msg -{ +namespace Msg { class BaseThreadListItem - : public ThreadListViewItem - { + : public ThreadListViewItem { public: BaseThreadListItem(App &app); virtual ~BaseThreadListItem(); diff --git a/src/MsgThread/Controller/inc/MsgSearchListItem.h b/src/MsgThread/Controller/inc/MsgSearchListItem.h index fad0732e..0efe05dd 100644 --- a/src/MsgThread/Controller/inc/MsgSearchListItem.h +++ b/src/MsgThread/Controller/inc/MsgSearchListItem.h @@ -20,11 +20,9 @@ #include "BaseThreadListItem.h" #include "Message.h" -namespace Msg -{ +namespace Msg { class MsgSearchListItem - : public BaseThreadListItem - { + : public BaseThreadListItem { public: MsgSearchListItem(App &app, const Message &msg, const std::string &searchWord); virtual ~MsgSearchListItem(); diff --git a/src/MsgThread/Controller/inc/MsgThread.h b/src/MsgThread/Controller/inc/MsgThread.h index 876dd747..eff7be55 100644 --- a/src/MsgThread/Controller/inc/MsgThread.h +++ b/src/MsgThread/Controller/inc/MsgThread.h @@ -33,8 +33,7 @@ #include #include -namespace Msg -{ +namespace Msg { class SelectAllListItem; class NaviFrameController; class ThreadListItem; @@ -47,8 +46,7 @@ namespace Msg , private IFloatingButtonListener , private IThreadListListener , private IThreadSearchListListener - , private ISystemSettingsManager - { + , private ISystemSettingsManager { public: MsgThread(NaviFrameController &parent); virtual ~MsgThread(); @@ -88,8 +86,7 @@ namespace Msg virtual void onLanguageChanged(); private: - enum Mode - { + enum Mode { InitMode, DeleteMode, NormalMode, diff --git a/src/MsgThread/Controller/inc/ThreadList.h b/src/MsgThread/Controller/inc/ThreadList.h index f816ad7e..f07eec73 100644 --- a/src/MsgThread/Controller/inc/ThreadList.h +++ b/src/MsgThread/Controller/inc/ThreadList.h @@ -24,8 +24,7 @@ #include "MsgTypes.h" #include -namespace Msg -{ +namespace Msg { class IThreadListListener; class SelectAllListItem; class ThreadListItem; @@ -36,8 +35,7 @@ namespace Msg , private IMsgStorageListener , private IListViewListener , private IContactManagerListener - , private ISystemSettingsManager - { + , private ISystemSettingsManager { public: ThreadList(Evas_Object *parent, App &app); virtual ~ThreadList(); @@ -88,8 +86,7 @@ namespace Msg bool m_DeleteMode; }; - class IThreadListListener - { + class IThreadListListener { public: virtual ~IThreadListListener() {} virtual void onListItemSelected(ThreadId id) {}; diff --git a/src/MsgThread/Controller/inc/ThreadListItem.h b/src/MsgThread/Controller/inc/ThreadListItem.h index 70b691e4..cebbceb5 100644 --- a/src/MsgThread/Controller/inc/ThreadListItem.h +++ b/src/MsgThread/Controller/inc/ThreadListItem.h @@ -24,11 +24,9 @@ #include "ContactManager.h" #include "App.h" -namespace Msg -{ +namespace Msg { class ThreadListItem - : public BaseThreadListItem - { + : public BaseThreadListItem { public: ThreadListItem(const MsgThreadItem &threadItem, App &app); virtual ~ThreadListItem(); diff --git a/src/MsgThread/Controller/inc/ThreadSearchList.h b/src/MsgThread/Controller/inc/ThreadSearchList.h index 21eea3b2..546ecba4 100644 --- a/src/MsgThread/Controller/inc/ThreadSearchList.h +++ b/src/MsgThread/Controller/inc/ThreadSearchList.h @@ -24,8 +24,7 @@ #include -namespace Msg -{ +namespace Msg { class IThreadSearchListListener; class ThreadSearchList @@ -33,8 +32,7 @@ namespace Msg , private IListViewListener , private IContactManagerListener , private ISystemSettingsManager - , private IMsgStorageListener - { + , private IMsgStorageListener { public: ThreadSearchList(Evas_Object *parent, App &app); virtual ~ThreadSearchList(); @@ -70,8 +68,7 @@ namespace Msg IThreadSearchListListener *m_pListener; }; - class IThreadSearchListListener - { + class IThreadSearchListListener { public: virtual ~IThreadSearchListListener() {} virtual void onSearchListChanged() {}; diff --git a/src/MsgThread/Controller/inc/ThreadSearchListItem.h b/src/MsgThread/Controller/inc/ThreadSearchListItem.h index f18a3bd2..6822a555 100644 --- a/src/MsgThread/Controller/inc/ThreadSearchListItem.h +++ b/src/MsgThread/Controller/inc/ThreadSearchListItem.h @@ -21,11 +21,9 @@ #include "MsgThreadItem.h" #include "MsgTypes.h" -namespace Msg -{ +namespace Msg { class ThreadSearchListItem - : public BaseThreadListItem - { + : public BaseThreadListItem { public: ThreadSearchListItem(App &app, const MsgThreadItem &item, const std::string &searchWord); virtual ~ThreadSearchListItem(); diff --git a/src/MsgThread/Controller/src/BaseThreadListItem.cpp b/src/MsgThread/Controller/src/BaseThreadListItem.cpp index 454d1803..c8a9caf2 100644 --- a/src/MsgThread/Controller/src/BaseThreadListItem.cpp +++ b/src/MsgThread/Controller/src/BaseThreadListItem.cpp @@ -54,16 +54,14 @@ void BaseThreadListItem::updateThumbnailAndName(const MsgThreadItem &threadItem, void BaseThreadListItem::updateThumbnailAndName(const MsgAddressList &addressList, bool decorateName) { int countContact = addressList.getLength(); - if (countContact <= 0) - { + if (countContact <= 0) { MSG_LOG_WARN("Msg address list is empty"); return; } const MsgAddress &addr = addressList[0]; - if (countContact > 1) - { + if (countContact > 1) { m_ThumbId = m_App.getThumbnailMaker().getThumbId(ThumbnailMaker::GroupThumb); updateName(addr, countContact, decorateName); } else if (countContact == 1) { diff --git a/src/MsgThread/Controller/src/MsgThread.cpp b/src/MsgThread/Controller/src/MsgThread.cpp index bbc73018..45578b79 100644 --- a/src/MsgThread/Controller/src/MsgThread.cpp +++ b/src/MsgThread/Controller/src/MsgThread.cpp @@ -55,8 +55,7 @@ MsgThread::~MsgThread() void MsgThread::prepareSearchPanel() { - if (!m_pSearchPanel) - { + if (!m_pSearchPanel) { m_pSearchPanel = new MsgThreadSearchPanel(*m_pLayout); m_pSearchPanel->setListener(this); getNaviBar().setSearch(*m_pSearchPanel); @@ -65,8 +64,7 @@ void MsgThread::prepareSearchPanel() void MsgThread::prepareSearchList() { - if (!m_pSearchList) - { + if (!m_pSearchList) { m_pSearchList = new ThreadSearchList(*m_pLayout, getApp()); m_pSearchList->setListener(this); m_pSearchList->show(); @@ -76,8 +74,7 @@ void MsgThread::prepareSearchList() void MsgThread::prepareNoContentLayout() { - if (!m_pNoContent) - { + if (!m_pNoContent) { m_pNoContent = new NoContentLayout(*m_pLayout); m_pNoContent->show(); m_pLayout->setNoContent(*m_pNoContent); @@ -86,8 +83,7 @@ void MsgThread::prepareNoContentLayout() void MsgThread::prepareThreadList() { - if (!m_pThreadList) - { + if (!m_pThreadList) { m_pThreadList = new ThreadList(*m_pLayout, getApp()); m_pThreadList->setListener(this); m_pThreadList->show(); @@ -106,8 +102,7 @@ void MsgThread::onAttached(ViewItem &item) void MsgThread::showMainPopup() { PopupList &popup = getApp().getPopupManager().getMorePopup(); - if (!m_pThreadList->isEmpty()) - { + if (!m_pThreadList->isEmpty()) { popup.appendItem(msg("IDS_MSG_OPT_DELETE"), POPUPLIST_ITEM_PRESSED_CB(MsgThread, onDeleteItemPressed), this); popup.appendItem(msg("IDS_MSG_OPT_SEARCH"), POPUPLIST_ITEM_PRESSED_CB(MsgThread, onSearchItemPressed), this); } @@ -148,19 +143,15 @@ void MsgThread::setMode(Mode mode) getNaviBar().setColor(colorId); setNormalMode(); - switch (mode) - { + switch (mode) { case NormalMode: break; - case SearchMode: setSearchMode(true); break; - case DeleteMode: setDeleteMode(true); break; - case InitMode: default: MSG_ASSERT(false, "Not supported mode"); @@ -173,16 +164,13 @@ void MsgThread::setNormalMode() MSG_LOG(""); getNaviBar().clear(); // Reset previus mode: - switch (m_Mode) - { + switch (m_Mode) { case DeleteMode: setDeleteMode(false); break; - case SearchMode: setSearchMode(false); break; - default: break; } @@ -205,8 +193,7 @@ void MsgThread::setDeleteMode(bool value) NaviBar &naviBar = getNaviBar(); naviBar.showButton(NaviOkButtonId, value); - if (value) - { + if (value) { m_pLayout->showFloatingButton(false); updateSelectItemsTitle(); naviBar.setButtonText(NaviOkButtonId, msgt("IDS_MSG_ACBUTTON_DELETE_ABB")); @@ -221,8 +208,7 @@ void MsgThread::setSearchMode(bool value) MSG_LOG(""); getNaviBar().showButton(NaviPrevButtonId, value); - if (value) - { + if (value) { m_pLayout->showFloatingButton(false); prepareSearchList(); prepareSearchPanel(); @@ -246,8 +232,7 @@ void MsgThread::setSearchMode(bool value) void MsgThread::update() { bool searchEnabled = m_Mode == SearchMode; - if (searchEnabled) - { + if (searchEnabled) { bool showSearch = !m_pSearchList->isEmpty(); bool showThread = !showSearch && !m_pThreadList->isEmpty() && m_pSearchList->getSearchWord().empty(); bool showNoContent = !showThread && !showSearch; @@ -267,8 +252,7 @@ void MsgThread::update() void MsgThread::updateSelectItemsTitle() { - if (m_Mode == DeleteMode) - { + if (m_Mode == DeleteMode) { int checked = m_pThreadList->getThreadsCheckedCount(); if (checked > 0) getNaviBar().setTitle(msgArgs("IDS_MSG_HEADER_PD_SELECTED_ABB3", checked)); diff --git a/src/MsgThread/Controller/src/ThreadList.cpp b/src/MsgThread/Controller/src/ThreadList.cpp index dd9775e5..239792e7 100644 --- a/src/MsgThread/Controller/src/ThreadList.cpp +++ b/src/MsgThread/Controller/src/ThreadList.cpp @@ -83,8 +83,7 @@ bool ThreadList::isDeleteModeEnabled() const void ThreadList::deleteSelectedItems() { auto items = getItems(); - for (ThreadListItem *it : items) - { + for (ThreadListItem *it : items) { if (it->getCheckedState()) m_App.getMsgEngine().getStorage().deleteThread(it->getThreadId()); } @@ -94,8 +93,7 @@ int ThreadList::getThreadsCheckedCount() const { auto items = getItems(); int count = 0; - for (ThreadListItem *item : items) - { + for (ThreadListItem *item : items) { if (item->isCheckable() && item->getCheckedState()) ++count; } @@ -106,10 +104,8 @@ void ThreadList::showSelectAllItem(bool show, bool resetCheck) { SelectAllListItem *item = dynamic_cast(getFirstItem()); - if (show) - { - if (!item) - { + if (show) { + if (!item) { item = new SelectAllListItem; prependItem(*item); } @@ -126,8 +122,7 @@ bool ThreadList::isAllThreadListItemChecked() const { // Simple impl. but not fast: auto items = getItems(); - for (ThreadListItem *item : items) - { + for (ThreadListItem *item : items) { if (item->isCheckable() && !item->getCheckedState()) return false; } @@ -178,8 +173,7 @@ int ThreadList::cmpFunc(const ListItem &item1, const ListItem &item2) void ThreadList::insertItem(ThreadId id) { MsgThreadItemRef threadItem = m_App.getMsgEngine().getStorage().getThread(id); - if (threadItem) - { + if (threadItem) { auto newItem = new ThreadListItem(*threadItem, m_App); ListView::sortedInsertItem(*newItem); navigateTo(*newItem); @@ -189,8 +183,7 @@ void ThreadList::insertItem(ThreadId id) ThreadListItem *ThreadList::getItem(ThreadId id) const { auto items = ListView::getItems(); - for (ThreadListItem *item : items) - { + for (ThreadListItem *item : items) { if (item->getThreadId() == id) return item; } @@ -205,8 +198,7 @@ void ThreadList::fillList() int length = msgThreadList->getLength(); - for (int i = 0; i < length; ++i) - { + for (int i = 0; i < length; ++i) { const MsgThreadItem &msgThreadItem = msgThreadList->at(i); ListView::appendItem(*new ThreadListItem(msgThreadItem, m_App)); } @@ -220,16 +212,14 @@ void ThreadList::deleteItems() std::set threadIdSet; int length = msgThreadList->getLength(); - for (int i = 0; i < length; ++i) - { + for (int i = 0; i < length; ++i) { const MsgThreadItem &msgThreadItem = msgThreadList->at(i); threadIdSet.insert(msgThreadItem.getId()); } auto items = ListView::getItems(); - for (ThreadListItem *item : items) - { + for (ThreadListItem *item : items) { if (threadIdSet.count(item->getThreadId()) == 0) ListView::deleteItem(*item); } @@ -247,8 +237,7 @@ void ThreadList::updateItems(const MsgIdList &idList) auto threadIdSet = getThreadIdSet(idList); auto threadItems = getItems(); - for (ThreadListItem *item: threadItems) - { + for (ThreadListItem *item: threadItems) { if (threadIdSet.count(item->getThreadId())) updateItem(*item); } @@ -257,8 +246,7 @@ void ThreadList::updateItems(const MsgIdList &idList) void ThreadList::updateItems() { auto items = getItems(); - for (ThreadListItem *item: items) - { + for (ThreadListItem *item: items) { updateItem(*item); } } @@ -266,8 +254,7 @@ void ThreadList::updateItems() void ThreadList::updateItem(ThreadListItem &item) { MsgThreadItemRef msgThread = m_App.getMsgEngine().getStorage().getThread(item.getThreadId()); - if (!msgThread) - { + if (!msgThread) { MSG_LOG_ERROR("msgThread is null"); return; } @@ -277,8 +264,7 @@ void ThreadList::updateItem(ThreadListItem &item) time_t threadTime = msgThread->getTime(); if ((next && threadTime < next->getRawTime()) || - (prev && threadTime > prev->getRawTime())) - { + (prev && threadTime > prev->getRawTime())) { auto newItem = new ThreadListItem(*msgThread, m_App); newItem->setCheckedState(item.getCheckedState(), false); item.destroy(); @@ -293,8 +279,7 @@ void ThreadList::updateItem(ThreadListItem &item) std::set ThreadList::getThreadIdSet(const MsgIdList &idList) { std::set res; - for (MsgId msgId : idList) - { + for (MsgId msgId : idList) { ThreadId threadId = m_App.getMsgEngine().getStorage().getThreadId(msgId); if (threadId.isValid()) res.insert(threadId); @@ -340,8 +325,7 @@ void ThreadList::onMsgStorageThreadDelete(const ThreadId &threadId) { MSG_LOG(""); auto* thread = getItem(threadId); - if (thread) - { + if (thread) { ListView::deleteItem(*thread); updateSelectAllItem(); } @@ -360,8 +344,7 @@ void ThreadList::onTimeFormatChanged() { MSG_LOG(""); auto items = ListView::getItems(); - for (ThreadListItem *item : items) - { + for (ThreadListItem *item : items) { item->updateTime(); } diff --git a/src/MsgThread/Controller/src/ThreadListItem.cpp b/src/MsgThread/Controller/src/ThreadListItem.cpp index fe746dee..4998a2ef 100644 --- a/src/MsgThread/Controller/src/ThreadListItem.cpp +++ b/src/MsgThread/Controller/src/ThreadListItem.cpp @@ -60,13 +60,11 @@ void ThreadListItem::update(const MsgThreadItem &threadItem, bool updateUi) State state = NormalState; MsgConversationListRef convList = m_App.getMsgEngine().getStorage().getConversationList(m_ThreadId); - if (convList && convList->getLength() > 0) - { + if (convList && convList->getLength() > 0) { MsgConversationItem &item = convList->at(convList->getLength() - 1); Message::NetworkStatus status = item.getNetworkStatus(); - if (status == Message::NS_Sending) - { + if (status == Message::NS_Sending) { state = StatusState; m_Status = decorateSendingText(msg("IDS_MSG_BODY_SENDING_ING_M_STATUS_ABB")); } else if (status == Message::NS_Send_Fail) { diff --git a/src/MsgThread/Controller/src/ThreadSearchList.cpp b/src/MsgThread/Controller/src/ThreadSearchList.cpp index 391bb6a2..4536f007 100644 --- a/src/MsgThread/Controller/src/ThreadSearchList.cpp +++ b/src/MsgThread/Controller/src/ThreadSearchList.cpp @@ -54,8 +54,7 @@ void ThreadSearchList::setListener(IThreadSearchListListener *l) void ThreadSearchList::requestSearch(const std::string &searchWord) { m_SearchWord = searchWord; - if (!m_pIdler) - { + if (!m_pIdler) { m_pIdler = ecore_idler_add ( [](void *data)->Eina_Bool @@ -71,8 +70,7 @@ void ThreadSearchList::requestSearch(const std::string &searchWord) void ThreadSearchList::cancelSearch() { - if (m_pIdler) - { + if (m_pIdler) { ecore_idler_del(m_pIdler); m_pIdler = nullptr; } @@ -88,17 +86,14 @@ void ThreadSearchList::search() MSG_LOG("Search word: ", m_SearchWord); ListView::clear(); - if (!m_SearchWord.empty()) - { + if (!m_SearchWord.empty()) { MsgStorage &msgSotrage = m_App.getMsgEngine().getStorage(); // Thread: MsgThreadListRef threadList = msgSotrage.searchThread(m_SearchWord); - if (threadList) - { + if (threadList) { int length = threadList->getLength(); - for (int i = 0; i < length; ++i) - { + for (int i = 0; i < length; ++i) { const MsgThreadItem &threadItem = threadList->at(i); ListView::appendItem(*new ThreadSearchListItem(m_App, threadItem, m_SearchWord)); } @@ -106,11 +101,9 @@ void ThreadSearchList::search() // Message: MessageListRef msgList = msgSotrage.searchMessage(m_SearchWord); - if (msgList) - { + if (msgList) { int length = msgList->getLength(); - for (int i = 0; i < length; ++i) - { + for (int i = 0; i < length; ++i) { const Message &msg = msgList->at(i); ListView::appendItem(*new MsgSearchListItem(m_App, msg, m_SearchWord)); } @@ -124,8 +117,7 @@ void ThreadSearchList::search() void ThreadSearchList::updateTime() { auto items = ListView::getItems(); - for (BaseThreadListItem *item : items) - { + for (BaseThreadListItem *item : items) { item->updateTime(); } @@ -134,8 +126,7 @@ void ThreadSearchList::updateTime() void ThreadSearchList::onListItemSelected(ListItem &listItem) { - if (m_pListener) - { + if (m_pListener) { if (auto it = dynamic_cast(&listItem)) m_pListener->onSearchListItemSelected(it->getMsgId(), m_SearchWord); else if (auto it = dynamic_cast(&listItem)) diff --git a/src/MsgThread/View/inc/FloatingButton.h b/src/MsgThread/View/inc/FloatingButton.h index 9b43012e..8d25f64a 100644 --- a/src/MsgThread/View/inc/FloatingButton.h +++ b/src/MsgThread/View/inc/FloatingButton.h @@ -19,13 +19,11 @@ #include "View.h" -namespace Msg -{ +namespace Msg { class IFloatingButtonListener; class FloatingButton - : public View - { + : public View { public: FloatingButton(Evas_Object *parent); @@ -42,8 +40,7 @@ namespace Msg IFloatingButtonListener* m_pListener; }; - class IFloatingButtonListener - { + class IFloatingButtonListener { public: virtual ~IFloatingButtonListener() {}; virtual void onFloatingButtonPressed() = 0; diff --git a/src/MsgThread/View/inc/MsgThreadLayout.h b/src/MsgThread/View/inc/MsgThreadLayout.h index 7f526eaa..f22cefcb 100644 --- a/src/MsgThread/View/inc/MsgThreadLayout.h +++ b/src/MsgThread/View/inc/MsgThreadLayout.h @@ -20,11 +20,9 @@ #include "View.h" #include "DefaultLayout.h" -namespace Msg -{ +namespace Msg { class MsgThreadLayout - : public DefaultLayout - { + : public DefaultLayout { public: MsgThreadLayout(Evas_Object *parent); virtual ~MsgThreadLayout(); diff --git a/src/MsgThread/View/inc/MsgThreadSearchPanel.h b/src/MsgThread/View/inc/MsgThreadSearchPanel.h index 4e58d3fe..978e78db 100644 --- a/src/MsgThread/View/inc/MsgThreadSearchPanel.h +++ b/src/MsgThread/View/inc/MsgThreadSearchPanel.h @@ -20,13 +20,11 @@ #include "View.h" #include -namespace Msg -{ +namespace Msg { class IMsgThreadSearchPanelListener; class MsgThreadSearchPanel - : public View - { + : public View { public: MsgThreadSearchPanel(Evas_Object *parent); virtual ~MsgThreadSearchPanel(); @@ -58,8 +56,7 @@ namespace Msg Ecore_Job *m_pEntryJob; }; - class IMsgThreadSearchPanelListener - { + class IMsgThreadSearchPanelListener { public: virtual ~IMsgThreadSearchPanelListener() {}; diff --git a/src/MsgThread/View/inc/ThreadListViewItem.h b/src/MsgThread/View/inc/ThreadListViewItem.h index 9210f434..c36b01dd 100644 --- a/src/MsgThread/View/inc/ThreadListViewItem.h +++ b/src/MsgThread/View/inc/ThreadListViewItem.h @@ -20,14 +20,11 @@ #include "ListItem.h" #include -namespace Msg -{ +namespace Msg { class ThreadListViewItem - : public ListItem - { + : public ListItem { public: - enum State - { + enum State { NormalState, StatusState, IconState diff --git a/src/MsgThread/View/src/FloatingButton.cpp b/src/MsgThread/View/src/FloatingButton.cpp index d1fc4316..2988ace6 100644 --- a/src/MsgThread/View/src/FloatingButton.cpp +++ b/src/MsgThread/View/src/FloatingButton.cpp @@ -48,7 +48,5 @@ void FloatingButton::setListener(IFloatingButtonListener* pListener) void FloatingButton::pressed(Evas_Object *obj, void *event_info) { if (m_pListener) - { m_pListener->onFloatingButtonPressed(); - } } diff --git a/src/MsgThread/View/src/MsgThreadSearchPanel.cpp b/src/MsgThread/View/src/MsgThreadSearchPanel.cpp index 7f313707..aef85226 100644 --- a/src/MsgThread/View/src/MsgThreadSearchPanel.cpp +++ b/src/MsgThread/View/src/MsgThreadSearchPanel.cpp @@ -35,8 +35,7 @@ MsgThreadSearchPanel::MsgThreadSearchPanel(Evas_Object *parent) MsgThreadSearchPanel::~MsgThreadSearchPanel() { - if (m_pEntryJob) - { + if (m_pEntryJob) { ecore_job_del(m_pEntryJob); m_pEntryJob = nullptr; } @@ -111,11 +110,9 @@ std::string MsgThreadSearchPanel::getEntryText() const std::string res; const char *plainText = elm_entry_entry_get(m_pEntry); - if (plainText) - { + if (plainText) { char *text = elm_entry_markup_to_utf8(elm_entry_entry_get(m_pEntry)); - if (text) - { + if (text) { res.assign(text); free(text); } diff --git a/src/MsgThread/View/src/ThreadListViewItem.cpp b/src/MsgThread/View/src/ThreadListViewItem.cpp index d6277ef6..4de810e4 100644 --- a/src/MsgThread/View/src/ThreadListViewItem.cpp +++ b/src/MsgThread/View/src/ThreadListViewItem.cpp @@ -27,8 +27,7 @@ using namespace Msg; -namespace -{ +namespace { ListItemStyleRef threadItemStyle = ListItemStyle::create("msg_thread"); const char *messagePart = "elm.text"; @@ -57,8 +56,7 @@ ThreadListViewItem::~ThreadListViewItem() std::string ThreadListViewItem::getText(ListItem &item, const char *part) { - if (!strcmp(part, messagePart)) - { + if (!strcmp(part, messagePart)) { return getMessage(); } else if (!strcmp(part, namePart)) { return getName(); @@ -76,12 +74,10 @@ Evas_Object *ThreadListViewItem::getContent(ListItem &item, const char *part) { Evas_Object *content = nullptr; - if (!strcmp(part, thumbnailPart)) - { + if (!strcmp(part, thumbnailPart)) { content = getThumbnail(); } else if (!strcmp(part, iconPart)) { - if (m_State == IconState) - { + if (m_State == IconState) { content = getIcon(); } } @@ -97,8 +93,7 @@ const char *ThreadListViewItem::getCheckPart(ListItem &item) void ThreadListViewItem::setState(State state, bool updateUi) { m_State = state; - if (updateUi) - { + if (updateUi) { updateFields(iconPart, ELM_GENLIST_ITEM_FIELD_CONTENT); updateFields(statusPart, ELM_GENLIST_ITEM_FIELD_TEXT); } @@ -165,7 +160,5 @@ std::string ThreadListViewItem::decorateDraftText(const std::string &text) const void ThreadListViewItem::resetCheckMode(ListView &listView) { for (ListItem *item: listView.getRealizedItems()) - { item->emitSignal("elm,state,reset_check", "elm"); - } } diff --git a/src/Settings/Controller/inc/MsgOnSimCard.h b/src/Settings/Controller/inc/MsgOnSimCard.h index d7663f5a..75aee789 100644 --- a/src/Settings/Controller/inc/MsgOnSimCard.h +++ b/src/Settings/Controller/inc/MsgOnSimCard.h @@ -30,8 +30,7 @@ #include "SystemSettingsManager.h" #include "PopupList.h" -namespace Msg -{ +namespace Msg { class NaviFrameController; class MsgSettings; @@ -43,8 +42,7 @@ namespace Msg , private IHwButtonListener , private IListViewListener , private IMsgStorageListener - , private ISystemSettingsManager - { + , private ISystemSettingsManager { public: MsgOnSimCard(NaviFrameController &parent); virtual ~MsgOnSimCard(); @@ -85,8 +83,7 @@ namespace Msg virtual void onLanguageChanged(); private: - enum SimMode - { + enum SimMode { NormalMode, CopyToDeviceMode, DeleteMode diff --git a/src/Settings/Controller/inc/Settings.h b/src/Settings/Controller/inc/Settings.h index ec2efaf0..5e901ef0 100644 --- a/src/Settings/Controller/inc/Settings.h +++ b/src/Settings/Controller/inc/Settings.h @@ -25,8 +25,7 @@ #include "SystemSettingsManager.h" #include "SettingsSound.h" -namespace Msg -{ +namespace Msg { class NaviFrameController; class MsgSettings; class IMsgSettingsListener; @@ -40,8 +39,7 @@ namespace Msg , private IListViewListener , private ISettingsListViewItemListener , private IMsgSettingsListener - , private ISystemSettingsManager - { + , private ISystemSettingsManager { public: /** * @brief A constructor of Settings object based on outside parent object. diff --git a/src/Settings/Controller/inc/SettingsListItem.h b/src/Settings/Controller/inc/SettingsListItem.h index 74beeaac..a4741482 100644 --- a/src/Settings/Controller/inc/SettingsListItem.h +++ b/src/Settings/Controller/inc/SettingsListItem.h @@ -19,16 +19,14 @@ #include "SettingsListViewItem.h" -namespace Msg -{ +namespace Msg { class Settings; /** * @brief Visual representation of particular element of message-settings list. */ class SettingsListItem - : public SettingsListViewItem - { + : public SettingsListViewItem { public: typedef void (Settings::*MethodHandler)(SettingsListItem &item); /**< A delegate fired when user taps on particular settings list element. */ diff --git a/src/Settings/Controller/inc/SettingsSound.h b/src/Settings/Controller/inc/SettingsSound.h index 972625b4..719e1dd4 100644 --- a/src/Settings/Controller/inc/SettingsSound.h +++ b/src/Settings/Controller/inc/SettingsSound.h @@ -19,16 +19,14 @@ #include "AppControlLauncher.h" -namespace Msg -{ +namespace Msg { class MsgSettings; /** * @brief This class is aimed to launch preinstalled utility from settings-app that allows to chose message-alert sound. */ class SettingsSound - : public AppControlHandle - { + : public AppControlHandle { public: /** * @brief Constructs an instance of SettingsSound based on message-service settings wrapper passed from outside. diff --git a/src/Settings/Controller/inc/SimListViewItem.h b/src/Settings/Controller/inc/SimListViewItem.h index 24026498..96dedf5e 100644 --- a/src/Settings/Controller/inc/SimListViewItem.h +++ b/src/Settings/Controller/inc/SimListViewItem.h @@ -21,14 +21,12 @@ #include #include "MessageSMS.h" -namespace Msg -{ +namespace Msg { /** * @brief Visual representation of an element in "Messages on SIM" list. */ class SimListViewItem - : public ListItem - { + : public ListItem { public: /** * @brief Creates element of "Messages on SIM" list based on message-service structure and genlist item type passed from outside. diff --git a/src/Settings/Controller/src/MsgOnSimCard.cpp b/src/Settings/Controller/src/MsgOnSimCard.cpp index 4ff0ed07..cc751720 100644 --- a/src/Settings/Controller/src/MsgOnSimCard.cpp +++ b/src/Settings/Controller/src/MsgOnSimCard.cpp @@ -75,8 +75,7 @@ void MsgOnSimCard::fillList() { MessageSMSListRef list = getMsgEngine().getStorage().getSimMsgList(); int length = list->getLength(); - for (int i = 0; i < length; ++i) - { + for (int i = 0; i < length; ++i) { SimListViewItem *item = new SimListViewItem(list->at(i)); m_pList->appendItem(*item); } @@ -99,10 +98,8 @@ void MsgOnSimCard::onAttached(ViewItem &item) void MsgOnSimCard::onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId) { - if (buttonId == NaviOkButtonId) - { - if (m_SimMode == DeleteMode) - { + if (buttonId == NaviOkButtonId) { + if (m_SimMode == DeleteMode) { deleteSelectedItems(); } else if (m_SimMode == CopyToDeviceMode) { copySelectedItems(); @@ -115,8 +112,7 @@ void MsgOnSimCard::onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId) void MsgOnSimCard::onListItemChecked(ListItem &listItem) { - if (dynamic_cast(&listItem)) - { + if (dynamic_cast(&listItem)) { bool checked = listItem.getCheckedState(); m_pList->checkAllItems(checked); } @@ -147,8 +143,7 @@ void MsgOnSimCard::onHwBackButtonClicked() void MsgOnSimCard::showCopyDeletePopup() { - if (!m_pList->isEmpty()) - { + if (!m_pList->isEmpty()) { PopupList &listPopup = getApp().getPopupManager().getMorePopup(); listPopup.appendItem(msg("IDS_MSG_OPT_COPY_TO_DEVICE_ABB"), POPUPLIST_ITEM_PRESSED_CB(MsgOnSimCard, onCopyToDeviceItemPressed), this); listPopup.appendItem(msg("IDS_MSG_OPT_DELETE"), POPUPLIST_ITEM_PRESSED_CB(MsgOnSimCard, onDeleteItemPressed), this); @@ -171,12 +166,9 @@ void MsgOnSimCard::onDeleteItemPressed(PopupListItem &item) void MsgOnSimCard::onMsgStorageDelete(const MsgIdList &msgIdList) { auto simListItems = m_pList->getItems(); - for (auto &itemId: msgIdList) - { - for (auto *simItem : simListItems) - { - if (simItem->getMsgId() == itemId) - { + for (auto &itemId: msgIdList) { + for (auto *simItem : simListItems) { + if (simItem->getMsgId() == itemId) { simItem->destroy(); break; } @@ -190,20 +182,16 @@ void MsgOnSimCard::setMode(SimMode mode) if (m_SimMode == mode) return; - switch (mode) - { + switch (mode) { case CopyToDeviceMode: setCopyToDeviceMode(true); break; - case DeleteMode: setDeleteMode(true); break; - case NormalMode: setNormalMode(); break; - default: MSG_ASSERT(false, "Not supported mode"); break; @@ -213,16 +201,13 @@ void MsgOnSimCard::setMode(SimMode mode) void MsgOnSimCard::setNormalMode() { // Reset previus mode: - switch (m_SimMode) - { + switch (m_SimMode) { case CopyToDeviceMode: setCopyToDeviceMode(false); break; - case DeleteMode: setDeleteMode(false); break; - default: break; } @@ -262,8 +247,7 @@ void MsgOnSimCard::setTitleWithButtons(bool value) getNaviBar().clear(); getNaviBar().showButton(NaviOkButtonId, value); - if (value) - { + if (value) { if (m_SimMode == DeleteMode) getNaviBar().setButtonText(NaviOkButtonId, msgt("IDS_MSG_ACBUTTON_DELETE_ABB")); else @@ -283,9 +267,10 @@ void MsgOnSimCard::deleteSelectedItems() auto items = m_pList->getItems(); MsgIdList messages; - for (auto *item : items) + for (auto *item : items) { if (item->getCheckedState()) messages.push_back(item->getMsgId()); + } getApp().getMsgEngine().getStorage().deleteMessages(messages); } @@ -293,13 +278,10 @@ void MsgOnSimCard::deleteSelectedItems() void MsgOnSimCard::copySelectedItems() { auto items = m_pList->getItems(); - for (auto *item : items) - { - if (item->getCheckedState()) - { + for (auto *item : items) { + if (item->getCheckedState()) { MessageRef msg = getApp().getMsgEngine().getStorage().getMessage(item->getMsgId()); - if (msg) - { + if (msg) { msg->setMessageStorageType(Message::MS_Phone); getApp().getMsgEngine().getStorage().saveMessage(*msg, false); } @@ -312,10 +294,8 @@ void MsgOnSimCard::showSelectAllItem(bool show, bool resetCheck) { SelectAllListItem *item = dynamic_cast(m_pList->getFirstItem()); - if (show) - { - if (!item) - { + if (show) { + if (!item) { item = new SelectAllListItem; m_pList->prependItem(*item); } @@ -333,8 +313,7 @@ void MsgOnSimCard::calcChecked(int &check, int &total) const check = 0; total = 0; auto items = m_pList->getItems(); - for (ListItem *item: items) - { + for (ListItem *item: items) { if (item->getCheckedState()) ++check; ++total; diff --git a/src/Settings/Controller/src/Settings.cpp b/src/Settings/Controller/src/Settings.cpp index ac014ffe..b79f4aeb 100644 --- a/src/Settings/Controller/src/Settings.cpp +++ b/src/Settings/Controller/src/Settings.cpp @@ -332,8 +332,7 @@ void Settings::autoRetItemHandler(SettingsListItem &item) MSG_LOG(""); getMsgSettings().setMmsAutoRetr(item.getCheckButtonState()); bool mmsAutoRetr = getMsgSettings().getMmsAutoRetr(); - if (mmsAutoRetr) - { + if (mmsAutoRetr) { // Restore: if (isExistingMmsAutoRetrRoamingBackup()) getMsgSettings().setMmsAutoRetrRoaming(getMmsAutoRetrRoamingBackup()); @@ -375,8 +374,7 @@ void Settings::onListItemSelected(ListItem &listItem) MSG_LOG("Item: ", &listItem); listItem.setSelected(false); SettingsListItem *settingItem = dynamic_cast(&listItem); - if (settingItem) - { + if (settingItem) { settingItem->changeCheckButtonState(); callItemHandler(*settingItem); } diff --git a/src/Settings/Controller/src/SettingsSound.cpp b/src/Settings/Controller/src/SettingsSound.cpp index bef4ca02..20005326 100644 --- a/src/Settings/Controller/src/SettingsSound.cpp +++ b/src/Settings/Controller/src/SettingsSound.cpp @@ -22,8 +22,7 @@ using namespace Msg; -namespace -{ +namespace { const char *sRingtoneValuePath = "/opt/share/settings/Alerts"; const char *sRingtoneKeySilent = "silent"; const char *sRingtoneKeyDefault = "default"; diff --git a/src/Settings/Controller/src/SimListViewItem.cpp b/src/Settings/Controller/src/SimListViewItem.cpp index 599208fb..4f1cd478 100644 --- a/src/Settings/Controller/src/SimListViewItem.cpp +++ b/src/Settings/Controller/src/SimListViewItem.cpp @@ -25,8 +25,7 @@ using namespace Msg; -namespace -{ +namespace { ListItemStyleRef SimItemStyle = ListItemStyle::create("multiline"); const char *messagePart = "elm.text.multiline"; @@ -52,9 +51,7 @@ void SimListViewItem::updateModel(const MessageSMS &msg) const MsgAddressList &addressList = msg.getAddressList(); int length = addressList.getLength(); for (int i = 0; i < length; ++i) - { m_Name += addressList.at(i).getAddress(); - } m_MessageText = msg.getText(); m_Time = TimeUtils::makeDateTimeString(msg.getTime()); diff --git a/src/Settings/View/inc/SettingsGroupListViewItem.h b/src/Settings/View/inc/SettingsGroupListViewItem.h index 6ca2912b..4c548b9e 100644 --- a/src/Settings/View/inc/SettingsGroupListViewItem.h +++ b/src/Settings/View/inc/SettingsGroupListViewItem.h @@ -20,14 +20,12 @@ #include "ListItem.h" #include -namespace Msg -{ +namespace Msg { /** * @brief Visual representation of grouping settings list items(a genlist item with "group_index" style). */ class SettingsGroupListViewItem - : public ListItem - { + : public ListItem { public: /** * @brief Constructs genlist-item with "group_index style" and title based on text passed from outside. diff --git a/src/Settings/View/inc/SettingsListViewItem.h b/src/Settings/View/inc/SettingsListViewItem.h index 46c553c3..f689ed7a 100644 --- a/src/Settings/View/inc/SettingsListViewItem.h +++ b/src/Settings/View/inc/SettingsListViewItem.h @@ -19,16 +19,14 @@ #include "ListItem.h" -namespace Msg -{ +namespace Msg { class ISettingsListViewItemListener; /** * @brief Generic visual representation of messages-settings list element. */ class SettingsListViewItem - : public ListItem - { + : public ListItem { public: static ListItemStyleRef multiLineStyle; /**< style for "multiline" genlist-item. */ static ListItemStyleRef multiLineIconStyle; /**< style for "multiline + icon" genlist-item. */ @@ -110,8 +108,7 @@ namespace Msg /** * @brief Listener to send list-item events to subscribers. */ - class ISettingsListViewItemListener - { + class ISettingsListViewItemListener { public: virtual ~ISettingsListViewItemListener(){} diff --git a/src/Settings/View/inc/SimMsgLayout.h b/src/Settings/View/inc/SimMsgLayout.h index cdf2e0a7..f78598f2 100644 --- a/src/Settings/View/inc/SimMsgLayout.h +++ b/src/Settings/View/inc/SimMsgLayout.h @@ -20,14 +20,12 @@ #include "View.h" #include "DefaultLayout.h" -namespace Msg -{ +namespace Msg { /** * @brief Represents a layout of "Messages on SIM" view. */ class SimMsgLayout - : public DefaultLayout - { + : public DefaultLayout { public: /** * @brief Constructs an instance of SimMsgLayout based on parent passed from outside. diff --git a/src/Settings/View/src/SettingsGroupListViewItem.cpp b/src/Settings/View/src/SettingsGroupListViewItem.cpp index 3b9dde38..b9e704af 100644 --- a/src/Settings/View/src/SettingsGroupListViewItem.cpp +++ b/src/Settings/View/src/SettingsGroupListViewItem.cpp @@ -19,8 +19,7 @@ using namespace Msg; -namespace -{ +namespace { ListItemStyleRef itemStyle = ListItemStyle::create("group_index"); } diff --git a/src/Settings/View/src/SettingsListViewItem.cpp b/src/Settings/View/src/SettingsListViewItem.cpp index 2f0133e6..3ab97feb 100644 --- a/src/Settings/View/src/SettingsListViewItem.cpp +++ b/src/Settings/View/src/SettingsListViewItem.cpp @@ -54,8 +54,7 @@ void SettingsListViewItem::disabledCheckButton(bool disabled) void SettingsListViewItem::setCheckButtonState(bool state) { - if (m_CheckButtonState != state) - { + if (m_CheckButtonState != state) { m_CheckButtonState = state; update(); } @@ -83,8 +82,7 @@ void SettingsListViewItem::setSubText(const std::string &text) std::string SettingsListViewItem::getText(ListItem &item, const char *part) { - if (getStyle().get() == oneLineIconStyle.get()) - { + if (getStyle().get() == oneLineIconStyle.get()) { if (strcmp(part, "elm.text") == 0) return msg(m_MainText); } else if (getStyle().get() == multiLineStyle.get() || getStyle().get() == multiLineIconStyle.get()) { @@ -101,8 +99,7 @@ std::string SettingsListViewItem::getText(ListItem &item, const char *part) Evas_Object *SettingsListViewItem::getContent(ListItem &item, const char *part) { - if (getStyle().get() == oneLineIconStyle.get() || getStyle().get() == multiLineIconStyle.get()) - { + if (getStyle().get() == oneLineIconStyle.get() || getStyle().get() == multiLineIconStyle.get()) { if (strcmp(part, "elm.swallow.end") == 0) return createCheckButton(*getOwner()); } else if (getStyle().get() == multiLineStyle.get()) { @@ -116,8 +113,7 @@ Evas_Object *SettingsListViewItem::getContent(ListItem &item, const char *part) Evas_Object *SettingsListViewItem::createCheckButton(Evas_Object *parent) { Evas_Object *check = nullptr; - if (m_ShowCheckButton) - { + if (m_ShowCheckButton) { check = elm_check_add(parent); elm_object_focus_allow_set(check, false); elm_object_style_set(check, "on&off"); diff --git a/src/Viewer/Controller/inc/SmilPage.h b/src/Viewer/Controller/inc/SmilPage.h index e040e288..940b52f0 100644 --- a/src/Viewer/Controller/inc/SmilPage.h +++ b/src/Viewer/Controller/inc/SmilPage.h @@ -25,16 +25,14 @@ #include -namespace Msg -{ +namespace Msg { class SmilImageItemView; class FileViewer; class SmilPage : public SmilPageLayout , private ISmilSaveAllItemViewListener - , private ISmilAttachmentItemViewListener - { + , private ISmilAttachmentItemViewListener { public: SmilPage(Evas_Object *parent, FileViewer &fileViewer, const MsgPage &page); SmilPage(Evas_Object *parent, FileViewer &fileViewer, const MsgAttachmentList &list); diff --git a/src/Viewer/Controller/inc/SmilPlayer.h b/src/Viewer/Controller/inc/SmilPlayer.h index fde78504..c964ae82 100644 --- a/src/Viewer/Controller/inc/SmilPlayer.h +++ b/src/Viewer/Controller/inc/SmilPlayer.h @@ -27,18 +27,15 @@ #include #include -namespace Msg -{ +namespace Msg { class ISmilPlayerListener; class SmilPlayer : public SmilPlayerView - , private IMediaPlayerListener - { + , private IMediaPlayerListener { public: typedef std::vector PageList; - enum State - { + enum State { StopState, // Stop = Pause PlayState, }; @@ -99,8 +96,7 @@ namespace Msg FileViewer m_FileViewer; }; - class ISmilPlayerListener - { + class ISmilPlayerListener { public: virtual ~ISmilPlayerListener() {} virtual void onSmilPlayerPageChanged() {}; diff --git a/src/Viewer/Controller/inc/Viewer.h b/src/Viewer/Controller/inc/Viewer.h index d348f14a..5cac09ac 100644 --- a/src/Viewer/Controller/inc/Viewer.h +++ b/src/Viewer/Controller/inc/Viewer.h @@ -33,8 +33,7 @@ #include "MsgStorage.h" #include "ContactViewer.h" -namespace Msg -{ +namespace Msg { class NaviFrameController; class Viewer @@ -46,8 +45,7 @@ namespace Msg , private IConversationListener , private ISmilPlayerListener , private ISystemSettingsManager - , private IMsgStorageListener - { + , private IMsgStorageListener { public: Viewer(NaviFrameController &parent, MsgId id); virtual ~Viewer(); diff --git a/src/Viewer/Controller/src/SmilPage.cpp b/src/Viewer/Controller/src/SmilPage.cpp index 1d94c9ce..f8d40d9e 100644 --- a/src/Viewer/Controller/src/SmilPage.cpp +++ b/src/Viewer/Controller/src/SmilPage.cpp @@ -116,8 +116,7 @@ void SmilPage::playAnimation(bool play) const MsgMedia *SmilPage::getMedia(const MsgPage &page, MsgMedia::Type type) const { const MsgMediaList &list = page.getMediaList(); - for (int i = 0; i < list.getLength(); ++i) - { + for (int i = 0; i < list.getLength(); ++i) { if (list[i].getType() == type) return &list[i]; } @@ -127,8 +126,7 @@ const MsgMedia *SmilPage::getMedia(const MsgPage &page, MsgMedia::Type type) con bool SmilPage::isEmpty(const MsgPage &page) { const MsgMediaList &list = page.getMediaList(); - for (int i = 0; i < list.getLength(); ++i) - { + for (int i = 0; i < list.getLength(); ++i) { const MsgMedia &media = list[i]; std::string filePath = media.getFilePath(); if (media.getType() != MsgMedia::UnknownType && FileUtils::getFileSize(filePath) > 0) @@ -142,16 +140,14 @@ void SmilPage::build(const MsgPage &page) m_Duration = page.getPageDuration() / 1000.0 + 0.5; const MsgMediaList &list = page.getMediaList(); - for (int i = 0; i < list.getLength(); ++i) - { + for (int i = 0; i < list.getLength(); ++i) { m_Attachments.push_back(list[i].getFilePath()); } const MsgMedia *video = getMedia(page, MsgMedia::VideoType); - if (video) + if (video) { buildVideo(*video); - else - { + } else { const MsgMedia *image = getMedia(page, MsgMedia::ImageType); if (image) buildImage(*image); @@ -161,8 +157,7 @@ void SmilPage::build(const MsgPage &page) if (text) buildText(*text); - if (!video) - { + if (!video) { const MsgMedia *audio = getMedia(page, MsgMedia::AudioType); if (audio) buildAudio(*audio); @@ -178,8 +173,7 @@ void SmilPage::build(const MsgAttachmentList &list) { m_Duration = defaultPageDuration; - for (int i = 0; i < list.getLength(); ++i) - { + for (int i = 0; i < list.getLength(); ++i) { m_Attachments.push_back(list[i].getFilePath()); } @@ -188,8 +182,7 @@ void SmilPage::build(const MsgAttachmentList &list) buildAttachmentInfo(list.getLength()); buildSaveAllItem(list.getLength()); - for (int i = 0; i < list.getLength(); ++i) - { + for (int i = 0; i < list.getLength(); ++i) { buildAttachment(list[i]); } } @@ -205,8 +198,7 @@ void SmilPage::buildImage(const MsgMedia &media) void SmilPage::buildText(const MsgMedia& media) { std::string text = FileUtils::readTextFile(media.getFilePath()); - if (!text.empty()) - { + if (!text.empty()) { SmilTextItemView *item = new SmilTextItemView(getBox(), text); item->show(); appendItem(*item); @@ -219,8 +211,7 @@ void SmilPage::buildAudio(const MsgMedia& media) m_HasAudio = true; int duration = MediaUtils::getDurationSec(m_MediaPath); - if (duration == 0) - { + if (duration == 0) { m_HasInvalidFiles = true; return; } @@ -239,8 +230,7 @@ void SmilPage::buildVideo(const MsgMedia& media) m_MediaPath = media.getFilePath(); int duration = MediaUtils::getDurationSec(m_MediaPath); - if (duration == 0) - { + if (duration == 0) { m_HasInvalidFiles = true; return; } @@ -251,8 +241,7 @@ void SmilPage::buildVideo(const MsgMedia& media) int height = 0; MediaUtils::getFrameSize(m_MediaPath, width, height); - if (width * height == 0) - { + if (width * height == 0) { MSG_LOG_ERROR("Wrong video dimension"); m_HasInvalidFiles = true; return; diff --git a/src/Viewer/Controller/src/SmilPlayer.cpp b/src/Viewer/Controller/src/SmilPlayer.cpp index 68c71348..01cbafc3 100644 --- a/src/Viewer/Controller/src/SmilPlayer.cpp +++ b/src/Viewer/Controller/src/SmilPlayer.cpp @@ -43,11 +43,9 @@ void SmilPlayer::create(const MessageMms &mms) { // Pages: const MsgPageList &pages = mms.getPageList(); - for (int i = 0; i < pages.getLength(); ++i) - { + for (int i = 0; i < pages.getLength(); ++i) { const MsgPage &page = pages[i]; - if (!SmilPage::isEmpty(page)) - { + if (!SmilPage::isEmpty(page)) { SmilPage *smilPage = new SmilPage(getEo(), m_FileViewer, page); m_Duration += smilPage->getDuration(); m_PageList.push_back(smilPage); @@ -55,8 +53,7 @@ void SmilPlayer::create(const MessageMms &mms) } // Attachment: - if (!mms.getAttachmentList().isEmpty()) - { + if (!mms.getAttachmentList().isEmpty()) { SmilPage *smilPage = new SmilPage(getEo(), m_FileViewer, mms.getAttachmentList()); m_Duration += smilPage->getDuration(); m_PageList.push_back(smilPage); @@ -73,8 +70,7 @@ void SmilPlayer::setListener(ISmilPlayerListener *l) void SmilPlayer::startTimer(int sec) { - if (m_pTimer) - { + if (m_pTimer) { ecore_timer_del(m_pTimer); m_pTimer = nullptr; } @@ -115,8 +111,7 @@ Eina_Bool SmilPlayer::onTick() void SmilPlayer::setState(State state) { - if (m_State != state) - { + if (m_State != state) { m_State = state; if (m_pListener) m_pListener->onSmilPlayerStateChanged(); @@ -130,10 +125,8 @@ SmilPlayer::State SmilPlayer::getState() const void SmilPlayer::start() { - if (m_pTimer) - { - if (canPlay(getCurrentPage())) - { + if (m_pTimer) { + if (canPlay(getCurrentPage())) { MSG_LOG("Continue"); setState(PlayState); continueTimer(); @@ -176,11 +169,9 @@ bool SmilPlayer::playPage() startTimer(page->getDuration()); playAnimation(true); - if (page->hasMedia()) - { + if (page->hasMedia()) { prepareMedia(); - if (!canPlay(page)) - { + if (!canPlay(page)) { stop(); showUnableToPlayNotif(*page); return false; @@ -199,17 +190,14 @@ bool SmilPlayer::playPage() void SmilPlayer::prepareMedia() { - if (m_MediaPlayer) - { + if (m_MediaPlayer) { m_MediaPlayer->stop(); m_MediaPlayer->setPosition(0); } SmilPage *page = getCurrentPage(); - if (page->hasMedia()) - { - if (!m_MediaPlayer) - { + if (page->hasMedia()) { + if (!m_MediaPlayer) { m_MediaPlayer.reset(new MediaPlayer); m_MediaPlayer->setListener(this); } @@ -231,8 +219,7 @@ bool SmilPlayer::canPlay(SmilPage *page) if (!page) return false; - if (page->hasMedia() && m_MediaPlayer && !m_MediaPlayer->getFocus()) - { + if (page->hasMedia() && m_MediaPlayer && !m_MediaPlayer->getFocus()) { showUnableToPlayNotif(*page); return false; } @@ -261,9 +248,7 @@ double SmilPlayer::getPosition() const { unsigned pos = 0; for (unsigned i = 0; i < m_CurrentPageIndex; ++i) - { pos += m_PageList[i]->getDuration(); - } pos += m_PageTickCounter; @@ -287,8 +272,7 @@ int SmilPlayer::getDuration() const bool SmilPlayer::nextPage() { - if (probeNextPage()) - { + if (probeNextPage()) { stopMedia(); ++m_CurrentPageIndex; playPage(); @@ -299,8 +283,7 @@ bool SmilPlayer::nextPage() bool SmilPlayer::prevPage() { - if (probePrevPage()) - { + if (probePrevPage()) { stopMedia(); --m_CurrentPageIndex; playPage(); @@ -355,12 +338,9 @@ void SmilPlayer::onBeforeDelete(View &view) stop(); for (SmilPage *page : m_PageList) - { page->destroy(); - } - if (m_pTimer) - { + if (m_pTimer) { ecore_timer_del(m_pTimer); m_pTimer = nullptr; } @@ -368,13 +348,10 @@ void SmilPlayer::onBeforeDelete(View &view) void SmilPlayer::onMediaPlayerSoundFocusChanged() { - if (m_MediaPlayer->isPlaying() && !m_MediaPlayer->getFocus()) - { + if (m_MediaPlayer->isPlaying() && !m_MediaPlayer->getFocus()) { SmilPage *page = getCurrentPage(); - if (page) - { - if (page->hasMedia()) - { + if (page) { + if (page->hasMedia()) { showUnableToPlayNotif(*page); stop(); } diff --git a/src/Viewer/Controller/src/Viewer.cpp b/src/Viewer/Controller/src/Viewer.cpp index d2a3d5dd..bcfe8e95 100644 --- a/src/Viewer/Controller/src/Viewer.cpp +++ b/src/Viewer/Controller/src/Viewer.cpp @@ -32,8 +32,7 @@ using namespace Msg; -namespace -{ +namespace { std::string makeTimeStr(int timeSec) { const int digitCount = 2; @@ -92,8 +91,7 @@ void Viewer::updateRecipPanel() void Viewer::create(MsgId id) { m_Msg = std::dynamic_pointer_cast(getMsgEngine().getStorage().getMessage(id)); - if (!m_Msg) - { + if (!m_Msg) { MSG_LOG_ERROR("Can't get message by id"); // Create empty message: m_Msg = getMsgEngine().getComposer().createMms(); @@ -118,8 +116,7 @@ void Viewer::create(MsgId id) void Viewer::createLayout() { - if (!m_pLayout) - { + if (!m_pLayout) { m_pLayout = new ViewerLayout(getParent()); m_pLayout->setListener(this); m_pLayout->show(); @@ -128,8 +125,7 @@ void Viewer::createLayout() void Viewer::createSubjectLayout() { - if (!m_pSubjectLayout) - { + if (!m_pSubjectLayout) { int numberOfPages = m_pSmilPlayer ? m_pSmilPlayer->getPages().size() : 0; m_pSubjectLayout = new SubjectLayout(*m_pLayout); m_pSubjectLayout->setNumberOfPages(numberOfPages); @@ -141,8 +137,7 @@ void Viewer::createSubjectLayout() void Viewer::createPlayerControl() { - if (!m_pPlayerControl) - { + if (!m_pPlayerControl) { m_pPlayerControl = new PlayerControl(*m_pLayout); m_pPlayerControl->setListener(this); @@ -158,8 +153,7 @@ void Viewer::createPlayerControl() void Viewer::createRecipPanel() { - if (!m_pRecipPanel && m_Msg->getAddressList().getLength() > 1) - { + if (!m_pRecipPanel && m_Msg->getAddressList().getLength() > 1) { m_pRecipPanel = new MbeRecipients(*m_pLayout, getApp()); m_pRecipPanel->addSmartCb("item,clicked", SMART_CALLBACK(Viewer, onRecipItemClicked), this); m_pRecipPanel->show(); @@ -170,8 +164,7 @@ void Viewer::createRecipPanel() void Viewer::createSmilPlayer() { - if (!m_pSmilPlayer) - { + if (!m_pSmilPlayer) { m_pSmilPlayer = new SmilPlayer(*m_pLayout, *m_Msg); m_pSmilPlayer->setListener(this); m_pSmilPlayer->show(); @@ -182,8 +175,7 @@ void Viewer::createSmilPlayer() void Viewer::naviExpandButtonHandler() { MSG_LOG(""); - if (m_pRecipPanel) - { + if (m_pRecipPanel) { bool isRecipInvisible = !m_pLayout->isRecipientsVisible(); m_pLayout->showRecipients(isRecipInvisible); getNaviBar().setDownButtonState(isRecipInvisible); @@ -193,8 +185,7 @@ void Viewer::naviExpandButtonHandler() void Viewer::naviCenterButtonHandler() { MSG_LOG(""); - if (m_pRecipPanel) - { + if (m_pRecipPanel) { naviExpandButtonHandler(); } else { const MsgAddressList &addressList = m_Msg->getAddressList(); @@ -240,8 +231,7 @@ void Viewer::updatePlayPos() void Viewer::updateSubject() { - if (m_pSubjectLayout) - { + if (m_pSubjectLayout) { std::string subject = m_Msg->getSubject(); if (subject.empty()) subject = msg("IDS_MSGF_BODY_NO_SUBJECT"); @@ -289,20 +279,16 @@ void Viewer::onHwMoreButtonClicked() void Viewer::onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId) { MSG_LOG(""); - switch (buttonId) - { + switch (buttonId) { case NaviCenterButtonId: naviCenterButtonHandler(); break; - case NaviPrevButtonId: naviPrevButtonHandler(); break; - case NaviExpandButtonId: naviExpandButtonHandler(); break; - default: break; }; @@ -348,7 +334,7 @@ void Viewer::onMakeVoiceItemPressed(PopupListItem &item) { MSG_LOG(""); item.getParent().destroy(); - VoiceCall::launch(m_SelectedAddress); + VoiceCall::launch(m_SelectedAddress); } void Viewer::onCreateContactItemPressed(PopupListItem &item) @@ -453,8 +439,7 @@ void Viewer::onLanguageChanged() void Viewer::onMsgStorageDelete(const MsgIdList &msgIdList) { MSG_LOG(""); - if (m_Msg) - { + if (m_Msg) { MsgId id = m_Msg->getId(); if (std::find(msgIdList.begin(), msgIdList.end(), id) != msgIdList.end()) pop(); diff --git a/src/Viewer/Utils/inc/MediaPlayer.h b/src/Viewer/Utils/inc/MediaPlayer.h index a5cbcfc7..50d3cfe5 100644 --- a/src/Viewer/Utils/inc/MediaPlayer.h +++ b/src/Viewer/Utils/inc/MediaPlayer.h @@ -22,12 +22,10 @@ #include #include -namespace Msg -{ +namespace Msg { class IMediaPlayerListener; - class MediaPlayer - { + class MediaPlayer { public: MediaPlayer(); ~MediaPlayer(); @@ -67,8 +65,7 @@ namespace Msg sound_stream_info_h m_StreamInfo; }; - class IMediaPlayerListener - { + class IMediaPlayerListener { public: virtual ~IMediaPlayerListener() {} virtual void onMediaPlayerCompleted() {}; diff --git a/src/Viewer/Utils/src/MediaPlayer.cpp b/src/Viewer/Utils/src/MediaPlayer.cpp index 6cab219e..c8c7229a 100644 --- a/src/Viewer/Utils/src/MediaPlayer.cpp +++ b/src/Viewer/Utils/src/MediaPlayer.cpp @@ -28,11 +28,9 @@ MediaPlayer::MediaPlayer() , m_StreamInfo() { sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, on_sound_stream_focus_state_changed_cb, this, &m_StreamInfo); - if (m_StreamInfo) - { + if (m_StreamInfo) { player_create(&m_Player); - if (m_Player) - { + if (m_Player) { player_set_sound_type(m_Player, SOUND_TYPE_MEDIA); player_set_volume(m_Player, 1.0, 1.0); player_set_looping(m_Player, false); @@ -50,8 +48,7 @@ MediaPlayer::~MediaPlayer() if (m_StreamInfo) sound_manager_destroy_stream_information(m_StreamInfo); - if (m_Player) - { + if (m_Player) { player_unprepare(m_Player); player_destroy(m_Player); } @@ -84,8 +81,7 @@ bool MediaPlayer::getFocus() const int flags = 0; char *extraInfo = nullptr; - if (sound_manager_get_current_playback_focus(&acquiredBy, &flags, &extraInfo) == SOUND_MANAGER_ERROR_NONE) - { + if (sound_manager_get_current_playback_focus(&acquiredBy, &flags, &extraInfo) == SOUND_MANAGER_ERROR_NONE) { free(extraInfo); return !isCallReason(acquiredBy); } @@ -151,12 +147,10 @@ void MediaPlayer::setPosition(int msec) int MediaPlayer::getDuration(const std::string &uri) { int msec = 0; - if (!uri.empty()) - { + if (!uri.empty()) { player_h player = {}; player_create(&player); - if (player_set_uri(player, uri.c_str()) == PLAYER_ERROR_NONE) - { + if (player_set_uri(player, uri.c_str()) == PLAYER_ERROR_NONE) { player_prepare(player); player_get_duration(player, &msec); player_unprepare(player); @@ -188,8 +182,7 @@ void MediaPlayer::on_sound_stream_focus_state_changed_cb(sound_stream_info_h str { MSG_LOG("Interrupted focus change reason = ", reason); auto *self = static_cast(user_data); - if (isCallReason(reason)) - { + if (isCallReason(reason)) { ecore_main_loop_thread_safe_call_async( [](void *data) { diff --git a/src/Viewer/View/inc/PlayerControl.h b/src/Viewer/View/inc/PlayerControl.h index 80898324..fce232b3 100644 --- a/src/Viewer/View/inc/PlayerControl.h +++ b/src/Viewer/View/inc/PlayerControl.h @@ -19,16 +19,13 @@ #include "View.h" -namespace Msg -{ +namespace Msg { class IPlayerControlListener; class PlayerControl - : public View - { + : public View { public: - enum PlayPauseState - { + enum PlayPauseState { PlayState, PauseState }; @@ -59,8 +56,7 @@ namespace Msg Evas_Object *m_pProgress; }; - class IPlayerControlListener - { + class IPlayerControlListener { public: virtual ~IPlayerControlListener() {} diff --git a/src/Viewer/View/inc/SmilAttachmentItemView.h b/src/Viewer/View/inc/SmilAttachmentItemView.h index 03150715..560d6bfd 100644 --- a/src/Viewer/View/inc/SmilAttachmentItemView.h +++ b/src/Viewer/View/inc/SmilAttachmentItemView.h @@ -19,15 +19,13 @@ #include "View.h" -namespace Msg -{ +namespace Msg { class ISmilAttachmentItemViewListener; class ISmilSaveAllItemViewListener; // SmilAttachmentItemView: class SmilAttachmentItemView - : public View - { + : public View { public: SmilAttachmentItemView(Evas_Object *parent); virtual ~SmilAttachmentItemView(); @@ -46,8 +44,7 @@ namespace Msg // SmilAttachmentInfoItemView : class SmilAttachmentInfoItemView - : public View - { + : public View { public: SmilAttachmentInfoItemView(Evas_Object *parent, bool manyAttachments); virtual ~SmilAttachmentInfoItemView(); @@ -55,8 +52,7 @@ namespace Msg // SmilSaveAllItemView : class SmilSaveAllItemView - : public View - { + : public View { public: SmilSaveAllItemView(Evas_Object *parent, int count); virtual ~SmilSaveAllItemView(); @@ -73,16 +69,14 @@ namespace Msg const int m_Count; }; - class ISmilAttachmentItemViewListener - { + class ISmilAttachmentItemViewListener { public: virtual ~ISmilAttachmentItemViewListener() {} virtual void onItemClicked(SmilAttachmentItemView &item) {}; virtual void onSaveButtonClicked(SmilAttachmentItemView &item) {}; }; - class ISmilSaveAllItemViewListener - { + class ISmilSaveAllItemViewListener { public: virtual ~ISmilSaveAllItemViewListener() {} virtual void onItemClicked(SmilSaveAllItemView &item) {}; diff --git a/src/Viewer/View/inc/SmilAudioItemView.h b/src/Viewer/View/inc/SmilAudioItemView.h index d77a8416..0faad1e4 100644 --- a/src/Viewer/View/inc/SmilAudioItemView.h +++ b/src/Viewer/View/inc/SmilAudioItemView.h @@ -19,11 +19,9 @@ #include "View.h" -namespace Msg -{ +namespace Msg { class SmilAudioItemView - : public View - { + : public View { public: SmilAudioItemView(Evas_Object *parent, const std::string &label); virtual ~SmilAudioItemView(); diff --git a/src/Viewer/View/inc/SmilImageItemView.h b/src/Viewer/View/inc/SmilImageItemView.h index d8519039..c29d526a 100644 --- a/src/Viewer/View/inc/SmilImageItemView.h +++ b/src/Viewer/View/inc/SmilImageItemView.h @@ -19,11 +19,9 @@ #include "View.h" -namespace Msg -{ +namespace Msg { class SmilImageItemView - : public View - { + : public View { public: SmilImageItemView(Evas_Object *parent, const std::string &imagePath); virtual ~SmilImageItemView(); diff --git a/src/Viewer/View/inc/SmilPageLayout.h b/src/Viewer/View/inc/SmilPageLayout.h index cbe28223..d2c4c3e2 100644 --- a/src/Viewer/View/inc/SmilPageLayout.h +++ b/src/Viewer/View/inc/SmilPageLayout.h @@ -19,11 +19,9 @@ #include "View.h" -namespace Msg -{ +namespace Msg { class SmilPageLayout - : public View - { + : public View { public: SmilPageLayout(Evas_Object *parent); virtual ~SmilPageLayout(); diff --git a/src/Viewer/View/inc/SmilPlayerView.h b/src/Viewer/View/inc/SmilPlayerView.h index 3bd74656..da17bd65 100644 --- a/src/Viewer/View/inc/SmilPlayerView.h +++ b/src/Viewer/View/inc/SmilPlayerView.h @@ -19,11 +19,9 @@ #include "View.h" -namespace Msg -{ +namespace Msg { class SmilPlayerView - : public View - { + : public View { public: SmilPlayerView(Evas_Object *parent); virtual ~SmilPlayerView(); diff --git a/src/Viewer/View/inc/SmilTextItemView.h b/src/Viewer/View/inc/SmilTextItemView.h index ad6889f6..a145ec70 100644 --- a/src/Viewer/View/inc/SmilTextItemView.h +++ b/src/Viewer/View/inc/SmilTextItemView.h @@ -19,11 +19,9 @@ #include "View.h" -namespace Msg -{ +namespace Msg { class SmilTextItemView - : public View - { + : public View { public: SmilTextItemView(Evas_Object *parent, const std::string &text); virtual ~SmilTextItemView(); diff --git a/src/Viewer/View/inc/SmilVideoItemView.h b/src/Viewer/View/inc/SmilVideoItemView.h index 11fd76b2..a252ff96 100644 --- a/src/Viewer/View/inc/SmilVideoItemView.h +++ b/src/Viewer/View/inc/SmilVideoItemView.h @@ -19,11 +19,9 @@ #include "View.h" -namespace Msg -{ +namespace Msg { class SmilVideoItemView - : public View - { + : public View { public: SmilVideoItemView(Evas_Object *parent, int videoWidth, int videoHeight, const std::string &thumbPath); virtual ~SmilVideoItemView(); diff --git a/src/Viewer/View/inc/SubjectLayout.h b/src/Viewer/View/inc/SubjectLayout.h index 3f7c4bc4..bc9a781e 100644 --- a/src/Viewer/View/inc/SubjectLayout.h +++ b/src/Viewer/View/inc/SubjectLayout.h @@ -21,11 +21,9 @@ #include #include "MessageMms.h" -namespace Msg -{ +namespace Msg { class SubjectLayout - : public View - { + : public View { public: SubjectLayout(Evas_Object *parent); ~SubjectLayout(); diff --git a/src/Viewer/View/inc/ViewerLayout.h b/src/Viewer/View/inc/ViewerLayout.h index b35efbe9..719a9d9d 100644 --- a/src/Viewer/View/inc/ViewerLayout.h +++ b/src/Viewer/View/inc/ViewerLayout.h @@ -19,13 +19,11 @@ #include "View.h" -namespace Msg -{ +namespace Msg { class IViewerLayoutListener; class ViewerLayout - : public View - { + : public View { public: ViewerLayout(Evas_Object *parent); virtual ~ViewerLayout(); @@ -47,8 +45,7 @@ namespace Msg IViewerLayoutListener *m_pListener; }; - class IViewerLayoutListener - { + class IViewerLayoutListener { public: virtual ~IViewerLayoutListener() {} virtual void onLayoutTap() {}; diff --git a/src/Viewer/View/src/PlayerControl.cpp b/src/Viewer/View/src/PlayerControl.cpp index 2793969f..bfab6578 100644 --- a/src/Viewer/View/src/PlayerControl.cpp +++ b/src/Viewer/View/src/PlayerControl.cpp @@ -20,8 +20,7 @@ using namespace Msg; -namespace -{ +namespace { const char *groupName = "player"; const char *prevCb = "prev_clicked"; const char *playCb = "play_clicked"; diff --git a/src/Viewer/View/src/SmilAttachmentItemView.cpp b/src/Viewer/View/src/SmilAttachmentItemView.cpp index 9de1368e..0620d143 100644 --- a/src/Viewer/View/src/SmilAttachmentItemView.cpp +++ b/src/Viewer/View/src/SmilAttachmentItemView.cpp @@ -22,8 +22,7 @@ using namespace Msg; -namespace -{ +namespace { const float fileButtonWeight = 2.0 / 3.0; const float saveButtonWeight = 1.0 / 3.0; const char *layoutGroupName = "smil_attachment_item_layout"; diff --git a/src/Viewer/View/src/SmilImageItemView.cpp b/src/Viewer/View/src/SmilImageItemView.cpp index a2ccd639..3ffab37e 100644 --- a/src/Viewer/View/src/SmilImageItemView.cpp +++ b/src/Viewer/View/src/SmilImageItemView.cpp @@ -51,8 +51,7 @@ bool SmilImageItemView::hasAnimation() const Evas_Object *SmilImageItemView::createImage(Evas_Object *parent, const std::string &imagePath) { m_pImage = elm_image_add(parent); - if (!elm_image_file_set(m_pImage, imagePath.c_str(), nullptr)) - { + if (!elm_image_file_set(m_pImage, imagePath.c_str(), nullptr)) { evas_object_del(m_pImage); m_pImage = nullptr; return m_pImage; diff --git a/src/Viewer/View/src/SmilPlayerView.cpp b/src/Viewer/View/src/SmilPlayerView.cpp index 97eda153..3a383ce1 100644 --- a/src/Viewer/View/src/SmilPlayerView.cpp +++ b/src/Viewer/View/src/SmilPlayerView.cpp @@ -30,13 +30,11 @@ SmilPlayerView::~SmilPlayerView() void SmilPlayerView::displayPage(Evas_Object *page) { Eina_List *list = elm_box_children_get(getEo()); - if (list) - { + if (list) { Eina_List *l = nullptr; void *obj = nullptr; - EINA_LIST_FOREACH(list, l, obj) - { + EINA_LIST_FOREACH(list, l, obj) { evas_object_hide((Evas_Object*)obj); } eina_list_free(list); diff --git a/src/Viewer/View/src/SmilTextItemView.cpp b/src/Viewer/View/src/SmilTextItemView.cpp index 76f8a5b6..ca20bd1d 100644 --- a/src/Viewer/View/src/SmilTextItemView.cpp +++ b/src/Viewer/View/src/SmilTextItemView.cpp @@ -38,8 +38,7 @@ Evas_Object *SmilTextItemView::createEntry(Evas_Object *parent, const std::strin evas_object_show(entry); char *markupText = elm_entry_utf8_to_markup(text.c_str()); - if (markupText) - { + if (markupText) { elm_entry_entry_set(entry, markupText); free(markupText); } diff --git a/src/Viewer/View/src/SmilVideoItemView.cpp b/src/Viewer/View/src/SmilVideoItemView.cpp index 0536f177..8f42d202 100644 --- a/src/Viewer/View/src/SmilVideoItemView.cpp +++ b/src/Viewer/View/src/SmilVideoItemView.cpp @@ -19,8 +19,7 @@ #include "Logger.h" using namespace Msg; -namespace -{ +namespace { const int viewerMaxWidth = 656; // Max width size according to UI const int viewerMaxHeight = 369; // Max height size according to UI @@ -28,20 +27,17 @@ namespace { bool isLandscape = contentW > contentH; - if (isLandscape) - { + if (isLandscape) { w = viewerMaxWidth; h = viewerMaxWidth * contentH / contentW; - if (h > viewerMaxHeight) - { + if (h > viewerMaxHeight) { w = viewerMaxHeight * contentW / contentH; h = viewerMaxHeight; } } else { w = viewerMaxHeight * contentH / contentW; h = viewerMaxHeight; - if (w > viewerMaxWidth) - { + if (w > viewerMaxWidth) { w = viewerMaxWidth; h = viewerMaxWidth * contentW / contentH; } diff --git a/src/Viewer/View/src/SubjectLayout.cpp b/src/Viewer/View/src/SubjectLayout.cpp index e2b7f129..16ed0bf7 100644 --- a/src/Viewer/View/src/SubjectLayout.cpp +++ b/src/Viewer/View/src/SubjectLayout.cpp @@ -20,8 +20,7 @@ using namespace Msg; -namespace -{ +namespace { const char *groupName = "subject/pageindex"; const char *partSubject = "subject/text"; const char *partPageText = "page/text"; diff --git a/src/Viewer/View/src/ViewerLayout.cpp b/src/Viewer/View/src/ViewerLayout.cpp index 4b50a3f1..f2a97649 100644 --- a/src/Viewer/View/src/ViewerLayout.cpp +++ b/src/Viewer/View/src/ViewerLayout.cpp @@ -18,8 +18,7 @@ using namespace Msg; -namespace -{ +namespace { const char *layoutGroup = "viewer_layout"; const char *bodyPart = "body"; const char *playerPart = "swallow.playctrl"; diff --git a/test/TC/ContactUtils.cpp b/test/TC/ContactUtils.cpp index c22965f4..9f5d6881 100644 --- a/test/TC/ContactUtils.cpp +++ b/test/TC/ContactUtils.cpp @@ -47,15 +47,13 @@ namespace Msg int error = CONTACTS_ERROR_NONE; error = contacts_db_get_record(_contacts_contact._uri, contactId, &contact); - if (error != CONTACTS_ERROR_NONE) - { + if (error != CONTACTS_ERROR_NONE) { MSG_LOG_ERROR("contacts_db_get_record failed"); return false; } error = contacts_record_get_child_record_at_p(contact, _contacts_contact.name, 0, &name); - if (error != CONTACTS_ERROR_NONE) - { + if (error != CONTACTS_ERROR_NONE) { MSG_LOG_ERROR("contacts_record_get_child_record_at_p failed"); contacts_record_destroy(contact, true); return false; @@ -70,13 +68,11 @@ namespace Msg contacts_record_h name = NULL; int error = CONTACTS_ERROR_NONE; - if (getContactName(contactId, contact, name)) - { + if (getContactName(contactId, contact, name)) { contacts_record_set_str(name, _contacts_name.first, newName.c_str()); error = contacts_db_update_record(contact); - if (error != CONTACTS_ERROR_NONE) - { + if (error != CONTACTS_ERROR_NONE) { MSG_LOG_ERROR("contacts_db_update_record failed"); contacts_record_destroy(contact, true); return; @@ -94,11 +90,9 @@ namespace Msg int error = CONTACTS_ERROR_NONE; std::string result; - if (getContactName(contactId, contact, name)) - { + if (getContactName(contactId, contact, name)) { contacts_record_get_str(name, _contacts_name.first, &str); - if (str) - { + if (str) { result = str; free(str); } diff --git a/test/TC/ContactUtils.h b/test/TC/ContactUtils.h index 6d8c1a49..a54564e9 100644 --- a/test/TC/ContactUtils.h +++ b/test/TC/ContactUtils.h @@ -12,8 +12,7 @@ namespace Msg { namespace Test { - class ContactUtils - { + class ContactUtils { public: static ContactUtils &getInst(); diff --git a/test/TC/TestAppControlUtils.cpp b/test/TC/TestAppControlUtils.cpp index 9363d05b..f464ca8d 100644 --- a/test/TC/TestAppControlUtils.cpp +++ b/test/TC/TestAppControlUtils.cpp @@ -20,8 +20,7 @@ using namespace Msg; -class TestAppControlUtils: public testing::Test -{ +class TestAppControlUtils: public testing::Test { protected: virtual void SetUp() { @@ -55,8 +54,7 @@ TEST_F(TestAppControlUtils, GetExtraDataArray) AppControlUtils::getExtraDataArray(m_handle, APP_CONTROL_DATA_PATH, gotList); int i = 0; - for (auto num: gotList) - { + for (auto num: gotList) { std::string s(arr[i]); ASSERT_EQ(s, num); ++i; @@ -83,8 +81,7 @@ TEST_F(TestAppControlUtils, GetExtraDataIntArray) std::list gotNums; AppControlUtils::getExtraDataIntArray(m_handle, APP_CONTROL_DATA_SELECTED, gotNums); int i = 0; - for (auto num: gotNums) - { + for (auto num: gotNums) { std::string s(numsStrList[i]); ASSERT_EQ(s, std::to_string(num)); ++i; diff --git a/test/TC/TestContactManager.cpp b/test/TC/TestContactManager.cpp index f7198162..64449782 100644 --- a/test/TC/TestContactManager.cpp +++ b/test/TC/TestContactManager.cpp @@ -23,8 +23,7 @@ using namespace Msg; -class TestContactManager: public testing::Test -{ +class TestContactManager: public testing::Test { protected: virtual void SetUp() { diff --git a/test/TC/TestMessageSender.cpp b/test/TC/TestMessageSender.cpp index 3394abe0..b1754da3 100644 --- a/test/TC/TestMessageSender.cpp +++ b/test/TC/TestMessageSender.cpp @@ -26,8 +26,7 @@ using namespace Msg; -class TestMessageSender: public testing::Test -{ +class TestMessageSender: public testing::Test { protected: virtual void SetUp() { diff --git a/test/TC/TestTimeUtils.cpp b/test/TC/TestTimeUtils.cpp index 67638b57..bf748577 100644 --- a/test/TC/TestTimeUtils.cpp +++ b/test/TC/TestTimeUtils.cpp @@ -22,8 +22,7 @@ #include class TimeUtilsTest - : public Msg::TimeUtils -{ + : public Msg::TimeUtils { public: using TimeUtils::getDefaultLocale; using TimeUtils::getDateBestPattern; diff --git a/test/TC/main.cpp b/test/TC/main.cpp index 186b2b4f..17a2c618 100644 --- a/test/TC/main.cpp +++ b/test/TC/main.cpp @@ -25,8 +25,7 @@ static int instancesNum = 0; -struct FinishTestListener : public testing::EmptyTestEventListener -{ +struct FinishTestListener : public testing::EmptyTestEventListener { virtual ~FinishTestListener() {} virtual void OnTestProgramEnd(const testing::UnitTest& /*unit_test*/) -- 2.34.1