fixup of datetime switchable
This commit is contained in:
parent
d4e4abfa84
commit
8b458a6999
7 changed files with 55 additions and 11 deletions
|
@ -192,10 +192,13 @@ void FeedDownloader::updateOneFeed(ServiceRoot* acc,
|
||||||
<< feed->customId() << "' URL: '" << feed->source() << "' title: '" << feed->title() << "' in thread: '"
|
<< feed->customId() << "' URL: '" << feed->source() << "' title: '" << feed->title() << "' in thread: '"
|
||||||
<< QThread::currentThreadId() << "'. Operation took " << tmr.nsecsElapsed() / 1000 << " microseconds.";
|
<< QThread::currentThreadId() << "'. Operation took " << tmr.nsecsElapsed() / 1000 << " microseconds.";
|
||||||
|
|
||||||
|
bool fix_future_datetimes = qApp->settings()->value(GROUP(Messages),
|
||||||
|
SETTING(Messages::FixupFutureArticleDateTimes)).toBool();
|
||||||
|
|
||||||
// Now, sanitize messages (tweak encoding etc.).
|
// Now, sanitize messages (tweak encoding etc.).
|
||||||
for (auto& msg : msgs) {
|
for (auto& msg : msgs) {
|
||||||
msg.m_accountId = acc_id;
|
msg.m_accountId = acc_id;
|
||||||
msg.sanitize(feed);
|
msg.sanitize(feed, fix_future_datetimes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!feed->messageFilters().isEmpty()) {
|
if (!feed->messageFilters().isEmpty()) {
|
||||||
|
|
|
@ -73,7 +73,7 @@ Message::Message() {
|
||||||
m_assignedLabels = QList<Label*>();
|
m_assignedLabels = QList<Label*>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Message::sanitize(const Feed* feed) {
|
void Message::sanitize(const Feed* feed, bool fix_future_datetimes) {
|
||||||
// Sanitize title.
|
// Sanitize title.
|
||||||
m_title = m_title
|
m_title = m_title
|
||||||
|
|
||||||
|
@ -101,7 +101,9 @@ void Message::sanitize(const Feed* feed) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix datetimes in future.
|
// Fix datetimes in future.
|
||||||
if (m_createdFromFeed && m_created.toUTC() > QDateTime::currentDateTimeUtc()) {
|
if (fix_future_datetimes &&
|
||||||
|
m_createdFromFeed &&
|
||||||
|
m_created.toUTC() > QDateTime::currentDateTimeUtc()) {
|
||||||
qWarningNN << LOGSEC_CORE << "Fixing future date of article" << QUOTE_W_SPACE(m_title) << "from invalid date/time"
|
qWarningNN << LOGSEC_CORE << "Fixing future date of article" << QUOTE_W_SPACE(m_title) << "from invalid date/time"
|
||||||
<< QUOTE_W_SPACE_DOT(m_created);
|
<< QUOTE_W_SPACE_DOT(m_created);
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class RSSGUARD_DLLSPEC Message {
|
||||||
public:
|
public:
|
||||||
explicit Message();
|
explicit Message();
|
||||||
|
|
||||||
void sanitize(const Feed* feed);
|
void sanitize(const Feed* feed, bool fix_future_datetimes);
|
||||||
|
|
||||||
// Creates Message from given record, which contains
|
// Creates Message from given record, which contains
|
||||||
// row from query SELECT * FROM Messages WHERE ....;
|
// row from query SELECT * FROM Messages WHERE ....;
|
||||||
|
|
|
@ -111,6 +111,8 @@ SettingsFeedsMessages::SettingsFeedsMessages(Settings* settings, QWidget* parent
|
||||||
connect(m_ui->m_cmbMessagesTimeFormat, &QComboBox::currentTextChanged, this,
|
connect(m_ui->m_cmbMessagesTimeFormat, &QComboBox::currentTextChanged, this,
|
||||||
&SettingsFeedsMessages::dirtifySettings);
|
&SettingsFeedsMessages::dirtifySettings);
|
||||||
|
|
||||||
|
connect(m_ui->m_cbFixupArticleDatetime, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings);
|
||||||
|
|
||||||
connect(m_ui->m_cmbCountsFeedList, &QComboBox::currentTextChanged, this, &SettingsFeedsMessages::dirtifySettings);
|
connect(m_ui->m_cmbCountsFeedList, &QComboBox::currentTextChanged, this, &SettingsFeedsMessages::dirtifySettings);
|
||||||
connect(m_ui->m_cmbCountsFeedList, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
connect(m_ui->m_cmbCountsFeedList, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
&SettingsFeedsMessages::dirtifySettings);
|
&SettingsFeedsMessages::dirtifySettings);
|
||||||
|
@ -217,6 +219,9 @@ void SettingsFeedsMessages::loadSettings() {
|
||||||
SETTING(Messages::DisplayEnclosuresInMessage)).toBool());
|
SETTING(Messages::DisplayEnclosuresInMessage)).toBool());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
m_ui->m_cbFixupArticleDatetime->setChecked(settings()->value(GROUP(Messages),
|
||||||
|
SETTING(Messages::FixupFutureArticleDateTimes)).toBool());
|
||||||
|
|
||||||
m_ui->m_checkMessagesDateTimeFormat->setChecked(settings()->value(GROUP(Messages), SETTING(Messages::UseCustomDate)).toBool());
|
m_ui->m_checkMessagesDateTimeFormat->setChecked(settings()->value(GROUP(Messages), SETTING(Messages::UseCustomDate)).toBool());
|
||||||
m_ui->m_cmbMessagesDateTimeFormat->setCurrentText(settings()->value(GROUP(Messages),
|
m_ui->m_cmbMessagesDateTimeFormat->setCurrentText(settings()->value(GROUP(Messages),
|
||||||
SETTING(Messages::CustomDateFormat)).toString());
|
SETTING(Messages::CustomDateFormat)).toString());
|
||||||
|
@ -287,6 +292,8 @@ void SettingsFeedsMessages::saveSettings() {
|
||||||
m_ui->m_cbShowEnclosuresDirectly->isChecked());
|
m_ui->m_cbShowEnclosuresDirectly->isChecked());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
settings()->setValue(GROUP(Messages), Messages::FixupFutureArticleDateTimes, m_ui->m_cbFixupArticleDatetime->isChecked());
|
||||||
|
|
||||||
settings()->setValue(GROUP(Messages), Messages::UseCustomDate, m_ui->m_checkMessagesDateTimeFormat->isChecked());
|
settings()->setValue(GROUP(Messages), Messages::UseCustomDate, m_ui->m_checkMessagesDateTimeFormat->isChecked());
|
||||||
settings()->setValue(GROUP(Messages), Messages::UseCustomTime, m_ui->m_checkMessagesTimeFormat->isChecked());
|
settings()->setValue(GROUP(Messages), Messages::UseCustomTime, m_ui->m_checkMessagesTimeFormat->isChecked());
|
||||||
|
|
||||||
|
|
|
@ -297,28 +297,28 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="2">
|
<item row="3" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="m_checkDisplayPlaceholders">
|
<widget class="QCheckBox" name="m_checkDisplayPlaceholders">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Display placeholders to indicate locations of pictures</string>
|
<string>Display placeholders to indicate locations of pictures</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="2">
|
<item row="4" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="m_cbShowEnclosuresDirectly">
|
<widget class="QCheckBox" name="m_cbShowEnclosuresDirectly">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Display attached pictures directly in article</string>
|
<string>Display attached pictures directly in article</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0" colspan="2">
|
<item row="5" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="m_checkBringToForegroundAfterMsgOpened">
|
<widget class="QCheckBox" name="m_checkBringToForegroundAfterMsgOpened">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Bring application window to front once article is opened in external web browser</string>
|
<string>Bring application window to front once article is opened in external web browser</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QLabel" name="m_lblHeightImageAttachments">
|
<widget class="QLabel" name="m_lblHeightImageAttachments">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Image attachments height</string>
|
<string>Image attachments height</string>
|
||||||
|
@ -328,7 +328,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="QSpinBox" name="m_spinHeightImageAttachments">
|
<widget class="QSpinBox" name="m_spinHeightImageAttachments">
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string notr="true"> px</string>
|
<string notr="true"> px</string>
|
||||||
|
@ -341,7 +341,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0" colspan="2">
|
<item row="7" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_4">
|
<widget class="QGroupBox" name="groupBox_4">
|
||||||
|
@ -384,7 +384,7 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0" colspan="2">
|
<item row="8" column="0" colspan="2">
|
||||||
<spacer name="verticalSpacer_2">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
|
@ -397,6 +397,13 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="m_cbFixupArticleDatetime">
|
||||||
|
<property name="text">
|
||||||
|
<string>Fixup date/time of articles which are in the future</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="m_tabArticlesList">
|
<widget class="QWidget" name="m_tabArticlesList">
|
||||||
|
@ -629,11 +636,30 @@
|
||||||
<tabstop>m_spinFeedUpdateTimeout</tabstop>
|
<tabstop>m_spinFeedUpdateTimeout</tabstop>
|
||||||
<tabstop>m_checkRemoveReadMessagesOnExit</tabstop>
|
<tabstop>m_checkRemoveReadMessagesOnExit</tabstop>
|
||||||
<tabstop>m_cmbIgnoreContentsChanges</tabstop>
|
<tabstop>m_cmbIgnoreContentsChanges</tabstop>
|
||||||
|
<tabstop>m_cbFixupArticleDatetime</tabstop>
|
||||||
<tabstop>m_checkDisplayPlaceholders</tabstop>
|
<tabstop>m_checkDisplayPlaceholders</tabstop>
|
||||||
<tabstop>m_cbShowEnclosuresDirectly</tabstop>
|
<tabstop>m_cbShowEnclosuresDirectly</tabstop>
|
||||||
<tabstop>m_checkBringToForegroundAfterMsgOpened</tabstop>
|
<tabstop>m_checkBringToForegroundAfterMsgOpened</tabstop>
|
||||||
<tabstop>m_spinHeightImageAttachments</tabstop>
|
<tabstop>m_spinHeightImageAttachments</tabstop>
|
||||||
<tabstop>m_btnChangeMessagesFont</tabstop>
|
<tabstop>m_btnChangeMessagesFont</tabstop>
|
||||||
|
<tabstop>m_tabFeedsMessages</tabstop>
|
||||||
|
<tabstop>m_spinHeightRowsFeeds</tabstop>
|
||||||
|
<tabstop>m_btnChangeFeedListFont</tabstop>
|
||||||
|
<tabstop>m_cmbCountsFeedList</tabstop>
|
||||||
|
<tabstop>m_cbHideCountsIfNoUnread</tabstop>
|
||||||
|
<tabstop>m_cbListsRestrictedShortcuts</tabstop>
|
||||||
|
<tabstop>m_checkShowTooltips</tabstop>
|
||||||
|
<tabstop>m_checkDisplayFeedIcons</tabstop>
|
||||||
|
<tabstop>m_checkKeppMessagesInTheMiddle</tabstop>
|
||||||
|
<tabstop>m_checkMultilineArticleList</tabstop>
|
||||||
|
<tabstop>m_spinHeightRowsMessages</tabstop>
|
||||||
|
<tabstop>m_spinPaddingRowsMessages</tabstop>
|
||||||
|
<tabstop>m_checkMessagesDateTimeFormat</tabstop>
|
||||||
|
<tabstop>m_cmbMessagesDateTimeFormat</tabstop>
|
||||||
|
<tabstop>m_checkMessagesTimeFormat</tabstop>
|
||||||
|
<tabstop>m_cmbMessagesTimeFormat</tabstop>
|
||||||
|
<tabstop>m_btnChangeMessageListFont</tabstop>
|
||||||
|
<tabstop>m_spinRelativeArticleTime</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|
|
@ -124,6 +124,9 @@ DVALUE(bool) Messages::DisplayImagePlaceholdersDef = false;
|
||||||
DKEY Messages::Zoom = "zoom";
|
DKEY Messages::Zoom = "zoom";
|
||||||
DVALUE(qreal) Messages::ZoomDef = double(1.0f);
|
DVALUE(qreal) Messages::ZoomDef = double(1.0f);
|
||||||
|
|
||||||
|
DKEY Messages::FixupFutureArticleDateTimes = "fixup_future_datetimes";
|
||||||
|
DVALUE(bool) Messages::FixupFutureArticleDateTimesDef = false;
|
||||||
|
|
||||||
DKEY Messages::UseCustomDate = "use_custom_date";
|
DKEY Messages::UseCustomDate = "use_custom_date";
|
||||||
DVALUE(bool) Messages::UseCustomDateDef = false;
|
DVALUE(bool) Messages::UseCustomDateDef = false;
|
||||||
|
|
||||||
|
|
|
@ -129,6 +129,9 @@ namespace Messages {
|
||||||
KEY Zoom;
|
KEY Zoom;
|
||||||
VALUE(qreal) ZoomDef;
|
VALUE(qreal) ZoomDef;
|
||||||
|
|
||||||
|
KEY FixupFutureArticleDateTimes;
|
||||||
|
VALUE(bool) FixupFutureArticleDateTimesDef;
|
||||||
|
|
||||||
KEY UseCustomDate;
|
KEY UseCustomDate;
|
||||||
VALUE(bool) UseCustomDateDef;
|
VALUE(bool) UseCustomDateDef;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue