From bd89f2c247be08e39783ddd724ada044d2e80056 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Mon, 3 Jul 2023 06:53:42 +0200 Subject: [PATCH] gmail: fix crash and make labels changing work online --- CMakeLists.txt | 2 +- src/librssguard/core/feedsproxymodel.cpp | 5 +++-- src/librssguard/definitions/globals.h | 4 ++-- src/librssguard/services/gmail/gui/emailpreviewer.cpp | 11 ++++++++--- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 032fb0a51..7122019b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,7 +66,7 @@ set(APP_AUTHOR "Martin Rotter") set(APP_COPYRIGHT "\\251 2011-${YEAR} ${APP_AUTHOR}") set(APP_REVERSE_NAME "io.github.martinrotter.rssguard") set(APP_DONATE_URL "https://github.com/sponsors/martinrotter") -set(APP_VERSION "4.4.0") +set(APP_VERSION "4.4.1") set(APP_URL "https://github.com/martinrotter/rssguard") set(APP_URL_DOCUMENTATION "https://github.com/martinrotter/rssguard/blob/${APP_VERSION}/resources/docs/Documentation.md") diff --git a/src/librssguard/core/feedsproxymodel.cpp b/src/librssguard/core/feedsproxymodel.cpp index d605beabd..37c9578d7 100644 --- a/src/librssguard/core/feedsproxymodel.cpp +++ b/src/librssguard/core/feedsproxymodel.cpp @@ -5,6 +5,7 @@ #include "core/feedsmodel.h" #include "database/databasequeries.h" #include "definitions/definitions.h" +#include "definitions/globals.h" #include "gui/feedsview.h" #include "miscellaneous/application.h" #include "miscellaneous/regexfactory.h" @@ -72,8 +73,8 @@ QModelIndexList FeedsProxyModel::match(const QModelIndex& start, QModelIndexList result; const int match_type = flags & 0x0F; const Qt::CaseSensitivity cs = Qt::CaseSensitivity::CaseInsensitive; - const bool recurse = (flags & Qt::MatchFlag::MatchRecursive) > 0; - const bool wrap = (flags & Qt::MatchFlag::MatchWrap) > 0; + const bool recurse = Globals::hasFlag(flags, Qt::MatchFlag::MatchRecursive); + const bool wrap = Globals::hasFlag(flags, Qt::MatchFlag::MatchWrap); const bool all_hits = (hits == -1); QString entered_text; const QModelIndex p = parent(start); diff --git a/src/librssguard/definitions/globals.h b/src/librssguard/definitions/globals.h index 21202370d..130a0b78e 100755 --- a/src/librssguard/definitions/globals.h +++ b/src/librssguard/definitions/globals.h @@ -5,13 +5,13 @@ class Globals { public: - template static bool hasFlag(T lhs, T rhs); + template static bool hasFlag(T lhs, U rhs); private: Globals(); }; -template inline bool Globals::hasFlag(T lhs, T rhs) { +template inline bool Globals::hasFlag(T lhs, U rhs) { return (int(lhs) & int(rhs)) == int(rhs); } diff --git a/src/librssguard/services/gmail/gui/emailpreviewer.cpp b/src/librssguard/services/gmail/gui/emailpreviewer.cpp index 91dfcd8c8..d35b722f8 100644 --- a/src/librssguard/services/gmail/gui/emailpreviewer.cpp +++ b/src/librssguard/services/gmail/gui/emailpreviewer.cpp @@ -72,9 +72,14 @@ void EmailPreviewer::loadMessage(const Message& msg, RootItem* selected_item) { } void EmailPreviewer::loadExtraMessageData() { - m_ui.m_tbTo->setText(m_account->network()->getMessageMetadata(m_message.m_customId, - {QSL("TO")}, - m_account->networkProxy())["To"]); + try { + m_ui.m_tbTo->setText(m_account->network()->getMessageMetadata(m_message.m_customId, + {QSL("TO")}, + m_account->networkProxy())["To"]); + } + catch (const ApplicationException& ex) { + qWarningNN << LOGSEC_GMAIL << "Cannot load extra article metadata:" << QUOTE_W_SPACE_DOT(ex.message()); + } } void EmailPreviewer::replyToEmail() {