From: Denis Dolzhenko Date: Thu, 27 Oct 2016 12:34:51 +0000 (+0300) Subject: TizenRefApp-7507 Refactor PopupManager to make translation of popup-message more... X-Git-Tag: submit/tizen/20161031.123956~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F09%2F94209%2F3;p=profile%2Fmobile%2Fapps%2Fnative%2Fmessage.git TizenRefApp-7507 Refactor PopupManager to make translation of popup-message more flexible Change-Id: Ia215381e677e4fd6d3904d15e52913bed1e6cf0e Signed-off-by: Denis Dolzhenko --- diff --git a/project_def.prop b/project_def.prop index 7866dfd0..8cc37d0c 100644 --- a/project_def.prop +++ b/project_def.prop @@ -9,13 +9,13 @@ type = app profile = mobile-3.0 # C/CPP Sources -USER_SRCS = src/Common/MsgEngine/src/MsgThreadItem.cpp src/Common/Utils/src/VCalendarParser.cpp src/Conversation/Body/View/src/BodyView.cpp src/Conversation/ConvList/Controller/src/ConvList.cpp src/MsgThread/Controller/src/MsgThread.cpp src/Common/Controller/src/SaveAttachmentsListItem.cpp src/Conversation/ConvList/Controller/src/BubbleCalEventEntity.cpp src/Conversation/Utils/src/MessageDetailContent.cpp src/Common/MsgEngine/src/private/MsgAddressPrivate.cpp src/MainApp/MainApp.cpp src/Common/MsgEngine/src/private/MsgReportPrivate.cpp src/Conversation/Utils/src/WorkingDir.cpp src/Common/View/src/ListItem.cpp src/MsgThread/Controller/src/BaseThreadListItem.cpp src/Viewer/Controller/src/SmilPlayer.cpp src/Common/MsgEngine/src/private/MsgTransportPrivate.cpp src/MsgThread/View/src/MsgThreadLayout.cpp src/Common/Controller/src/SaveAttachments.cpp src/Conversation/ContactList/Controller/src/ConvContactList.cpp src/Common/MsgEngine/src/Message.cpp src/Viewer/Utils/src/MediaPlayer.cpp src/Common/AppControl/src/AppControlDefault.cpp src/Common/View/src/ListView.cpp src/Settings/Controller/src/MsgOnSimCard.cpp src/Common/MsgEngine/src/MessageMms.cpp src/Conversation/Main/Controller/src/Conversation.cpp src/Common/MsgEngine/src/private/MsgConvMediaPrivate.cpp src/Common/MsgEngine/src/MsgTransport.cpp src/Viewer/View/src/SmilImageItemView.cpp src/Common/ContactManager/src/ContactRecord.cpp src/Conversation/ContactList/View/src/ConvContactListView.cpp src/MsgThread/Controller/src/ThreadSearchList.cpp src/MsgThread/View/src/MsgThreadSearchPanel.cpp src/Common/Utils/src/FileUtils.cpp src/Common/View/src/ContextPopup.cpp src/Common/MsgEngine/src/MessageSMS.cpp src/Conversation/ConvList/Controller/src/BubbleContactEntity.cpp src/Conversation/ContactList/View/src/ContactListViewItem.cpp src/Common/MsgEngine/src/private/MessagePrivate.cpp src/Conversation/ConvList/Controller/src/BubbleAudioEntity.cpp src/Common/View/src/MbeRecipientsView.cpp src/MsgThread/Controller/src/ThreadListItem.cpp src/Settings/View/src/SettingsGroupListViewItem.cpp src/Common/View/src/Popup.cpp src/Common/Controller/src/ViewItemController.cpp src/Settings/Controller/src/Settings.cpp src/Common/ContactManager/src/ContactVCardParser.cpp src/Viewer/Controller/src/Viewer.cpp src/Viewer/Controller/src/SmilPage.cpp src/Conversation/ConvList/Controller/src/BubbleUnknownFileEntity.cpp src/Common/Utils/src/HwButtonListener.cpp src/Common/AppControl/src/AppControlCompose.cpp src/Common/MsgEngine/src/MsgUtils.cpp src/Conversation/ConvList/View/src/BubbleTextViewItem.cpp src/Common/Utils/src/PhoneNumberUtils.cpp src/Common/MsgEngine/src/private/MessageSMSPrivate.cpp src/Conversation/ConvList/Controller/src/BubbleEntityFactory.cpp src/Viewer/View/src/SmilPageLayout.cpp src/Common/View/src/View.cpp src/Conversation/Main/Controller/src/PopupRecipientListItem.cpp src/Common/MsgEngine/src/private/MsgConversationItemPrivate.cpp src/Common/Controller/src/FrameController.cpp src/Conversation/ConvList/View/src/DateLineViewItem.cpp src/Common/AppControl/src/AppControlCommand.cpp src/Viewer/View/src/SmilTextItemView.cpp src/Settings/View/src/SimMsgLayout.cpp src/Common/MsgEngine/src/private/MsgThreadItemPrivate.cpp src/Common/MsgEngine/src/MsgEngine.cpp src/Viewer/View/src/PlayerControl.cpp src/Common/AppControl/src/AppControlParser.cpp src/Common/Controller/src/ViewController.cpp src/Conversation/ConvList/View/src/BubbleIconTextLayoutItem.cpp src/Common/View/src/NaviFrameView.cpp src/Common/AppControl/src/FileViewer.cpp src/Common/Utils/src/PathUtils.cpp src/Conversation/ConvList/Controller/src/ComposeListItem.cpp src/Conversation/ConvList/Controller/src/DateLineItem.cpp src/Conversation/ConvList/View/src/BubbleItemContainer.cpp src/Common/AppControl/src/VoiceCall.cpp src/Common/View/src/Scroller.cpp src/Conversation/ConvList/Controller/src/BubbleVideoEntity.cpp src/Common/MsgEngine/src/MsgSettings.cpp src/Conversation/ContactList/Controller/src/ContactListItem.cpp src/Common/ContactManager/src/ContactVCardGenerator.cpp src/Viewer/View/src/SmilAudioItemView.cpp src/Common/Utils/src/LoggerImpl.cpp src/Conversation/ConvList/View/src/ConvSelectAll.cpp src/Common/ContactManager/src/ContactManager.cpp src/Conversation/Utils/src/AttachmentHandler.cpp src/Conversation/ConvList/View/src/ComposeListViewItem.cpp src/Common/MsgEngine/src/private/MsgAttachmentPrivate.cpp src/Common/View/src/ViewItem.cpp src/Conversation/AppControl/src/ContactPicker.cpp src/Common/MsgEngine/src/private/MsgMediaPrivate.cpp src/Viewer/View/src/SubjectLayout.cpp src/Conversation/Main/View/src/MessageInputPanel.cpp src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp src/Common/Controller/src/BaseController.cpp src/Conversation/AppControl/src/AttachPanel.cpp src/Settings/Controller/src/SettingsSound.cpp src/Conversation/ConvList/View/src/ConvListViewItem.cpp src/Common/AppControl/src/Share.cpp src/Conversation/Body/Controller/src/Body.cpp src/Common/View/src/StandardWindow.cpp src/Common/MsgEngine/src/MsgConversationItem.cpp src/Common/MsgEngine/src/private/MessageMmsPrivate.cpp src/Viewer/View/src/SmilAttachmentItemView.cpp src/MsgThread/Controller/src/ThreadSearchListItem.cpp src/Common/View/src/DefaultLayout.cpp src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp src/Conversation/ConvList/View/src/BubbleVideoViewItem.cpp src/Common/View/src/PopupListItem.cpp src/Conversation/ConvList/View/src/BubbleViewItem.cpp src/Viewer/View/src/SmilVideoItemView.cpp src/Common/Controller/src/NaviFrameController.cpp src/MsgThread/Controller/src/ThreadList.cpp src/Common/Utils/src/TextDecorator.cpp src/Common/MsgEngine/src/MsgStorage.cpp src/Common/View/src/SelectAllListItem.cpp src/Conversation/ConvList/View/src/BubbleDownloadButtonViewItem.cpp src/Common/AppControl/src/ContactViewer.cpp src/Common/View/src/Box.cpp src/Common/Utils/src/ThumbnailMaker.cpp src/Common/View/src/NaviFrameItem.cpp src/Common/View/src/PopupList.cpp src/MsgThread/View/src/FloatingButton.cpp src/MsgThread/Controller/src/MsgSearchListItem.cpp src/Common/Controller/src/App.cpp src/Conversation/ConvList/View/src/ConvListLayout.cpp src/Common/View/src/PopupAttachmentListItem.cpp src/Common/MsgEngine/src/private/MsgComposerPrivate.cpp src/Viewer/View/src/ViewerLayout.cpp src/Common/Utils/src/MediaUtils.cpp src/Common/Controller/src/MbeRecipients.cpp src/Settings/Controller/src/SimListViewItem.cpp src/Common/Utils/src/TimeUtils.cpp src/Common/MsgEngine/src/private/MsgSettingsPrivate.cpp src/Viewer/View/src/SmilPlayerView.cpp src/MainApp/main.cpp src/Conversation/ConvList/View/src/BubbleImageViewItem.cpp src/Common/View/src/NoContentLayout.cpp src/Common/SystemSettingsManager/src/SystemSettingsManager.cpp src/Common/MsgEngine/src/MsgPage.cpp src/Common/AppControl/src/ContactEditor.cpp src/Conversation/Main/View/src/ConversationLayout.cpp src/Common/MsgEngine/src/private/MsgUtilsPrivate.cpp src/Common/View/src/PopupManager.cpp src/Settings/View/src/SettingsListViewItem.cpp src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp src/Conversation/ConvList/Controller/src/ConvListItem.cpp src/Conversation/ConvList/View/src/BubbleBgViewItem.cpp src/MsgThread/View/src/ThreadListViewItem.cpp src/Common/MsgEngine/src/private/MsgPagePrivate.cpp src/Common/AppControl/src/AppControlUtils.cpp src/Conversation/AppControl/src/LaunchSettings.cpp +USER_SRCS = src/Common/MsgEngine/src/MsgThreadItem.cpp src/Common/Utils/src/VCalendarParser.cpp src/Conversation/Body/View/src/BodyView.cpp src/Conversation/ConvList/Controller/src/ConvList.cpp src/MsgThread/Controller/src/MsgThread.cpp src/Common/Controller/src/SaveAttachmentsListItem.cpp src/Conversation/ConvList/Controller/src/BubbleCalEventEntity.cpp src/Conversation/Utils/src/MessageDetailContent.cpp src/Common/MsgEngine/src/private/MsgAddressPrivate.cpp src/MainApp/MainApp.cpp src/Common/MsgEngine/src/private/MsgReportPrivate.cpp src/Conversation/Utils/src/WorkingDir.cpp src/Common/View/src/ListItem.cpp src/MsgThread/Controller/src/BaseThreadListItem.cpp src/Viewer/Controller/src/SmilPlayer.cpp src/Common/MsgEngine/src/private/MsgTransportPrivate.cpp src/MsgThread/View/src/MsgThreadLayout.cpp src/Common/Controller/src/SaveAttachments.cpp src/Conversation/ContactList/Controller/src/ConvContactList.cpp src/Common/MsgEngine/src/Message.cpp src/Viewer/Utils/src/MediaPlayer.cpp src/Common/AppControl/src/AppControlDefault.cpp src/Common/View/src/ListView.cpp src/Settings/Controller/src/MsgOnSimCard.cpp src/Common/MsgEngine/src/MessageMms.cpp src/Conversation/Main/Controller/src/Conversation.cpp src/Common/MsgEngine/src/private/MsgConvMediaPrivate.cpp src/Common/MsgEngine/src/MsgTransport.cpp src/Viewer/View/src/SmilImageItemView.cpp src/Common/ContactManager/src/ContactRecord.cpp src/Conversation/ContactList/View/src/ConvContactListView.cpp src/MsgThread/Controller/src/ThreadSearchList.cpp src/MsgThread/View/src/MsgThreadSearchPanel.cpp src/Common/Utils/src/FileUtils.cpp src/Common/View/src/ContextPopup.cpp src/Common/MsgEngine/src/MessageSMS.cpp src/Conversation/ConvList/Controller/src/BubbleContactEntity.cpp src/Conversation/ContactList/View/src/ContactListViewItem.cpp src/Common/MsgEngine/src/private/MessagePrivate.cpp src/Conversation/ConvList/Controller/src/BubbleAudioEntity.cpp src/Common/View/src/MbeRecipientsView.cpp src/MsgThread/Controller/src/ThreadListItem.cpp src/Settings/View/src/SettingsGroupListViewItem.cpp src/Common/View/src/Popup.cpp src/Common/Controller/src/ViewItemController.cpp src/Settings/Controller/src/Settings.cpp src/Common/ContactManager/src/ContactVCardParser.cpp src/Viewer/Controller/src/Viewer.cpp src/Viewer/Controller/src/SmilPage.cpp src/Conversation/ConvList/Controller/src/BubbleUnknownFileEntity.cpp src/Common/Utils/src/HwButtonListener.cpp src/Common/AppControl/src/AppControlCompose.cpp src/Common/MsgEngine/src/MsgUtils.cpp src/Conversation/ConvList/View/src/BubbleTextViewItem.cpp src/Common/Utils/src/PhoneNumberUtils.cpp src/Common/MsgEngine/src/private/MessageSMSPrivate.cpp src/Conversation/ConvList/Controller/src/BubbleEntityFactory.cpp src/Viewer/View/src/SmilPageLayout.cpp src/Common/View/src/View.cpp src/Conversation/Main/Controller/src/PopupRecipientListItem.cpp src/Common/MsgEngine/src/private/MsgConversationItemPrivate.cpp src/Conversation/ConvList/Controller/src/MsgDetailsPopup.cpp src/Common/Controller/src/FrameController.cpp src/Conversation/ConvList/View/src/DateLineViewItem.cpp src/Common/AppControl/src/AppControlCommand.cpp src/Viewer/View/src/SmilTextItemView.cpp src/Settings/View/src/SimMsgLayout.cpp src/Common/MsgEngine/src/private/MsgThreadItemPrivate.cpp src/Common/MsgEngine/src/MsgEngine.cpp src/Viewer/View/src/PlayerControl.cpp src/Common/AppControl/src/AppControlParser.cpp src/Common/Controller/src/ViewController.cpp src/Conversation/ConvList/View/src/BubbleIconTextLayoutItem.cpp src/Common/View/src/NaviFrameView.cpp src/Common/AppControl/src/FileViewer.cpp src/Common/Utils/src/PathUtils.cpp src/Conversation/ConvList/Controller/src/ComposeListItem.cpp src/Conversation/ConvList/Controller/src/DateLineItem.cpp src/Conversation/ConvList/View/src/BubbleItemContainer.cpp src/Common/AppControl/src/VoiceCall.cpp src/Common/View/src/Scroller.cpp src/Conversation/ConvList/Controller/src/BubbleVideoEntity.cpp src/Common/MsgEngine/src/MsgSettings.cpp src/Conversation/ContactList/Controller/src/ContactListItem.cpp src/Common/ContactManager/src/ContactVCardGenerator.cpp src/Viewer/View/src/SmilAudioItemView.cpp src/Common/Utils/src/LoggerImpl.cpp src/Conversation/ConvList/View/src/ConvSelectAll.cpp src/Common/ContactManager/src/ContactManager.cpp src/Conversation/Utils/src/AttachmentHandler.cpp src/Conversation/ConvList/View/src/ComposeListViewItem.cpp src/Common/MsgEngine/src/private/MsgAttachmentPrivate.cpp src/Common/View/src/ViewItem.cpp src/Conversation/AppControl/src/ContactPicker.cpp src/Common/MsgEngine/src/private/MsgMediaPrivate.cpp src/Viewer/View/src/SubjectLayout.cpp src/Conversation/Main/View/src/MessageInputPanel.cpp src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp src/Common/Controller/src/BaseController.cpp src/Conversation/AppControl/src/AttachPanel.cpp src/Settings/Controller/src/SettingsSound.cpp src/Conversation/ConvList/View/src/ConvListViewItem.cpp src/Common/AppControl/src/Share.cpp src/Conversation/Body/Controller/src/Body.cpp src/Common/View/src/StandardWindow.cpp src/Common/MsgEngine/src/MsgConversationItem.cpp src/Common/MsgEngine/src/private/MessageMmsPrivate.cpp src/Viewer/View/src/SmilAttachmentItemView.cpp src/MsgThread/Controller/src/ThreadSearchListItem.cpp src/Common/View/src/DefaultLayout.cpp src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp src/Conversation/ConvList/View/src/BubbleVideoViewItem.cpp src/Common/View/src/PopupListItem.cpp src/Conversation/ConvList/View/src/BubbleViewItem.cpp src/Viewer/View/src/SmilVideoItemView.cpp src/Common/Controller/src/NaviFrameController.cpp src/MsgThread/Controller/src/ThreadList.cpp src/Common/Utils/src/TextDecorator.cpp src/Common/MsgEngine/src/MsgStorage.cpp src/Common/View/src/SelectAllListItem.cpp src/Conversation/ConvList/View/src/BubbleDownloadButtonViewItem.cpp src/Common/AppControl/src/ContactViewer.cpp src/Common/View/src/Box.cpp src/Common/Utils/src/ThumbnailMaker.cpp src/Common/View/src/NaviFrameItem.cpp src/Common/View/src/PopupList.cpp src/MsgThread/View/src/FloatingButton.cpp src/MsgThread/Controller/src/MsgSearchListItem.cpp src/Common/Controller/src/App.cpp src/Conversation/ConvList/View/src/ConvListLayout.cpp src/Common/View/src/PopupAttachmentListItem.cpp src/Common/MsgEngine/src/private/MsgComposerPrivate.cpp src/Viewer/View/src/ViewerLayout.cpp src/Common/Utils/src/MediaUtils.cpp src/Common/Controller/src/MbeRecipients.cpp src/Settings/Controller/src/SimListViewItem.cpp src/Common/Utils/src/TimeUtils.cpp src/Common/MsgEngine/src/private/MsgSettingsPrivate.cpp src/Viewer/View/src/SmilPlayerView.cpp src/MainApp/main.cpp src/Conversation/ConvList/View/src/BubbleImageViewItem.cpp src/Common/View/src/NoContentLayout.cpp src/Common/SystemSettingsManager/src/SystemSettingsManager.cpp src/Common/MsgEngine/src/MsgPage.cpp src/Common/AppControl/src/ContactEditor.cpp src/Conversation/Main/View/src/ConversationLayout.cpp src/Common/MsgEngine/src/private/MsgUtilsPrivate.cpp src/Common/View/src/PopupManager.cpp src/Settings/View/src/SettingsListViewItem.cpp src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp src/Conversation/ConvList/Controller/src/ConvListItem.cpp src/Conversation/ConvList/View/src/BubbleBgViewItem.cpp src/MsgThread/View/src/ThreadListViewItem.cpp src/Common/MsgEngine/src/private/MsgPagePrivate.cpp src/Common/AppControl/src/AppControlUtils.cpp src/Conversation/AppControl/src/LaunchSettings.cpp # EDC Sources USER_EDCS = # PO Sources -USER_POS = res/po/et.po res/po/eu.po res/po/kk.po res/po/it_IT.po res/po/ga.po res/po/lv.po res/po/de.po res/po/lt.po res/po/mk.po res/po/tr_TR.po res/po/hr.po res/po/pl.po res/po/es_ES.po res/po/uz.po res/po/ko_KR.po res/po/ja_JP.po res/po/en.po res/po/fr_CA.po res/po/en_PH.po res/po/cs.po res/po/ro.po res/po/zh_HK.po res/po/ar.po res/po/ka.po res/po/zh_CN.po res/po/gl.po res/po/hy.po res/po/es_US.po res/po/ru_RU.po res/po/el_GR.po res/po/pt_BR.po res/po/az.po res/po/en_US.po res/po/ca.po res/po/nl.po res/po/pt_PT.po res/po/hu.po res/po/is.po res/po/da.po res/po/bg.po res/po/fr.po res/po/sk.po res/po/sv.po res/po/nb.po res/po/sl.po res/po/zh_TW.po res/po/uk.po res/po/sr.po res/po/fi.po +USER_POS = res/po/et.po res/po/eu.po res/po/kk.po res/po/it_IT.po res/po/ga.po res/po/lv.po res/po/de.po res/po/lt.po res/po/mk.po res/po/tr_TR.po res/po/hr.po res/po/pl.po res/po/es_ES.po res/po/uz.po res/po/ko_KR.po res/po/ja_JP.po res/po/en.po res/po/fr_CA.po res/po/en_PH.po res/po/cs.po res/po/ro.po res/po/zh_HK.po res/po/ar.po res/po/ka.po res/po/zh_CN.po res/po/gl.po res/po/hy.po res/po/es_US.po res/po/ru_RU.po res/po/el_GR.po res/po/pt_BR.po res/po/az.po res/po/en_US.po res/po/ca.po res/po/nl.po res/po/pt_PT.po res/po/hu.po res/po/is.po res/po/da.po res/po/hi.po res/po/bg.po res/po/fr.po res/po/sk.po res/po/sv.po res/po/nb.po res/po/sl.po res/po/zh_TW.po res/po/uk.po res/po/sr.po res/po/fi.po # User Defines USER_DEFS = diff --git a/src/Common/View/inc/Popup.h b/src/Common/View/inc/Popup.h index c37013c2..27314123 100644 --- a/src/Common/View/inc/Popup.h +++ b/src/Common/View/inc/Popup.h @@ -53,6 +53,7 @@ namespace Msg Popup(PopupManager &parent); virtual ~Popup(); + void show(bool deferred = true); Evas_Object *getHostEvasObject() const; Evas_Object *setContent(Evas_Object *content); void setContent(const std::string &text); @@ -84,6 +85,7 @@ namespace Msg bool m_MoreKeyDismiss; bool m_PauseAppDismiss; PopupManager *m_pManager; + Ecore_Idler *m_pShowIdler; }; } diff --git a/src/Common/View/inc/PopupManager.h b/src/Common/View/inc/PopupManager.h index 9150df9d..aed53fb8 100644 --- a/src/Common/View/inc/PopupManager.h +++ b/src/Common/View/inc/PopupManager.h @@ -61,8 +61,8 @@ namespace Msg void reset(); /** - * @brief Destroys specified popup. - * @param[in] popup a popup to be destroyed. + * @brief Destroys previous popup and register new in manager + * @param[in] popup a new popup for register. */ void reset(Popup &popup); @@ -79,6 +79,14 @@ namespace Msg */ Popup &getPopup(); + /** + * @brief Creates specific popup. + * @param[in] variadic arguments + * @return popup created. + */ + template + ClassName &getPopup(Args&&... args); + /** * @brief Checks whether popup exists and it's visible. * @return true if popup exists and it's visible, false otherwise. @@ -122,6 +130,15 @@ namespace Msg ContextPopup *m_pCtxPopup; Window &m_Window; }; + + template + ClassName &PopupManager::getPopup(Args&&... args) + { + reset(); + m_pPopup = new ClassName(*this, std::forward(args)...); + eext_object_event_callback_add(*m_pPopup, EEXT_CALLBACK_BACK, SMART_CALLBACK(PopupManager, onHwBackButtonPopupClicked), this); + return static_cast(*m_pPopup); + } } #endif /* PopupManager_h_ */ diff --git a/src/Common/View/src/Popup.cpp b/src/Common/View/src/Popup.cpp index 4fc8e620..ea50fdaf 100644 --- a/src/Common/View/src/Popup.cpp +++ b/src/Common/View/src/Popup.cpp @@ -42,6 +42,7 @@ Popup::Popup(Evas_Object *parent) , m_MoreKeyDismiss(false) , m_PauseAppDismiss(false) , m_pManager(nullptr) + , m_pShowIdler(nullptr) { create(parent); } @@ -55,6 +56,11 @@ Popup::Popup(PopupManager &parent) Popup::~Popup() { MSG_LOG("Destructor"); + if(m_pShowIdler) + { + ecore_idler_del(m_pShowIdler); + m_pShowIdler = nullptr; + } } void Popup::create(Evas_Object *parent) @@ -186,6 +192,31 @@ void Popup::setTitle(const TText &title) setText(title, titlePart); } +void Popup::show(bool deferred) +{ + if(!deferred) + { + View::show(); + } + else + { + if(!m_pShowIdler) + { + m_pShowIdler = ecore_idler_add + ( + [](void *data)->Eina_Bool + { + auto *self =(Popup*)data; + self->m_pShowIdler = nullptr; + self->View::show(); + return false; // Delete idler + }, + this + ); + } + } +} + void Popup::on_button_clicked(void *data, Evas_Object *obj, void *event_info) { PopupButtonCb cb = (PopupButtonCb)evas_object_data_get(obj, buttonCbKey); diff --git a/src/Common/View/src/PopupManager.cpp b/src/Common/View/src/PopupManager.cpp index 075e5306..8b1fb461 100644 --- a/src/Common/View/src/PopupManager.cpp +++ b/src/Common/View/src/PopupManager.cpp @@ -52,9 +52,12 @@ void PopupManager::reset() void PopupManager::reset(Popup &popup) { - reset(); - eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, SMART_CALLBACK(PopupManager, onHwBackButtonPopupClicked), this); - m_pPopup = &popup; + if(&popup != m_pPopup) + { + reset(); + eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, SMART_CALLBACK(PopupManager, onHwBackButtonPopupClicked), this); + m_pPopup = &popup; + } } Popup &PopupManager::getPopup() diff --git a/src/Conversation/ConvList/Controller/inc/MsgDetailsPopup.h b/src/Conversation/ConvList/Controller/inc/MsgDetailsPopup.h new file mode 100644 index 00000000..f38f0084 --- /dev/null +++ b/src/Conversation/ConvList/Controller/inc/MsgDetailsPopup.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2009-2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 MsgDetailsPopup_h_ +#define MsgDetailsPopup_h_ + +#include "Popup.h" +#include "MsgTypes.h" +#include "App.h" +#include "ContactManager.h" +#include "SystemSettingsManager.h" + +namespace Msg +{ + class MsgDetailsPopup + : public Popup + , private IContactManagerListener + , private ISystemSettingsManager + { + public: + MsgDetailsPopup(PopupManager &mngr, App &app, MsgId msgId); + virtual ~MsgDetailsPopup(); + + private: + void updateContent(); + + // IContactManagerListener: + virtual void onContactChanged(); + + // ISystemSettingsManager: + virtual void onLanguageChanged(); + virtual void onTimeFormatChanged(); + + private: + App &m_App; + MsgId m_MsgId; + }; +} + +#endif /* MsgDetailsPopup_h_ */ diff --git a/src/Conversation/ConvList/Controller/src/ConvListItem.cpp b/src/Conversation/ConvList/Controller/src/ConvListItem.cpp index 8fb3b2e0..a7950516 100644 --- a/src/Conversation/ConvList/Controller/src/ConvListItem.cpp +++ b/src/Conversation/ConvList/Controller/src/ConvListItem.cpp @@ -27,6 +27,7 @@ #include "FileViewer.h" #include "BubbleItemContainer.h" #include "Share.h" +#include "MsgDetailsPopup.h" // Bubble items: #include "BubbleTextEntity.h" @@ -531,11 +532,7 @@ void ConvListItem::onCopyToSimCardItemPressed(PopupListItem &item) void ConvListItem::onViewDetailsItemPressed(PopupListItem &item) { MSG_LOG(""); - Popup &popup = m_App.getPopupManager().getPopup(); - popup.addButton(msgt("IDS_MSG_BUTTON_OK_ABB"), Popup::CancelButtonId, POPUP_BUTTON_CB(ConvListItem, onCancelButtonClicked), this); - popup.setTitle(msgt("IDS_MSGF_HEADER_MESSAGE_DETAILS")); - popup.setContent(MessageDetailContent::getMsgDetailsPopupContent(m_App, m_MsgId)); - popup.show(); + m_App.getPopupManager().getPopup(m_App, m_MsgId).show(); } void ConvListItem::onEditButtonClicked(Evas_Object *obj, void *event_info) diff --git a/src/Conversation/ConvList/Controller/src/MsgDetailsPopup.cpp b/src/Conversation/ConvList/Controller/src/MsgDetailsPopup.cpp new file mode 100644 index 00000000..d93f2474 --- /dev/null +++ b/src/Conversation/ConvList/Controller/src/MsgDetailsPopup.cpp @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2009-2016 Samsung Electronics Co., Ltd All Rights contenterved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 expcontents or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "MsgDetailsPopup.h" +#include "MessageDetailContent.h" +#include "LangUtils.h" +#include "Logger.h" + +using namespace Msg; +using namespace MessageDetailContent; + +MsgDetailsPopup::MsgDetailsPopup(PopupManager &mngr, App &app, MsgId msgId) + : Popup(mngr) + , m_App(app) + , m_MsgId(msgId) +{ + m_App.getSysSettingsManager().addListener(*this); + m_App.getContactManager().addListener(*this); + addButton(msgt("IDS_MSG_BUTTON_OK_ABB"), Popup::OkButtonId); + setTitle(msgt("IDS_MSGF_HEADER_MESSAGE_DETAILS")); + updateContent(); +} + +MsgDetailsPopup::~MsgDetailsPopup() +{ + m_App.getSysSettingsManager().removeListener(*this); + m_App.getContactManager().removeListener(*this); +} + +void MsgDetailsPopup::updateContent() +{ + static const std::string brTag = "

