Remove redundat methods.
This commit is contained in:
parent
ad2af43af2
commit
17d04b8bde
|
@ -1037,39 +1037,6 @@ int DatabaseQueries::createAccount(QSqlDatabase db, const QString& code, bool* o
|
|||
}
|
||||
}
|
||||
|
||||
Assignment DatabaseQueries::getOwnCloudCategories(QSqlDatabase db, int account_id, bool* ok) {
|
||||
Assignment categories;
|
||||
|
||||
// Obtain data for categories from the database.
|
||||
QSqlQuery q(db);
|
||||
|
||||
q.setForwardOnly(true);
|
||||
q.prepare(QSL("SELECT * FROM Categories WHERE account_id = :account_id;"));
|
||||
q.bindValue(QSL(":account_id"), account_id);
|
||||
|
||||
if (!q.exec()) {
|
||||
qFatal("ownCloud: Query for obtaining categories failed. Error message: '%s'.", qPrintable(q.lastError().text()));
|
||||
|
||||
if (ok != nullptr) {
|
||||
*ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
while (q.next()) {
|
||||
AssignmentItem pair;
|
||||
|
||||
pair.first = q.value(CAT_DB_PARENT_ID_INDEX).toInt();
|
||||
pair.second = new Category(q.record());
|
||||
categories << pair;
|
||||
}
|
||||
|
||||
if (ok != nullptr) {
|
||||
*ok = true;
|
||||
}
|
||||
|
||||
return categories;
|
||||
}
|
||||
|
||||
Assignment DatabaseQueries::getOwnCloudFeeds(QSqlDatabase db, int account_id, bool* ok) {
|
||||
Assignment feeds;
|
||||
QSqlQuery q(db);
|
||||
|
@ -1328,7 +1295,7 @@ QList<ServiceRoot*> DatabaseQueries::getAccounts(QSqlDatabase db, bool* ok) {
|
|||
return roots;
|
||||
}
|
||||
|
||||
Assignment DatabaseQueries::getCategories(QSqlDatabase db, int account_id, bool* ok) {
|
||||
Assignment DatabaseQueries::getStandardCategories(QSqlDatabase db, int account_id, bool* ok) {
|
||||
Assignment categories;
|
||||
|
||||
// Obtain data for categories from the database.
|
||||
|
@ -1363,7 +1330,7 @@ Assignment DatabaseQueries::getCategories(QSqlDatabase db, int account_id, bool*
|
|||
return categories;
|
||||
}
|
||||
|
||||
Assignment DatabaseQueries::getFeeds(QSqlDatabase db, int account_id, bool* ok) {
|
||||
Assignment DatabaseQueries::getStandardFeeds(QSqlDatabase db, int account_id, bool* ok) {
|
||||
Assignment feeds;
|
||||
QSqlQuery q(db);
|
||||
|
||||
|
@ -1475,7 +1442,7 @@ bool DatabaseQueries::createTtRssAccount(QSqlDatabase db, int id_to_assign, cons
|
|||
}
|
||||
}
|
||||
|
||||
Assignment DatabaseQueries::getTtRssCategories(QSqlDatabase db, int account_id, bool* ok) {
|
||||
Assignment DatabaseQueries::getCategories(QSqlDatabase db, int account_id, bool* ok) {
|
||||
Assignment categories;
|
||||
|
||||
// Obtain data for categories from the database.
|
||||
|
|
|
@ -76,6 +76,7 @@ class DatabaseQueries {
|
|||
static bool storeAccountTree(QSqlDatabase db, RootItem* tree_root, int account_id);
|
||||
static bool editBaseFeed(QSqlDatabase db, int feed_id, Feed::AutoUpdateType auto_update_type,
|
||||
int auto_update_interval);
|
||||
static Assignment getCategories(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
||||
|
||||
// ownCloud account.
|
||||
static QList<ServiceRoot*> getOwnCloudAccounts(QSqlDatabase db, bool* ok = nullptr);
|
||||
|
@ -85,7 +86,6 @@ class DatabaseQueries {
|
|||
static bool createOwnCloudAccount(QSqlDatabase db, int id_to_assign, const QString& username, const QString& password,
|
||||
const QString& url, bool force_server_side_feed_update);
|
||||
static int createAccount(QSqlDatabase db, const QString& code, bool* ok = nullptr);
|
||||
static Assignment getOwnCloudCategories(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
||||
static Assignment getOwnCloudFeeds(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
||||
|
||||
// Standard account.
|
||||
|
@ -107,8 +107,8 @@ class DatabaseQueries {
|
|||
const QString& username, const QString& password, Feed::AutoUpdateType auto_update_type,
|
||||
int auto_update_interval, StandardFeed::Type feed_format);
|
||||
static QList<ServiceRoot*> getAccounts(QSqlDatabase db, bool* ok = nullptr);
|
||||
static Assignment getCategories(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
||||
static Assignment getFeeds(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
||||
static Assignment getStandardCategories(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
||||
static Assignment getStandardFeeds(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
||||
|
||||
// TT-RSS acccount.
|
||||
static QList<ServiceRoot*> getTtRssAccounts(QSqlDatabase db, bool* ok = nullptr);
|
||||
|
@ -120,7 +120,6 @@ class DatabaseQueries {
|
|||
const QString& password, bool auth_protected, const QString& auth_username,
|
||||
const QString& auth_password, const QString& url,
|
||||
bool force_server_side_feed_update);
|
||||
static Assignment getTtRssCategories(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
||||
static Assignment getTtRssFeeds(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
||||
|
||||
private:
|
||||
|
|
|
@ -280,7 +280,7 @@ RootItem* OwnCloudServiceRoot::obtainNewTreeForSyncIn() const {
|
|||
|
||||
void OwnCloudServiceRoot::loadFromDatabase() {
|
||||
QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
|
||||
Assignment categories = DatabaseQueries::getOwnCloudCategories(database, accountId());
|
||||
Assignment categories = DatabaseQueries::getCategories(database, accountId());
|
||||
Assignment feeds = DatabaseQueries::getOwnCloudFeeds(database, accountId());
|
||||
|
||||
// All data are now obtained, lets create the hierarchy.
|
||||
|
|
|
@ -163,8 +163,8 @@ Qt::ItemFlags StandardServiceRoot::additionalFlags() const {
|
|||
|
||||
void StandardServiceRoot::loadFromDatabase() {
|
||||
QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
|
||||
Assignment categories = DatabaseQueries::getCategories(database, accountId());
|
||||
Assignment feeds = DatabaseQueries::getFeeds(database, accountId());
|
||||
Assignment categories = DatabaseQueries::getStandardCategories(database, accountId());
|
||||
Assignment feeds = DatabaseQueries::getStandardFeeds(database, accountId());
|
||||
|
||||
// All data are now obtained, lets create the hierarchy.
|
||||
assembleCategories(categories);
|
||||
|
|
|
@ -262,7 +262,7 @@ void TtRssServiceRoot::saveAccountDataToDatabase() {
|
|||
|
||||
void TtRssServiceRoot::loadFromDatabase() {
|
||||
QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
|
||||
Assignment categories = DatabaseQueries::getTtRssCategories(database, accountId());
|
||||
Assignment categories = DatabaseQueries::getCategories(database, accountId());
|
||||
Assignment feeds = DatabaseQueries::getTtRssFeeds(database, accountId());
|
||||
|
||||
// All data are now obtained, lets create the hierarchy.
|
||||
|
|
Loading…
Reference in New Issue