Added Q_OBJECT to classes.
This commit is contained in:
parent
e4fe5a9f13
commit
4e289fc1f0
5 changed files with 82 additions and 1 deletions
|
@ -561,6 +561,8 @@ set(APP_HEADERS
|
||||||
# TT-RSS service headers.
|
# TT-RSS service headers.
|
||||||
src/services/tt-rss/ttrssserviceroot.h
|
src/services/tt-rss/ttrssserviceroot.h
|
||||||
src/services/tt-rss/ttrssrecyclebin.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
|
src/services/tt-rss/gui/formeditaccount.h
|
||||||
|
|
||||||
# NETWORK-WEB headers.
|
# NETWORK-WEB headers.
|
||||||
|
|
|
@ -24,11 +24,15 @@
|
||||||
|
|
||||||
|
|
||||||
class TtRssCategory : public Category {
|
class TtRssCategory : public Category {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TtRssCategory(RootItem *parent = NULL);
|
explicit TtRssCategory(RootItem *parent = NULL);
|
||||||
explicit TtRssCategory(const QSqlRecord &record);
|
explicit TtRssCategory(const QSqlRecord &record);
|
||||||
virtual ~TtRssCategory();
|
virtual ~TtRssCategory();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int customId() const;
|
int customId() const;
|
||||||
void setCustomId(int custom_id);
|
void setCustomId(int custom_id);
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
class TtRssServiceRoot;
|
class TtRssServiceRoot;
|
||||||
|
|
||||||
class TtRssFeed : public Feed {
|
class TtRssFeed : public Feed {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TtRssFeed(RootItem *parent = NULL);
|
explicit TtRssFeed(RootItem *parent = NULL);
|
||||||
explicit TtRssFeed(const QSqlRecord &record);
|
explicit TtRssFeed(const QSqlRecord &record);
|
||||||
|
|
|
@ -222,6 +222,77 @@ TtRssNetworkFactory *TtRssServiceRoot::network() const {
|
||||||
return m_network;
|
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() {
|
void TtRssServiceRoot::saveAccountDataToDatabase() {
|
||||||
if (accountId() != NO_PARENT_CATEGORY) {
|
if (accountId() != NO_PARENT_CATEGORY) {
|
||||||
// We are overwritting previously saved data.
|
// We are overwritting previously saved data.
|
||||||
|
|
|
@ -68,9 +68,11 @@ class TtRssServiceRoot : public ServiceRoot {
|
||||||
|
|
||||||
TtRssNetworkFactory *network() const;
|
TtRssNetworkFactory *network() const;
|
||||||
|
|
||||||
|
// Returns list of custom IDS of all DB messages in given item.
|
||||||
|
QStringList customIDSOfMessagesForItem(RootItem *item);
|
||||||
|
|
||||||
void saveAccountDataToDatabase();
|
void saveAccountDataToDatabase();
|
||||||
void updateTitle();
|
void updateTitle();
|
||||||
|
|
||||||
void completelyRemoveAllData();
|
void completelyRemoveAllData();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
Loading…
Add table
Reference in a new issue