feat: responsive compact mail view + folder unread badges
- CompactMailDelegate: card-based view for narrow panels (<420px) * Avatar with hash-based color, sender + date (relative format) * Subject line with attachment icon * Action buttons: flag, delete, category, more (context menu) * Unread highlight with light blue background + bold sender - MailListView: automatic switch between tree/table (wide) and list/cards (narrow) * QStackedWidget with QTreeView + QListView sharing same proxy model * resizeEvent threshold at 420px * Signals forwarded to MainMainWindow for actions - FolderTreeDelegate: custom paint for folder tree * Unread count badge (blue pill) right-aligned on folder nodes * Account nodes bold, folder nodes normal weight * Proper indentation per depth level - MailItemDao::countUnreadByFolderId() for real-time unread counts - MainMainWindow handlers for compact actions (flag, delete, category, more menu)
This commit is contained in:
@@ -394,3 +394,19 @@ QVector<StoredAttachmentRecord> MailItemDao::attachmentsForMail(qint64 mailItemI
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int MailItemDao::countUnreadByFolderId(int folderId)
|
||||
{
|
||||
QSqlDatabase db = DatabaseManager::instance().database();
|
||||
QSqlQuery query(db);
|
||||
query.prepare("SELECT COUNT(*) FROM MailCopy WHERE folderId = :folderId AND read = 0");
|
||||
query.bindValue(":folderId", folderId);
|
||||
if (!query.exec()) {
|
||||
qWarning() << "Failed to count unread mails:" << query.lastError().text();
|
||||
return 0;
|
||||
}
|
||||
if (query.next()) {
|
||||
return query.value(0).toInt();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -32,4 +32,5 @@ public:
|
||||
static bool removeByUid(int folderId, qint64 uid);
|
||||
static bool replaceAttachments(qint64 mailItemId, const QVector<StoredAttachmentRecord>& attachments);
|
||||
static QVector<StoredAttachmentRecord> attachmentsForMail(qint64 mailItemId);
|
||||
static int countUnreadByFolderId(int folderId);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user