Refact. update item in ThreadList. 13/91213/3 submit/tizen/20161006.125030
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Thu, 6 Oct 2016 09:02:06 +0000 (12:02 +0300)
committerAndrey Klimenko <and.klimenko@samsung.com>
Thu, 6 Oct 2016 11:37:13 +0000 (04:37 -0700)
Added: promote method to ListView.

Change-Id: I7a6b60408acfb89f654aee0d8f53fab20a999e7a
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
src/Common/View/inc/ListView.h
src/Common/View/src/ListView.cpp
src/MsgThread/Controller/inc/ThreadList.h
src/MsgThread/Controller/src/ThreadList.cpp

index e48f629..a72aa40 100644 (file)
@@ -196,6 +196,12 @@ namespace Msg
             void demoteItem(ListItem &item);
 
             /**
+             * @brief Promotes specified list-view item to the begin of the list.
+             * @param[in] item an item to be promoted.
+             */
+            void promoteItem(ListItem &item);
+
+            /**
              * @brief Set filter for items
              * @param[in] key The filter key
              */
index d5e6dc2..43bac5c 100644 (file)
@@ -233,6 +233,11 @@ void ListView::demoteItem(ListItem &item)
     elm_genlist_item_demote(item);
 }
 
+void ListView::promoteItem(ListItem &item)
+{
+    elm_genlist_item_promote(item);
+}
+
 void ListView::setFilter(void *key)
 {
     elm_genlist_filter_set(getEo(), key);
index a0631a4..c32a328 100644 (file)
@@ -74,6 +74,7 @@ namespace Msg
             void deleteItems();
             void updateItems(const MsgIdList &idList);
             void updateItems();
+            void update(ThreadListItem &item);
             void insertItem(const MsgThreadItem &msgThreadItem);
             void insertItem(ThreadId id);
             ThreadListItem *getItem(ThreadId id) const;
index 9e63e10..fecf8b8 100644 (file)
@@ -244,10 +244,10 @@ void ThreadList::updateItems(const MsgIdList &idList)
     auto threadIdSet = getThreadIdSet(idList);
     auto threadItems = getItems<ThreadListItem>();
 
-    for(ThreadListItem *threadListItem: threadItems)
+    for(ThreadListItem *item: threadItems)
     {
-        if(threadIdSet.count(threadListItem->getThreadId()))
-            threadListItem->update();
+        if(threadIdSet.count(item->getThreadId()))
+            update(*item);
     }
 
     updateRealizedItems();
@@ -258,12 +258,26 @@ void ThreadList::updateItems()
     auto items = getItems<ThreadListItem>();
     for(ThreadListItem *item: items)
     {
-        item->update();
+        update(*item);
     }
 
     updateRealizedItems();
 }
 
+void ThreadList::update(ThreadListItem &item)
+{
+    time_t time = item.getRawTime();
+    item.update();
+    if(item.getRawTime() < time)
+    {
+        // TODO: JIRA issue TSAM-8683
+    }
+    else if(item.getRawTime() > time)
+    {
+        // TODO: JIRA issue TSAM-8683
+    }
+}
+
 std::set<ThreadId> ThreadList::getThreadIdSet(const MsgIdList &idList)
 {
     std::set<ThreadId> res;
@@ -312,7 +326,7 @@ void ThreadList::onMsgStorageInsert(const MsgIdList &msgIdList)
         ThreadListItem *item = getItem(id);
         if(item)
         {
-            item->update();
+            update(*item);
             updated = true;
         }
         else