mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-30 09:04:52 +01:00
Fix newlines in downloaded messages for gmail.
This commit is contained in:
parent
203cce77c3
commit
7e06964b82
@ -169,6 +169,9 @@
|
||||
#define qInfoNN qInfo().noquote().nospace()
|
||||
#endif
|
||||
|
||||
#define QUOTE_W_SPACE_DOT(x) " '" << x << "'."
|
||||
#define QUOTE_W_SPACE(x) " '" << x << "' "
|
||||
|
||||
#ifndef QSL
|
||||
|
||||
// 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) {
|
||||
|
||||
// Setup debug output system.
|
||||
qSetMessagePattern(QSL("time=\"%{time process}\" type=\"%{type}\" -> %{message}\n"));
|
||||
qSetMessagePattern(QSL("time=\"%{time process}\" type=\"%{type}\" -> %{message}"));
|
||||
determineFirstRuns();
|
||||
|
||||
//: Abbreviation of language, e.g. en.
|
||||
|
@ -72,7 +72,7 @@ void FeedReader::updateFeeds(const QList<Feed*>& feeds) {
|
||||
}
|
||||
|
||||
if (m_feedDownloader == nullptr) {
|
||||
qDebug("Creating FeedDownloader singleton.");
|
||||
qDebugNN << LOGSEC_CORE << "Creating FeedDownloader singleton.";
|
||||
|
||||
m_feedDownloaderThread = new QThread();
|
||||
m_feedDownloader = new FeedDownloader();
|
||||
@ -120,10 +120,12 @@ void FeedReader::updateAutoUpdateStatus() {
|
||||
if (!m_autoUpdateTimer->isActive()) {
|
||||
m_autoUpdateTimer->setInterval(AUTO_UPDATE_INTERVAL);
|
||||
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 {
|
||||
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() {
|
||||
if (qApp->mainFormWidget()->isActiveWindow() && m_globalAutoUpdateOnlyUnfocused) {
|
||||
qDebug("Delaying scheduled feed auto-update for one minute since window is focused and updates"
|
||||
"while focused are disabled by the user.");
|
||||
qDebugNN << LOGSEC_CORE
|
||||
<< "Delaying scheduled feed auto-update for one minute since window is focused and updates while focused are disabled by the user.";
|
||||
|
||||
// Cannot update, quit.
|
||||
return;
|
||||
}
|
||||
|
||||
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.
|
||||
return;
|
||||
@ -244,7 +246,9 @@ void FeedReader::executeNextAutoUpdate() {
|
||||
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
|
||||
// should be updated in this pass.
|
||||
@ -280,10 +284,10 @@ void FeedReader::checkServicesForAsyncOperations() {
|
||||
}
|
||||
|
||||
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, [&] {
|
||||
qDebug("Starting next check for cached service data in NOW.");
|
||||
qDebugNN << LOGSEC_CORE << "Saving cached metadata NOW.";
|
||||
checkServicesForAsyncOperations();
|
||||
});
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
IconFactory::IconFactory(QObject* parent) : QObject(parent) {}
|
||||
|
||||
IconFactory::~IconFactory() {
|
||||
qDebug("Destroying IconFactory instance.");
|
||||
qDebugNN << LOGSEC_GUI << "Destroying IconFactory instance.";
|
||||
}
|
||||
|
||||
QIcon IconFactory::fromByteArray(QByteArray array) {
|
||||
@ -53,10 +53,11 @@ QIcon IconFactory::miscIcon(const QString& name) {
|
||||
|
||||
void IconFactory::setupSearchPaths() {
|
||||
QIcon::setThemeSearchPaths(QIcon::themeSearchPaths() << APP_THEME_PATH);
|
||||
qDebug("Available icon theme paths: %s.",
|
||||
qPrintable(QIcon::themeSearchPaths()
|
||||
.replaceInStrings(QRegularExpression(QSL("^|$")), QSL("\'"))
|
||||
.replaceInStrings(QRegularExpression(QSL("/")), QDir::separator()).join(QSL(", "))));
|
||||
qDebugNN << LOGSEC_GUI
|
||||
<< "Available icon theme paths: "
|
||||
<< QIcon::themeSearchPaths()
|
||||
.replaceInStrings(QRegularExpression(QSL("^|$")), QSL("\'"))
|
||||
.replaceInStrings(QRegularExpression(QSL("/")), QDir::separator()).join(QSL(", "));
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -122,9 +123,9 @@ QStringList IconFactory::installedIconThemes() const {
|
||||
|
||||
// Iterate all icon themes in this directory.
|
||||
for (const QFileInfo& icon_theme_path : icon_dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot |
|
||||
QDir::Readable | QDir::CaseSensitive |
|
||||
QDir::NoSymLinks,
|
||||
QDir::Time)) {
|
||||
QDir::Readable | QDir::CaseSensitive |
|
||||
QDir::NoSymLinks,
|
||||
QDir::Time)) {
|
||||
QDir icon_theme_dir = QDir(icon_theme_path.absoluteFilePath());
|
||||
|
||||
if (icon_theme_dir.exists(filters_index.at(0))) {
|
||||
|
@ -23,30 +23,44 @@ void Localization::loadActiveLanguage() {
|
||||
auto* app_translator = new QTranslator(qApp);
|
||||
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)) {
|
||||
const QString real_loaded_locale = app_translator->translate("QObject", "LANG_ABBREV");
|
||||
|
||||
Application::installTranslator(app_translator);
|
||||
qDebug("Application localization '%s' loaded successfully, specifically sublocalization '%s' was loaded.",
|
||||
qPrintable(desired_localization),
|
||||
qPrintable(real_loaded_locale));
|
||||
qDebugNN << LOGSEC_CORE
|
||||
<< "Application localization"
|
||||
<< QUOTE_W_SPACE(desired_localization)
|
||||
<< "loaded successfully, specifically sublocalization"
|
||||
<< QUOTE_W_SPACE(real_loaded_locale)
|
||||
<< "was loaded.";
|
||||
desired_localization = real_loaded_locale;
|
||||
}
|
||||
else {
|
||||
qWarning("Application localization '%s' was not loaded. Loading '%s' instead.",
|
||||
qPrintable(desired_localization),
|
||||
DEFAULT_LOCALE);
|
||||
qWarningNN << LOGSEC_CORE
|
||||
<< "Application localization"
|
||||
<< QUOTE_W_SPACE(desired_localization)
|
||||
<< "was not loaded. Loading"
|
||||
<< QUOTE_W_SPACE(DEFAULT_LOCALE)
|
||||
<< "instead.";
|
||||
desired_localization = DEFAULT_LOCALE;
|
||||
}
|
||||
|
||||
if (qt_translator->load(QLocale(desired_localization), "qtbase", QSL("_"), APP_LANG_PATH)) {
|
||||
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 {
|
||||
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;
|
||||
|
@ -2,10 +2,12 @@
|
||||
|
||||
#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() {
|
||||
qDebug("Destroying Mutex instance.");
|
||||
qDebugNN << LOGSEC_CORE << ("Destroying Mutex instance.");
|
||||
}
|
||||
|
||||
void Mutex::lock() {
|
||||
|
@ -9,7 +9,11 @@
|
||||
#include <QLocale>
|
||||
#include <QPointer>
|
||||
|
||||
#if defined (USE_WEBENGINE)
|
||||
|
||||
// WebEngine.
|
||||
DKEY WebEngineAttributes::ID = "web_engine_attributes";
|
||||
#endif
|
||||
|
||||
// AdBlock.
|
||||
DKEY AdBlock::ID = "adblock";
|
||||
|
@ -26,9 +26,11 @@
|
||||
#define DEFAULT_VALUE(x) x ## Def
|
||||
#define GROUP(x) x::ID
|
||||
|
||||
#if defined (USE_WEBENGINE)
|
||||
namespace WebEngineAttributes {
|
||||
KEY ID;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace AdBlock {
|
||||
KEY ID;
|
||||
|
@ -430,6 +430,7 @@ bool GmailNetworkFactory::fillFullMessage(Message& msg, const QJsonObject& json,
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user