, m_ThumbId(m_App.getThumbnailMaker().getThumbId(ThumbnailMaker::SingleThumb))
, m_RawTime()
{
-
}
BaseThreadListItem::~BaseThreadListItem()
{
-
}
void BaseThreadListItem::updateMessage(const MsgThreadItem &threadItem)
void BaseThreadListItem::updateThumbnailAndName(const MsgThreadItem &threadItem, bool decorateName)
{
const MsgAddressListRef addressList = m_App.getMsgEngine().getStorage().getAddressList(threadItem.getId());
- if(addressList)
+ if (addressList)
updateThumbnailAndName(*addressList, decorateName);
}
void BaseThreadListItem::updateThumbnailAndName(const MsgAddressList &addressList, bool decorateName)
{
int countContact = addressList.getLength();
- if(countContact <= 0)
+ if (countContact <= 0)
{
MSG_LOG_WARN("Msg address list is empty");
return;
const MsgAddress &addr = addressList[0];
- if(countContact > 1)
+ if (countContact > 1)
{
m_ThumbId = m_App.getThumbnailMaker().getThumbId(ThumbnailMaker::GroupThumb);
updateName(addr, countContact, decorateName);
- }
- else if(countContact == 1)
- {
+ } else if (countContact == 1) {
m_ThumbId = m_App.getThumbnailMaker().getThumbId(addr);
updateName(addr, countContact, decorateName);
}
void BaseThreadListItem::updateName(const MsgAddress &address, int addressesCount, bool decorateName)
{
ContactAddressRef contactAddress = m_App.getContactManager().getContactAddress(address.getAddress());
- if(contactAddress)
+ if (contactAddress)
updateName(*contactAddress, addressesCount, decorateName);
else
updateName(address.getAddress(), addressesCount, decorateName);
void BaseThreadListItem::updateName(const ContactAddress &address, int addressesCount, bool decorateName)
{
std::string dispName = address.getDispName();
- if(dispName.empty())
+ if (dispName.empty())
dispName = address.getAddress();
updateName(dispName, addressesCount, decorateName);
}
{
m_Name = address;
--addressesCount;
- if(addressesCount > 0)
+ if (addressesCount > 0)
m_Name += " +" + std::to_string(addressesCount);
- if(decorateName)
+ if (decorateName)
m_Name = decorateNameText(m_Name);
}
void MsgThread::prepareSearchPanel()
{
- if(!m_pSearchPanel)
+ if (!m_pSearchPanel)
{
m_pSearchPanel = new MsgThreadSearchPanel(*m_pLayout);
m_pSearchPanel->setListener(this);
void MsgThread::prepareSearchList()
{
- if(!m_pSearchList)
+ if (!m_pSearchList)
{
m_pSearchList = new ThreadSearchList(*m_pLayout, getApp());
m_pSearchList->setListener(this);
void MsgThread::prepareNoContentLayout()
{
- if(!m_pNoContent)
+ if (!m_pNoContent)
{
m_pNoContent = new NoContentLayout(*m_pLayout);
m_pNoContent->show();
void MsgThread::prepareThreadList()
{
- if(!m_pThreadList)
+ if (!m_pThreadList)
{
m_pThreadList = new ThreadList(*m_pLayout, getApp());
m_pThreadList->setListener(this);
{
Conversation *frame = new Conversation(getParent());
frame->setThreadId(threadId, searchWord.c_str());
- if(msgId.isValid())
+ if (msgId.isValid())
frame->navigateTo(msgId);
else
frame->navigateToBottom();
void MsgThread::setMode(Mode mode)
{
- if(m_Mode == mode)
+ if (m_Mode == mode)
return;
NaviBar::NaviColorId colorId = mode == SearchMode ? NaviBar::NaviWhiteColorId : NaviBar::NaviBlueColorId;
getNaviBar().setColor(colorId);
setNormalMode();
- switch(mode)
+ switch (mode)
{
case NormalMode:
break;
MSG_LOG("");
getNaviBar().clear();
// Reset previus mode:
- switch(m_Mode)
+ switch (m_Mode)
{
case DeleteMode:
setDeleteMode(false);
{
MSG_LOG("");
- if(value)
+ if (value)
m_Mode = DeleteMode;
NaviBar &naviBar = getNaviBar();
naviBar.showButton(NaviOkButtonId, value);
- if(value)
+ if (value)
{
m_pLayout->showFloatingButton(false);
updateSelectItemsTitle();
MSG_LOG("");
getNaviBar().showButton(NaviPrevButtonId, value);
- if(value)
+ if (value)
{
m_pLayout->showFloatingButton(false);
prepareSearchList();
getNaviBar().showSearch();
m_pNoContent->setText(msgt("IDS_MSG_NPBODY_NO_RESULTS_FOUND_ABB"));
m_pNoContent->setHelpText();
- }
- else
- {
- if(m_pSearchList)
+ } else {
+ if (m_pSearchList)
m_pSearchList->cancelSearch();
getNaviBar().hideSearch();
}
update();
- if(m_pSearchPanel)
+ if (m_pSearchPanel)
m_pSearchPanel->setEntryFocus(value);
}
void MsgThread::update()
{
bool searchEnabled = m_Mode == SearchMode;
- if(searchEnabled)
+ if (searchEnabled)
{
bool showSearch = !m_pSearchList->isEmpty();
bool showThread = !showSearch && !m_pThreadList->isEmpty() && m_pSearchList->getSearchWord().empty();
m_pLayout->showThreadList(showThread);
m_pLayout->showNoContent(showNoContent);
- }
- else
- {
+ } else {
bool showThread = !m_pThreadList->isEmpty();
m_pLayout->showThreadList(showThread);
m_pLayout->showNoContent(!showThread);
void MsgThread::updateSelectItemsTitle()
{
- if(m_Mode == DeleteMode)
+ if (m_Mode == DeleteMode)
{
int checked = m_pThreadList->getThreadsCheckedCount();
- if(checked > 0)
+ if (checked > 0)
getNaviBar().setTitle(msgArgs("IDS_MSG_HEADER_PD_SELECTED_ABB3", checked));
else
getNaviBar().setTitle(msgt("IDS_MSG_HEADER_SELECT_ITEMS_ABB3"));
void MsgThread::search(const std::string &searchWord)
{
- if(m_Mode == SearchMode && m_pSearchList)
+ if (m_Mode == SearchMode && m_pSearchList)
m_pSearchList->requestSearch(searchWord);
}
void MsgThread::onHwBackButtonClicked()
{
MSG_LOG("");
- if(m_Mode == SearchMode || m_Mode == DeleteMode)
+ if (m_Mode == SearchMode || m_Mode == DeleteMode)
setMode(NormalMode);
else
pop();
void MsgThread::onHwMoreButtonClicked()
{
MSG_LOG("");
- if(m_Mode == NormalMode)
+ if (m_Mode == NormalMode)
showMainPopup();
}
void MsgThread::onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId)
{
MSG_LOG("NaviButton id:", buttonId);
- if(buttonId == NaviOkButtonId)
+ if (buttonId == NaviOkButtonId)
m_pThreadList->deleteSelectedItems();
setMode(NormalMode);
}
{
MSG_LOG("");
MessageRef msg = getMsgEngine().getStorage().getMessage(id);
- if(msg)
+ if (msg)
navigateToConversation(msg->getThreadId(), id, searchWord);
}
void ThreadList::deleteSelectedItems()
{
auto items = getItems<ThreadListItem>();
- for(ThreadListItem *it : items)
+ for (ThreadListItem *it : items)
{
- if(it->getCheckedState())
+ if (it->getCheckedState())
m_App.getMsgEngine().getStorage().deleteThread(it->getThreadId());
}
}
{
auto items = getItems<ThreadListItem>();
int count = 0;
- for(ThreadListItem *item : items)
+ for (ThreadListItem *item : items)
{
- if(item->isCheckable() && item->getCheckedState())
+ if (item->isCheckable() && item->getCheckedState())
++count;
}
return count;
{
SelectAllListItem *item = dynamic_cast<SelectAllListItem*>(getFirstItem());
- if(show)
+ if (show)
{
- if(!item)
+ if (!item)
{
item = new SelectAllListItem;
prependItem(*item);
}
- if(item && resetCheck)
+ if (item && resetCheck)
item->setCheckedState(false, true);
- }
- else
- {
- if(item)
+ } else {
+ if (item)
item->destroy();
}
}
{
// Simple impl. but not fast:
auto items = getItems<ThreadListItem>();
- for(ThreadListItem *item : items)
+ for (ThreadListItem *item : items)
{
- if(item->isCheckable() && !item->getCheckedState())
+ if (item->isCheckable() && !item->getCheckedState())
return false;
}
return true;
void ThreadList::updateSelectAllItem()
{
- if(!m_DeleteMode)
+ if (!m_DeleteMode)
return;
bool allChecked = isAllThreadListItemChecked();
SelectAllListItem *selectAllItem = dynamic_cast<SelectAllListItem*>(getFirstItem());
- if(selectAllItem)
+ if (selectAllItem)
selectAllItem->setCheckedState(allChecked, true);
}
{
bool checked = item.getCheckedState();
checkAllItems(checked);
- if(m_pListener)
+ if (m_pListener)
m_pListener->onThreadListItemChecked();
}
ThreadId threadId = item.getThreadId();
MSG_LOG("Checked (id : state) = ", threadId, ":", item.getCheckedState());
updateSelectAllItem();
- if(m_pListener)
+ if (m_pListener)
m_pListener->onThreadListItemChecked();
}
int ThreadList::cmpFunc(const ListItem &item1, const ListItem &item2)
{
- if(isSelectAll(&item1))
+ if (isSelectAll(&item1))
return 0;
- if(isSelectAll(&item2))
+ if (isSelectAll(&item2))
return 1;
auto &threadItem1 = static_cast<const ThreadListItem&>(item1);
void ThreadList::insertItem(ThreadId id)
{
MsgThreadItemRef threadItem = m_App.getMsgEngine().getStorage().getThread(id);
- if(threadItem)
+ if (threadItem)
{
auto newItem = new ThreadListItem(*threadItem, m_App);
ListView::sortedInsertItem(*newItem);
ThreadListItem *ThreadList::getItem(ThreadId id) const
{
auto items = ListView::getItems<ThreadListItem>();
- for(ThreadListItem *item : items)
+ for (ThreadListItem *item : items)
{
- if(item->getThreadId() == id)
+ if (item->getThreadId() == id)
return item;
}
return nullptr;
void ThreadList::fillList()
{
MsgThreadListRef msgThreadList = m_App.getMsgEngine().getStorage().getThreadList();
- if(!msgThreadList)
+ if (!msgThreadList)
return;
int length = msgThreadList->getLength();
- for(int i = 0; i < length; ++i)
+ for (int i = 0; i < length; ++i)
{
const MsgThreadItem &msgThreadItem = msgThreadList->at(i);
ListView::appendItem(*new ThreadListItem(msgThreadItem, m_App));
void ThreadList::deleteItems()
{
MsgThreadListRef msgThreadList = m_App.getMsgEngine().getStorage().getThreadList();
- if(!msgThreadList)
+ if (!msgThreadList)
return;
std::set<ThreadId> threadIdSet;
int length = msgThreadList->getLength();
- for(int i = 0; i < length; ++i)
+ for (int i = 0; i < length; ++i)
{
const MsgThreadItem &msgThreadItem = msgThreadList->at(i);
threadIdSet.insert(msgThreadItem.getId());
auto items = ListView::getItems<ThreadListItem>();
- for(ThreadListItem *item : items)
+ for (ThreadListItem *item : items)
{
- if(threadIdSet.count(item->getThreadId()) == 0)
+ if (threadIdSet.count(item->getThreadId()) == 0)
ListView::deleteItem(*item);
}
auto threadIdSet = getThreadIdSet(idList);
auto threadItems = getItems<ThreadListItem>();
- for(ThreadListItem *item: threadItems)
+ for (ThreadListItem *item: threadItems)
{
- if(threadIdSet.count(item->getThreadId()))
+ if (threadIdSet.count(item->getThreadId()))
updateItem(*item);
}
}
void ThreadList::updateItems()
{
auto items = getItems<ThreadListItem>();
- for(ThreadListItem *item: items)
+ for (ThreadListItem *item: items)
{
updateItem(*item);
}
void ThreadList::updateItem(ThreadListItem &item)
{
MsgThreadItemRef msgThread = m_App.getMsgEngine().getStorage().getThread(item.getThreadId());
- if(!msgThread)
+ if (!msgThread)
{
MSG_LOG_ERROR("msgThread is null");
return;
ThreadListItem *prev = getPrevItem<ThreadListItem>(item);
time_t threadTime = msgThread->getTime();
- if((next && threadTime < next->getRawTime()) ||
+ if ((next && threadTime < next->getRawTime()) ||
(prev && threadTime > prev->getRawTime()))
{
auto newItem = new ThreadListItem(*msgThread, m_App);
item.destroy();
ListView::sortedInsertItem(*newItem);
navigateTo(*newItem);
- }
- else
- {
+ } else {
item.update(*msgThread, true);
navigateTo(item);
}
std::set<ThreadId> ThreadList::getThreadIdSet(const MsgIdList &idList)
{
std::set<ThreadId> res;
- for(MsgId msgId : idList)
+ for (MsgId msgId : idList)
{
ThreadId threadId = m_App.getMsgEngine().getStorage().getThreadId(msgId);
- if(threadId.isValid())
+ if (threadId.isValid())
res.insert(threadId);
}
return res;
{
MSG_LOG("");
ThreadListItem *it = dynamic_cast<ThreadListItem*>(&listItem);
- if(it && m_pListener)
+ if (it && m_pListener)
m_pListener->onListItemSelected(it->getThreadId());
}
void ThreadList::onListItemChecked(ListItem &listItem)
{
MSG_LOG("");
- if(ThreadListItem *it = dynamic_cast<ThreadListItem*>(&listItem))
+ if (ThreadListItem *it = dynamic_cast<ThreadListItem*>(&listItem))
checkHandler(*it);
- else if(SelectAllListItem *it = isSelectAll(&listItem))
+ else if (SelectAllListItem *it = isSelectAll(&listItem))
checkHandler(*it);
}
{
MSG_LOG("");
auto* item = getItem(threadId);
- if(item)
+ if (item)
updateItem(*item);
}
MSG_LOG("");
insertItem(threadId);
updateSelectAllItem();
- if(m_pListener)
+ if (m_pListener)
m_pListener->onThreadListChanged();
}
{
MSG_LOG("");
auto* thread = getItem(threadId);
- if(thread)
+ if (thread)
{
ListView::deleteItem(*thread);
updateSelectAllItem();
}
- if(m_pListener)
+ if (m_pListener)
m_pListener->onThreadListChanged();
}
{
MSG_LOG("");
auto items = ListView::getItems<ThreadListItem>();
- for(ThreadListItem *item : items)
+ for (ThreadListItem *item : items)
{
item->updateTime();
}
State state = NormalState;
MsgConversationListRef convList = m_App.getMsgEngine().getStorage().getConversationList(m_ThreadId);
- if(convList && convList->getLength() > 0)
+ if (convList && convList->getLength() > 0)
{
MsgConversationItem &item = convList->at(convList->getLength() - 1);
Message::NetworkStatus status = item.getNetworkStatus();
- if(status == Message::NS_Sending)
+ if (status == Message::NS_Sending)
{
state = StatusState;
m_Status = decorateSendingText(msg("IDS_MSG_BODY_SENDING_ING_M_STATUS_ABB"));
- }
- else if(status == Message::NS_Send_Fail)
- {
+ } else if (status == Message::NS_Send_Fail) {
state = StatusState;
m_Status = decorateFailedText(msg("IDS_MSG_BODY_FAILED_M_STATUS_ABB2"));
- }
- else if(item.isDraft())
- {
+ } else if (item.isDraft()) {
state = StatusState;
m_Status = decorateDraftText(msg("IDS_MSG_BODY_DRAFT_M_STATUS_ABB"));
- }
- else if(!item.isRead() && item.getDirection() == Message::MD_Received)
- {
+ } else if (!item.isRead() && item.getDirection() == Message::MD_Received) {
int count = threadItem.getUnreadCount();
- if(count > 0)
+ if (count > 0)
{
state = IconState;
m_UnreadCount = std::to_string(count);
updateThumbnailAndName(threadItem, true);
updateTime(threadItem.getTime());
- if(updateUi)
+ if (updateUi)
ListItem::update();
}
void ThreadSearchList::requestSearch(const std::string &searchWord)
{
m_SearchWord = searchWord;
- if(!m_pIdler)
+ if (!m_pIdler)
{
m_pIdler = ecore_idler_add
(
self->search();
return false; // Delete idler
},
- this
- );
+ this);
}
}
void ThreadSearchList::cancelSearch()
{
- if(m_pIdler)
+ if (m_pIdler)
{
ecore_idler_del(m_pIdler);
m_pIdler = nullptr;
MSG_LOG("Search word: ", m_SearchWord);
ListView::clear();
- if(!m_SearchWord.empty())
+ if (!m_SearchWord.empty())
{
MsgStorage &msgSotrage = m_App.getMsgEngine().getStorage();
// Thread:
MsgThreadListRef threadList = msgSotrage.searchThread(m_SearchWord);
- if(threadList)
+ if (threadList)
{
int length = threadList->getLength();
- for(int i = 0; i < length; ++i)
+ for (int i = 0; i < length; ++i)
{
const MsgThreadItem &threadItem = threadList->at(i);
ListView::appendItem(*new ThreadSearchListItem(m_App, threadItem, m_SearchWord));
// Message:
MessageListRef msgList = msgSotrage.searchMessage(m_SearchWord);
- if(msgList)
+ if (msgList)
{
int length = msgList->getLength();
- for(int i = 0; i < length; ++i)
+ for (int i = 0; i < length; ++i)
{
const Message &msg = msgList->at(i);
ListView::appendItem(*new MsgSearchListItem(m_App, msg, m_SearchWord));
}
}
- if(m_pListener)
+ if (m_pListener)
m_pListener->onSearchListChanged();
}
void ThreadSearchList::updateTime()
{
auto items = ListView::getItems<BaseThreadListItem>();
- for(BaseThreadListItem *item : items)
+ for (BaseThreadListItem *item : items)
{
item->updateTime();
}
void ThreadSearchList::onListItemSelected(ListItem &listItem)
{
- if(m_pListener)
+ if (m_pListener)
{
- if(auto it = dynamic_cast<MsgSearchListItem*>(&listItem))
+ if (auto it = dynamic_cast<MsgSearchListItem*>(&listItem))
m_pListener->onSearchListItemSelected(it->getMsgId(), m_SearchWord);
- else if(auto it = dynamic_cast<ThreadSearchListItem*>(&listItem))
+ else if (auto it = dynamic_cast<ThreadSearchListItem*>(&listItem))
m_pListener->onSearchListItemSelected(it->getThreadId());
}
}
ThreadSearchListItem::~ThreadSearchListItem()
{
-
}
ThreadId ThreadSearchListItem::getThreadId() const
private:
Evas_Object *m_pLayout;
-
};
}
void FloatingButton::pressed(Evas_Object *obj, void *event_info)
{
- if(m_pListener)
+ if (m_pListener)
{
m_pListener->onFloatingButtonPressed();
}
MsgThreadLayout::~MsgThreadLayout()
{
-
}
void MsgThreadLayout::create(Evas_Object *parent)
MsgThreadSearchPanel::~MsgThreadSearchPanel()
{
- if(m_pEntryJob)
+ if (m_pEntryJob)
{
ecore_job_del(m_pEntryJob);
m_pEntryJob = nullptr;
std::string res;
const char *plainText = elm_entry_entry_get(m_pEntry);
- if(plainText)
+ if (plainText)
{
char *text = elm_entry_markup_to_utf8(elm_entry_entry_get(m_pEntry));
- if(text)
+ if (text)
{
res.assign(text);
free(text);
void MsgThreadSearchPanel::setEntryFocus(bool focus)
{
m_EntryFocus = focus;
- if(!m_pEntryJob)
+ if (!m_pEntryJob)
m_pEntryJob = ecore_job_add(onPostponedEntryFocus, this);
}
void MsgThreadSearchPanel::onEntryChanged(Evas_Object *obj, void *eventInfo)
{
showClearButton(!isEmpty());
- if(m_pListener)
+ if (m_pListener)
m_pListener->onEntryChanged(*this);
}
void MsgThreadSearchPanel::onKeyDown(Evas_Object *obj, void *eventInfo)
{
-
}
std::string ThreadListViewItem::getText(ListItem &item, const char *part)
{
- if(!strcmp(part, messagePart))
+ if (!strcmp(part, messagePart))
{
return getMessage();
- }
- else if(!strcmp(part, namePart))
- {
+ } else if (!strcmp(part, namePart)) {
return getName();
- }
- else if(!strcmp(part, timePart))
- {
+ } else if (!strcmp(part, timePart)) {
return getTime();
- }
- else if(!strcmp(part, statusPart))
- {
- if(m_State == StatusState)
+ } else if (!strcmp(part, statusPart)) {
+ if (m_State == StatusState)
return getStatus();
}
{
Evas_Object *content = nullptr;
- if(!strcmp(part, thumbnailPart))
+ if (!strcmp(part, thumbnailPart))
{
content = getThumbnail();
- }
- else if(!strcmp(part, iconPart))
- {
- if(m_State == IconState)
+ } else if (!strcmp(part, iconPart)) {
+ if (m_State == IconState)
{
content = getIcon();
}
void ThreadListViewItem::setState(State state, bool updateUi)
{
m_State = state;
- if(updateUi)
+ if (updateUi)
{
updateFields(iconPart, ELM_GENLIST_ITEM_FIELD_CONTENT);
updateFields(statusPart, ELM_GENLIST_ITEM_FIELD_TEXT);
Evas_Object *ThreadListViewItem::makeUnreadIcon(const std::string &text) const
{
- if(text.empty())
+ if (text.empty())
return nullptr;
Evas_Object *icon = View::addLayout(*getOwner(), ICONS_EDJ_PATH, "badge");
elm_object_part_text_set(icon, "elm.text.count", text.c_str());
void ThreadListViewItem::resetCheckMode(ListView &listView)
{
- for(ListItem *item: listView.getRealizedItems())
+ for (ListItem *item: listView.getRealizedItems())
{
item->emitSignal("elm,state,reset_check", "elm");
}