This commit is contained in:
Martin Rotter 2023-12-13 07:21:30 +01:00
parent db57f48846
commit dc701cea1d
8 changed files with 34 additions and 12 deletions

View File

@ -72,7 +72,7 @@ set(APP_AUTHOR "Martin Rotter")
set(APP_COPYRIGHT "\\251 2011-${YEAR} ${APP_AUTHOR}")
set(APP_REVERSE_NAME "io.github.martinrotter.rssguard")
set(APP_DONATE_URL "https://github.com/sponsors/martinrotter")
set(APP_VERSION "4.6.2")
set(APP_VERSION "4.6.3")
set(APP_URL "https://github.com/martinrotter/rssguard")
set(APP_URL_DOCUMENTATION "https://rssguard.readthedocs.io")

View File

@ -1179,12 +1179,22 @@ QList<Message> DatabaseQueries::getArticlesSlice(const QSqlDatabase& db,
int account_id,
bool newest_first,
bool unread_only,
qint64 start_after_article_date,
int row_offset,
int row_limit) {
QList<Message> messages;
QSqlQuery q(db);
QString feed_clause = !feed_custom_id.isEmpty() ? QSL("feed = :feed AND") : QString();
QString date_created_clause;
if (start_after_article_date > 0) {
if (newest_first) {
date_created_clause = QSL("date_created < :date_created AND ");
}
else {
date_created_clause = QSL("date_created > :date_created AND ");
}
}
q.setForwardOnly(true);
q.prepare(QSL("SELECT %1 "
@ -1192,17 +1202,21 @@ QList<Message> DatabaseQueries::getArticlesSlice(const QSqlDatabase& db,
"WHERE is_deleted = 0 AND "
" is_pdeleted = 0 AND "
" is_read = :is_read AND "
//" date_created > :date_created AND "
" %3 "
" %4 "
" account_id = :account_id "
"ORDER BY Messages.date_created %2 "
"LIMIT :row_limit OFFSET :row_offset;")
.arg(messageTableAttributes(true, db.driverName() == QSL(APP_DB_SQLITE_DRIVER)).values().join(QSL(", ")),
newest_first ? QSL("DESC") : QSL("ASC"),
feed_clause));
feed_clause,
date_created_clause));
q.bindValue(QSL(":account_id"), account_id);
q.bindValue(QSL(":row_limit"), row_limit);
q.bindValue(QSL(":row_offset"), row_offset);
q.bindValue(QSL(":feed"), feed_custom_id);
q.bindValue(QSL(":date_created"), start_after_article_date);
if (unread_only) {
q.bindValue(QSL(":is_read"), 0);

View File

@ -123,6 +123,7 @@ class DatabaseQueries {
int account_id,
bool newest_first,
bool unread_only,
qint64 start_after_article_date,
int row_offset,
int row_limit);

View File

@ -296,7 +296,7 @@ void SettingsFeedsMessages::loadSettings() {
m_ui->m_cbArticleViewerAlwaysVisible
->setChecked(settings()->value(GROUP(Messages), SETTING(Messages::AlwaysDisplayItemPreview)).toBool());
m_ui->m_spinHeightImageAttachments
->setValue(settings()->value(GROUP(Messages), SETTING(Messages::MessageHeadImageHeight)).toInt());
->setValue(settings()->value(GROUP(Messages), SETTING(Messages::LimitArticleImagesHeight)).toInt());
m_ui->m_cbShowEnclosuresDirectly
->setChecked(settings()->value(GROUP(Messages), SETTING(Messages::DisplayEnclosuresInMessage)).toBool());
@ -395,7 +395,7 @@ void SettingsFeedsMessages::saveSettings() {
settings()->setValue(GROUP(Feeds), Feeds::EnableTooltipsFeedsMessages, m_ui->m_checkShowTooltips->isChecked());
settings()->setValue(GROUP(Messages), Messages::IgnoreContentsChanges, m_ui->m_cmbIgnoreContentsChanges->isChecked());
settings()->setValue(GROUP(Messages), Messages::MultilineArticleList, m_ui->m_checkMultilineArticleList->isChecked());
settings()->setValue(GROUP(Messages), Messages::MessageHeadImageHeight, m_ui->m_spinHeightImageAttachments->value());
settings()->setValue(GROUP(Messages), Messages::LimitArticleImagesHeight, m_ui->m_spinHeightImageAttachments->value());
settings()->setValue(GROUP(Messages),
Messages::DisplayEnclosuresInMessage,
m_ui->m_cbShowEnclosuresDirectly->isChecked());

View File

@ -140,8 +140,8 @@ DKEY Feeds::ListFont = "list_font";
// Messages.
DKEY Messages::ID = "messages";
DKEY Messages::MessageHeadImageHeight = "message_head_image_height";
DVALUE(int) Messages::MessageHeadImageHeightDef = 36;
DKEY Messages::LimitArticleImagesHeight = "message_head_image_height";
DVALUE(int) Messages::LimitArticleImagesHeightDef = 72;
DKEY Messages::DisplayEnclosuresInMessage = "show_enclosures_in_message";
DVALUE(bool) Messages::DisplayEnclosuresInMessageDef = false;

View File

@ -137,8 +137,8 @@ namespace Feeds {
namespace Messages {
KEY ID;
KEY MessageHeadImageHeight;
VALUE(int) MessageHeadImageHeightDef;
KEY LimitArticleImagesHeight;
VALUE(int) LimitArticleImagesHeightDef;
KEY DisplayEnclosuresInMessage;
VALUE(bool) DisplayEnclosuresInMessageDef;

View File

@ -236,7 +236,7 @@ PreparedHtml SkinFactory::generateHtmlOfArticles(const QList<Message>& messages,
QString messages_layout;
QString single_message_layout = skin.m_layoutMarkup;
const int forced_img_height =
qApp->settings()->value(GROUP(Messages), SETTING(Messages::MessageHeadImageHeight)).toInt();
qApp->settings()->value(GROUP(Messages), SETTING(Messages::LimitArticleImagesHeight)).toInt();
auto* feed = root != nullptr
? root->getParentServiceRoot()

View File

@ -113,6 +113,7 @@ ApiResponse ApiServer::processArticlesFromFeed(const QJsonValue& req) const {
QJsonObject data = req.toObject();
QString feed_id = data.value(QSL("feed")).toString();
qint64 start_after_article_date = qint64(data.value(QSL("start_after_article_date")).toDouble());
int account_id = data.value(QSL("account")).toInt();
bool newest_first = data.value(QSL("newest_first")).toBool();
bool unread_only = data.value(QSL("unread_only")).toBool();
@ -125,8 +126,14 @@ ApiResponse ApiServer::processArticlesFromFeed(const QJsonValue& req) const {
}
QSqlDatabase database = qApp->database()->driver()->connection(metaObject()->className());
QList<Message> msgs =
DatabaseQueries::getArticlesSlice(database, feed_id, account_id, newest_first, unread_only, row_offset, row_limit);
QList<Message> msgs = DatabaseQueries::getArticlesSlice(database,
feed_id,
account_id,
newest_first,
unread_only,
start_after_article_date,
row_offset,
row_limit);
QJsonArray msgs_json_array;
for (const Message& msg : msgs) {