Fixed the initial fill of the friends in the contact sidebar in the MessageComposer. Now the correct state image of the friend is shown.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3929 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-12-22 01:11:19 +00:00
parent 719c0ec30d
commit 9715066181

View File

@ -540,6 +540,9 @@ void MessageComposer::insertSendList()
std::list<std::string>::iterator peerIt; std::list<std::string>::iterator peerIt;
rsPeers->getFriendList(peers); rsPeers->getFriendList(peers);
std::list<StatusInfo> statusInfo;
rsStatus->getStatusList(statusInfo);
std::list<std::string> fillPeerIds; std::list<std::string> fillPeerIds;
// start with groups // start with groups
@ -600,7 +603,6 @@ void MessageComposer::insertSendList()
// add equal too, its no problem // add equal too, its no problem
fillPeerIds.push_back(detail.id); fillPeerIds.push_back(detail.id);
/* make a widget per friend */ /* make a widget per friend */
QTreeWidgetItem *item = new RSTreeWidgetItem(m_compareRole, TYPE_SSL); QTreeWidgetItem *item = new RSTreeWidgetItem(m_compareRole, TYPE_SSL);
@ -611,8 +613,17 @@ void MessageComposer::insertSendList()
int state = RS_STATUS_OFFLINE; int state = RS_STATUS_OFFLINE;
if (detail.state & RS_PEER_STATE_CONNECTED) { if (detail.state & RS_PEER_STATE_CONNECTED) {
std::list<StatusInfo>::iterator it;
for (it = statusInfo.begin(); it != statusInfo.end() ; it++) {
if (it->id == detail.id) {
state = it->status;
break;
}
}
}
if (state != RS_STATUS_OFFLINE) {
item->setTextColor(COLUMN_CONTACT_NAME, COLOR_CONNECT); item->setTextColor(COLUMN_CONTACT_NAME, COLOR_CONNECT);
state = RS_STATUS_ONLINE;
} }
item->setIcon(COLUMN_CONTACT_NAME, QIcon(StatusDefs::imageUser(state))); item->setIcon(COLUMN_CONTACT_NAME, QIcon(StatusDefs::imageUser(state)));