From: Denis Dolzhenko Date: Wed, 2 Aug 2017 11:57:14 +0000 (+0300) Subject: TizenRefApp-8998 Implement Blocked number list in Settings X-Git-Tag: submit/tizen/20170803.142151~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b8e21cdfc07f56feed7f645ffb205ccfd95dbf1;p=profile%2Fwearable%2Fapps%2Fnative%2Fmessage.git TizenRefApp-8998 Implement Blocked number list in Settings Change-Id: I7ef92ecd4e872e1db1643e093b628b8e628c31b9 Signed-off-by: Denis Dolzhenko --- diff --git a/project_def.prop b/project_def.prop index 37d8ab2..686baf6 100644 --- a/project_def.prop +++ b/project_def.prop @@ -9,7 +9,7 @@ type = app profile = wearable-4.0 # C/CPP Sources -USER_SRCS = src/Common/MsgEngine/src/MsgThreadItem.cpp src/Common/Utils/src/VCalendarParser.cpp src/Common/MsgEngine/src/dummy/MsgStorageDummy.cpp src/Composer/View/src/ContactListViewItem.cpp src/Conversation/Controller/src/ConvFrame.cpp src/Common/MsgEngine/src/dummy/MessageDummy.cpp src/Common/MsgEngine/src/private/MsgAddressPrivate.cpp src/MainApp/MainApp.cpp src/Conversation/View/src/BubbleIconTextLayoutItem.cpp src/Common/MsgEngine/src/private/MsgReportPrivate.cpp src/Conversation/View/src/BubbleTextViewItem.cpp src/Composer/Controller/src/ContactFrame.cpp src/Common/Utils/src/MediaPlayer.cpp src/Conversation/Controller/src/BubbleVideoEntity.cpp src/Common/View/src/ListItem.cpp src/Common/MsgEngine/src/dummy/MsgConvMediaDummy.cpp src/Composer/Controller/src/MsgInputSelector.cpp src/Common/MsgEngine/src/private/MsgTransportPrivate.cpp src/Common/Utils/src/MediaPlayerProvider.cpp src/Conversation/View/src/BubbleViewItem.cpp src/Conversation/Controller/src/BubbleContactEntity.cpp src/Common/View/src/MoreOption.cpp src/Common/AppControl/src/SettingsLauncher.cpp src/Common/MsgEngine/src/Message.cpp src/Conversation/View/src/BubbleItemContainer.cpp src/Common/AppControl/src/AppControlDefault.cpp src/Common/View/src/ListView.cpp src/Common/MsgEngine/src/MessageMms.cpp src/Common/MsgEngine/src/private/MsgConvMediaPrivate.cpp src/Common/MsgEngine/src/MsgTransport.cpp src/Composer/Controller/src/SendingOptionsFrame.cpp src/Common/ContactManager/src/ContactRecord.cpp src/Common/MsgEngine/src/private/MsgSentStatusPrivate.cpp src/Common/Utils/src/WorkingDir.cpp src/Common/View/src/BasePopup.cpp src/Settings/Controller/src/BlockedMsgListItem.cpp src/Common/Utils/src/FileUtils.cpp src/Settings/Controller/src/SettingsFrame.cpp src/Conversation/View/src/BubbleImageViewItem.cpp src/Settings/View/src/BlockedMsgListViewItem.cpp src/Conversation/View/src/BubbleSubjectViewItem.cpp src/Common/MsgEngine/src/MessageSMS.cpp src/Settings/Controller/src/SettingsBlockListFrame.cpp src/Common/MsgEngine/src/private/MessagePrivate.cpp src/Conversation/Controller/src/ConvList.cpp src/Common/View/src/InputLayout.cpp src/Common/View/src/MbeRecipientsView.cpp src/MsgThread/Controller/src/ThreadListItem.cpp src/Common/View/src/Entry.cpp src/Common/View/src/Popup.cpp src/Common/ContactManager/src/ContactVCardParser.cpp src/Conversation/Controller/src/ConvListItem.cpp src/Common/AppControl/src/AppControlCompose.cpp src/Common/MsgEngine/src/MsgUtils.cpp src/Common/Recipient/src/Recipient.cpp src/Common/Utils/src/PhoneNumberUtils.cpp src/Common/MsgEngine/src/private/MessageSMSPrivate.cpp src/Conversation/View/src/ConvReplyListItem.cpp src/Common/View/src/ToastPopup.cpp src/Common/View/src/View.cpp src/Common/MsgEngine/src/private/MsgConversationItemPrivate.cpp src/Common/Controller/src/FrameController.cpp src/Common/AppControl/src/AppControlCommand.cpp src/Composer/View/src/MsgBodyView.cpp src/Common/MsgEngine/src/dummy/MsgAddressDummy.cpp src/Conversation/Controller/src/BubbleSubjectEntity.cpp src/Common/MsgEngine/src/dummy/MsgComposerDummy.cpp src/Common/MsgEngine/src/private/MsgThreadItemPrivate.cpp src/Common/View/src/StandardPopup.cpp src/Common/MsgEngine/src/MsgEngine.cpp src/Common/AppControl/src/AppControlParser.cpp src/Common/AppControl/src/ContactPicker.cpp src/Common/View/src/NaviFrameView.cpp src/Common/AppControl/src/FileViewer.cpp src/Conversation/View/src/ConvDateLineListItem.cpp src/Common/MsgEngine/src/dummy/MsgPageDummy.cpp src/Conversation/Controller/src/RecipListFrame.cpp src/Common/Utils/src/PathUtils.cpp src/Common/View/src/CtxPopup.cpp src/Common/AppControl/src/VoiceCall.cpp src/Common/MsgEngine/src/MsgSettings.cpp src/Common/MsgEngine/src/dummy/MsgConversationItemDummy.cpp src/Common/ContactManager/src/ContactVCardGenerator.cpp src/Common/AppControl/src/AppControlLauncher.cpp src/Common/Utils/src/LoggerImpl.cpp src/Common/ContactManager/src/ContactManager.cpp src/Common/View/src/SelectButton.cpp src/Conversation/Controller/src/BubbleEntityFactory.cpp src/Settings/View/src/BlockedNumberListViewItem.cpp src/Common/MsgEngine/src/private/MsgAttachmentPrivate.cpp src/Settings/View/src/SettingsMenuListItem.cpp src/Common/View/src/ViewItem.cpp src/Common/MsgEngine/src/private/MsgMediaPrivate.cpp src/Conversation/Controller/src/BubbleAudioEntity.cpp src/Composer/Controller/src/Composer.cpp src/Common/Controller/src/InputFrame.cpp src/Conversation/View/src/BubbleAudioViewItem.cpp src/Composer/View/src/RecipFieldView.cpp src/Common/AppControl/src/Share.cpp src/MsgThread/Controller/src/MsgThreadFrame.cpp src/Common/View/src/StandardWindow.cpp src/Common/MsgEngine/src/MsgConversationItem.cpp src/Common/MsgEngine/src/dummy/MsgUtilsDummy.cpp src/Common/View/src/LineListViewItem.cpp src/Composer/View/src/AlwaysSendAsTextListViewItem.cpp src/Common/MsgEngine/src/private/MessageMmsPrivate.cpp src/Settings/Controller/src/SettingsBlockedMsgDetailFrame.cpp src/Common/MsgEngine/src/dummy/MsgMediaDummy.cpp src/Common/View/src/DefaultLayout.cpp src/Composer/Controller/src/RecipFrame.cpp src/Settings/Controller/src/SettingsMenuBlockListFrame.cpp src/Common/MsgEngine/src/dummy/MsgSettingsDummy.cpp src/Common/View/src/PopupListItem.cpp src/Common/MsgEngine/src/dummy/MsgAttachmentDummy.cpp src/Common/MsgEngine/src/dummy/MessageSMSDummy.cpp src/Common/View/src/BottomButton.cpp src/Common/Controller/src/NaviFrameController.cpp src/Common/MsgEngine/src/dummy/MsgTransportDummy.cpp src/MsgThread/Controller/src/ThreadList.cpp src/Common/Utils/src/TextDecorator.cpp src/Common/MsgEngine/src/dummy/MessageMmsDummy.cpp src/Common/MsgEngine/src/MsgStorage.cpp src/Common/View/src/SelectAllListItem.cpp src/Common/AppControl/src/AppControlHandle.cpp src/Common/AppControl/src/ContactViewer.cpp src/Conversation/View/src/ConvListViewItem.cpp src/Common/Utils/src/ThumbnailMaker.cpp src/Common/View/src/NaviFrameItem.cpp src/Composer/Controller/src/MsgBodyFrame.cpp src/Common/View/src/PopupList.cpp src/Settings/View/src/SettingsBlockedMsgDetailView.cpp src/Common/Controller/src/App.cpp src/Common/View/src/PopupAttachmentListItem.cpp src/Common/MsgEngine/src/private/MsgComposerPrivate.cpp src/Common/Utils/src/MediaUtils.cpp src/Common/MsgEngine/src/dummy/MsgThreadItemDummy.cpp src/Composer/View/src/SendingOptionListViewItem.cpp src/Common/View/src/TitleListItem.cpp src/Common/Utils/src/TimeUtils.cpp src/Conversation/Controller/src/BubbleCalEventEntity.cpp src/Common/Controller/src/ConnectivityChecker.cpp src/Common/MsgEngine/src/private/MsgSettingsPrivate.cpp src/Composer/Controller/src/RecipInputFrame.cpp src/Common/View/src/IconTextPopup.cpp src/MainApp/main.cpp src/Settings/Controller/src/BlockedNumberListItem.cpp src/Common/View/src/NoContentLayout.cpp src/Common/SystemSettingsManager/src/SystemSettingsManager.cpp src/Common/MsgEngine/src/dummy/MsgReportDummy.cpp src/Composer/Controller/src/ContactListItem.cpp src/Common/MsgEngine/src/MsgPage.cpp src/Common/AppControl/src/ContactEditor.cpp src/Common/AppControl/src/InputSelector.cpp src/Common/MsgEngine/src/private/MsgUtilsPrivate.cpp src/Common/View/src/PopupManager.cpp src/MsgThread/View/src/ThreadComposeListViewItem.cpp src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp src/Common/View/src/SearchBar.cpp src/MsgThread/View/src/ThreadListViewItem.cpp src/Common/MsgEngine/src/private/MsgPagePrivate.cpp src/Common/AppControl/src/AppControlUtils.cpp +USER_SRCS = src/Common/MsgEngine/src/MsgThreadItem.cpp src/Common/Utils/src/VCalendarParser.cpp src/Common/MsgEngine/src/dummy/MsgStorageDummy.cpp src/Composer/View/src/ContactListViewItem.cpp src/Conversation/Controller/src/ConvFrame.cpp src/Common/MsgEngine/src/dummy/MessageDummy.cpp src/Common/MsgEngine/src/private/MsgAddressPrivate.cpp src/MainApp/MainApp.cpp src/Conversation/View/src/BubbleIconTextLayoutItem.cpp src/Common/MsgEngine/src/private/MsgReportPrivate.cpp src/Conversation/View/src/BubbleTextViewItem.cpp src/Composer/Controller/src/ContactFrame.cpp src/Common/Utils/src/MediaPlayer.cpp src/Conversation/Controller/src/BubbleVideoEntity.cpp src/Common/View/src/ListItem.cpp src/Common/MsgEngine/src/dummy/MsgConvMediaDummy.cpp src/Composer/Controller/src/MsgInputSelector.cpp src/Common/MsgEngine/src/private/MsgTransportPrivate.cpp src/Common/Utils/src/MediaPlayerProvider.cpp src/Conversation/View/src/BubbleViewItem.cpp src/Conversation/Controller/src/BubbleContactEntity.cpp src/Common/View/src/MoreOption.cpp src/Common/AppControl/src/SettingsLauncher.cpp src/Common/MsgEngine/src/Message.cpp src/Conversation/View/src/BubbleItemContainer.cpp src/Common/AppControl/src/AppControlDefault.cpp src/Common/View/src/ListView.cpp src/Common/MsgEngine/src/MessageMms.cpp src/Common/MsgEngine/src/private/MsgConvMediaPrivate.cpp src/Common/MsgEngine/src/MsgTransport.cpp src/Composer/Controller/src/SendingOptionsFrame.cpp src/Common/ContactManager/src/ContactRecord.cpp src/Common/MsgEngine/src/private/MsgSentStatusPrivate.cpp src/Common/Utils/src/WorkingDir.cpp src/Common/View/src/BasePopup.cpp src/Settings/Controller/src/BlockedMsgListItem.cpp src/Common/Utils/src/FileUtils.cpp src/Settings/Controller/src/SettingsFrame.cpp src/Conversation/View/src/BubbleImageViewItem.cpp src/Settings/View/src/BlockedMsgListViewItem.cpp src/Conversation/View/src/BubbleSubjectViewItem.cpp src/Common/MsgEngine/src/MessageSMS.cpp src/Common/MsgEngine/src/private/MessagePrivate.cpp src/Conversation/Controller/src/ConvList.cpp src/Common/View/src/InputLayout.cpp src/Common/View/src/MbeRecipientsView.cpp src/MsgThread/Controller/src/ThreadListItem.cpp src/Common/View/src/Entry.cpp src/Common/View/src/Popup.cpp src/Settings/Controller/src/SettingsBlockedNumbersFrame.cpp src/Common/ContactManager/src/ContactVCardParser.cpp src/Conversation/Controller/src/ConvListItem.cpp src/Common/AppControl/src/AppControlCompose.cpp src/Common/MsgEngine/src/MsgUtils.cpp src/Common/Recipient/src/Recipient.cpp src/Common/Utils/src/PhoneNumberUtils.cpp src/Common/MsgEngine/src/private/MessageSMSPrivate.cpp src/Conversation/View/src/ConvReplyListItem.cpp src/Common/View/src/ToastPopup.cpp src/Common/View/src/View.cpp src/Common/MsgEngine/src/private/MsgConversationItemPrivate.cpp src/Common/Controller/src/FrameController.cpp src/Common/AppControl/src/AppControlCommand.cpp src/Composer/View/src/MsgBodyView.cpp src/Common/MsgEngine/src/dummy/MsgAddressDummy.cpp src/Conversation/Controller/src/BubbleSubjectEntity.cpp src/Common/MsgEngine/src/dummy/MsgComposerDummy.cpp src/Common/MsgEngine/src/private/MsgThreadItemPrivate.cpp src/Common/View/src/StandardPopup.cpp src/Common/MsgEngine/src/MsgEngine.cpp src/Common/AppControl/src/AppControlParser.cpp src/Common/AppControl/src/ContactPicker.cpp src/Common/View/src/NaviFrameView.cpp src/Common/AppControl/src/FileViewer.cpp src/Conversation/View/src/ConvDateLineListItem.cpp src/Common/MsgEngine/src/dummy/MsgPageDummy.cpp src/Conversation/Controller/src/RecipListFrame.cpp src/Common/Utils/src/PathUtils.cpp src/Common/View/src/CtxPopup.cpp src/Common/AppControl/src/VoiceCall.cpp src/Common/MsgEngine/src/MsgSettings.cpp src/Common/MsgEngine/src/dummy/MsgConversationItemDummy.cpp src/Common/ContactManager/src/ContactVCardGenerator.cpp src/Common/AppControl/src/AppControlLauncher.cpp src/Common/Utils/src/LoggerImpl.cpp src/Common/ContactManager/src/ContactManager.cpp src/Common/View/src/SelectButton.cpp src/Conversation/Controller/src/BubbleEntityFactory.cpp src/Settings/View/src/BlockedNumberListViewItem.cpp src/Common/MsgEngine/src/private/MsgAttachmentPrivate.cpp src/Settings/View/src/SettingsMenuListItem.cpp src/Common/View/src/ViewItem.cpp src/Common/MsgEngine/src/private/MsgMediaPrivate.cpp src/Conversation/Controller/src/BubbleAudioEntity.cpp src/Composer/Controller/src/Composer.cpp src/Common/Controller/src/InputFrame.cpp src/Conversation/View/src/BubbleAudioViewItem.cpp src/Composer/View/src/RecipFieldView.cpp src/Common/AppControl/src/Share.cpp src/MsgThread/Controller/src/MsgThreadFrame.cpp src/Common/View/src/StandardWindow.cpp src/Common/MsgEngine/src/MsgConversationItem.cpp src/Common/MsgEngine/src/dummy/MsgUtilsDummy.cpp src/Common/View/src/LineListViewItem.cpp src/Composer/View/src/AlwaysSendAsTextListViewItem.cpp src/Common/MsgEngine/src/private/MessageMmsPrivate.cpp src/Settings/Controller/src/SettingsBlockedMsgDetailFrame.cpp src/Settings/Controller/src/SettingsBlockedMessagesFrame.cpp src/Common/MsgEngine/src/dummy/MsgMediaDummy.cpp src/Common/View/src/DefaultLayout.cpp src/Composer/Controller/src/RecipFrame.cpp src/Settings/Controller/src/SettingsMenuBlockListFrame.cpp src/Common/MsgEngine/src/dummy/MsgSettingsDummy.cpp src/Common/View/src/PopupListItem.cpp src/Common/MsgEngine/src/dummy/MsgAttachmentDummy.cpp src/Common/MsgEngine/src/dummy/MessageSMSDummy.cpp src/Common/View/src/BottomButton.cpp src/Common/Controller/src/NaviFrameController.cpp src/Common/MsgEngine/src/dummy/MsgTransportDummy.cpp src/MsgThread/Controller/src/ThreadList.cpp src/Common/Utils/src/TextDecorator.cpp src/Common/MsgEngine/src/dummy/MessageMmsDummy.cpp src/Common/MsgEngine/src/MsgStorage.cpp src/Common/View/src/SelectAllListItem.cpp src/Common/AppControl/src/AppControlHandle.cpp src/Common/AppControl/src/ContactViewer.cpp src/Conversation/View/src/ConvListViewItem.cpp src/Common/Utils/src/ThumbnailMaker.cpp src/Common/View/src/NaviFrameItem.cpp src/Composer/Controller/src/MsgBodyFrame.cpp src/Common/View/src/PopupList.cpp src/Settings/View/src/SettingsBlockedMsgDetailView.cpp src/Common/Controller/src/App.cpp src/Common/View/src/PopupAttachmentListItem.cpp src/Common/MsgEngine/src/private/MsgComposerPrivate.cpp src/Common/Utils/src/MediaUtils.cpp src/Common/MsgEngine/src/dummy/MsgThreadItemDummy.cpp src/Composer/View/src/SendingOptionListViewItem.cpp src/Common/View/src/TitleListItem.cpp src/Common/Utils/src/TimeUtils.cpp src/Conversation/Controller/src/BubbleCalEventEntity.cpp src/Common/Controller/src/ConnectivityChecker.cpp src/Common/MsgEngine/src/private/MsgSettingsPrivate.cpp src/Composer/Controller/src/RecipInputFrame.cpp src/Common/View/src/IconTextPopup.cpp src/MainApp/main.cpp src/Settings/Controller/src/BlockedNumberListItem.cpp src/Common/View/src/NoContentLayout.cpp src/Common/SystemSettingsManager/src/SystemSettingsManager.cpp src/Common/MsgEngine/src/dummy/MsgReportDummy.cpp src/Composer/Controller/src/ContactListItem.cpp src/Common/MsgEngine/src/MsgPage.cpp src/Common/AppControl/src/ContactEditor.cpp src/Common/AppControl/src/InputSelector.cpp src/Common/MsgEngine/src/private/MsgUtilsPrivate.cpp src/Common/View/src/PopupManager.cpp src/MsgThread/View/src/ThreadComposeListViewItem.cpp src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp src/Common/View/src/SearchBar.cpp src/MsgThread/View/src/ThreadListViewItem.cpp src/Common/MsgEngine/src/private/MsgPagePrivate.cpp src/Common/AppControl/src/AppControlUtils.cpp # EDC Sources USER_EDCS = diff --git a/res/edje/default_layout.edc b/res/edje/default_layout.edc index 708932a..15355ac 100755 --- a/res/edje/default_layout.edc +++ b/res/edje/default_layout.edc @@ -34,7 +34,7 @@ collections { visible: 0; } } - part { name: "swl.more_option"; + part { name: "swl.select_button"; type: SWALLOW; scale: 1; description { state: "default" 0.0; @@ -49,7 +49,7 @@ collections { visible: 0; } } - part { name: "swl.select_button"; + part { name: "swl.bottom_button"; type: SWALLOW; scale: 1; description { state: "default" 0.0; @@ -64,7 +64,7 @@ collections { visible: 0; } } - part { name: "swl.bottom_button"; + part { name: "swl.more_option"; type: SWALLOW; scale: 1; description { state: "default" 0.0; diff --git a/src/Common/Recipient/src/Recipient.cpp b/src/Common/Recipient/src/Recipient.cpp index 3d1728e..469eccb 100644 --- a/src/Common/Recipient/src/Recipient.cpp +++ b/src/Common/Recipient/src/Recipient.cpp @@ -199,5 +199,8 @@ Recipient Recipient::getByContactPersonNmberId(int id) Recipient Recipient::getByAddress(const std::string &address) { auto rec = App::getInst().getContactManager().getContactAddress(address); - return toRecip(rec); + Recipient recip = toRecip(rec); + if (recip.getAddress().empty()) + recip.setAddress(address); + return recip; } diff --git a/src/Common/Utils/inc/PhoneNumberUtils.h b/src/Common/Utils/inc/PhoneNumberUtils.h index ee0b004..fa28339 100644 --- a/src/Common/Utils/inc/PhoneNumberUtils.h +++ b/src/Common/Utils/inc/PhoneNumberUtils.h @@ -29,7 +29,7 @@ namespace Msg { bool addToBlocked(const std::string &number); bool removeFromBlocked(const std::string &number); std::list getBlockedNumList() const; - bool isBlocked(const std::string &number); + bool isBlocked(const std::string &number) const; private: PhoneNumberUtils(); diff --git a/src/Common/Utils/src/PhoneNumberUtils.cpp b/src/Common/Utils/src/PhoneNumberUtils.cpp index b6822b3..ef0f863 100644 --- a/src/Common/Utils/src/PhoneNumberUtils.cpp +++ b/src/Common/Utils/src/PhoneNumberUtils.cpp @@ -120,7 +120,7 @@ std::list PhoneNumberUtils::getBlockedNumList() const return res; } -bool PhoneNumberUtils::isBlocked(const std::string &number) +bool PhoneNumberUtils::isBlocked(const std::string &number) const { bool res = false; phone_number_check_blocking(number.c_str(), &res); diff --git a/src/Common/View/inc/View.h b/src/Common/View/inc/View.h index 0a37097..b5d6525 100644 --- a/src/Common/View/inc/View.h +++ b/src/Common/View/inc/View.h @@ -404,7 +404,7 @@ namespace Msg inline void View::setFocus(bool focus) { - return elm_object_focus_set(m_pEo, focus); + elm_object_focus_set(m_pEo, focus); } inline bool View::getFocus() const diff --git a/src/MsgThread/Controller/src/ThreadList.cpp b/src/MsgThread/Controller/src/ThreadList.cpp index 971a54d..92ba4aa 100644 --- a/src/MsgThread/Controller/src/ThreadList.cpp +++ b/src/MsgThread/Controller/src/ThreadList.cpp @@ -110,7 +110,6 @@ bool ThreadList::isAllThreadListItemChecked() const return true; } - void ThreadList::checkHandler(ThreadListItem &item) { ThreadId threadId = item.getThreadId(); diff --git a/src/Settings/Controller/inc/BlockedNumberListItem.h b/src/Settings/Controller/inc/BlockedNumberListItem.h index 7477e2f..c9ce7e2 100644 --- a/src/Settings/Controller/inc/BlockedNumberListItem.h +++ b/src/Settings/Controller/inc/BlockedNumberListItem.h @@ -18,18 +18,24 @@ #define BlockedNumberListItem_h_ #include "BlockedNumberListViewItem.h" +#include "Recipient.h" namespace Msg { class BlockedNumberListItem : public BlockedNumberListViewItem { public: - BlockedNumberListItem(); + BlockedNumberListItem(Recipient recip); virtual ~BlockedNumberListItem(); + Recipient &getRecip(); + private: std::string getAddress() override; std::string getContactName() override; + + private: + Recipient m_Recip; }; } diff --git a/src/Settings/Controller/inc/SettingsBlockListFrame.h b/src/Settings/Controller/inc/SettingsBlockListFrame.h deleted file mode 100644 index 2dad384..0000000 --- a/src/Settings/Controller/inc/SettingsBlockListFrame.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2016 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.org/license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef SettingsBlockListFrame_h_ -#define SettingsBlockListFrame_h_ - -#include "SystemSettingsManager.h" -#include "FrameController.h" -#include "ListView.h" - -namespace Msg { - - class ListView; - class ListItem; - class DefaultLayout; - class MoreOption; - class BottomButton; - class CtxPopupItem; - class SelectButton; - class PaddingListViewItem; - class NoContentLayout; - - class SettingsBlockListFrame - : public FrameController - , private IListViewListener - , private ISystemSettingsManager { - - public: - enum BlockListType { - BlockedNumType, - BlockedMsgType - }; - - SettingsBlockListFrame(NaviFrameController &parent, BlockListType type); - virtual ~SettingsBlockListFrame(); - - protected: - // NaviFrameItem: - void onAttached(ViewItem &item) override; - - private: - // Select mode cb: - void onDoneButtonClicked(Evas_Object *obj, void *event); - void onSelectButtonClicked(Evas_Object *obj, void *event); - void onSelectAllButtonClicked(CtxPopupItem &item); - void onDeselectAllButtonClicked(CtxPopupItem &item); - - // More option: - void onRestoreClicked(MoreOption &obj); - void onDeleteClicked(MoreOption &obj); - - // IListViewListener: - void onListItemSelected(ListItem &listItem) override; - - // ISystemSettingsManager: - void onTimeFormatChanged() override; - void onLanguageChanged() override; - - void prepareMainLayout(); - void prepareMoreOption(); - void prepareSelectViews(); - void preapareList(); - void prepareNoContent(); - void updateCheckViews(); - void fillList(); - void setSelectMode(bool value); - void showSelectPopup(); - void updateNoContent(); - void updateLangInfo(); - void insertItem(ListItem *item); - - private: - const BlockListType m_BlockListType; - bool m_IsSelectMode; - DefaultLayout *m_pLayout; - MoreOption *m_pMoreOption; - BottomButton *m_pDoneButton; - SelectButton *m_pSelectButton; - ListView *m_pList; - PaddingListViewItem *m_pBottomItem; - NoContentLayout *m_pNoContent; - }; -} - -#endif /* SettingsBlockListFrame_h_ */ diff --git a/src/Settings/Controller/inc/SettingsBlockedMessagesFrame.h b/src/Settings/Controller/inc/SettingsBlockedMessagesFrame.h new file mode 100644 index 0000000..9de8ed3 --- /dev/null +++ b/src/Settings/Controller/inc/SettingsBlockedMessagesFrame.h @@ -0,0 +1,105 @@ +/* + * Copyright 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SettingsBlockedMessagesFrame_h_ +#define SettingsBlockedMessagesFrame_h_ + +#include "SystemSettingsManager.h" +#include "FrameController.h" +#include "ListView.h" + +namespace Msg { + + class ListView; + class ListItem; + class DefaultLayout; + class MoreOption; + class BottomButton; + class CtxPopupItem; + class SelectButton; + class PaddingListViewItem; + class NoContentLayout; + class SelectCtxPopup; + class BlockedMsgListItem; + + class SettingsBlockedMessagesFrame + : public FrameController + , private IListViewListener + , private ISystemSettingsManager { + + public: + SettingsBlockedMessagesFrame(NaviFrameController &parent); + virtual ~SettingsBlockedMessagesFrame(); + + protected: + // NaviFrameItem: + void onAttached(ViewItem &item) override; + + private: + // Select mode cb: + void onDoneButtonClicked(Evas_Object *obj, void *event); + void onSelectButtonClicked(Evas_Object *obj, void *event); + void onSelectAllButtonClicked(CtxPopupItem &item); + void onDeselectAllButtonClicked(CtxPopupItem &item); + void onSelectPopupDel(Evas *e, Evas_Object *obj, void *event_info); + + // More option: + void onRestoreClicked(MoreOption &obj); + void onDeleteClicked(MoreOption &obj); + + // IListViewListener: + void onListItemSelected(ListItem &listItem) override; + void onListItemLongPressed(ListItem &listItem) override; + void onListItemChecked(ListItem &listItem) override; + + // ISystemSettingsManager: + void onTimeFormatChanged() override; + void onLanguageChanged() override; + + // Hw buttons: + void onHwBackButtonPreessed(Evas_Object *obj, void *event); + + void prepareMainLayout(); + void prepareMoreOption(); + void prepareSelectViews(); + void preapareList(); + void prepareNoContent(); + void updateSelectViews(); + void fillList(); + void setSelectMode(bool value); + void showSelectPopup(); + void hideSelectPopup(); + void updateNoContent(); + void updateLangInfo(); + void insertItem(ListItem *item); + void checkHandler(ListItem &item); + void deleteMessages(const std::vector &items); + std::vector getSelectedItems() const; + + private: + bool m_IsSelectMode; + DefaultLayout *m_pLayout; + MoreOption *m_pMoreOption; + BottomButton *m_pDoneButton; + SelectButton *m_pSelectButton; + ListView *m_pList; + PaddingListViewItem *m_pBottomItem; + NoContentLayout *m_pNoContent; + SelectCtxPopup *m_pSelectPopup; + }; +} + +#endif /* SettingsBlockedMessagesFrame_h_ */ diff --git a/src/Settings/Controller/inc/SettingsBlockedNumbersFrame.h b/src/Settings/Controller/inc/SettingsBlockedNumbersFrame.h new file mode 100644 index 0000000..ba25986 --- /dev/null +++ b/src/Settings/Controller/inc/SettingsBlockedNumbersFrame.h @@ -0,0 +1,108 @@ +/* + * Copyright 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SettingsBlockedNumbersFrame_h_ +#define SettingsBlockedNumbersFrame_h_ + +#include "SystemSettingsManager.h" +#include "ContactManager.h" +#include "FrameController.h" +#include "ListView.h" + +namespace Msg { + + class ListView; + class ListItem; + class DefaultLayout; + class MoreOption; + class BottomButton; + class CtxPopupItem; + class SelectButton; + class PaddingListViewItem; + class NoContentLayout; + class SelectCtxPopup; + class BlockedNumberListItem; + + class SettingsBlockedNumbersFrame + : public FrameController + , private IListViewListener + , private ISystemSettingsManager + , private IContactManagerListener { + + public: + SettingsBlockedNumbersFrame(NaviFrameController &parent); + virtual ~SettingsBlockedNumbersFrame(); + + protected: + // NaviFrameItem: + void onAttached(ViewItem &item) override; + + private: + // Select mode cb: + void onDeleteButtonClicked(Evas_Object *obj, void *event); + void onSelectButtonClicked(Evas_Object *obj, void *event); + void onSelectAllButtonClicked(CtxPopupItem &item); + void onDeselectAllButtonClicked(CtxPopupItem &item); + void onSelectPopupDel(Evas *e, Evas_Object *obj, void *event_info); + + // More option: + void onDeleteClicked(MoreOption &obj); + + // IListViewListener: + void onListItemLongPressed(ListItem &listItem) override; + void onListItemChecked(ListItem &listItem) override; + + // ISystemSettingsManager: + void onLanguageChanged() override; + + // IContactManagerListener: + void onContactChanged() override; + + // Hw buttons: + void onHwBackButtonPreessed(Evas_Object *obj, void *event); + + + void prepareMainLayout(); + void prepareMoreOption(); + void prepareSelectViews(); + void preapareList(); + void prepareNoContent(); + void updateSelectViews(); + void fillList(); + void setSelectMode(bool value); + void showSelectPopup(); + void hideSelectPopup(); + void updateNoContent(); + void updateLangInfo(); + void updateContactInfo(); + void insertItem(ListItem *item); + void checkHandler(ListItem &item); + void deleteNumbers(const std::vector &items); + + private: + bool m_IsSelectMode; + DefaultLayout *m_pLayout; + MoreOption *m_pMoreOption; + BottomButton *m_pDelButton; + SelectButton *m_pSelectButton; + ListView *m_pList; + PaddingListViewItem *m_pBottomItem; + NoContentLayout *m_pNoContent; + SelectCtxPopup *m_pSelectPopup; + }; +} + +#endif /* SettingsBlockedNumbersFrame_h_ */ diff --git a/src/Settings/Controller/src/BlockedNumberListItem.cpp b/src/Settings/Controller/src/BlockedNumberListItem.cpp index d5392c3..8f10903 100644 --- a/src/Settings/Controller/src/BlockedNumberListItem.cpp +++ b/src/Settings/Controller/src/BlockedNumberListItem.cpp @@ -18,9 +18,11 @@ using namespace Msg; -BlockedNumberListItem::BlockedNumberListItem() +BlockedNumberListItem::BlockedNumberListItem(Recipient recip) + : m_Recip(std::move(recip)) { - // TODO: impl. + auto style = m_Recip.getContactName().empty() ? numberStyle : contactNameStyle; + setStyle(style); } BlockedNumberListItem::~BlockedNumberListItem() @@ -29,12 +31,15 @@ BlockedNumberListItem::~BlockedNumberListItem() std::string BlockedNumberListItem::getAddress() { - // TODO: impl. - return "Address"; + return m_Recip.getAddress(); } std::string BlockedNumberListItem::getContactName() { - // TODO: impl. - return "Name"; + return m_Recip.getContactName(); +} + +Recipient &BlockedNumberListItem::getRecip() +{ + return m_Recip; } diff --git a/src/Settings/Controller/src/SettingsBlockListFrame.cpp b/src/Settings/Controller/src/SettingsBlockListFrame.cpp deleted file mode 100644 index 1d05acc..0000000 --- a/src/Settings/Controller/src/SettingsBlockListFrame.cpp +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright 2016 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.org/license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include "SettingsBlockListFrame.h" -#include "MoreOption.h" -#include "BottomButton.h" -#include "DefaultLayout.h" -#include "TitleListItem.h" -#include "PaddingListViewItem.h" -#include "SelectButton.h" -#include "SelectCtxPopup.h" -#include "Logger.h" -#include "BlockedNumberListItem.h" -#include "BlockedMsgListItem.h" -#include "NoContentLayout.h" -#include "SettingsBlockedMsgDetailFrame.h" -#include "App.h" -#include "NaviFrameController.h" - -using namespace Msg; - -SettingsBlockListFrame::SettingsBlockListFrame(NaviFrameController &parent, BlockListType type) - : FrameController(parent, SettingsGroup) - , m_BlockListType(type) - , m_IsSelectMode(false) - , m_pLayout(nullptr) - , m_pMoreOption(nullptr) - , m_pDoneButton(nullptr) - , m_pSelectButton(nullptr) - , m_pList(nullptr) - , m_pBottomItem(nullptr) - , m_pNoContent(nullptr) -{ - MSG_LOG(""); - prepareMainLayout(); - prepareMoreOption(); - preapareList(); - updateNoContent(); - App::getInst().getSysSettingsManager().addListener(*this); -} - -SettingsBlockListFrame::~SettingsBlockListFrame() -{ - App::getInst().getSysSettingsManager().removeListener(*this); -} - -void SettingsBlockListFrame::setSelectMode(bool value) -{ - if (value == m_IsSelectMode) - return; - - m_IsSelectMode = value; - m_pLayout->showBottomButton(value); - m_pLayout->showMoreOption(!value); - - if (value) { - prepareSelectViews(); - m_pSelectButton->setText("0"); - m_pSelectButton->showButton(true); - m_pDoneButton->disabled(true); - } else { - if (m_pSelectButton) - m_pSelectButton->showButton(false); - } -} - -void SettingsBlockListFrame::prepareMainLayout() -{ - if (!m_pLayout) { - m_pLayout = new DefaultLayout(getParent()); - m_pLayout->showSelectButton(true); - m_pLayout->showMoreOption(true); - } -} - -void SettingsBlockListFrame::preapareList() -{ - if (!m_pList) { - m_pList = new ListView(getParent(), App::getInst().getWindow().getCircleSurface()); - m_pList->setHomogeneous(false); - m_pList->setMultiSelection(false); - m_pList->setListener(this); - m_pLayout->setContent(*m_pList); - fillList(); - } -} - -void SettingsBlockListFrame::prepareNoContent() -{ - if (!m_pNoContent) { - m_pNoContent = new NoContentLayout(*m_pLayout); - m_pNoContent->enableTitle(true); - - Evas_Object *img = elm_image_add(*m_pNoContent); - std::string imgPath = PathUtils::getResourcePath(IMAGES_EDJ_PATH); - elm_image_file_set(img, imgPath.c_str(), NO_SPAM_MSG_ICON); - - m_pNoContent->setIcon(img); - m_pLayout->setNoContent(*m_pNoContent); - } -} - -void SettingsBlockListFrame::fillList() -{ - // Title: - auto *titleItem = new TitleListItem; - const char *titleStr = m_BlockListType == BlockedMsgType ? "WDS_MSG_MBODY_BLOCKED_MESSAGES" - : "WDS_MSG_MBODY_BLOCKED_NUMBERS"; - titleItem->setTitle(msg(titleStr)); - m_pList->appendItem(*titleItem); - - // Bottom padding: - m_pBottomItem = new PaddingListViewItem; - insertItem(m_pBottomItem); -} - -void SettingsBlockListFrame::prepareMoreOption() -{ - if (!m_pMoreOption) { - m_pMoreOption = new MoreOption(*m_pLayout); - m_pMoreOption->setDirection(EEXT_MORE_OPTION_DIRECTION_RIGHT); - m_pMoreOption->appendItem(msgt("WDS_MSG_OPT_RESTORE_ABB"), RESTORE_MORE_ICON, makeCbLast(&SettingsBlockListFrame::onRestoreClicked), this); - m_pMoreOption->appendItem(msgt("WDS_MSG_OPT_DELETE_ABB"), DELETEG_MORE_ICON, makeCbLast(&SettingsBlockListFrame::onDeleteClicked), this); - m_pLayout->setMoreOption(*m_pMoreOption); - } -} - -void SettingsBlockListFrame::prepareSelectViews() -{ - if (!m_pDoneButton) { - m_pDoneButton = new BottomButton(*m_pLayout); - m_pDoneButton->setText(msgt("IDS_MSG_ACBUTTON_DELETE_ABB")); - View::addSmartCb(m_pDoneButton->getInnerButton(), "clicked", makeCbFirst(&SettingsBlockListFrame::onDoneButtonClicked), this); - m_pLayout->setBottomButton(*m_pDoneButton); - } - - if (!m_pSelectButton) { - m_pSelectButton = new SelectButton(*m_pLayout); - View::addSmartCb(m_pSelectButton->getInnerButton(), "clicked", makeCbFirst(&SettingsBlockListFrame::onSelectButtonClicked), this); - m_pLayout->setSelectButton(*m_pSelectButton); - } -} - -void SettingsBlockListFrame::updateCheckViews() -{ - if (m_IsSelectMode) { - int count = m_pList->getCheckedItemsCount(); - m_pSelectButton->setText(std::to_string(count)); - m_pDoneButton->disabled(count <= 0); - } -} - -void SettingsBlockListFrame::showSelectPopup() -{ - auto *ctx = new SelectCtxPopup; - int checkedCount = m_pList->getCheckedItemsCount(); - int checkableCount = m_pList->getCheckableItemsCount(); - - if (checkedCount < checkableCount) - ctx->appendTopItem(msgt("WDS_MSG_OPT_SELECT_ALL_ABB"), makeCbLast(&SettingsBlockListFrame::onSelectAllButtonClicked), this); - if (checkedCount > 0) - ctx->appendBottomItem(msgt("WDS_MSG_OPT_DESELECT_ALL_ABB"), makeCbLast(&SettingsBlockListFrame::onDeselectAllButtonClicked), this); - - if (m_pSelectButton) - ctx->align(m_pSelectButton->getInnerButton()); - - ctx->go(); -} - -void SettingsBlockListFrame::updateNoContent() -{ - int count = m_BlockListType == BlockedNumType ? m_pList->getItemsCount() - : m_pList->getItemsCount(); - bool noContent = count <= 0; - - if (noContent) { - const char *text = m_BlockListType == BlockedNumType ? "WDS_MSG_NPBODY_NO_BLOCKED_NUMBERS_ABB" - : "WDS_MSG_NPBODY_NO_BLOCKED_MESSAGES_ABB"; - const char *title = m_BlockListType == BlockedMsgType ? "WDS_MSG_MBODY_BLOCKED_MESSAGES" - : "WDS_MSG_MBODY_BLOCKED_NUMBERS"; - prepareNoContent(); - m_pNoContent->setTitle(msgt(title)); - m_pNoContent->setText(msgt(text)); - } - - m_pLayout->showNoContent(noContent); - m_pLayout->showContent(!noContent); - m_pLayout->showMoreOption(!noContent); -} - -void SettingsBlockListFrame::updateLangInfo() -{ - m_pList->updateRealizedItems(); - // TODO: update items -} - -void SettingsBlockListFrame::insertItem(ListItem *item) -{ - if(m_pBottomItem && m_pBottomItem != item) - m_pList->insertBeforeItem(*item, *m_pBottomItem); - else - m_pList->appendItem(*item); -} - -void SettingsBlockListFrame::onAttached(ViewItem &item) -{ - FrameController::onAttached(item); - setContent(*m_pLayout); -} - -void SettingsBlockListFrame::onSelectAllButtonClicked(CtxPopupItem &item) -{ - MSG_LOG(""); -} - -void SettingsBlockListFrame::onDeselectAllButtonClicked(CtxPopupItem &item) -{ - MSG_LOG(""); -} - -void SettingsBlockListFrame::onRestoreClicked(MoreOption &obj) -{ - MSG_LOG(""); -} - -void SettingsBlockListFrame::onDeleteClicked(MoreOption &obj) -{ - MSG_LOG(""); - setSelectMode(true); -} - -void SettingsBlockListFrame::onDoneButtonClicked(Evas_Object *obj, void *event) -{ - MSG_LOG(""); - setSelectMode(false); -} - -void SettingsBlockListFrame::onSelectButtonClicked(Evas_Object *obj, void *event) -{ - MSG_LOG(""); -} - -void SettingsBlockListFrame::onListItemSelected(ListItem &listItem) -{ - MSG_LOG(""); - auto *frame = new SettingsBlockedMsgDetailFrame(getParent()); - getParent().push(*frame); -} - -void SettingsBlockListFrame::onTimeFormatChanged() -{ - MSG_LOG(""); -} - -void SettingsBlockListFrame::onLanguageChanged() -{ - MSG_LOG(""); - updateLangInfo(); -} - diff --git a/src/Settings/Controller/src/SettingsBlockedMessagesFrame.cpp b/src/Settings/Controller/src/SettingsBlockedMessagesFrame.cpp new file mode 100644 index 0000000..c9dcf9c --- /dev/null +++ b/src/Settings/Controller/src/SettingsBlockedMessagesFrame.cpp @@ -0,0 +1,342 @@ +/* + * Copyright 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include "SettingsBlockedMessagesFrame.h" +#include "MoreOption.h" +#include "BottomButton.h" +#include "DefaultLayout.h" +#include "TitleListItem.h" +#include "PaddingListViewItem.h" +#include "SelectButton.h" +#include "SelectCtxPopup.h" +#include "Logger.h" +#include "BlockedNumberListItem.h" +#include "BlockedMsgListItem.h" +#include "NoContentLayout.h" +#include "SettingsBlockedMsgDetailFrame.h" +#include "App.h" +#include "NaviFrameController.h" +#include "PhoneNumberUtils.h" + +using namespace Msg; + +SettingsBlockedMessagesFrame::SettingsBlockedMessagesFrame(NaviFrameController &parent) + : FrameController(parent, SettingsGroup) + , m_IsSelectMode(false) + , m_pLayout(nullptr) + , m_pMoreOption(nullptr) + , m_pDoneButton(nullptr) + , m_pSelectButton(nullptr) + , m_pList(nullptr) + , m_pBottomItem(nullptr) + , m_pNoContent(nullptr) + , m_pSelectPopup(nullptr) +{ + MSG_LOG(""); + prepareMainLayout(); + prepareMoreOption(); + preapareList(); + updateNoContent(); + App::getInst().getSysSettingsManager().addListener(*this); +} + +SettingsBlockedMessagesFrame::~SettingsBlockedMessagesFrame() +{ + hideSelectPopup(); + App::getInst().getSysSettingsManager().removeListener(*this); +} + +void SettingsBlockedMessagesFrame::setSelectMode(bool value) +{ + if (value == m_IsSelectMode) + return; + + m_IsSelectMode = value; + m_pLayout->showBottomButton(value); + m_pList->setCheckMode(value); + m_pList->checkAllItems(false); + m_pList->updateRealizedItems(); + + if (value) { + prepareSelectViews(); + m_pSelectButton->setText("0"); + m_pSelectButton->showButton(true); + m_pDoneButton->disabled(true); + } else { + if (m_pSelectButton) + m_pSelectButton->showButton(false); + } +} + +void SettingsBlockedMessagesFrame::prepareMainLayout() +{ + if (!m_pLayout) { + m_pLayout = new DefaultLayout(getParent()); + m_pLayout->showSelectButton(true); + m_pLayout->showMoreOption(true); + m_pLayout->addHwButtonEvent(EEXT_CALLBACK_BACK, makeCbFirst(&SettingsBlockedMessagesFrame::onHwBackButtonPreessed), this); + } +} + +void SettingsBlockedMessagesFrame::preapareList() +{ + if (!m_pList) { + m_pList = new ListView(getParent(), App::getInst().getWindow().getCircleSurface()); + m_pList->setHomogeneous(false); + m_pList->setMultiSelection(false); + m_pList->setListener(this); + m_pLayout->setContent(*m_pList); + fillList(); + } +} + +void SettingsBlockedMessagesFrame::prepareNoContent() +{ + if (!m_pNoContent) { + m_pNoContent = new NoContentLayout(*m_pLayout); + m_pNoContent->enableTitle(true); + + Evas_Object *img = elm_image_add(*m_pNoContent); + std::string imgPath = PathUtils::getResourcePath(IMAGES_EDJ_PATH); + elm_image_file_set(img, imgPath.c_str(), NO_SPAM_MSG_ICON); + + m_pNoContent->setIcon(img); + m_pLayout->setNoContent(*m_pNoContent); + } +} + +void SettingsBlockedMessagesFrame::fillList() +{ + + // Title: + auto *titleItem = new TitleListItem; + titleItem->setTitle(msg("WDS_MSG_MBODY_BLOCKED_MESSAGES")); + m_pList->appendItem(*titleItem); + + // TODO: fill + + // Bottom padding: + m_pBottomItem = new PaddingListViewItem; + insertItem(m_pBottomItem); +} + +void SettingsBlockedMessagesFrame::prepareMoreOption() +{ + if (!m_pMoreOption) { + m_pMoreOption = new MoreOption(*m_pLayout); + m_pMoreOption->setDirection(EEXT_MORE_OPTION_DIRECTION_RIGHT); + m_pMoreOption->appendItem(msgt("WDS_MSG_OPT_RESTORE_ABB"), RESTORE_MORE_ICON, makeCbLast(&SettingsBlockedMessagesFrame::onRestoreClicked), this); + m_pMoreOption->appendItem(msgt("WDS_MSG_OPT_DELETE_ABB"), DELETEG_MORE_ICON, makeCbLast(&SettingsBlockedMessagesFrame::onDeleteClicked), this); + m_pLayout->setMoreOption(*m_pMoreOption); + } +} + +void SettingsBlockedMessagesFrame::prepareSelectViews() +{ + if (!m_pDoneButton) { + m_pDoneButton = new BottomButton(*m_pLayout); + m_pDoneButton->setText(msgt("IDS_MSG_ACBUTTON_DELETE_ABB")); + View::addSmartCb(m_pDoneButton->getInnerButton(), "clicked", makeCbFirst(&SettingsBlockedMessagesFrame::onDoneButtonClicked), this); + m_pLayout->setBottomButton(*m_pDoneButton); + } + + if (!m_pSelectButton) { + m_pSelectButton = new SelectButton(*m_pLayout); + View::addSmartCb(m_pSelectButton->getInnerButton(), "clicked", makeCbFirst(&SettingsBlockedMessagesFrame::onSelectButtonClicked), this); + m_pLayout->setSelectButton(*m_pSelectButton); + } +} + +void SettingsBlockedMessagesFrame::updateSelectViews() +{ + if (m_IsSelectMode) { + int count = m_pList->getCheckedItemsCount(); + m_pSelectButton->setText(std::to_string(count)); + m_pDoneButton->disabled(count <= 0); + } +} + +void SettingsBlockedMessagesFrame::showSelectPopup() +{ + m_pSelectPopup = new SelectCtxPopup; + m_pSelectPopup->addEventCb(EVAS_CALLBACK_DEL, makeCbFirst(&SettingsBlockedMessagesFrame::onSelectPopupDel), this); + int checkedCount = m_pList->getCheckedItemsCount(); + int checkableCount = m_pList->getCheckableItemsCount(); + + if (checkedCount < checkableCount) + m_pSelectPopup->appendTopItem(msgt("WDS_MSG_OPT_SELECT_ALL_ABB"), makeCbLast(&SettingsBlockedMessagesFrame::onSelectAllButtonClicked), this); + if (checkedCount > 0) + m_pSelectPopup->appendBottomItem(msgt("WDS_MSG_OPT_DESELECT_ALL_ABB"), makeCbLast(&SettingsBlockedMessagesFrame::onDeselectAllButtonClicked), this); + + if (m_pSelectButton) + m_pSelectPopup->align(m_pSelectButton->getInnerButton()); + + m_pSelectPopup->go(); +} + +void SettingsBlockedMessagesFrame::hideSelectPopup() +{ + if (m_pSelectPopup) { + m_pSelectPopup->destroy(); + m_pSelectPopup = nullptr; + } +} + +void SettingsBlockedMessagesFrame::updateNoContent() +{ + int count = m_pList->getItemsCount(); + bool noContent = count <= 0; + if (noContent) { + prepareNoContent(); + m_pNoContent->setTitle(msgt("WDS_MSG_MBODY_BLOCKED_MESSAGES")); + m_pNoContent->setText(msgt("WDS_MSG_NPBODY_NO_BLOCKED_MESSAGES_ABB")); + } + + m_pLayout->showNoContent(noContent); + m_pLayout->showContent(!noContent); + m_pLayout->showMoreOption(!noContent); +} + +void SettingsBlockedMessagesFrame::deleteMessages(const std::vector &items) +{ + //TODO: impl. + updateNoContent(); +} + +void SettingsBlockedMessagesFrame::updateLangInfo() +{ + m_pList->updateRealizedItems(); + // TODO: update items +} + +void SettingsBlockedMessagesFrame::insertItem(ListItem *item) +{ + if(m_pBottomItem && m_pBottomItem != item) + m_pList->insertBeforeItem(*item, *m_pBottomItem); + else + m_pList->appendItem(*item); +} + +std::vector SettingsBlockedMessagesFrame::getSelectedItems() const +{ + auto items = m_pList->getItems(); + decltype(items) selectedItems; + + for(BlockedMsgListItem *item : items) { + if (item->getCheckedState()) + selectedItems.push_back(item); + } + return selectedItems; +} + +void SettingsBlockedMessagesFrame::checkHandler(ListItem &item) +{ + updateSelectViews(); +} + +void SettingsBlockedMessagesFrame::onAttached(ViewItem &item) +{ + FrameController::onAttached(item); + setContent(*m_pLayout); +} + +void SettingsBlockedMessagesFrame::onSelectAllButtonClicked(CtxPopupItem &item) +{ + MSG_LOG(""); + m_pList->checkAllItems(true); + updateSelectViews(); +} + +void SettingsBlockedMessagesFrame::onDeselectAllButtonClicked(CtxPopupItem &item) +{ + MSG_LOG(""); + m_pList->checkAllItems(false); + updateSelectViews(); +} + +void SettingsBlockedMessagesFrame::onRestoreClicked(MoreOption &obj) +{ + MSG_LOG(""); +} + +void SettingsBlockedMessagesFrame::onDeleteClicked(MoreOption &obj) +{ + MSG_LOG(""); + auto selectedItems = getSelectedItems(); + setSelectMode(false); + deleteMessages(selectedItems); +} + +void SettingsBlockedMessagesFrame::onDoneButtonClicked(Evas_Object *obj, void *event) +{ + MSG_LOG(""); + setSelectMode(false); +} + +void SettingsBlockedMessagesFrame::onSelectButtonClicked(Evas_Object *obj, void *event) +{ + MSG_LOG(""); + showSelectPopup(); +} + +void SettingsBlockedMessagesFrame::onListItemSelected(ListItem &listItem) +{ + MSG_LOG(""); + if (auto blockedMsgItem = dynamic_cast(&listItem)) { + auto frame = new SettingsBlockedMsgDetailFrame(getParent()); + getParent().push(*frame); + } +} + +void SettingsBlockedMessagesFrame::onListItemLongPressed(ListItem &listItem) +{ + MSG_LOG(""); + setSelectMode(true); + if (listItem.isCheckable()) { + listItem.setCheckedState(true, true); + checkHandler(listItem); + } +}; + +void SettingsBlockedMessagesFrame::onListItemChecked(ListItem &listItem) +{ + MSG_LOG(""); + checkHandler(listItem); +} + +void SettingsBlockedMessagesFrame::onTimeFormatChanged() +{ + MSG_LOG(""); +} + +void SettingsBlockedMessagesFrame::onLanguageChanged() +{ + MSG_LOG(""); + updateLangInfo(); +} + +void SettingsBlockedMessagesFrame::onHwBackButtonPreessed(Evas_Object *obj, void *event) +{ + MSG_LOG(""); + m_IsSelectMode ? setSelectMode(false) : pop(); +} + +void SettingsBlockedMessagesFrame::onSelectPopupDel(Evas *e, Evas_Object *obj, void *event_info) +{ + m_pSelectPopup = nullptr; +} + diff --git a/src/Settings/Controller/src/SettingsBlockedNumbersFrame.cpp b/src/Settings/Controller/src/SettingsBlockedNumbersFrame.cpp new file mode 100644 index 0000000..02ffaf3 --- /dev/null +++ b/src/Settings/Controller/src/SettingsBlockedNumbersFrame.cpp @@ -0,0 +1,339 @@ +/* + * Copyright 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include "SettingsBlockedNumbersFrame.h" +#include "MoreOption.h" +#include "BottomButton.h" +#include "DefaultLayout.h" +#include "TitleListItem.h" +#include "PaddingListViewItem.h" +#include "SelectButton.h" +#include "SelectCtxPopup.h" +#include "Logger.h" +#include "BlockedNumberListItem.h" +#include "NoContentLayout.h" +#include "App.h" +#include "NaviFrameController.h" +#include "PhoneNumberUtils.h" + +using namespace Msg; + +SettingsBlockedNumbersFrame::SettingsBlockedNumbersFrame(NaviFrameController &parent) + : FrameController(parent, SettingsGroup) + , m_IsSelectMode(false) + , m_pLayout(nullptr) + , m_pMoreOption(nullptr) + , m_pDelButton(nullptr) + , m_pSelectButton(nullptr) + , m_pList(nullptr) + , m_pBottomItem(nullptr) + , m_pNoContent(nullptr) + , m_pSelectPopup(nullptr) +{ + MSG_LOG(""); + prepareMainLayout(); + prepareMoreOption(); + preapareList(); + updateNoContent(); + App::getInst().getSysSettingsManager().addListener(*this); + App::getInst().getContactManager().addListener(*this); +} + +SettingsBlockedNumbersFrame::~SettingsBlockedNumbersFrame() +{ + hideSelectPopup(); + App::getInst().getSysSettingsManager().removeListener(*this); + App::getInst().getContactManager().removeListener(*this); +} + +void SettingsBlockedNumbersFrame::setSelectMode(bool value) +{ + if (value == m_IsSelectMode) + return; + + m_IsSelectMode = value; + m_pLayout->showBottomButton(value); + m_pLayout->showMoreOption(!value); + m_pList->setCheckMode(value); + m_pList->checkAllItems(false); + m_pList->updateRealizedItems(); + + if (value) { + prepareSelectViews(); + m_pSelectButton->setText("0"); + m_pSelectButton->showButton(true); + m_pDelButton->disabled(true); + } else { + if (m_pSelectButton) + m_pSelectButton->showButton(false); + } +} + +void SettingsBlockedNumbersFrame::prepareMainLayout() +{ + if (!m_pLayout) { + m_pLayout = new DefaultLayout(getParent()); + m_pLayout->showSelectButton(true); + m_pLayout->showMoreOption(true); + m_pLayout->addHwButtonEvent(EEXT_CALLBACK_BACK, makeCbFirst(&SettingsBlockedNumbersFrame::onHwBackButtonPreessed), this); + } +} + +void SettingsBlockedNumbersFrame::preapareList() +{ + if (!m_pList) { + m_pList = new ListView(getParent(), App::getInst().getWindow().getCircleSurface()); + m_pList->setHomogeneous(false); + m_pList->setMultiSelection(false); + m_pList->setListener(this); + m_pLayout->setContent(*m_pList); + fillList(); + } +} + +void SettingsBlockedNumbersFrame::prepareNoContent() +{ + if (!m_pNoContent) { + m_pNoContent = new NoContentLayout(*m_pLayout); + m_pNoContent->enableTitle(true); + + Evas_Object *img = elm_image_add(*m_pNoContent); + std::string imgPath = PathUtils::getResourcePath(IMAGES_EDJ_PATH); + elm_image_file_set(img, imgPath.c_str(), NO_SPAM_MSG_ICON); + + m_pNoContent->setIcon(img); + m_pLayout->setNoContent(*m_pNoContent); + } +} + +void SettingsBlockedNumbersFrame::fillList() +{ + // Title: + auto *titleItem = new TitleListItem; + titleItem->setTitle(msg("WDS_MSG_MBODY_BLOCKED_NUMBERS")); + m_pList->appendItem(*titleItem); + + // BlockedNumberListItem: + auto list = PhoneNumberUtils::getInst().getBlockedNumList(); + for (std::string &num : list) { + Recipient recip = Recipient::getByAddress(num); + auto *item = new BlockedNumberListItem(std::move(recip)); + insertItem(item); + } + + // Bottom padding: + m_pBottomItem = new PaddingListViewItem; + insertItem(m_pBottomItem); +} + +void SettingsBlockedNumbersFrame::prepareMoreOption() +{ + if (!m_pMoreOption) { + m_pMoreOption = new MoreOption(*m_pLayout); + m_pMoreOption->setDirection(EEXT_MORE_OPTION_DIRECTION_RIGHT); + m_pMoreOption->appendItem(msgt("WDS_MSG_OPT_DELETE_ABB"), DELETEG_MORE_ICON, makeCbLast(&SettingsBlockedNumbersFrame::onDeleteClicked), this); + m_pLayout->setMoreOption(*m_pMoreOption); + } +} + +void SettingsBlockedNumbersFrame::prepareSelectViews() +{ + if (!m_pDelButton) { + m_pDelButton = new BottomButton(*m_pLayout); + m_pDelButton->setText(msgt("IDS_MSG_ACBUTTON_DELETE_ABB")); + View::addSmartCb(m_pDelButton->getInnerButton(), "clicked", makeCbFirst(&SettingsBlockedNumbersFrame::onDeleteButtonClicked), this); + m_pLayout->setBottomButton(*m_pDelButton); + } + + if (!m_pSelectButton) { + m_pSelectButton = new SelectButton(*m_pLayout); + View::addSmartCb(m_pSelectButton->getInnerButton(), "clicked", makeCbFirst(&SettingsBlockedNumbersFrame::onSelectButtonClicked), this); + m_pLayout->setSelectButton(*m_pSelectButton); + } +} + +void SettingsBlockedNumbersFrame::updateSelectViews() +{ + if (m_IsSelectMode) { + int count = m_pList->getCheckedItemsCount(); + m_pSelectButton->setText(std::to_string(count)); + m_pDelButton->disabled(count <= 0); + } +} + +void SettingsBlockedNumbersFrame::showSelectPopup() +{ + m_pSelectPopup = new SelectCtxPopup; + m_pSelectPopup->addEventCb(EVAS_CALLBACK_DEL, makeCbFirst(&SettingsBlockedNumbersFrame::onSelectPopupDel), this); + int checkedCount = m_pList->getCheckedItemsCount(); + int checkableCount = m_pList->getCheckableItemsCount(); + + if (checkedCount < checkableCount) + m_pSelectPopup->appendTopItem(msgt("WDS_MSG_OPT_SELECT_ALL_ABB"), makeCbLast(&SettingsBlockedNumbersFrame::onSelectAllButtonClicked), this); + if (checkedCount > 0) + m_pSelectPopup->appendBottomItem(msgt("WDS_MSG_OPT_DESELECT_ALL_ABB"), makeCbLast(&SettingsBlockedNumbersFrame::onDeselectAllButtonClicked), this); + + if (m_pSelectButton) + m_pSelectPopup->align(m_pSelectButton->getInnerButton()); + + m_pSelectPopup->go(); +} + +void SettingsBlockedNumbersFrame::hideSelectPopup() +{ + if (m_pSelectPopup) { + m_pSelectPopup->destroy(); + m_pSelectPopup = nullptr; + } +} + +void SettingsBlockedNumbersFrame::updateNoContent() +{ + int count = m_pList->getItemsCount(); + bool noContent = count <= 0; + if (noContent) { + prepareNoContent(); + m_pNoContent->setTitle(msgt("WDS_MSG_MBODY_BLOCKED_NUMBERS")); + m_pNoContent->setText(msgt("WDS_MSG_NPBODY_NO_BLOCKED_NUMBERS_ABB")); + } + + m_pLayout->showNoContent(noContent); + m_pLayout->showContent(!noContent); + m_pLayout->showMoreOption(!noContent); +} + +void SettingsBlockedNumbersFrame::deleteNumbers(const std::vector &items) +{ + for (BlockedNumberListItem *item : items) { + if (PhoneNumberUtils::getInst().removeFromBlocked(item->getRecip().getAddress())) + item->destroy(); + } + updateNoContent(); +} + +void SettingsBlockedNumbersFrame::updateLangInfo() +{ + m_pList->updateRealizedItems(); +} + +void SettingsBlockedNumbersFrame::updateContactInfo() +{ + auto items = m_pList->getItems(); + for (BlockedNumberListItem *item : items) { + item->getRecip().updateContactInfo(); + } + m_pList->updateRealizedItems(); +} + +void SettingsBlockedNumbersFrame::insertItem(ListItem *item) +{ + if(m_pBottomItem && m_pBottomItem != item) + m_pList->insertBeforeItem(*item, *m_pBottomItem); + else + m_pList->appendItem(*item); +} + +void SettingsBlockedNumbersFrame::checkHandler(ListItem &item) +{ + updateSelectViews(); +} + +void SettingsBlockedNumbersFrame::onAttached(ViewItem &item) +{ + FrameController::onAttached(item); + setContent(*m_pLayout); +} + +void SettingsBlockedNumbersFrame::onSelectAllButtonClicked(CtxPopupItem &item) +{ + MSG_LOG(""); + m_pList->checkAllItems(true); + updateSelectViews(); +} + +void SettingsBlockedNumbersFrame::onDeselectAllButtonClicked(CtxPopupItem &item) +{ + MSG_LOG(""); + m_pList->checkAllItems(false); + updateSelectViews(); +} + +void SettingsBlockedNumbersFrame::onDeleteClicked(MoreOption &obj) +{ + MSG_LOG(""); + setSelectMode(true); +} + +void SettingsBlockedNumbersFrame::onDeleteButtonClicked(Evas_Object *obj, void *event) +{ + MSG_LOG(""); + auto items = m_pList->getItems(); + decltype(items) selectedItems; + + for(BlockedNumberListItem *item : items) { + if (item->getCheckedState()) + selectedItems.push_back(item); + } + + setSelectMode(false); + deleteNumbers(selectedItems); +} + +void SettingsBlockedNumbersFrame::onSelectButtonClicked(Evas_Object *obj, void *event) +{ + MSG_LOG(""); + showSelectPopup(); +} + +void SettingsBlockedNumbersFrame::onListItemLongPressed(ListItem &listItem) +{ + MSG_LOG(""); + setSelectMode(true); + if (listItem.isCheckable()) { + listItem.setCheckedState(true, true); + checkHandler(listItem); + } +}; + +void SettingsBlockedNumbersFrame::onListItemChecked(ListItem &listItem) +{ + MSG_LOG(""); + checkHandler(listItem); +} + +void SettingsBlockedNumbersFrame::onLanguageChanged() +{ + MSG_LOG(""); + updateLangInfo(); +} + +void SettingsBlockedNumbersFrame::onContactChanged() +{ + MSG_LOG(""); +} + +void SettingsBlockedNumbersFrame::onHwBackButtonPreessed(Evas_Object *obj, void *event) +{ + MSG_LOG(""); + m_IsSelectMode ? setSelectMode(false) : pop(); +} + +void SettingsBlockedNumbersFrame::onSelectPopupDel(Evas *e, Evas_Object *obj, void *event_info) +{ + m_pSelectPopup = nullptr; +} + diff --git a/src/Settings/Controller/src/SettingsMenuBlockListFrame.cpp b/src/Settings/Controller/src/SettingsMenuBlockListFrame.cpp index a082b69..4274051 100644 --- a/src/Settings/Controller/src/SettingsMenuBlockListFrame.cpp +++ b/src/Settings/Controller/src/SettingsMenuBlockListFrame.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include "SettingsBlockedMessagesFrame.h" #include "SettingsMenuBlockListFrame.h" #include "SettingsMenuListItem.h" #include "PaddingListViewItem.h" @@ -23,8 +24,8 @@ #include "ListView.h" #include "TitleListItem.h" #include "ListView.h" -#include "SettingsBlockListFrame.h" #include "NaviFrameController.h" +#include "SettingsBlockedNumbersFrame.h" using namespace Msg; @@ -84,14 +85,14 @@ void SettingsMenuBlockListFrame::fillList() void SettingsMenuBlockListFrame::onBlockedNumberSelected(ListItem &listItem) { MSG_LOG(""); - auto *frame = new SettingsBlockListFrame(getParent(), SettingsBlockListFrame::BlockedNumType); + auto *frame = new SettingsBlockedNumbersFrame(getParent()); getParent().push(*frame); } void SettingsMenuBlockListFrame::onBlockedMsgSelected(ListItem &listItem) { MSG_LOG(""); - auto *frame = new SettingsBlockListFrame(getParent(), SettingsBlockListFrame::BlockedMsgType); + auto *frame = new SettingsBlockedMessagesFrame(getParent()); getParent().push(*frame); } diff --git a/src/Settings/View/inc/BlockedNumberListViewItem.h b/src/Settings/View/inc/BlockedNumberListViewItem.h index 0d46be6..1db682c 100644 --- a/src/Settings/View/inc/BlockedNumberListViewItem.h +++ b/src/Settings/View/inc/BlockedNumberListViewItem.h @@ -25,20 +25,21 @@ namespace Msg { : public ListItem { public: - static ListItemStyleRef numberStyle; - static ListItemStyleRef contactNameStyle; + static const ListItemStyleRef numberStyle; + static const ListItemStyleRef contactNameStyle; public: BlockedNumberListViewItem(); virtual ~BlockedNumberListViewItem(); - protected: virtual std::string getAddress() = 0; virtual std::string getContactName() = 0; private: std::string getText(ListItem &item, const char *part) override; + const char *getCheckPart(ListItem &item) override; + bool isCheckable() const override; }; } diff --git a/src/Settings/View/src/BlockedNumberListViewItem.cpp b/src/Settings/View/src/BlockedNumberListViewItem.cpp index 21a3568..310946f 100644 --- a/src/Settings/View/src/BlockedNumberListViewItem.cpp +++ b/src/Settings/View/src/BlockedNumberListViewItem.cpp @@ -19,8 +19,8 @@ using namespace Msg; -ListItemStyleRef BlockedNumberListViewItem::numberStyle = ListItemStyle::create("1text"); -ListItemStyleRef BlockedNumberListViewItem::contactNameStyle = ListItemStyle::create("2text"); +const ListItemStyleRef BlockedNumberListViewItem::numberStyle = ListItemStyle::create("1text"); +const ListItemStyleRef BlockedNumberListViewItem::contactNameStyle = ListItemStyle::create("2text"); namespace { const char *numberTextPart = "elm.text"; @@ -46,3 +46,13 @@ std::string BlockedNumberListViewItem::getText(ListItem &item, const char *part) return ""; } + +const char *BlockedNumberListViewItem::getCheckPart(ListItem &item) +{ + return "elm.swallow.center_check"; +} + +bool BlockedNumberListViewItem::isCheckable() const +{ + return true; +}