From: Denis Dolzhenko Date: Fri, 11 Aug 2017 09:26:35 +0000 (+0300) Subject: TizenRefApp-9102 Implement blocked message detail X-Git-Tag: submit/tizen/20170814.131616~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d00198c8c69dfa97d436a9d73913619cd4c4e907;p=profile%2Fwearable%2Fapps%2Fnative%2Fmessage.git TizenRefApp-9102 Implement blocked message detail Change-Id: Ibbefa7b783ff3002cdc11dd47060cf799c4bec75 Signed-off-by: Denis Dolzhenko --- diff --git a/src/Common/Utils/inc/TimeUtils.h b/src/Common/Utils/inc/TimeUtils.h index a08e09e..14af149 100644 --- a/src/Common/Utils/inc/TimeUtils.h +++ b/src/Common/Utils/inc/TimeUtils.h @@ -28,7 +28,6 @@ namespace Msg { TimeFormat24H, TimeFormat12H }; - std::string makeThreadTimeString(time_t msgTime); std::string makeBubbleTimeString(time_t msgTime); std::string makeBubbleDateLineString(time_t msgTime); @@ -37,6 +36,7 @@ namespace Msg { std::string makeSmsReportTimeString(time_t msgTime); std::string makeMmsReportTimeString(time_t msgTime); std::string makeCalEventString(time_t time); + std::string makeBlockedMsgDetailString(time_t time); std::string makeCalEventString(int year, int month, int mday, int hour, int min, const char *timezone = nullptr); }; } diff --git a/src/Common/Utils/src/TimeUtils.cpp b/src/Common/Utils/src/TimeUtils.cpp index b5b7ec8..e24894b 100644 --- a/src/Common/Utils/src/TimeUtils.cpp +++ b/src/Common/Utils/src/TimeUtils.cpp @@ -44,6 +44,8 @@ const std::string delivReportSms24H = "MMM/dd/yyyy HHmm"; //SMS Delivery report const std::string delivReportSms12H = "MMM/dd/yyyy hma"; //SMS Delivery report 12H format const std::string delivReportMms24H = "HH:mm, d MMM"; //MMS Delivery report 24H format const std::string delivReportMms12H = "hh:mm a, d MMM"; //MMS Delivery report 12H format +const std::string blockedMsgDetail24H = "yyyy/dd/MM HHmm"; // Blocked message detail 24H format +const std::string blockedMsgDetail12H = "yyyy/dd/MM hma"; // Blocked message detail 12H format int getTimeFormat(); std::string getTimezone(); @@ -70,7 +72,7 @@ std::string makeThreadTimeString(time_t msgTime) if (isToday) { - const std::string &timeFormat = getTimeFormat() == TimeFormat24H ? time24H : time12H; + const std::string &timeFormat = getTimeFormat() == TimeFormat24H ? time24H : time12H; return getFormattedDate(locale, getDateBestPattern(locale, timeFormat), msgTime); } else { bool notThisYear = (msgTimeTm.tm_year - curTimeTm.tm_year != 0); @@ -104,7 +106,7 @@ std::string makeDateTimeString(time_t msgTime) //the same for Sim Message List std::string res = getFormattedDate(locale, getDateBestPattern(locale, dateTimeSceleton), msgTime); res.append(" "); - const std::string &timeFormat = getTimeFormat() == TimeFormat24H ? time24H : time12H; + const std::string &timeFormat = getTimeFormat() == TimeFormat24H ? time24H : time12H; res += getFormattedDate(locale, getDateBestPattern(locale, timeFormat), msgTime); return res; @@ -130,6 +132,13 @@ std::string makeCalEventString(time_t time) return getFormattedDate(locale, getDateBestPattern(locale, dateYear), time); } +std::string makeBlockedMsgDetailString(time_t time) +{ + const std::string &locale = getDefaultLocale(); + const std::string &timeFormat = getTimeFormat() == TimeFormat24H ? blockedMsgDetail24H : blockedMsgDetail12H; + return getFormattedDate(locale, getDateBestPattern(locale, timeFormat), time); +} + std::string makeCalEventString(int year, int month, int mday, int hour, int min, const char *timezone) { struct tm time = {}; diff --git a/src/Settings/Controller/inc/BlockedMsgDetailListItem.h b/src/Settings/Controller/inc/BlockedMsgDetailListItem.h new file mode 100644 index 0000000..3120f27 --- /dev/null +++ b/src/Settings/Controller/inc/BlockedMsgDetailListItem.h @@ -0,0 +1,47 @@ +/* + * Copyright 2017 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 BlockedMsgDetailListItem_h_ +#define BlockedMsgDetailListItem_h_ + +#include "BlockedMsgDetailListViewItem.h" +#include "MsgTypes.h" + +#include + +namespace Msg { + class BlockedMsgDetailListItem + : public BlockedMsgDetailListViewItem { + + public: + BlockedMsgDetailListItem(MsgId id); + virtual ~BlockedMsgDetailListItem(); + + void updateTimeInfo(); + + protected: + std::string getTime() override; + std::string getMessage() override; + + private: + MsgId m_MsgId; + time_t m_Time; + std::string m_TimeStr; + std::string m_Message; + }; +} + +#endif // BlockedMsgDetailListItem_h_ diff --git a/src/Settings/Controller/inc/BlockedMsgListItem.h b/src/Settings/Controller/inc/BlockedMsgListItem.h index 575b6c9..01c6ee4 100644 --- a/src/Settings/Controller/inc/BlockedMsgListItem.h +++ b/src/Settings/Controller/inc/BlockedMsgListItem.h @@ -35,6 +35,7 @@ namespace Msg { MsgId getMsgId() const; time_t getRawTime() const; + const Recipient &getRecip() const; void updateMsgInfo(const Message &msg); void updateMsgInfo(); void updateContactInfo(); diff --git a/src/Settings/Controller/inc/BlockedNumberListItem.h b/src/Settings/Controller/inc/BlockedNumberListItem.h index a0cdbc2..cd057bf 100644 --- a/src/Settings/Controller/inc/BlockedNumberListItem.h +++ b/src/Settings/Controller/inc/BlockedNumberListItem.h @@ -29,6 +29,7 @@ namespace Msg { virtual ~BlockedNumberListItem(); Recipient &getRecip(); + void updateContactInfo(); private: std::string getAddress() override; diff --git a/src/Settings/Controller/inc/SettingsBlockedMessagesFrame.h b/src/Settings/Controller/inc/SettingsBlockedMessagesFrame.h index 8206d92..9b985a4 100644 --- a/src/Settings/Controller/inc/SettingsBlockedMessagesFrame.h +++ b/src/Settings/Controller/inc/SettingsBlockedMessagesFrame.h @@ -19,6 +19,7 @@ #include "SystemSettingsManager.h" #include "FrameController.h" +#include "ContactManager.h" #include "ListView.h" #include "MsgStorage.h" @@ -41,6 +42,7 @@ namespace Msg { : public FrameController , private IListViewListener , private ISystemSettingsManager + , private IContactManagerListener , private IMsgStorageListener { public: @@ -67,6 +69,9 @@ namespace Msg { void onListItemLongPressed(ListItem &listItem) override; void onListItemChecked(ListItem &listItem) override; + // IContactManagerListener: + void onContactChanged() override; + // ISystemSettingsManager: void onTimeFormatChanged() override; void onLanguageChanged() override; @@ -91,6 +96,7 @@ namespace Msg { void hideSelectPopup(); void updateNoContent(); void updateLangInfo(); + void updateContactInfo(); void updateTimeInfo(); void checkHandler(ListItem &item); void deleteMessages(const std::vector &items); diff --git a/src/Settings/Controller/inc/SettingsBlockedMsgDetailFrame.h b/src/Settings/Controller/inc/SettingsBlockedMsgDetailFrame.h index b2c181b..d2a5ab1 100644 --- a/src/Settings/Controller/inc/SettingsBlockedMsgDetailFrame.h +++ b/src/Settings/Controller/inc/SettingsBlockedMsgDetailFrame.h @@ -18,15 +18,25 @@ #define SettingsBlockedMsgDetailFrame_h_ #include "FrameController.h" +#include "SystemSettingsManager.h" +#include "ContactManager.h" +#include "MsgTypes.h" +#include "ListView.h" +#include "Recipient.h" namespace Msg { class MoreOption; class DefaultLayout; + class TitleListItem; + class BlockedMsgDetailListItem; class SettingsBlockedMsgDetailFrame - : public FrameController { + : public FrameController + , private ISystemSettingsManager + , private IContactManagerListener { + public: - SettingsBlockedMsgDetailFrame(NaviFrameController &parent); + SettingsBlockedMsgDetailFrame(NaviFrameController &parent, MsgId msgId, Recipient recip); virtual ~SettingsBlockedMsgDetailFrame(); protected: @@ -34,16 +44,32 @@ namespace Msg { void onAttached(ViewItem &item) override; private: + // ISystemSettingsManager: + void onTimeFormatChanged() override; + + // IContactManagerListener: + void onContactChanged() override; + // More option: void onRestoreClicked(MoreOption &obj); void onDeleteClicked(MoreOption &obj); + void showRestorePopup(); void prepareMainLayout(); void prepareMoreOption(); + void preapareList(); + void fillList(); + + void updateSenderListItem(); private: DefaultLayout *m_pLayout; MoreOption *m_pMoreOption; + ListView *m_pList; + MsgId m_MsgId; + Recipient m_Recip; + TitleListItem *m_pSenderListItem; + BlockedMsgDetailListItem *m_pMsgItem; }; } diff --git a/src/Settings/Controller/inc/SettingsBlockedNumbersFrame.h b/src/Settings/Controller/inc/SettingsBlockedNumbersFrame.h index ef520f8..e424b3f 100644 --- a/src/Settings/Controller/inc/SettingsBlockedNumbersFrame.h +++ b/src/Settings/Controller/inc/SettingsBlockedNumbersFrame.h @@ -74,7 +74,6 @@ namespace Msg { // Hw buttons: void onHwBackButtonPressed(Evas_Object *obj, void *event); - void prepareMainLayout(); void prepareMoreOption(); void prepareSelectViews(); @@ -88,6 +87,7 @@ namespace Msg { void updateNoContent(); void updateLangInfo(); void updateContactInfo(); + void insertItem(ListItem *item); void checkHandler(ListItem &item); void deleteNumbers(const std::vector &items); diff --git a/src/Settings/Controller/src/BlockedMsgDetailListItem.cpp b/src/Settings/Controller/src/BlockedMsgDetailListItem.cpp new file mode 100644 index 0000000..27f7edf --- /dev/null +++ b/src/Settings/Controller/src/BlockedMsgDetailListItem.cpp @@ -0,0 +1,54 @@ +/* + * Copyright 2017 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 "BlockedMsgDetailListItem.h" +#include "App.h" +#include "MsgEngine.h" +#include "TimeUtils.h" + +using namespace Msg; + +BlockedMsgDetailListItem::BlockedMsgDetailListItem(MsgId id) + : m_MsgId(id) +{ + auto msg = App::getInst().getMsgEngine().getStorage().getMessage(id); + if (msg) { + m_Time = msg->getTime(); + m_Message = msg->getText(); + } +} + +BlockedMsgDetailListItem::~BlockedMsgDetailListItem() +{ +} + +void BlockedMsgDetailListItem::updateTimeInfo() +{ + m_TimeStr.clear(); + BlockedMsgDetailListViewItem::update(); +} + +std::string BlockedMsgDetailListItem::getTime() +{ + if (m_TimeStr.empty()) + m_TimeStr = TimeUtils::makeBlockedMsgDetailString(m_Time); + return m_TimeStr; +} + +std::string BlockedMsgDetailListItem::getMessage() +{ + return m_Message; +} diff --git a/src/Settings/Controller/src/BlockedMsgListItem.cpp b/src/Settings/Controller/src/BlockedMsgListItem.cpp index 923ecff..f172c07 100644 --- a/src/Settings/Controller/src/BlockedMsgListItem.cpp +++ b/src/Settings/Controller/src/BlockedMsgListItem.cpp @@ -97,3 +97,8 @@ time_t BlockedMsgListItem::getRawTime() const return m_Time; } +const Recipient &BlockedMsgListItem::getRecip() const +{ + return m_Recip; +} + diff --git a/src/Settings/Controller/src/BlockedNumberListItem.cpp b/src/Settings/Controller/src/BlockedNumberListItem.cpp index f12b97e..55fd59c 100644 --- a/src/Settings/Controller/src/BlockedNumberListItem.cpp +++ b/src/Settings/Controller/src/BlockedNumberListItem.cpp @@ -29,6 +29,11 @@ BlockedNumberListItem::~BlockedNumberListItem() { } +void BlockedNumberListItem::updateContactInfo() +{ + m_Recip.updateContactInfo(); +} + std::string BlockedNumberListItem::getAddress() { return m_Recip.getAddress(); diff --git a/src/Settings/Controller/src/SettingsBlockedMessagesFrame.cpp b/src/Settings/Controller/src/SettingsBlockedMessagesFrame.cpp index 35fde73..cab6f30 100644 --- a/src/Settings/Controller/src/SettingsBlockedMessagesFrame.cpp +++ b/src/Settings/Controller/src/SettingsBlockedMessagesFrame.cpp @@ -52,6 +52,7 @@ SettingsBlockedMessagesFrame::SettingsBlockedMessagesFrame(NaviFrameController & prepareMoreOption(); preapareList(); updateNoContent(); + App::getInst().getContactManager().addListener(*this); App::getInst().getSysSettingsManager().addListener(*this); App::getInst().getMsgEngine().getStorage().addListener(*this); } @@ -59,6 +60,7 @@ SettingsBlockedMessagesFrame::SettingsBlockedMessagesFrame(NaviFrameController & SettingsBlockedMessagesFrame::~SettingsBlockedMessagesFrame() { hideSelectPopup(); + App::getInst().getContactManager().removeListener(*this); App::getInst().getSysSettingsManager().removeListener(*this); App::getInst().getMsgEngine().getStorage().removeListener(*this); } @@ -251,6 +253,15 @@ void SettingsBlockedMessagesFrame::updateLangInfo() m_pList->updateRealizedItems(); } +void SettingsBlockedMessagesFrame::updateContactInfo() +{ + auto items = m_pList->getItems(); + for (BlockedMsgListItem *item : items) { + item->updateContactInfo(); + } + m_pList->updateRealizedItems(); +} + void SettingsBlockedMessagesFrame::updateTimeInfo() { auto items = m_pList->getItems(); @@ -431,7 +442,7 @@ void SettingsBlockedMessagesFrame::onListItemSelected(ListItem &listItem) { MSG_LOG(""); if (auto blockedMsgItem = dynamic_cast(&listItem)) { - auto frame = new SettingsBlockedMsgDetailFrame(getParent()); + auto frame = new SettingsBlockedMsgDetailFrame(getParent(), blockedMsgItem->getMsgId(), blockedMsgItem->getRecip()); getParent().push(*frame); } } @@ -464,6 +475,12 @@ void SettingsBlockedMessagesFrame::onLanguageChanged() updateLangInfo(); } +void SettingsBlockedMessagesFrame::onContactChanged() +{ + MSG_LOG(""); + updateContactInfo(); +} + void SettingsBlockedMessagesFrame::onHwBackButtonPressed(Evas_Object *obj, void *event) { MSG_LOG(""); diff --git a/src/Settings/Controller/src/SettingsBlockedMsgDetailFrame.cpp b/src/Settings/Controller/src/SettingsBlockedMsgDetailFrame.cpp index 683e630..854f762 100644 --- a/src/Settings/Controller/src/SettingsBlockedMsgDetailFrame.cpp +++ b/src/Settings/Controller/src/SettingsBlockedMsgDetailFrame.cpp @@ -14,26 +14,77 @@ * limitations under the License. */ +#include #include "SettingsBlockedMsgDetailFrame.h" #include "LangUtils.h" #include "DefaultLayout.h" #include "MoreOption.h" #include "IconTextPopup.h" #include "NaviFrameController.h" +#include "App.h" +#include "Window.h" +#include "TitleListItem.h" +#include "MsgEngine.h" +#include "PaddingListViewItem.h" using namespace Msg; -SettingsBlockedMsgDetailFrame::SettingsBlockedMsgDetailFrame(NaviFrameController &parent) +SettingsBlockedMsgDetailFrame::SettingsBlockedMsgDetailFrame(NaviFrameController &parent, MsgId msgId, Recipient recip) : FrameController(parent, SettingsGroup) , m_pLayout(nullptr) , m_pMoreOption(nullptr) + , m_pList(nullptr) + , m_MsgId(msgId) + , m_Recip(std::move(recip)) + , m_pSenderListItem(nullptr) + , m_pMsgItem(nullptr) { + App::getInst().getContactManager().addListener(*this); + App::getInst().getSysSettingsManager().addListener(*this); prepareMainLayout(); prepareMoreOption(); + preapareList(); } SettingsBlockedMsgDetailFrame::~SettingsBlockedMsgDetailFrame() { + App::getInst().getContactManager().removeListener(*this); + App::getInst().getSysSettingsManager().removeListener(*this); +} + +void SettingsBlockedMsgDetailFrame::preapareList() +{ + if (!m_pList) { + m_pList = new ListView(getParent(), App::getInst().getWindow().getCircleSurface()); + m_pList->setHomogeneous(false); + m_pList->setMultiSelection(false); + m_pLayout->setContent(*m_pList); + fillList(); + } +} + +void SettingsBlockedMsgDetailFrame::fillList() +{ + // Append Sender: + m_pSenderListItem = new TitleListItem; + m_pList->appendItem(*m_pSenderListItem); + updateSenderListItem(); + + // Msg item: + if (m_MsgId.isValid()) { + m_pMsgItem = new BlockedMsgDetailListItem(m_MsgId); + m_pList->appendItem(*m_pMsgItem); + } + + // Bottom padding: + auto *bottomItem = new PaddingListViewItem; + m_pList->appendItem(*bottomItem); +} + +void SettingsBlockedMsgDetailFrame::updateSenderListItem() +{ + m_Recip.updateContactInfo(); + m_pSenderListItem->setTitle(m_Recip.getDispName()); } void SettingsBlockedMsgDetailFrame::onAttached(ViewItem &item) @@ -62,9 +113,8 @@ void SettingsBlockedMsgDetailFrame::prepareMoreOption() } } -void SettingsBlockedMsgDetailFrame::onRestoreClicked(MoreOption &obj) +void SettingsBlockedMsgDetailFrame::showRestorePopup() { - MSG_LOG(""); auto *popup = new IconTextPopup; popup->setIcon(IconTextPopup::CheckIcon); popup->setText(msgt("WDS_MSG_TPOP_MESSAGE_RESTORED_ABB")); @@ -72,7 +122,31 @@ void SettingsBlockedMsgDetailFrame::onRestoreClicked(MoreOption &obj) popup->show(); } +void SettingsBlockedMsgDetailFrame::onRestoreClicked(MoreOption &obj) +{ + MSG_LOG(""); + if (App::getInst().getMsgEngine().getStorage().moveMsgToInBox(m_MsgId)) { + showRestorePopup(); + pop(); + } +} + void SettingsBlockedMsgDetailFrame::onDeleteClicked(MoreOption &obj) { MSG_LOG(""); + if (App::getInst().getMsgEngine().getStorage().deleteMessage(m_MsgId)) + pop(); +} + +void SettingsBlockedMsgDetailFrame::onTimeFormatChanged() +{ + MSG_LOG(""); + if (m_pMsgItem) + m_pMsgItem->updateTimeInfo(); +} + +void SettingsBlockedMsgDetailFrame::onContactChanged() +{ + MSG_LOG(""); + updateSenderListItem(); } diff --git a/src/Settings/Controller/src/SettingsBlockedNumbersFrame.cpp b/src/Settings/Controller/src/SettingsBlockedNumbersFrame.cpp index 6db97dc..d426059 100644 --- a/src/Settings/Controller/src/SettingsBlockedNumbersFrame.cpp +++ b/src/Settings/Controller/src/SettingsBlockedNumbersFrame.cpp @@ -234,7 +234,7 @@ void SettingsBlockedNumbersFrame::updateContactInfo() { auto items = m_pList->getItems(); for (BlockedNumberListItem *item : items) { - item->getRecip().updateContactInfo(); + item->updateContactInfo(); } m_pList->updateRealizedItems(); } @@ -324,6 +324,7 @@ void SettingsBlockedNumbersFrame::onLanguageChanged() void SettingsBlockedNumbersFrame::onContactChanged() { MSG_LOG(""); + updateContactInfo(); } void SettingsBlockedNumbersFrame::onHwBackButtonPressed(Evas_Object *obj, void *event) diff --git a/src/Settings/View/inc/BlockedMsgDetailListViewItem.h b/src/Settings/View/inc/BlockedMsgDetailListViewItem.h new file mode 100644 index 0000000..a76744a --- /dev/null +++ b/src/Settings/View/inc/BlockedMsgDetailListViewItem.h @@ -0,0 +1,39 @@ +/* + * Copyright 2017 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 BlockedMsgDetailListViewItem_h_ +#define BlockedMsgDetailListViewItem_h_ + +#include "ListItem.h" + +namespace Msg { + class BlockedMsgDetailListViewItem + : public ListItem { + + public: + BlockedMsgDetailListViewItem(); + virtual ~BlockedMsgDetailListViewItem(); + + protected: + virtual std::string getTime() = 0; + virtual std::string getMessage() = 0; + + private: + std::string getText(ListItem &item, const char *part) override; + }; +} + +#endif // BlockedMsgDetailListViewItem_h_ diff --git a/src/Settings/View/inc/SettingsBlockedMsgDetailView.h b/src/Settings/View/inc/SettingsBlockedMsgDetailView.h deleted file mode 100644 index fc56bdb..0000000 --- a/src/Settings/View/inc/SettingsBlockedMsgDetailView.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2017 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 SettingsBlockedMsgDetailView_h_ -#define SettingsBlockedMsgDetailView_h_ - -#include "ListItem.h" -#include "LangUtils.h" - -namespace Msg { - class SettingsBlockedMsgDetailView - : public ListItem { - public: - SettingsBlockedMsgDetailView(); - virtual ~SettingsBlockedMsgDetailView(); - - void setTime(std::string time); - void setMessage(std::string message); - - private: - std::string getText(ListItem &item, const char *part) override; - - private: - std::string m_Time; - std::string m_Message; - }; -} - -#endif // SettingsBlockedMsgDetailView_h_ diff --git a/src/Settings/View/src/BlockedMsgDetailListViewItem.cpp b/src/Settings/View/src/BlockedMsgDetailListViewItem.cpp new file mode 100644 index 0000000..4d30ca4 --- /dev/null +++ b/src/Settings/View/src/BlockedMsgDetailListViewItem.cpp @@ -0,0 +1,49 @@ +/* + * Copyright 2017 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 "BlockedMsgDetailListViewItem.h" +#include "TimeUtils.h" + +#include + +using namespace Msg; + +namespace { + const char *msgTime = "elm.text"; + const char *msgText = "elm.text.1"; +} + +BlockedMsgDetailListViewItem::BlockedMsgDetailListViewItem() + : ListItem(ListItemStyle::create("message_detail")) +{ +} + +BlockedMsgDetailListViewItem::~BlockedMsgDetailListViewItem() +{ +} + +std::string BlockedMsgDetailListViewItem::getText(ListItem &item, const char *part) +{ + if (!strcmp(part, msgTime)) + return getTime(); + else if (!strcmp(part, msgText)) { + return getMessage(); + } + + return ""; +} + diff --git a/src/Settings/View/src/SettingsBlockedMsgDetailView.cpp b/src/Settings/View/src/SettingsBlockedMsgDetailView.cpp deleted file mode 100644 index bebf240..0000000 --- a/src/Settings/View/src/SettingsBlockedMsgDetailView.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2017 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 -#include "SettingsBlockedMsgDetailView.h" -#include "TimeUtils.h" - -using namespace Msg; - -namespace { - const char *msgTime = "elm.text"; - const char *msgText = "elm.text.1"; -} - -SettingsBlockedMsgDetailView::SettingsBlockedMsgDetailView() - : ListItem(ListItemStyle::create("message_detail")) -{ -} - -SettingsBlockedMsgDetailView::~SettingsBlockedMsgDetailView() -{ -} - -void SettingsBlockedMsgDetailView::setTime(std::string time) -{ - m_Time = std::move(time); -} - -void SettingsBlockedMsgDetailView::setMessage(std::string message) -{ - m_Message = std::move(message); -} - -std::string SettingsBlockedMsgDetailView::getText(ListItem &item, const char *part) -{ - if (!strcmp(part, msgTime)) - return m_Time; - else if (!strcmp(part, msgText)) { - return m_Message; - } - - return ""; -} -