some cleanups, remove DB transactins support as it is now useless

This commit is contained in:
Martin Rotter 2023-01-09 14:44:41 +01:00
parent b0cc456087
commit ffc9c74900
15 changed files with 73 additions and 121 deletions

View file

@ -60,7 +60,7 @@
<content_rating type="oars-1.0" /> <content_rating type="oars-1.0" />
<content_rating type="oars-1.1" /> <content_rating type="oars-1.1" />
<releases> <releases>
<release version="4.2.7" date="2023-01-06" /> <release version="4.2.7" date="2023-01-09" />
</releases> </releases>
<provides> <provides>
<binary>@APP_LOW_NAME@</binary> <binary>@APP_LOW_NAME@</binary>

View file

@ -11,7 +11,7 @@
DatabaseCleaner::DatabaseCleaner(QObject* parent) : QObject(parent) {} DatabaseCleaner::DatabaseCleaner(QObject* parent) : QObject(parent) {}
void DatabaseCleaner::purgeDatabaseData(CleanerOrders which_data) { void DatabaseCleaner::purgeDatabaseData(CleanerOrders which_data) {
qDebugNN << LOGSEC_DB << "Performing database cleanup in thread: '" << QThread::currentThreadId() << "'."; qDebugNN << LOGSEC_DB << "Performing database cleanup in thread:" << QUOTE_W_SPACE_DOT(QThread::currentThreadId());
// Inform everyone about the start of the process. // Inform everyone about the start of the process.
emit purgeStarted(); emit purgeStarted();

View file

@ -1086,7 +1086,6 @@ QPair<int, int> DatabaseQueries::updateMessages(QSqlDatabase db,
return {0, 0}; return {0, 0};
} }
bool use_transactions = qApp->settings()->value(GROUP(Database), SETTING(Database::UseTransactions)).toBool();
QPair<int, int> updated_messages = {0, 0}; QPair<int, int> updated_messages = {0, 0};
int account_id = feed->getParentServiceRoot()->accountId(); int account_id = feed->getParentServiceRoot()->accountId();
auto feed_custom_id = feed->customId(); auto feed_custom_id = feed->customId();
@ -1098,7 +1097,6 @@ QPair<int, int> DatabaseQueries::updateMessages(QSqlDatabase db,
QSqlQuery query_select_with_id(db); QSqlQuery query_select_with_id(db);
QSqlQuery query_update(db); QSqlQuery query_update(db);
QSqlQuery query_insert(db); QSqlQuery query_insert(db);
QSqlQuery query_begin_transaction(db);
// Here we have query which will check for existence of the "same" message in given feed. // Here we have query which will check for existence of the "same" message in given feed.
// The two message are the "same" if: // The two message are the "same" if:
@ -1148,12 +1146,6 @@ QPair<int, int> DatabaseQueries::updateMessages(QSqlDatabase db,
"contents = :contents, enclosures = :enclosures, feed = :feed " "contents = :contents, enclosures = :enclosures, feed = :feed "
"WHERE id = :id;")); "WHERE id = :id;"));
if (use_transactions && !db.transaction()) {
qCriticalNN << LOGSEC_DB << "Transaction start for message downloader failed:"
<< QUOTE_W_SPACE_DOT(query_begin_transaction.lastError().text());
return updated_messages;
}
QVector<Message*> msgs_to_insert; QVector<Message*> msgs_to_insert;
for (Message& message : messages) { for (Message& message : messages) {
@ -1473,21 +1465,9 @@ QPair<int, int> DatabaseQueries::updateMessages(QSqlDatabase db,
qWarningNN << LOGSEC_DB << "Failed to set custom ID for all messages:" << QUOTE_W_SPACE_DOT(db.lastError().text()); qWarningNN << LOGSEC_DB << "Failed to set custom ID for all messages:" << QUOTE_W_SPACE_DOT(db.lastError().text());
} }
if (use_transactions && !db.commit()) {
qCriticalNN << LOGSEC_DB
<< "Transaction commit for message downloader failed:" << QUOTE_W_SPACE_DOT(db.lastError().text());
db.rollback();
if (ok != nullptr) {
*ok = false;
updated_messages = {0, 0};
}
}
else {
if (ok != nullptr) { if (ok != nullptr) {
*ok = true; *ok = true;
} }
}
return updated_messages; return updated_messages;
} }

View file

