From: Denis Dolzhenko Date: Thu, 13 Apr 2017 08:27:49 +0000 (+0300) Subject: TizenRefApp-8366 Implement mark msg thread as read. X-Git-Tag: submit/tizen/20170427.124559~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F87%2F124987%2F1;p=profile%2Fwearable%2Fapps%2Fnative%2Fmessage.git TizenRefApp-8366 Implement mark msg thread as read. Change-Id: I35ae783280232a428b52cb12d1f89aba47e156ee Signed-off-by: Denis Dolzhenko --- diff --git a/src/Conversation/Controller/inc/ConvList.h b/src/Conversation/Controller/inc/ConvList.h index a0ac917..df064f2 100644 --- a/src/Conversation/Controller/inc/ConvList.h +++ b/src/Conversation/Controller/inc/ConvList.h @@ -76,6 +76,7 @@ namespace Msg { ConvListItem *insertItem(const MsgConversationItem &item); void demoteItem(ConvListItem &item); // move down existing item void clear(); + void markAsRead(); private: bool m_IsDeleteMode; diff --git a/src/Conversation/Controller/src/ConvList.cpp b/src/Conversation/Controller/src/ConvList.cpp index 847aa75..61448fe 100644 --- a/src/Conversation/Controller/src/ConvList.cpp +++ b/src/Conversation/Controller/src/ConvList.cpp @@ -243,9 +243,17 @@ void ConvList::setThreadId(ThreadId id) m_ThreadId = id; fillList(); updateTitle(); + markAsRead(); } } +void ConvList::markAsRead() +{ + if (m_ThreadId.isValid()) + getMsgStorage().setReadStatus(m_ThreadId); +} + + void ConvList::onListItemSelected(ListItem &listItem) { MSG_LOG(""); diff --git a/src/MsgThread/Controller/inc/ThreadList.h b/src/MsgThread/Controller/inc/ThreadList.h index 5cf52ba..6e75c82 100644 --- a/src/MsgThread/Controller/inc/ThreadList.h +++ b/src/MsgThread/Controller/inc/ThreadList.h @@ -54,7 +54,7 @@ namespace Msg { // IMsgStorageListener: void onMsgStorageThreadUpdate(const ThreadId &threadId) override; void onMsgStorageThreadInsert(const ThreadId &threadId) override; - void onMsgStorageThreadDelete(const ThreadId &threadId) override;; + void onMsgStorageThreadDelete(const ThreadId &threadId) override; // IContactManagerListener: void onContactChanged() override; diff --git a/src/MsgThread/Controller/src/ThreadList.cpp b/src/MsgThread/Controller/src/ThreadList.cpp index 8a8c93f..a102dc2 100644 --- a/src/MsgThread/Controller/src/ThreadList.cpp +++ b/src/MsgThread/Controller/src/ThreadList.cpp @@ -71,7 +71,6 @@ void ThreadList::setDeleteMode(bool value) if (m_DeleteMode != value) { m_DeleteMode = value; setCheckMode(value); - ThreadListViewItem::resetCheckMode(*this); checkAllItems(false, true); if (m_ComposeItem) m_ComposeItem->disabled(value); @@ -227,7 +226,7 @@ void ThreadList::deleteItems() void ThreadList::navigateTo(ThreadListItem &item) { - ListView::showItem(item, ELM_GENLIST_ITEM_SCROLLTO_TOP); + ListView::showItem(item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE); } void ThreadList::updateItems(const MsgIdList &idList) diff --git a/src/MsgThread/View/inc/ThreadListViewItem.h b/src/MsgThread/View/inc/ThreadListViewItem.h index 02975e8..2010a65 100644 --- a/src/MsgThread/View/inc/ThreadListViewItem.h +++ b/src/MsgThread/View/inc/ThreadListViewItem.h @@ -36,7 +36,6 @@ namespace Msg { void setState(State state, bool updateUi); State getState() const; - static void resetCheckMode(ListView &listView); protected: virtual std::string getName() = 0; diff --git a/src/MsgThread/View/src/ThreadListViewItem.cpp b/src/MsgThread/View/src/ThreadListViewItem.cpp index e6c41fb..5523b5d 100644 --- a/src/MsgThread/View/src/ThreadListViewItem.cpp +++ b/src/MsgThread/View/src/ThreadListViewItem.cpp @@ -63,7 +63,7 @@ Evas_Object *ThreadListViewItem::getContent(ListItem &item, const char *part) { Evas_Object *content = nullptr; - if (!strcmp(part, iconPart) || !strcmp(part, iconPaddingPart)) + if (m_State == IconState && (!strcmp(part, iconPart) || !strcmp(part, iconPaddingPart))) content = makeUnreadIcon(getUnreadCount()); return content; @@ -100,8 +100,3 @@ Evas_Object *ThreadListViewItem::makeUnreadIcon(const std::string &text) const evas_object_show(icon); return icon; } - -void ThreadListViewItem::resetCheckMode(ListView &listView) -{ - // TODO: impl if needed. -}