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:
@@ -45,9 +45,24 @@ template <> constexpr inline auto MailListView::qt_create_metaobjectdata<qt_meta
|
||||
"mailId",
|
||||
"emailOpenRequested",
|
||||
"composeRequested",
|
||||
"flagRequested",
|
||||
"deleteRequested",
|
||||
"categoryRequested",
|
||||
"moreRequested",
|
||||
"QPoint",
|
||||
"globalPos",
|
||||
"onRowSelected",
|
||||
"QModelIndex",
|
||||
"index"
|
||||
"index",
|
||||
"onSearchTextChanged",
|
||||
"text",
|
||||
"onFilterChanged",
|
||||
"onGroupByChanged",
|
||||
"onCompactFlagRequested",
|
||||
"onCompactDeleteRequested",
|
||||
"onCompactCategoryRequested",
|
||||
"onCompactMoreRequested",
|
||||
"onCompactMailClicked"
|
||||
};
|
||||
|
||||
QtMocHelpers::UintData qt_methods {
|
||||
@@ -61,9 +76,55 @@ template <> constexpr inline auto MailListView::qt_create_metaobjectdata<qt_meta
|
||||
}}),
|
||||
// Signal 'composeRequested'
|
||||
QtMocHelpers::SignalData<void()>(5, 2, QMC::AccessPublic, QMetaType::Void),
|
||||
// Signal 'flagRequested'
|
||||
QtMocHelpers::SignalData<void(int)>(6, 2, QMC::AccessPublic, QMetaType::Void, {{
|
||||
{ QMetaType::Int, 3 },
|
||||
}}),
|
||||
// Signal 'deleteRequested'
|
||||
QtMocHelpers::SignalData<void(int)>(7, 2, QMC::AccessPublic, QMetaType::Void, {{
|
||||
{ QMetaType::Int, 3 },
|
||||
}}),
|
||||
// Signal 'categoryRequested'
|
||||
QtMocHelpers::SignalData<void(int)>(8, 2, QMC::AccessPublic, QMetaType::Void, {{
|
||||
{ QMetaType::Int, 3 },
|
||||
}}),
|
||||
// Signal 'moreRequested'
|
||||
QtMocHelpers::SignalData<void(int, const QPoint &)>(9, 2, QMC::AccessPublic, QMetaType::Void, {{
|
||||
{ QMetaType::Int, 3 }, { 0x80000000 | 10, 11 },
|
||||
}}),
|
||||
// Slot 'onRowSelected'
|
||||
QtMocHelpers::SlotData<void(const QModelIndex &)>(6, 2, QMC::AccessPrivate, QMetaType::Void, {{
|
||||
{ 0x80000000 | 7, 8 },
|
||||
QtMocHelpers::SlotData<void(const QModelIndex &)>(12, 2, QMC::AccessPrivate, QMetaType::Void, {{
|
||||
{ 0x80000000 | 13, 14 },
|
||||
}}),
|
||||
// Slot 'onSearchTextChanged'
|
||||
QtMocHelpers::SlotData<void(const QString &)>(15, 2, QMC::AccessPrivate, QMetaType::Void, {{
|
||||
{ QMetaType::QString, 16 },
|
||||
}}),
|
||||
// Slot 'onFilterChanged'
|
||||
QtMocHelpers::SlotData<void()>(17, 2, QMC::AccessPrivate, QMetaType::Void),
|
||||
// Slot 'onGroupByChanged'
|
||||
QtMocHelpers::SlotData<void(int)>(18, 2, QMC::AccessPrivate, QMetaType::Void, {{
|
||||
{ QMetaType::Int, 14 },
|
||||
}}),
|
||||
// Slot 'onCompactFlagRequested'
|
||||
QtMocHelpers::SlotData<void(int)>(19, 2, QMC::AccessPrivate, QMetaType::Void, {{
|
||||
{ QMetaType::Int, 3 },
|
||||
}}),
|
||||
// Slot 'onCompactDeleteRequested'
|
||||
QtMocHelpers::SlotData<void(int)>(20, 2, QMC::AccessPrivate, QMetaType::Void, {{
|
||||
{ QMetaType::Int, 3 },
|
||||
}}),
|
||||
// Slot 'onCompactCategoryRequested'
|
||||
QtMocHelpers::SlotData<void(int)>(21, 2, QMC::AccessPrivate, QMetaType::Void, {{
|
||||
{ QMetaType::Int, 3 },
|
||||
}}),
|
||||
// Slot 'onCompactMoreRequested'
|
||||
QtMocHelpers::SlotData<void(int, const QPoint &)>(22, 2, QMC::AccessPrivate, QMetaType::Void, {{
|
||||
{ QMetaType::Int, 3 }, { 0x80000000 | 10, 11 },
|
||||
}}),
|
||||
// Slot 'onCompactMailClicked'
|
||||
QtMocHelpers::SlotData<void(int)>(23, 2, QMC::AccessPrivate, QMetaType::Void, {{
|
||||
{ QMetaType::Int, 3 },
|
||||
}}),
|
||||
};
|
||||
QtMocHelpers::UintData qt_properties {
|
||||
@@ -91,7 +152,19 @@ void MailListView::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id
|
||||
case 0: _t->emailSelected((*reinterpret_cast<std::add_pointer_t<int>>(_a[1]))); break;
|
||||
case 1: _t->emailOpenRequested((*reinterpret_cast<std::add_pointer_t<int>>(_a[1]))); break;
|
||||
case 2: _t->composeRequested(); break;
|
||||
case 3: _t->onRowSelected((*reinterpret_cast<std::add_pointer_t<QModelIndex>>(_a[1]))); break;
|
||||
case 3: _t->flagRequested((*reinterpret_cast<std::add_pointer_t<int>>(_a[1]))); break;
|
||||
case 4: _t->deleteRequested((*reinterpret_cast<std::add_pointer_t<int>>(_a[1]))); break;
|
||||
case 5: _t->categoryRequested((*reinterpret_cast<std::add_pointer_t<int>>(_a[1]))); break;
|
||||
case 6: _t->moreRequested((*reinterpret_cast<std::add_pointer_t<int>>(_a[1])),(*reinterpret_cast<std::add_pointer_t<QPoint>>(_a[2]))); break;
|
||||
case 7: _t->onRowSelected((*reinterpret_cast<std::add_pointer_t<QModelIndex>>(_a[1]))); break;
|
||||
case 8: _t->onSearchTextChanged((*reinterpret_cast<std::add_pointer_t<QString>>(_a[1]))); break;
|
||||
case 9: _t->onFilterChanged(); break;
|
||||
case 10: _t->onGroupByChanged((*reinterpret_cast<std::add_pointer_t<int>>(_a[1]))); break;
|
||||
case 11: _t->onCompactFlagRequested((*reinterpret_cast<std::add_pointer_t<int>>(_a[1]))); break;
|
||||
case 12: _t->onCompactDeleteRequested((*reinterpret_cast<std::add_pointer_t<int>>(_a[1]))); break;
|
||||
case 13: _t->onCompactCategoryRequested((*reinterpret_cast<std::add_pointer_t<int>>(_a[1]))); break;
|
||||
case 14: _t->onCompactMoreRequested((*reinterpret_cast<std::add_pointer_t<int>>(_a[1])),(*reinterpret_cast<std::add_pointer_t<QPoint>>(_a[2]))); break;
|
||||
case 15: _t->onCompactMailClicked((*reinterpret_cast<std::add_pointer_t<int>>(_a[1]))); break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
@@ -102,6 +175,14 @@ void MailListView::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id
|
||||
return;
|
||||
if (QtMocHelpers::indexOfMethod<void (MailListView::*)()>(_a, &MailListView::composeRequested, 2))
|
||||
return;
|
||||
if (QtMocHelpers::indexOfMethod<void (MailListView::*)(int )>(_a, &MailListView::flagRequested, 3))
|
||||
return;
|
||||
if (QtMocHelpers::indexOfMethod<void (MailListView::*)(int )>(_a, &MailListView::deleteRequested, 4))
|
||||
return;
|
||||
if (QtMocHelpers::indexOfMethod<void (MailListView::*)(int )>(_a, &MailListView::categoryRequested, 5))
|
||||
return;
|
||||
if (QtMocHelpers::indexOfMethod<void (MailListView::*)(int , const QPoint & )>(_a, &MailListView::moreRequested, 6))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,14 +205,14 @@ int MailListView::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||
if (_id < 0)
|
||||
return _id;
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
if (_id < 4)
|
||||
if (_id < 16)
|
||||
qt_static_metacall(this, _c, _id, _a);
|
||||
_id -= 4;
|
||||
_id -= 16;
|
||||
}
|
||||
if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
|
||||
if (_id < 4)
|
||||
if (_id < 16)
|
||||
*reinterpret_cast<QMetaType *>(_a[0]) = QMetaType();
|
||||
_id -= 4;
|
||||
_id -= 16;
|
||||
}
|
||||
return _id;
|
||||
}
|
||||
@@ -153,4 +234,28 @@ void MailListView::composeRequested()
|
||||
{
|
||||
QMetaObject::activate(this, &staticMetaObject, 2, nullptr);
|
||||
}
|
||||
|
||||
// SIGNAL 3
|
||||
void MailListView::flagRequested(int _t1)
|
||||
{
|
||||
QMetaObject::activate<void>(this, &staticMetaObject, 3, nullptr, _t1);
|
||||
}
|
||||
|
||||
// SIGNAL 4
|
||||
void MailListView::deleteRequested(int _t1)
|
||||
{
|
||||
QMetaObject::activate<void>(this, &staticMetaObject, 4, nullptr, _t1);
|
||||
}
|
||||
|
||||
// SIGNAL 5
|
||||
void MailListView::categoryRequested(int _t1)
|
||||
{
|
||||
QMetaObject::activate<void>(this, &staticMetaObject, 5, nullptr, _t1);
|
||||
}
|
||||
|
||||
// SIGNAL 6
|
||||
void MailListView::moreRequested(int _t1, const QPoint & _t2)
|
||||
{
|
||||
QMetaObject::activate<void>(this, &staticMetaObject, 6, nullptr, _t1, _t2);
|
||||
}
|
||||
QT_WARNING_POP
|
||||
|
||||
Reference in New Issue
Block a user