@ -12,18 +12,14 @@ SettingsDatabase::SettingsDatabase(Settings* settings, QWidget* parent)
: SettingsPanel(settings, parent), m_ui(new Ui::SettingsDatabase) { : SettingsPanel(settings, parent), m_ui(new Ui::SettingsDatabase) {
m_ui->setupUi(this); m_ui->setupUi(this);
m_ui->m_lblDataStorageWarning->setHelpText(tr("Note that switching to another data storage type will "
"NOT copy existing your data from currently active data "
"storage to newly selected one."),
true);
m_ui->m_lblMysqlInfo->setHelpText(tr("Note that speed of used MySQL server and latency of used connection " m_ui->m_lblMysqlInfo->setHelpText(tr("Note that speed of used MySQL server and latency of used connection "
"medium HEAVILY influences the final performance of this application. " "medium HEAVILY influences the final performance of this application. "
"Using slow database connections leads to bad performance when browsing " "Using slow database connections leads to bad performance when browsing "
"feeds or messages."), "feeds or messages."),
false); false);
m_ui->m_lblSqliteInMemoryWarnings->setHelpText(tr("Usage of in-memory working database has several advantages " m_ui->m_lblSqliteInMemoryWarnings
->setHelpText(tr("Usage of in-memory working database has several advantages "
"and pitfalls. Make sure that you are familiar with these " "and pitfalls. Make sure that you are familiar with these "
"before you turn this feature on.\n" "before you turn this feature on.\n"
"\n" "\n"
@ -43,23 +39,43 @@ SettingsDatabase::SettingsDatabase(Settings* settings, QWidget* parent)
m_ui->m_txtMysqlPassword->lineEdit()->setPasswordMode(true); m_ui->m_txtMysqlPassword->lineEdit()->setPasswordMode(true);
connect(m_ui->m_cmbDatabaseDriver, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, connect(m_ui->m_cmbDatabaseDriver,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this,
&SettingsDatabase::dirtifySettings); &SettingsDatabase::dirtifySettings);
connect(m_ui->m_checkSqliteUseInMemoryDatabase, &QCheckBox::toggled, this, &SettingsDatabase::dirtifySettings); connect(m_ui->m_checkSqliteUseInMemoryDatabase, &QCheckBox::toggled, this, &SettingsDatabase::dirtifySettings);
connect(m_ui->m_txtMysqlDatabase->lineEdit(), &QLineEdit::textChanged, this, &SettingsDatabase::dirtifySettings); connect(m_ui->m_txtMysqlDatabase->lineEdit(), &QLineEdit::textChanged, this, &SettingsDatabase::dirtifySettings);
connect(m_ui->m_txtMysqlHostname->lineEdit(), &QLineEdit::textChanged, this, &SettingsDatabase::dirtifySettings); connect(m_ui->m_txtMysqlHostname->lineEdit(), &QLineEdit::textChanged, this, &SettingsDatabase::dirtifySettings);
connect(m_ui->m_txtMysqlPassword->lineEdit(), &QLineEdit::textChanged, this, &SettingsDatabase::dirtifySettings); connect(m_ui->m_txtMysqlPassword->lineEdit(), &QLineEdit::textChanged, this, &SettingsDatabase::dirtifySettings);
connect(m_ui->m_checkUseTransactions, &QCheckBox::toggled, this, &SettingsDatabase::dirtifySettings);
connect(m_ui->m_txtMysqlUsername->lineEdit(), &QLineEdit::textChanged, this, &SettingsDatabase::dirtifySettings); connect(m_ui->m_txtMysqlUsername->lineEdit(), &QLineEdit::textChanged, this, &SettingsDatabase::dirtifySettings);
connect(m_ui->m_spinMysqlPort, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &SettingsDatabase::dirtifySettings); connect(m_ui->m_spinMysqlPort,
connect(m_ui->m_cmbDatabaseDriver, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
this,
&SettingsDatabase::dirtifySettings);
connect(m_ui->m_cmbDatabaseDriver,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this,
&SettingsDatabase::selectSqlBackend); &SettingsDatabase::selectSqlBackend);
connect(m_ui->m_txtMysqlUsername->lineEdit(), &BaseLineEdit::textChanged, this, &SettingsDatabase::onMysqlUsernameChanged); connect(m_ui->m_txtMysqlUsername->lineEdit(),
connect(m_ui->m_txtMysqlHostname->lineEdit(), &BaseLineEdit::textChanged, this, &SettingsDatabase::onMysqlHostnameChanged); &BaseLineEdit::textChanged,
connect(m_ui->m_txtMysqlPassword->lineEdit(), &BaseLineEdit::textChanged, this, &SettingsDatabase::onMysqlPasswordChanged); this,
connect(m_ui->m_txtMysqlDatabase->lineEdit(), &BaseLineEdit::textChanged, this, &SettingsDatabase::onMysqlDatabaseChanged); &SettingsDatabase::onMysqlUsernameChanged);
connect(m_ui->m_txtMysqlHostname->lineEdit(),
&BaseLineEdit::textChanged,
this,
&SettingsDatabase::onMysqlHostnameChanged);
connect(m_ui->m_txtMysqlPassword->lineEdit(),
&BaseLineEdit::textChanged,
this,
&SettingsDatabase::onMysqlPasswordChanged);
connect(m_ui->m_txtMysqlDatabase->lineEdit(),
&BaseLineEdit::textChanged,
this,
&SettingsDatabase::onMysqlDatabaseChanged);
connect(m_ui->m_btnMysqlTestSetup, &QPushButton::clicked, this, &SettingsDatabase::mysqlTestConnection); connect(m_ui->m_btnMysqlTestSetup, &QPushButton::clicked, this, &SettingsDatabase::mysqlTestConnection);
connect(m_ui->m_cmbDatabaseDriver, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, connect(m_ui->m_cmbDatabaseDriver,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this,
&SettingsDatabase::requireRestart); &SettingsDatabase::requireRestart);
connect(m_ui->m_checkSqliteUseInMemoryDatabase, &QCheckBox::toggled, this, &SettingsDatabase::requireRestart); connect(m_ui->m_checkSqliteUseInMemoryDatabase, &QCheckBox::toggled, this, &SettingsDatabase::requireRestart);
connect(m_ui->m_spinMysqlPort, &QSpinBox::editingFinished, this, &SettingsDatabase::requireRestart); connect(m_ui->m_spinMysqlPort, &QSpinBox::editingFinished, this, &SettingsDatabase::requireRestart);
@ -139,17 +155,14 @@ void SettingsDatabase::selectSqlBackend(int index) {
m_ui->m_stackedDatabaseDriver->setCurrentIndex(1); m_ui->m_stackedDatabaseDriver->setCurrentIndex(1);
} }
else { else {
qWarningNN << LOGSEC_GUI qWarningNN << LOGSEC_GUI << "GUI for given database driver '" << selected_db_driver << "' is not available.";
<< "GUI for given database driver '"
<< selected_db_driver
<< "' is not available.";
} }
} }
void SettingsDatabase::loadSettings() { void SettingsDatabase::loadSettings() {
onBeginLoadSettings(); onBeginLoadSettings();
m_ui->m_checkUseTransactions->setChecked(qApp->settings()->value(GROUP(Database), SETTING(Database::UseTransactions)).toBool()); m_ui->m_lblMysqlTestResult->setStatus(WidgetWithStatus::StatusType::Information,
m_ui->m_lblMysqlTestResult->setStatus(WidgetWithStatus::StatusType::Information, tr("No connection test triggered so far."), tr("No connection test triggered so far."),
tr("You did not executed any connection test yet.")); tr("You did not executed any connection test yet."));
// Load SQLite. // Load SQLite.
@ -158,7 +171,8 @@ void SettingsDatabase::loadSettings() {
m_ui->m_cmbDatabaseDriver->addItem(lite_driver->humanDriverType(), lite_driver->qtDriverCode()); m_ui->m_cmbDatabaseDriver->addItem(lite_driver->humanDriverType(), lite_driver->qtDriverCode());
// Load in-memory database status. // Load in-memory database status.
m_ui->m_checkSqliteUseInMemoryDatabase->setChecked(settings()->value(GROUP(Database), SETTING(Database::UseInMemory)).toBool()); m_ui->m_checkSqliteUseInMemoryDatabase
->setChecked(settings()->value(GROUP(Database), SETTING(Database::UseInMemory)).toBool());
auto* mysq_driver = qApp->database()->driverForType(DatabaseDriver::DriverType::MySQL); auto* mysq_driver = qApp->database()->driverForType(DatabaseDriver::DriverType::MySQL);
@ -176,16 +190,19 @@ void SettingsDatabase::loadSettings() {
m_ui->m_txtMysqlUsername->lineEdit()->setPlaceholderText(tr("Username to login with")); m_ui->m_txtMysqlUsername->lineEdit()->setPlaceholderText(tr("Username to login with"));
m_ui->m_txtMysqlPassword->lineEdit()->setPlaceholderText(tr("Password for your username")); m_ui->m_txtMysqlPassword->lineEdit()->setPlaceholderText(tr("Password for your username"));
m_ui->m_txtMysqlDatabase->lineEdit()->setPlaceholderText(tr("Working database which you have full access to.")); m_ui->m_txtMysqlDatabase->lineEdit()->setPlaceholderText(tr("Working database which you have full access to."));
m_ui->m_txtMysqlHostname->lineEdit()->setText(settings()->value(GROUP(Database), SETTING(Database::MySQLHostname)).toString()); m_ui->m_txtMysqlHostname->lineEdit()
m_ui->m_txtMysqlUsername->lineEdit()->setText(settings()->value(GROUP(Database), SETTING(Database::MySQLUsername)).toString()); ->setText(settings()->value(GROUP(Database), SETTING(Database::MySQLHostname)).toString());
m_ui->m_txtMysqlPassword->lineEdit()->setText(settings()->password(GROUP(Database), m_ui->m_txtMysqlUsername->lineEdit()
SETTING(Database::MySQLPassword)).toString()); ->setText(settings()->value(GROUP(Database), SETTING(Database::MySQLUsername)).toString());
m_ui->m_txtMysqlDatabase->lineEdit()->setText(settings()->value(GROUP(Database), SETTING(Database::MySQLDatabase)).toString()); m_ui->m_txtMysqlPassword->lineEdit()
->setText(settings()->password(GROUP(Database), SETTING(Database::MySQLPassword)).toString());
m_ui->m_txtMysqlDatabase->lineEdit()
->setText(settings()->value(GROUP(Database), SETTING(Database::MySQLDatabase)).toString());
m_ui->m_spinMysqlPort->setValue(settings()->value(GROUP(Database), SETTING(Database::MySQLPort)).toInt()); m_ui->m_spinMysqlPort->setValue(settings()->value(GROUP(Database), SETTING(Database::MySQLPort)).toInt());
} }
int index_current_backend = m_ui->m_cmbDatabaseDriver->findData(settings()->value(GROUP(Database), int index_current_backend =
SETTING(Database::ActiveDriver)).toString()); m_ui->m_cmbDatabaseDriver->findData(settings()->value(GROUP(Database), SETTING(Database::ActiveDriver)).toString());
if (index_current_backend >= 0) { if (index_current_backend >= 0) {
m_ui->m_cmbDatabaseDriver->setCurrentIndex(index_current_backend); m_ui->m_cmbDatabaseDriver->setCurrentIndex(index_current_backend);
@ -201,11 +218,10 @@ void SettingsDatabase::saveSettings() {
const bool original_inmemory = settings()->value(GROUP(Database), SETTING(Database::UseInMemory)).toBool(); const bool original_inmemory = settings()->value(GROUP(Database), SETTING(Database::UseInMemory)).toBool();
const bool new_inmemory = m_ui->m_checkSqliteUseInMemoryDatabase->isChecked(); const bool new_inmemory = m_ui->m_checkSqliteUseInMemoryDatabase->isChecked();
qApp->settings()->setValue(GROUP(Database), Database::UseTransactions, m_ui->m_checkUseTransactions->isChecked());
// Save data storage settings. // Save data storage settings.
QString original_db_driver = settings()->value(GROUP(Database), SETTING(Database::ActiveDriver)).toString(); QString original_db_driver = settings()->value(GROUP(Database), SETTING(Database::ActiveDriver)).toString();
QString selected_db_driver = m_ui->m_cmbDatabaseDriver->itemData(m_ui->m_cmbDatabaseDriver->currentIndex()).toString(); QString selected_db_driver =
m_ui->m_cmbDatabaseDriver->itemData(m_ui->m_cmbDatabaseDriver->currentIndex()).toString();
// Save SQLite. // Save SQLite.
settings()->setValue(GROUP(Database), Database::UseInMemory, new_inmemory); settings()->setValue(GROUP(Database), Database::UseInMemory, new_inmemory);

View file

@ -11,20 +11,7 @@
</rect> </rect>
</property> </property>
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
<item row="0" column="0" colspan="2"> <item row="0" column="0">
<widget class="QCheckBox" name="m_checkUseTransactions">
<property name="toolTip">
<string>Note that turning this option ON will make saving of new messages FASTER, but it might rarely cause some issues with messages saving.</string>
</property>
<property name="text">
<string>Use DB transactions when storing downloaded messages</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="HelpSpoiler" name="m_lblDataStorageWarning" native="true"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="m_lblDatabaseDriver"> <widget class="QLabel" name="m_lblDatabaseDriver">
<property name="text"> <property name="text">
<string>Database driver</string> <string>Database driver</string>
@ -34,10 +21,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="0" column="1">
<widget class="QComboBox" name="m_cmbDatabaseDriver"/> <widget class="QComboBox" name="m_cmbDatabaseDriver"/>
</item> </item>
<item row="3" column="0" colspan="2"> <item row="1" column="0" colspan="2">
<widget class="QStackedWidget" name="m_stackedDatabaseDriver"> <widget class="QStackedWidget" name="m_stackedDatabaseDriver">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>0</number>
@ -204,7 +191,7 @@
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="4" column="0" colspan="2"> <item row="2" column="0" colspan="2">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -218,11 +205,6 @@
</spacer> </spacer>
</item> </item>
</layout> </layout>
<zorder>m_lblDatabaseDriver</zorder>
<zorder>m_cmbDatabaseDriver</zorder>
<zorder>m_stackedDatabaseDriver</zorder>
<zorder>m_checkUseTransactions</zorder>
<zorder>m_lblDataStorageWarning</zorder>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>

View file

@ -374,9 +374,6 @@ DVALUE(int) Proxy::PortDef = 80;
// Database. // Database.
DKEY Database::ID = "database"; DKEY Database::ID = "database";
DKEY Database::UseTransactions = "use_transactions";
DVALUE(bool) Database::UseTransactionsDef = false;
DKEY Database::UseInMemory = "use_in_memory_db"; DKEY Database::UseInMemory = "use_in_memory_db";
DVALUE(bool) Database::UseInMemoryDef = false; DVALUE(bool) Database::UseInMemoryDef = false;

View file

@ -401,9 +401,6 @@ namespace Proxy {
// Database. // Database.
namespace Database { namespace Database {
KEY ID; KEY ID;
KEY UseTransactions;
VALUE(bool) UseTransactionsDef;
KEY UseInMemory; KEY UseInMemory;

View file

@ -17,8 +17,6 @@
#include "services/abstract/serviceroot.h" #include "services/abstract/serviceroot.h"
#include "services/abstract/unreadnode.h" #include "services/abstract/unreadnode.h"
#include <QThread>
Feed::Feed(RootItem* parent) Feed::Feed(RootItem* parent)
: RootItem(parent), m_source(QString()), m_status(Status::Normal), m_statusString(QString()), : RootItem(parent), m_source(QString()), m_status(Status::Normal), m_statusString(QString()),
m_autoUpdateType(AutoUpdateType::DefaultAutoUpdate), m_autoUpdateInterval(DEFAULT_AUTO_UPDATE_INTERVAL), m_autoUpdateType(AutoUpdateType::DefaultAutoUpdate), m_autoUpdateInterval(DEFAULT_AUTO_UPDATE_INTERVAL),

View file

@ -8,8 +8,6 @@
#include "services/abstract/cacheforserviceroot.h" #include "services/abstract/cacheforserviceroot.h"
#include "services/abstract/serviceroot.h" #include "services/abstract/serviceroot.h"
#include <QThread>
ImportantNode::ImportantNode(RootItem* parent_item) : RootItem(parent_item) { ImportantNode::ImportantNode(RootItem* parent_item) : RootItem(parent_item) {
setKind(RootItem::Kind::Important); setKind(RootItem::Kind::Important);
setId(ID_IMPORTANT); setId(ID_IMPORTANT);

View file

@ -12,7 +12,6 @@
#include <QPainter> #include <QPainter>
#include <QPainterPath> #include <QPainterPath>
#include <QThread>
Label::Label(const QString& name, const QColor& color, RootItem* parent_item) : Label(parent_item) { Label::Label(const QString& name, const QColor& color, RootItem* parent_item) : Label(parent_item) {
setColor(color); setColor(color);

View file

@ -9,8 +9,6 @@
#include "services/abstract/cacheforserviceroot.h" #include "services/abstract/cacheforserviceroot.h"
#include "services/abstract/serviceroot.h" #include "services/abstract/serviceroot.h"
#include <QThread>
RecycleBin::RecycleBin(RootItem* parent_item) : RootItem(parent_item), m_totalCount(0), m_unreadCount(0) { RecycleBin::RecycleBin(RootItem* parent_item) : RootItem(parent_item), m_totalCount(0), m_unreadCount(0) {
setKind(RootItem::Kind::Bin); setKind(RootItem::Kind::Bin);
setId(ID_RECYCLE_BIN); setId(ID_RECYCLE_BIN);

View file

@ -19,8 +19,6 @@
#include "services/abstract/recyclebin.h" #include "services/abstract/recyclebin.h"
#include "services/abstract/unreadnode.h" #include "services/abstract/unreadnode.h"
#include <QThread>
ServiceRoot::ServiceRoot(RootItem* parent) ServiceRoot::ServiceRoot(RootItem* parent)
: RootItem(parent), m_recycleBin(new RecycleBin(this)), m_importantNode(new ImportantNode(this)), : RootItem(parent), m_recycleBin(new RecycleBin(this)), m_importantNode(new ImportantNode(this)),
m_labelsNode(new LabelsNode(this)), m_unreadNode(new UnreadNode(this)), m_accountId(NO_PARENT_CATEGORY), m_labelsNode(new LabelsNode(this)), m_unreadNode(new UnreadNode(this)), m_accountId(NO_PARENT_CATEGORY),
@ -953,7 +951,6 @@ QPair<int, int> ServiceRoot::updateMessages(QList<Message>& messages, Feed* feed
return updated_messages; return updated_messages;
} }
QList<RootItem*> items_to_update;
bool ok = false; bool ok = false;
QSqlDatabase database = qApp->database()->driver()->threadSafeConnection(metaObject()->className()); QSqlDatabase database = qApp->database()->driver()->threadSafeConnection(metaObject()->className());
@ -967,28 +964,22 @@ QPair<int, int> ServiceRoot::updateMessages(QList<Message>& messages, Feed* feed
if (recycleBin() != nullptr) { if (recycleBin() != nullptr) {
recycleBin()->updateCounts(true); recycleBin()->updateCounts(true);
items_to_update.append(recycleBin());
} }
if (importantNode() != nullptr) { if (importantNode() != nullptr) {
importantNode()->updateCounts(true); importantNode()->updateCounts(true);
items_to_update.append(importantNode());
} }
if (unreadNode() != nullptr) { if (unreadNode() != nullptr) {
unreadNode()->updateCounts(true); unreadNode()->updateCounts(true);
items_to_update.append(unreadNode());
} }
if (labelsNode() != nullptr) { if (labelsNode() != nullptr) {
labelsNode()->updateCounts(true); labelsNode()->updateCounts(true);
items_to_update.append(labelsNode());
} }
} }
// Some messages were really added to DB, reload feed in model. // NOTE: Do not update model items here. We update only once when all feeds are fetched.
items_to_update.append(feed);
// getParentServiceRoot()->itemChanged(items_to_update);
return updated_messages; return updated_messages;
} }

View file

@ -6,8 +6,6 @@
#include "miscellaneous/application.h" #include "miscellaneous/application.h"
#include "miscellaneous/iconfactory.h" #include "miscellaneous/iconfactory.h"
#include <QThread>
UnreadNode::UnreadNode(RootItem* parent_item) : RootItem(parent_item) { UnreadNode::UnreadNode(RootItem* parent_item) : RootItem(parent_item) {
setKind(RootItem::Kind::Unread); setKind(RootItem::Kind::Unread);
setId(ID_UNREAD); setId(ID_UNREAD);

View file

@ -23,7 +23,6 @@
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject> #include <QJsonObject>
#include <QRegularExpression> #include <QRegularExpression>
#include <QThread>
#include <QUrl> #include <QUrl>
GmailNetworkFactory::GmailNetworkFactory(QObject* parent) GmailNetworkFactory::GmailNetworkFactory(QObject* parent)

View file

@ -24,7 +24,6 @@
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject> #include <QJsonObject>
#include <QRegularExpression> #include <QRegularExpression>
#include <QThread>
#include <QUrl> #include <QUrl>
RedditNetworkFactory::RedditNetworkFactory(QObject* parent) RedditNetworkFactory::RedditNetworkFactory(QObject* parent)