refactoring pt. 1
This commit is contained in:
parent
7c8d4bd0a6
commit
8a5c744210
17 changed files with 171 additions and 171 deletions
|
@ -369,7 +369,7 @@ QString DatabaseFactory::sqliteDatabaseFilePath() const {
|
||||||
return m_sqliteDatabaseFilePath + QDir::separator() + APP_DB_SQLITE_FILE;
|
return m_sqliteDatabaseFilePath + QDir::separator() + APP_DB_SQLITE_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseFactory::sqliteUpdateDatabaseSchema(QSqlDatabase database, const QString& source_db_schema_version) {
|
bool DatabaseFactory::sqliteUpdateDatabaseSchema(const QSqlDatabase& database, const QString& source_db_schema_version) {
|
||||||
int working_version = QString(source_db_schema_version).remove('.').toInt();
|
int working_version = QString(source_db_schema_version).remove('.').toInt();
|
||||||
const int current_version = QString(APP_DB_SCHEMA_VERSION).remove('.').toInt();
|
const int current_version = QString(APP_DB_SCHEMA_VERSION).remove('.').toInt();
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ bool DatabaseFactory::sqliteUpdateDatabaseSchema(QSqlDatabase database, const QS
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseFactory::mysqlUpdateDatabaseSchema(QSqlDatabase database, const QString& source_db_schema_version, const QString& db_name) {
|
bool DatabaseFactory::mysqlUpdateDatabaseSchema(const QSqlDatabase& database, const QString& source_db_schema_version, const QString& db_name) {
|
||||||
int working_version = QString(source_db_schema_version).remove('.').toInt();
|
int working_version = QString(source_db_schema_version).remove('.').toInt();
|
||||||
const int current_version = QString(APP_DB_SCHEMA_VERSION).remove('.').toInt();
|
const int current_version = QString(APP_DB_SCHEMA_VERSION).remove('.').toInt();
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ class DatabaseFactory : public QObject {
|
||||||
QSqlDatabase mysqlInitializeDatabase(const QString& connection_name);
|
QSqlDatabase mysqlInitializeDatabase(const QString& connection_name);
|
||||||
|
|
||||||
// Updates database schema.
|
// Updates database schema.
|
||||||
bool mysqlUpdateDatabaseSchema(QSqlDatabase database, const QString& source_db_schema_version, const QString& db_name);
|
bool mysqlUpdateDatabaseSchema(const QSqlDatabase& database, const QString& source_db_schema_version, const QString& db_name);
|
||||||
|
|
||||||
// Runs "VACUUM" on the database.
|
// Runs "VACUUM" on the database.
|
||||||
bool mysqlVacuumDatabase();
|
bool mysqlVacuumDatabase();
|
||||||
|
@ -149,7 +149,7 @@ class DatabaseFactory : public QObject {
|
||||||
void sqliteAssemblyDatabaseFilePath();
|
void sqliteAssemblyDatabaseFilePath();
|
||||||
|
|
||||||
// Updates database schema.
|
// Updates database schema.
|
||||||
bool sqliteUpdateDatabaseSchema(QSqlDatabase database, const QString& source_db_schema_version);
|
bool sqliteUpdateDatabaseSchema(const QSqlDatabase& database, const QString& source_db_schema_version);
|
||||||
|
|
||||||
// Creates new connection, initializes database and
|
// Creates new connection, initializes database and
|
||||||
// returns opened connections.
|
// returns opened connections.
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
bool DatabaseQueries::markMessagesReadUnread(QSqlDatabase db, const QStringList& ids, RootItem::ReadStatus read) {
|
bool DatabaseQueries::markMessagesReadUnread(const QSqlDatabase& db, const QStringList& ids, RootItem::ReadStatus read) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
|
@ -38,7 +38,7 @@ bool DatabaseQueries::markMessagesReadUnread(QSqlDatabase db, const QStringList&
|
||||||
.arg(ids.join(QSL(", ")), read == RootItem::Read ? QSL("1") : QSL("0")));
|
.arg(ids.join(QSL(", ")), read == RootItem::Read ? QSL("1") : QSL("0")));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::markMessageImportant(QSqlDatabase db, int id, RootItem::Importance importance) {
|
bool DatabaseQueries::markMessageImportant(const QSqlDatabase& db, int id, RootItem::Importance importance) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
|
@ -55,7 +55,7 @@ bool DatabaseQueries::markMessageImportant(QSqlDatabase db, int id, RootItem::Im
|
||||||
return q.exec();
|
return q.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::markFeedsReadUnread(QSqlDatabase db, const QStringList& ids, int account_id, RootItem::ReadStatus read) {
|
bool DatabaseQueries::markFeedsReadUnread(const QSqlDatabase& db, const QStringList& ids, int account_id, RootItem::ReadStatus read) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
|
@ -66,7 +66,7 @@ bool DatabaseQueries::markFeedsReadUnread(QSqlDatabase db, const QStringList& id
|
||||||
return q.exec();
|
return q.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::markBinReadUnread(QSqlDatabase db, int account_id, RootItem::ReadStatus read) {
|
bool DatabaseQueries::markBinReadUnread(const QSqlDatabase& db, int account_id, RootItem::ReadStatus read) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
|
@ -77,7 +77,7 @@ bool DatabaseQueries::markBinReadUnread(QSqlDatabase db, int account_id, RootIte
|
||||||
return q.exec();
|
return q.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::markAccountReadUnread(QSqlDatabase db, int account_id, RootItem::ReadStatus read) {
|
bool DatabaseQueries::markAccountReadUnread(const QSqlDatabase& db, int account_id, RootItem::ReadStatus read) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
|
@ -87,21 +87,21 @@ bool DatabaseQueries::markAccountReadUnread(QSqlDatabase db, int account_id, Roo
|
||||||
return q.exec();
|
return q.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::switchMessagesImportance(QSqlDatabase db, const QStringList& ids) {
|
bool DatabaseQueries::switchMessagesImportance(const QSqlDatabase& db, const QStringList& ids) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
return q.exec(QString(QSL("UPDATE Messages SET is_important = NOT is_important WHERE id IN (%1);")).arg(ids.join(QSL(", "))));
|
return q.exec(QString(QSL("UPDATE Messages SET is_important = NOT is_important WHERE id IN (%1);")).arg(ids.join(QSL(", "))));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::permanentlyDeleteMessages(QSqlDatabase db, const QStringList& ids) {
|
bool DatabaseQueries::permanentlyDeleteMessages(const QSqlDatabase& db, const QStringList& ids) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
return q.exec(QString(QSL("UPDATE Messages SET is_pdeleted = 1 WHERE id IN (%1);")).arg(ids.join(QSL(", "))));
|
return q.exec(QString(QSL("UPDATE Messages SET is_pdeleted = 1 WHERE id IN (%1);")).arg(ids.join(QSL(", "))));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::deleteOrRestoreMessagesToFromBin(QSqlDatabase db, const QStringList& ids, bool deleted) {
|
bool DatabaseQueries::deleteOrRestoreMessagesToFromBin(const QSqlDatabase& db, const QStringList& ids, bool deleted) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
|
@ -110,7 +110,7 @@ bool DatabaseQueries::deleteOrRestoreMessagesToFromBin(QSqlDatabase db, const QS
|
||||||
QString::number(0)));
|
QString::number(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::restoreBin(QSqlDatabase db, int account_id) {
|
bool DatabaseQueries::restoreBin(const QSqlDatabase& db, int account_id) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
|
@ -120,7 +120,7 @@ bool DatabaseQueries::restoreBin(QSqlDatabase db, int account_id) {
|
||||||
return q.exec();
|
return q.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::purgeImportantMessages(QSqlDatabase db) {
|
bool DatabaseQueries::purgeImportantMessages(const QSqlDatabase& db) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
|
@ -128,7 +128,7 @@ bool DatabaseQueries::purgeImportantMessages(QSqlDatabase db) {
|
||||||
return q.exec();
|
return q.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::purgeReadMessages(QSqlDatabase db) {
|
bool DatabaseQueries::purgeReadMessages(const QSqlDatabase& db) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
|
@ -143,7 +143,7 @@ bool DatabaseQueries::purgeReadMessages(QSqlDatabase db) {
|
||||||
return q.exec();
|
return q.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::purgeOldMessages(QSqlDatabase db, int older_than_days) {
|
bool DatabaseQueries::purgeOldMessages(const QSqlDatabase& db, int older_than_days) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
const qint64 since_epoch = QDateTime::currentDateTimeUtc().addDays(-older_than_days).toMSecsSinceEpoch();
|
const qint64 since_epoch = QDateTime::currentDateTimeUtc().addDays(-older_than_days).toMSecsSinceEpoch();
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ bool DatabaseQueries::purgeOldMessages(QSqlDatabase db, int older_than_days) {
|
||||||
return q.exec();
|
return q.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::purgeRecycleBin(QSqlDatabase db) {
|
bool DatabaseQueries::purgeRecycleBin(const QSqlDatabase& db) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
|
@ -168,7 +168,7 @@ bool DatabaseQueries::purgeRecycleBin(QSqlDatabase db) {
|
||||||
return q.exec();
|
return q.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, QPair<int, int>> DatabaseQueries::getMessageCountsForCategory(QSqlDatabase db, const QString& custom_id, int account_id,
|
QMap<QString, QPair<int, int>> DatabaseQueries::getMessageCountsForCategory(const QSqlDatabase& db, const QString& custom_id, int account_id,
|
||||||
bool including_total_counts, bool* ok) {
|
bool including_total_counts, bool* ok) {
|
||||||
QMap<QString, QPair<int, int>> counts;
|
QMap<QString, QPair<int, int>> counts;
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
@ -217,7 +217,7 @@ QMap<QString, QPair<int, int>> DatabaseQueries::getMessageCountsForCategory(QSql
|
||||||
return counts;
|
return counts;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, QPair<int, int>> DatabaseQueries::getMessageCountsForAccount(QSqlDatabase db, int account_id,
|
QMap<QString, QPair<int, int>> DatabaseQueries::getMessageCountsForAccount(const QSqlDatabase& db, int account_id,
|
||||||
bool including_total_counts, bool* ok) {
|
bool including_total_counts, bool* ok) {
|
||||||
QMap<QString, QPair<int, int>> counts;
|
QMap<QString, QPair<int, int>> counts;
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
@ -265,7 +265,7 @@ QMap<QString, QPair<int, int>> DatabaseQueries::getMessageCountsForAccount(QSqlD
|
||||||
return counts;
|
return counts;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DatabaseQueries::getMessageCountsForFeed(QSqlDatabase db, const QString& feed_custom_id,
|
int DatabaseQueries::getMessageCountsForFeed(const QSqlDatabase& db, const QString& feed_custom_id,
|
||||||
int account_id, bool including_total_counts, bool* ok) {
|
int account_id, bool including_total_counts, bool* ok) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ int DatabaseQueries::getMessageCountsForFeed(QSqlDatabase db, const QString& fee
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int DatabaseQueries::getMessageCountsForBin(QSqlDatabase db, int account_id, bool including_total_counts, bool* ok) {
|
int DatabaseQueries::getMessageCountsForBin(const QSqlDatabase& db, int account_id, bool including_total_counts, bool* ok) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
|
@ -331,7 +331,7 @@ int DatabaseQueries::getMessageCountsForBin(QSqlDatabase db, int account_id, boo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Message> DatabaseQueries::getUndeletedMessagesForFeed(QSqlDatabase db, const QString& feed_custom_id, int account_id, bool* ok) {
|
QList<Message> DatabaseQueries::getUndeletedMessagesForFeed(const QSqlDatabase& db, const QString& feed_custom_id, int account_id, bool* ok) {
|
||||||
QList<Message> messages;
|
QList<Message> messages;
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ QList<Message> DatabaseQueries::getUndeletedMessagesForFeed(QSqlDatabase db, con
|
||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Message> DatabaseQueries::getUndeletedMessagesForBin(QSqlDatabase db, int account_id, bool* ok) {
|
QList<Message> DatabaseQueries::getUndeletedMessagesForBin(const QSqlDatabase& db, int account_id, bool* ok) {
|
||||||
QList<Message> messages;
|
QList<Message> messages;
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@ QList<Message> DatabaseQueries::getUndeletedMessagesForBin(QSqlDatabase db, int
|
||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Message> DatabaseQueries::getUndeletedMessagesForAccount(QSqlDatabase db, int account_id, bool* ok) {
|
QList<Message> DatabaseQueries::getUndeletedMessagesForAccount(const QSqlDatabase& db, int account_id, bool* ok) {
|
||||||
QList<Message> messages;
|
QList<Message> messages;
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
|
@ -664,7 +664,7 @@ int DatabaseQueries::updateMessages(QSqlDatabase db,
|
||||||
return updated_messages;
|
return updated_messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::purgeMessagesFromBin(QSqlDatabase db, bool clear_only_read, int account_id) {
|
bool DatabaseQueries::purgeMessagesFromBin(const QSqlDatabase& db, bool clear_only_read, int account_id) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
|
@ -680,7 +680,7 @@ bool DatabaseQueries::purgeMessagesFromBin(QSqlDatabase db, bool clear_only_read
|
||||||
return q.exec();
|
return q.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::deleteAccount(QSqlDatabase db, int account_id) {
|
bool DatabaseQueries::deleteAccount(const QSqlDatabase& db, int account_id) {
|
||||||
QSqlQuery query(db);
|
QSqlQuery query(db);
|
||||||
|
|
||||||
query.setForwardOnly(true);
|
query.setForwardOnly(true);
|
||||||
|
@ -707,7 +707,7 @@ bool DatabaseQueries::deleteAccount(QSqlDatabase db, int account_id) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::deleteAccountData(QSqlDatabase db, int account_id, bool delete_messages_too) {
|
bool DatabaseQueries::deleteAccountData(const QSqlDatabase& db, int account_id, bool delete_messages_too) {
|
||||||
bool result = true;
|
bool result = true;
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
|
@ -730,7 +730,7 @@ bool DatabaseQueries::deleteAccountData(QSqlDatabase db, int account_id, bool de
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::cleanFeeds(QSqlDatabase db, const QStringList& ids, bool clean_read_only, int account_id) {
|
bool DatabaseQueries::cleanFeeds(const QSqlDatabase& db, const QStringList& ids, bool clean_read_only, int account_id) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
|
@ -758,7 +758,7 @@ bool DatabaseQueries::cleanFeeds(QSqlDatabase db, const QStringList& ids, bool c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::purgeLeftoverMessages(QSqlDatabase db, int account_id) {
|
bool DatabaseQueries::purgeLeftoverMessages(const QSqlDatabase& db, int account_id) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
|
@ -775,7 +775,7 @@ bool DatabaseQueries::purgeLeftoverMessages(QSqlDatabase db, int account_id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::storeAccountTree(QSqlDatabase db, RootItem* tree_root, int account_id) {
|
bool DatabaseQueries::storeAccountTree(const QSqlDatabase& db, RootItem* tree_root, int account_id) {
|
||||||
QSqlQuery query_category(db);
|
QSqlQuery query_category(db);
|
||||||
QSqlQuery query_feed(db);
|
QSqlQuery query_feed(db);
|
||||||
|
|
||||||
|
@ -825,7 +825,7 @@ bool DatabaseQueries::storeAccountTree(QSqlDatabase db, RootItem* tree_root, int
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList DatabaseQueries::customIdsOfMessagesFromAccount(QSqlDatabase db, int account_id, bool* ok) {
|
QStringList DatabaseQueries::customIdsOfMessagesFromAccount(const QSqlDatabase& db, int account_id, bool* ok) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
QStringList ids;
|
QStringList ids;
|
||||||
|
|
||||||
|
@ -847,7 +847,7 @@ QStringList DatabaseQueries::customIdsOfMessagesFromAccount(QSqlDatabase db, int
|
||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList DatabaseQueries::customIdsOfMessagesFromBin(QSqlDatabase db, int account_id, bool* ok) {
|
QStringList DatabaseQueries::customIdsOfMessagesFromBin(const QSqlDatabase& db, int account_id, bool* ok) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
QStringList ids;
|
QStringList ids;
|
||||||
|
|
||||||
|
@ -869,7 +869,7 @@ QStringList DatabaseQueries::customIdsOfMessagesFromBin(QSqlDatabase db, int acc
|
||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList DatabaseQueries::customIdsOfMessagesFromFeed(QSqlDatabase db, const QString& feed_custom_id, int account_id, bool* ok) {
|
QStringList DatabaseQueries::customIdsOfMessagesFromFeed(const QSqlDatabase& db, const QString& feed_custom_id, int account_id, bool* ok) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
QStringList ids;
|
QStringList ids;
|
||||||
|
|
||||||
|
@ -892,14 +892,14 @@ QStringList DatabaseQueries::customIdsOfMessagesFromFeed(QSqlDatabase db, const
|
||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ServiceRoot*> DatabaseQueries::getOwnCloudAccounts(QSqlDatabase db, bool* ok) {
|
QList<ServiceRoot*> DatabaseQueries::getOwnCloudAccounts(const QSqlDatabase& db, bool* ok) {
|
||||||
QSqlQuery query(db);
|
QSqlQuery query(db);
|
||||||
|
|
||||||
QList<ServiceRoot*> roots;
|
QList<ServiceRoot*> roots;
|
||||||
|
|
||||||
if (query.exec("SELECT * FROM OwnCloudAccounts;")) {
|
if (query.exec("SELECT * FROM OwnCloudAccounts;")) {
|
||||||
while (query.next()) {
|
while (query.next()) {
|
||||||
OwnCloudServiceRoot* root = new OwnCloudServiceRoot();
|
auto* root = new OwnCloudServiceRoot();
|
||||||
|
|
||||||
root->setId(query.value(0).toInt());
|
root->setId(query.value(0).toInt());
|
||||||
root->setAccountId(query.value(0).toInt());
|
root->setAccountId(query.value(0).toInt());
|
||||||
|
@ -927,14 +927,14 @@ QList<ServiceRoot*> DatabaseQueries::getOwnCloudAccounts(QSqlDatabase db, bool*
|
||||||
return roots;
|
return roots;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ServiceRoot*> DatabaseQueries::getTtRssAccounts(QSqlDatabase db, bool* ok) {
|
QList<ServiceRoot*> DatabaseQueries::getTtRssAccounts(const QSqlDatabase& db, bool* ok) {
|
||||||
QSqlQuery query(db);
|
QSqlQuery query(db);
|
||||||
|
|
||||||
QList<ServiceRoot*> roots;
|
QList<ServiceRoot*> roots;
|
||||||
|
|
||||||
if (query.exec("SELECT * FROM TtRssAccounts;")) {
|
if (query.exec("SELECT * FROM TtRssAccounts;")) {
|
||||||
while (query.next()) {
|
while (query.next()) {
|
||||||
TtRssServiceRoot* root = new TtRssServiceRoot();
|
auto* root = new TtRssServiceRoot();
|
||||||
|
|
||||||
root->setId(query.value(0).toInt());
|
root->setId(query.value(0).toInt());
|
||||||
root->setAccountId(query.value(0).toInt());
|
root->setAccountId(query.value(0).toInt());
|
||||||
|
@ -964,7 +964,7 @@ QList<ServiceRoot*> DatabaseQueries::getTtRssAccounts(QSqlDatabase db, bool* ok)
|
||||||
return roots;
|
return roots;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::deleteOwnCloudAccount(QSqlDatabase db, int account_id) {
|
bool DatabaseQueries::deleteOwnCloudAccount(const QSqlDatabase& db, int account_id) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
|
@ -973,7 +973,7 @@ bool DatabaseQueries::deleteOwnCloudAccount(QSqlDatabase db, int account_id) {
|
||||||
return q.exec();
|
return q.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::overwriteOwnCloudAccount(QSqlDatabase db, const QString& username, const QString& password,
|
bool DatabaseQueries::overwriteOwnCloudAccount(const QSqlDatabase& db, const QString& username, const QString& password,
|
||||||
const QString& url, bool force_server_side_feed_update, int batch_size, int account_id) {
|
const QString& url, bool force_server_side_feed_update, int batch_size, int account_id) {
|
||||||
QSqlQuery query(db);
|
QSqlQuery query(db);
|
||||||
|
|
||||||
|
@ -996,7 +996,7 @@ bool DatabaseQueries::overwriteOwnCloudAccount(QSqlDatabase db, const QString& u
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::createOwnCloudAccount(QSqlDatabase db, int id_to_assign, const QString& username,
|
bool DatabaseQueries::createOwnCloudAccount(const QSqlDatabase& db, int id_to_assign, const QString& username,
|
||||||
const QString& password, const QString& url,
|
const QString& password, const QString& url,
|
||||||
bool force_server_side_feed_update, int batch_size) {
|
bool force_server_side_feed_update, int batch_size) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
@ -1019,7 +1019,7 @@ bool DatabaseQueries::createOwnCloudAccount(QSqlDatabase db, int id_to_assign, c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int DatabaseQueries::createAccount(QSqlDatabase db, const QString& code, bool* ok) {
|
int DatabaseQueries::createAccount(const QSqlDatabase& db, const QString& code, bool* ok) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
// First obtain the ID, which can be assigned to this new account.
|
// First obtain the ID, which can be assigned to this new account.
|
||||||
|
@ -1056,7 +1056,7 @@ int DatabaseQueries::createAccount(QSqlDatabase db, const QString& code, bool* o
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Assignment DatabaseQueries::getOwnCloudFeeds(QSqlDatabase db, int account_id, bool* ok) {
|
Assignment DatabaseQueries::getOwnCloudFeeds(const QSqlDatabase& db, int account_id, bool* ok) {
|
||||||
Assignment feeds;
|
Assignment feeds;
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
|
@ -1087,7 +1087,7 @@ Assignment DatabaseQueries::getOwnCloudFeeds(QSqlDatabase db, int account_id, bo
|
||||||
return feeds;
|
return feeds;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::deleteFeed(QSqlDatabase db, int feed_custom_id, int account_id) {
|
bool DatabaseQueries::deleteFeed(const QSqlDatabase& db, int feed_custom_id, int account_id) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
|
@ -1108,7 +1108,7 @@ bool DatabaseQueries::deleteFeed(QSqlDatabase db, int feed_custom_id, int accoun
|
||||||
return q.exec();
|
return q.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::deleteCategory(QSqlDatabase db, int id) {
|
bool DatabaseQueries::deleteCategory(const QSqlDatabase& db, int id) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
// Remove this category from database.
|
// Remove this category from database.
|
||||||
|
@ -1118,8 +1118,8 @@ bool DatabaseQueries::deleteCategory(QSqlDatabase db, int id) {
|
||||||
return q.exec();
|
return q.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
int DatabaseQueries::addCategory(QSqlDatabase db, int parent_id, int account_id, const QString& title,
|
int DatabaseQueries::addCategory(const QSqlDatabase& db, int parent_id, int account_id, const QString& title,
|
||||||
const QString& description, QDateTime creation_date, const QIcon& icon,
|
const QString& description, const QDateTime& creation_date, const QIcon& icon,
|
||||||
bool* ok) {
|
bool* ok) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
|
@ -1160,7 +1160,7 @@ int DatabaseQueries::addCategory(QSqlDatabase db, int parent_id, int account_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::editCategory(QSqlDatabase db, int parent_id, int category_id,
|
bool DatabaseQueries::editCategory(const QSqlDatabase& db, int parent_id, int category_id,
|
||||||
const QString& title, const QString& description, const QIcon& icon) {
|
const QString& title, const QString& description, const QIcon& icon) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
|
@ -1176,8 +1176,8 @@ bool DatabaseQueries::editCategory(QSqlDatabase db, int parent_id, int category_
|
||||||
return q.exec();
|
return q.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
int DatabaseQueries::addFeed(QSqlDatabase db, int parent_id, int account_id, const QString& title,
|
int DatabaseQueries::addFeed(const QSqlDatabase& db, int parent_id, int account_id, const QString& title,
|
||||||
const QString& description, QDateTime creation_date, const QIcon& icon,
|
const QString& description, const QDateTime& creation_date, const QIcon& icon,
|
||||||
const QString& encoding, const QString& url, bool is_protected,
|
const QString& encoding, const QString& url, bool is_protected,
|
||||||
const QString& username, const QString& password,
|
const QString& username, const QString& password,
|
||||||
Feed::AutoUpdateType auto_update_type,
|
Feed::AutoUpdateType auto_update_type,
|
||||||
|
@ -1236,7 +1236,7 @@ int DatabaseQueries::addFeed(QSqlDatabase db, int parent_id, int account_id, con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::editFeed(QSqlDatabase db, int parent_id, int feed_id, const QString& title,
|
bool DatabaseQueries::editFeed(const QSqlDatabase& db, int parent_id, int feed_id, const QString& title,
|
||||||
const QString& description, const QIcon& icon,
|
const QString& description, const QIcon& icon,
|
||||||
const QString& encoding, const QString& url, bool is_protected,
|
const QString& encoding, const QString& url, bool is_protected,
|
||||||
const QString& username, const QString& password,
|
const QString& username, const QString& password,
|
||||||
|
@ -1271,7 +1271,7 @@ bool DatabaseQueries::editFeed(QSqlDatabase db, int parent_id, int feed_id, cons
|
||||||
return q.exec();
|
return q.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::editBaseFeed(QSqlDatabase db, int feed_id, Feed::AutoUpdateType auto_update_type,
|
bool DatabaseQueries::editBaseFeed(const QSqlDatabase& db, int feed_id, Feed::AutoUpdateType auto_update_type,
|
||||||
int auto_update_interval) {
|
int auto_update_interval) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
|
@ -1285,7 +1285,7 @@ bool DatabaseQueries::editBaseFeed(QSqlDatabase db, int feed_id, Feed::AutoUpdat
|
||||||
return q.exec();
|
return q.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ServiceRoot*> DatabaseQueries::getAccounts(QSqlDatabase db, bool* ok) {
|
QList<ServiceRoot*> DatabaseQueries::getAccounts(const QSqlDatabase& db, bool* ok) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
QList<ServiceRoot*> roots;
|
QList<ServiceRoot*> roots;
|
||||||
|
@ -1295,7 +1295,7 @@ QList<ServiceRoot*> DatabaseQueries::getAccounts(QSqlDatabase db, bool* ok) {
|
||||||
|
|
||||||
if (q.exec()) {
|
if (q.exec()) {
|
||||||
while (q.next()) {
|
while (q.next()) {
|
||||||
StandardServiceRoot* root = new StandardServiceRoot();
|
auto* root = new StandardServiceRoot();
|
||||||
|
|
||||||
root->setAccountId(q.value(0).toInt());
|
root->setAccountId(q.value(0).toInt());
|
||||||
roots.append(root);
|
roots.append(root);
|
||||||
|
@ -1314,7 +1314,7 @@ QList<ServiceRoot*> DatabaseQueries::getAccounts(QSqlDatabase db, bool* ok) {
|
||||||
return roots;
|
return roots;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assignment DatabaseQueries::getStandardCategories(QSqlDatabase db, int account_id, bool* ok) {
|
Assignment DatabaseQueries::getStandardCategories(const QSqlDatabase& db, int account_id, bool* ok) {
|
||||||
Assignment categories;
|
Assignment categories;
|
||||||
|
|
||||||
// Obtain data for categories from the database.
|
// Obtain data for categories from the database.
|
||||||
|
@ -1349,7 +1349,7 @@ Assignment DatabaseQueries::getStandardCategories(QSqlDatabase db, int account_i
|
||||||
return categories;
|
return categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assignment DatabaseQueries::getStandardFeeds(QSqlDatabase db, int account_id, bool* ok) {
|
Assignment DatabaseQueries::getStandardFeeds(const QSqlDatabase& db, int account_id, bool* ok) {
|
||||||
Assignment feeds;
|
Assignment feeds;
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
|
@ -1396,7 +1396,7 @@ Assignment DatabaseQueries::getStandardFeeds(QSqlDatabase db, int account_id, bo
|
||||||
return feeds;
|
return feeds;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::deleteTtRssAccount(QSqlDatabase db, int account_id) {
|
bool DatabaseQueries::deleteTtRssAccount(const QSqlDatabase& db, int account_id) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
|
@ -1408,7 +1408,7 @@ bool DatabaseQueries::deleteTtRssAccount(QSqlDatabase db, int account_id) {
|
||||||
return q.exec();
|
return q.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::overwriteTtRssAccount(QSqlDatabase db, const QString& username, const QString& password,
|
bool DatabaseQueries::overwriteTtRssAccount(const QSqlDatabase& db, const QString& username, const QString& password,
|
||||||
bool auth_protected, const QString& auth_username, const QString& auth_password,
|
bool auth_protected, const QString& auth_username, const QString& auth_password,
|
||||||
const QString& url, bool force_server_side_feed_update, int account_id) {
|
const QString& url, bool force_server_side_feed_update, int account_id) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
@ -1435,7 +1435,7 @@ bool DatabaseQueries::overwriteTtRssAccount(QSqlDatabase db, const QString& user
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::createTtRssAccount(QSqlDatabase db, int id_to_assign, const QString& username,
|
bool DatabaseQueries::createTtRssAccount(const QSqlDatabase& db, int id_to_assign, const QString& username,
|
||||||
const QString& password, bool auth_protected, const QString& auth_username,
|
const QString& password, bool auth_protected, const QString& auth_username,
|
||||||
const QString& auth_password, const QString& url,
|
const QString& auth_password, const QString& url,
|
||||||
bool force_server_side_feed_update) {
|
bool force_server_side_feed_update) {
|
||||||
|
@ -1461,7 +1461,7 @@ bool DatabaseQueries::createTtRssAccount(QSqlDatabase db, int id_to_assign, cons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Assignment DatabaseQueries::getCategories(QSqlDatabase db, int account_id, bool* ok) {
|
Assignment DatabaseQueries::getCategories(const QSqlDatabase& db, int account_id, bool* ok) {
|
||||||
Assignment categories;
|
Assignment categories;
|
||||||
|
|
||||||
// Obtain data for categories from the database.
|
// Obtain data for categories from the database.
|
||||||
|
@ -1495,7 +1495,7 @@ Assignment DatabaseQueries::getCategories(QSqlDatabase db, int account_id, bool*
|
||||||
return categories;
|
return categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assignment DatabaseQueries::getGmailFeeds(QSqlDatabase db, int account_id, bool* ok) {
|
Assignment DatabaseQueries::getGmailFeeds(const QSqlDatabase& db, int account_id, bool* ok) {
|
||||||
Assignment feeds;
|
Assignment feeds;
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
|
@ -1526,14 +1526,14 @@ Assignment DatabaseQueries::getGmailFeeds(QSqlDatabase db, int account_id, bool*
|
||||||
return feeds;
|
return feeds;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ServiceRoot*> DatabaseQueries::getGmailAccounts(QSqlDatabase db, bool* ok) {
|
QList<ServiceRoot*> DatabaseQueries::getGmailAccounts(const QSqlDatabase& db, bool* ok) {
|
||||||
QSqlQuery query(db);
|
QSqlQuery query(db);
|
||||||
|
|
||||||
QList<ServiceRoot*> roots;
|
QList<ServiceRoot*> roots;
|
||||||
|
|
||||||
if (query.exec("SELECT * FROM GmailAccounts;")) {
|
if (query.exec("SELECT * FROM GmailAccounts;")) {
|
||||||
while (query.next()) {
|
while (query.next()) {
|
||||||
GmailServiceRoot* root = new GmailServiceRoot(nullptr);
|
auto* root = new GmailServiceRoot(nullptr);
|
||||||
|
|
||||||
root->setId(query.value(0).toInt());
|
root->setId(query.value(0).toInt());
|
||||||
root->setAccountId(query.value(0).toInt());
|
root->setAccountId(query.value(0).toInt());
|
||||||
|
@ -1562,7 +1562,7 @@ QList<ServiceRoot*> DatabaseQueries::getGmailAccounts(QSqlDatabase db, bool* ok)
|
||||||
return roots;
|
return roots;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::deleteGmailAccount(QSqlDatabase db, int account_id) {
|
bool DatabaseQueries::deleteGmailAccount(const QSqlDatabase& db, int account_id) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
|
@ -1571,7 +1571,7 @@ bool DatabaseQueries::deleteGmailAccount(QSqlDatabase db, int account_id) {
|
||||||
return q.exec();
|
return q.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::deleteInoreaderAccount(QSqlDatabase db, int account_id) {
|
bool DatabaseQueries::deleteInoreaderAccount(const QSqlDatabase& db, int account_id) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
|
@ -1580,7 +1580,7 @@ bool DatabaseQueries::deleteInoreaderAccount(QSqlDatabase db, int account_id) {
|
||||||
return q.exec();
|
return q.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
Assignment DatabaseQueries::getInoreaderFeeds(QSqlDatabase db, int account_id, bool* ok) {
|
Assignment DatabaseQueries::getInoreaderFeeds(const QSqlDatabase& db, int account_id, bool* ok) {
|
||||||
Assignment feeds;
|
Assignment feeds;
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
|
||||||
|
@ -1611,7 +1611,7 @@ Assignment DatabaseQueries::getInoreaderFeeds(QSqlDatabase db, int account_id, b
|
||||||
return feeds;
|
return feeds;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::storeNewInoreaderTokens(QSqlDatabase db, const QString& refresh_token, int account_id) {
|
bool DatabaseQueries::storeNewInoreaderTokens(const QSqlDatabase& db, const QString& refresh_token, int account_id) {
|
||||||
QSqlQuery query(db);
|
QSqlQuery query(db);
|
||||||
|
|
||||||
query.prepare("UPDATE InoreaderAccounts "
|
query.prepare("UPDATE InoreaderAccounts "
|
||||||
|
@ -1629,14 +1629,14 @@ bool DatabaseQueries::storeNewInoreaderTokens(QSqlDatabase db, const QString& re
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ServiceRoot*> DatabaseQueries::getInoreaderAccounts(QSqlDatabase db, bool* ok) {
|
QList<ServiceRoot*> DatabaseQueries::getInoreaderAccounts(const QSqlDatabase& db, bool* ok) {
|
||||||
QSqlQuery query(db);
|
QSqlQuery query(db);
|
||||||
|
|
||||||
QList<ServiceRoot*> roots;
|
QList<ServiceRoot*> roots;
|
||||||
|
|
||||||
if (query.exec("SELECT * FROM InoreaderAccounts;")) {
|
if (query.exec("SELECT * FROM InoreaderAccounts;")) {
|
||||||
while (query.next()) {
|
while (query.next()) {
|
||||||
InoreaderServiceRoot* root = new InoreaderServiceRoot(nullptr);
|
auto* root = new InoreaderServiceRoot(nullptr);
|
||||||
|
|
||||||
root->setId(query.value(0).toInt());
|
root->setId(query.value(0).toInt());
|
||||||
root->setAccountId(query.value(0).toInt());
|
root->setAccountId(query.value(0).toInt());
|
||||||
|
@ -1665,7 +1665,7 @@ QList<ServiceRoot*> DatabaseQueries::getInoreaderAccounts(QSqlDatabase db, bool*
|
||||||
return roots;
|
return roots;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::overwriteGmailAccount(QSqlDatabase db, const QString& username, const QString& app_id,
|
bool DatabaseQueries::overwriteGmailAccount(const QSqlDatabase& db, const QString& username, const QString& app_id,
|
||||||
const QString& app_key, const QString& redirect_url,
|
const QString& app_key, const QString& redirect_url,
|
||||||
const QString& refresh_token, int batch_size, int account_id) {
|
const QString& refresh_token, int batch_size, int account_id) {
|
||||||
QSqlQuery query(db);
|
QSqlQuery query(db);
|
||||||
|
@ -1691,7 +1691,7 @@ bool DatabaseQueries::overwriteGmailAccount(QSqlDatabase db, const QString& user
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::createGmailAccount(QSqlDatabase db, int id_to_assign, const QString& username,
|
bool DatabaseQueries::createGmailAccount(const QSqlDatabase& db, int id_to_assign, const QString& username,
|
||||||
const QString& app_id, const QString& app_key, const QString& redirect_url,
|
const QString& app_id, const QString& app_key, const QString& redirect_url,
|
||||||
const QString& refresh_token, int batch_size) {
|
const QString& refresh_token, int batch_size) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
@ -1715,7 +1715,7 @@ bool DatabaseQueries::createGmailAccount(QSqlDatabase db, int id_to_assign, cons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::overwriteInoreaderAccount(QSqlDatabase db, const QString& username, const QString& app_id,
|
bool DatabaseQueries::overwriteInoreaderAccount(const QSqlDatabase& db, const QString& username, const QString& app_id,
|
||||||
const QString& app_key, const QString& redirect_url,
|
const QString& app_key, const QString& redirect_url,
|
||||||
const QString& refresh_token, int batch_size, int account_id) {
|
const QString& refresh_token, int batch_size, int account_id) {
|
||||||
QSqlQuery query(db);
|
QSqlQuery query(db);
|
||||||
|
@ -1741,7 +1741,7 @@ bool DatabaseQueries::overwriteInoreaderAccount(QSqlDatabase db, const QString&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseQueries::createInoreaderAccount(QSqlDatabase db, int id_to_assign, const QString& username,
|
bool DatabaseQueries::createInoreaderAccount(const QSqlDatabase& db, int id_to_assign, const QString& username,
|
||||||
const QString& app_id, const QString& app_key, const QString& redirect_url,
|
const QString& app_id, const QString& app_key, const QString& redirect_url,
|
||||||
const QString& refresh_token, int batch_size) {
|
const QString& refresh_token, int batch_size) {
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
|
@ -1765,7 +1765,7 @@ bool DatabaseQueries::createInoreaderAccount(QSqlDatabase db, int id_to_assign,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Assignment DatabaseQueries::getTtRssFeeds(QSqlDatabase db, int account_id, bool* ok) {
|
Assignment DatabaseQueries::getTtRssFeeds(const QSqlDatabase& db, int account_id, bool* ok) {
|
||||||
Assignment feeds;
|
Assignment feeds;
|
||||||
|
|
||||||
// All categories are now loaded.
|
// All categories are now loaded.
|
||||||
|
@ -1803,4 +1803,4 @@ QString DatabaseQueries::unnulifyString(const QString& str) {
|
||||||
return str.isNull() ? "" : str;
|
return str.isNull() ? "" : str;
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseQueries::DatabaseQueries() {}
|
DatabaseQueries::DatabaseQueries() = default;
|
||||||
|
|
|
@ -14,120 +14,120 @@ class DatabaseQueries {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Mark read/unread/starred/delete messages.
|
// Mark read/unread/starred/delete messages.
|
||||||
static bool markMessagesReadUnread(QSqlDatabase db, const QStringList& ids, RootItem::ReadStatus read);
|
static bool markMessagesReadUnread(const QSqlDatabase& db, const QStringList& ids, RootItem::ReadStatus read);
|
||||||
static bool markMessageImportant(QSqlDatabase db, int id, RootItem::Importance importance);
|
static bool markMessageImportant(const QSqlDatabase& db, int id, RootItem::Importance importance);
|
||||||
static bool markFeedsReadUnread(QSqlDatabase db, const QStringList& ids, int account_id, RootItem::ReadStatus read);
|
static bool markFeedsReadUnread(const QSqlDatabase& db, const QStringList& ids, int account_id, RootItem::ReadStatus read);
|
||||||
static bool markBinReadUnread(QSqlDatabase db, int account_id, RootItem::ReadStatus read);
|
static bool markBinReadUnread(const QSqlDatabase& db, int account_id, RootItem::ReadStatus read);
|
||||||
static bool markAccountReadUnread(QSqlDatabase db, int account_id, RootItem::ReadStatus read);
|
static bool markAccountReadUnread(const QSqlDatabase& db, int account_id, RootItem::ReadStatus read);
|
||||||
static bool switchMessagesImportance(QSqlDatabase db, const QStringList& ids);
|
static bool switchMessagesImportance(const QSqlDatabase& db, const QStringList& ids);
|
||||||
static bool permanentlyDeleteMessages(QSqlDatabase db, const QStringList& ids);
|
static bool permanentlyDeleteMessages(const QSqlDatabase& db, const QStringList& ids);
|
||||||
static bool deleteOrRestoreMessagesToFromBin(QSqlDatabase db, const QStringList& ids, bool deleted);
|
static bool deleteOrRestoreMessagesToFromBin(const QSqlDatabase& db, const QStringList& ids, bool deleted);
|
||||||
static bool restoreBin(QSqlDatabase db, int account_id);
|
static bool restoreBin(const QSqlDatabase& db, int account_id);
|
||||||
|
|
||||||
// Purge database.
|
// Purge database.
|
||||||
static bool purgeImportantMessages(QSqlDatabase db);
|
static bool purgeImportantMessages(const QSqlDatabase& db);
|
||||||
static bool purgeReadMessages(QSqlDatabase db);
|
static bool purgeReadMessages(const QSqlDatabase& db);
|
||||||
static bool purgeOldMessages(QSqlDatabase db, int older_than_days);
|
static bool purgeOldMessages(const QSqlDatabase& db, int older_than_days);
|
||||||
static bool purgeRecycleBin(QSqlDatabase db);
|
static bool purgeRecycleBin(const QSqlDatabase& db);
|
||||||
static bool purgeMessagesFromBin(QSqlDatabase db, bool clear_only_read, int account_id);
|
static bool purgeMessagesFromBin(const QSqlDatabase& db, bool clear_only_read, int account_id);
|
||||||
static bool purgeLeftoverMessages(QSqlDatabase db, int account_id);
|
static bool purgeLeftoverMessages(const QSqlDatabase& db, int account_id);
|
||||||
|
|
||||||
// Obtain counts of unread/all messages.
|
// Obtain counts of unread/all messages.
|
||||||
static QMap<QString, QPair<int, int>> getMessageCountsForCategory(QSqlDatabase db, const QString& custom_id, int account_id,
|
static QMap<QString, QPair<int, int>> getMessageCountsForCategory(const QSqlDatabase& db, const QString& custom_id, int account_id,
|
||||||
bool including_total_counts, bool* ok = nullptr);
|
bool including_total_counts, bool* ok = nullptr);
|
||||||
static QMap<QString, QPair<int, int>> getMessageCountsForAccount(QSqlDatabase db, int account_id,
|
static QMap<QString, QPair<int, int>> getMessageCountsForAccount(const QSqlDatabase& db, int account_id,
|
||||||
bool including_total_counts, bool* ok = nullptr);
|
bool including_total_counts, bool* ok = nullptr);
|
||||||
static int getMessageCountsForFeed(QSqlDatabase db, const QString& feed_custom_id, int account_id,
|
static int getMessageCountsForFeed(const QSqlDatabase& db, const QString& feed_custom_id, int account_id,
|
||||||
bool including_total_counts, bool* ok = nullptr);
|
bool including_total_counts, bool* ok = nullptr);
|
||||||
static int getMessageCountsForBin(QSqlDatabase db, int account_id, bool including_total_counts, bool* ok = nullptr);
|
static int getMessageCountsForBin(const QSqlDatabase& db, int account_id, bool including_total_counts, bool* ok = nullptr);
|
||||||
|
|
||||||
// Get messages (for newspaper view for example).
|
// Get messages (for newspaper view for example).
|
||||||
static QList<Message> getUndeletedMessagesForFeed(QSqlDatabase db, const QString& feed_custom_id, int account_id, bool* ok = nullptr);
|
static QList<Message> getUndeletedMessagesForFeed(const QSqlDatabase& db, const QString& feed_custom_id, int account_id, bool* ok = nullptr);
|
||||||
static QList<Message> getUndeletedMessagesForBin(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
static QList<Message> getUndeletedMessagesForBin(const QSqlDatabase& db, int account_id, bool* ok = nullptr);
|
||||||
static QList<Message> getUndeletedMessagesForAccount(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
static QList<Message> getUndeletedMessagesForAccount(const QSqlDatabase& db, int account_id, bool* ok = nullptr);
|
||||||
|
|
||||||
// Custom ID accumulators.
|
// Custom ID accumulators.
|
||||||
static QStringList customIdsOfMessagesFromAccount(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
static QStringList customIdsOfMessagesFromAccount(const QSqlDatabase& db, int account_id, bool* ok = nullptr);
|
||||||
static QStringList customIdsOfMessagesFromBin(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
static QStringList customIdsOfMessagesFromBin(const QSqlDatabase& db, int account_id, bool* ok = nullptr);
|
||||||
static QStringList customIdsOfMessagesFromFeed(QSqlDatabase db, const QString& feed_custom_id, int account_id, bool* ok = nullptr);
|
static QStringList customIdsOfMessagesFromFeed(const QSqlDatabase& db, const QString& feed_custom_id, int account_id, bool* ok = nullptr);
|
||||||
|
|
||||||
// Common accounts methods.
|
// Common accounts methods.
|
||||||
static int updateMessages(QSqlDatabase db, const QList<Message>& messages, const QString& feed_custom_id,
|
static int updateMessages(QSqlDatabase db, const QList<Message>& messages, const QString& feed_custom_id,
|
||||||
int account_id, const QString& url, bool* any_message_changed, bool* ok = nullptr);
|
int account_id, const QString& url, bool* any_message_changed, bool* ok = nullptr);
|
||||||
static bool deleteAccount(QSqlDatabase db, int account_id);
|
static bool deleteAccount(const QSqlDatabase& db, int account_id);
|
||||||
static bool deleteAccountData(QSqlDatabase db, int account_id, bool delete_messages_too);
|
static bool deleteAccountData(const QSqlDatabase& db, int account_id, bool delete_messages_too);
|
||||||
static bool cleanFeeds(QSqlDatabase db, const QStringList& ids, bool clean_read_only, int account_id);
|
static bool cleanFeeds(const QSqlDatabase& db, const QStringList& ids, bool clean_read_only, int account_id);
|
||||||
static bool storeAccountTree(QSqlDatabase db, RootItem* tree_root, int account_id);
|
static bool storeAccountTree(const QSqlDatabase& db, RootItem* tree_root, int account_id);
|
||||||
static bool editBaseFeed(QSqlDatabase db, int feed_id, Feed::AutoUpdateType auto_update_type,
|
static bool editBaseFeed(const QSqlDatabase& db, int feed_id, Feed::AutoUpdateType auto_update_type,
|
||||||
int auto_update_interval);
|
int auto_update_interval);
|
||||||
static Assignment getCategories(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
static Assignment getCategories(const QSqlDatabase& db, int account_id, bool* ok = nullptr);
|
||||||
|
|
||||||
// Gmail account.
|
// Gmail account.
|
||||||
static Assignment getGmailFeeds(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
static Assignment getGmailFeeds(const QSqlDatabase& db, int account_id, bool* ok = nullptr);
|
||||||
static bool deleteGmailAccount(QSqlDatabase db, int account_id);
|
static bool deleteGmailAccount(const QSqlDatabase& db, int account_id);
|
||||||
static QList<ServiceRoot*> getGmailAccounts(QSqlDatabase db, bool* ok = nullptr);
|
static QList<ServiceRoot*> getGmailAccounts(const QSqlDatabase& db, bool* ok = nullptr);
|
||||||
static bool overwriteGmailAccount(QSqlDatabase db, const QString& username, const QString& app_id,
|
static bool overwriteGmailAccount(const QSqlDatabase& db, const QString& username, const QString& app_id,
|
||||||
const QString& app_key, const QString& redirect_url, const QString& refresh_token,
|
const QString& app_key, const QString& redirect_url, const QString& refresh_token,
|
||||||
int batch_size, int account_id);
|
int batch_size, int account_id);
|
||||||
static bool createGmailAccount(QSqlDatabase db, int id_to_assign, const QString& username,
|
static bool createGmailAccount(const QSqlDatabase& db, int id_to_assign, const QString& username,
|
||||||
const QString& app_id, const QString& app_key, const QString& redirect_url,
|
const QString& app_id, const QString& app_key, const QString& redirect_url,
|
||||||
const QString& refresh_token, int batch_size);
|
const QString& refresh_token, int batch_size);
|
||||||
|
|
||||||
// Inoreader account.
|
// Inoreader account.
|
||||||
static bool deleteInoreaderAccount(QSqlDatabase db, int account_id);
|
static bool deleteInoreaderAccount(const QSqlDatabase& db, int account_id);
|
||||||
static Assignment getInoreaderFeeds(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
static Assignment getInoreaderFeeds(const QSqlDatabase& db, int account_id, bool* ok = nullptr);
|
||||||
static bool storeNewInoreaderTokens(QSqlDatabase db, const QString& refresh_token, int account_id);
|
static bool storeNewInoreaderTokens(const QSqlDatabase& db, const QString& refresh_token, int account_id);
|
||||||
static QList<ServiceRoot*> getInoreaderAccounts(QSqlDatabase db, bool* ok = nullptr);
|
static QList<ServiceRoot*> getInoreaderAccounts(const QSqlDatabase& db, bool* ok = nullptr);
|
||||||
static bool overwriteInoreaderAccount(QSqlDatabase db, const QString& username, const QString& app_id,
|
static bool overwriteInoreaderAccount(const QSqlDatabase& db, const QString& username, const QString& app_id,
|
||||||
const QString& app_key, const QString& redirect_url, const QString& refresh_token,
|
const QString& app_key, const QString& redirect_url, const QString& refresh_token,
|
||||||
int batch_size, int account_id);
|
int batch_size, int account_id);
|
||||||
static bool createInoreaderAccount(QSqlDatabase db, int id_to_assign, const QString& username,
|
static bool createInoreaderAccount(const QSqlDatabase& db, int id_to_assign, const QString& username,
|
||||||
const QString& app_id, const QString& app_key, const QString& redirect_url,
|
const QString& app_id, const QString& app_key, const QString& redirect_url,
|
||||||
const QString& refresh_token, int batch_size);
|
const QString& refresh_token, int batch_size);
|
||||||
|
|
||||||
// ownCloud account.
|
// ownCloud account.
|
||||||
static QList<ServiceRoot*> getOwnCloudAccounts(QSqlDatabase db, bool* ok = nullptr);
|
static QList<ServiceRoot*> getOwnCloudAccounts(const QSqlDatabase& db, bool* ok = nullptr);
|
||||||
static bool deleteOwnCloudAccount(QSqlDatabase db, int account_id);
|
static bool deleteOwnCloudAccount(const QSqlDatabase& db, int account_id);
|
||||||
static bool overwriteOwnCloudAccount(QSqlDatabase db, const QString& username, const QString& password,
|
static bool overwriteOwnCloudAccount(const QSqlDatabase& db, const QString& username, const QString& password,
|
||||||
const QString& url, bool force_server_side_feed_update, int batch_size, int account_id);
|
const QString& url, bool force_server_side_feed_update, int batch_size, int account_id);
|
||||||
static bool createOwnCloudAccount(QSqlDatabase db, int id_to_assign, const QString& username, const QString& password,
|
static bool createOwnCloudAccount(const QSqlDatabase& db, int id_to_assign, const QString& username, const QString& password,
|
||||||
const QString& url, bool force_server_side_feed_update, int batch_size);
|
const QString& url, bool force_server_side_feed_update, int batch_size);
|
||||||
static int createAccount(QSqlDatabase db, const QString& code, bool* ok = nullptr);
|
static int createAccount(const QSqlDatabase& db, const QString& code, bool* ok = nullptr);
|
||||||
static Assignment getOwnCloudFeeds(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
static Assignment getOwnCloudFeeds(const QSqlDatabase& db, int account_id, bool* ok = nullptr);
|
||||||
|
|
||||||
// Standard account.
|
// Standard account.
|
||||||
static bool deleteFeed(QSqlDatabase db, int feed_custom_id, int account_id);
|
static bool deleteFeed(const QSqlDatabase& db, int feed_custom_id, int account_id);
|
||||||
static bool deleteCategory(QSqlDatabase db, int id);
|
static bool deleteCategory(const QSqlDatabase& db, int id);
|
||||||
static int addCategory(QSqlDatabase db, int parent_id, int account_id, const QString& title,
|
static int addCategory(const QSqlDatabase& db, int parent_id, int account_id, const QString& title,
|
||||||
const QString& description, QDateTime creation_date, const QIcon& icon, bool* ok = nullptr);
|
const QString& description, const QDateTime& creation_date, const QIcon& icon, bool* ok = nullptr);
|
||||||
static bool editCategory(QSqlDatabase db, int parent_id, int category_id,
|
static bool editCategory(const QSqlDatabase& db, int parent_id, int category_id,
|
||||||
const QString& title, const QString& description, const QIcon& icon);
|
const QString& title, const QString& description, const QIcon& icon);
|
||||||
static int addFeed(QSqlDatabase db, int parent_id, int account_id, const QString& title,
|
static int addFeed(const QSqlDatabase& db, int parent_id, int account_id, const QString& title,
|
||||||
const QString& description, QDateTime creation_date, const QIcon& icon,
|
const QString& description, const QDateTime& creation_date, const QIcon& icon,
|
||||||
const QString& encoding, const QString& url, bool is_protected,
|
const QString& encoding, const QString& url, bool is_protected,
|
||||||
const QString& username, const QString& password,
|
const QString& username, const QString& password,
|
||||||
Feed::AutoUpdateType auto_update_type,
|
Feed::AutoUpdateType auto_update_type,
|
||||||
int auto_update_interval, StandardFeed::Type feed_format, bool* ok = nullptr);
|
int auto_update_interval, StandardFeed::Type feed_format, bool* ok = nullptr);
|
||||||
static bool editFeed(QSqlDatabase db, int parent_id, int feed_id, const QString& title,
|
static bool editFeed(const QSqlDatabase& db, int parent_id, int feed_id, const QString& title,
|
||||||
const QString& description, const QIcon& icon,
|
const QString& description, const QIcon& icon,
|
||||||
const QString& encoding, const QString& url, bool is_protected,
|
const QString& encoding, const QString& url, bool is_protected,
|
||||||
const QString& username, const QString& password, Feed::AutoUpdateType auto_update_type,
|
const QString& username, const QString& password, Feed::AutoUpdateType auto_update_type,
|
||||||
int auto_update_interval, StandardFeed::Type feed_format);
|
int auto_update_interval, StandardFeed::Type feed_format);
|
||||||
static QList<ServiceRoot*> getAccounts(QSqlDatabase db, bool* ok = nullptr);
|
static QList<ServiceRoot*> getAccounts(const QSqlDatabase& db, bool* ok = nullptr);
|
||||||
static Assignment getStandardCategories(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
static Assignment getStandardCategories(const QSqlDatabase& db, int account_id, bool* ok = nullptr);
|
||||||
static Assignment getStandardFeeds(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
static Assignment getStandardFeeds(const QSqlDatabase& db, int account_id, bool* ok = nullptr);
|
||||||
|
|
||||||
// TT-RSS acccount.
|
// TT-RSS acccount.
|
||||||
static QList<ServiceRoot*> getTtRssAccounts(QSqlDatabase db, bool* ok = nullptr);
|
static QList<ServiceRoot*> getTtRssAccounts(const QSqlDatabase& db, bool* ok = nullptr);
|
||||||
static bool deleteTtRssAccount(QSqlDatabase db, int account_id);
|
static bool deleteTtRssAccount(const QSqlDatabase& db, int account_id);
|
||||||
static bool overwriteTtRssAccount(QSqlDatabase db, const QString& username, const QString& password,
|
static bool overwriteTtRssAccount(const QSqlDatabase& db, const QString& username, const QString& password,
|
||||||
bool auth_protected, const QString& auth_username, const QString& auth_password,
|
bool auth_protected, const QString& auth_username, const QString& auth_password,
|
||||||
const QString& url, bool force_server_side_feed_update, int account_id);
|
const QString& url, bool force_server_side_feed_update, int account_id);
|
||||||
static bool createTtRssAccount(QSqlDatabase db, int id_to_assign, const QString& username,
|
static bool createTtRssAccount(const QSqlDatabase& db, int id_to_assign, const QString& username,
|
||||||
const QString& password, bool auth_protected, const QString& auth_username,
|
const QString& password, bool auth_protected, const QString& auth_username,
|
||||||
const QString& auth_password, const QString& url,
|
const QString& auth_password, const QString& url,
|
||||||
bool force_server_side_feed_update);
|
bool force_server_side_feed_update);
|
||||||
static Assignment getTtRssFeeds(QSqlDatabase db, int account_id, bool* ok = nullptr);
|
static Assignment getTtRssFeeds(const QSqlDatabase& db, int account_id, bool* ok = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static QString unnulifyString(const QString& str);
|
static QString unnulifyString(const QString& str);
|
||||||
|
|
|
@ -45,7 +45,7 @@ void Debugging::performLog(const char* message, QtMsgType type, const char* file
|
||||||
if (instance()->targetFile().isEmpty()) {
|
if (instance()->targetFile().isEmpty()) {
|
||||||
|
|
||||||
// Write to console.
|
// Write to console.
|
||||||
if (file == 0 || function == 0 || line < 0) {
|
if (file == nullptr || function == nullptr || line < 0) {
|
||||||
fprintf(stderr, "[%s] %s: %s (%s)\n", APP_LOW_NAME, type_string, message, mbstr);
|
fprintf(stderr, "[%s] %s: %s (%s)\n", APP_LOW_NAME, type_string, message, mbstr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -88,8 +88,7 @@ const char* Debugging::typeToString(QtMsgType type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Debugging::Debugging() {}
|
Debugging::Debugging() = default;
|
||||||
|
|
||||||
void Debugging::debugHandler(QtMsgType type, const QMessageLogContext& placement, const QString& message) {
|
void Debugging::debugHandler(QtMsgType type, const QMessageLogContext& placement, const QString& message) {
|
||||||
#ifndef QT_NO_DEBUG_OUTPUT
|
#ifndef QT_NO_DEBUG_OUTPUT
|
||||||
performLog(qPrintable(message), type, placement.file, placement.function, placement.line);
|
performLog(qPrintable(message), type, placement.file, placement.function, placement.line);
|
||||||
|
|
|
@ -15,7 +15,7 @@ class Debugging {
|
||||||
// Specifies format of output console messages.
|
// Specifies format of output console messages.
|
||||||
// NOTE: QT_NO_DEBUG_OUTPUT - disables debug outputs completely!!!
|
// NOTE: QT_NO_DEBUG_OUTPUT - disables debug outputs completely!!!
|
||||||
static void debugHandler(QtMsgType type, const QMessageLogContext& placement, const QString& message);
|
static void debugHandler(QtMsgType type, const QMessageLogContext& placement, const QString& message);
|
||||||
static void performLog(const char* message, QtMsgType type, const char* file = 0, const char* function = 0, int line = -1);
|
static void performLog(const char* message, QtMsgType type, const char* file = nullptr, const char* function = nullptr, int line = -1);
|
||||||
static const char* typeToString(QtMsgType type);
|
static const char* typeToString(QtMsgType type);
|
||||||
|
|
||||||
// Returns pointer to global silent network manager
|
// Returns pointer to global silent network manager
|
||||||
|
@ -28,7 +28,7 @@ class Debugging {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_targetFile;
|
QString m_targetFile;
|
||||||
QFile* m_targetFileHandle;
|
QFile* m_targetFileHandle{};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DEBUGGING_H
|
#endif // DEBUGGING_H
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
void ExternalTool::sanitizeParameters() {
|
void ExternalTool::sanitizeParameters() {
|
||||||
m_executable = QDir::toNativeSeparators(m_executable);
|
m_executable = QDir::toNativeSeparators(m_executable);
|
||||||
|
@ -15,12 +16,12 @@ void ExternalTool::sanitizeParameters() {
|
||||||
m_parameters.removeAll(QString());
|
m_parameters.removeAll(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
ExternalTool::ExternalTool() {}
|
ExternalTool::ExternalTool() = default;
|
||||||
|
|
||||||
ExternalTool::ExternalTool(const ExternalTool& other) : ExternalTool(other.executable(), other.parameters()) {}
|
ExternalTool::ExternalTool(const ExternalTool& other) : ExternalTool(other.executable(), other.parameters()) {}
|
||||||
|
|
||||||
ExternalTool::ExternalTool(const QString& executable, const QStringList& parameters)
|
ExternalTool::ExternalTool(QString executable, QStringList parameters)
|
||||||
: m_executable(executable), m_parameters(parameters) {
|
: m_executable(std::move(executable)), m_parameters(std::move(parameters)) {
|
||||||
sanitizeParameters();
|
sanitizeParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ ExternalTool ExternalTool::fromString(const QString& str) {
|
||||||
throw ApplicationException(QObject::tr("Passed external tool representation is not valid."));
|
throw ApplicationException(QObject::tr("Passed external tool representation is not valid."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const QString executable = outer.at(0);
|
const QString& executable = outer.at(0);
|
||||||
const QStringList parameters = outer.at(1).split(EXTERNAL_TOOL_PARAM_SEPARATOR);
|
const QStringList parameters = outer.at(1).split(EXTERNAL_TOOL_PARAM_SEPARATOR);
|
||||||
|
|
||||||
return ExternalTool(executable, parameters);
|
return ExternalTool(executable, parameters);
|
||||||
|
|
|
@ -10,7 +10,7 @@ class ExternalTool {
|
||||||
public:
|
public:
|
||||||
explicit ExternalTool();
|
explicit ExternalTool();
|
||||||
ExternalTool(const ExternalTool& other);
|
ExternalTool(const ExternalTool& other);
|
||||||
explicit ExternalTool(const QString& executable, const QStringList& parameters);
|
explicit ExternalTool(QString executable, QStringList parameters);
|
||||||
|
|
||||||
QString toString();
|
QString toString();
|
||||||
QString executable() const;
|
QString executable() const;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
FeedReader::FeedReader(QObject* parent)
|
FeedReader::FeedReader(QObject* parent)
|
||||||
: QObject(parent), m_feedServices(QList<ServiceEntryPoint*>()),
|
: QObject(parent),
|
||||||
m_autoUpdateTimer(new QTimer(this)), m_feedDownloader(nullptr) {
|
m_autoUpdateTimer(new QTimer(this)), m_feedDownloader(nullptr) {
|
||||||
m_feedsModel = new FeedsModel(this);
|
m_feedsModel = new FeedsModel(this);
|
||||||
m_feedsProxyModel = new FeedsProxyModel(m_feedsModel, this);
|
m_feedsProxyModel = new FeedsProxyModel(m_feedsModel, this);
|
||||||
|
@ -174,7 +174,7 @@ void FeedReader::executeNextAutoUpdate() {
|
||||||
// of scheduled update can be shown now.
|
// of scheduled update can be shown now.
|
||||||
if (qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::EnableAutoUpdateNotification)).toBool()) {
|
if (qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::EnableAutoUpdateNotification)).toBool()) {
|
||||||
qApp->showGuiMessage(tr("Starting auto-update of some feeds"),
|
qApp->showGuiMessage(tr("Starting auto-update of some feeds"),
|
||||||
tr("I will auto-update %n feed(s).", 0, feeds_for_update.size()),
|
tr("I will auto-update %n feed(s).", nullptr, feeds_for_update.size()),
|
||||||
QSystemTrayIcon::Information);
|
QSystemTrayIcon::Information);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,9 +78,9 @@ class FeedReader : public QObject {
|
||||||
|
|
||||||
// Auto-update stuff.
|
// Auto-update stuff.
|
||||||
QTimer* m_autoUpdateTimer;
|
QTimer* m_autoUpdateTimer;
|
||||||
bool m_globalAutoUpdateEnabled;
|
bool m_globalAutoUpdateEnabled{};
|
||||||
int m_globalAutoUpdateInitialInterval;
|
int m_globalAutoUpdateInitialInterval{};
|
||||||
int m_globalAutoUpdateRemainingInterval;
|
int m_globalAutoUpdateRemainingInterval{};
|
||||||
FeedDownloader* m_feedDownloader;
|
FeedDownloader* m_feedDownloader;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
|
|
||||||
IOFactory::IOFactory() {}
|
IOFactory::IOFactory() = default;
|
||||||
|
|
||||||
bool IOFactory::isFolderWritable(const QString& folder) {
|
bool IOFactory::isFolderWritable(const QString& folder) {
|
||||||
QString real_file = folder;
|
QString real_file = folder;
|
||||||
|
|
|
@ -12,15 +12,15 @@
|
||||||
Localization::Localization(QObject* parent)
|
Localization::Localization(QObject* parent)
|
||||||
: QObject(parent) {}
|
: QObject(parent) {}
|
||||||
|
|
||||||
Localization::~Localization() {}
|
Localization::~Localization() = default;
|
||||||
|
|
||||||
QString Localization::desiredLanguage() const {
|
QString Localization::desiredLanguage() const {
|
||||||
return qApp->settings()->value(GROUP(General), SETTING(General::Language)).toString();
|
return qApp->settings()->value(GROUP(General), SETTING(General::Language)).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Localization::loadActiveLanguage() {
|
void Localization::loadActiveLanguage() {
|
||||||
QTranslator* qt_translator = new QTranslator(qApp);
|
auto* qt_translator = new QTranslator(qApp);
|
||||||
QTranslator* app_translator = new QTranslator(qApp);
|
auto* app_translator = new QTranslator(qApp);
|
||||||
QString desired_localization = desiredLanguage();
|
QString desired_localization = desiredLanguage();
|
||||||
|
|
||||||
qDebug("Starting to load active localization. Desired localization is '%s'.", qPrintable(desired_localization));
|
qDebug("Starting to load active localization. Desired localization is '%s'.", qPrintable(desired_localization));
|
||||||
|
|
|
@ -354,7 +354,7 @@ DKEY CategoriesExpandStates::ID = "categories_expand_states";
|
||||||
Settings::Settings(const QString& file_name, Format format, const SettingsProperties::SettingsType& status, QObject* parent)
|
Settings::Settings(const QString& file_name, Format format, const SettingsProperties::SettingsType& status, QObject* parent)
|
||||||
: QSettings(file_name, format, parent), m_initializationStatus(status) {}
|
: QSettings(file_name, format, parent), m_initializationStatus(status) {}
|
||||||
|
|
||||||
Settings::~Settings() {}
|
Settings::~Settings() = default;
|
||||||
|
|
||||||
QString Settings::pathName() const {
|
QString Settings::pathName() const {
|
||||||
return QFileInfo(fileName()).absolutePath();
|
return QFileInfo(fileName()).absolutePath();
|
||||||
|
|
|
@ -46,7 +46,7 @@ void SimpleRegExp::setMinimal(bool minimal) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int SimpleRegExp::indexIn(const QString& str, int offset) const {
|
int SimpleRegExp::indexIn(const QString& str, int offset) const {
|
||||||
SimpleRegExp* that = const_cast<SimpleRegExp*>(this);
|
auto* that = const_cast<SimpleRegExp*>(this);
|
||||||
QRegularExpressionMatch m = match(str, offset);
|
QRegularExpressionMatch m = match(str, offset);
|
||||||
|
|
||||||
if (!m.hasMatch()) {
|
if (!m.hasMatch()) {
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
SkinFactory::SkinFactory(QObject* parent) : QObject(parent) {}
|
SkinFactory::SkinFactory(QObject* parent) : QObject(parent) {}
|
||||||
|
|
||||||
SkinFactory::~SkinFactory() {}
|
SkinFactory::~SkinFactory() = default;
|
||||||
|
|
||||||
void SkinFactory::loadCurrentSkin() {
|
void SkinFactory::loadCurrentSkin() {
|
||||||
QList<QString> skin_names_to_try;
|
QList<QString> skin_names_to_try;
|
||||||
|
@ -63,7 +63,7 @@ QString SkinFactory::selectedSkinName() const {
|
||||||
|
|
||||||
QString SkinFactory::adBlockedPage(const QString& subscription, const QString& rule) {
|
QString SkinFactory::adBlockedPage(const QString& subscription, const QString& rule) {
|
||||||
const QString& adblocked = currentSkin().m_adblocked.arg(tr("This page was blocked by AdBlock"),
|
const QString& adblocked = currentSkin().m_adblocked.arg(tr("This page was blocked by AdBlock"),
|
||||||
tr("Blocked by set: \"%1\"<br/>Blocked by filter: \"%2\"")
|
tr(R"(Blocked by set: "%1"<br/>Blocked by filter: "%2")")
|
||||||
.arg(subscription,
|
.arg(subscription,
|
||||||
rule));
|
rule));
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,11 @@
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
typedef QPair<UpdateInfo, QNetworkReply::NetworkError> UpdateCheck;
|
using UpdateCheck = QPair<UpdateInfo, QNetworkReply::NetworkError>;
|
||||||
|
|
||||||
SystemFactory::SystemFactory(QObject* parent) : QObject(parent) {}
|
SystemFactory::SystemFactory(QObject* parent) : QObject(parent) {}
|
||||||
|
|
||||||
SystemFactory::~SystemFactory() {}
|
SystemFactory::~SystemFactory() = default;
|
||||||
|
|
||||||
QRegularExpression SystemFactory::supportedUpdateFiles() {
|
QRegularExpression SystemFactory::supportedUpdateFiles() {
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
|
@ -202,7 +202,7 @@ QString SystemFactory::loggedInUser() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemFactory::checkForUpdates() const {
|
void SystemFactory::checkForUpdates() const {
|
||||||
Downloader* downloader = new Downloader();
|
auto* downloader = new Downloader();
|
||||||
|
|
||||||
connect(downloader, &Downloader::completed, this, [this, downloader]() {
|
connect(downloader, &Downloader::completed, this, [this, downloader]() {
|
||||||
QPair<QList<UpdateInfo>, QNetworkReply::NetworkError> result;
|
QPair<QList<UpdateInfo>, QNetworkReply::NetworkError> result;
|
||||||
|
@ -269,8 +269,8 @@ QList<UpdateInfo> SystemFactory::parseUpdatesFile(const QByteArray& updates_file
|
||||||
QList<UpdateInfo> updates;
|
QList<UpdateInfo> updates;
|
||||||
QJsonArray document = QJsonDocument::fromJson(updates_file).array();
|
QJsonArray document = QJsonDocument::fromJson(updates_file).array();
|
||||||
|
|
||||||
for (int i = 0; i < document.size(); i++) {
|
for (QJsonValueRef i : document) {
|
||||||
QJsonObject release = document.at(i).toObject();
|
QJsonObject release = i.toObject();
|
||||||
UpdateInfo update;
|
UpdateInfo update;
|
||||||
|
|
||||||
update.m_date = QDateTime::fromString(release["published_at"].toString(), QSL("yyyy-MM-ddTHH:mm:ssZ"));
|
update.m_date = QDateTime::fromString(release["published_at"].toString(), QSL("yyyy-MM-ddTHH:mm:ssZ"));
|
||||||
|
@ -278,8 +278,8 @@ QList<UpdateInfo> SystemFactory::parseUpdatesFile(const QByteArray& updates_file
|
||||||
update.m_changes = release["body"].toString();
|
update.m_changes = release["body"].toString();
|
||||||
QJsonArray assets = release["assets"].toArray();
|
QJsonArray assets = release["assets"].toArray();
|
||||||
|
|
||||||
for (int j = 0; j < assets.size(); j++) {
|
for (QJsonValueRef j : assets) {
|
||||||
QJsonObject asset = assets.at(j).toObject();
|
QJsonObject asset = j.toObject();
|
||||||
UpdateUrl url;
|
UpdateUrl url;
|
||||||
|
|
||||||
url.m_fileUrl = asset["browser_download_url"].toString();
|
url.m_fileUrl = asset["browser_download_url"].toString();
|
||||||
|
@ -291,7 +291,7 @@ QList<UpdateInfo> SystemFactory::parseUpdatesFile(const QByteArray& updates_file
|
||||||
updates.append(update);
|
updates.append(update);
|
||||||
}
|
}
|
||||||
|
|
||||||
qSort(updates.begin(), updates.end(), [](const UpdateInfo& a, const UpdateInfo& b) -> bool {
|
std::sort(updates.begin(), updates.end(), [](const UpdateInfo& a, const UpdateInfo& b) -> bool {
|
||||||
return a.m_date > b.m_date;
|
return a.m_date > b.m_date;
|
||||||
});
|
});
|
||||||
return updates;
|
return updates;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
quint64 TextFactory::s_encryptionKey = 0x0;
|
quint64 TextFactory::s_encryptionKey = 0x0;
|
||||||
|
|
||||||
TextFactory::TextFactory() {}
|
TextFactory::TextFactory() = default;
|
||||||
|
|
||||||
int TextFactory::stringHeight(const QString& string, const QFontMetrics& metrics) {
|
int TextFactory::stringHeight(const QString& string, const QFontMetrics& metrics) {
|
||||||
const int count_lines = string.split(QL1C('\n')).size();
|
const int count_lines = string.split(QL1C('\n')).size();
|
||||||
|
@ -130,7 +130,7 @@ quint64 TextFactory::initializeSecretEncryptionKey() {
|
||||||
try {
|
try {
|
||||||
s_encryptionKey = quint64(QString(IOFactory::readFile(encryption_file_path)).toLongLong());
|
s_encryptionKey = quint64(QString(IOFactory::readFile(encryption_file_path)).toLongLong());
|
||||||
}
|
}
|
||||||
catch (ApplicationException) {
|
catch (ApplicationException&) {
|
||||||
// Well, key does not exist or is invalid, generate and save one.
|
// Well, key does not exist or is invalid, generate and save one.
|
||||||
s_encryptionKey = generateSecretEncryptionKey();
|
s_encryptionKey = generateSecretEncryptionKey();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue