mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-18 20:01:15 +01:00
Maybe better now, it makes no sense to be fully dynamic.
This commit is contained in:
parent
12c0d3d463
commit
f0298cbaeb
@ -13,7 +13,7 @@ Fixed:
|
||||
|
||||
Changed:
|
||||
|
||||
▪ Sorting of both views (feeds/messages) is now fully dynamic.
|
||||
▪ Adjusted sorting, particularly in message list.
|
||||
▪ Tweaked "remove duplicates" policy.
|
||||
▪ TT-RSS plugin can now restore messages from local recycle bin.
|
||||
|
||||
|
@ -30,7 +30,7 @@ MessagesProxyModel::MessagesProxyModel(QObject *parent)
|
||||
setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||
setFilterKeyColumn(-1);
|
||||
setFilterRole(Qt::EditRole);
|
||||
setDynamicSortFilter(true);
|
||||
setDynamicSortFilter(false);
|
||||
setSourceModel(m_sourceModel);
|
||||
}
|
||||
|
||||
@ -179,10 +179,6 @@ QModelIndexList MessagesProxyModel::match(const QModelIndex &start, int role,
|
||||
return result;
|
||||
}
|
||||
|
||||
void MessagesProxyModel::sort(int column, Qt::SortOrder order) {
|
||||
QSortFilterProxyModel::sort(column, order);
|
||||
}
|
||||
|
||||
QModelIndexList MessagesProxyModel::mapListToSource(const QModelIndexList &indexes) const {
|
||||
QModelIndexList source_indexes;
|
||||
|
||||
|
@ -45,8 +45,6 @@ class MessagesProxyModel : public QSortFilterProxyModel {
|
||||
// Fix for matching indexes with respect to specifics of the message model.
|
||||
QModelIndexList match(const QModelIndex &start, int role, const QVariant &entered_value, int hits, Qt::MatchFlags flags) const;
|
||||
|
||||
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
|
||||
|
||||
private:
|
||||
QModelIndex getNextUnreadItemIndex(int default_row, int max_row) const;
|
||||
|
||||
|
@ -80,7 +80,6 @@ void MessagesView::reloadSelections(bool mark_current_index_read) {
|
||||
|
||||
// Reload the model now.
|
||||
m_sourceModel->fetchAllData();
|
||||
|
||||
sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
|
||||
|
||||
selected_indexes = m_proxyModel->mapListFromSource(mapped_indexes, true);
|
||||
@ -209,13 +208,15 @@ void MessagesView::selectionChanged(const QItemSelection &selected, const QItemS
|
||||
mapped_current_index.row(), mapped_current_index.column());
|
||||
|
||||
if (mapped_current_index.isValid() && selected_rows.count() == 1) {
|
||||
Message message = m_sourceModel->messageAt(m_proxyModel->mapToSource(selected_rows.at(0)).row());
|
||||
|
||||
if (!m_batchUnreadSwitch) {
|
||||
// Set this message as read only if current item
|
||||
// wasn't changed by "mark selected messages unread" action.
|
||||
m_sourceModel->setMessageRead(mapped_current_index.row(), RootItem::Read);
|
||||
}
|
||||
|
||||
emit currentMessagesChanged(QList<Message>() << m_sourceModel->messageAt(m_proxyModel->mapToSource(selected_rows.at(0)).row()));
|
||||
emit currentMessagesChanged(QList<Message>() << message);
|
||||
}
|
||||
else {
|
||||
emit currentMessagesRemoved();
|
||||
@ -351,7 +352,7 @@ void MessagesView::setSelectedMessagesReadStatus(RootItem::ReadStatus read) {
|
||||
const QModelIndexList mapped_indexes = m_proxyModel->mapListToSource(selected_indexes);
|
||||
|
||||
m_sourceModel->setBatchMessagesRead(mapped_indexes, read);
|
||||
sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
|
||||
//sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
|
||||
|
||||
selected_indexes = m_proxyModel->mapListFromSource(mapped_indexes, true);
|
||||
current_index = m_proxyModel->mapFromSource(m_sourceModel->index(mapped_current_index.row(), mapped_current_index.column()));
|
||||
@ -379,7 +380,7 @@ void MessagesView::deleteSelectedMessages() {
|
||||
const QModelIndexList mapped_indexes = m_proxyModel->mapListToSource(selected_indexes);
|
||||
|
||||
m_sourceModel->setBatchMessagesDeleted(mapped_indexes);
|
||||
sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
|
||||
//sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
|
||||
|
||||
const int row_count = m_sourceModel->rowCount();
|
||||
|
||||
@ -408,7 +409,7 @@ void MessagesView::restoreSelectedMessages() {
|
||||
const QModelIndexList mapped_indexes = m_proxyModel->mapListToSource(selected_indexes);
|
||||
|
||||
m_sourceModel->setBatchMessagesRestored(mapped_indexes);
|
||||
sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
|
||||
//sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
|
||||
|
||||
int row_count = m_sourceModel->rowCount();
|
||||
|
||||
@ -438,7 +439,7 @@ void MessagesView::switchSelectedMessagesImportance() {
|
||||
const QModelIndexList mapped_indexes = m_proxyModel->mapListToSource(selected_indexes);
|
||||
|
||||
m_sourceModel->switchBatchMessageImportance(mapped_indexes);
|
||||
sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
|
||||
//sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
|
||||
|
||||
selected_indexes = m_proxyModel->mapListFromSource(mapped_indexes, true);
|
||||
current_index = m_proxyModel->mapFromSource(m_sourceModel->index(mapped_current_index.row(),
|
||||
@ -459,7 +460,7 @@ void MessagesView::reselectIndexes(const QModelIndexList &indexes) {
|
||||
selection.merge(QItemSelection(index, index), QItemSelectionModel::Select);
|
||||
}
|
||||
|
||||
selectionModel()->select(selection, QItemSelectionModel::Select | QItemSelectionModel::Rows);
|
||||
selectionModel()->select(selection, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user