mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-29 00:30:12 +01:00
provide local IDs
This commit is contained in:
parent
fd251a1e78
commit
75ce82bb49
@ -127,24 +127,27 @@ void FeedDownloader::updateOneFeed(Feed* feed) {
|
||||
QSqlDatabase database = is_main_thread ?
|
||||
qApp->database()->driver()->connection(metaObject()->className()) :
|
||||
qApp->database()->driver()->connection(QSL("feed_upd"));
|
||||
QHash<ServiceRoot::BagOfMessages, QStringList> stated_messages;
|
||||
QHash<QString, QPair<ServiceRoot::BagOfMessages, QStringList>> stated_messages;
|
||||
QHash<QString, QStringList> tagged_messages;
|
||||
|
||||
if (feed->getParentServiceRoot()->wantsBaggedIdsOfExistingMessages()) {
|
||||
// This account has activated intelligent downloading of messages.
|
||||
// Prepare bags.
|
||||
stated_messages.insert(ServiceRoot::BagOfMessages::Read,
|
||||
DatabaseQueries::bagOfMessages(database,
|
||||
ServiceRoot::BagOfMessages::Read,
|
||||
{ feed }));
|
||||
stated_messages.insert(ServiceRoot::BagOfMessages::Unread,
|
||||
DatabaseQueries::bagOfMessages(database,
|
||||
ServiceRoot::BagOfMessages::Unread,
|
||||
{ feed }));
|
||||
stated_messages.insert(ServiceRoot::BagOfMessages::Starred,
|
||||
DatabaseQueries::bagOfMessages(database,
|
||||
ServiceRoot::BagOfMessages::Starred,
|
||||
{ feed }));
|
||||
stated_messages.insert(feed->customId(),
|
||||
{ ServiceRoot::BagOfMessages::Read,
|
||||
DatabaseQueries::bagOfMessages(database,
|
||||
ServiceRoot::BagOfMessages::Read,
|
||||
feed) });
|
||||
stated_messages.insert(feed->customId(),
|
||||
{ ServiceRoot::BagOfMessages::Unread,
|
||||
DatabaseQueries::bagOfMessages(database,
|
||||
ServiceRoot::BagOfMessages::Unread,
|
||||
feed) });
|
||||
stated_messages.insert(feed->customId(),
|
||||
{ ServiceRoot::BagOfMessages::Starred,
|
||||
DatabaseQueries::bagOfMessages(database,
|
||||
ServiceRoot::BagOfMessages::Starred,
|
||||
feed) });
|
||||
|
||||
tagged_messages = DatabaseQueries::bagsOfMessages(database,
|
||||
feed->getParentServiceRoot()->labelsNode()->labels());
|
||||
|
@ -958,7 +958,7 @@ QList<Message> DatabaseQueries::getUndeletedMessagesForAccount(const QSqlDatabas
|
||||
return messages;
|
||||
}
|
||||
|
||||
QStringList DatabaseQueries::bagOfMessages(const QSqlDatabase& db, ServiceRoot::BagOfMessages bag, const QList<Feed*>& feeds) {
|
||||
QStringList DatabaseQueries::bagOfMessages(const QSqlDatabase& db, ServiceRoot::BagOfMessages bag, const Feed* feed) {
|
||||
QStringList ids;
|
||||
QSqlQuery q(db);
|
||||
QString query;
|
||||
@ -984,13 +984,11 @@ QStringList DatabaseQueries::bagOfMessages(const QSqlDatabase& db, ServiceRoot::
|
||||
"FROM Messages "
|
||||
"WHERE %1 AND account_id = :account_id;").arg(query));
|
||||
|
||||
for (Feed* feed: feeds) {
|
||||
q.bindValue(QSL(":account_id"), feed->getParentServiceRoot()->accountId());
|
||||
q.exec();
|
||||
q.bindValue(QSL(":account_id"), feed->getParentServiceRoot()->accountId());
|
||||
q.exec();
|
||||
|
||||
while (q.next()) {
|
||||
ids.append(q.value(0).toString());
|
||||
}
|
||||
while (q.next()) {
|
||||
ids.append(q.value(0).toString());
|
||||
}
|
||||
|
||||
return ids;
|
||||
|
@ -93,7 +93,7 @@ class DatabaseQueries {
|
||||
static QList<Message> getUndeletedMessagesForAccount(const QSqlDatabase& db, int account_id, bool* ok = nullptr);
|
||||
|
||||
// Custom ID accumulators.
|
||||
static QStringList bagOfMessages(const QSqlDatabase& db, ServiceRoot::BagOfMessages bag, const QList<Feed*>& feeds);
|
||||
static QStringList bagOfMessages(const QSqlDatabase& db, ServiceRoot::BagOfMessages bag, const Feed* feed);
|
||||
static QHash<QString, QStringList> bagsOfMessages(const QSqlDatabase& db, const QList<Label*>& labels);
|
||||
static QStringList customIdsOfMessagesFromLabel(const QSqlDatabase& db, Label* label, bool* ok = nullptr);
|
||||
static QStringList customIdsOfImportantMessages(const QSqlDatabase& db, int account_id, bool* ok = nullptr);
|
||||
|
@ -102,7 +102,7 @@ class ServiceRoot : public RootItem {
|
||||
// Throws exception subclassed from ApplicationException, preferably FeedFetchException
|
||||
// if any problems arise.
|
||||
virtual QList<Message> obtainNewMessages(const QList<Feed*>& feeds,
|
||||
const QHash<ServiceRoot::BagOfMessages, QStringList>& stated_messages,
|
||||
QHash<QString, QPair<ServiceRoot::BagOfMessages, QStringList>> stated_messages,
|
||||
const QHash<QString, QStringList>& tagged_messages) = 0;
|
||||
|
||||
// This method should prepare messages for given "item" (download them maybe?)
|
||||
|
@ -24,7 +24,7 @@ class FeedlyServiceRoot : public ServiceRoot, public CacheForServiceRoot {
|
||||
virtual QVariantHash customDatabaseData() const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data);
|
||||
virtual QList<Message> obtainNewMessages(const QList<Feed*>& feeds,
|
||||
const QHash<ServiceRoot::BagOfMessages, QStringList>& stated_messages,
|
||||
QHash<QString, QPair<ServiceRoot::BagOfMessages, QStringList>> stated_messages,
|
||||
const QHash<QString, QStringList>& tagged_messages);
|
||||
|
||||
FeedlyNetwork* network() const;
|
||||
|
@ -32,7 +32,7 @@ class GmailServiceRoot : public ServiceRoot, public CacheForServiceRoot {
|
||||
virtual QVariantHash customDatabaseData() const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data);
|
||||
virtual QList<Message> obtainNewMessages(const QList<Feed*>& feeds,
|
||||
const QHash<ServiceRoot::BagOfMessages, QStringList>& stated_messages,
|
||||
QHash<QString, QPair<ServiceRoot::BagOfMessages, QStringList>> stated_messages,
|
||||
const QHash<QString, QStringList>& tagged_messages);
|
||||
|
||||
protected:
|
||||
|
@ -32,7 +32,7 @@ class GreaderServiceRoot : public ServiceRoot, public CacheForServiceRoot {
|
||||
virtual QVariantHash customDatabaseData() const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data);
|
||||
virtual QList<Message> obtainNewMessages(const QList<Feed*>& feeds,
|
||||
const QHash<ServiceRoot::BagOfMessages, QStringList>& stated_messages,
|
||||
QHash<QString, QPair<ServiceRoot::BagOfMessages, QStringList>> stated_messages,
|
||||
const QHash<QString, QStringList>& tagged_messages);
|
||||
virtual bool wantsBaggedIdsOfExistingMessages() const;
|
||||
|
||||
|
@ -30,7 +30,7 @@ class InoreaderServiceRoot : public ServiceRoot, public CacheForServiceRoot {
|
||||
virtual QVariantHash customDatabaseData() const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data);
|
||||
virtual QList<Message> obtainNewMessages(const QList<Feed*>& feeds,
|
||||
const QHash<ServiceRoot::BagOfMessages, QStringList>& stated_messages,
|
||||
QHash<QString, QPair<ServiceRoot::BagOfMessages, QStringList>> stated_messages,
|
||||
const QHash<QString, QStringList>& tagged_messages);
|
||||
|
||||
protected:
|
||||
|
@ -29,7 +29,7 @@ class OwnCloudServiceRoot : public ServiceRoot, public CacheForServiceRoot {
|
||||
virtual QVariantHash customDatabaseData() const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data);
|
||||
virtual QList<Message> obtainNewMessages(const QList<Feed*>& feeds,
|
||||
const QHash<ServiceRoot::BagOfMessages, QStringList>& stated_messages,
|
||||
QHash<QString, QPair<ServiceRoot::BagOfMessages, QStringList>> stated_messages,
|
||||
const QHash<QString, QStringList>& tagged_messages);
|
||||
|
||||
OwnCloudNetworkFactory* network() const;
|
||||
|
@ -33,7 +33,7 @@ class StandardServiceRoot : public ServiceRoot {
|
||||
virtual bool supportsCategoryAdding() const;
|
||||
virtual Qt::ItemFlags additionalFlags() const;
|
||||
virtual QList<Message> obtainNewMessages(const QList<Feed*>& feeds,
|
||||
const QHash<ServiceRoot::BagOfMessages, QStringList>& stated_messages,
|
||||
QHash<QString, QPair<ServiceRoot::BagOfMessages, QStringList>> stated_messages,
|
||||
const QHash<QString, QStringList>& tagged_messages);
|
||||
|
||||
QList<QAction*> serviceMenu();
|
||||
|
@ -34,7 +34,7 @@ class TtRssServiceRoot : public ServiceRoot, public CacheForServiceRoot {
|
||||
virtual QVariantHash customDatabaseData() const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data);
|
||||
virtual QList<Message> obtainNewMessages(const QList<Feed*>& feeds,
|
||||
const QHash<ServiceRoot::BagOfMessages, QStringList>& stated_messages,
|
||||
QHash<QString, QPair<ServiceRoot::BagOfMessages, QStringList>> stated_messages,
|
||||
const QHash<QString, QStringList>& tagged_messages);
|
||||
|
||||
// Access to network.
|
||||
|
Loading…
x
Reference in New Issue
Block a user