ChannelFeed:

- Sort channel messages by date with newest first.
- Remove all channel messages from the list, when no channel is selected.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3641 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-10-07 19:31:37 +00:00
parent 3b2ab05993
commit cb39d5ec32

View File

@ -458,7 +458,7 @@ void ChannelFeed::updateMessageSummaryList(const std::string &channelId)
int channelItems[2] = { OWN, SUBSCRIBED };
for (int channelItem = 0; channelItem < 2; channelItem++) {
QStandardItem *groupItem = model->item(channelItem);
QStandardItem *groupItem = model->item(channelItems[channelItem]);
if (groupItem == NULL) {
continue;
}
@ -503,7 +503,7 @@ void ChannelFeed::updateMessageSummaryList(const std::string &channelId)
static bool sortChannelMsgSummary(const ChannelMsgSummary &msg1, const ChannelMsgSummary &msg2)
{
return (msg1.ts < msg2.ts);
return (msg1.ts > msg2.ts);
}
void ChannelFeed::updateChannelMsgs()
@ -512,6 +512,13 @@ void ChannelFeed::updateChannelMsgs()
return;
}
/* replace all the messages with new ones */
std::list<ChanMsgItem *>::iterator mit;
for (mit = mChanMsgItems.begin(); mit != mChanMsgItems.end(); mit++) {
delete (*mit);
}
mChanMsgItems.clear();
ChannelInfo ci;
if (!rsChannels->getChannelInfo(mChannelId, ci)) {
postButton->setEnabled(false);
@ -561,13 +568,6 @@ void ChannelFeed::updateChannelMsgs()
postButton->setEnabled(false);
}
/* replace all the messages with new ones */
std::list<ChanMsgItem *>::iterator mit;
for (mit = mChanMsgItems.begin(); mit != mChanMsgItems.end(); mit++) {
delete (*mit);
}
mChanMsgItems.clear();
std::list<ChannelMsgSummary> msgs;
std::list<ChannelMsgSummary>::iterator it;