mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-27 07:46:17 +01:00
fixup of datetime switchable
This commit is contained in:
parent
d4e4abfa84
commit
5c1b5907ee
@ -192,10 +192,13 @@ void FeedDownloader::updateOneFeed(ServiceRoot* acc,
|
||||
<< feed->customId() << "' URL: '" << feed->source() << "' title: '" << feed->title() << "' in thread: '"
|
||||
<< 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.).
|
||||
for (auto& msg : msgs) {
|
||||
msg.m_accountId = acc_id;
|
||||
msg.sanitize(feed);
|
||||
msg.sanitize(feed, fix_future_datetimes);
|
||||
}
|
||||
|
||||
if (!feed->messageFilters().isEmpty()) {
|
||||
|
@ -73,7 +73,7 @@ Message::Message() {
|
||||
m_assignedLabels = QList<Label*>();
|
||||
}
|
||||
|
||||
void Message::sanitize(const Feed* feed) {
|
||||
void Message::sanitize(const Feed* feed, bool fix_future_datetimes) {
|
||||
// Sanitize title.
|
||||
m_title = m_title
|
||||
|
||||
@ -101,7 +101,9 @@ void Message::sanitize(const Feed* feed) {
|
||||
}
|
||||
|
||||
// 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"
|
||||
<< QUOTE_W_SPACE_DOT(m_created);
|
||||
|
||||
|
@ -111,6 +111,8 @@ SettingsFeedsMessages::SettingsFeedsMessages(Settings* settings, QWidget* parent
|
||||
connect(m_ui->m_cmbMessagesTimeFormat, &QComboBox::currentTextChanged, this,
|
||||
&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, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&SettingsFeedsMessages::dirtifySettings);
|
||||
@ -217,6 +219,9 @@ void SettingsFeedsMessages::loadSettings() {
|
||||
SETTING(Messages::DisplayEnclosuresInMessage)).toBool());
|
||||
#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_cmbMessagesDateTimeFormat->setCurrentText(settings()->value(GROUP(Messages),
|
||||
SETTING(Messages::CustomDateFormat)).toString());
|
||||
@ -287,6 +292,8 @@ void SettingsFeedsMessages::saveSettings() {
|
||||
m_ui->m_cbShowEnclosuresDirectly->isChecked());
|
||||
#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::UseCustomTime, m_ui->m_checkMessagesTimeFormat->isChecked());
|
||||
|
||||
|
@ -297,28 +297,28 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="m_checkDisplayPlaceholders">
|
||||
<property name="text">
|
||||
<string>Display placeholders to indicate locations of pictures</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="m_cbShowEnclosuresDirectly">
|
||||
<property name="text">
|
||||
<string>Display attached pictures directly in article</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="m_checkBringToForegroundAfterMsgOpened">
|
||||
<property name="text">
|
||||
<string>Bring application window to front once article is opened in external web browser</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="m_lblHeightImageAttachments">
|
||||
<property name="text">
|
||||
<string>Image attachments height</string>
|
||||
@ -328,7 +328,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="QSpinBox" name="m_spinHeightImageAttachments">
|
||||
<property name="suffix">
|
||||
<string notr="true"> px</string>
|
||||
@ -341,7 +341,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<item row="7" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
@ -384,7 +384,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<item row="8" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -397,6 +397,13 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</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>
|
||||
</widget>
|
||||
<widget class="QWidget" name="m_tabArticlesList">
|
||||
@ -629,11 +636,30 @@
|
||||
<tabstop>m_spinFeedUpdateTimeout</tabstop>
|
||||
<tabstop>m_checkRemoveReadMessagesOnExit</tabstop>
|
||||
<tabstop>m_cmbIgnoreContentsChanges</tabstop>
|
||||
<tabstop>m_cbFixupArticleDatetime</tabstop>
|
||||
<tabstop>m_checkDisplayPlaceholders</tabstop>
|
||||
<tabstop>m_cbShowEnclosuresDirectly</tabstop>
|
||||
<tabstop>m_checkBringToForegroundAfterMsgOpened</tabstop>
|
||||
<tabstop>m_spinHeightImageAttachments</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>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@ -124,6 +124,9 @@ DVALUE(bool) Messages::DisplayImagePlaceholdersDef = false;
|
||||
DKEY Messages::Zoom = "zoom";
|
||||
DVALUE(qreal) Messages::ZoomDef = double(1.0f);
|
||||
|
||||
DKEY Messages::FixupFutureArticleDateTimes = "fixup_future_datetimes";
|
||||
DVALUE(bool) Messages::FixupFutureArticleDateTimesDef = false;
|
||||
|
||||
DKEY Messages::UseCustomDate = "use_custom_date";
|
||||
DVALUE(bool) Messages::UseCustomDateDef = false;
|
||||
|
||||
|
@ -129,6 +129,9 @@ namespace Messages {
|
||||
KEY Zoom;
|
||||
VALUE(qreal) ZoomDef;
|
||||
|
||||
KEY FixupFutureArticleDateTimes;
|
||||
VALUE(bool) FixupFutureArticleDateTimesDef;
|
||||
|
||||
KEY UseCustomDate;
|
||||
VALUE(bool) UseCustomDateDef;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user