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()))
#include "Recipient.h"
#include "DefaultLayout.h"
#include "ContactManager.h"
+#include "SystemSettingsManager.h"
#include <unordered_map>
#include <unordered_set>
: public ListView
, private IListViewListener
, private IMsgStorageListener
- , private IContactManagerListener {
+ , private IContactManagerListener
+ , private ISystemSettingsManager {
public:
ConvList(DefaultLayout *parent, WorkingDirRef &workingDir);
// 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);
BubbleEntityFactory m_BubbleEntityFactory;
ConvListItemMap m_ConvListItemMap;
DateLineItemSet m_DateLineItemSet;
- DefaultLayout *m_pParentLayout;
};
class IConvListListener {
MsgId getMsgId() const;
time_t getRawTime() const;
void updateStatus();
+ void updateLangInfo();
void updateTime();
protected:
#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;
, 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);
{
getMsgStorage().removeListener(*this);
App::getInst().getContactManager().removeListener(*this);
+ App::getInst().getSysSettingsManager().removeListener(*this);
}
void ConvList::setDeleteMode(bool value)
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();
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);
}
}
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
m_Recip.updateContactInfo();
updateTitle();
}
+
+void ConvList::onTimeFormatChanged()
+{
+ MSG_LOG("");
+}
+
+void ConvList::onLanguageChanged()
+{
+ MSG_LOG("");
+ updateLangInfo();
+}
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);
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;
};
}
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;
};
}
*/
#include "ConvDateLineListItem.h"
+#include "TimeUtils.h"
#include "ListView.h"
using namespace Msg;
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))
{
}
{
}
-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 "";
}
ConvReplyListItem::ConvReplyListItem()
: ListItem(ListItemStyle::create("reply"))
- , m_ReplyText(msg("WDS_MSG_OPT_REPLY_ABB"))
{
}
{
}
+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 "";
}
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));
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);
time_t getRawTime() const;
void updateTime();
void updateContactInfo();
+ void updateLangInfo();
protected:
void updateName();
}
}
-void ThreadList::updateItems()
+void ThreadList::updateLangInfo()
{
auto items = getItems<ThreadListItem>();
for (ThreadListItem *item: items) {
- updateItem(*item);
+ item->updateLangInfo();
}
+ updateRealizedItems();
}
void ThreadList::showNoContent(bool value)
void ThreadList::onLanguageChanged()
{
MSG_LOG("");
- updateItems();
+ updateLangInfo();
}
void ThreadList::onComposeButtonClicked()
updateName();
}
+void ThreadListItem::updateLangInfo()
+{
+ updateTime();
+}
+
std::string ThreadListItem::getName()
{
return m_Name;
#ifndef SettingsBlockListFrame_h_
#define SettingsBlockListFrame_h_
+#include "SystemSettingsManager.h"
#include "FrameController.h"
#include "ListView.h"
class SettingsBlockListFrame
: public FrameController
- , private IListViewListener {
+ , private IListViewListener
+ , private ISystemSettingsManager {
public:
enum BlockListType {
// IListViewListener:
void onListItemSelected(ListItem &listItem) override;
+ // ISystemSettingsManager:
+ void onTimeFormatChanged() override;
+ void onLanguageChanged() override;
+
void prepareMainLayout();
void prepareMoreOption();
void prepareSelectViews();
void setSelectMode(bool value);
void showSelectPopup();
void updateNoContent();
+ void updateLangInfo();
void insertItem(ListItem *item);
private:
prepareMoreOption();
preapareList();
updateNoContent();
+ App::getInst().getSysSettingsManager().addListener(*this);
}
SettingsBlockListFrame::~SettingsBlockListFrame()
{
+ App::getInst().getSysSettingsManager().removeListener(*this);
}
void SettingsBlockListFrame::setSelectMode(bool value)
m_pLayout->showMoreOption(!noContent);
}
+void SettingsBlockListFrame::updateLangInfo()
+{
+ m_pList->updateRealizedItems();
+ // TODO: update items
+}
+
void SettingsBlockListFrame::insertItem(ListItem *item)
{
if(m_pBottomItem && m_pBottomItem != item)
getParent().push(*frame);
}
+void SettingsBlockListFrame::onTimeFormatChanged()
+{
+ MSG_LOG("");
+}
+
+void SettingsBlockListFrame::onLanguageChanged()
+{
+ MSG_LOG("");
+ updateLangInfo();
+}
+