diff --git a/app/src/main/java/eu/faircode/email/DaoMessage.java b/app/src/main/java/eu/faircode/email/DaoMessage.java index b5d44384be..5a0c15aa2b 100644 --- a/app/src/main/java/eu/faircode/email/DaoMessage.java +++ b/app/src/main/java/eu/faircode/email/DaoMessage.java @@ -461,6 +461,19 @@ public interface DaoMessage { @Query("SELECT COUNT(*) FROM message") int countTotal(); + @Query("SELECT COUNT(*) FROM message" + + " WHERE folder = :folder" + + " AND NOT ui_seen") + int countUnseen(long folder); + + @Query("SELECT COUNT(*)" + + " FROM message" + + " WHERE folder = :folder" + + " AND notifying <> 0" + + " AND notifying <> " + EntityMessage.NOTIFYING_IGNORE + + " AND NOT (message.ui_seen OR message.ui_ignored OR message.ui_hide)") + int countNotifying(long folder); + @Query("SELECT message.*" + ", account.pop AS accountProtocol, account.name AS accountName, account.category AS accountCategory, identity.color AS accountColor" + ", account.notify AS accountNotify, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" + diff --git a/app/src/main/java/eu/faircode/email/Log.java b/app/src/main/java/eu/faircode/email/Log.java index 009660c8df..16f1b7a4c8 100644 --- a/app/src/main/java/eu/faircode/email/Log.java +++ b/app/src/main/java/eu/faircode/email/Log.java @@ -2135,16 +2135,20 @@ public class Log { if (folders.size() > 0) Collections.sort(folders, folders.get(0).getComparator(context)); for (TupleFolderEx folder : folders) - if (folder.synchronize) + if (folder.synchronize) { + int unseen = db.message().countUnseen(folder.id); + int notifying = db.message().countNotifying(folder.id); size += write(os, "- " + folder.name + " " + folder.type + (folder.unified ? " unified" : "") + (folder.notify ? " notify" : "") + " poll=" + folder.poll + "/" + folder.poll_factor + " days=" + folder.sync_days + "/" + folder.keep_days + " msgs=" + folder.content + "/" + folder.messages + "/" + folder.total + + " unseen=" + unseen + " notifying=" + notifying + " " + folder.state + (folder.last_sync == null ? "" : " " + dtf.format(folder.last_sync)) + "\r\n"); + } size += write(os, "\r\n"); }