Advance Phase 5: added EmailManager, updated main.cpp, improved ReaderPage placeholder, added ComposePage form

This commit is contained in:
Padrino
2026-05-17 03:08:16 +02:00
parent 99812bbf4c
commit 4a6551642a
5 changed files with 142 additions and 17 deletions
+32
View File
@@ -0,0 +1,32 @@
#include "EmailManager.h"
#include <QDir>
#include <QStandardPaths>
#include "../db/dao/mailitemdao.h"
EmailManager::EmailManager(QObject *parent)
: QObject(parent)
{
}
MailItem EmailManager::getMailItemById(qint64 id) const
{
// Use the DAO to fetch the MailItem by id
auto optItem = MailItemDao::instance().findById(id);
if (optItem.has_value()) {
return optItem.value();
}
// Return an empty MailItem if not found
return MailItem();
}
QString EmailManager::getStorageDirectory() const
{
// Define where .eml files are stored (e.g., in the application data directory)
QString storagePath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
QDir dir(storagePath);
if (!dir.exists()) {
dir.mkpath("."); // create if it doesn't exist
}
// Assuming .eml files are stored directly in this directory
return storagePath;
}