mailmodel 0.1.5

A proof-of-concept mail viewer writting with Qt using QML
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.2

Item {
    readonly property var currentUid: folder.currentIndex >= 0 ? folder.model.uid(folder.currentIndex) : undefined
    Layout.preferredWidth: 300
    ScrollView {
        anchors.fill: parent
        verticalScrollBarPolicy: Qt.ScrollBarAsNeeded
        horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff

        ListView {
            id: folder
            model: imapmodel.folder
            keyNavigationEnabled: true
            highlightMoveVelocity: 100000
            focus: true
            delegate: delegate
        }
    }
    Component {
        id: delegate
        Rectangle {
            property color textColor: (folder.currentIndex === index)
                    ? palette.highlightedText
                    : palette.text
            height: 3 * s.font.pixelSize
            width: parent.width
            color: (folder.currentIndex === index) ? palette.highlight
                    :index % 2 == 0 ? palette.base : palette.alternateBase
            Text {
                id: s
                text: subject || ""
                color: textColor
                textFormat: Text.PlainText
                anchors.left: parent.left
                anchors.right: parent.right
                anchors.top: parent.top
                elide: Text.ElideRight
            }
            Text {
                id: f
                text: from || ""
                color: textColor
                textFormat: Text.PlainText
                width: s.width - d.width
                anchors.top: s.bottom
                anchors.left: parent.left
                anchors.bottom: parent.bottom
                font.italic: true
                elide: Text.ElideRight
            }
            Text {
                id: d
                text: date || ""
                color: textColor
                textFormat: Text.PlainText
                width: contentWidth
                anchors.top: s.bottom
                anchors.right: parent.right
                anchors.bottom: parent.bottom
                font.italic: true
                horizontalAlignment: Text.AlignRight
            }
            MouseArea {
                anchors.fill: parent
                onClicked: folder.currentIndex = index
            }
        }
    }
}