This commit is contained in:
Martin Rotter 2016-01-13 11:19:08 +01:00
parent 30b8e7d176
commit 42b44043df
7 changed files with 34 additions and 5 deletions

View File

@ -14,6 +14,7 @@ Changed:
Fixed:
▪ Feeds are now (re)sorted when batch update finishes. (bug #150)
▪ Expand status if items in feed list are now persistent when performing sync-in of TT-RSS accounts. (bug #149)
▪ Fixed problem with importing invalid OPML 2.0 files. (bug #145)
▪ Fixed error in SQL initialization script which led to problems with in-memory SQLite DBs. (bug #140)

View File

@ -145,7 +145,7 @@ void FeedsModel::updateFeeds(const QList<Feed *> &feeds) {
connect(m_feedDownloaderThread, SIGNAL(finished()), m_feedDownloaderThread, SLOT(deleteLater()));
connect(m_feedDownloader, SIGNAL(finished(FeedDownloadResults)), this, SLOT(onFeedUpdatesFinished(FeedDownloadResults)));
connect(m_feedDownloader, SIGNAL(started()), this, SLOT(onFeedUpdatesStarted()));
connect(m_feedDownloader, SIGNAL(progress(Feed*,int,int)), this, SLOT(onFeedUpdatesProgress(Feed*,int,int)));
connect(m_feedDownloader, SIGNAL(progress(const Feed*,int,int)), this, SLOT(onFeedUpdatesProgress(const Feed*,int,int)));
// Connections are made, start the feed downloader thread.
m_feedDownloaderThread->start();
@ -177,6 +177,7 @@ void FeedsModel::onFeedUpdatesFinished(const FeedDownloadResults &results) {
}
emit feedsUpdateFinished();
emit sortingRequired();
}
void FeedsModel::updateAllFeeds() {

View File

@ -221,6 +221,9 @@ class FeedsModel : public QAbstractItemModel {
// NOTE: View will probably expand dropped index.
void requireItemValidationAfterDragDrop(const QModelIndex &source_index);
// When emitted, view (re)sorts items.
void sortingRequired();
private:
RootItem *m_rootItem;
QList<QString> m_headerData;

View File

@ -59,7 +59,7 @@ void DiscoverFeedsButton::setFeedAddresses(const QStringList &addresses) {
m_addresses = addresses;
}
void DiscoverFeedsButton::linkTriggered(const QAction *action) {
void DiscoverFeedsButton::linkTriggered(QAction *action) {
const QString url = action->property("url").toString();
ServiceRoot *root = static_cast<ServiceRoot*>(action->property("root").value<void*>());

View File

@ -35,7 +35,7 @@ class DiscoverFeedsButton : public QToolButton {
private slots:
// User chose any of addresses.
void linkTriggered(const QAction *action);
void linkTriggered(QAction *action);
void fillMenu();
private:

View File

@ -58,6 +58,7 @@ FeedsView::FeedsView(QWidget *parent)
connect(m_sourceModel, SIGNAL(requireItemValidationAfterDragDrop(QModelIndex)), this, SLOT(validateItemAfterDragDrop(QModelIndex)));
connect(m_sourceModel, SIGNAL(itemExpandRequested(QList<RootItem*>,bool)), this, SLOT(onItemExpandRequested(QList<RootItem*>,bool)));
connect(m_sourceModel, SIGNAL(itemExpandStateSaveRequested(RootItem*)), this, SLOT(onItemExpandStateSaveRequested(RootItem*)));
connect(m_sourceModel, SIGNAL(sortingRequired()), this, SLOT(reSort()));
connect(header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(saveSortState(int,Qt::SortOrder)));
setModel(m_proxyModel);
@ -133,8 +134,27 @@ void FeedsView::loadAllExpandStates() {
settings->value(GROUP(CategoriesExpandStates), setting_name, item->childCount() > 0).toBool());
}
sortByColumn(qApp->settings()->value(GROUP(GUI), SETTING(GUI::DefaultSortColumnFeeds)).toInt(),
static_cast<Qt::SortOrder>(qApp->settings()->value(GROUP(GUI), SETTING(GUI::DefaultSortOrderFeeds)).toInt()));
sort(true);
}
void FeedsView::sort(bool from_settings) {
int column;
Qt::SortOrder order;
if (from_settings) {
column = qApp->settings()->value(GROUP(GUI), SETTING(GUI::DefaultSortColumnFeeds)).toInt();
order = static_cast<Qt::SortOrder>(qApp->settings()->value(GROUP(GUI), SETTING(GUI::DefaultSortOrderFeeds)).toInt());
}
else {
column = header()->sortIndicatorSection();
order = header()->sortIndicatorOrder();
}
sortByColumn(column, order);
}
void FeedsView::reSort() {
m_proxyModel->sort(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
}
void FeedsView::addFeedIntoSelectedAccount() {

View File

@ -61,6 +61,10 @@ class FeedsView : public QTreeView {
void loadAllExpandStates();
public slots:
// Sorts according to column/order taken from settings.
void sort(bool from_settings);
void reSort();
void addFeedIntoSelectedAccount();
void addCategoryIntoSelectedAccount();
void expandCollapseCurrentItem();