diff --git a/resources/text/CHANGELOG b/resources/text/CHANGELOG index 5546108c1..ed00d2285 100755 --- a/resources/text/CHANGELOG +++ b/resources/text/CHANGELOG @@ -12,9 +12,11 @@ Changed: ▪ Some GUI refinements and fixes. ▪ Added more logging entries. +▪ "Clean all items" now does not clean messages from recycle bins. Fixed: +▪ Made some rather big changes to sorting/filtering of feeds, which is now dynamic. ▪ 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) diff --git a/src/core/feedsmodel.cpp b/src/core/feedsmodel.cpp index 786e0fa75..845c632b5 100755 --- a/src/core/feedsmodel.cpp +++ b/src/core/feedsmodel.cpp @@ -177,7 +177,7 @@ void FeedsModel::onFeedUpdatesFinished(const FeedDownloadResults &results) { } emit feedsUpdateFinished(); - emit sortingRequired(); + //emit sortingRequired(); } void FeedsModel::updateAllFeeds() { @@ -614,10 +614,15 @@ bool FeedsModel::hasAnyFeedNewMessages() const { void FeedsModel::reloadChangedLayout(QModelIndexList list) { while (!list.isEmpty()) { QModelIndex indx = list.takeFirst(); - QModelIndex indx_parent = indx.parent(); - // Underlying data are changed. - emit dataChanged(index(indx.row(), 0, indx_parent), index(indx.row(), FDS_MODEL_COUNTS_INDEX, indx_parent)); + if (indx.isValid()) { + QModelIndex indx_parent = indx.parent(); + + // Underlying data are changed. + emit dataChanged(index(indx.row(), 0, indx_parent), index(indx.row(), FDS_MODEL_COUNTS_INDEX, indx_parent)); + + list.append(indx_parent); + } } } @@ -663,7 +668,6 @@ bool FeedsModel::addServiceAccount(ServiceRoot *root, bool freshly_activated) { // Connect. connect(root, SIGNAL(itemRemovalRequested(RootItem*)), this, SLOT(removeItem(RootItem*))); connect(root, SIGNAL(itemReassignmentRequested(RootItem*,RootItem*)), this, SLOT(reassignNodeToNewParent(RootItem*,RootItem*))); - connect(root, SIGNAL(readFeedsFilterInvalidationRequested()), this, SIGNAL(readFeedsFilterInvalidationRequested())); connect(root, SIGNAL(dataChanged(QList)), this, SLOT(onItemDataChanged(QList))); connect(root, SIGNAL(reloadMessageListRequested(bool)), this, SIGNAL(reloadMessageListRequested(bool))); connect(root, SIGNAL(itemExpandRequested(QList,bool)), this, SIGNAL(itemExpandRequested(QList,bool))); diff --git a/src/core/feedsmodel.h b/src/core/feedsmodel.h index 9f899940d..a82be8e1f 100755 --- a/src/core/feedsmodel.h +++ b/src/core/feedsmodel.h @@ -197,10 +197,6 @@ class FeedsModel : public QAbstractItemModel { // Update of feeds is finished. void feedsUpdateFinished(); - // Counts of unread messages are changed in some feeds, - // notify view about this shit. - void readFeedsFilterInvalidationRequested(); - // Emitted when model requests update of some feeds. void feedsUpdateRequested(const QList feeds); diff --git a/src/core/feedsproxymodel.cpp b/src/core/feedsproxymodel.cpp index 80e9976db..8f21db80f 100755 --- a/src/core/feedsproxymodel.cpp +++ b/src/core/feedsproxymodel.cpp @@ -37,10 +37,8 @@ FeedsProxyModel::FeedsProxyModel(QObject *parent) setFilterCaseSensitivity(Qt::CaseInsensitive); setFilterKeyColumn(-1); setFilterRole(Qt::EditRole); - setDynamicSortFilter(false); + setDynamicSortFilter(true); setSourceModel(m_sourceModel); - - connect(m_sourceModel, SIGNAL(readFeedsFilterInvalidationRequested()), this, SLOT(invalidateReadFeedsFilter())); } FeedsProxyModel::~FeedsProxyModel() { diff --git a/src/services/abstract/recyclebin.cpp b/src/services/abstract/recyclebin.cpp index 9869a834a..840a25e79 100755 --- a/src/services/abstract/recyclebin.cpp +++ b/src/services/abstract/recyclebin.cpp @@ -186,7 +186,6 @@ bool RecycleBin::restore() { parent_root->updateCounts(true); parent_root->itemChanged(parent_root->getSubTree()); parent_root->requestReloadMessageList(true); - parent_root->requestFeedReadFilterReload(); return true; } else { diff --git a/src/services/abstract/rootitem.cpp b/src/services/abstract/rootitem.cpp index 5b7afe33d..8b4650bc4 100755 --- a/src/services/abstract/rootitem.cpp +++ b/src/services/abstract/rootitem.cpp @@ -89,21 +89,13 @@ QList RootItem::undeletedMessages() const { bool RootItem::cleanMessages(bool clear_only_read) { bool result = true; - RecycleBin *bin = NULL; foreach (RootItem *child, m_childItems) { - if (child->kind() == RootItemKind::Bin) { - bin = qobject_cast(child); - } - else { + if (child->kind() != RootItemKind::Bin) { result &= child->cleanMessages(clear_only_read); } } - if (bin != NULL) { - result &= bin->cleanMessages(clear_only_read); - } - return result; } diff --git a/src/services/abstract/serviceroot.cpp b/src/services/abstract/serviceroot.cpp index 46a0f59c0..09949f8fd 100755 --- a/src/services/abstract/serviceroot.cpp +++ b/src/services/abstract/serviceroot.cpp @@ -118,10 +118,6 @@ void ServiceRoot::requestReloadMessageList(bool mark_selected_messages_read) { emit reloadMessageListRequested(mark_selected_messages_read); } -void ServiceRoot::requestFeedReadFilterReload() { - emit readFeedsFilterInvalidationRequested(); -} - void ServiceRoot::requestItemExpand(const QList &items, bool expand) { emit itemExpandRequested(items, expand); } diff --git a/src/services/abstract/serviceroot.h b/src/services/abstract/serviceroot.h index b4e7e387d..a474897f5 100755 --- a/src/services/abstract/serviceroot.h +++ b/src/services/abstract/serviceroot.h @@ -154,7 +154,6 @@ class ServiceRoot : public RootItem { // Obvious methods to wrap signals. void itemChanged(const QList &items); void requestReloadMessageList(bool mark_selected_messages_read); - void requestFeedReadFilterReload(); void requestItemExpand(const QList &items, bool expand); void requestItemExpandStateSave(RootItem *subtree_root); void requestItemReassignment(RootItem *item, RootItem *new_parent); @@ -172,7 +171,6 @@ class ServiceRoot : public RootItem { signals: // Emitted if data in any item belonging to this root are changed. void dataChanged(QList items); - void readFeedsFilterInvalidationRequested(); void reloadMessageListRequested(bool mark_selected_messages_read); void itemExpandRequested(QList items, bool expand); void itemExpandStateSaveRequested(RootItem *subtree_root); diff --git a/src/services/standard/standardfeed.cpp b/src/services/standard/standardfeed.cpp index fc797f745..2b594eb6b 100755 --- a/src/services/standard/standardfeed.cpp +++ b/src/services/standard/standardfeed.cpp @@ -742,10 +742,6 @@ int StandardFeed::updateMessages(const QList &messages) { else { updateCounts(true); serviceRoot()->itemChanged(QList() << this); - - if (updated_messages > 0) { - serviceRoot()->requestFeedReadFilterReload(); - } } return updated_messages; diff --git a/src/services/standard/standardserviceroot.cpp b/src/services/standard/standardserviceroot.cpp index ef8d996e7..d74f7c13b 100755 --- a/src/services/standard/standardserviceroot.cpp +++ b/src/services/standard/standardserviceroot.cpp @@ -192,18 +192,22 @@ bool StandardServiceRoot::markFeedsReadUnread(QList items, ReadStatus rea bool StandardServiceRoot::cleanFeeds(QList items, bool clean_read_only) { QSqlDatabase db_handle = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings); QSqlQuery query_delete_msg(db_handle); + int account_id = accountId(); query_delete_msg.setForwardOnly(true); if (clean_read_only) { query_delete_msg.prepare(QString("UPDATE Messages SET is_deleted = :deleted " - "WHERE feed IN (%1) AND is_deleted = 0 AND is_pdeleted = 0 AND is_read = 1;").arg(textualFeedIds(items).join(QSL(", ")))); + "WHERE feed IN (%1) AND is_deleted = 0 AND is_pdeleted = 0 AND is_read = 1 AND account_id = :account_id;") + .arg(textualFeedIds(items).join(QSL(", ")))); } else { query_delete_msg.prepare(QString("UPDATE Messages SET is_deleted = :deleted " - "WHERE feed IN (%1) AND is_deleted = 0 AND is_pdeleted = 0;").arg(textualFeedIds(items).join(QSL(", ")))); + "WHERE feed IN (%1) AND is_deleted = 0 AND is_pdeleted = 0 AND account_id = :account_id;") + .arg(textualFeedIds(items).join(QSL(", ")))); } query_delete_msg.bindValue(QSL(":deleted"), 1); + query_delete_msg.bindValue(QSL(":account_id"), account_id); if (query_delete_msg.exec()) { // Messages are cleared, now inform model about need to reload data. @@ -222,8 +226,7 @@ bool StandardServiceRoot::cleanFeeds(QList items, bool clean_read_only) { return true; } else { - QString aa = query_delete_msg.lastError().text(); - + qDebug("Cleaning of feeds failed: '%s'.", qPrintable(query_delete_msg.lastError().text())); return false; } } @@ -497,7 +500,6 @@ bool StandardServiceRoot::onAfterSetMessagesRead(RootItem *selected_item, const selected_item->updateCounts(false); itemChanged(QList() << selected_item); - requestFeedReadFilterReload(); return true; } @@ -538,8 +540,6 @@ bool StandardServiceRoot::onAfterMessagesDelete(RootItem *selected_item, const Q itemChanged(QList() << selected_item << m_recycleBin); } - - requestFeedReadFilterReload(); return true; } @@ -556,6 +556,5 @@ bool StandardServiceRoot::onAfterMessagesRestoredFromBin(RootItem *selected_item updateCounts(true); itemChanged(getSubTree()); - requestFeedReadFilterReload(); return true; } diff --git a/src/services/tt-rss/ttrssfeed.cpp b/src/services/tt-rss/ttrssfeed.cpp index 3d8e1f830..244e6ff3d 100755 --- a/src/services/tt-rss/ttrssfeed.cpp +++ b/src/services/tt-rss/ttrssfeed.cpp @@ -387,10 +387,6 @@ int TtRssFeed::updateMessages(const QList &messages) { updateCounts(true); serviceRoot()->itemChanged(QList() << this); - - if (updated_messages > 0) { - serviceRoot()->requestFeedReadFilterReload(); - } } return updated_messages; diff --git a/src/services/tt-rss/ttrssserviceroot.cpp b/src/services/tt-rss/ttrssserviceroot.cpp index 695f1e307..c800419a2 100755 --- a/src/services/tt-rss/ttrssserviceroot.cpp +++ b/src/services/tt-rss/ttrssserviceroot.cpp @@ -222,7 +222,6 @@ bool TtRssServiceRoot::onAfterSetMessagesRead(RootItem *selected_item, const QLi selected_item->updateCounts(false); itemChanged(QList() << selected_item); - requestFeedReadFilterReload(); return true; } @@ -272,7 +271,6 @@ bool TtRssServiceRoot::onAfterMessagesDelete(RootItem *selected_item, const QLis itemChanged(QList() << selected_item << m_recycleBin); } - requestFeedReadFilterReload(); return true; }