"; + + std::string content; + MsgStorage &msgStorage = m_App.getMsgEngine().getStorage(); + Message::Direction msgDirection = msgStorage.getMessage(m_MsgId)->getDirection(); + Message::Type msgType = msgStorage.getMessage(m_MsgId)->getType(); + Message::NetworkStatus msgStatus = msgStorage.getMessage(m_MsgId)->getNetworkStatus(); + ThreadId msgThreadId = msgStorage.getMessage(m_MsgId)->getThreadId(); + + content += getMessageType(msgType); + content += getContactsInfo(m_App, msgDirection, msgThreadId); + content += getSentReceivedTime(msgStorage, msgDirection, m_MsgId); + + if(msgDirection == Message::MD_Sent && msgType == Message::MT_SMS) + { + content += brTag; + content += makeDeliveryReportResult(m_App, msgStatus, msgType, msgThreadId, m_MsgId); + content += getSmsStatus(msgStatus); + } + else if(msgType == Message::MT_MMS_Noti) + { + content += brTag; + content += getMmsSubject(m_App, m_MsgId, ViewDetailsTextStyle); + content += getMmsMessageSize(m_App, m_MsgId, ViewDetailsTextStyle); + content += getMmsMessageExpired(m_App, m_MsgId, ViewDetailsTextStyle); + } + else if(msgType == Message::MT_MMS) + { + content += brTag; + content += getMmsSubject(m_App, m_MsgId, ViewDetailsTextStyle); + content += getMmsMessageSize(m_App, m_MsgId, ViewDetailsTextStyle); + + if(msgDirection == Message::MD_Sent) + { + content += brTag; + content += makeDeliveryReportResult(m_App, msgStatus, msgType, msgThreadId, m_MsgId); + content += makeReadReportResult(m_App, m_MsgId, msgThreadId, msgStatus); + } + } + + setContent(content); +} + +void MsgDetailsPopup::onContactChanged() +{ + MSG_LOG(""); + updateContent(); +} + +void MsgDetailsPopup::onLanguageChanged() +{ + MSG_LOG(""); + updateContent(); +} + +void MsgDetailsPopup::onTimeFormatChanged() +{ + MSG_LOG(""); + updateContent(); +} + diff --git a/src/Conversation/Utils/inc/MessageDetailContent.h b/src/Conversation/Utils/inc/MessageDetailContent.h index dbf5e2f0..b470acf3 100644 --- a/src/Conversation/Utils/inc/MessageDetailContent.h +++ b/src/Conversation/Utils/inc/MessageDetailContent.h @@ -23,7 +23,7 @@ namespace Msg { - class MessageDetailContent + namespace MessageDetailContent { enum TextStyle { @@ -31,27 +31,20 @@ namespace Msg DownloadTextStyle }; - public: - static std::string getMsgDetailsPopupContent(App &app, MsgId msgId); - static std::string getMmsNotiConvListItemContent(App &app, MsgId msgId); - - private: - // Create Content of Popup for View Details - static std::string createMsgDetailsPopupText(App &app, MsgId msgId); - static std::string getMessageType(Message::Type msgType); - static std::string getContactsInfo(App &app, Message::Direction m_Direction, ThreadId msgThreadId); - static std::string getSentReceivedTime(MsgStorage &msgStorage, Message::Direction msgDirection, MsgId msgId); - static std::string makeDeliveryReportResult(App &app, Message::NetworkStatus msgStatus, Message::Type msgType, ThreadId msgThreadId, MsgId msgId); - static std::string getSubscriberNumber(); - static std::string getSmsStatus(Message::NetworkStatus msgStatus); - static std::string getMmsSubject(App &app, MsgId msgId, int style); - static std::string getMmsMessageSize(App &app, MsgId msgId, int style); - static std::string getMmsMessageExpired(App &app, MsgId msgId, int style); - static std::string makeReadReportResult(App &app, MsgId msgId, ThreadId msgThreadId, Message::NetworkStatus msgStatus); - static std::string makeDispAddress(App &app, const std::string &address); - static std::string makeMainText(const std::string &text); - static std::string makeSecondText(const std::string &text); - + // TODO: Ineffective get methods by MsgId + std::string getMmsNotiConvListItemContent(App &app, MsgId msgId); + std::string getMessageType(Message::Type msgType); + std::string getContactsInfo(App &app, Message::Direction m_Direction, ThreadId msgThreadId); + std::string getSentReceivedTime(MsgStorage &msgStorage, Message::Direction msgDirection, MsgId msgId); + std::string makeDeliveryReportResult(App &app, Message::NetworkStatus msgStatus, Message::Type msgType, ThreadId msgThreadId, MsgId msgId); + std::string getSmsStatus(Message::NetworkStatus msgStatus); + std::string getMmsSubject(App &app, MsgId msgId, int style); + std::string getMmsMessageSize(App &app, MsgId msgId, int style); + std::string getMmsMessageExpired(App &app, MsgId msgId, int style); + std::string makeReadReportResult(App &app, MsgId msgId, ThreadId msgThreadId, Message::NetworkStatus msgStatus); + std::string makeDispAddress(App &app, const std::string &address); + std::string makeMainText(const std::string &text); + std::string makeSecondText(const std::string &text); }; } diff --git a/src/Conversation/Utils/src/MessageDetailContent.cpp b/src/Conversation/Utils/src/MessageDetailContent.cpp index 0ef55c16..50586933 100644 --- a/src/Conversation/Utils/src/MessageDetailContent.cpp +++ b/src/Conversation/Utils/src/MessageDetailContent.cpp @@ -26,7 +26,10 @@ #include #include -using namespace Msg; +namespace Msg +{ +namespace MessageDetailContent +{ namespace { @@ -35,54 +38,7 @@ namespace const unsigned int secondTextSize = 32; } -std::string MessageDetailContent::getMsgDetailsPopupContent(App &app, MsgId msgId) -{ - return createMsgDetailsPopupText(app, msgId); -} - -std::string MessageDetailContent::createMsgDetailsPopupText(App &app, MsgId msgId) -{ - std::string msgDetails; - Message::Direction msgDirection = app.getMsgEngine().getStorage().getMessage(msgId)->getDirection(); - Message::Type msgType = app.getMsgEngine().getStorage().getMessage(msgId)->getType(); - Message::NetworkStatus msgStatus = app.getMsgEngine().getStorage().getMessage(msgId)->getNetworkStatus(); - ThreadId msgThreadId = app.getMsgEngine().getStorage().getMessage(msgId)->getThreadId(); - MsgStorage &msgStorage = app.getMsgEngine().getStorage(); - - msgDetails += getMessageType(msgType); - msgDetails += getContactsInfo(app, msgDirection, msgThreadId); - msgDetails += getSentReceivedTime(msgStorage, msgDirection, msgId); - - if(msgDirection == Message::MD_Sent && msgType == Message::MT_SMS) - { - msgDetails.append("

