diff options
author | Denis Dolzhenko <d.dolzhenko@samsung.com> | 2017-05-25 15:17:30 +0300 |
---|---|---|
committer | Denis Dolzhenko <d.dolzhenko@samsung.com> | 2017-05-25 16:12:50 +0300 |
commit | eae58f8ea25be502105e5f9e5419c386f5e4d449 (patch) | |
tree | c11ba4f309cb4194fb239add7f61fc738d10466d | |
parent | bd448dc025a5721b2422d6dcf4715bc1d7defe3b (diff) | |
download | message-eae58f8ea25be502105e5f9e5419c386f5e4d449.tar.gz message-eae58f8ea25be502105e5f9e5419c386f5e4d449.tar.bz2 message-eae58f8ea25be502105e5f9e5419c386f5e4d449.zip |
TizenRefApp-8557 Multi-language support
Change-Id: I979d11a2d2471e4c9a09213100304227a71389ae
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
-rw-r--r-- | src/Composer/Controller/src/MsgBodyFrame.cpp | 2 | ||||
-rw-r--r-- | src/Conversation/Controller/inc/ConvList.h | 11 | ||||
-rw-r--r-- | src/Conversation/Controller/inc/ConvListItem.h | 1 | ||||
-rw-r--r-- | src/Conversation/Controller/src/ConvList.cpp | 47 | ||||
-rw-r--r-- | src/Conversation/Controller/src/ConvListItem.cpp | 5 | ||||
-rw-r--r-- | src/Conversation/View/inc/ConvDateLineListItem.h | 12 | ||||
-rw-r--r-- | src/Conversation/View/inc/ConvReplyListItem.h | 4 | ||||
-rw-r--r-- | src/Conversation/View/src/ConvDateLineListItem.cpp | 27 | ||||
-rw-r--r-- | src/Conversation/View/src/ConvReplyListItem.cpp | 10 | ||||
-rw-r--r-- | src/MsgThread/Controller/inc/ThreadList.h | 2 | ||||
-rw-r--r-- | src/MsgThread/Controller/inc/ThreadListItem.h | 1 | ||||
-rw-r--r-- | src/MsgThread/Controller/src/ThreadList.cpp | 7 | ||||
-rw-r--r-- | src/MsgThread/Controller/src/ThreadListItem.cpp | 5 | ||||
-rw-r--r-- | src/Settings/Controller/inc/SettingsBlockListFrame.h | 9 | ||||
-rw-r--r-- | src/Settings/Controller/src/SettingsBlockListFrame.cpp | 19 |
15 files changed, 129 insertions, 33 deletions
diff --git a/src/Composer/Controller/src/MsgBodyFrame.cpp b/src/Composer/Controller/src/MsgBodyFrame.cpp index 450b0c6..e21b7d3 100644 --- a/src/Composer/Controller/src/MsgBodyFrame.cpp +++ b/src/Composer/Controller/src/MsgBodyFrame.cpp @@ -242,7 +242,7 @@ void MsgBodyFrame::requestSendMessage() m_SendInfo.reset(); m_SendInfo.msgs = createMessage(); - if (m_SendInfo.msgs .empty()) + if (m_SendInfo.msgs.empty()) return; if (!checkBeforeSend(m_SendInfo.msgs [0]->getType())) diff --git a/src/Conversation/Controller/inc/ConvList.h b/src/Conversation/Controller/inc/ConvList.h index 30e359b..9fd840c 100644 --- a/src/Conversation/Controller/inc/ConvList.h +++ b/src/Conversation/Controller/inc/ConvList.h @@ -26,6 +26,7 @@ #include "Recipient.h" #include "DefaultLayout.h" #include "ContactManager.h" +#include "SystemSettingsManager.h" #include <unordered_map> #include <unordered_set> @@ -42,7 +43,8 @@ namespace Msg { : public ListView , private IListViewListener , private IMsgStorageListener - , private IContactManagerListener { + , private IContactManagerListener + , private ISystemSettingsManager { public: ConvList(DefaultLayout *parent, WorkingDirRef &workingDir); @@ -74,8 +76,14 @@ namespace Msg { // IContactManagerListener: void onContactChanged() override; + // ISystemSettingsManager: + void onTimeFormatChanged() override; + void onLanguageChanged() override; + void fillList(); void updateTitle(); + void updateLangInfo(); + void updateDateLineItems(bool updateUi); MsgStorage &getMsgStorage(); void delDateLineIfNeeded(ConvListItem &item); void addDateLineIfNeeded(ConvListItem &item); @@ -101,7 +109,6 @@ namespace Msg { BubbleEntityFactory m_BubbleEntityFactory; ConvListItemMap m_ConvListItemMap; DateLineItemSet m_DateLineItemSet; - DefaultLayout *m_pParentLayout; }; class IConvListListener { diff --git a/src/Conversation/Controller/inc/ConvListItem.h b/src/Conversation/Controller/inc/ConvListItem.h index b458d52..e04db94 100644 --- a/src/Conversation/Controller/inc/ConvListItem.h +++ b/src/Conversation/Controller/inc/ConvListItem.h @@ -46,6 +46,7 @@ namespace Msg { MsgId getMsgId() const; time_t getRawTime() const; void updateStatus(); + void updateLangInfo(); void updateTime(); protected: diff --git a/src/Conversation/Controller/src/ConvList.cpp b/src/Conversation/Controller/src/ConvList.cpp index 201bf18..abb637a 100644 --- a/src/Conversation/Controller/src/ConvList.cpp +++ b/src/Conversation/Controller/src/ConvList.cpp @@ -23,11 +23,11 @@ #include "PaddingListViewItem.h" #include "TitleListItem.h" #include "ConvDateLineListItem.h" -#include "TimeUtils.h" #include "BubbleEntityFactory.h" #include "MsgUtils.h" #include "ContactManager.h" #include "Recipient.h" +#include "TimeUtils.h" using namespace Msg; @@ -41,11 +41,11 @@ ConvList::ConvList(DefaultLayout *parent, WorkingDirRef &workingDir) , m_pTitleItem(nullptr) , m_WorkingDir(workingDir) , m_BubbleEntityFactory(m_WorkingDir) - , m_pParentLayout(parent) { ListView::setListener(this); getMsgStorage().addListener(*this); App::getInst().getContactManager().addListener(*this); + App::getInst().getSysSettingsManager().addListener(*this); ListView::setHomogeneous(false); ListView::setMultiSelection(false); ListView::enabledAlign(false); @@ -55,6 +55,7 @@ ConvList::~ConvList() { getMsgStorage().removeListener(*this); App::getInst().getContactManager().removeListener(*this); + App::getInst().getSysSettingsManager().removeListener(*this); } void ConvList::setDeleteMode(bool value) @@ -119,6 +120,33 @@ void ConvList::updateTitle() m_pTitleItem->update(); } +void ConvList::updateLangInfo() +{ + // Update ConvListItem: + auto convItems = getItems<ConvListItem>(); + for (ConvListItem *item : convItems) + item->updateLangInfo(); + + // Update ConvDateLineListItem: + updateDateLineItems(false); + + // Update view: + ListView::updateRealizedItems(); +} + +void ConvList::updateDateLineItems(bool updateUi) +{ + m_DateLineItemSet.clear(); + auto items = getItems<ConvDateLineListItem>(); + for (ConvDateLineListItem *item : items) { + item->update(); + m_DateLineItemSet.insert(item->getDateTimeStr()); + } + + if (updateUi) + ListView::updateRealizedItems(); +} + void ConvList::clear() { ListView::clear(); @@ -227,7 +255,7 @@ void ConvList::delDateLineIfNeeded(ConvListItem &item) auto *nextItem = ListView::getNextItem(item); bool needDelDateLine = nextItem ? dynamic_cast<ConvListItem*>(nextItem) == nullptr : true; if (needDelDateLine) { - m_DateLineItemSet.erase(prev->getDateLine()); + m_DateLineItemSet.erase(prev->getDateTimeStr()); ListView::deleteItem(*prev); } } @@ -239,7 +267,7 @@ void ConvList::addDateLineIfNeeded(ConvListItem &item) auto it = m_DateLineItemSet.find(dateStr); if (it == m_DateLineItemSet.end()) { m_DateLineItemSet.insert(dateStr); - auto *dateLine = new ConvDateLineListItem(std::move(dateStr)); + auto *dateLine = new ConvDateLineListItem(item.getRawTime(), std::move(dateStr)); if (m_pItemAfterConv) ListView::insertBeforeItem(*dateLine, *m_pItemAfterConv); else @@ -342,3 +370,14 @@ void ConvList::onContactChanged() m_Recip.updateContactInfo(); updateTitle(); } + +void ConvList::onTimeFormatChanged() +{ + MSG_LOG(""); +} + +void ConvList::onLanguageChanged() +{ + MSG_LOG(""); + updateLangInfo(); +} diff --git a/src/Conversation/Controller/src/ConvListItem.cpp b/src/Conversation/Controller/src/ConvListItem.cpp index e2b11d1..c6f28a9 100644 --- a/src/Conversation/Controller/src/ConvListItem.cpp +++ b/src/Conversation/Controller/src/ConvListItem.cpp @@ -105,6 +105,11 @@ void ConvListItem::updateTime() m_TimeStr.clear(); } +void ConvListItem::updateLangInfo() +{ + updateTime(); +} + void ConvListItem::showMobileDataOffPopup() { ToastPopup::toast(msgt("WDS_MSG_TPOP_UNABLE_TO_RETRIEVE_MESSAGE_MOBILE_DATA_OFF_ABB"), nullptr); diff --git a/src/Conversation/View/inc/ConvDateLineListItem.h b/src/Conversation/View/inc/ConvDateLineListItem.h index e652c39..4b83bbe 100644 --- a/src/Conversation/View/inc/ConvDateLineListItem.h +++ b/src/Conversation/View/inc/ConvDateLineListItem.h @@ -23,19 +23,19 @@ namespace Msg { class ConvDateLineListItem : public ListItem { public: - ConvDateLineListItem(std::string dateLine); + ConvDateLineListItem(time_t dateTime); + ConvDateLineListItem(time_t dateTime, std::string dateTimeStr); virtual ~ConvDateLineListItem(); - const std::string &getDateLine() const; - - protected: - void setDateLine(std::string dateLine); + void update(); + const std::string &getDateTimeStr() const; private: virtual std::string getText(ListItem &item, const char *part); private: - std::string m_DateLine; + time_t m_DateTime; + std::string m_DateTimeStr; }; } diff --git a/src/Conversation/View/inc/ConvReplyListItem.h b/src/Conversation/View/inc/ConvReplyListItem.h index d267b88..5e04889 100644 --- a/src/Conversation/View/inc/ConvReplyListItem.h +++ b/src/Conversation/View/inc/ConvReplyListItem.h @@ -30,13 +30,11 @@ namespace Msg { void onAttached(ViewItem &item) override; private: + std::string getReplayText() const; std::string getText(ListItem &item, const char *part) override; Evas_Object *getContent(ListItem &item, const char *part) override; Evas_Object *getReplyButton(); - - private: - std::string m_ReplyText; }; } diff --git a/src/Conversation/View/src/ConvDateLineListItem.cpp b/src/Conversation/View/src/ConvDateLineListItem.cpp index 2ff8472..e78c3a4 100644 --- a/src/Conversation/View/src/ConvDateLineListItem.cpp +++ b/src/Conversation/View/src/ConvDateLineListItem.cpp @@ -15,6 +15,7 @@ */ #include "ConvDateLineListItem.h" +#include "TimeUtils.h" #include "ListView.h" using namespace Msg; @@ -23,9 +24,17 @@ namespace { const char *datePart = "elm.text"; } -ConvDateLineListItem::ConvDateLineListItem(std::string dateLine) +ConvDateLineListItem::ConvDateLineListItem(time_t dateTime) : ListItem(ListItemStyle::create("dateline")) - , m_DateLine(std::move(dateLine)) + , m_DateTime(dateTime) +{ + update(); +} + +ConvDateLineListItem::ConvDateLineListItem(time_t dateTime, std::string dateTimeStr) + : ListItem(ListItemStyle::create("dateline")) + , m_DateTime(dateTime) + , m_DateTimeStr(std::move(dateTimeStr)) { } @@ -33,20 +42,20 @@ ConvDateLineListItem::~ConvDateLineListItem() { } -const std::string &ConvDateLineListItem::getDateLine() const +void ConvDateLineListItem::update() { - return m_DateLine; + m_DateTimeStr = TimeUtils::makeBubbleDateLineString(m_DateTime); } -void ConvDateLineListItem::setDateLine(std::string dateLine) +const std::string &ConvDateLineListItem::getDateTimeStr() const { - m_DateLine = std::move(dateLine); + return m_DateTimeStr; } std::string ConvDateLineListItem::getText(ListItem &item, const char *part) { if (!strcmp(part, datePart)) - return m_DateLine; - else - return ""; + return m_DateTimeStr; + + return ""; } diff --git a/src/Conversation/View/src/ConvReplyListItem.cpp b/src/Conversation/View/src/ConvReplyListItem.cpp index 1071187..0f459a9 100644 --- a/src/Conversation/View/src/ConvReplyListItem.cpp +++ b/src/Conversation/View/src/ConvReplyListItem.cpp @@ -26,7 +26,6 @@ namespace { ConvReplyListItem::ConvReplyListItem() : ListItem(ListItemStyle::create("reply")) - , m_ReplyText(msg("WDS_MSG_OPT_REPLY_ABB")) { } @@ -34,10 +33,15 @@ ConvReplyListItem::~ConvReplyListItem() { } +std::string ConvReplyListItem::getReplayText() const +{ + return msg("WDS_MSG_OPT_REPLY_ABB"); +} + std::string ConvReplyListItem::getText(ListItem &item, const char *part) { if (!strcmp(part, replyText)) - return m_ReplyText; + return getReplayText(); return ""; } @@ -55,7 +59,7 @@ Evas_Object *ConvReplyListItem::getReplyButton() Evas_Object *btn = View::addIconButton(*getOwner(), "conv/reply_icon"); Atspi AoBtn = Atspi(btn); - AoBtn.setName(m_ReplyText); + AoBtn.setName(getReplayText()); AoBtn.setRole(ELM_ATSPI_ROLE_PUSH_BUTTON); AoBtn.setReadingInfo((Elm_Accessible_Reading_Info_Type)(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME | ELM_ACCESSIBLE_READING_INFO_TYPE_ROLE)); diff --git a/src/MsgThread/Controller/inc/ThreadList.h b/src/MsgThread/Controller/inc/ThreadList.h index 5cfaa74..7681624 100644 --- a/src/MsgThread/Controller/inc/ThreadList.h +++ b/src/MsgThread/Controller/inc/ThreadList.h @@ -79,7 +79,7 @@ namespace Msg { void fillList(); void deleteItems(); void updateItems(const MsgIdList &idList); - void updateItems(); + void updateLangInfo(); void updateItem(ThreadListItem &item); void showNoContent(bool value); void insertItem(ThreadId id); diff --git a/src/MsgThread/Controller/inc/ThreadListItem.h b/src/MsgThread/Controller/inc/ThreadListItem.h index 6f50c30..84a9734 100644 --- a/src/MsgThread/Controller/inc/ThreadListItem.h +++ b/src/MsgThread/Controller/inc/ThreadListItem.h @@ -34,6 +34,7 @@ namespace Msg { time_t getRawTime() const; void updateTime(); void updateContactInfo(); + void updateLangInfo(); protected: void updateName(); diff --git a/src/MsgThread/Controller/src/ThreadList.cpp b/src/MsgThread/Controller/src/ThreadList.cpp index f85b636..48a3c95 100644 --- a/src/MsgThread/Controller/src/ThreadList.cpp +++ b/src/MsgThread/Controller/src/ThreadList.cpp @@ -252,12 +252,13 @@ void ThreadList::updateItems(const MsgIdList &idList) } } -void ThreadList::updateItems() +void ThreadList::updateLangInfo() { auto items = getItems<ThreadListItem>(); for (ThreadListItem *item: items) { - updateItem(*item); + item->updateLangInfo(); } + updateRealizedItems(); } void ThreadList::showNoContent(bool value) @@ -383,7 +384,7 @@ void ThreadList::onTimeFormatChanged() void ThreadList::onLanguageChanged() { MSG_LOG(""); - updateItems(); + updateLangInfo(); } void ThreadList::onComposeButtonClicked() diff --git a/src/MsgThread/Controller/src/ThreadListItem.cpp b/src/MsgThread/Controller/src/ThreadListItem.cpp index 4d77aa2..1a9bbd7 100644 --- a/src/MsgThread/Controller/src/ThreadListItem.cpp +++ b/src/MsgThread/Controller/src/ThreadListItem.cpp @@ -145,6 +145,11 @@ void ThreadListItem::updateContactInfo() updateName(); } +void ThreadListItem::updateLangInfo() +{ + updateTime(); +} + std::string ThreadListItem::getName() { return m_Name; diff --git a/src/Settings/Controller/inc/SettingsBlockListFrame.h b/src/Settings/Controller/inc/SettingsBlockListFrame.h index 645c96c..7afc1d7 100644 --- a/src/Settings/Controller/inc/SettingsBlockListFrame.h +++ b/src/Settings/Controller/inc/SettingsBlockListFrame.h @@ -17,6 +17,7 @@ #ifndef SettingsBlockListFrame_h_ #define SettingsBlockListFrame_h_ +#include "SystemSettingsManager.h" #include "FrameController.h" #include "ListView.h" @@ -35,7 +36,8 @@ namespace Msg { class SettingsBlockListFrame : public FrameController - , private IListViewListener { + , private IListViewListener + , private ISystemSettingsManager { public: enum BlockListType { @@ -64,6 +66,10 @@ namespace Msg { // IListViewListener: void onListItemSelected(ListItem &listItem) override; + // ISystemSettingsManager: + void onTimeFormatChanged() override; + void onLanguageChanged() override; + void prepareMainLayout(); void prepareMoreOption(); void prepareSelectViews(); @@ -74,6 +80,7 @@ namespace Msg { void setSelectMode(bool value); void showSelectPopup(); void updateNoContent(); + void updateLangInfo(); void insertItem(ListItem *item); private: diff --git a/src/Settings/Controller/src/SettingsBlockListFrame.cpp b/src/Settings/Controller/src/SettingsBlockListFrame.cpp index 514223a..79ee350 100644 --- a/src/Settings/Controller/src/SettingsBlockListFrame.cpp +++ b/src/Settings/Controller/src/SettingsBlockListFrame.cpp @@ -48,10 +48,12 @@ SettingsBlockListFrame::SettingsBlockListFrame(NaviFrameController &parent, Bloc prepareMoreOption(); preapareList(); updateNoContent(); + App::getInst().getSysSettingsManager().addListener(*this); } SettingsBlockListFrame::~SettingsBlockListFrame() { + App::getInst().getSysSettingsManager().removeListener(*this); } void SettingsBlockListFrame::setSelectMode(bool value) @@ -198,6 +200,12 @@ void SettingsBlockListFrame::updateNoContent() m_pLayout->showMoreOption(!noContent); } +void SettingsBlockListFrame::updateLangInfo() +{ + m_pList->updateRealizedItems(); + // TODO: update items +} + void SettingsBlockListFrame::insertItem(ListItem *item) { if(m_pBottomItem && m_pBottomItem != item) @@ -251,3 +259,14 @@ void SettingsBlockListFrame::onListItemSelected(ListItem &listItem) getParent().push(*frame); } +void SettingsBlockListFrame::onTimeFormatChanged() +{ + MSG_LOG(""); +} + +void SettingsBlockListFrame::onLanguageChanged() +{ + MSG_LOG(""); + updateLangInfo(); +} + |