TimeFormat24H,
TimeFormat12H
};
-
std::string makeThreadTimeString(time_t msgTime);
std::string makeBubbleTimeString(time_t msgTime);
std::string makeBubbleDateLineString(time_t msgTime);
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);
};
}
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();
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);
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;
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 = {};
--- /dev/null
+/*
+ * 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 <time.h>
+
+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_
MsgId getMsgId() const;
time_t getRawTime() const;
+ const Recipient &getRecip() const;
void updateMsgInfo(const Message &msg);
void updateMsgInfo();
void updateContactInfo();
virtual ~BlockedNumberListItem();
Recipient &getRecip();
+ void updateContactInfo();
private:
std::string getAddress() override;
#include "SystemSettingsManager.h"
#include "FrameController.h"
+#include "ContactManager.h"
#include "ListView.h"
#include "MsgStorage.h"
: public FrameController
, private IListViewListener
, private ISystemSettingsManager
+ , private IContactManagerListener
, private IMsgStorageListener {
public:
void onListItemLongPressed(ListItem &listItem) override;
void onListItemChecked(ListItem &listItem) override;
+ // IContactManagerListener:
+ void onContactChanged() override;
+
// ISystemSettingsManager:
void onTimeFormatChanged() override;
void onLanguageChanged() override;
void hideSelectPopup();
void updateNoContent();
void updateLangInfo();
+ void updateContactInfo();
void updateTimeInfo();
void checkHandler(ListItem &item);
void deleteMessages(const std::vector<BlockedMsgListItem*> &items);
#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:
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;
};
}
// Hw buttons:
void onHwBackButtonPressed(Evas_Object *obj, void *event);
-
void prepareMainLayout();
void prepareMoreOption();
void prepareSelectViews();
void updateNoContent();
void updateLangInfo();
void updateContactInfo();
+
void insertItem(ListItem *item);
void checkHandler(ListItem &item);
void deleteNumbers(const std::vector<BlockedNumberListItem*> &items);
--- /dev/null
+/*
+ * 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;
+}
return m_Time;
}
+const Recipient &BlockedMsgListItem::getRecip() const
+{
+ return m_Recip;
+}
+
{
}
+void BlockedNumberListItem::updateContactInfo()
+{
+ m_Recip.updateContactInfo();
+}
+
std::string BlockedNumberListItem::getAddress()
{
return m_Recip.getAddress();
prepareMoreOption();
preapareList();
updateNoContent();
+ App::getInst().getContactManager().addListener(*this);
App::getInst().getSysSettingsManager().addListener(*this);
App::getInst().getMsgEngine().getStorage().addListener(*this);
}
SettingsBlockedMessagesFrame::~SettingsBlockedMessagesFrame()
{
hideSelectPopup();
+ App::getInst().getContactManager().removeListener(*this);
App::getInst().getSysSettingsManager().removeListener(*this);
App::getInst().getMsgEngine().getStorage().removeListener(*this);
}
m_pList->updateRealizedItems();
}
+void SettingsBlockedMessagesFrame::updateContactInfo()
+{
+ auto items = m_pList->getItems<BlockedMsgListItem>();
+ for (BlockedMsgListItem *item : items) {
+ item->updateContactInfo();
+ }
+ m_pList->updateRealizedItems();
+}
+
void SettingsBlockedMessagesFrame::updateTimeInfo()
{
auto items = m_pList->getItems<BlockedMsgListItem>();
{
MSG_LOG("");
if (auto blockedMsgItem = dynamic_cast<BlockedMsgListItem*>(&listItem)) {
- auto frame = new SettingsBlockedMsgDetailFrame(getParent());
+ auto frame = new SettingsBlockedMsgDetailFrame(getParent(), blockedMsgItem->getMsgId(), blockedMsgItem->getRecip());
getParent().push(*frame);
}
}
updateLangInfo();
}
+void SettingsBlockedMessagesFrame::onContactChanged()
+{
+ MSG_LOG("");
+ updateContactInfo();
+}
+
void SettingsBlockedMessagesFrame::onHwBackButtonPressed(Evas_Object *obj, void *event)
{
MSG_LOG("");
* limitations under the License.
*/
+#include <BlockedMsgDetailListItem.h>
#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)
}
}
-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"));
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();
}
{
auto items = m_pList->getItems<BlockedNumberListItem>();
for (BlockedNumberListItem *item : items) {
- item->getRecip().updateContactInfo();
+ item->updateContactInfo();
}
m_pList->updateRealizedItems();
}
void SettingsBlockedNumbersFrame::onContactChanged()
{
MSG_LOG("");
+ updateContactInfo();
}
void SettingsBlockedNumbersFrame::onHwBackButtonPressed(Evas_Object *obj, void *event)
--- /dev/null
+/*
+ * 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_
+++ /dev/null
-/*
- * 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_
--- /dev/null
+/*
+ * 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 <string.h>
+
+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 "";
+}
+
+++ /dev/null
-/*
- * 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 <string.h>
-#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 "";
-}
-