feat: comprehensive Wino Mail updates
- ReaderView: complete rewrite with CSS styling, headers, attachments, zoom, find, dark mode, image blocking - Categories: DAO + UI tree widget with colors, nested categories, assignment - Rules engine: DAO + evaluation + actions (move, mark read, flag, delete, category, forward) - Templates: DAO + editor + manager with variables support - Signatures: DAO + manager + auto-per-account + manual selector in compose - ComposeView: signature combo, template selector, auto-signature on new email - MainWindow: frameless with rounded corners, 1px border, resize from edges, no status bar - Database: new tables (Category, MailCategory, Rule, Template, Signature) with indexes
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
#include "../databasemanager.h"
|
||||
#include <QVector>
|
||||
#include <optional>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
|
||||
struct TemplateVariable
|
||||
{
|
||||
QString name;
|
||||
QString label;
|
||||
QString defaultValue;
|
||||
QString type; // "text", "email", "date", "select", "textarea"
|
||||
QStringList options; // for select type
|
||||
};
|
||||
|
||||
struct Template
|
||||
{
|
||||
qint64 id{-1};
|
||||
qint64 accountId{-1}; // -1 = global
|
||||
QString name;
|
||||
QString subject;
|
||||
QString bodyHtml;
|
||||
QString bodyText;
|
||||
QVector<TemplateVariable> variables;
|
||||
bool isDefault{false};
|
||||
QDateTime createdAt;
|
||||
QDateTime updatedAt;
|
||||
|
||||
bool isGlobal() const { return accountId < 0; }
|
||||
bool isValid() const { return id >= 0 && !name.isEmpty(); }
|
||||
|
||||
QJsonObject toJson() const;
|
||||
static Template fromJson(const QJsonObject& obj);
|
||||
};
|
||||
|
||||
class TemplateDao
|
||||
{
|
||||
public:
|
||||
static bool insert(Template& tmpl);
|
||||
static bool update(const Template& tmpl);
|
||||
static bool remove(qint64 id);
|
||||
static std::optional<Template> findById(qint64 id);
|
||||
static QVector<Template> findByAccount(qint64 accountId); // accountId = -1 for global
|
||||
static QVector<Template> findGlobal();
|
||||
static QVector<Template> findAll();
|
||||
static std::optional<Template> findDefault(qint64 accountId);
|
||||
static bool setDefault(qint64 id, bool isDefault);
|
||||
};
|
||||
Reference in New Issue
Block a user