2026-05-17 01:09:01 +02:00
|
|
|
import QtQuick 2.15
|
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id: mailListPage
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
2026-05-17 01:52:34 +02:00
|
|
|
// Models
|
|
|
|
|
FolderListModel {
|
|
|
|
|
id: folderModel
|
|
|
|
|
}
|
|
|
|
|
EmailListModel {
|
|
|
|
|
id: emailModel
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-17 02:28:15 +02:00
|
|
|
// Signals
|
|
|
|
|
signal emailSelected(int emailId)
|
|
|
|
|
signal composeRequested
|
|
|
|
|
|
|
|
|
|
// Header
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: header
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
height: 50
|
|
|
|
|
color: "#1976D2"
|
|
|
|
|
|
|
|
|
|
// Title
|
|
|
|
|
Text {
|
|
|
|
|
text: qsTr("Wino Mail")
|
|
|
|
|
color: "white"
|
|
|
|
|
font.pointSize: 18
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.leftMargin: 16
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Compose button
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: composeButton
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.margins: 10
|
|
|
|
|
width: 40
|
|
|
|
|
height: 40
|
|
|
|
|
color: "#e0e0e0"
|
|
|
|
|
radius: 5
|
|
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
onClicked: {
|
|
|
|
|
mailListPage.composeRequested()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Text {
|
|
|
|
|
text: "✎"
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
font.pointSize: 20
|
|
|
|
|
color: "#333"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Main content: SplitView for folder list and email list
|
2026-05-17 01:09:01 +02:00
|
|
|
SplitView {
|
2026-05-17 02:28:15 +02:00
|
|
|
anchors {
|
|
|
|
|
top: header.bottom
|
|
|
|
|
bottom: parent.bottom
|
|
|
|
|
left: parent.left
|
|
|
|
|
right: parent.right
|
|
|
|
|
}
|
2026-05-17 01:09:01 +02:00
|
|
|
|
|
|
|
|
// Left pane: Folder list
|
|
|
|
|
Rectangle {
|
|
|
|
|
width: 200
|
|
|
|
|
color: "#fafafa"
|
|
|
|
|
ListView {
|
|
|
|
|
id: folderListView
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
clip: true
|
2026-05-17 01:52:34 +02:00
|
|
|
model: folderModel
|
2026-05-17 01:09:01 +02:00
|
|
|
delegate: Item {
|
|
|
|
|
height: 40
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Rectangle {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
color: ListView.isCurrentItem ? "#e3f2fd" : "transparent"
|
|
|
|
|
Text {
|
|
|
|
|
text: folderName
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.leftMargin: 16
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
font.pointSize: 14
|
|
|
|
|
color: ListView.isCurrentItem ? "#1976d2" : "#666"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
onClicked: {
|
|
|
|
|
folderListView.currentIndex = index
|
2026-05-17 01:52:34 +02:00
|
|
|
// Load emails for selected folder
|
|
|
|
|
// For now, we'll map folder names to IDs (hardcoded for demo)
|
|
|
|
|
var folderId = 0; // Inbox
|
|
|
|
|
switch (folderName) {
|
|
|
|
|
case "Inbox": folderId = 0; break;
|
|
|
|
|
case "Sent": folderId = 1; break;
|
|
|
|
|
case "Drafts": folderId = 2; break;
|
|
|
|
|
case "Trash": folderId = 3; break;
|
|
|
|
|
case "Spam": folderId = 4; break;
|
|
|
|
|
default: folderId = 0;
|
|
|
|
|
}
|
|
|
|
|
emailModel.setFolderId(folderId);
|
2026-05-17 01:09:01 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-17 02:28:15 +02:00
|
|
|
// Right pane: Email list (full height)
|
2026-05-17 01:09:01 +02:00
|
|
|
Rectangle {
|
|
|
|
|
color: "#fafafa"
|
2026-05-17 02:28:15 +02:00
|
|
|
ListView {
|
|
|
|
|
id: emailListView
|
2026-05-17 01:09:01 +02:00
|
|
|
anchors.fill: parent
|
2026-05-17 02:28:15 +02:00
|
|
|
clip: true
|
|
|
|
|
model: emailModel
|
|
|
|
|
delegate: Item {
|
|
|
|
|
height: 60
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Rectangle {
|
2026-05-17 01:09:01 +02:00
|
|
|
anchors.fill: parent
|
2026-05-17 02:28:15 +02:00
|
|
|
color: ListView.isCurrentItem ? "#e3f2fd" : "transparent"
|
|
|
|
|
RowLayout {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
anchors.margins: 8
|
|
|
|
|
// Sender avatar/initial
|
2026-05-17 01:09:01 +02:00
|
|
|
Rectangle {
|
2026-05-17 02:28:15 +02:00
|
|
|
width: 40
|
|
|
|
|
height: 40
|
|
|
|
|
color: "#cccccc"
|
|
|
|
|
Text {
|
|
|
|
|
text: senderInitial
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
font.pointSize: 16
|
|
|
|
|
color: "#666"
|
2026-05-17 01:09:01 +02:00
|
|
|
}
|
|
|
|
|
}
|
2026-05-17 02:28:15 +02:00
|
|
|
ColumnLayout {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
spacing: 4
|
|
|
|
|
Text {
|
|
|
|
|
text: senderName
|
|
|
|
|
font.pointSize: 14
|
|
|
|
|
color: "#333"
|
|
|
|
|
elide: Text.ElideRight
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
}
|
|
|
|
|
Text {
|
|
|
|
|
text: subject
|
|
|
|
|
font.pointSize: 13
|
|
|
|
|
color: "#666"
|
|
|
|
|
elide: Text.ElideRight
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
}
|
|
|
|
|
Text {
|
|
|
|
|
text: time
|
|
|
|
|
font.pointSize: 12
|
|
|
|
|
color: "#999"
|
2026-05-17 01:09:01 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-05-17 02:28:15 +02:00
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
onClicked: {
|
|
|
|
|
emailListView.currentIndex = index
|
|
|
|
|
// Emit signal with email id
|
|
|
|
|
emailSelected(model.id)
|
|
|
|
|
}
|
2026-05-17 01:09:01 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|