From cb39d5ec32a7dbf5caf45c4997ac9886801d0d4f Mon Sep 17 00:00:00 2001 From: thunder2 Date: Thu, 7 Oct 2010 19:31:37 +0000 Subject: [PATCH] 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 --- retroshare-gui/src/gui/ChannelFeed.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/retroshare-gui/src/gui/ChannelFeed.cpp b/retroshare-gui/src/gui/ChannelFeed.cpp index 079015cf2..762c8343e 100644 --- a/retroshare-gui/src/gui/ChannelFeed.cpp +++ b/retroshare-gui/src/gui/ChannelFeed.cpp @@ -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::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::iterator mit; - for (mit = mChanMsgItems.begin(); mit != mChanMsgItems.end(); mit++) { - delete (*mit); - } - mChanMsgItems.clear(); - std::list msgs; std::list::iterator it;