"); - msgDetails += makeDeliveryReportResult(app, msgStatus, msgType, msgThreadId, msgId); - msgDetails += getSmsStatus(msgStatus); - } - else if(msgType == Message::MT_MMS_Noti) - { - msgDetails.append("

"); - msgDetails += getMmsSubject(app, msgId, ViewDetailsTextStyle); - msgDetails += getMmsMessageSize(app, msgId, ViewDetailsTextStyle); - msgDetails += getMmsMessageExpired(app, msgId, ViewDetailsTextStyle); - } - else if(msgType == Message::MT_MMS) - { - msgDetails.append("

"); - msgDetails += getMmsSubject(app, msgId, ViewDetailsTextStyle); - msgDetails += getMmsMessageSize(app, msgId, ViewDetailsTextStyle); - - if(msgDirection == Message::MD_Sent) - { - msgDetails.append("

"); - msgDetails += makeDeliveryReportResult(app, msgStatus, msgType, msgThreadId, msgId); - msgDetails += makeReadReportResult(app, msgId, msgThreadId, msgStatus); - } - } - return msgDetails; -} - -std::string MessageDetailContent::getMmsNotiConvListItemContent(App &app, MsgId msgId) +std::string getMmsNotiConvListItemContent(App &app, MsgId msgId) { std::string msgDetails; msgDetails += getMmsSubject(app, msgId, DownloadTextStyle); @@ -91,7 +47,7 @@ std::string MessageDetailContent::getMmsNotiConvListItemContent(App &app, MsgId return msgDetails; } -std::string MessageDetailContent::getMessageType(Message::Type msgType) +std::string getMessageType(Message::Type msgType) { std::string msgDetails = makeMainText(msg("IDS_MSG_POP_TYPE")); msgDetails.append("
"); @@ -114,7 +70,7 @@ std::string MessageDetailContent::getMessageType(Message::Type msgType) return msgDetails; } -std::string MessageDetailContent::getContactsInfo(App &app, Message::Direction msgDirection, ThreadId msgThreadId) +std::string getContactsInfo(App &app, Message::Direction msgDirection, ThreadId msgThreadId) { MsgAddressListRef addrList = app.getMsgEngine().getStorage().getAddressList(msgThreadId); @@ -144,7 +100,7 @@ std::string MessageDetailContent::getContactsInfo(App &app, Message::Direction m return contactsInfo; } -std::string MessageDetailContent::getSentReceivedTime(MsgStorage &msgStorage, Message::Direction msgDirection, MsgId msgId) +std::string getSentReceivedTime(MsgStorage &msgStorage, Message::Direction msgDirection, MsgId msgId) { std::string msgDetails; if(msgDirection == Message::MD_Sent) @@ -158,7 +114,7 @@ std::string MessageDetailContent::getSentReceivedTime(MsgStorage &msgStorage, Me return msgDetails; } -std::string MessageDetailContent::makeDeliveryReportResult(App &app, Message::NetworkStatus msgStatus, Message::Type msgType, ThreadId msgThreadId, MsgId msgId) +std::string makeDeliveryReportResult(App &app, Message::NetworkStatus msgStatus, Message::Type msgType, ThreadId msgThreadId, MsgId msgId) { std::string deliverText = makeMainText(msg("IDS_MSGF_BODY_DELIVERY_REPORT")); @@ -225,32 +181,7 @@ std::string MessageDetailContent::makeDeliveryReportResult(App &app, Message::Ne return deliverText; } -std::string MessageDetailContent::getSubscriberNumber() -{ - std::string subscriberNumber; - telephony_handle_list_s telHandleList; - int err = telephony_init(&telHandleList); - - if(err == TELEPHONY_ERROR_NONE) - { - if(telHandleList.count != 0) - { - char *tmpSubscriberNumber = nullptr; - telephony_sim_get_subscriber_number(telHandleList.handle[0], &tmpSubscriberNumber); - if(tmpSubscriberNumber) - { - subscriberNumber = tmpSubscriberNumber; - free(tmpSubscriberNumber); - } - } - telephony_deinit(&telHandleList); - } - - return !subscriberNumber.empty() ? subscriberNumber : msg("IDS_MSGF_BODY_UNKNOWN"); - -} - -std::string MessageDetailContent::getSmsStatus(Message::NetworkStatus msgStatus) +std::string getSmsStatus(Message::NetworkStatus msgStatus) { std::string status = makeMainText(msg("IDS_MSG_BODY_STATUS_C")); status.append("
"); @@ -279,7 +210,7 @@ std::string MessageDetailContent::getSmsStatus(Message::NetworkStatus msgStatus) return status; } -std::string MessageDetailContent::getMmsSubject(App &app, MsgId msgId, int style) +std::string getMmsSubject(App &app, MsgId msgId, int style) { std::string msgDetails; std::string subject = app.getMsgEngine().getStorage().getMessage(msgId)->getSubject(); @@ -310,7 +241,7 @@ std::string MessageDetailContent::getMmsSubject(App &app, MsgId msgId, int style return msgDetails; } -std::string MessageDetailContent::getMmsMessageSize(App &app, MsgId msgId, int style) +std::string getMmsMessageSize(App &app, MsgId msgId, int style) { std::string msgDetails; int msgSize = app.getMsgEngine().getStorage().getMessage(msgId)->getSize(); @@ -336,7 +267,7 @@ std::string MessageDetailContent::getMmsMessageSize(App &app, MsgId msgId, int s return msgDetails; } -std::string MessageDetailContent::getMmsMessageExpired(App &app, MsgId msgId, int style) +std::string getMmsMessageExpired(App &app, MsgId msgId, int style) { std::string msgDetails; MessageMmsRef mms = std::dynamic_pointer_cast(app.getMsgEngine().getStorage().getMessage(msgId)); @@ -370,7 +301,7 @@ std::string MessageDetailContent::getMmsMessageExpired(App &app, MsgId msgId, in return msgDetails; } -std::string MessageDetailContent::makeReadReportResult(App &app, MsgId msgId, ThreadId msgThreadId, Message::NetworkStatus msgStatus) +std::string makeReadReportResult(App &app, MsgId msgId, ThreadId msgThreadId, Message::NetworkStatus msgStatus) { std::string readReport = makeMainText(msg("IDS_MSGF_POP_READ_REPORT")); bool readFlag = app.getMsgEngine().getStorage().isReadReportChecked(msgId); @@ -432,7 +363,7 @@ std::string MessageDetailContent::makeReadReportResult(App &app, MsgId msgId, Th return readReport; } -std::string MessageDetailContent::makeDispAddress(App &app, const std::string &address) +std::string makeDispAddress(App &app, const std::string &address) { std::string res; ContactAddressRef rec = app.getContactManager().getContactAddress(address); @@ -456,12 +387,15 @@ std::string MessageDetailContent::makeDispAddress(App &app, const std::string &a return res; } -std::string MessageDetailContent::makeMainText(const std::string &text) +std::string makeMainText(const std::string &text) { return TextDecorator::make(text, mainTextSize); } -std::string MessageDetailContent::makeSecondText(const std::string &text) +std::string makeSecondText(const std::string &text) { return TextDecorator::make(text, secondTextSize, secondTextColor); } + +} // namespace MessageDetailContent +} // namespace Msg