diff --git a/src/miscellaneous/databasequeries.cpp b/src/miscellaneous/databasequeries.cpp index 1bd33a679..379ce59e8 100755 --- a/src/miscellaneous/databasequeries.cpp +++ b/src/miscellaneous/databasequeries.cpp @@ -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 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. diff --git a/src/miscellaneous/databasequeries.h b/src/miscellaneous/databasequeries.h index 4cd286228..5ef13d52e 100755 --- a/src/miscellaneous/databasequeries.h +++ b/src/miscellaneous/databasequeries.h @@ -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 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 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 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: diff --git a/src/services/owncloud/owncloudserviceroot.cpp b/src/services/owncloud/owncloudserviceroot.cpp index 131a016a5..895df9688 100755 --- a/src/services/owncloud/owncloudserviceroot.cpp +++ b/src/services/owncloud/owncloudserviceroot.cpp @@ -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. diff --git a/src/services/standard/standardserviceroot.cpp b/src/services/standard/standardserviceroot.cpp index a8887eb7c..643b42149 100755 --- a/src/services/standard/standardserviceroot.cpp +++ b/src/services/standard/standardserviceroot.cpp @@ -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); diff --git a/src/services/tt-rss/ttrssserviceroot.cpp b/src/services/tt-rss/ttrssserviceroot.cpp index 4bd1c02a8..34414c5eb 100755 --- a/src/services/tt-rss/ttrssserviceroot.cpp +++ b/src/services/tt-rss/ttrssserviceroot.cpp @@ -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.