Fix newlines in downloaded messages for gmail.
This commit is contained in:
parent
203cce77c3
commit
7e06964b82
9 changed files with 60 additions and 29 deletions
|
@ -169,6 +169,9 @@
|
||||||
#define qInfoNN qInfo().noquote().nospace()
|
#define qInfoNN qInfo().noquote().nospace()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define QUOTE_W_SPACE_DOT(x) " '" << x << "'."
|
||||||
|
#define QUOTE_W_SPACE(x) " '" << x << "' "
|
||||||
|
|
||||||
#ifndef QSL
|
#ifndef QSL
|
||||||
|
|
||||||
// Thin macro wrapper for literal strings.
|
// Thin macro wrapper for literal strings.
|
||||||
|
|
|
@ -54,7 +54,7 @@ Application::Application(const QString& id, int& argc, char** argv)
|
||||||
m_database(new DatabaseFactory(this)), m_downloadManager(nullptr), m_shouldRestart(false) {
|
m_database(new DatabaseFactory(this)), m_downloadManager(nullptr), m_shouldRestart(false) {
|
||||||
|
|
||||||
// Setup debug output system.
|
// Setup debug output system.
|
||||||
qSetMessagePattern(QSL("time=\"%{time process}\" type=\"%{type}\" -> %{message}\n"));
|
qSetMessagePattern(QSL("time=\"%{time process}\" type=\"%{type}\" -> %{message}"));
|
||||||
determineFirstRuns();
|
determineFirstRuns();
|
||||||
|
|
||||||
//: Abbreviation of language, e.g. en.
|
//: Abbreviation of language, e.g. en.
|
||||||
|
|
|
@ -72,7 +72,7 @@ void FeedReader::updateFeeds(const QList<Feed*>& feeds) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_feedDownloader == nullptr) {
|
if (m_feedDownloader == nullptr) {
|
||||||
qDebug("Creating FeedDownloader singleton.");
|
qDebugNN << LOGSEC_CORE << "Creating FeedDownloader singleton.";
|
||||||
|
|
||||||
m_feedDownloaderThread = new QThread();
|
m_feedDownloaderThread = new QThread();
|
||||||
m_feedDownloader = new FeedDownloader();
|
m_feedDownloader = new FeedDownloader();
|
||||||
|
@ -120,10 +120,12 @@ void FeedReader::updateAutoUpdateStatus() {
|
||||||
if (!m_autoUpdateTimer->isActive()) {
|
if (!m_autoUpdateTimer->isActive()) {
|
||||||
m_autoUpdateTimer->setInterval(AUTO_UPDATE_INTERVAL);
|
m_autoUpdateTimer->setInterval(AUTO_UPDATE_INTERVAL);
|
||||||
m_autoUpdateTimer->start();
|
m_autoUpdateTimer->start();
|
||||||
qDebug("Auto-update timer started with interval %d.", m_autoUpdateTimer->interval());
|
qDebugNN << LOGSEC_CORE << "Auto-update timer started with interval "
|
||||||
|
<< m_autoUpdateTimer->interval()
|
||||||
|
<< " ms.";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qDebug("Auto-update timer is already running.");
|
qDebugNN << LOGSEC_CORE << "Auto-update timer is already running.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,15 +225,15 @@ MessagesModel* FeedReader::messagesModel() const {
|
||||||
|
|
||||||
void FeedReader::executeNextAutoUpdate() {
|
void FeedReader::executeNextAutoUpdate() {
|
||||||
if (qApp->mainFormWidget()->isActiveWindow() && m_globalAutoUpdateOnlyUnfocused) {
|
if (qApp->mainFormWidget()->isActiveWindow() && m_globalAutoUpdateOnlyUnfocused) {
|
||||||
qDebug("Delaying scheduled feed auto-update for one minute since window is focused and updates"
|
qDebugNN << LOGSEC_CORE
|
||||||
"while focused are disabled by the user.");
|
<< "Delaying scheduled feed auto-update for one minute since window is focused and updates while focused are disabled by the user.";
|
||||||
|
|
||||||
// Cannot update, quit.
|
// Cannot update, quit.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!qApp->feedUpdateLock()->tryLock()) {
|
if (!qApp->feedUpdateLock()->tryLock()) {
|
||||||
qDebug("Delaying scheduled feed auto-updates for one minute due to another running update.");
|
qDebugNN << LOGSEC_CORE << "Delaying scheduled feed auto-updates for one minute due to another running update.";
|
||||||
|
|
||||||
// Cannot update, quit.
|
// Cannot update, quit.
|
||||||
return;
|
return;
|
||||||
|
@ -244,7 +246,9 @@ void FeedReader::executeNextAutoUpdate() {
|
||||||
m_globalAutoUpdateRemainingInterval = m_globalAutoUpdateInitialInterval;
|
m_globalAutoUpdateRemainingInterval = m_globalAutoUpdateInitialInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("Starting auto-update event, pass %d/%d.", m_globalAutoUpdateRemainingInterval, m_globalAutoUpdateInitialInterval);
|
qDebugNN << LOGSEC_CORE
|
||||||
|
<< "Starting auto-update event, pass "
|
||||||
|
<< m_globalAutoUpdateRemainingInterval << "/" << m_globalAutoUpdateInitialInterval << ".";
|
||||||
|
|
||||||
// Pass needed interval data and lets the model decide which feeds
|
// Pass needed interval data and lets the model decide which feeds
|
||||||
// should be updated in this pass.
|
// should be updated in this pass.
|
||||||
|
@ -280,10 +284,10 @@ void FeedReader::checkServicesForAsyncOperations() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeedReader::asyncCacheSaveFinished() {
|
void FeedReader::asyncCacheSaveFinished() {
|
||||||
qDebug("I will start next check for cached service data in 60 seconds.");
|
qDebugNN << LOGSEC_CORE << "I will start next check for cached service data in 60 seconds.";
|
||||||
|
|
||||||
QTimer::singleShot(60000, this, [&] {
|
QTimer::singleShot(60000, this, [&] {
|
||||||
qDebug("Starting next check for cached service data in NOW.");
|
qDebugNN << LOGSEC_CORE << "Saving cached metadata NOW.";
|
||||||
checkServicesForAsyncOperations();
|
checkServicesForAsyncOperations();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
IconFactory::IconFactory(QObject* parent) : QObject(parent) {}
|
IconFactory::IconFactory(QObject* parent) : QObject(parent) {}
|
||||||
|
|
||||||
IconFactory::~IconFactory() {
|
IconFactory::~IconFactory() {
|
||||||
qDebug("Destroying IconFactory instance.");
|
qDebugNN << LOGSEC_GUI << "Destroying IconFactory instance.";
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon IconFactory::fromByteArray(QByteArray array) {
|
QIcon IconFactory::fromByteArray(QByteArray array) {
|
||||||
|
@ -53,10 +53,11 @@ QIcon IconFactory::miscIcon(const QString& name) {
|
||||||
|
|
||||||
void IconFactory::setupSearchPaths() {
|
void IconFactory::setupSearchPaths() {
|
||||||
QIcon::setThemeSearchPaths(QIcon::themeSearchPaths() << APP_THEME_PATH);
|
QIcon::setThemeSearchPaths(QIcon::themeSearchPaths() << APP_THEME_PATH);
|
||||||
qDebug("Available icon theme paths: %s.",
|
qDebugNN << LOGSEC_GUI
|
||||||
qPrintable(QIcon::themeSearchPaths()
|
<< "Available icon theme paths: "
|
||||||
.replaceInStrings(QRegularExpression(QSL("^|$")), QSL("\'"))
|
<< QIcon::themeSearchPaths()
|
||||||
.replaceInStrings(QRegularExpression(QSL("/")), QDir::separator()).join(QSL(", "))));
|
.replaceInStrings(QRegularExpression(QSL("^|$")), QSL("\'"))
|
||||||
|
.replaceInStrings(QRegularExpression(QSL("/")), QDir::separator()).join(QSL(", "));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IconFactory::setCurrentIconTheme(const QString& theme_name) {
|
void IconFactory::setCurrentIconTheme(const QString& theme_name) {
|
||||||
|
@ -68,7 +69,7 @@ void IconFactory::loadCurrentIconTheme() {
|
||||||
const QString theme_name_from_settings = qApp->settings()->value(GROUP(GUI), SETTING(GUI::IconTheme)).toString();
|
const QString theme_name_from_settings = qApp->settings()->value(GROUP(GUI), SETTING(GUI::IconTheme)).toString();
|
||||||
|
|
||||||
if (QIcon::themeName() == theme_name_from_settings) {
|
if (QIcon::themeName() == theme_name_from_settings) {
|
||||||
qDebug("Icon theme '%s' already loaded.", qPrintable(theme_name_from_settings));
|
qDebugNN << LOGSEC_GUI << "Icon theme '" << theme_name_from_settings << "' already loaded.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,9 +123,9 @@ QStringList IconFactory::installedIconThemes() const {
|
||||||
|
|
||||||
// Iterate all icon themes in this directory.
|
// Iterate all icon themes in this directory.
|
||||||
for (const QFileInfo& icon_theme_path : icon_dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot |
|
for (const QFileInfo& icon_theme_path : icon_dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot |
|
||||||
QDir::Readable | QDir::CaseSensitive |
|
QDir::Readable | QDir::CaseSensitive |
|
||||||
QDir::NoSymLinks,
|
QDir::NoSymLinks,
|
||||||
QDir::Time)) {
|
QDir::Time)) {
|
||||||
QDir icon_theme_dir = QDir(icon_theme_path.absoluteFilePath());
|
QDir icon_theme_dir = QDir(icon_theme_path.absoluteFilePath());
|
||||||
|
|
||||||
if (icon_theme_dir.exists(filters_index.at(0))) {
|
if (icon_theme_dir.exists(filters_index.at(0))) {
|
||||||
|
|
|
@ -23,30 +23,44 @@ void Localization::loadActiveLanguage() {
|
||||||
auto* app_translator = new QTranslator(qApp);
|
auto* app_translator = new QTranslator(qApp);
|
||||||
QString desired_localization = desiredLanguage();
|
QString desired_localization = desiredLanguage();
|
||||||
|
|
||||||
qDebug("Starting to load active localization. Desired localization is '%s'.", qPrintable(desired_localization));
|
qDebugNN << LOGSEC_CORE
|
||||||
|
<< "Starting to load active localization. Desired localization is"
|
||||||
|
<< QUOTE_W_SPACE_DOT(desired_localization);
|
||||||
|
|
||||||
if (app_translator->load(QLocale(desired_localization), "rssguard", QSL("_"), APP_LANG_PATH)) {
|
if (app_translator->load(QLocale(desired_localization), "rssguard", QSL("_"), APP_LANG_PATH)) {
|
||||||
const QString real_loaded_locale = app_translator->translate("QObject", "LANG_ABBREV");
|
const QString real_loaded_locale = app_translator->translate("QObject", "LANG_ABBREV");
|
||||||
|
|
||||||
Application::installTranslator(app_translator);
|
Application::installTranslator(app_translator);
|
||||||
qDebug("Application localization '%s' loaded successfully, specifically sublocalization '%s' was loaded.",
|
qDebugNN << LOGSEC_CORE
|
||||||
qPrintable(desired_localization),
|
<< "Application localization"
|
||||||
qPrintable(real_loaded_locale));
|
<< QUOTE_W_SPACE(desired_localization)
|
||||||
|
<< "loaded successfully, specifically sublocalization"
|
||||||
|
<< QUOTE_W_SPACE(real_loaded_locale)
|
||||||
|
<< "was loaded.";
|
||||||
desired_localization = real_loaded_locale;
|
desired_localization = real_loaded_locale;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qWarning("Application localization '%s' was not loaded. Loading '%s' instead.",
|
qWarningNN << LOGSEC_CORE
|
||||||
qPrintable(desired_localization),
|
<< "Application localization"
|
||||||
DEFAULT_LOCALE);
|
<< QUOTE_W_SPACE(desired_localization)
|
||||||
|
<< "was not loaded. Loading"
|
||||||
|
<< QUOTE_W_SPACE(DEFAULT_LOCALE)
|
||||||
|
<< "instead.";
|
||||||
desired_localization = DEFAULT_LOCALE;
|
desired_localization = DEFAULT_LOCALE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qt_translator->load(QLocale(desired_localization), "qtbase", QSL("_"), APP_LANG_PATH)) {
|
if (qt_translator->load(QLocale(desired_localization), "qtbase", QSL("_"), APP_LANG_PATH)) {
|
||||||
Application::installTranslator(qt_translator);
|
Application::installTranslator(qt_translator);
|
||||||
qDebug("Qt localization '%s' loaded successfully.", qPrintable(desired_localization));
|
qDebugNN << LOGSEC_CORE
|
||||||
|
<< "Qt localization"
|
||||||
|
<< QUOTE_W_SPACE(desired_localization)
|
||||||
|
<< "loaded successfully.";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qWarning("Qt localization '%s' was not loaded.", qPrintable(desired_localization));
|
qWarningNN << LOGSEC_CORE
|
||||||
|
<< "Qt localization"
|
||||||
|
<< QUOTE_W_SPACE(desired_localization)
|
||||||
|
<< "WAS NOT loaded successfully.";
|
||||||
}
|
}
|
||||||
|
|
||||||
m_loadedLanguage = desired_localization;
|
m_loadedLanguage = desired_localization;
|
||||||
|
|
|
@ -2,10 +2,12 @@
|
||||||
|
|
||||||
#include "miscellaneous/mutex.h"
|
#include "miscellaneous/mutex.h"
|
||||||
|
|
||||||
|
#include "definitions/definitions.h"
|
||||||
|
|
||||||
Mutex::Mutex(QMutex::RecursionMode mode, QObject* parent) : QObject(parent), m_mutex(new QMutex(mode)), m_isLocked(false) {}
|
Mutex::Mutex(QMutex::RecursionMode mode, QObject* parent) : QObject(parent), m_mutex(new QMutex(mode)), m_isLocked(false) {}
|
||||||
|
|
||||||
Mutex::~Mutex() {
|
Mutex::~Mutex() {
|
||||||
qDebug("Destroying Mutex instance.");
|
qDebugNN << LOGSEC_CORE << ("Destroying Mutex instance.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mutex::lock() {
|
void Mutex::lock() {
|
||||||
|
|
|
@ -9,7 +9,11 @@
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
|
#if defined (USE_WEBENGINE)
|
||||||
|
|
||||||
|
// WebEngine.
|
||||||
DKEY WebEngineAttributes::ID = "web_engine_attributes";
|
DKEY WebEngineAttributes::ID = "web_engine_attributes";
|
||||||
|
#endif
|
||||||
|
|
||||||
// AdBlock.
|
// AdBlock.
|
||||||
DKEY AdBlock::ID = "adblock";
|
DKEY AdBlock::ID = "adblock";
|
||||||
|
|
|
@ -26,9 +26,11 @@
|
||||||
#define DEFAULT_VALUE(x) x ## Def
|
#define DEFAULT_VALUE(x) x ## Def
|
||||||
#define GROUP(x) x::ID
|
#define GROUP(x) x::ID
|
||||||
|
|
||||||
|
#if defined (USE_WEBENGINE)
|
||||||
namespace WebEngineAttributes {
|
namespace WebEngineAttributes {
|
||||||
KEY ID;
|
KEY ID;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace AdBlock {
|
namespace AdBlock {
|
||||||
KEY ID;
|
KEY ID;
|
||||||
|
|
|
@ -430,6 +430,7 @@ bool GmailNetworkFactory::fillFullMessage(Message& msg, const QJsonObject& json,
|
||||||
msg.m_contents = backup_contents;
|
msg.m_contents = backup_contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
msg.m_contents.replace(QSL("\r\n"), QSL("\n")).replace(QL1C('\r'), QL1C('\n')).replace(QL1C('\n'), QSL("<br/>"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue