fix build
This commit is contained in:
parent
fdeef6b6a6
commit
c7cbb5fe8e
@ -92,6 +92,9 @@ class DatabaseQueries {
|
||||
// Common account methods.
|
||||
template<typename T>
|
||||
static QList<ServiceRoot*> getAccounts(const QSqlDatabase& db, const QString& code, bool* ok = nullptr);
|
||||
|
||||
template<typename Categ, typename Fee>
|
||||
static void loadFromDatabase(ServiceRoot* root);
|
||||
static bool storeNewOauthTokens(const QSqlDatabase& db, const QString& table_name,
|
||||
const QString& refresh_token, int account_id);
|
||||
static void createOverwriteAccount(const QSqlDatabase& db, ServiceRoot* account);
|
||||
@ -320,4 +323,14 @@ Assignment DatabaseQueries::getFeeds(const QSqlDatabase& db,
|
||||
return feeds;
|
||||
}
|
||||
|
||||
template<typename Categ, typename Fee>
|
||||
void DatabaseQueries::loadFromDatabase(ServiceRoot* root) {
|
||||
QSqlDatabase database = root->internalDatabase();
|
||||
Assignment categories = DatabaseQueries::getCategories<Categ>(database, root->accountId());
|
||||
Assignment feeds = DatabaseQueries::getFeeds<Fee>(database, root->internalFilters(), root->accountId());
|
||||
auto labels = DatabaseQueries::getLabels(database, root->accountId());
|
||||
|
||||
root->performInitialAssembly(categories, feeds, labels);
|
||||
}
|
||||
|
||||
#endif // DATABASEQUERIES_H
|
||||
|
@ -6,8 +6,8 @@
|
||||
#include "services/abstract/rootitem.h"
|
||||
|
||||
#include "core/message.h"
|
||||
#include "core/messagefilter.h"
|
||||
#include "definitions/typedefs.h"
|
||||
#include "miscellaneous/databasequeries.h"
|
||||
|
||||
#include <QNetworkProxy>
|
||||
#include <QPair>
|
||||
@ -62,9 +62,6 @@ class ServiceRoot : public RootItem {
|
||||
virtual QList<CustomDatabaseEntry> customDatabaseAttributes() const;
|
||||
virtual void saveAccountDataToDatabase();
|
||||
|
||||
template<typename Categ, typename Feed>
|
||||
void loadFromDatabase();
|
||||
|
||||
// Returns list of specific actions for "Add new item" main window menu.
|
||||
// So typical list of returned actions could look like:
|
||||
// a) Add new feed
|
||||
@ -201,13 +198,19 @@ class ServiceRoot : public RootItem {
|
||||
QStringList customIDsOfMessages(const QList<Message>& messages);
|
||||
QStringList customIDSOfMessagesForItem(RootItem* item);
|
||||
|
||||
void performInitialAssembly(const Assignment& categories, const Assignment& feeds, const QList<Label*>& labels);
|
||||
|
||||
// Helper methods to keep "application.h" inclusion
|
||||
// out of this file.
|
||||
QSqlDatabase internalDatabase() const;
|
||||
QList<MessageFilter*> internalFilters() const;
|
||||
|
||||
public slots:
|
||||
virtual void addNewFeed(RootItem* selected_item, const QString& url = QString());
|
||||
virtual void addNewCategory(RootItem* selected_item);
|
||||
virtual void syncIn();
|
||||
|
||||
protected:
|
||||
void performInitialAssembly(const Assignment& categories, const Assignment& feeds, const QList<Label*>& labels);
|
||||
|
||||
// This method should obtain new tree of feed/categories/whatever to perform sync in.
|
||||
virtual RootItem* obtainNewTreeForSyncIn() const;
|
||||
@ -255,11 +258,6 @@ class ServiceRoot : public RootItem {
|
||||
virtual QMap<QString, QVariantMap> storeCustomFeedsData();
|
||||
virtual void restoreCustomFeedsData(const QMap<QString, QVariantMap>& data, const QHash<QString, Feed*>& feeds);
|
||||
|
||||
// Helper methods to keep "application.h" inclusion
|
||||
// out of this file.
|
||||
QSqlDatabase internalDatabase() const;
|
||||
QList<MessageFilter*> internalFilters() const;
|
||||
|
||||
protected:
|
||||
RecycleBin* m_recycleBin;
|
||||
ImportantNode* m_importantNode;
|
||||
@ -272,15 +270,4 @@ class ServiceRoot : public RootItem {
|
||||
ServiceRoot::LabelOperation operator|(ServiceRoot::LabelOperation lhs, ServiceRoot::LabelOperation rhs);
|
||||
ServiceRoot::LabelOperation operator&(ServiceRoot::LabelOperation lhs, ServiceRoot::LabelOperation rhs);
|
||||
|
||||
template<typename Categ, typename Fee>
|
||||
void ServiceRoot::loadFromDatabase() {
|
||||
|
||||
QSqlDatabase database = internalDatabase();
|
||||
Assignment categories = DatabaseQueries::getCategories<Categ>(database, accountId());
|
||||
Assignment feeds = DatabaseQueries::getFeeds<Fee>(database, internalFilters(), accountId());
|
||||
auto labels = DatabaseQueries::getLabels(database, accountId());
|
||||
|
||||
performInitialAssembly(categories, feeds, labels);
|
||||
}
|
||||
|
||||
#endif // SERVICEROOT_H
|
||||
|
@ -38,7 +38,7 @@ ServiceRoot::LabelOperation TtRssServiceRoot::supportedLabelOperations() const {
|
||||
|
||||
void TtRssServiceRoot::start(bool freshly_activated) {
|
||||
if (!freshly_activated) {
|
||||
loadFromDatabase<Category, TtRssFeed>();
|
||||
DatabaseQueries::loadFromDatabase<Category, TtRssFeed>(this);
|
||||
loadCacheFromFile();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user