Add isSpam() method to Message model.
Change-Id: I1644b0c845287e130d379a51a71140e8e01c17ed
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
std::unique_ptr<ConnectivityChecker> m_ConnectivityChecker;
Ecore_Job *m_pExitJob;
};
+
+ template<typename T>
+ inline T *NaviFrameController::findTopFrame() const
+ {
+ auto items = getItems();
+ for (auto item = items.rbegin(); item != items.rend(); ++item) {
+ T *frame = dynamic_cast<T*>(*item);
+ if (frame)
+ return frame;
+ }
+ return nullptr;
+ }
}
#endif /* NaviFrameController_h_ */
return;
AppControlDefault::DefaultType type = cmd->getDefaultType();
+
+ MSG_LOG("getDefaultType: ", type);
auto *thread = findTopFrame<MsgThreadFrame>(); // Check if thread is open
if (!thread)
insertToBottom(*new MsgThreadFrame(*this)); // Push thread list to the bottom
+ // TODO: Temporarily disabled
+ /*
if (type != AppControlDefault::MainType) {
MessageRef msg = App::getInst().getMsgEngine().getStorage().getMessage(cmd->getMessageId()); //To avoid opening conversation if MsgId is invalid
if (msg) {
}
}
}
+ */
}
void NaviFrameController::execCmd(const AppControlComposeRef &cmd)
}
}
-template<typename T>
-T *NaviFrameController::findTopFrame() const
-{
- auto items = getItems();
- for (auto item = items.rbegin(); item != items.rend(); ++item) {
- T *frame = dynamic_cast<T*>(*item);
- if (frame)
- return frame;
- }
- return nullptr;
-}
-
FrameController *NaviFrameController::getTopFrame() const
{
return static_cast<FrameController*>(NaviFrameView::getTopFrame());
* @return true in case of restriction, false otherwise.
*/
virtual bool isRestrictedByDpm() const = 0;
+
+ /**
+ * @brief Checks whether message is draft or not.
+ * @return true if message is draft, false otherwise.
+ */
+ virtual bool isDraft() const = 0;
+
+ /**
+ * @brief Checks whether is spam or not.
+ * @return true if message is spam, false otherwise.
+ */
+ virtual bool isSpam() const = 0;
};
}
*/
virtual bool isDraft() const = 0;
+ /**
+ * @brief Checks whether conversation-item is related to spam message or not.
+ * @return true if message is spam, false otherwise.
+ */
+ virtual bool isSpam() const = 0;
+
/**
* @brief Checks whether conversation-item is related to read message or not.
* @return true if message is read, false otherwise.
{
return false;
}
+
+bool MessageDummy::isDraft() const
+{
+ return false;
+}
+
+bool MessageDummy::isSpam() const
+{
+ return false;
+}
virtual Message::MessageStorageType getMessageStorageType() const;
virtual bool isMms() const;
virtual bool isRestrictedByDpm() const;
+ virtual bool isDraft() const;
+ virtual bool isSpam() const;
void setId(MsgId id);
virtual void commit();
return false;
}
+bool MsgConversationItemDummy::isSpam() const
+{
+ return false;
+}
+
bool MsgConversationItemDummy::isRead() const
{
return true;
virtual Message::Type getType() const;
virtual Message::NetworkStatus getNetworkStatus() const;
virtual bool isDraft() const;
+ virtual bool isSpam() const;
virtual bool isRead() const;
virtual int getPagesCount() const;
virtual int getAttachCount() const;
bool MessagePrivate::isRestrictedByDpm() const
{
- bool restricted = false;
- msg_get_bool_value(m_MsgStruct, MSG_MESSAGE_DPM_RESTRICTED_BOOL, &restricted);
- return restricted;
+ bool res = false;
+ msg_get_bool_value(m_MsgStruct, MSG_MESSAGE_FOLDER_ID_INT, &res);
+ return res;
+}
+
+bool MessagePrivate::isDraft() const
+{
+ int folder = 0;
+ msg_get_int_value(m_MsgStruct, MSG_CONV_MSG_FOLDER_ID_INT, &folder);
+ return folder == MSG_DRAFT_ID;
+}
+
+bool MessagePrivate::isSpam() const
+{
+ int folder = 0;
+ msg_get_int_value(m_MsgStruct, MSG_CONV_MSG_FOLDER_ID_INT, &folder);
+ return folder == MSG_SPAMBOX_ID;
}
virtual Message::MessageStorageType getMessageStorageType() const;
virtual bool isMms() const;
virtual bool isRestrictedByDpm() const;
+ virtual bool isDraft() const;
+ virtual bool isSpam() const;
void setId(MsgId id);
void set(msg_struct_t msgStruct);
{
int folder = 0;
msg_get_int_value(m_MsgStruct, MSG_CONV_MSG_FOLDER_ID_INT, &folder);
- return (folder == MSG_DRAFT_ID);
+ return folder == MSG_DRAFT_ID;
+}
+
+bool MsgConversationItemPrivate::isSpam() const
+{
+ int folder = 0;
+ msg_get_int_value(m_MsgStruct, MSG_CONV_MSG_FOLDER_ID_INT, &folder);
+ return folder == MSG_SPAMBOX_ID;
}
bool MsgConversationItemPrivate::isRead() const
virtual Message::Type getType() const;
virtual Message::NetworkStatus getNetworkStatus() const;
virtual bool isDraft() const;
+ virtual bool isSpam() const;
virtual bool isRead() const;
virtual int getPagesCount() const;
virtual int getAttachCount() const;
{
}
-
MsgThreadListRef MsgStoragePrivate::getThreadList()
{
MsgThreadListRef res;
};
private:
- // NaviFrameItem:
+ // Frame:
void onAttached(ViewItem &item) override;
+ void onPause() override;
+ void onResume() override;
// HW button:
void onHwBackButtonPreessed(Evas_Object *obj, void *event);
void navigateToBottom();
bool isEmpty() const;
const Recipient &getRecip() const;
+ void markAsRead();
private:
typedef std::unordered_map<MsgId::Type, ConvListItem*> ConvListItemMap;
ConvListItem *insertItem(const MsgConversationItem &item);
void demoteItem(ConvListItem &item); // move down existing item
void clear();
- void markAsRead();
void resendMsg(ConvListItem &listItem);
private:
setContent(*m_pLayout);
}
+void ConvFrame::onPause()
+{
+ MSG_LOG("");
+}
+
+void ConvFrame::onResume()
+{
+ MSG_LOG("");
+ if (m_pList)
+ m_pList->markAsRead();
+}
+
void ConvFrame::onHwBackButtonPreessed(Evas_Object *obj, void *event)
{
MSG_LOG("");
#include "ContactManager.h"
#include "Recipient.h"
#include "TimeUtils.h"
+#include "NaviFrameController.h"
using namespace Msg;
void ConvList::markAsRead()
{
- if (m_ThreadId.isValid())
+ auto topFrame = App::getInst().getNavigation().getTopFrame();
+ bool isActive = topFrame && !topFrame->isPause();
+ if (m_ThreadId.isValid() && isActive)
getMsgStorage().setReadStatus(m_ThreadId);
}
continue;
MessageRef msg = getMsgStorage().getMessage(msgId);
- if (msg && msg->getThreadId() == m_ThreadId && msg->getMessageStorageType() != Message::MS_Sim) {
+ if (msg && msg->getThreadId() == m_ThreadId) {
MsgConversationItemRef item = getMsgStorage().getConversationItem(msgId);
if (item)
lastInsertedItem = insertItem(*item);