mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-16 19:03:25 +01:00
Added Q_OBJECT to classes.
This commit is contained in:
parent
e4fe5a9f13
commit
4e289fc1f0
@ -561,6 +561,8 @@ set(APP_HEADERS
|
||||
# TT-RSS service headers.
|
||||
src/services/tt-rss/ttrssserviceroot.h
|
||||
src/services/tt-rss/ttrssrecyclebin.h
|
||||
src/services/tt-rss/ttrssfeed.h
|
||||
src/services/tt-rss/ttrsscategory.h
|
||||
src/services/tt-rss/gui/formeditaccount.h
|
||||
|
||||
# NETWORK-WEB headers.
|
||||
|
@ -24,11 +24,15 @@
|
||||
|
||||
|
||||
class TtRssCategory : public Category {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TtRssCategory(RootItem *parent = NULL);
|
||||
explicit TtRssCategory(const QSqlRecord &record);
|
||||
virtual ~TtRssCategory();
|
||||
|
||||
|
||||
|
||||
int customId() const;
|
||||
void setCustomId(int custom_id);
|
||||
|
||||
|
@ -26,6 +26,8 @@
|
||||
class TtRssServiceRoot;
|
||||
|
||||
class TtRssFeed : public Feed {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TtRssFeed(RootItem *parent = NULL);
|
||||
explicit TtRssFeed(const QSqlRecord &record);
|
||||
|
@ -222,6 +222,77 @@ TtRssNetworkFactory *TtRssServiceRoot::network() const {
|
||||
return m_network;
|
||||
}
|
||||
|
||||
QStringList TtRssServiceRoot::customIDSOfMessagesForItem(RootItem *item) {
|
||||
if (item->getParentServiceRoot() != this) {
|
||||
// Not item from this account.
|
||||
return QStringList();
|
||||
}
|
||||
else {
|
||||
QStringList list;
|
||||
|
||||
switch (item->kind()) {
|
||||
case RootItemKind::Category: {
|
||||
foreach (RootItem *child, item->childItems()) {
|
||||
list.append(customIDSOfMessagesForItem(child));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
case RootItemKind::ServiceRoot: {
|
||||
QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
|
||||
QSqlQuery query(database);
|
||||
|
||||
query.prepare(QSL("SELECT custom_id FROM Messages WHERE is_deleted = 0 AND is_pdeleted = 0 AND account_id = :account_id;"));
|
||||
query.bindValue(QSL(":account_id"), accountId());
|
||||
query.exec();
|
||||
|
||||
while (query.next()) {
|
||||
list.append(query.value(0).toString());
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case RootItemKind::Bin: {
|
||||
QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
|
||||
QSqlQuery query(database);
|
||||
|
||||
query.prepare(QSL("SELECT custom_id FROM Messages WHERE is_deleted = 1 AND is_pdeleted = 0 AND account_id = :account_id;"));
|
||||
query.bindValue(QSL(":account_id"), accountId());
|
||||
query.exec();
|
||||
|
||||
while (query.next()) {
|
||||
list.append(query.value(0).toString());
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case RootItemKind::Feed: {
|
||||
QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
|
||||
QSqlQuery query(database);
|
||||
|
||||
query.prepare(QSL("SELECT custom_id FROM Messages WHERE is_deleted = 0 AND is_pdeleted = 0 AND feed = :feed AND account_id = :account_id;"));
|
||||
query.bindValue(QSL(":account_id"), accountId());
|
||||
query.bindValue(QSL(":feed"), qobject_cast<TtRssFeed*>(item)->customId());
|
||||
query.exec();
|
||||
|
||||
while (query.next()) {
|
||||
list.append(query.value(0).toString());
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
void TtRssServiceRoot::saveAccountDataToDatabase() {
|
||||
if (accountId() != NO_PARENT_CATEGORY) {
|
||||
// We are overwritting previously saved data.
|
||||
|
@ -68,9 +68,11 @@ class TtRssServiceRoot : public ServiceRoot {
|
||||
|
||||
TtRssNetworkFactory *network() const;
|
||||
|
||||
// Returns list of custom IDS of all DB messages in given item.
|
||||
QStringList customIDSOfMessagesForItem(RootItem *item);
|
||||
|
||||
void saveAccountDataToDatabase();
|
||||
void updateTitle();
|
||||
|
||||
void completelyRemoveAllData();
|
||||
|
||||
public slots:
|
||||
|
Loading…
Reference in New Issue
Block a user