int Feed::updateMessages(const QList<Message> &messages) { int custom_id = customId(); int account_id = getParentServiceRoot()->accountId(); bool anything_updated = false; bool ok; QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings); int updated_messages = DatabaseQueries::updateMessages(database, messages, custom_id, account_id, url(), &anything_updated, &ok); if (ok) { if (updated_messages > 0) { setStatus(NewMessages); } else { setStatus(Normal); } QList<RootItem*> items_to_update; updateCounts(true); items_to_update.append(this); if (getParentServiceRoot()->recycleBin() != nullptr && anything_updated) { getParentServiceRoot()->recycleBin()->updateCounts(true); items_to_update.append(getParentServiceRoot()->recycleBin()); } getParentServiceRoot()->itemChanged(items_to_update); } return updated_messages; }
void Feed::updateCounts(bool including_total_count) { QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings); int account_id = getParentServiceRoot()->accountId(); if (including_total_count) { setCountOfAllMessages(DatabaseQueries::getMessageCountsForFeed(database, customId(), account_id, true)); } setCountOfUnreadMessages(DatabaseQueries::getMessageCountsForFeed(database, customId(), account_id, false)); }
StandardServiceRoot *StandardCategory::serviceRoot() const { return qobject_cast<StandardServiceRoot*>(getParentServiceRoot()); }
QList<Message> Feed::undeletedMessages() const { QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings); return DatabaseQueries::getUndeletedMessagesForFeed(database, customId(), getParentServiceRoot()->accountId()); }
TtRssServiceRoot *TtRssRecycleBin::serviceRoot() { return qobject_cast<TtRssServiceRoot*>(getParentServiceRoot()); }
bool StandardFeed::removeItself() { QSqlDatabase database = qApp->database()->connection(metaObject()->className()); return DatabaseQueries::deleteFeed(database, customId().toInt(), getParentServiceRoot()->accountId()); }