mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-02-02 18:36:49 +01:00
some initial fixes and refactorings for the PR
This commit is contained in:
parent
a0102833c9
commit
dbad3978a5
@ -5,11 +5,13 @@
|
||||
<file>sql/db_update_mysql_2_3.sql</file>
|
||||
<file>sql/db_update_mysql_3_4.sql</file>
|
||||
<file>sql/db_update_mysql_4_5.sql</file>
|
||||
<file>sql/db_update_mysql_5_6.sql</file>
|
||||
|
||||
<file>sql/db_init_sqlite.sql</file>
|
||||
<file>sql/db_update_sqlite_1_2.sql</file>
|
||||
<file>sql/db_update_sqlite_2_3.sql</file>
|
||||
<file>sql/db_update_sqlite_3_4.sql</file>
|
||||
<file>sql/db_update_sqlite_4_5.sql</file>
|
||||
<file>sql/db_update_sqlite_5_6.sql</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -31,25 +31,24 @@ CREATE TABLE Categories (
|
||||
);
|
||||
-- !
|
||||
CREATE TABLE Feeds (
|
||||
id $$,
|
||||
ordr INTEGER NOT NULL CHECK (ordr >= 0),
|
||||
title TEXT NOT NULL CHECK (title != ''),
|
||||
description TEXT,
|
||||
date_created BIGINT,
|
||||
icon ^^,
|
||||
category INTEGER NOT NULL CHECK (category >= -1), /* Physical category ID, also root feeds contain -1 here. */
|
||||
source TEXT,
|
||||
update_type INTEGER NOT NULL CHECK (update_type >= 0),
|
||||
update_interval INTEGER NOT NULL DEFAULT 900 CHECK (update_interval >= 1),
|
||||
is_off INTEGER NOT NULL DEFAULT 0 CHECK (is_off >= 0 AND is_off <= 1),
|
||||
is_quiet INTEGER NOT NULL DEFAULT 0 CHECK (is_quiet >= 0 AND is_quiet <= 1),
|
||||
is_rtl INTEGER NOT NULL DEFAULT 0 CHECK (is_rtl >= 0 AND is_rtl <= 1),
|
||||
add_any_datetime_articles INTEGER NOT NULL DEFAULT 0 CHECK(add_any_datetime_articles >= 0 AND add_any_datetime_articles <= 1),
|
||||
avoid_old_articles INTEGER NOT NULL DEFAULT 0 CHECK(avoid_old_articles >= 0 AND avoid_old_articles <= 1),
|
||||
datetime_to_avoid BIGINT NOT NULL DEFAULT 0 CHECK (datetime_to_avoid >= 0),
|
||||
open_articles INTEGER NOT NULL DEFAULT 0 CHECK (open_articles >= 0 AND open_articles <= 1),
|
||||
account_id INTEGER NOT NULL,
|
||||
custom_id TEXT NOT NULL CHECK (custom_id != ''), /* Custom ID cannot be empty, it must contain either service-specific ID, or Feeds/id. */
|
||||
id $$,
|
||||
ordr INTEGER NOT NULL CHECK (ordr >= 0),
|
||||
title TEXT NOT NULL CHECK (title != ''),
|
||||
description TEXT,
|
||||
date_created BIGINT,
|
||||
icon ^^,
|
||||
category INTEGER NOT NULL CHECK (category >= -1), /* Physical category ID, also root feeds contain -1 here. */
|
||||
source TEXT,
|
||||
update_type INTEGER NOT NULL CHECK (update_type >= 0),
|
||||
update_interval INTEGER NOT NULL DEFAULT 900 CHECK (update_interval >= 1),
|
||||
is_off INTEGER NOT NULL DEFAULT 0 CHECK (is_off >= 0 AND is_off <= 1),
|
||||
is_quiet INTEGER NOT NULL DEFAULT 0 CHECK (is_quiet >= 0 AND is_quiet <= 1),
|
||||
is_rtl INTEGER NOT NULL DEFAULT 0 CHECK (is_rtl >= 0 AND is_rtl <= 1),
|
||||
add_any_datetime_articles INTEGER NOT NULL DEFAULT 1 CHECK (add_any_datetime_articles >= 0 AND add_any_datetime_articles <= 1),
|
||||
datetime_to_avoid BIGINT NOT NULL DEFAULT 0 CHECK (datetime_to_avoid >= 0),
|
||||
open_articles INTEGER NOT NULL DEFAULT 0 CHECK (open_articles >= 0 AND open_articles <= 1),
|
||||
account_id INTEGER NOT NULL,
|
||||
custom_id TEXT NOT NULL CHECK (custom_id != ''), /* Custom ID cannot be empty, it must contain either service-specific ID, or Feeds/id. */
|
||||
/* Custom column for (serialized) custom account-specific data. */
|
||||
custom_data TEXT,
|
||||
|
||||
|
8
resources/sql/db_update_mysql_5_6.sql
Executable file
8
resources/sql/db_update_mysql_5_6.sql
Executable file
@ -0,0 +1,8 @@
|
||||
USE ##;
|
||||
-- !
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
-- !
|
||||
!! db_update_sqlite_5_6.sql
|
||||
-- !
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
-- !
|
@ -13,10 +13,6 @@ CREATE TABLE Feeds (
|
||||
update_interval INTEGER NOT NULL DEFAULT 900 CHECK (update_interval >= 1),
|
||||
is_off INTEGER NOT NULL DEFAULT 0 CHECK (is_off >= 0 AND is_off <= 1),
|
||||
is_quiet INTEGER NOT NULL DEFAULT 0 CHECK (is_quiet >= 0 AND is_quiet <= 1),
|
||||
is_rtl INTEGER NOT NULL DEFAULT 0 CHECK (is_rtl >= 0 AND is_rtl <= 1),
|
||||
add_any_datetime_articles INTEGER NOT NULL DEFAULT 0 CHECK(add_any_datetime_articles >= 0 AND add_any_datetime_articles <= 1),
|
||||
avoid_old_articles INTEGER NOT NULL DEFAULT 0 CHECK(avoid_old_articles >= 0 AND avoid_old_articles <= 1),
|
||||
datetime_to_avoid BIGINT NOT NULL DEFAULT 0 CHECK (datetime_to_avoid >= 0),
|
||||
open_articles INTEGER NOT NULL DEFAULT 0 CHECK (open_articles >= 0 AND open_articles <= 1),
|
||||
account_id INTEGER NOT NULL,
|
||||
custom_id TEXT NOT NULL CHECK (custom_id != ''), /* Custom ID cannot be empty, it must contain either service-specific ID, or Feeds/id. */
|
||||
@ -26,8 +22,8 @@ CREATE TABLE Feeds (
|
||||
FOREIGN KEY (account_id) REFERENCES Accounts (id) ON DELETE CASCADE
|
||||
);
|
||||
-- !
|
||||
INSERT INTO Feeds (id, ordr, title, description, date_created, icon, category, source, update_type, update_interval, is_off, is_quiet, is_rtl , add_any_datetime_articles, avoid_old_articles, datetime_to_avoid, open_articles, account_id, custom_id, custom_data)
|
||||
SELECT id, ordr, title, description, date_created, icon, category, source, update_type, update_interval, is_off, is_quiet, is_rtl , add_any_datetime_articles, avoid_old_articles, datetime_to_avoid, open_articles, account_id, custom_id, custom_data
|
||||
INSERT INTO Feeds (id, ordr, title, description, date_created, icon, category, source, update_type, update_interval, is_off, open_articles, account_id, custom_id, custom_data)
|
||||
SELECT id, ordr, title, description, date_created, icon, category, source, update_type, update_interval, is_off, open_articles, account_id, custom_id, custom_data
|
||||
FROM backup_Feeds;
|
||||
-- !
|
||||
DROP TABLE backup_Feeds;
|
||||
DROP TABLE backup_Feeds;
|
32
resources/sql/db_update_sqlite_5_6.sql
Executable file
32
resources/sql/db_update_sqlite_5_6.sql
Executable file
@ -0,0 +1,32 @@
|
||||
ALTER TABLE Feeds RENAME TO backup_Feeds;
|
||||
-- !
|
||||
CREATE TABLE Feeds (
|
||||
id $$,
|
||||
ordr INTEGER NOT NULL CHECK (ordr >= 0),
|
||||
title TEXT NOT NULL CHECK (title != ''),
|
||||
description TEXT,
|
||||
date_created BIGINT,
|
||||
icon ^^,
|
||||
category INTEGER NOT NULL CHECK (category >= -1), /* Physical category ID, also root feeds contain -1 here. */
|
||||
source TEXT,
|
||||
update_type INTEGER NOT NULL CHECK (update_type >= 0),
|
||||
update_interval INTEGER NOT NULL DEFAULT 900 CHECK (update_interval >= 1),
|
||||
is_off INTEGER NOT NULL DEFAULT 0 CHECK (is_off >= 0 AND is_off <= 1),
|
||||
is_quiet INTEGER NOT NULL DEFAULT 0 CHECK (is_quiet >= 0 AND is_quiet <= 1),
|
||||
is_rtl INTEGER NOT NULL DEFAULT 0 CHECK (is_rtl >= 0 AND is_rtl <= 1),
|
||||
add_any_datetime_articles INTEGER NOT NULL DEFAULT 1 CHECK (add_any_datetime_articles >= 0 AND add_any_datetime_articles <= 1),
|
||||
datetime_to_avoid BIGINT NOT NULL DEFAULT 0 CHECK (datetime_to_avoid >= 0),
|
||||
open_articles INTEGER NOT NULL DEFAULT 0 CHECK (open_articles >= 0 AND open_articles <= 1),
|
||||
account_id INTEGER NOT NULL,
|
||||
custom_id TEXT NOT NULL CHECK (custom_id != ''), /* Custom ID cannot be empty, it must contain either service-specific ID, or Feeds/id. */
|
||||
/* Custom column for (serialized) custom account-specific data. */
|
||||
custom_data TEXT,
|
||||
|
||||
FOREIGN KEY (account_id) REFERENCES Accounts (id) ON DELETE CASCADE
|
||||
);
|
||||
-- !
|
||||
INSERT INTO Feeds (id, ordr, title, description, date_created, icon, category, source, update_type, update_interval, is_off, is_quiet, open_articles, account_id, custom_id, custom_data)
|
||||
SELECT id, ordr, title, description, date_created, icon, category, source, update_type, update_interval, is_off, is_quiet, open_articles, account_id, custom_id, custom_data
|
||||
FROM backup_Feeds;
|
||||
-- !
|
||||
DROP TABLE backup_Feeds;
|
@ -2181,7 +2181,7 @@ void DatabaseQueries::createOverwriteFeed(const QSqlDatabase& db, Feed* feed, in
|
||||
" icon = :icon, category = :category, source = :source, update_type = :update_type,"
|
||||
" update_interval = :update_interval, is_off = :is_off, is_quiet = :is_quiet, open_articles ="
|
||||
" :open_articles, is_rtl = :is_rtl, add_any_datetime_articles = :add_any_datetime_articles,"
|
||||
" avoid_old_articles = :avoid_old_articles, datetime_to_avoid = :datetime_to_avoid, account_id"
|
||||
" datetime_to_avoid = :datetime_to_avoid, account_id"
|
||||
" = :account_id, custom_id = :custom_id, custom_data = :custom_data WHERE id = :id;");
|
||||
q.bindValue(QSL(":title"), feed->title());
|
||||
q.bindValue(QSL(":description"), feed->description());
|
||||
@ -2198,9 +2198,8 @@ void DatabaseQueries::createOverwriteFeed(const QSqlDatabase& db, Feed* feed, in
|
||||
q.bindValue(QSL(":is_off"), feed->isSwitchedOff());
|
||||
q.bindValue(QSL(":is_quiet"), feed->isQuiet());
|
||||
q.bindValue(QSL(":open_articles"), feed->openArticlesDirectly());
|
||||
q.bindValue(QSL(":is_rtl"), feed->isRTL());
|
||||
q.bindValue(QSL(":is_rtl"), feed->isRtl());
|
||||
q.bindValue(QSL(":add_any_datetime_articles"), feed->addAnyDatetimeArticles());
|
||||
q.bindValue(QSL(":avoid_old_articles"), feed->avoidOldArticles());
|
||||
q.bindValue(QSL(":datetime_to_avoid"), feed->datetimeToAvoid().toMSecsSinceEpoch());
|
||||
|
||||
auto custom_data = feed->customDatabaseData();
|
||||
|
@ -353,9 +353,8 @@ Assignment DatabaseQueries::getFeeds(const QSqlDatabase& db,
|
||||
feed->setAutoUpdateInterval(query.value(FDS_DB_UPDATE_INTERVAL_INDEX).toInt());
|
||||
feed->setIsSwitchedOff(query.value(FDS_DB_IS_OFF_INDEX).toBool());
|
||||
feed->setIsQuiet(query.value(FDS_DB_IS_QUIET_INDEX).toBool());
|
||||
feed->setIsRTL(query.value(FDS_DB_IS_RTL_INDEX).toBool());
|
||||
feed->setIsRtl(query.value(FDS_DB_IS_RTL_INDEX).toBool());
|
||||
feed->setAddAnyDatetimeArticles(query.value(FDS_DB_ADD_ANY_DATETIME_ARTICLES_INDEX).toBool());
|
||||
feed->setAvoidOldArticles(query.value(FDS_DB_AVOID_OLD_ARTICLES_INDEX).toBool());
|
||||
feed->setDatetimeToAvoid(query.value(FDS_DB_DATETIME_TO_AVOID_INDEX).toDateTime());
|
||||
feed->setOpenArticlesDirectly(query.value(FDS_DB_OPEN_ARTICLES_INDEX).toBool());
|
||||
|
||||
|
@ -214,7 +214,7 @@
|
||||
#define APP_DB_SQLITE_FILE "database.db"
|
||||
|
||||
// Keep this in sync with schema versions declared in SQL initialization code.
|
||||
#define APP_DB_SCHEMA_VERSION "5"
|
||||
#define APP_DB_SCHEMA_VERSION "6"
|
||||
#define APP_DB_UPDATE_FILE_PATTERN "db_update_%1_%2_%3.sql"
|
||||
#define APP_DB_COMMENT_SPLIT "-- !\n"
|
||||
#define APP_DB_INCLUDE_PLACEHOLDER "!!"
|
||||
@ -297,12 +297,11 @@
|
||||
#define FDS_DB_IS_QUIET_INDEX 11
|
||||
#define FDS_DB_IS_RTL_INDEX 12
|
||||
#define FDS_DB_ADD_ANY_DATETIME_ARTICLES_INDEX 13
|
||||
#define FDS_DB_AVOID_OLD_ARTICLES_INDEX 14
|
||||
#define FDS_DB_DATETIME_TO_AVOID_INDEX 15
|
||||
#define FDS_DB_OPEN_ARTICLES_INDEX 16
|
||||
#define FDS_DB_ACCOUNT_ID_INDEX 17
|
||||
#define FDS_DB_CUSTOM_ID_INDEX 18
|
||||
#define FDS_DB_CUSTOM_DATA_INDEX 19
|
||||
#define FDS_DB_DATETIME_TO_AVOID_INDEX 14
|
||||
#define FDS_DB_OPEN_ARTICLES_INDEX 15
|
||||
#define FDS_DB_ACCOUNT_ID_INDEX 16
|
||||
#define FDS_DB_CUSTOM_ID_INDEX 17
|
||||
#define FDS_DB_CUSTOM_DATA_INDEX 18
|
||||
|
||||
// Indexes of columns for feed models.
|
||||
#define FDS_MODEL_TITLE_INDEX 0
|
||||
|
@ -231,12 +231,12 @@ void FeedsView::editSelectedItem() {
|
||||
QSystemTrayIcon::MessageIcon::Warning});
|
||||
}
|
||||
|
||||
RootItem* selected_item = selectedItem();
|
||||
emit itemSelected(selected_item);
|
||||
|
||||
|
||||
// Changes are done, unlock the update master lock.
|
||||
qApp->feedUpdateLock()->unlock();
|
||||
|
||||
// TODO: NOTE: Make sure to refresh article list if RTL is changed?
|
||||
// RootItem* selected_item = selectedItem();
|
||||
// emit itemSelected(selected_item);
|
||||
}
|
||||
|
||||
void FeedsView::deleteSelectedItem() {
|
||||
|
@ -517,10 +517,12 @@ void MessagesView::loadItem(RootItem* item) {
|
||||
m_sourceModel->loadMessages(item);
|
||||
|
||||
if (item->toFeed() != nullptr) {
|
||||
if (item->toFeed()->isRTL())
|
||||
setLayoutDirection(Qt::RightToLeft);
|
||||
else
|
||||
setLayoutDirection(Qt::LeftToRight);
|
||||
if (item->toFeed()->isRtl()) {
|
||||
setLayoutDirection(Qt::LayoutDirection::RightToLeft);
|
||||
}
|
||||
else {
|
||||
setLayoutDirection(Qt::LayoutDirection::LeftToRight);
|
||||
}
|
||||
}
|
||||
|
||||
// Messages are loaded, make sure that previously
|
||||
|
@ -20,8 +20,8 @@
|
||||
Feed::Feed(RootItem* parent)
|
||||
: RootItem(parent), m_source(QString()), m_status(Status::Normal), m_statusString(QString()),
|
||||
m_autoUpdateType(AutoUpdateType::DefaultAutoUpdate), m_autoUpdateInterval(DEFAULT_AUTO_UPDATE_INTERVAL),
|
||||
m_lastUpdated(QDateTime::currentDateTimeUtc()), m_isSwitchedOff(false), m_isQuiet(false),
|
||||
m_isRTL(false), m_addAnyDatetimeArticles(false), m_avoidOldArticles(false), m_openArticlesDirectly(false),
|
||||
m_lastUpdated(QDateTime::currentDateTimeUtc()), m_isSwitchedOff(false), m_isQuiet(false), m_isRtl(false),
|
||||
m_addAnyDatetimeArticles(false), m_avoidOldArticles(false), m_openArticlesDirectly(false),
|
||||
m_datetimeToAvoid(QDateTime::currentDateTime()), m_messageFilters(QList<QPointer<MessageFilter>>()) {
|
||||
setKind(RootItem::Kind::Feed);
|
||||
}
|
||||
@ -45,10 +45,8 @@ Feed::Feed(const Feed& other) : RootItem(other) {
|
||||
setMessageFilters(other.messageFilters());
|
||||
setOpenArticlesDirectly(other.openArticlesDirectly());
|
||||
setAddAnyDatetimeArticles(other.addAnyDatetimeArticles());
|
||||
setAvoidOldArticles(other.avoidOldArticles());
|
||||
setAvoidOldArticlesEnabled(other.isAvoidOldArticlesEnabled());
|
||||
setDatetimeToAvoid(other.datetimeToAvoid());
|
||||
setIsRTL(other.isRTL());
|
||||
setIsRtl(other.isRtl());
|
||||
setIsSwitchedOff(other.isSwitchedOff());
|
||||
setIsQuiet(other.isQuiet());
|
||||
}
|
||||
@ -195,44 +193,28 @@ void Feed::setOpenArticlesDirectly(bool opn) {
|
||||
m_openArticlesDirectly = opn;
|
||||
}
|
||||
|
||||
bool Feed::isRTL() const {
|
||||
return m_isRTL;
|
||||
bool Feed::isRtl() const {
|
||||
return m_isRtl;
|
||||
}
|
||||
|
||||
void Feed::setIsRTL(bool rtl) {
|
||||
m_isRTL = rtl;
|
||||
void Feed::setIsRtl(bool rtl) {
|
||||
m_isRtl = rtl;
|
||||
}
|
||||
|
||||
bool Feed::addAnyDatetimeArticles() const {
|
||||
return m_addAnyDatetimeArticles;
|
||||
}
|
||||
|
||||
void Feed::setAddAnyDatetimeArticles(bool addAnyDatetimeArticles) {
|
||||
m_addAnyDatetimeArticles = addAnyDatetimeArticles;
|
||||
}
|
||||
|
||||
bool Feed::avoidOldArticles() const {
|
||||
return m_avoidOldArticles;
|
||||
}
|
||||
|
||||
void Feed::setAvoidOldArticles(bool avoidDateArticles) {
|
||||
m_avoidOldArticles = avoidDateArticles;
|
||||
}
|
||||
|
||||
bool Feed::isAvoidOldArticlesEnabled() const {
|
||||
return m_avoidOldArticlesEnabled;
|
||||
}
|
||||
|
||||
void Feed::setAvoidOldArticlesEnabled(bool newAvoidOldArticlesEnabled) {
|
||||
m_avoidOldArticlesEnabled = newAvoidOldArticlesEnabled;
|
||||
void Feed::setAddAnyDatetimeArticles(bool add_any_articles) {
|
||||
m_addAnyDatetimeArticles = add_any_articles;
|
||||
}
|
||||
|
||||
QDateTime Feed::datetimeToAvoid() const {
|
||||
return m_datetimeToAvoid;
|
||||
}
|
||||
|
||||
void Feed::setDatetimeToAvoid(const QDateTime &dateTime) {
|
||||
m_datetimeToAvoid = dateTime;
|
||||
void Feed::setDatetimeToAvoid(const QDateTime& dt) {
|
||||
m_datetimeToAvoid = dt;
|
||||
}
|
||||
|
||||
void Feed::appendMessageFilter(MessageFilter* filter) {
|
||||
|
@ -83,21 +83,14 @@ class Feed : public RootItem {
|
||||
QDateTime lastUpdated() const;
|
||||
void setLastUpdated(const QDateTime& last_updated);
|
||||
|
||||
bool isRTL() const;
|
||||
void setIsRTL(bool rtl);
|
||||
bool isRtl() const;
|
||||
void setIsRtl(bool rtl);
|
||||
|
||||
bool addAnyDatetimeArticles() const;
|
||||
void setAddAnyDatetimeArticles(bool addAnyDatetimeArticles);
|
||||
|
||||
bool avoidOldArticles() const;
|
||||
void setAvoidOldArticles(bool avoidDateArticles);
|
||||
|
||||
bool isAvoidOldArticlesEnabled() const;
|
||||
void setAvoidOldArticlesEnabled(bool newAvoidOldArticlesEnabled);
|
||||
void setAddAnyDatetimeArticles(bool add_any_articles);
|
||||
|
||||
QDateTime datetimeToAvoid() const;
|
||||
void setDatetimeToAvoid(const QDateTime &dateTime);
|
||||
|
||||
void setDatetimeToAvoid(const QDateTime& dt);
|
||||
|
||||
public slots:
|
||||
virtual void updateCounts(bool including_total_count);
|
||||
@ -116,7 +109,7 @@ class Feed : public RootItem {
|
||||
bool m_isSwitchedOff;
|
||||
bool m_isQuiet;
|
||||
bool m_openArticlesDirectly;
|
||||
bool m_isRTL;
|
||||
bool m_isRtl;
|
||||
bool m_addAnyDatetimeArticles;
|
||||
bool m_avoidOldArticles;
|
||||
bool m_avoidOldArticlesEnabled;
|
||||
|
@ -49,9 +49,8 @@ void FormFeedDetails::apply() {
|
||||
.toInt()));
|
||||
m_feed->setAutoUpdateInterval(int(m_ui->m_spinAutoUpdateInterval->value()));
|
||||
m_feed->setOpenArticlesDirectly(m_ui->m_cbOpenArticlesAutomatically->isChecked());
|
||||
m_feed->setIsRTL(m_ui->m_cbFeedRTL->isChecked());
|
||||
m_feed->setIsRtl(m_ui->m_cbFeedRTL->isChecked());
|
||||
m_feed->setAddAnyDatetimeArticles(m_ui->m_cbAddAnyDateArticles->isChecked());
|
||||
m_feed->setAvoidOldArticles(m_ui->m_gbAvoidOldArticles->isChecked());
|
||||
m_feed->setDatetimeToAvoid(m_ui->m_dtDateTimeToAvoid->dateTime());
|
||||
m_feed->setIsSwitchedOff(m_ui->m_cbDisableFeed->isChecked());
|
||||
m_feed->setIsQuiet(m_ui->m_cbSuppressFeed->isChecked());
|
||||
@ -88,9 +87,7 @@ void FormFeedDetails::createConnections() {
|
||||
|
||||
connect(m_ui->m_cbAddAnyDateArticles, &QCheckBox::toggled, this, [this](bool checked) {
|
||||
m_ui->m_gbAvoidOldArticles->setEnabled(!checked);
|
||||
m_feed->setAvoidOldArticlesEnabled(!checked);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void FormFeedDetails::loadFeedData() {
|
||||
@ -107,9 +104,8 @@ void FormFeedDetails::loadFeedData() {
|
||||
->setCurrentIndex(m_ui->m_cmbAutoUpdateType->findData(QVariant::fromValue(int(m_feed->autoUpdateType()))));
|
||||
m_ui->m_spinAutoUpdateInterval->setValue(m_feed->autoUpdateInterval());
|
||||
m_ui->m_cbOpenArticlesAutomatically->setChecked(m_feed->openArticlesDirectly());
|
||||
m_ui->m_cbFeedRTL->setChecked(m_feed->isRTL());
|
||||
m_ui->m_cbFeedRTL->setChecked(m_feed->isRtl());
|
||||
m_ui->m_cbAddAnyDateArticles->setChecked(m_feed->addAnyDatetimeArticles());
|
||||
m_ui->m_gbAvoidOldArticles->setChecked(m_feed->avoidOldArticles());
|
||||
m_ui->m_gbAvoidOldArticles->setEnabled(!m_feed->addAnyDatetimeArticles());
|
||||
m_ui->m_dtDateTimeToAvoid->setDateTime(m_feed->datetimeToAvoid());
|
||||
m_ui->m_cbDisableFeed->setChecked(m_feed->isSwitchedOff());
|
||||
|
@ -384,9 +384,8 @@ QMap<QString, QVariantMap> ServiceRoot::storeCustomFeedsData() {
|
||||
feed_custom_data.insert(QSL("is_off"), feed->isSwitchedOff());
|
||||
feed_custom_data.insert(QSL("is_quiet"), feed->isQuiet());
|
||||
feed_custom_data.insert(QSL("open_articles_directly"), feed->openArticlesDirectly());
|
||||
feed_custom_data.insert(QSL("is_rtl"), feed->isRTL());
|
||||
feed_custom_data.insert(QSL("is_rtl"), feed->isRtl());
|
||||
feed_custom_data.insert(QSL("add_any_datetime_articles"), feed->addAnyDatetimeArticles());
|
||||
feed_custom_data.insert(QSL("avoid_old_articles"), feed->avoidOldArticles());
|
||||
feed_custom_data.insert(QSL("datetime_to_avoid"), feed->datetimeToAvoid().toMSecsSinceEpoch());
|
||||
|
||||
// NOTE: This is here specifically to be able to restore custom sort order.
|
||||
@ -437,10 +436,9 @@ void ServiceRoot::restoreCustomFeedsData(const QMap<QString, QVariantMap>& data,
|
||||
feed->setIsSwitchedOff(feed_custom_data.value(QSL("is_off")).toBool());
|
||||
feed->setIsQuiet(feed_custom_data.value(QSL("is_quiet")).toBool());
|
||||
feed->setOpenArticlesDirectly(feed_custom_data.value(QSL("open_articles_directly")).toBool());
|
||||
feed->setIsRTL(feed_custom_data.value(QSL("is_rtl")).toBool());
|
||||
feed->setIsRtl(feed_custom_data.value(QSL("is_rtl")).toBool());
|
||||
feed->setAddAnyDatetimeArticles(feed_custom_data.value(QSL("add_any_datetime_articles")).toBool());
|
||||
feed->setAvoidOldArticles(feed_custom_data.value(QSL("avoid_date_message")).toBool());
|
||||
feed->setDatetimeToAvoid(feed_custom_data.value(QSL("avoid_message_datetime")).toDateTime());
|
||||
feed->setDatetimeToAvoid(feed_custom_data.value(QSL("datetime_to_avoid")).toDateTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -256,21 +256,26 @@ QList<Message> StandardServiceRoot::obtainNewMessages(Feed* feed,
|
||||
mess.m_feedId = feed->customId();
|
||||
}
|
||||
|
||||
|
||||
if (!feed->addAnyDatetimeArticles()) {
|
||||
|
||||
QDateTime datetimeToAvoid;
|
||||
|
||||
if (feed->isAvoidOldArticlesEnabled() && feed->avoidOldArticles())
|
||||
if (feed->datetimeToAvoid().isValid()) {
|
||||
datetimeToAvoid = feed->datetimeToAvoid();
|
||||
else if (qApp->settings()->value(GROUP(Messages), SETTING(Messages::AvoidOldArticles)).toBool())
|
||||
datetimeToAvoid = qApp->settings()->value(GROUP(Messages), SETTING(Messages::DateTimeToAvoidArticle)).toDateTime();
|
||||
else
|
||||
}
|
||||
else if (qApp->settings()->value(GROUP(Messages), SETTING(Messages::AvoidOldArticles)).toBool()) {
|
||||
datetimeToAvoid =
|
||||
qApp->settings()->value(GROUP(Messages), SETTING(Messages::DateTimeToAvoidArticle)).toDateTime();
|
||||
}
|
||||
else {
|
||||
return messages;
|
||||
}
|
||||
|
||||
for (int i = 0; i < messages.size(); i++)
|
||||
if (messages.at(i).m_created < datetimeToAvoid)
|
||||
for (int i = 0; i < messages.size(); i++) {
|
||||
if (messages.at(i).m_createdFromFeed && messages.at(i).m_created < datetimeToAvoid) {
|
||||
messages.removeAt(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return messages;
|
||||
|
Loading…
x
Reference in New Issue
Block a user