diff --git a/resources/desktop/com.github.rssguard.appdata.xml b/resources/desktop/com.github.rssguard.appdata.xml index cf2934eed..854f49807 100755 --- a/resources/desktop/com.github.rssguard.appdata.xml +++ b/resources/desktop/com.github.rssguard.appdata.xml @@ -30,7 +30,7 @@ https://martinrotter.github.io/donate/ - + none diff --git a/rssguard.pro b/rssguard.pro index 66b7a617d..98990251a 100755 --- a/rssguard.pro +++ b/rssguard.pro @@ -51,7 +51,7 @@ APP_REVERSE_NAME = "com.github.rssguard" APP_LOW_H_NAME = ".rssguard" APP_AUTHOR = "Martin Rotter" APP_COPYRIGHT = "(C) 2011-2019 $$APP_AUTHOR" -APP_VERSION = "3.5.7" +APP_VERSION = "3.5.8" APP_LONG_NAME = "$$APP_NAME $$APP_VERSION" APP_EMAIL = "rotter.martinos@gmail.com" APP_URL = "https://github.com/martinrotter/rssguard" diff --git a/src/gui/messagepreviewer.cpp b/src/gui/messagepreviewer.cpp index fb673af0f..3d1b2747c 100755 --- a/src/gui/messagepreviewer.cpp +++ b/src/gui/messagepreviewer.cpp @@ -241,19 +241,29 @@ QString MessagePreviewer::prepareHtmlForMessage(const Message& message) { html += QString("[%2] %1
").arg(enc_url, enc.m_mimeType); } - QRegularExpression imgTagRegex("\\]*src\\s*=\\s*\"([^\"]*)\"[^\\>]*\\>", + QRegularExpression imgTagRegex("\\]*src\\s*=\\s*[\"\']([^\"\']*)[\"\'][^\\>]*\\>", QRegularExpression::PatternOption::CaseInsensitiveOption | QRegularExpression::PatternOption::InvertedGreedinessOption); QRegularExpressionMatchIterator i = imgTagRegex.globalMatch(message.m_contents); + QString pictures_html; while (i.hasNext()) { QRegularExpressionMatch match = i.next(); m_pictures.append(match.captured(1)); - html += QString("[%1] %2
").arg(tr("image"), match.captured(1)); + pictures_html += QString("
[%1] %2").arg(tr("image"), match.captured(1)); } - html += "
"; - html += message.m_contents; + if (qApp->settings()->value(GROUP(Messages), SETTING(Messages::DisplayImagePlaceholders)).toBool()) { + html += message.m_contents; + } + else { + QString cnts = message.m_contents; + + html += cnts.replace(imgTagRegex, QString()); + } + + html += pictures_html; + return html; } diff --git a/src/gui/messagetextbrowser.cpp b/src/gui/messagetextbrowser.cpp index 2e91b2cc5..d957cf8fd 100755 --- a/src/gui/messagetextbrowser.cpp +++ b/src/gui/messagetextbrowser.cpp @@ -13,11 +13,16 @@ QVariant MessageTextBrowser::loadResource(int type, const QUrl& name) { switch (type) { case QTextDocument::ImageResource: { - if (m_imagePlaceholder.isNull()) { - m_imagePlaceholder = qApp->icons()->miscPixmap(QSL("image-placeholder")).scaledToWidth(20, Qt::FastTransformation); - } + if (qApp->settings()->value(GROUP(Messages), SETTING(Messages::DisplayImagePlaceholders)).toBool()) { + if (m_imagePlaceholder.isNull()) { + m_imagePlaceholder = qApp->icons()->miscPixmap(QSL("image-placeholder")).scaledToWidth(20, Qt::FastTransformation); + } - return m_imagePlaceholder; + return m_imagePlaceholder; + } + else { + return QVariant(); + } } default: diff --git a/src/gui/settings/settingsfeedsmessages.cpp b/src/gui/settings/settingsfeedsmessages.cpp index 1361820a9..339bfb4a8 100755 --- a/src/gui/settings/settingsfeedsmessages.cpp +++ b/src/gui/settings/settingsfeedsmessages.cpp @@ -23,6 +23,13 @@ SettingsFeedsMessages::SettingsFeedsMessages(Settings* settings, QWidget* parent initializeMessageDateFormats(); GuiUtilities::setLabelAsNotice(*m_ui->label_9, false); +#if defined (USE_WEBENGINE) + m_ui->m_tabMessages->layout()->removeWidget(m_ui->m_checkDisplayPlaceholders); + m_ui->m_checkDisplayPlaceholders->hide(); +#else + connect(m_ui->m_checkDisplayPlaceholders, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings); +#endif + connect(m_ui->m_spinHeightRowsMessages, static_cast(&QSpinBox::valueChanged), this, &SettingsFeedsMessages::requireRestart); connect(m_ui->m_spinHeightRowsFeeds, static_cast(&QSpinBox::valueChanged), @@ -110,6 +117,10 @@ void SettingsFeedsMessages::loadSettings() { m_ui->m_cmbCountsFeedList->setEditText(settings()->value(GROUP(Feeds), SETTING(Feeds::CountFormat)).toString()); m_ui->m_spinHeightImageAttachments->setValue(settings()->value(GROUP(Messages), SETTING(Messages::MessageHeadImageHeight)).toInt()); +#if !defined (USE_WEBENGINE) + m_ui->m_checkDisplayPlaceholders->setChecked(settings()->value(GROUP(Messages), SETTING(Messages::DisplayImagePlaceholders)).toBool()); +#endif + m_ui->m_checkMessagesDateTimeFormat->setChecked(settings()->value(GROUP(Messages), SETTING(Messages::UseCustomDate)).toBool()); const int index_format = m_ui->m_cmbMessagesDateTimeFormat->findData(settings()->value(GROUP(Messages), SETTING(Messages::CustomDateFormat)).toString()); @@ -143,6 +154,11 @@ void SettingsFeedsMessages::saveSettings() { settings()->setValue(GROUP(Feeds), Feeds::CountFormat, m_ui->m_cmbCountsFeedList->currentText()); settings()->setValue(GROUP(Messages), Messages::UseCustomDate, m_ui->m_checkMessagesDateTimeFormat->isChecked()); settings()->setValue(GROUP(Messages), Messages::MessageHeadImageHeight, m_ui->m_spinHeightImageAttachments->value()); + +#if !defined (USE_WEBENGINE) + settings()->setValue(GROUP(Messages), Messages::DisplayImagePlaceholders, m_ui->m_checkDisplayPlaceholders->isChecked()); +#endif + settings()->setValue(GROUP(Messages), Messages::CustomDateFormat, m_ui->m_cmbMessagesDateTimeFormat->itemData(m_ui->m_cmbMessagesDateTimeFormat->currentIndex()).toString()); diff --git a/src/gui/settings/settingsfeedsmessages.ui b/src/gui/settings/settingsfeedsmessages.ui index 0be2bce66..db5d1c74d 100755 --- a/src/gui/settings/settingsfeedsmessages.ui +++ b/src/gui/settings/settingsfeedsmessages.ui @@ -7,7 +7,7 @@ 0 0 651 - 270 + 295 @@ -26,7 +26,7 @@ - 0 + 1 @@ -190,14 +190,14 @@ - + Keep message selection in the middle of the message list viewport - + @@ -221,7 +221,7 @@ - + Use custom date/time format (overrides format loaded from active localization) @@ -234,10 +234,10 @@ - + - + Internal message browser fonts @@ -273,7 +273,7 @@ - + @@ -297,6 +297,13 @@ + + + + Display placeholders to indicate locations of pictures + + + @@ -320,6 +327,7 @@ m_spinHeightRowsFeeds m_cmbCountsFeedList m_checkRemoveReadMessagesOnExit + m_checkDisplayPlaceholders m_checkKeppMessagesInTheMiddle m_spinHeightRowsMessages m_spinHeightImageAttachments diff --git a/src/miscellaneous/settings.cpp b/src/miscellaneous/settings.cpp index 2678c06ce..93ba3abee 100755 --- a/src/miscellaneous/settings.cpp +++ b/src/miscellaneous/settings.cpp @@ -65,6 +65,12 @@ DKEY Messages::EnableMessagePreview = "enable_message_preview"; DVALUE(bool) Messages::EnableMessagePreviewDef = true; +#if !defined (USE_WEBENGINE) +DKEY Messages::DisplayImagePlaceholders = "display_image_placeholders"; + +DVALUE(bool) Messages::DisplayImagePlaceholdersDef = false; +#endif + DKEY Messages::UseCustomDate = "use_custom_date"; DVALUE(bool) Messages::UseCustomDateDef = false; diff --git a/src/miscellaneous/settings.h b/src/miscellaneous/settings.h index 5574825ff..37d6b1f50 100755 --- a/src/miscellaneous/settings.h +++ b/src/miscellaneous/settings.h @@ -88,6 +88,12 @@ namespace Messages { VALUE(bool) EnableMessagePreviewDef; +#if !defined (USE_WEBENGINE) + KEY DisplayImagePlaceholders; + + VALUE(bool) DisplayImagePlaceholdersDef; +#endif + KEY UseCustomDate; VALUE(bool) UseCustomDateDef;