diff --git a/retroshare-gui/src/gui/NewsFeed.cpp b/retroshare-gui/src/gui/NewsFeed.cpp
index aaad6ea19..6df5c8881 100644
--- a/retroshare-gui/src/gui/NewsFeed.cpp
+++ b/retroshare-gui/src/gui/NewsFeed.cpp
@@ -108,10 +108,14 @@ NewsFeed::NewsFeed(QWidget *parent) :
ui->feedWidget->enableRemove(true);
+ ui->sortComboBox->addItem(tr("Newest on top"), Qt::DescendingOrder);
+ ui->sortComboBox->addItem(tr("Oldest on top"), Qt::AscendingOrder);
+
+ connect(ui->sortComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(sortChanged(int)));
+
connect(ui->removeAllButton, SIGNAL(clicked()), ui->feedWidget, SLOT(clear()));
connect(ui->feedOptionsButton, SIGNAL(clicked()), this, SLOT(feedoptions()));
connect(ui->feedWidget, SIGNAL(feedCountChanged()), this, SLOT(sendNewsFeedChanged()));
- connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
QString hlp_str = tr(
"
News Feed
\
@@ -129,11 +133,15 @@ QString hlp_str = tr(
registerHelpButton(ui->helpButton,hlp_str) ;
- settingsChanged();
+ // load settings
+ processSettings(true);
}
NewsFeed::~NewsFeed()
{
+ // save settings
+ processSettings(false);
+
if (instance == this) {
instance = NULL;
}
@@ -154,9 +162,31 @@ UserNotify *NewsFeed::getUserNotify(QObject *parent)
return new NewsFeedUserNotify(this, parent);
}
-void NewsFeed::settingsChanged()
+void NewsFeed::processSettings(bool load)
{
- ui->feedWidget->setSortRole(ROLE_RECEIVED, Settings->getAddFeedsAtEnd() ? Qt::AscendingOrder : Qt::DescendingOrder);
+ Settings->beginGroup("NewsFeed");
+
+ if (load) {
+ // load settings
+
+ // state of sort order
+ Qt::SortOrder sortOrder = (Qt::SortOrder) Settings->value("SortOrder", Qt::AscendingOrder).toInt();
+ ui->sortComboBox->setCurrentIndex(ui->sortComboBox->findData(sortOrder));
+ sortChanged(ui->sortComboBox->currentIndex());
+ } else {
+ // save settings
+
+ // state of sort order
+ Settings->setValue("SortOrder", ui->sortComboBox->itemData(ui->sortComboBox->currentIndex()).toInt());
+ }
+
+ Settings->endGroup();
+}
+
+void NewsFeed::sortChanged(int index)
+{
+ Qt::SortOrder sortOrder = (Qt::SortOrder) ui->sortComboBox->itemData(index).toInt();
+ ui->feedWidget->setSortRole(ROLE_RECEIVED, sortOrder);
}
void NewsFeed::updateDisplay()
@@ -735,7 +765,7 @@ void NewsFeed::addFeedItem(FeedItem *item)
// costly, but not really a problem here
int feedItemCount;
- bool fromTop = Settings->getAddFeedsAtEnd();
+ bool fromTop = (ui->sortComboBox->itemData(ui->sortComboBox->currentIndex()).toInt() == Qt::AscendingOrder);
while ((feedItemCount = ui->feedWidget->feedItemCount()) >= MAX_FEEDITEM_COUNT) {
FeedItem *feedItem = ui->feedWidget->feedItem(fromTop ? 0 : feedItemCount - 1);
diff --git a/retroshare-gui/src/gui/NewsFeed.h b/retroshare-gui/src/gui/NewsFeed.h
index b48bafbd6..21091c1e2 100644
--- a/retroshare-gui/src/gui/NewsFeed.h
+++ b/retroshare-gui/src/gui/NewsFeed.h
@@ -69,13 +69,15 @@ signals:
void newsFeedChanged(int count);
protected:
+ void processSettings(bool load);
+
/* TokenResponse */
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
private slots:
// void toggleChanMsgItems(bool on);
void feedoptions();
- void settingsChanged();
+ void sortChanged(int index);
void sendNewsFeedChanged();
diff --git a/retroshare-gui/src/gui/NewsFeed.ui b/retroshare-gui/src/gui/NewsFeed.ui
index a5fb207c0..7a69b63aa 100644
--- a/retroshare-gui/src/gui/NewsFeed.ui
+++ b/retroshare-gui/src/gui/NewsFeed.ui
@@ -77,6 +77,9 @@
+ -
+
+
-
diff --git a/retroshare-gui/src/gui/settings/NotifyPage.cpp b/retroshare-gui/src/gui/settings/NotifyPage.cpp
index 8021eae81..6e2f8e56d 100755
--- a/retroshare-gui/src/gui/settings/NotifyPage.cpp
+++ b/retroshare-gui/src/gui/settings/NotifyPage.cpp
@@ -198,8 +198,6 @@ NotifyPage::save(QString &/*errmsg*/)
MainWindow::installGroupChatNotifier();
MainWindow::installNotifyIcons();
- Settings->setAddFeedsAtEnd(ui.addFeedsAtEnd->isChecked());
-
int index = ui.comboBoxToasterPosition->currentIndex();
if (index != -1) {
Settings->setToasterPosition((RshareSettings::enumToasterPosition) ui.comboBoxToasterPosition->itemData(index).toInt());
@@ -244,8 +242,6 @@ void NotifyPage::load()
ui.systray_GroupChat->setChecked(Settings->getDisplayTrayGroupChat());
ui.systray_ChatLobby->setChecked(Settings->getDisplayTrayChatLobby());
- ui.addFeedsAtEnd->setChecked(Settings->getAddFeedsAtEnd());
-
ui.pushButtonDisableAll->setChecked(NotifyQt::isAllDisable());
RshareSettings::enumToasterPosition toasterPosition = Settings->getToasterPosition();
diff --git a/retroshare-gui/src/gui/settings/NotifyPage.ui b/retroshare-gui/src/gui/settings/NotifyPage.ui
index dab8dda9f..8e25187dc 100755
--- a/retroshare-gui/src/gui/settings/NotifyPage.ui
+++ b/retroshare-gui/src/gui/settings/NotifyPage.ui
@@ -86,20 +86,6 @@
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- Add feeds at end
-
-
-
-
diff --git a/retroshare-gui/src/gui/settings/rsharesettings.cpp b/retroshare-gui/src/gui/settings/rsharesettings.cpp
index 1aba677f3..da361b77a 100644
--- a/retroshare-gui/src/gui/settings/rsharesettings.cpp
+++ b/retroshare-gui/src/gui/settings/rsharesettings.cpp
@@ -486,16 +486,6 @@ void RshareSettings::setDisplayTrayGroupChat(bool bValue)
setValue("DisplayTrayGroupChat", bValue);
}
-bool RshareSettings::getAddFeedsAtEnd()
-{
- return value("AddFeedsAtEnd").toBool();
-}
-
-void RshareSettings::setAddFeedsAtEnd(bool bValue)
-{
- setValue("AddFeedsAtEnd", bValue);
-}
-
bool RshareSettings::getChatSendMessageWithCtrlReturn()
{
return valueFromGroup("Chat", "SendMessageWithCtrlReturn", false).toBool();
diff --git a/retroshare-gui/src/gui/settings/rsharesettings.h b/retroshare-gui/src/gui/settings/rsharesettings.h
index 38e02a8f7..36246b2be 100644
--- a/retroshare-gui/src/gui/settings/rsharesettings.h
+++ b/retroshare-gui/src/gui/settings/rsharesettings.h
@@ -199,9 +199,6 @@ public:
bool getDisplayTrayGroupChat();
void setDisplayTrayGroupChat(bool bValue);
- bool getAddFeedsAtEnd();
- void setAddFeedsAtEnd(bool bValue);
-
bool getChatSendMessageWithCtrlReturn();
void setChatSendMessageWithCtrlReturn(bool bValue);