Fixed #43.
This commit is contained in:
parent
6d48863b1f
commit
ab01f6b91c
@ -1,3 +1,13 @@
|
||||
3.3.5
|
||||
—————
|
||||
|
||||
Added:
|
||||
|
||||
Changed:
|
||||
▪ Made some tweaks regarding bug #41. Number of new messages is now determined in feed downloader working thread too.
|
||||
|
||||
Fixed:
|
||||
|
||||
3.3.4
|
||||
—————
|
||||
|
||||
|
@ -73,7 +73,7 @@ APP_LOW_NAME = "rssguard"
|
||||
APP_LOW_H_NAME = ".rssguard"
|
||||
APP_AUTHOR = "Martin Rotter"
|
||||
APP_COPYRIGHT = "(C) 2011-2016 $$APP_AUTHOR"
|
||||
APP_VERSION = "3.3.4"
|
||||
APP_VERSION = "3.3.5"
|
||||
APP_LONG_NAME = "$$APP_NAME $$APP_VERSION"
|
||||
APP_EMAIL = "rotter.martinos@gmail.com"
|
||||
APP_URL = "https://github.com/martinrotter/rssguard"
|
||||
|
@ -106,11 +106,13 @@ void FeedDownloader::oneFeedUpdateFinished(const QList<Message> &messages) {
|
||||
<< feed->id() << " in thread: \'"
|
||||
<< QThread::currentThreadId() << "\'.";
|
||||
|
||||
int updated_messages;
|
||||
int updated_messages = feed->updateMessages(messages);
|
||||
|
||||
/*
|
||||
QMetaObject::invokeMethod(feed, "updateMessages", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(int, updated_messages),
|
||||
Q_ARG(QList<Message>, messages));
|
||||
*/
|
||||
|
||||
if (updated_messages > 0) {
|
||||
m_results.appendUpdatedFeed(QPair<QString,int>(feed->title(), updated_messages));
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
for (int i = 0; i < argc; i++) {
|
||||
const QString str = QString::fromLocal8Bit(argv[i]);
|
||||
|
@ -128,7 +128,10 @@ void Feed::setUrl(const QString &url) {
|
||||
}
|
||||
|
||||
void Feed::updateCounts(bool including_total_count) {
|
||||
QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
|
||||
bool is_main_thread = QThread::currentThread() == qApp->thread();
|
||||
QSqlDatabase database = is_main_thread ?
|
||||
qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings) :
|
||||
qApp->database()->connection(QSL("feed_upd"), DatabaseFactory::FromSettings);
|
||||
int account_id = getParentServiceRoot()->accountId();
|
||||
|
||||
if (including_total_count) {
|
||||
@ -148,16 +151,18 @@ void Feed::run() {
|
||||
}
|
||||
|
||||
int Feed::updateMessages(const QList<Message> &messages) {
|
||||
qDebug().nospace() << "Updating messages in DB. Main thread: " <<
|
||||
(QThread::currentThread() == qApp->thread() ? "true." : "false.");
|
||||
bool is_main_thread = QThread::currentThread() == qApp->thread();
|
||||
|
||||
qDebug("Updating messages in DB. Main thread: '%s'.", qPrintable(is_main_thread ? "true." : "false."));
|
||||
|
||||
int custom_id = customId();
|
||||
int account_id = getParentServiceRoot()->accountId();
|
||||
bool anything_updated = false;
|
||||
bool ok;
|
||||
QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
|
||||
int updated_messages = DatabaseQueries::updateMessages(database, messages, custom_id, account_id, url(),
|
||||
&anything_updated, &ok);
|
||||
QSqlDatabase database = is_main_thread ?
|
||||
qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings) :
|
||||
qApp->database()->connection(QSL("feed_upd"), DatabaseFactory::FromSettings);
|
||||
int updated_messages = DatabaseQueries::updateMessages(database, messages, custom_id, account_id, url(), &anything_updated, &ok);
|
||||
|
||||
if (ok) {
|
||||
if (updated_messages > 0) {
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "miscellaneous/databasequeries.h"
|
||||
#include "services/abstract/serviceroot.h"
|
||||
|
||||
#include <QThread>
|
||||
|
||||
|
||||
RecycleBin::RecycleBin(RootItem *parent_item) : RootItem(parent_item), m_totalCount(0),
|
||||
m_unreadCount(0), m_contextMenu(QList<QAction*>()) {
|
||||
@ -46,7 +48,10 @@ int RecycleBin::countOfAllMessages() const {
|
||||
}
|
||||
|
||||
void RecycleBin::updateCounts(bool update_total_count) {
|
||||
QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
|
||||
bool is_main_thread = QThread::currentThread() == qApp->thread();
|
||||
QSqlDatabase database = is_main_thread ?
|
||||
qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings) :
|
||||
qApp->database()->connection(QSL("feed_upd"), DatabaseFactory::FromSettings);
|
||||
|
||||
m_unreadCount = DatabaseQueries::getMessageCountsForBin(database, getParentServiceRoot()->accountId(), false);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user