This commit is contained in:
Martin Rotter 2020-08-06 11:42:52 +02:00
parent ed1ee0b362
commit 2618791143
7 changed files with 35 additions and 34 deletions

View File

@ -138,14 +138,15 @@ void FeedDownloader::updateOneFeed(Feed* feed) {
for (int i = 0; i < msgs.size(); i++) {
Message msg_backup(msgs[i]);
Message* msg_orig = &msgs[i];
// Attach live message object to wrapper.
tmr.restart();
msg_obj.setMessage(&msgs[i]);
msg_obj.setMessage(msg_orig);
qDebugNN << LOGSEC_FEEDDOWNLOADER << "Hooking message took " << tmr.nsecsElapsed() / 1000 << " microseconds.";
auto feed_filters = feed->messageFilters();
bool msg_ignored = false;
bool remove_msg = false;
for (int j = 0; j < feed_filters.size(); j++) {
QPointer<MessageFilter> filter = feed_filters.at(j);
@ -176,8 +177,7 @@ void FeedDownloader::updateOneFeed(Feed* feed) {
case FilteringAction::Ignore:
// Remove the message, we do not want it.
msgs.removeAt(i--);
msg_ignored = true;
remove_msg = true;
break;
}
}
@ -194,18 +194,20 @@ void FeedDownloader::updateOneFeed(Feed* feed) {
break;
}
if (!msg_ignored) {
if (!msg_backup.m_isRead && msgs[i].m_isRead) {
qDebugNN << LOGSEC_FEEDDOWNLOADER << "Message with custom ID: '" << msg_backup.m_customId << "' was marked as read by message scripts.";
if (!msg_backup.m_isRead && msg_orig->m_isRead) {
qDebugNN << LOGSEC_FEEDDOWNLOADER << "Message with custom ID: '" << msg_backup.m_customId << "' was marked as read by message scripts.";
read_msgs << msgs[i];
}
read_msgs << *msg_orig;
}
if (!msg_backup.m_isImportant && msgs[i].m_isImportant) {
qDebugNN << LOGSEC_FEEDDOWNLOADER << "Message with custom ID: '" << msg_backup.m_customId << "' was marked as important by message scripts.";
if (!msg_backup.m_isImportant && msg_orig->m_isImportant) {
qDebugNN << LOGSEC_FEEDDOWNLOADER << "Message with custom ID: '" << msg_backup.m_customId << "' was marked as important by message scripts.";
important_msgs << msgs[i];
}
important_msgs << *msg_orig;
}
if (remove_msg) {
msgs.removeAt(i--);
}
}

View File

@ -86,6 +86,8 @@
#define LOGSEC_FEEDMODEL "feed-model: "
#define LOGSEC_FEEDDOWNLOADER "feed-downloader: "
#define LOGSEC_MESSAGEMODEL "message-model: "
#define LOGSEC_GUI "gui: "
#define LOGSEC_CORE "core: "
#define MAX_ZOOM_FACTOR 5.0f
#define MIN_ZOOM_FACTOR 0.25f

View File

@ -33,7 +33,7 @@ ShortcutCatcher::ShortcutCatcher(QWidget* parent)
m_shortcutBox->setMinimumWidth(170);
m_shortcutBox->setToolTip(tr("Click and hit new shortcut."));
// Add both buttons to the layout.
// Add all buttons to the layout.
m_layout->addWidget(m_shortcutBox);
m_layout->addWidget(m_btnReset);
m_layout->addWidget(m_btnClear);

View File

@ -20,9 +20,7 @@ FormAbout::FormAbout(QWidget* parent) : QDialog(parent) {
loadSettingsAndPaths();
}
FormAbout::~FormAbout() {
qDebug() << QSslSocket::sslLibraryVersionString();
}
FormAbout::~FormAbout() {}
void FormAbout::loadSettingsAndPaths() {
if (qApp->settings()->type() == SettingsProperties::SettingsType::Portable) {

View File

@ -29,7 +29,7 @@ FormAddAccount::FormAddAccount(const QList<ServiceEntryPoint*>& entry_points, Fe
}
FormAddAccount::~FormAddAccount() {
qDebug("Destroying FormAddAccount instance.");
qDebugNN << LOGSEC_GUI << "Destroying FormAddAccount instance.";
}
void FormAddAccount::addSelectedAccount() {
@ -41,7 +41,7 @@ void FormAddAccount::addSelectedAccount() {
m_model->addServiceAccount(new_root, true);
}
else {
qWarning("Cannot create new account.");
qDebugNN << LOGSEC_CORE << "Cannot create new account.";
}
}
@ -55,7 +55,7 @@ void FormAddAccount::loadEntryPoints() {
if (entry_point->isSingleInstanceService() && m_model->containsServiceRootFromEntryPoint(entry_point)) {
// Oops, this item cannot be added, it is single instance and is already added.
item->setFlags(Qt::NoItemFlags);
item->setFlags(Qt::ItemFlag::NoItemFlags);
item->setToolTip(tr("This account can be added only once."));
}
else {

View File

@ -35,7 +35,7 @@ FormBackupDatabaseSettings::FormBackupDatabaseSettings(QWidget* parent) : QDialo
}
FormBackupDatabaseSettings::~FormBackupDatabaseSettings() {
qDebug("Destroying FormBackupDatabaseSettings instance.");
qDebugNN << LOGSEC_GUI << "Destroying FormBackupDatabaseSettings instance.";
}
void FormBackupDatabaseSettings::performBackup() {

View File

@ -33,6 +33,11 @@
#include "services/owncloud/network/owncloudnetworkfactory.h"
#include "services/standard/gui/formstandardimportexport.h"
#if defined (USE_WEBENGINE)
#include "network-web/adblock/adblockicon.h"
#include "network-web/adblock/adblockmanager.h"
#endif
#include <QCloseEvent>
#include <QDesktopWidget>
#include <QFileDialog>
@ -45,14 +50,9 @@
#include <QScreen>
#endif
#if defined (USE_WEBENGINE)
#include "network-web/adblock/adblockicon.h"
#include "network-web/adblock/adblockmanager.h"
#endif
FormMain::FormMain(QWidget* parent, Qt::WindowFlags f)
: QMainWindow(parent, f), m_ui(new Ui::FormMain), m_trayMenu(nullptr), m_statusBar(nullptr) {
qDebug().nospace() << "Creating main application form in thread: \'" << QThread::currentThreadId() << "\'.";
qDebugNN << LOGSEC_GUI << "Creating main application form in thread: '" << QThread::currentThreadId() << "'.";
m_ui->setupUi(this);
qApp->setMainForm(this);
@ -89,7 +89,7 @@ FormMain::FormMain(QWidget* parent, Qt::WindowFlags f)
}
FormMain::~FormMain() {
qDebug("Destroying FormMain instance.");
qDebugNN << LOGSEC_GUI << "Destroying FormMain instance.";
}
QMenu* FormMain::trayMenu() const {
@ -135,16 +135,13 @@ QList<QAction*> FormMain::allActions() const {
#if !defined(Q_OS_MACOS)
actions << m_ui->m_actionFullscreen;
actions << m_ui->m_actionSwitchMainMenu;
#endif
actions << m_ui->m_actionAboutGuard;
actions << m_ui->m_actionSwitchFeedsList;
actions << m_ui->m_actionSwitchMainWindow;
#if !defined(Q_OS_MACOS)
actions << m_ui->m_actionSwitchMainMenu;
#endif
actions << m_ui->m_actionSwitchToolBars;
actions << m_ui->m_actionSwitchListHeaders;
actions << m_ui->m_actionSwitchStatusBar;
@ -193,6 +190,7 @@ QList<QAction*> FormMain::allActions() const {
actions << m_ui->m_actionTabsCloseAll;
actions << m_ui->m_actionTabsCloseAllExceptCurrent;
return actions;
}
@ -213,7 +211,8 @@ void FormMain::prepareMenus() {
m_trayMenu->addSeparator();
m_trayMenu->addAction(m_ui->m_actionSettings);
m_trayMenu->addAction(m_ui->m_actionQuit);
qDebug("Creating tray icon menu.");
qDebugNN << LOGSEC_MESSAGEMODEL << "Creating tray icon menu.";
}
#if !defined(USE_WEBENGINE)
@ -545,7 +544,7 @@ void FormMain::loadSize() {
QScreen* scr = screen();
if (scr == nullptr) {
qWarning("Cannot load dialog size, because no screens are detected.");
qWarningNN << LOGSEC_MESSAGEMODEL << "Cannot load dialog size, because no screens are detected.";
return;
}