diff --git a/src/gui/feedsview.cpp b/src/gui/feedsview.cpp index fb595a938..bb60b42fc 100644 --- a/src/gui/feedsview.cpp +++ b/src/gui/feedsview.cpp @@ -27,6 +27,13 @@ void FeedsView::setSortingEnabled(bool enable) { header()->setSortIndicatorShown(false); } +QList FeedsView::selectedFeeds() const { + QModelIndexList selection = selectionModel()->selectedRows(); + QModelIndexList mapped_selection = m_proxyModel->mapListToSource(selection); + + return m_sourceModel->feedsForIndexes(mapped_selection); +} + void FeedsView::updateCountsOfSelectedFeeds() { QModelIndexList selected_rows = selectionModel()->selectedRows(); QModelIndexList mapped_rows = m_proxyModel->mapListToSource(selected_rows); @@ -65,9 +72,7 @@ void FeedsView::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) { QTreeView::selectionChanged(selected, deselected); - QModelIndexList selection = selectionModel()->selectedRows(); - QModelIndexList mapped_selection = m_proxyModel->mapListToSource(selection); - QList selected_feeds = m_sourceModel->feedsForIndexes(mapped_selection); + QList selected_feeds = selectedFeeds(); QList feed_ids; foreach (FeedsModelFeed *feed, selected_feeds) { diff --git a/src/gui/feedsview.h b/src/gui/feedsview.h index fe3d9e686..f93154100 100644 --- a/src/gui/feedsview.h +++ b/src/gui/feedsview.h @@ -6,6 +6,7 @@ class FeedsModel; class FeedsProxyModel; +class FeedsModelFeed; class FeedsView : public QTreeView { Q_OBJECT @@ -17,6 +18,8 @@ class FeedsView : public QTreeView { void setSortingEnabled(bool enable); + QList selectedFeeds() const; + public slots: // Reloads count for selected feeds. void updateCountsOfSelectedFeeds();