* @return true in case of restriction, false otherwise.
*/
virtual bool isRestrictedByDpm() const = 0;
+
+ /**
+ * @brief Get read status
+ * @return true if message is read, false otherwise
+ */
+ virtual bool isRead() const = 0;
};
}
msg_get_bool_value(m_MsgStruct, MSG_MESSAGE_DPM_RESTRICTED_BOOL, &restricted);
return restricted;
}
+
+bool MessagePrivate::isRead() const
+{
+ bool value = false;
+ msg_get_bool_value(m_MsgStruct, MSG_MESSAGE_READ_BOOL, &value);
+ return value;
+}
virtual Message::MessageStorageType getMessageStorageType() const;
virtual bool isMms() const;
virtual bool isRestrictedByDpm() const;
+ virtual bool isRead() const;
void setId(MsgId id);
void set(msg_struct_t msgStruct);
* @brief called when all messages has been deleted from current thread
*/
virtual void onAllConvItemsDeleted(ConvList &list) {};
+ virtual void onItemInserted(ConvListItem &item) {};
virtual void onSlideShow(MsgId id) {};
virtual void onEditDraftMsg(MsgId id) {};
virtual void onForwardMsg(MsgId id) {};
* @brief Returns message's time
*/
time_t getRawTime() const;
+
+ /**
+ * @brief Returns message read status
+ */
+ bool isRead() const;
+
void showPopup();
void setListener(IConvListItemListener *l);
BubbleEntityFactory &m_BubbleEntityFactory;
bool m_IsRestrictedByDpm;
bool m_IsNeededReadReport;
+ bool m_IsRead;
const std::string m_SearchWord;
};
m_pList->insertBeforeItem(*item, *m_pComposeItem);
else
m_pList->appendItem(*item);
+
updateSelectAllItem();
+
+ if (m_pListener)
+ m_pListener->onItemInserted(*item);
}
void ConvList::deleteItem(ConvListItem *item)
, m_BubbleEntityFactory(bubbleEntityFactory)
, m_IsRestrictedByDpm(false)
, m_IsNeededReadReport(false)
+ , m_IsRead(item.isRead())
, m_SearchWord(searchWord)
{
update(item);
updateTime();
m_Time = msg->getTime();
+ m_IsRead = msg->isRead();
m_NetworkStatus = msg->getNetworkStatus();
m_IsRestrictedByDpm = msg->isRestrictedByDpm();
clearEntityList();
BubbleBgViewItem::BgType bgType = getBubbleBgType(item);
+ m_IsRead = item.isRead();
m_MsgId = item.getMsgId();
m_IsDraft = item.isDraft();
m_Direction = item.getDirection();
return m_Time;
}
+bool ConvListItem::isRead() const
+{
+ return m_IsRead;
+}
+
void ConvListItem::setListener(IConvListItemListener *l)
{
m_pListener = l;
// IConvListListener:
virtual void onAllConvItemsDeleted(ConvList &list);
+ virtual void onItemInserted(ConvListItem &item);
virtual void onEditDraftMsg(MsgId id);
virtual void onForwardMsg(MsgId id);
virtual void onResendMsg(MsgId id);
// ISystemSettingsManager:
virtual void onLanguageChanged();
+ // Timer:
+ Eina_Bool onDeferredMarkAsRead();
+
private:
void create();
void setMode(Mode mode);
void updateRecipientArea();
void createMainLayout();
void markAsRead();
+ void deferredMarkAsRead();
void recipientClickHandler(const std::string &address);
void contactChangedHandler();
MsgAddressListRef getAddressList();
SettingsNetwork m_SettingsNetwork;
IConversationListener *m_pListener;
std::function<void()> m_TransFinishedFunc;
+ Ecore_Timer *m_pMarkAsReadTimer;
};
class IConversationListener {
, m_pConvList(nullptr)
, m_AttachPanel(getApp())
, m_pListener(nullptr)
+ , m_pMarkAsReadTimer(nullptr)
{
create();
}
ecore_idler_del(m_NnotifyConvertMsgTypeIdler);
m_NnotifyConvertMsgTypeIdler = nullptr;
}
- markAsRead();
+ if (m_pMarkAsReadTimer) {
+ ecore_timer_del(m_pMarkAsReadTimer);
+ m_pMarkAsReadTimer = nullptr;
+ }
}
void Conversation::execCmd(const AppControlComposeRef &cmd)
void Conversation::markAsRead()
{
+ MSG_LOG("");
// Warning thread and messages marks as read only for ConversationMode.
- if (m_ThreadId.isValid() && m_Mode == ConversationMode)
+ if (m_ThreadId.isValid() && m_Mode == ConversationMode) {
+ MSG_LOG("", m_ThreadId);
getMsgEngine().getStorage().setReadStatus(m_ThreadId);
+ }
+}
+
+void Conversation::deferredMarkAsRead()
+{
+ if (!isPause() && !m_pMarkAsReadTimer) {
+ const double minTimeForRead = 1 / 10.0;
+ ecore_timer_add(minTimeForRead, ECORE_TACK_CALLBACK(Conversation, onDeferredMarkAsRead), this);
+ }
}
void Conversation::recipientClickHandler(const std::string &address)
if (m_pConvList && updateConvList)
m_pConvList->setThreadId(m_ThreadId, searchWord);
- markAsRead();
+ deferredMarkAsRead();
updateNavibar();
updateActiveNotifPolicy();
checkAndSetMsgType(true);
m_pLayout->setConvList(*m_pConvList);
}
} else {
- if (m_pConvList)
- {
+ if (m_pConvList) {
m_pConvList->setListener(nullptr);
m_pConvList->destroy();
m_pConvList = nullptr;
m_pLayout->setRecipientRect(m_pRecipPanel->getAreaRect());
}
} else {
- if (m_pRecipPanel)
- {
+ if (m_pRecipPanel) {
m_pRecipPanel->destroy();
m_pRecipPanel = nullptr;
}
{
MSG_LOG("");
updateActiveNotifPolicy();
+ deferredMarkAsRead();
}
void Conversation::onHwBackButtonClicked()
}
}
+void Conversation::onItemInserted(ConvListItem &item)
+{
+ MSG_LOG("", item.isRead());
+ if (!item.isRead())
+ deferredMarkAsRead();
+}
+
void Conversation::onEditDraftMsg(MsgId id)
{
MSG_LOG("");
updateMsgInputPanel();
updateSelectMsgTitle();
}
+
+Eina_Bool Conversation::onDeferredMarkAsRead()
+{
+ if (!isPause())
+ markAsRead();
+ m_pMarkAsReadTimer = nullptr;
+ return false; // Delete Timer
+}