work on probes, some other fixes

This commit is contained in:
Martin Rotter 2023-08-16 09:26:08 +02:00
parent 6566349838
commit 27295f10f9
7 changed files with 10 additions and 66 deletions

View file

@ -3,6 +3,7 @@
#include "miscellaneous/application.h"
#include "3rd-party/boolinq/boolinq.h"
#include "3rd-party/sqlite/sqlite3.h"
#include "dynamic-shortcuts/dynamicshortcuts.h"
#include "exceptions/applicationexception.h"
#include "gui/dialogs/formabout.h"
@ -233,6 +234,7 @@ Application::Application(const QString& id, int& argc, char** argv, const QStrin
setupWorkHorsePool();
qDebugNN << LOGSEC_CORE << "SQLite version:" << QUOTE_W_SPACE_DOT(SQLITE_VERSION);
qDebugNN << LOGSEC_CORE << "OpenSSL version:" << QUOTE_W_SPACE_DOT(QSslSocket::sslLibraryVersionString());
qDebugNN << LOGSEC_CORE << "OpenSSL supported:" << QUOTE_W_SPACE_DOT(QSslSocket::supportsSsl());
qDebugNN << LOGSEC_CORE << "Global thread pool has"

View file

@ -20,13 +20,13 @@ Category::Category(const Category& other) : RootItem(other) {
void Category::updateCounts(bool including_total_count) {
QList<Feed*> feeds;
auto str = getSubTree();
auto str = childItems();
for (RootItem* child : qAsConst(str)) {
if (child->kind() == RootItem::Kind::Feed) {
feeds.append(child->toFeed());
}
else if (child->kind() != RootItem::Kind::Category && child->kind() != RootItem::Kind::ServiceRoot) {
else if (child->kind() == RootItem::Kind::Category) {
child->updateCounts(including_total_count);
}
}

View file

@ -32,34 +32,6 @@ QList<Message> LabelsNode::undeletedMessages() const {
return DatabaseQueries::getUndeletedLabelledMessages(database, getParentServiceRoot()->accountId());
}
int LabelsNode::countOfUnreadMessages() const {
auto chi = childItems();
if (chi.isEmpty()) {
return 0;
}
return boolinq::from(chi)
.max([](RootItem* it) {
return it->countOfUnreadMessages();
})
->countOfUnreadMessages();
}
int LabelsNode::countOfAllMessages() const {
auto chi = childItems();
if (chi.isEmpty()) {
return 0;
}
return boolinq::from(chi)
.max([](RootItem* it) {
return it->countOfAllMessages();
})
->countOfAllMessages();
}
void LabelsNode::updateCounts(bool including_total_count) {
// TODO: This is still rather slow because this is automatically
// called when message is marked (un)read or starred.

View file

@ -18,8 +18,6 @@ class LabelsNode : public RootItem {
virtual QList<Message> undeletedMessages() const;
virtual QList<QAction*> contextMenuFeedsList();
virtual int countOfUnreadMessages() const;
virtual int countOfAllMessages() const;
virtual void updateCounts(bool including_total_count);
Label* labelById(const QString& custom_id);

View file

@ -217,8 +217,9 @@ bool RootItem::performDragDropChange(RootItem* target_item) {
int RootItem::countOfUnreadMessages() const {
return boolinq::from(m_childItems).sum([](RootItem* it) {
return (it->kind() == RootItem::Kind::Important || it->kind() == RootItem::Kind::Unread ||
it->kind() == RootItem::Kind::Labels || it->kind() == RootItem::Kind::Probes)
return (it->kind() == RootItem::Kind::Bin || it->kind() == RootItem::Kind::Important ||
it->kind() == RootItem::Kind::Unread || it->kind() == RootItem::Kind::Labels ||
it->kind() == RootItem::Kind::Probes)
? 0
: it->countOfUnreadMessages();
});
@ -226,8 +227,9 @@ int RootItem::countOfUnreadMessages() const {
int RootItem::countOfAllMessages() const {
return boolinq::from(m_childItems).sum([](RootItem* it) {
return (it->kind() == RootItem::Kind::Important || it->kind() == RootItem::Kind::Unread ||
it->kind() == RootItem::Kind::Labels || it->kind() == RootItem::Kind::Probes)
return (it->kind() == RootItem::Kind::Bin || it->kind() == RootItem::Kind::Important ||
it->kind() == RootItem::Kind::Unread || it->kind() == RootItem::Kind::Labels ||
it->kind() == RootItem::Kind::Probes)
? 0
: it->countOfAllMessages();
});

View file

@ -61,34 +61,6 @@ QList<QAction*> SearchsNode::contextMenuFeedsList() {
return QList<QAction*>{m_actProbeNew};
}
int SearchsNode::countOfUnreadMessages() const {
auto chi = childItems();
if (chi.isEmpty()) {
return 0;
}
return boolinq::from(chi)
.max([](RootItem* it) {
return it->countOfUnreadMessages();
})
->countOfUnreadMessages();
}
int SearchsNode::countOfAllMessages() const {
auto chi = childItems();
if (chi.isEmpty()) {
return 0;
}
return boolinq::from(chi)
.max([](RootItem* it) {
return it->countOfAllMessages();
})
->countOfAllMessages();
}
void SearchsNode::createProbe() {
FormAddEditProbe frm(qApp->mainFormWidget());
Search* new_prb = frm.execForAdd();

View file

@ -17,8 +17,6 @@ class SearchsNode : public RootItem {
void loadProbes(const QList<Search*>& probes);
virtual QList<Message> undeletedMessages() const;
virtual int countOfUnreadMessages() const;
virtual int countOfAllMessages() const;
virtual QList<QAction*> contextMenuFeedsList();
Search* probeById(const QString& custom_id);