Fix couple of bugs - not purging starred messages, not updated counts in "important" node after feed update. There is a big API/code cleanup ahead.

This commit is contained in:
Martin Rotter 2020-06-12 13:34:16 +02:00
parent c7bad4d61b
commit 362ed189f5
6 changed files with 21 additions and 6 deletions

View File

@ -16,7 +16,7 @@ void DatabaseCleaner::purgeDatabaseData(const CleanerOrders& which_data) {
// Inform everyone about the start of the process.
emit purgeStarted();
bool result = true;
const int difference = 99 / 8;
const int difference = 99 / 12;
int progress = 0;
QSqlDatabase database = qApp->database()->connection(metaObject()->className());
@ -50,6 +50,16 @@ void DatabaseCleaner::purgeDatabaseData(const CleanerOrders& which_data) {
emit purgeProgress(progress, tr("Old messages purged..."));
}
if (which_data.m_removeStarredMessages) {
progress += difference;
emit purgeProgress(progress, tr("Removing starred messages..."));
// Remove old messages.
result &= purgeStarredMessages(database);
progress += difference;
emit purgeProgress(progress, tr("Starred messages purged..."));
}
if (which_data.m_shrinkDatabase) {
progress += difference;
emit purgeProgress(progress, tr("Shrinking database file..."));

View File

@ -10,6 +10,7 @@
#include "miscellaneous/mutex.h"
#include "miscellaneous/textfactory.h"
#include "services/abstract/cacheforserviceroot.h"
#include "services/abstract/importantnode.h"
#include "services/abstract/recyclebin.h"
#include "services/abstract/serviceroot.h"
@ -209,6 +210,11 @@ int Feed::updateMessages(const QList<Message>& messages, bool error_during_obtai
getParentServiceRoot()->recycleBin()->updateCounts(true);
items_to_update.append(getParentServiceRoot()->recycleBin());
}
if (getParentServiceRoot()->importantNode() != nullptr && anything_updated) {
getParentServiceRoot()->importantNode()->updateCounts(true);
items_to_update.append(getParentServiceRoot()->importantNode());
}
}
}
else {

View File

@ -165,7 +165,7 @@ void GmailServiceRoot::start(bool freshly_activated) {
loadFromDatabase();
loadCacheFromFile(accountId());
if (childCount() <= 1) {
if (childCount() <= 2) {
syncIn();
}
@ -208,7 +208,6 @@ void GmailServiceRoot::saveAllCachedData(bool async) {
while (j.hasNext()) {
j.next();
auto key = j.key();
QList<Message> messages = j.value();
if (!messages.isEmpty()) {

View File

@ -123,7 +123,7 @@ void InoreaderServiceRoot::start(bool freshly_activated) {
loadFromDatabase();
loadCacheFromFile(accountId());
if (childCount() <= 1) {
if (childCount() <= 2) {
syncIn();
}
else {

View File

@ -74,7 +74,7 @@ void OwnCloudServiceRoot::start(bool freshly_activated) {
loadFromDatabase();
loadCacheFromFile(accountId());
if (childCount() <= 1) {
if (childCount() <= 2) {
syncIn();
}
}

View File

@ -36,7 +36,7 @@ void TtRssServiceRoot::start(bool freshly_activated) {
loadFromDatabase();
loadCacheFromFile(accountId());
if (qApp->isFirstRun(QSL("3.1.1")) || (childCount() == 1 && child(0)->kind() == RootItemKind::Bin)) {
if (childCount() <= 2) {
syncIn();
}
}