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:
@@ -0,0 +1,62 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include "src/services/accountservice.h"
|
||||
#include "src/db/dao/accountdao.h"
|
||||
#include "src/db/databasemanager.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
// Ensure DB is initialized
|
||||
DatabaseManager::instance().database(); // triggers init if needed
|
||||
|
||||
AccountService service;
|
||||
|
||||
// Create a test account
|
||||
Account testAcc;
|
||||
testAcc.setEmail("testdelete@example.com");
|
||||
testAcc.setDisplayName("Test Delete");
|
||||
testAcc.setType(AccountType::IMAP);
|
||||
Account::ConnectionSettings settings;
|
||||
settings.incomingHost = "imap.example.com";
|
||||
settings.incomingPort = 993;
|
||||
settings.incomingSsl = true;
|
||||
settings.outgoingHost = "smtp.example.com";
|
||||
settings.outgoingPort = 465;
|
||||
settings.outgoingSsl = true;
|
||||
settings.username = "testdelete@example.com";
|
||||
settings.password = "testpass";
|
||||
settings.authMethod = "LOGIN";
|
||||
testAcc.setConnectionSettings(settings);
|
||||
|
||||
qDebug() << "Adding test account...";
|
||||
service.addAccount(testAcc);
|
||||
qint64 addedId = testAcc.id(); // after addAccount, id should be set via DAO insert returning id
|
||||
qDebug() << "Added account ID:" << addedId;
|
||||
|
||||
// Verify exists
|
||||
QVector<Account> accounts = AccountDao::findAll();
|
||||
qDebug() << "Accounts after add:" << accounts.size();
|
||||
for (const Account &acc : accounts) {
|
||||
qDebug() << " ID:" << acc.id() << "Email:" << acc.email();
|
||||
}
|
||||
|
||||
// Remove account
|
||||
qDebug() << "Removing account ID:" << addedId;
|
||||
service.removeAccount(addedId);
|
||||
|
||||
// Verify removed
|
||||
accounts = AccountDao::findAll();
|
||||
qDebug() << "Accounts after remove:" << accounts.size();
|
||||
for (const Account &acc : accounts) {
|
||||
qDebug() << " ID:" << acc.id() << "Email:" << acc.email();
|
||||
}
|
||||
|
||||
if (accounts.isEmpty()) {
|
||||
qDebug() << "SUCCESS: No accounts remain.";
|
||||
return 0;
|
||||
} else {
|
||||
qDebug() << "FAILURE: Accounts still present.";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user